@aurodesignsystem/auro-formkit 5.8.1 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +4 -15
  2. package/README.md +4 -4
  3. package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
  4. package/components/bibtemplate/dist/index.js +2 -2
  5. package/components/bibtemplate/dist/registered.js +2 -2
  6. package/components/checkbox/demo/api.min.js +1 -1
  7. package/components/checkbox/demo/index.min.js +1 -1
  8. package/components/checkbox/dist/index.js +1 -1
  9. package/components/checkbox/dist/registered.js +1 -1
  10. package/components/combobox/demo/api.md +7 -6
  11. package/components/combobox/demo/api.min.js +1698 -1038
  12. package/components/combobox/demo/index.min.js +1698 -1038
  13. package/components/combobox/dist/auro-combobox.d.ts +10 -8
  14. package/components/combobox/dist/index.js +128 -149
  15. package/components/combobox/dist/registered.js +128 -149
  16. package/components/counter/demo/api.min.js +37 -61
  17. package/components/counter/demo/index.min.js +37 -61
  18. package/components/counter/dist/index.js +37 -61
  19. package/components/counter/dist/registered.js +37 -61
  20. package/components/datepicker/demo/api.min.js +55 -148
  21. package/components/datepicker/demo/index.min.js +55 -148
  22. package/components/datepicker/dist/auro-datepicker.d.ts +1 -1
  23. package/components/datepicker/dist/iconVersion.d.ts +1 -1
  24. package/components/datepicker/dist/index.js +55 -148
  25. package/components/datepicker/dist/popoverVersion.d.ts +1 -1
  26. package/components/datepicker/dist/registered.js +55 -148
  27. package/components/dropdown/demo/api.min.js +33 -57
  28. package/components/dropdown/demo/index.min.js +33 -57
  29. package/components/dropdown/dist/iconVersion.d.ts +1 -1
  30. package/components/dropdown/dist/index.js +33 -57
  31. package/components/dropdown/dist/registered.js +33 -57
  32. package/components/form/demo/working.html +1 -1
  33. package/components/input/demo/api.min.js +5 -4
  34. package/components/input/demo/index.min.js +5 -4
  35. package/components/input/dist/base-input.d.ts +1 -1
  36. package/components/input/dist/iconVersion.d.ts +1 -1
  37. package/components/input/dist/index.js +5 -4
  38. package/components/input/dist/registered.js +5 -4
  39. package/components/menu/demo/api.js +4 -0
  40. package/components/menu/demo/api.md +271 -31
  41. package/components/menu/demo/api.min.js +1609 -863
  42. package/components/menu/demo/index.html +1 -0
  43. package/components/menu/demo/index.js +2 -0
  44. package/components/menu/demo/index.md +95 -1
  45. package/components/menu/demo/index.min.js +1544 -812
  46. package/components/menu/dist/auro-menu.context.d.ts +227 -0
  47. package/components/menu/dist/auro-menu.d.ts +98 -53
  48. package/components/menu/dist/auro-menuoption.d.ts +116 -14
  49. package/components/menu/dist/index.js +1457 -796
  50. package/components/menu/dist/registered.js +1456 -807
  51. package/components/radio/demo/api.min.js +1 -1
  52. package/components/radio/demo/index.min.js +1 -1
  53. package/components/radio/dist/index.js +1 -1
  54. package/components/radio/dist/registered.js +1 -1
  55. package/components/select/demo/api.md +8 -7
  56. package/components/select/demo/api.min.js +1617 -1056
  57. package/components/select/demo/index.min.js +1617 -1056
  58. package/components/select/dist/auro-select.d.ts +11 -35
  59. package/components/select/dist/index.js +98 -218
  60. package/components/select/dist/registered.js +98 -218
  61. package/package.json +8 -2
