@nectary/components 5.57.3 → 5.58.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.
package/alert/index.js CHANGED
@@ -4,7 +4,7 @@ import "../text/index.js";
4
4
  import { updateAttribute, getLiteralAttribute, updateLiteralAttribute, getAttribute } from "../utils/dom.js";
5
5
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
6
6
  import { typeValues } from "./utils.js";
7
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}#icon-error,#icon-info,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
7
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-alert-color-success-default-background)}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}#icon-success{--sinch-global-color-icon:var(--sinch-comp-alert-color-success-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-success-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-icon icons-version="2" name="circle-check" id="icon-success"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
8
8
  const template = document.createElement("template");
9
9
  template.innerHTML = templateHTML;
10
10
  class Alert extends NectaryElement {
package/alert/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { NectaryComponentReactByType, NectaryComponentVanillaByType, NectaryComponentReact, NectaryComponentVanilla } from '../types';
2
- export type TSinchAlertType = 'info' | 'warn' | 'error';
2
+ export type TSinchAlertType = 'info' | 'success' | 'warn' | 'error';
3
3
  export type TSinchAlertProps = {
4
4
  /** Type */
5
5
  type: TSinchAlertType;
@@ -16,6 +16,9 @@ export type TSinchAlertStyle = {
16
16
  '--sinch-comp-alert-color-info-default-background'?: string;
17
17
  '--sinch-comp-alert-color-info-default-icon'?: string;
18
18
  '--sinch-comp-alert-color-info-default-text'?: string;
19
+ '--sinch-comp-alert-color-success-default-background'?: string;
20
+ '--sinch-comp-alert-color-success-default-icon'?: string;
21
+ '--sinch-comp-alert-color-success-default-text'?: string;
19
22
  '--sinch-comp-alert-font-body'?: string;
20
23
  '--sinch-global-color-icon'?: string;
21
24
  '--sinch-global-color-text'?: string;
package/alert/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- const typeValues = ["info", "warn", "error"];
1
+ const typeValues = ["info", "success", "warn", "error"];
2
2
  export {
3
3
  typeValues
4
4
  };
package/bundle.js CHANGED
@@ -2172,8 +2172,8 @@ class RichText extends NectaryElement {
2172
2172
  };
2173
2173
  }
2174
2174
  defineCustomElement("sinch-rich-text", RichText);
2175
- const typeValues$5 = ["info", "warn", "error"];
2176
- const templateHTML$19 = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}#icon-error,#icon-info,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
2175
+ const typeValues$5 = ["info", "success", "warn", "error"];
2176
+ const templateHTML$19 = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-alert-color-success-default-background)}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}#icon-success{--sinch-global-color-icon:var(--sinch-comp-alert-color-success-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-success-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-icon icons-version="2" name="circle-check" id="icon-success"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
2177
2177
  const template$19 = document.createElement("template");
2178
2178
  template$19.innerHTML = templateHTML$19;
2179
2179
  class Alert extends NectaryElement {
@@ -8940,6 +8940,7 @@ class FieldV2 extends NectaryElement {
8940
8940
  #$tooltipWrapper;
8941
8941
  #$tooltipSlot;
8942
8942
  #controller = null;
8943
+ #writtenAriaLabel = null;
8943
8944
  constructor() {
8944
8945
  super();
8945
8946
  const shadowRoot = this.attachShadow();
@@ -9117,14 +9118,22 @@ class FieldV2 extends NectaryElement {
9117
9118
  }
9118
9119
  #syncInputAriaLabel(labelText) {
9119
9120
  const inputElement = getFirstSlotElement(this.#$inputSlot);
9121
+ const name = labelText ?? "";
9120
9122
  if (inputElement === null) {
9123
+ if (name.trim().length === 0) {
9124
+ this.#writtenAriaLabel = null;
9125
+ }
9121
9126
  return;
9122
9127
  }
9123
- if (labelText != null && labelText.length > 0) {
9124
- inputElement.setAttribute("aria-label", labelText);
9125
- } else {
9128
+ if (name.trim().length > 0) {
9129
+ inputElement.setAttribute("aria-label", name);
9130
+ this.#writtenAriaLabel = name;
9131
+ return;
9132
+ }
9133
+ if (this.#writtenAriaLabel !== null && inputElement.getAttribute("aria-label") === this.#writtenAriaLabel) {
9126
9134
  inputElement.removeAttribute("aria-label");
9127
9135
  }
9136
+ this.#writtenAriaLabel = null;
9128
9137
  }
9129
9138
  #syncInputDescription() {
9130
9139
  const inputElement = getFirstSlotElement(this.#$inputSlot);
package/field-v2/index.js CHANGED
@@ -54,6 +54,7 @@ class FieldV2 extends NectaryElement {
54
54
  #$tooltipWrapper;
55
55
  #$tooltipSlot;
56
56
  #controller = null;
57
+ #writtenAriaLabel = null;
57
58
  constructor() {
58
59
  super();
59
60
  const shadowRoot = this.attachShadow();
@@ -231,14 +232,22 @@ class FieldV2 extends NectaryElement {
231
232
  }
232
233
  #syncInputAriaLabel(labelText) {
233
234
  const inputElement = getFirstSlotElement(this.#$inputSlot);
235
+ const name = labelText ?? "";
234
236
  if (inputElement === null) {
237
+ if (name.trim().length === 0) {
238
+ this.#writtenAriaLabel = null;
239
+ }
235
240
  return;
236
241
  }
237
- if (labelText != null && labelText.length > 0) {
238
- inputElement.setAttribute("aria-label", labelText);
239
- } else {
242
+ if (name.trim().length > 0) {
243
+ inputElement.setAttribute("aria-label", name);
244
+ this.#writtenAriaLabel = name;
245
+ return;
246
+ }
247
+ if (this.#writtenAriaLabel !== null && inputElement.getAttribute("aria-label") === this.#writtenAriaLabel) {
240
248
  inputElement.removeAttribute("aria-label");
241
249
  }
250
+ this.#writtenAriaLabel = null;
242
251
  }
243
252
  #syncInputDescription() {
244
253
  const inputElement = getFirstSlotElement(this.#$inputSlot);
package/input/types.d.ts CHANGED
@@ -12,8 +12,8 @@ export type TSinchInputProps = {
12
12
  value?: string;
13
13
  /** Mask */
14
14
  mask?: string | null;
15
- /** Label that is used for a11y – might be different from `label` */
16
- 'aria-label': string;
15
+ /** Accessible name. May be omitted when a parent field `label` supplies the name. */
16
+ 'aria-label'?: string;
17
17
  /** Accessible description. Exposed on the native input through a description in this shadow root. */
18
18
  'aria-description'?: string;
19
19
  /** Text field type, `text` by default */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.57.3",
3
+ "version": "5.58.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.22.15",
27
- "@nectary/assets": "3.7.0"
27
+ "@nectary/assets": "3.7.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/cli": "^7.22.15",
@@ -41,6 +41,6 @@
41
41
  "vite": "^7.0.6"
42
42
  },
43
43
  "peerDependencies": {
44
- "@nectary/theme-base": "1.19.0"
44
+ "@nectary/theme-base": "1.20.0"
45
45
  }
46
46
  }