@aurodesignsystem-dev/auro-formkit 0.0.0-pr1503.2 → 0.0.0-pr1505.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.
Files changed (62) hide show
  1. package/components/checkbox/demo/customize.min.js +2 -2
  2. package/components/checkbox/demo/getting-started.min.js +2 -2
  3. package/components/checkbox/demo/index.min.js +2 -2
  4. package/components/checkbox/dist/index.js +2 -2
  5. package/components/checkbox/dist/registered.js +2 -2
  6. package/components/combobox/demo/customize.md +7 -3
  7. package/components/combobox/demo/customize.min.js +1450 -1662
  8. package/components/combobox/demo/getting-started.min.js +1450 -1662
  9. package/components/combobox/demo/index.min.js +1450 -1662
  10. package/components/combobox/dist/auro-combobox.d.ts +5 -0
  11. package/components/combobox/dist/index.js +504 -141
  12. package/components/combobox/dist/registered.js +504 -141
  13. package/components/counter/demo/customize.min.js +3 -3
  14. package/components/counter/demo/index.min.js +3 -3
  15. package/components/counter/dist/index.js +3 -3
  16. package/components/counter/dist/registered.js +3 -3
  17. package/components/datepicker/demo/api.md +2 -0
  18. package/components/datepicker/demo/customize.md +195 -33
  19. package/components/datepicker/demo/customize.min.js +145 -60
  20. package/components/datepicker/demo/index.min.js +137 -59
  21. package/components/datepicker/dist/index.js +137 -59
  22. package/components/datepicker/dist/registered.js +137 -59
  23. package/components/datepicker/dist/src/auro-datepicker.d.ts +2 -0
  24. package/components/dropdown/demo/customize.min.js +1 -1
  25. package/components/dropdown/demo/getting-started.min.js +1 -1
  26. package/components/dropdown/demo/index.min.js +1 -1
  27. package/components/dropdown/dist/index.js +1 -1
  28. package/components/dropdown/dist/registered.js +1 -1
  29. package/components/form/demo/customize.min.js +2209 -2237
  30. package/components/form/demo/getting-started.min.js +2209 -2237
  31. package/components/form/demo/index.min.js +2209 -2237
  32. package/components/form/demo/registerDemoDeps.min.js +2207 -2235
  33. package/components/input/demo/customize.md +56 -55
  34. package/components/input/demo/customize.min.js +131 -56
  35. package/components/input/demo/getting-started.min.js +131 -56
  36. package/components/input/demo/index.md +2 -2
  37. package/components/input/demo/index.min.js +131 -56
  38. package/components/input/dist/base-input.d.ts +16 -0
  39. package/components/input/dist/index.js +131 -56
  40. package/components/input/dist/registered.js +131 -56
  41. package/components/menu/demo/api.md +41 -45
  42. package/components/menu/demo/customize.md +0 -28
  43. package/components/menu/demo/index.min.js +779 -1354
  44. package/components/menu/dist/auro-menu.d.ts +95 -110
  45. package/components/menu/dist/auro-menuoption.d.ts +32 -138
  46. package/components/menu/dist/index.js +753 -1308
  47. package/components/menu/dist/registered.js +765 -1308
  48. package/components/radio/demo/customize.min.js +2 -2
  49. package/components/radio/demo/getting-started.min.js +2 -2
  50. package/components/radio/demo/index.min.js +2 -2
  51. package/components/radio/dist/index.js +2 -2
  52. package/components/radio/dist/registered.js +2 -2
  53. package/components/select/demo/customize.md +7 -3
  54. package/components/select/demo/customize.min.js +1072 -1616
  55. package/components/select/demo/getting-started.min.js +1072 -1616
  56. package/components/select/demo/index.min.js +1072 -1616
  57. package/components/select/dist/index.js +46 -15
  58. package/components/select/dist/registered.js +46 -15
  59. package/components/select/dist/selectUtils.d.ts +12 -0
  60. package/custom-elements.json +384 -1022
  61. package/package.json +1 -3
  62. package/components/menu/dist/auro-menu.context.d.ts +0 -238
