vira 31.23.0 → 31.24.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.
@@ -37,6 +37,13 @@ export declare const ViraDropdown: import("element-vir").DeclarativeElementDefin
37
37
  */
38
38
  randomId: string;
39
39
  }, {
40
+ /**
41
+ * @deprecated Use `selectedValuesChange` instead. `selectedChange` is broken for
42
+ * multi-select (it doesn't emit all the currently selected values) but is temporarily
43
+ * left for backwards compatibility purposes. It will be removed entirely soon.
44
+ */
40
45
  selectedChange: import("element-vir").DefineEvent<string[]>;
46
+ /** Emits all currently selected values. */
47
+ selectedValuesChange: import("element-vir").DefineEvent<string[]>;
41
48
  openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
42
49
  }, "vira-dropdown-", "vira-dropdown-", readonly [], readonly ["leadingIcon", "prefixText", "trigger"]>;
@@ -110,7 +110,14 @@ export const ViraDropdown = defineViraElement()({
110
110
  }
111
111
  `,
112
112
  events: {
113
+ /**
114
+ * @deprecated Use `selectedValuesChange` instead. `selectedChange` is broken for
115
+ * multi-select (it doesn't emit all the currently selected values) but is temporarily
116
+ * left for backwards compatibility purposes. It will be removed entirely soon.
117
+ */
113
118
  selectedChange: defineElementEvent(),
119
+ /** Emits all currently selected values. */
120
+ selectedValuesChange: defineElementEvent(),
114
121
  openChange: defineElementEvent(),
115
122
  },
116
123
  state() {
@@ -160,7 +167,17 @@ export const ViraDropdown = defineViraElement()({
160
167
  return {
161
168
  content: option.label,
162
169
  onClick() {
170
+ const newSelectedValues = inputs.isMultiSelect
171
+ ? selectedOptions.includes(option)
172
+ ? filterMap(selectedOptions, (selectedOption) => selectedOption.value, (value, selectedOption) => selectedOption !== option)
173
+ : [
174
+ ...selectedOptions.map((selectedOption) => selectedOption.value),
175
+ option.value,
176
+ ]
177
+ : [option.value];
178
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
163
179
  dispatch(new events.selectedChange([option.value]));
180
+ dispatch(new events.selectedValuesChange(newSelectedValues));
164
181
  },
165
182
  disabled: option.disabled,
166
183
  selected: selectedOptions.includes(option),
@@ -171,6 +188,7 @@ export const ViraDropdown = defineViraElement()({
171
188
  const triggerTemplate = html `
172
189
  <${ViraPopUpTrigger.assign({
173
190
  ...inputs,
191
+ keepOpenAfterInteraction: inputs.isMultiSelect,
174
192
  focusOnClose: true,
175
193
  popUpOffset: {
176
194
  vertical: -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "31.23.0",
3
+ "version": "31.24.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",