@@ -0,0 +1,227 @@
1
+ export class MenuService {
2
+ /**
3
+ * CONSTRUCTOR
4
+ */
5
+ /**
6
+ * Creates a new MenuService instance.
7
+ * @param {Object} options - The options object.
8
+ * @param {AuroMenu} options.host - The host element that this service will control. Required.
9
+ * @throws {Error} If the host is not provided.
10
+ */
11
+ constructor({ host }?: {
12
+ host: AuroMenu;
13
+ });
14
+ /**
15
+ * PROPERTIES AND GETTERS
16
+ */
17
+ /**
18
+ * Gets the list of registered menu options.
19
+ * @returns {AuroMenuOption[]}
20
+ */
21
+ get menuOptions(): AuroMenuOption[];
22
+ /**
23
+ * Gets the currently highlighted option.
24
+ * @returns {AuroMenuOption|null}
25
+ */
26
+ get highlightedOption(): AuroMenuOption | null;
27
+ /**
28
+ * Gets the current value(s) of the selected option(s).
29
+ * @returns {string|string[]|undefined}
30
+ */
31
+ get currentValue(): string | string[] | undefined;
32
+ /**
33
+ * Gets the label(s) of the currently selected option(s).
34
+ * @returns {string}
35
+ */
36
+ get currentLabel(): string;
37
+ /**
38
+ * Gets the string representation of the current value(s).
39
+ * For multi-select, this is a JSON stringified array.
40
+ * @returns {string|undefined}
41
+ */
42
+ get stringValue(): string | undefined;
43
+ /**
44
+ * Gets the key(s) of the currently selected option(s).
45
+ * @returns {string|string[]|undefined}
46
+ */
47
+ get currentKeys(): string | string[] | undefined;
48
+ host: AuroMenu;
49
+ size: any;
50
+ shape: any;
51
+ noCheckmark: any;
52
+ disabled: any;
53
+ matchWord: any;
54
+ multiSelect: any;
55
+ allowDeselect: any;
56
+ selectAllMatchingOptions: any;
57
+ highlightedIndex: number;
58
+ _menuOptions: any[];
59
+ _subscribers: any[];
60
+ internalUpdateInProgress: boolean;
61
+ selectedOptions: any[];
62
+ /**
63
+ * PROPERTY SYNCING
64
+ */
65
+ /**
66
+ * Handles host updates.
67
+ * This is a lit reactive lifecycle method.
68
+ * This comes from the Lit controller interface provided by adding this service as a controller to the host.
69
+ * See constructor for `this.host.addController(this)`
70
+ * You can read more about Lit reactive controllers here: https://lit.dev/docs/composition/controllers/
71
+ */
72
+ hostUpdated(): void;
73
+ /**
74
+ * Handles host disconnection and memory cleanup.
75
+ */
76
+ hostDisconnected(): void;
77
+ /**
78
+ * Sets a property value if it exists on the instance and the value has changed.
79
+ * @param {string} property
80
+ * @param {any} value
81
+ */
82
+ setProperty(property: string, value: any): void;
83
+ /**
84
+ * Sets multiple properties on the instance.
85
+ * @param {Object} properties - Key-value pairs of properties to set.
86
+ */
87
+ setProperties(properties: any): void;
88
+ /**
89
+ * MENU OPTION HIGHLIGHTING
90
+ */
91
+ /**
92
+ * Highlights the next active option in the menu.
93
+ */
94
+ highlightNext(): void;
95
+ /**
96
+ * Highlights the previous active option in the menu.
97
+ */
98
+ highlightPrevious(): void;
99
+ /**
100
+ * Moves the highlighted option in the specified direction.
101
+ * @param {string} direction - The direction to move the highlight ("next" or "previous").
102
+ */
103
+ moveHighlightedOption(direction: string): void;
104
+ /**
105
+ * Sets the highlighted index to the specified option.
106
+ * @param {AuroMenuOption} option - The option to highlight.
107
+ */
108
+ setHighlightedOption(option: AuroMenuOption): void;
109
+ /**
110
+ * Sets the highlighted option to the option at the specified index if it exists.
111
+ * @param {number} index
112
+ */
113
+ setHighlightedIndex(index: number): void;
114
+ /**
115
+ * Selects the currently highlighted option.
116
+ */
117
+ selectHighlightedOption(): void;
118
+ /**
119
+ * SELECTION AND DESELECTION METHODS
120
+ */
121
+ /**
122
+ * Selects one or more options in a batch operation
123
+ * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to select
124
+ */
125
+ selectOptions(options: AuroMenuOption | AuroMenuOption[]): void;
126
+ /**
127
+ * Deselects one or more options in a batch operation
128
+ * @param {AuroMenuOption|AuroMenuOption[]} options - Single option or array of options to deselect
129
+ */
130
+ deselectOptions(options: AuroMenuOption | AuroMenuOption[]): void;
131
+ /**
132
+ * Selects a single option.
133
+ * @param {AuroMenuOption} option
134
+ */
135
+ selectOption(option: AuroMenuOption): void;
136
+ /**
137
+ * Deselects a single option.
138
+ * @param {AuroMenuOption} option
139
+ */
140
+ deselectOption(option: AuroMenuOption): void;
141
+ /**
142
+ * Toggles the selection state of a single option.
143
+ * @param {AuroMenuOption} option
144
+ */
145
+ toggleOption(option: AuroMenuOption): void;
146
+ /**
147
+ * Selects options based on their value(s) when compared to a passed value or values.
148
+ * Value or values are normalized to an array of strings that can be matched to option keys.
149
+ * @param {string|number|Array<string|number>} value - The value(s) to select.
150
+ */
151
+ selectByValue(value: string | number | Array<string | number>): void;
152
+ /**
153
+ * Resets the selected options to an empty array.
154
+ */
155
+ reset(): void;
156
+ /**
157
+ * SUBSCRIPTION, NOTIFICATION AND EVENT DISPATCH METHODS
158
+ */
159
+ /**
160
+ * Subscribes a callback to menu service events.
161
+ * @param {Function} callback - The callback to invoke on events.
162
+ */
163
+ subscribe(callback: Function): void;
164
+ /**
165
+ * Remove a previously subscribed callback from menu service events.
166
+ * @param {Function} callback
167
+ */
168
+ unsubscribe(callback: Function): void;
169
+ /**
170
+ * Stages an update to notify subscribers of state and value changes.
171
+ */
172
+ stageUpdate(): void;
173
+ /**
174
+ * Notifies subscribers of a menu service event.
175
+ * All notifications are sent to all subscribers.
176
+ * @param {string} event - The event to send to subscribers.
177
+ */
178
+ notify(event: string): void;
179
+ /**
180
+ * Notifies subscribers of a state change (selected options has changed).
181
+ */
182
+ notifyStateChange(): void;
183
+ /**
184
+ * Notifies subscribers of a value change (current value has changed).
185
+ */
186
+ notifyValueChange(): void;
187
+ /**
188
+ * Dispatches a custom event from the host element.
189
+ * @param {string} eventName
190
+ * @param {any} detail
191
+ */
192
+ dispatchChangeEvent(eventName: string, detail: any): void;
193
+ /**
194
+ * MENU OPTION MANAGEMENT METHODS
195
+ */
196
+ /**
197
+ * Adds a menu option to the service's list.
198
+ * @param {AuroMenuOption} option - the option to track
199
+ */
200
+ addMenuOption(option: AuroMenuOption): void;
201
+ /**
202
+ * Removes a menu option from the service's list.
203
+ * @param {AuroMenuOption} option - the option to remove
204
+ */
205
+ removeMenuOption(option: AuroMenuOption): void;
206
+ /**
207
+ * UTILITIES
208
+ */
209
+ /**
210
+ * Normalizes a value or array of values into an array of strings for option selection.
211
+ * This function ensures that input values are consistently formatted for matching menu options.
212
+ *
213
+ * @param {string|number|Array<string|number>} value - The value(s) to normalize.
214
+ * @returns {Array<string>} An array of string values suitable for option matching.
215
+ * @throws {Error} If any value is not a string or number.
216
+ */
217
+ _getNormalizedValues(value: string | number | Array<string | number>): Array<string>;
218
+ /**
219
+ * Returns whether two arrays of options contain the same elements.
220
+ * @param {AuroMenuOption[]} arr1 - First array of options.
221
+ * @param {AuroMenuOption[]} arr2 - Second array of options.
222
+ * @returns {boolean} True if arrays match, false otherwise.
223
+ */
224
+ optionsArraysMatch(arr1: AuroMenuOption[], arr2: AuroMenuOption[]): boolean;
225
+ }
226
+ export const MenuContext: import("@lit/context").Context<"menu-context", any>;
227
+ import { AuroMenuOption } from "./auro-menuoption";
@@ -7,6 +7,10 @@
7
7
  * @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