@@ -6,7 +6,6 @@
6
6
  * @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
7
7
  * @event {CustomEvent<{ loading: boolean; hasLoadingPlaceholder: boolean; }>} auroMenu-loadingChange - Notifies when the loading attribute is changed.
8
8
  * @event {CustomEvent<any>} auroMenu-selectValueFailure - Notifies that an attempt to select a menuoption by matching a value has failed.
9
- * @event {CustomEvent<{ values: HTMLElement[] }>} auroMenu-deselectPrevented - Notifies that deselection was prevented and includes the affected options in `detail.values`.
10
9
  * @event {CustomEvent<any>} auroMenu-selectValueReset - Notifies that the component value has been reset.
11
10
  * @event {CustomEvent<any>} auroMenu-selectedOption - Notifies that a new menuoption selection has been made.
12
11
  * @slot loadingText - Text to show while loading attribute is set
@@ -15,13 +14,6 @@
15
14
  */
16
15
  export class AuroMenu extends AuroElement {
17
16
  static get properties(): {
18
- /**
19
- * Allows deselecting an already selected option when clicked again in single-select mode.
20
- */
21
- allowDeselect: {
22
- type: BooleanConstructor;
23
- reflect: boolean;
24
- };
25
17
  /**
26
18
  * When true, the entire menu and all options are disabled.
27
19
  */
@@ -29,18 +21,6 @@ export class AuroMenu extends AuroElement {
29
21
  type: BooleanConstructor;
30
22
  reflect: boolean;
31
23
  };
32
- /**
33
- * Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
34
- */
35
- hasLoadingPlaceholder: {
36
- type: BooleanConstructor;
37
- };
38
- /**
39
- * @private
40
- */
41
- layout: {
42
- type: StringConstructor;
43
- };
44
24
  /**
45
25
  * Indent level for submenus.
46
26
  * @private
@@ -93,30 +73,6 @@ export class AuroMenu extends AuroElement {
93
73
  optionSelected: {
94
74
  type: ObjectConstructor;
95
75
  };
96
- options: {
97
- type: ArrayConstructor;
98
- reflect: boolean;
99
- attribute: boolean;
100
- };
101
- /**
102
- * Sets the size of the menu.
103
- * @type {'sm' | 'md'}
104
- * @default 'sm'
105
- */
106
- size: "sm" | "md";
107
- /**
108
- * When true, selects all options that match the provided value/key when setting value and multiselect is enabled.
109
- */
110
- selectAllMatchingOptions: {
111
- type: BooleanConstructor;
112
- reflect: boolean;
113
- };
114
- /**
115
- * Sets the shape of the menu.
116
- * @type {'box' | 'round'}
117
- * @default 'box'
118
- */
119
- shape: "box" | "round";
120
76
  /**
121
77
  * The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
122
78
  */
@@ -125,11 +81,16 @@ export class AuroMenu extends AuroElement {
125
81
  reflect: boolean;
126
82
  attribute: string;
127
83
  };
84
+ layout: {
85
+ type: StringConstructor;
86
+ attribute: string;
87
+ reflect: boolean;
88
+ };
128
89
  };
129
90
  static get styles(): import("lit").CSSResult[];
130
91
  /**
131
92
  * This will register this element with the browser.
132
- * @param {string} [name="auro-menu"] - The name of the element that you want to register.
93
+ * @param {string} [name="auro-menu"] - The name of element that you want to register to.
133
94
  *
134
95
  * @example
135
96
  * AuroMenu.register("custom-menu") // this will register this element to <custom-menu/>
@@ -144,30 +105,41 @@ export class AuroMenu extends AuroElement {
144
105
  * @private
145
106
  */
146
107
  private size;
108
+ value: any;
147
109
  optionSelected: any;
148
110
  matchWord: any;
149
111
  noCheckmark: boolean;
150
- optionActive: any;
112
+ optionActive: Element | undefined;
151
113
  loading: boolean;
152
114
  multiSelect: boolean;
153
- allowDeselect: boolean;
154
- selectAllMatchingOptions: boolean;
155
115
  /**
156
- * Handles slot change events.
116
+ * Handles keyboard navigation and selection.
157
117
  * @private
118
+ * @param {KeyboardEvent} event - The keydown event.
158
119
  */
159
- private handleSlotChange;
120
+ private handleKeyDown;
160
121
  /**
161
- * @readonly
162
- * @returns {string} - Returns the label of the currently selected option(s).
122
+ * Handles option selection via click events from menuoptions.
123
+ * @private
124
+ * @param {CustomEvent} event - The auroMenuOption-click event.
163
125
  */
164
- readonly get currentLabel(): string;
126
+ private handleMouseSelect;
127
+ /**
128
+ * Handles option hover events.
129
+ * @private
130
+ * @param {CustomEvent} event - Event object from the browser.
131
+ */
132
+ private handleOptionHover;
133
+ /**
134
+ * Handles slot change events.
135
+ * @private
136
+ */
137
+ private handleSlotChange;
165
138
  /**
166
139
  * @readonly
167
140
  * @returns {Array<HTMLElement>} - Returns the array of available menu options.
168
- * @deprecated Use `options` property instead.
169
141
  */
170
- readonly get items(): Array<HTMLElement>;
142
+ readonly get options(): Array<HTMLElement>;
171
143
  /**
172
144
  * @param {number} value - Sets the index of the currently active option.
173
145
  */
@@ -177,83 +149,72 @@ export class AuroMenu extends AuroElement {
177
149
  */
178
150
  get index(): number;
179
151
  /**
180
- * Formatted value based on `multiSelect` state.
181
- * Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
182
- * @private
183
- * @returns {String|Array<String>}
184
- */
185
- private get formattedValue();
186
- /**
187
- * Gets the current property values for the menu service.
188
- * @private
189
- * @returns {Object}
190
- */
191
- private get propertyValues();
192
- /**
193
- * Provides the menu context to child components.
194
- * Initializes the MenuService and subscribes to menu changes.
195
- * @protected
196
- */
197
- protected provideContext(): void;
198
- rootMenu: boolean | undefined;
199
- menuService: any;
200
- _contextProvider: any;
201
- /**
202
- * Updates the currently active option in the menu.
203
- * @param {HTMLElement} option - The option to set as active.
152
+ * Gets the currently selected options as an array.
153
+ * @returns {Array<HTMLElement>}
204
154
  */
205
- updateActiveOption(option: HTMLElement): void;
155
+ get selectedOptions(): Array<HTMLElement>;
206
156
  /**
207
- * Sets the internal value and manages update state.
208
- * @param {String|Array<String>} value - The value to set.
209
- * @protected
157
+ * Gets the first selected option, or null if none.
158
+ * @returns {HTMLElement|null}
210
159
  */
211
- protected setInternalValue(value: string | Array<string>): void;
212
- internalUpdateInProgress: boolean | undefined;
213
- value: any;
160
+ get selectedOption(): HTMLElement | null;
214
161
  /**
215
- * Handles changes from the menu service and updates component state.
216
- * @param {Object} event - The event object from the menu service.
217
- * @protected
162
+ * @readonly
163
+ * @returns {string} - Returns the label of the currently selected option(s).
218
164
  */
219
- protected handleMenuChange(event: Object): void;
220
- _index: any;
221
- options: any;
165
+ readonly get currentLabel(): string;
222
166
  /**
223
- * Gets the currently selected options.
224
- * @returns {Array<HTMLElement>}
167
+ * Formatted value based on `multiSelect` state.
168
+ * Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
169
+ * @private
170
+ * @returns {String|Array<String>}
225
171
  */
226
- get selectedOptions(): Array<HTMLElement>;
172
+ private get formattedValue();
227
173
  /**
228
- * Gets the first selected option, or null if none.
229
- * @returns {HTMLElement|null}
174
+ * Selects options by value.
175
+ * @param {string|string[]|undefined|null} value - The value(s) to select.
176
+ * @public
230
177
  */
231
- get selectedOption(): HTMLElement | null;
178
+ public selectByValue(value: string | string[] | undefined | null): void;
232
179
  firstUpdated(): void;
233
180
  loadingSlots: NodeListOf<Element> | undefined;
234
- updated(changedProperties: any): void;
235
181
  /**
236
182
  * Sets an attribute that matches the default tag name if the tag name is not the default.
237
183
  * @param {string} tagName - The tag name to set as an attribute.
238
184
  * @private
239
185
  */
240
186
  private setTagAttribute;
187
+ updated(changedProperties: any): void;
188
+ _index: number | undefined;
241
189
  /**
242
- * Sets the loading state and dispatches a loading change event.
243
- * @param {boolean} isLoading - Whether the menu is loading.
244
- * @protected
190
+ * Updates the UI state and appearance of menu items based on changed properties.
191
+ * @private
192
+ * @param {Map<string, boolean>} changedProperties - LitElement's changed properties map.
245
193
  */
246
- protected setLoadingState(isLoading: boolean): void;
194
+ private updateItemsState;
247
195
  /**
248
196
  * Initializes the menu's state and structure.
249
197
  * @private
250
198
  */
251
199
  private initializeMenu;
252
200
  /**
253
- * Selects the currently highlighted option.
254
- * @protected
201
+ * Initializes menu items and their attributes.
202
+ * @private
203
+ */
204
+ private initItems;
205
+ items: Element[] | undefined;
206
+ /**
207
+ * Updates menu state when an option is selected.
208
+ * @private
209
+ * @param {HTMLElement} option - The option element to select.
210
+ */
211
+ private handleSelectState;
212
+ /**
213
+ * Deselects a menu option and updates related state.
214
+ * @private
215
+ * @param {HTMLElement} option - The menuoption to be deselected.
255
216
  */
256
- protected makeSelection(): void;
217
+ private handleDeselectState;
257
218
  /**
258
219
  * Resets all options to their default state.
259
220
  * @private
@@ -272,11 +233,28 @@ export class AuroMenu extends AuroElement {
272
233
  */
273
234
  private handleNestedMenus;
274
235
  /**
275
- * Navigates the menu options in the specified direction.
276
- * @param {'up'|'down'} direction - The direction to navigate.
277
- * @protected
236
+ * Makes a selection based on the current index.
237
+ * @private
278
238
  */
279
- protected navigateOptions(direction: "up" | "down"): void;
239
+ private makeSelection;
240
+ /**
241
+ * Toggle the selection state of the menuoption.
242
+ * @private
243
+ * @param {HTMLElement} option - The menuoption to toggle.
244
+ */
245
+ private toggleOption;
246
+ rootMenu: boolean | undefined;
247
+ /**
248
+ * Navigates through options using keyboard.
249
+ * @param {string} direction - 'up' or 'down'.
250
+ */
251
+ navigateOptions(direction: string): void;
252
+ /**
253
+ * Updates the active option state and dispatches events.
254
+ * Accepts either a numeric index or an HTMLElement option.
255
+ * @param {number|HTMLElement} indexOrOption - Index of the option or the option element to make active.
256
+ */
257
+ updateActiveOption(indexOrOption: number | HTMLElement): void;
280
258
  /**
281
259
  * Handles custom events defined on options.
282
260
  * @private
@@ -289,6 +267,13 @@ export class AuroMenu extends AuroElement {
289
267
  * @private
290
268
  */
291
269
  private notifySelectionChange;
270
+ /**
271
+ * @private
272
+ * @param {any} current - Current selection.
273
+ * @param {any} next - New selection to compare.
274
+ * @returns {boolean} Whether the selections are equal.
275
+ */
276
+ private selectionEquals;
292
277
  /**
293
278
  * Checks if an option is currently selected.
294
279
  * @private
@@ -5,103 +5,62 @@
5
5
  * @slot default - The default slot for the menu option text.
6
6
  *
7
7
  * @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
8
+ * @event auroMenuOption-click - Notifies that this option has been clicked.
8
9
  */
9
10
  export class AuroMenuOption extends AuroElement {
10
- /**
11
- * This will register this element with the browser.
12
- * @param {string} [name="auro-menuoption"] - The name of the element that you want to register.
13
- *
14
- * @example
15
- * AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
16
- *
17
- */
18
- static register(name?: string): void;
19
11
  static get properties(): {
20
- /**
21
- * When true, disables the menu option.
22
- */
23
- disabled: {
12
+ noCheckmark: {
24
13
  type: BooleanConstructor;
25
14
  reflect: boolean;
26
15
  };
27
- /**
28
- * @private
29
- */
30
- event: {
31
- type: StringConstructor;
16
+ selected: {
17
+ type: BooleanConstructor;
32
18
  reflect: boolean;
33
19
  };
34
- /**
35
- * @private
36
- */
37
- layout: {
38
- type: StringConstructor;
20
+ disabled: {
21
+ type: BooleanConstructor;
22
+ reflect: boolean;
39
23
  };
40
- /**
41
- * Allows users to set a unique key for the menu option for specified option selection. If no key is provided, the value property will be used.
42
- */
43
- key: {
24
+ value: {
44
25
  type: StringConstructor;
45
26
  reflect: boolean;
46
27
  };
47
- /**
48
- * @private
49
- */
50
- menuService: {
51
- type: ObjectConstructor;
52
- state: boolean;
28
+ tabIndex: {
29
+ type: NumberConstructor;
30
+ reflect: boolean;
53
31
  };
54
32
  /**
55
33
  * @private
56
34
  */
57
- matchWord: {
35
+ event: {
58
36
  type: StringConstructor;
59
- state: boolean;
60
- };
61
- /**
62
- * @private
63
- */
64
- noCheckmark: {
65
- type: BooleanConstructor;
66
37
  reflect: boolean;
67
38
  };
68
39
  /**
69
- * When true, marks this option as the "no matching results" placeholder shown by combobox when the user's input does not match any available options. Enables distinct styling and prevents the option from being treated as a selectable match.
40
+ * When true, marks this option as the "no matching results" placeholder shown by combobox
41
+ * when the user's input does not match any available options.
70
42
  */
71
43
  noMatch: {
72
44
  type: BooleanConstructor;
73
45
  reflect: boolean;
74
46
  attribute: string;
75
47
  };
76
- /**
77
- * Specifies that an option is selected.
78
- */
79
- selected: {
80
- type: BooleanConstructor;
81
- reflect: boolean;
82
- };
83
- /**
84
- * Specifies the tab index of the menu option.
85
- */
86
- tabIndex: {
87
- type: NumberConstructor;
88
- reflect: boolean;
89
- };
90
- /**
91
- * Specifies the value to be sent to a server.
92
- */
93
- value: {
48
+ layout: {
94
49
  type: StringConstructor;
50
+ attribute: string;
95
51
  reflect: boolean;
96
52
  };
97
53
  };
98
54
  static get styles(): import("lit").CSSResult[];
99
55
  /**
100
- * Returns whether the menu option is currently active and selectable.
101
- * An option is considered active if it is not hidden, not disabled, and not static.
102
- * @returns {boolean} True if the option is active, false otherwise.
56
+ * This will register this element with the browser.
57
+ * @param {string} [name="auro-menuoption"] - The name of element that you want to register to.
58
+ *
59
+ * @example
60
+ * AuroMenuOption.register("custom-menuoption") // this will register this element to <custom-menuoption/>
61
+ *
103
62
  */
104
- get isActive(): boolean;
63
+ static register(name?: string): void;
105
64
  /**
106
65
  * @private
107
66
  */
@@ -119,87 +78,23 @@ export class AuroMenuOption extends AuroElement {
119
78
  * @private
120
79
  */
121
80
  private runtimeUtils;
122
- menuService: Object | null;
123
- unsubscribe: any;
124
81
  /**
125
- * Handles changes from the menu service and updates the option's state.
126
- * This function synchronizes the option's properties and selection/highlight state with menu events.
127
- * @param {Object} event - The event object from the menu service.
82
+ * Returns whether the menu option is currently active and selectable.
83
+ * @returns {boolean}
128
84
  */
129
- handleMenuChange(event: Object): void;
130
- _contextConsumer: ContextConsumer<import("@lit/context").Context<"menu-context", any>, this> | undefined;
131
- key: any;
85
+ get isActive(): boolean;
132
86
  firstUpdated(): void;
133
87
  updated(changedProperties: any): void;
88
+ handleMenuChange(): void;
89
+ setSelected(value: any): void;
90
+ updateActive(active: any): void;
91
+ active: any;
92
+ attachTo(): void;
134
93
  /**
135
- * Sets up event listeners for user interaction with the menu option.
136
- * This function enables click and mouse enter events to trigger selection and highlighting logic.
137
- */
138
- bindEvents(): void;
139
- /**
140
- * Attaches this menu option to a menu service and subscribes to its events.
141
- * This method enables the option to participate in menu selection and highlighting logic.
142
- * @param {Object} service - The menu service instance to attach to.
143
- */
144
- attachTo(service: Object): void;
145
- active: boolean | undefined;
146
- /**
147
- * Updates the internal selected state of the menu option bypassing 'updated' and triggers custom events if selected.
148
- * This function ensures the option's selection state is synchronized with menu logic and notifies listeners.
149
- * @param {boolean} isSelected - Whether the option should be marked as selected.
150
- */
151
- setInternalSelected(isSelected: boolean): void;
152
- internalUpdateInProgress: boolean | undefined;
153
- /**
154
- * Sets the selected state of the menu option.
155
- * This function updates whether the option is currently selected.
156
- * @param {boolean} isSelected - Whether the option should be marked as selected.
157
- * @deprecated Simply modify the `selected` property directly instead.
158
- */
159
- setSelected(isSelected: boolean): void;
160
- /**
161
- * Updates the active state and visual highlighting of the menu option.
162
- * This function toggles the option's active status and applies or removes the active CSS class.
163
- * @param {boolean} isActive - Whether the option should be marked as active.
164
- * @deprecated Simply modify the `active` property directly instead.
165
- */
166
- updateActive(isActive: boolean): void;
167
- /**
168
- * Updates the CSS class for the menu option based on its active state.
169
- * This function adds or removes the 'active' class to visually indicate the option's active status.
170
- * @private
171
- */
172
- private updateActiveClasses;
173
- /**
174
- * Updates the visual highlighting of text within the menu option based on the current match word.
175
- * This function highlights matching text segments and manages nested spacers for display formatting.
176
- * @private
177
- */
178
- private updateTextHighlight;
179
- /**
180
- * Handles click events on the menu option, toggling its selected state.
181
- * This function dispatches a click event and updates selection if the option is not disabled.
94
+ * Handles click events on the menu option.
182
95
  * @private
183
96
  */
184
97
  private handleClick;
185
- /**
186
- * Handles mouse enter events to highlight the menu option.
187
- * This function updates the menu service to set this option as the currently highlighted item if not disabled.
188
- * @private
189
- */
190
- private handleMouseEnter;
191
- /**
192
- * Dispatches custom events defined for this menu option.
193
- * This function notifies listeners when a custom event is triggered by the option.
194
- * @private
195
- */
196
- private handleCustomEvent;
197
- /**
198
- * Dispatches a click event for this menu option.
199
- * This function notifies listeners that the option has been clicked.
200
- * @private
201
- */
202
- private dispatchClickEvent;
203
98
  /**
204
99
  * Generates an HTML element containing an SVG icon based on the provided `svgContent`.
205
100
  *
@@ -216,4 +111,3 @@ export class AuroMenuOption extends AuroElement {
216
111
  protected renderLayout(): void;
217
112
  }
218
113
  import { AuroElement } from "../../layoutElement/src/auroElement.js";
219
- import { ContextConsumer } from '@lit/context';