@nectary/components 5.29.2 → 5.31.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/bundle.js CHANGED
@@ -2348,9 +2348,12 @@ class Button extends NectaryElement {
2348
2348
  super.connectedCallback();
2349
2349
  this.#controller = new AbortController();
2350
2350
  const { signal } = this.#controller;
2351
- this.setAttribute("role", "button");
2352
- this.#internals.role = "button";
2353
- this.tabIndex = 0;
2351
+ if (!this.hasAttribute("tabindex")) {
2352
+ this.setAttribute("tabindex", "0");
2353
+ }
2354
+ if (!this.hasAttribute("role")) {
2355
+ this.setAttribute("role", "button");
2356
+ }
2354
2357
  this.addEventListener("click", this.#onButtonClick, { signal });
2355
2358
  this.addEventListener("focus", this.#onButtonFocus, { signal });
2356
2359
  this.addEventListener("blur", this.#onButtonBlur, { signal });
@@ -2374,7 +2377,9 @@ class Button extends NectaryElement {
2374
2377
  "toggled",
2375
2378
  "size",
2376
2379
  "data-size",
2377
- "data-managed-aria-disabled"
2380
+ "data-managed-aria-disabled",
2381
+ "role",
2382
+ "tabindex"
2378
2383
  ];
2379
2384
  }
2380
2385
  attributeChangedCallback(name, oldVal, newVal) {
@@ -2412,6 +2417,33 @@ class Button extends NectaryElement {
2412
2417
  this.#onSizeUpdate();
2413
2418
  break;
2414
2419
  }
2420
+ case "role": {
2421
+ if (isAttrEqual(oldVal, newVal)) {
2422
+ break;
2423
+ }
2424
+ const effectiveRole = newVal !== null && newVal !== "" ? newVal : "button";
2425
+ this.#internals.role = effectiveRole;
2426
+ if (newVal === null || newVal === "") {
2427
+ this.setAttribute("role", "button");
2428
+ }
2429
+ break;
2430
+ }
2431
+ case "tabindex": {
2432
+ if (newVal === null) {
2433
+ if (this.isDomConnected) {
2434
+ this.setAttribute("tabindex", "0");
2435
+ }
2436
+ break;
2437
+ }
2438
+ if (isAttrEqual(oldVal, newVal)) {
2439
+ break;
2440
+ }
2441
+ const parsed = Number.parseInt(newVal, 10);
2442
+ if (Number.isNaN(parsed)) {
2443
+ this.setAttribute("tabindex", "0");
2444
+ }
2445
+ break;
2446
+ }
2415
2447
  }
2416
2448
  }
2417
2449
  set type(value) {
@@ -12567,7 +12599,7 @@ class SelectButton extends NectaryElement {
12567
12599
  };
12568
12600
  }
12569
12601
  defineCustomElement("sinch-select-button", SelectButton);
12570
- const templateHTML$i = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;min-height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;background-color:var(--sinch-comp-select-menu-color-default-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-select-menu-size-icon)}#content{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-option)}#icon-check{display:none;margin-right:-6px}:host([data-checked]) #icon-check{display:block}:host([data-selected])>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-selected)}:host(:hover)>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-hover)}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;background-color:var(--sinch-comp-select-menu-color-disabled-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-disabled-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-disabled-icon-initial)}::slotted([slot=icon]){margin-left:-6px}::slotted([slot=content]){pointer-events:none;flex:1}</style><div id="wrapper"><slot name="icon"></slot><slot name="content"></slot><sinch-text id="content" type="m" ellipsis></sinch-text><sinch-icon icons-version="2" name="fa-check" id="icon-check"></sinch-icon></div>';
12602
+ const templateHTML$i = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;min-height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;background-color:var(--sinch-comp-select-menu-color-default-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-select-menu-size-icon)}#content{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-option)}#icon-check{display:none;margin-right:-6px}:host([data-checked]:not([action])) #icon-check{display:block}:host([data-selected])>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-selected)}:host(:hover)>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-hover)}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;background-color:var(--sinch-comp-select-menu-color-disabled-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-disabled-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-disabled-icon-initial)}::slotted([slot=icon]){margin-left:-6px}::slotted([slot=content]){pointer-events:none;flex:1}</style><div id="wrapper"><slot name="icon"></slot><slot name="content"></slot><sinch-text id="content" type="m" ellipsis></sinch-text><sinch-icon icons-version="2" name="fa-check" id="icon-check"></sinch-icon></div>';
12571
12603
  const template$i = document.createElement("template");
12572
12604
  template$i.innerHTML = templateHTML$i;