8
8
  * @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
9
9
  * @attr {boolean} multiselect - When true, the selected option can be multiple options.
10
+ * @attr {boolean} selectAllMatchingOptions - When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
11
+ * @attr {string} value - The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
12
+ * @prop {string} size - Sets the size of the menu. Accepted values are 'sm' and 'md'. Default is 'sm'.
13
+ * @prop {string} shape - Sets the shape of the menu options. Accepted values are 'box' and 'round'. Default is 'box'.
10
14
  * @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
11
15
  * @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
12
16
  * @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
@@ -20,6 +24,13 @@
20
24
  */
21
25
  export class AuroMenu extends AuroElement {
22
26
  static get properties(): {
27
+ /**
28
+ * Allows deselecting an already selected option when clicked again in single-select mode.
29
+ */
30
+ allowDeselect: {
31
+ type: BooleanConstructor;
32
+ reflect: boolean;
33
+ };
23
34
  noCheckmark: {
24
35
  type: BooleanConstructor;
25
36
  reflect: boolean;
@@ -49,6 +60,10 @@ export class AuroMenu extends AuroElement {
49
60
  reflect: boolean;
50
61
  attribute: string;
51
62
  };
63
+ selectAllMatchingOptions: {
64
+ type: BooleanConstructor;
65
+ reflect: boolean;
66
+ };
52
67
  /**
53
68
  * Value selected for the component.
54
69
  */
@@ -66,6 +81,11 @@ export class AuroMenu extends AuroElement {
66
81
  reflect: boolean;
67
82
  attribute: boolean;
68
83
  };
84
+ options: {
85
+ type: ArrayConstructor;
86
+ reflect: boolean;
87
+ attribute: boolean;
88
+ };
69
89
  layout: {
70
90
  type: StringConstructor;
71
91
  attribute: string;
@@ -94,9 +114,11 @@ export class AuroMenu extends AuroElement {
94
114
  optionSelected: any;
95
115
  matchWord: any;
96
116
  noCheckmark: boolean;
97
- optionActive: Element;
117
+ optionActive: any;
98
118
  loading: boolean;
99
119
  multiSelect: boolean;
120
+ allowDeselect: boolean;
121
+ selectAllMatchingOptions: boolean;
100
122
  /**
101
123
  * Handles keyboard navigation.
102
124
  * @private
@@ -104,22 +126,29 @@ export class AuroMenu extends AuroElement {
104
126
  */
105
127
  private handleKeyDown;
106
128
  /**
107
- * Handles option selection via mouse.
129
+ * Handles slot change events.
108
130
  * @private
109
- * @param {MouseEvent} event - Event object from the browser.
110
131
  */
111
- private handleMouseSelect;
132
+ private handleSlotChange;
112
133
  /**
113
- * Handles option hover events.
114
- * @private
115
- * @param {CustomEvent} event - Event object from the browser.
134
+ * @readonly
135
+ * @returns {string} - Returns the label of the currently selected option(s).
116
136
  */
117
- private handleOptionHover;
137
+ readonly get currentLabel(): string;
118
138
  /**
119
- * Handles slot change events.
120
- * @private
139
+ * @readonly
140
+ * @returns {Array<HTMLElement>} - Returns the array of available menu options.
141
+ * @deprecated use `options` property instead.
121
142
  */
122
- private handleSlotChange;
143
+ readonly get items(): Array<HTMLElement>;
144
+ /**
145
+ * @param {number} value - Sets the index of the currently active option.
146
+ */
147
+ set index(value: number);
148
+ /**
149
+ * @returns {number} - Returns the index of the currently active option.
150
+ */
151
+ get index(): number;
123
152
  /**
124
153
  * Formatted value based on `multiSelect` state.
125
154
  * Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
@@ -127,45 +156,75 @@ export class AuroMenu extends AuroElement {
127
156
  * @returns {String|Array<String>}
128
157
  */
129
158
  private get formattedValue();
159
+ /**
160
+ * Gets the current property values for the menu service.
161
+ * @private
162
+ * @returns {Object}
163
+ */
164
+ private get propertyValues();
165
+ /**
166
+ * Provides the menu context to child components.
167
+ * Initializes the MenuService and subscribes to menu changes.
168
+ * @protected
169
+ */
170
+ protected provideContext(): void;
171
+ menuService: MenuService;
172
+ _contextProvider: ContextProvider<import("@lit/context").Context<"menu-context", any>, this>;
173
+ /**
174
+ * Updates the currently active option in the menu.
175
+ * @param {HTMLElement} option - The option to set as active.
176
+ */
177
+ updateActiveOption(option: HTMLElement): void;
178
+ /**
179
+ * Sets the internal value and manages update state.
180
+ * @param {String|Array<String>} value - The value to set.
181
+ * @protected
182
+ */
183
+ protected setInternalValue(value: string | Array<string>): void;
184
+ internalUpdateInProgress: boolean;
185
+ /**
186
+ * Handles changes from the menu service and updates component state.
187
+ * @param {Object} event - The event object from the menu service.
188
+ * @protected
189
+ */
190
+ protected handleMenuChange(event: any): void;
191
+ _index: any;
192
+ options: any;
193
+ /**
194
+ * Gets the currently selected options.
195
+ * @returns {Array<HTMLElement>}
196
+ */
197
+ get selectedOptions(): Array<HTMLElement>;
198
+ /**
199
+ * Gets the first selected option, or null if none.
200
+ * @returns {HTMLElement|null}
201
+ */
202
+ get selectedOption(): HTMLElement | null;
130
203
  firstUpdated(): void;
131
204
  loadingSlots: NodeListOf<Element>;
205
+ updated(changedProperties: any): void;
132
206
  /**
133
207
  * Sets an attribute that matches the default tag name if the tag name is not the default.
134
208
  * @param {string} tagName - The tag name to set as an attribute.
135
209
  * @private
136
210
  */
137
211
  private setTagAttribute;
138
- updated(changedProperties: any): void;
139
- index: any;
140
212
  /**
141
- * Updates the UI state and appearance of menu items based on changed properties.
142
- * @private
143
- * @param {Map<string, boolean>} changedProperties - LitElement's changed properties map.
213
+ * Sets the loading state and dispatches a loading change event.
214
+ * @param {boolean} isLoading - Whether the menu is loading.
215
+ * @protected
144
216
  */
145
- private updateItemsState;
217
+ protected setLoadingState(isLoading: boolean): void;
146
218
  /**
147
219
  * Initializes the menu's state and structure.
148
220
  * @private
149
221
  */
150
222
  private initializeMenu;
151
223
  /**
152
- * Initializes menu items and their attributes.
153
- * @private
154
- */
155
- private initItems;
156
- items: Element[];
157
- /**
158
- * Updates menu state when an option is selected.
159
- * @private
160
- * @param {HTMLElement} option - The option element to select.
161
- */
162
- private handleSelectState;
163
- /**
164
- * Deselects a menu option and updates related state.
165
- * @private
166
- * @param {HTMLElement} option - The menuoption to be deselected.
224
+ * Selects the currently highlighted option.
225
+ * @protected
167
226
  */
168
- private handleDeselectState;
227
+ protected makeSelection(): void;
169
228
  /**
170
229
  * Resets all options to their default state.
171
230
  * @private
@@ -184,28 +243,12 @@ export class AuroMenu extends AuroElement {
184
243
  */
185
244
  private handleNestedMenus;
186
245
  /**
187
- * Makes a selection based on the current index or clicked option.
188
- * @private
189
- */
190
- private makeSelection;
191
- /**
192
- * Toggle the selection state of the menuoption.
193
- * @private
194
- * @param {HTMLElement} option - The menuoption to toggle.
246
+ * Navigates the menu options in the specified direction.
247
+ * @param {'up'|'down'} direction - The direction to navigate.
248
+ * @protected
195
249
  */
196
- private toggleOption;
250
+ protected navigateOptions(direction: "up" | "down"): void;
197
251
  rootMenu: boolean;
198
- /**
199
- * Navigates through options using keyboard.
200
- * @private
201
- * @param {string} direction - 'up' or 'down'.
202
- */
203
- private navigateOptions;
204
- /**
205
- * Updates the active option state and dispatches events.
206
- * @param {number} index - Index of the option to make active.
207
- */
208
- updateActiveOption(index: number): void;
209
252
  /**
210
253
  * Handles custom events defined on options.
211
254
  * @private
@@ -244,3 +287,5 @@ export class AuroMenu extends AuroElement {
244
287
  protected renderLayout(): void;
245
288
  }
246
289
  import { AuroElement } from "../../layoutElement/src/auroElement.js";
290
+ import { MenuService } from "./auro-menu.context.js";
291
+ import { ContextProvider } from "@lit/context";
@@ -9,27 +9,52 @@
9
9
  * @slot - Specifies text for an option, but is not the value.
10
10
  */
11
11
  export class AuroMenuOption extends AuroElement {
12
+ /**
13
+ * This will register this element with the browser.
14
+ * @param {string} [name="auro-menuoption"] - The name of element that you want to register to.
15
+ *
16
+ * @example
17
+ * AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
18
+ *
19
+ */
20
+ static register(name?: string): void;
12
21
  static get properties(): {
13
- nocheckmark: {
22
+ disabled: {
14
23
  type: BooleanConstructor;
15
24
  reflect: boolean;
16
25
  };
17
- selected: {
18
- type: BooleanConstructor;
26
+ event: {
27
+ type: StringConstructor;
19
28
  reflect: boolean;
20
29
  };
21
- disabled: {
22
- type: BooleanConstructor;
30
+ key: {
31
+ type: StringConstructor;
23
32
  reflect: boolean;
24
33
  };
25
- value: {
34
+ menuService: {
35
+ type: ObjectConstructor;
36
+ state: boolean;
37
+ };
38
+ matchWord: {
26
39
  type: StringConstructor;
40
+ state: boolean;
41
+ };
42
+ noCheckmark: {
43
+ type: BooleanConstructor;
44
+ reflect: boolean;
45
+ };
46
+ selected: {
47
+ type: BooleanConstructor;
27
48
  reflect: boolean;
28
49
  };
29
50
  tabIndex: {
30
51
  type: NumberConstructor;
31
52
  reflect: boolean;
32
53
  };
54
+ value: {
55
+ type: StringConstructor;
56
+ reflect: boolean;
57
+ };
33
58
  layout: {
34
59
  type: StringConstructor;
35
60
  attribute: string;
@@ -38,14 +63,11 @@ export class AuroMenuOption extends AuroElement {
38
63
  };
39
64
  static get styles(): import("lit").CSSResult[];
40
65
  /**
41
- * This will register this element with the browser.
42
- * @param {string} [name="auro-menuoption"] - The name of element that you want to register to.
43
- *
44
- * @example
45
- * AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
46
- *
66
+ * Returns whether the menu option is currently active and selectable.
67
+ * An option is considered active if it is not hidden, not disabled, and not static.
68
+ * @returns {boolean} True if the option is active, false otherwise.
47
69
  */
48
- static register(name?: string): void;
70
+ get isActive(): boolean;
49
71
  /**
50
72
  * @private
51
73
  */
@@ -56,14 +78,93 @@ export class AuroMenuOption extends AuroElement {
56
78
  private size;
57
79
  iconTag: any;
58
80
  selected: boolean;
59
- nocheckmark: boolean;
81
+ noCheckmark: boolean;
60
82
  disabled: boolean;
61
83
  /**
62
84
  * @private
63
85
  */
64
86
  private runtimeUtils;
87
+ menuService: any;
88
+ unsubscribe: any;
89
+ /**
90
+ * Handles changes from the menu service and updates the option's state.
91
+ * This function synchronizes the option's properties and selection/highlight state with menu events.
92
+ * @param {Object} event - The event object from the menu service.
93
+ */
94
+ handleMenuChange(event: any): void;
95
+ _contextConsumer: ContextConsumer<import("@lit/context").Context<"menu-context", any>, this>;
96
+ key: any;
65
97
  firstUpdated(): void;
66
98
  updated(changedProperties: any): void;
99
+ /**
100
+ * Sets up event listeners for user interaction with the menu option.
101
+ * This function enables click and mouse enter events to trigger selection and highlighting logic.
102
+ */
103
+ bindEvents(): void;
104
+ /**
105
+ * Attaches this menu option to a menu service and subscribes to its events.
106
+ * This method enables the option to participate in menu selection and highlighting logic.
107
+ * @param {Object} service - The menu service instance to attach to.
108
+ */
109
+ attachTo(service: any): void;
110
+ active: boolean;
111
+ /**
112
+ * Updates the internal selected state of the menu option bypassing 'updated' and triggers custom events if selected.
113
+ * This function ensures the option's selection state is synchronized with menu logic and notifies listeners.
114
+ * @param {boolean} isSelected - Whether the option should be marked as selected.
115
+ */
116
+ setInternalSelected(isSelected: boolean): void;
117
+ internalUpdateInProgress: boolean;
118
+ /**
119
+ * Sets the selected state of the menu option.
120
+ * This function updates whether the option is currently selected.
121
+ * @param {boolean} isSelected - Whether the option should be marked as selected.
122
+ * @deprecated Simply modify the `selected` property directly instead.
123
+ */
124
+ setSelected(isSelected: boolean): void;
125
+ /**
126
+ * Updates the active state and visual highlighting of the menu option.
127
+ * This function toggles the option's active status and applies or removes the active CSS class.
128
+ * @param {boolean} isActive - Whether the option should be marked as active.
129
+ * @deprecated Simply modify the `active` property directly instead.
130
+ */
131
+ updateActive(isActive: boolean): void;
132
+ /**
133
+ * Updates the CSS class for the menu option based on its active state.
134
+ * This function adds or removes the 'active' class to visually indicate the option's active status.
135
+ * @private
136
+ */
137
+ private updateActiveClasses;
138
+ /**
139
+ * Updates the visual highlighting of text within the menu option based on the current match word.
140
+ * This function highlights matching text segments and manages nested spacers for display formatting.
141
+ * @private
142
+ */
143
+ private updateTextHighlight;
144
+ /**
145
+ * Handles click events on the menu option, toggling its selected state.
146
+ * This function dispatches a click event and updates selection if the option is not disabled.
147
+ * @private
148
+ */
149
+ private handleClick;
150
+ /**
151
+ * Handles mouse enter events to highlight the menu option.
152
+ * This function updates the menu service to set this option as the currently highlighted item if not disabled.
153
+ * @private
154
+ */
155
+ private handleMouseEnter;
156
+ /**
157
+ * Dispatches custom events defined for this menu option.
158
+ * This function notifies listeners when a custom event is triggered by the option.
159
+ * @private
160
+ */
161
+ private handleCustomEvent;
162
+ /**
163
+ * Dispatches a click event for this menu option.
164
+ * This function notifies listeners that the option has been clicked.
165
+ * @private
166
+ */
167
+ private dispatchClickEvent;
67
168
  /**
68
169
  * Generates an HTML element containing an SVG icon based on the provided `svgContent`.
69
170
  *
@@ -80,3 +181,4 @@ export class AuroMenuOption extends AuroElement {
80
181
  protected renderLayout(): void;
81
182
  }
82
183
  import { AuroElement } from "../../layoutElement/src/auroElement.js";
184
+ import { ContextConsumer } from '@lit/context';