12573
12605
  class SelectMenuOption extends NectaryElement {
@@ -12633,6 +12665,12 @@ class SelectMenuOption extends NectaryElement {
12633
12665
  get disabled() {
12634
12666
  return getBooleanAttribute(this, "disabled");
12635
12667
  }
12668
+ set action(isAction) {
12669
+ updateBooleanAttribute(this, "action", isAction);
12670
+ }
12671
+ get action() {
12672
+ return getBooleanAttribute(this, "action");
12673
+ }
12636
12674
  matchesSearch(searchValue) {
12637
12675
  return this.text.toLowerCase().includes(searchValue.toLowerCase());
12638
12676
  }
@@ -12704,6 +12742,7 @@ class SelectMenu extends NectaryElement {
12704
12742
  options
12705
12743
  );
12706
12744
  this.addEventListener("-change", this.#onChangeReactHandler, options);
12745
+ this.addEventListener("-action", this.#onActionReactHandler, options);
12707
12746
  subscribeContext(
12708
12747
  this,
12709
12748
  "keydown",
@@ -12862,7 +12901,7 @@ class SelectMenu extends NectaryElement {
12862
12901
  this.focus();
12863
12902
  if (!isTargetEqual(e, this.#$listbox) && !getBooleanAttribute($elem, "disabled")) {
12864
12903
  this.#selectOption($elem);
12865
- this.#dispatchChangeEvent($elem);
12904
+ this.#handleDispatch($elem);
12866
12905
  }
12867
12906
  };
12868
12907
  #onSearchChange = (e) => {
@@ -12927,7 +12966,7 @@ class SelectMenu extends NectaryElement {
12927
12966
  const $option = this.#findSelectedOption();
12928
12967
  if ($option !== null) {
12929
12968
  e.preventDefault();
12930
- this.#dispatchChangeEvent($option);
12969
+ this.#handleDispatch($option);
12931
12970
  }
12932
12971
  break;
12933
12972
  }
@@ -12943,6 +12982,13 @@ class SelectMenu extends NectaryElement {
12943
12982
  }
12944
12983
  }
12945
12984
  }
12985
+ #handleDispatch = (option) => {
12986
+ if (getBooleanAttribute(option, "action")) {
12987
+ this.#dispatchActionEvent(option);
12988
+ } else {
12989
+ this.#dispatchChangeEvent(option);
12990
+ }
12991
+ };
12946
12992
  #onOptionSlotChange = () => {
12947
12993
  const searchable = this.searchable;
12948
12994
  const options = this.#getOptionElements();
@@ -12958,7 +13004,7 @@ class SelectMenu extends NectaryElement {
12958
13004
  if (this.multiple) {
12959
13005
  const values = unpackCsv(csv);
12960
13006
  for (const $option of this.#getOptionElements()) {
12961
- const isChecked = !getBooleanAttribute($option, "disabled") && values.includes(getAttribute($option, "value", ""));
13007
+ const isChecked = !getBooleanAttribute($option, "disabled") && !getBooleanAttribute($option, "action") && values.includes(getAttribute($option, "value", ""));
12962
13008
  updateBooleanAttribute($option, "data-checked", isChecked);
12963
13009
  }
12964
13010
  const formData = new FormData();
@@ -12969,7 +13015,7 @@ class SelectMenu extends NectaryElement {
12969
13015
  } else {
12970
13016
  const value = getFirstCsvValue(csv);
12971
13017
  for (const $option of this.#getOptionElements()) {
12972
- const isChecked = !getBooleanAttribute($option, "disabled") && value === getAttribute($option, "value", "");
13018
+ const isChecked = !getBooleanAttribute($option, "disabled") && !getBooleanAttribute($option, "action") && value === getAttribute($option, "value", "");
12973
13019
  updateBooleanAttribute($option, "data-checked", isChecked);
12974
13020
  }
12975
13021
  setFormValue(this.#internals, value ?? "");
@@ -13058,7 +13104,7 @@ class SelectMenu extends NectaryElement {
13058
13104
  const elements = this.#getOptionElements();
13059
13105
  const value = this.multiple ? getFirstCsvValue(this.value) : this.value;
13060
13106
  for (const $el of elements) {
13061
- if (!getBooleanAttribute($el, "disabled") && getAttribute($el, "value") === value) {
13107
+ if (!getBooleanAttribute($el, "disabled") && !getBooleanAttribute($el, "action") && getAttribute($el, "value") === value) {
13062
13108
  return $el;
13063
13109
  }
13064
13110
  }
@@ -13076,10 +13122,17 @@ class SelectMenu extends NectaryElement {
13076
13122
  ) : value;
13077
13123
  this.dispatchEvent(new CustomEvent("-change", { detail: result }));
13078
13124
  }
13125
+ #dispatchActionEvent($opt) {
13126
+ this.dispatchEvent(new CustomEvent("-action", { detail: $opt.value }));
13127
+ }
13079
13128
  #onChangeReactHandler = (e) => {
13080
13129
  getReactEventHandler(this, "on-change")?.(e);
13081
13130
  getReactEventHandler(this, "onChange")?.(e);
13082
13131
  };
13132
+ #onActionReactHandler = (e) => {
13133
+ getReactEventHandler(this, "on-action")?.(e);
13134
+ getReactEventHandler(this, "onAction")?.(e);
13135
+ };
13083
13136
  #onSearchChangeReactHandler = (e) => {
13084
13137
  getReactEventHandler(this, "on-search-change")?.(e);
13085
13138
  getReactEventHandler(this, "onSearchChange")?.(e);
package/button/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Context, subscribeContext } from "../utils/context.js";
2
- import { updateAttribute, isAttrEqual, updateBooleanAttribute, isAttrTrue, updateLiteralAttribute, getLiteralAttribute, getAttribute, getBooleanAttribute } from "../utils/dom.js";
2
+ import { isAttrEqual, updateAttribute, updateBooleanAttribute, isAttrTrue, updateLiteralAttribute, getLiteralAttribute, getAttribute, getBooleanAttribute } from "../utils/dom.js";
3
3
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
4
4
  import { getReactEventHandler } from "../utils/get-react-event-handler.js";
5
5
  import { requestSubmitForm } from "../utils/form.js";
@@ -28,9 +28,12 @@ class Button extends NectaryElement {
28
28
  super.connectedCallback();
29
29
  this.#controller = new AbortController();
30
30
  const { signal } = this.#controller;
31
- this.setAttribute("role", "button");
32
- this.#internals.role = "button";
33
- this.tabIndex = 0;
31
+ if (!this.hasAttribute("tabindex")) {
32
+ this.setAttribute("tabindex", "0");
33
+ }
34
+ if (!this.hasAttribute("role")) {
35
+ this.setAttribute("role", "button");
36
+ }
34
37
  this.addEventListener("click", this.#onButtonClick, { signal });
35
38
  this.addEventListener("focus", this.#onButtonFocus, { signal });
36
39
  this.addEventListener("blur", this.#onButtonBlur, { signal });
@@ -54,7 +57,9 @@ class Button extends NectaryElement {
54
57
  "toggled",
55
58
  "size",
56
59
  "data-size",
57
- "data-managed-aria-disabled"
60
+ "data-managed-aria-disabled",
61
+ "role",
62
+ "tabindex"
58
63
  ];
59
64
  }
60
65
  attributeChangedCallback(name, oldVal, newVal) {
@@ -92,6 +97,33 @@ class Button extends NectaryElement {
92
97
  this.#onSizeUpdate();
93
98
  break;
94
99
  }
100
+ case "role": {
101
+ if (isAttrEqual(oldVal, newVal)) {
102
+ break;
103
+ }
104
+ const effectiveRole = newVal !== null && newVal !== "" ? newVal : "button";
105
+ this.#internals.role = effectiveRole;
106
+ if (newVal === null || newVal === "") {
107
+ this.setAttribute("role", "button");
108
+ }
109
+ break;
110
+ }
111
+ case "tabindex": {
112
+ if (newVal === null) {
113
+ if (this.isDomConnected) {
114
+ this.setAttribute("tabindex", "0");
115
+ }
116
+ break;
117
+ }
118
+ if (isAttrEqual(oldVal, newVal)) {
119
+ break;
120
+ }
121
+ const parsed = Number.parseInt(newVal, 10);
122
+ if (Number.isNaN(parsed)) {
123
+ this.setAttribute("tabindex", "0");
124
+ }
125
+ break;
126
+ }
95
127
  }
96
128
  }
97
129
  set type(value) {
package/button/types.d.ts CHANGED
@@ -5,6 +5,10 @@ export type TSinchButtonType = 'primary' | 'secondary'
5
5
  /** @deprecated */
6
6
  | 'tertiary' | 'subtle-primary' | 'subtle-secondary' | 'cta-primary' | 'cta-secondary' | 'destructive';
7
7
  export type TSinchButtonProps = {
8
+ /** ARIA role, `button` by default. Curated union for common use cases; hosts can still set other roles in HTML. */
9
+ role?: 'button' | 'tab' | 'menuitem' | 'switch' | 'link' | 'option';
10
+ /** Keyboard navigation order, `0` by default */
11
+ tabIndex?: number;
8
12
  /** Button Type */
9
13
  type?: TSinchButtonType;
10
14
  /** Size, `m` by default */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.29.2",
3
+ "version": "5.31.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -71,6 +71,7 @@ class SelectMenu extends NectaryElement {
71
71
  options
72
72
  );
73
73
  this.addEventListener("-change", this.#onChangeReactHandler, options);
74
+ this.addEventListener("-action", this.#onActionReactHandler, options);
74
75
  subscribeContext(
75
76
  this,
76
77
  "keydown",
@@ -229,7 +230,7 @@ class SelectMenu extends NectaryElement {
229
230
  this.focus();
230
231
  if (!isTargetEqual(e, this.#$listbox) && !getBooleanAttribute($elem, "disabled")) {
231
232
  this.#selectOption($elem);
232
- this.#dispatchChangeEvent($elem);
233
+ this.#handleDispatch($elem);
233
234
  }
234
235
  };
235
236
  #onSearchChange = (e) => {
@@ -294,7 +295,7 @@ class SelectMenu extends NectaryElement {
294
295
  const $option = this.#findSelectedOption();
295
296
  if ($option !== null) {
296
297
  e.preventDefault();
297
- this.#dispatchChangeEvent($option);
298
+ this.#handleDispatch($option);
298
299
  }
299
300
  break;
300
301
  }
@@ -310,6 +311,13 @@ class SelectMenu extends NectaryElement {
310
311
  }
311
312
  }
312
313
  }
314
+ #handleDispatch = (option) => {
315
+ if (getBooleanAttribute(option, "action")) {
316
+ this.#dispatchActionEvent(option);
317
+ } else {
318
+ this.#dispatchChangeEvent(option);
319
+ }
320
+ };
313
321
  #onOptionSlotChange = () => {
314
322
  const searchable = this.searchable;
315
323
  const options = this.#getOptionElements();
@@ -325,7 +333,7 @@ class SelectMenu extends NectaryElement {
325
333
  if (this.multiple) {
326
334
  const values = unpackCsv(csv);
327
335
  for (const $option of this.#getOptionElements()) {
328
- const isChecked = !getBooleanAttribute($option, "disabled") && values.includes(getAttribute($option, "value", ""));
336
+ const isChecked = !getBooleanAttribute($option, "disabled") && !getBooleanAttribute($option, "action") && values.includes(getAttribute($option, "value", ""));
329
337
  updateBooleanAttribute($option, "data-checked", isChecked);
330
338
  }
331
339
  const formData = new FormData();
@@ -336,7 +344,7 @@ class SelectMenu extends NectaryElement {
336
344
  } else {
337
345
  const value = getFirstCsvValue(csv);
338
346
  for (const $option of this.#getOptionElements()) {
339
- const isChecked = !getBooleanAttribute($option, "disabled") && value === getAttribute($option, "value", "");
347
+ const isChecked = !getBooleanAttribute($option, "disabled") && !getBooleanAttribute($option, "action") && value === getAttribute($option, "value", "");
340
348
  updateBooleanAttribute($option, "data-checked", isChecked);
341
349
  }
342
350
  setFormValue(this.#internals, value ?? "");
@@ -425,7 +433,7 @@ class SelectMenu extends NectaryElement {
425
433
  const elements = this.#getOptionElements();
426
434
  const value = this.multiple ? getFirstCsvValue(this.value) : this.value;
427
435
  for (const $el of elements) {
428
- if (!getBooleanAttribute($el, "disabled") && getAttribute($el, "value") === value) {
436
+ if (!getBooleanAttribute($el, "disabled") && !getBooleanAttribute($el, "action") && getAttribute($el, "value") === value) {
429
437
  return $el;
430
438
  }
431
439
  }
@@ -443,10 +451,17 @@ class SelectMenu extends NectaryElement {
443
451
  ) : value;
444
452
  this.dispatchEvent(new CustomEvent("-change", { detail: result }));
445
453
  }
454
+ #dispatchActionEvent($opt) {
455
+ this.dispatchEvent(new CustomEvent("-action", { detail: $opt.value }));
456
+ }
446
457
  #onChangeReactHandler = (e) => {
447
458
  getReactEventHandler(this, "on-change")?.(e);
448
459
  getReactEventHandler(this, "onChange")?.(e);
449
460
  };
461
+ #onActionReactHandler = (e) => {
462
+ getReactEventHandler(this, "on-action")?.(e);
463
+ getReactEventHandler(this, "onAction")?.(e);
464
+ };
450
465
  #onSearchChangeReactHandler = (e) => {
451
466
  getReactEventHandler(this, "on-search-change")?.(e);
452
467
  getReactEventHandler(this, "onSearchChange")?.(e);
@@ -24,6 +24,8 @@ export type TSinchSelectMenuEvents = {
24
24
  '-search-change'?: (e: CustomEvent<string>) => void;
25
25
  /** Change value handler */
26
26
  '-change'?: (e: CustomEvent<string>) => void;
27
+ /** Action option activated handler — detail is the action option's value */
28
+ '-action'?: (e: CustomEvent<string>) => void;
27
29
  };
28
30
  export type TSinchSelectMenuStyle = {
29
31
  '--sinch-comp-select-menu-color-default-title-initial'?: string;
@@ -14,5 +14,7 @@ export declare class SelectMenuOption extends NectaryElement {
14
14
  get text(): string;
15
15
  set disabled(isDisabled: boolean);
16
16
  get disabled(): boolean;
17
+ set action(isAction: boolean);
18
+ get action(): boolean;
17
19
  matchesSearch(searchValue: string): boolean;
18
20
  }
@@ -2,7 +2,7 @@ import "../icon/index.js";
2
2
  import "../text/index.js";
3
3
  import { isAttrEqual, updateBooleanAttribute, isAttrTrue, updateExplicitBooleanAttribute, updateAttribute, getAttribute, getBooleanAttribute } from "../utils/dom.js";
4
4
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
5
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;min-height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;background-color:var(--sinch-comp-select-menu-color-default-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-select-menu-size-icon)}#content{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-option)}#icon-check{display:none;margin-right:-6px}:host([data-checked]) #icon-check{display:block}:host([data-selected])>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-selected)}:host(:hover)>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-hover)}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;background-color:var(--sinch-comp-select-menu-color-disabled-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-disabled-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-disabled-icon-initial)}::slotted([slot=icon]){margin-left:-6px}::slotted([slot=content]){pointer-events:none;flex:1}</style><div id="wrapper"><slot name="icon"></slot><slot name="content"></slot><sinch-text id="content" type="m" ellipsis></sinch-text><sinch-icon icons-version="2" name="fa-check" id="icon-check"></sinch-icon></div>';
5
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;position:relative;box-sizing:border-box;min-height:40px;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;background-color:var(--sinch-comp-select-menu-color-default-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-select-menu-size-icon)}#content{flex:1;min-width:0;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-option)}#icon-check{display:none;margin-right:-6px}:host([data-checked]:not([action])) #icon-check{display:block}:host([data-selected])>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-selected)}:host(:hover)>#wrapper{background-color:var(--sinch-comp-select-menu-color-default-background-hover)}:host([disabled])>#wrapper{cursor:initial;pointer-events:none;background-color:var(--sinch-comp-select-menu-color-disabled-background-initial);--sinch-global-color-text:var(--sinch-comp-select-menu-color-disabled-option-initial);--sinch-global-color-icon:var(--sinch-comp-select-menu-color-disabled-icon-initial)}::slotted([slot=icon]){margin-left:-6px}::slotted([slot=content]){pointer-events:none;flex:1}</style><div id="wrapper"><slot name="icon"></slot><slot name="content"></slot><sinch-text id="content" type="m" ellipsis></sinch-text><sinch-icon icons-version="2" name="fa-check" id="icon-check"></sinch-icon></div>';
6
6
  const template = document.createElement("template");
7
7
  template.innerHTML = templateHTML;
8
8
  class SelectMenuOption extends NectaryElement {
@@ -68,6 +68,12 @@ class SelectMenuOption extends NectaryElement {
68
68
  get disabled() {
69
69
  return getBooleanAttribute(this, "disabled");
70
70
  }
71
+ set action(isAction) {
72
+ updateBooleanAttribute(this, "action", isAction);
73
+ }
74
+ get action() {
75
+ return getBooleanAttribute(this, "action");
76
+ }
71
77
  matchesSearch(searchValue) {
72
78
  return this.text.toLowerCase().includes(searchValue.toLowerCase());
73
79
  }
@@ -6,6 +6,8 @@ export type TSinchSelectMenuOptionProps = {
6
6
  text: string;
7
7
  /** Disabled state */
8
8
  disabled?: boolean;
9
+ /** Marks this option as an action — activating it triggers an action event instead of changing the select value */
10
+ action?: boolean;
9
11
  /** Label that is used for a11y */
10
12
  'aria-label': string;
11
13
  };