@ironsource/shared-ui 2.0.0-rc.0 → 2.0.0-rc.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 (178) hide show
  1. package/AddFilterButton.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  2. package/AppTrigger.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  3. package/AutocompleteDropdown.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  4. package/AutocompleteInput.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  5. package/Banner.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  6. package/Button.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  7. package/ButtonBase.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  8. package/ButtonV4.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  9. package/CalendarMonth.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  10. package/Chip.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  11. package/ChipV4.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  12. package/DateRange.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  13. package/Dialog.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  14. package/Dropdown.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  15. package/Dropdown.vue_vue_type_style_index_1_lang.css +1 -1
  16. package/DropdownV4.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  17. package/DropdownV4.vue_vue_type_style_index_1_lang.css +1 -0
  18. package/Editable.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  19. package/EmptyState.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  20. package/FilterDropdown.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  21. package/FilterSearchInput.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  22. package/FloatingToolbar.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  23. package/GroupOption.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  24. package/IconButton.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  25. package/IncludeExclude.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  26. package/IncludeExcludeAppTrigger.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  27. package/IncludeExcludeChipFilter.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  28. package/IncludeExcludeDragDrop.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  29. package/IncludeExcludeOptionDraggable.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  30. package/Input.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  31. package/Label.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  32. package/Menu.vue_vue_type_style_index_1_lang.css +1 -1
  33. package/MenuItem.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  34. package/Option.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  35. package/Popover.vue_vue_type_style_index_0_lang.css +1 -1
  36. package/ScrollButton.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  37. package/Search.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  38. package/SearchInput.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  39. package/SearchV4.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  40. package/Snackbar.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  41. package/Switch.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  42. package/SwitchV4.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  43. package/Table.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  44. package/Table.vue_vue_type_style_index_1_lang.css +1 -1
  45. package/Tabs.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  46. package/TextArea.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  47. package/Toggle.vue_vue_type_style_index_0_scoped_true_lang.css +1 -1
  48. package/Typography.vue_vue_type_style_index_0_scoped_true_lang.css +1 -0
  49. package/commonCssVariables.scss +623 -0
  50. package/components/ThemeWrapper/ThemeStrore.d.ts +4 -0
  51. package/components/ThemeWrapper/ThemeWrapper.vue.d.ts +15 -0
  52. package/components/appTrigger/AppTrigger.vue.js +4 -4
  53. package/components/autocompleteDropdown/AutocompleteDropdown.vue.js +4 -3
  54. package/components/autocompleteDropdown/AutocompleteInput.vue.js +2 -2
  55. package/components/autocompleteDropdown/GroupOption.vue.js +2 -2
  56. package/components/button/common/ButtonBase.vue.d.ts +48 -0
  57. package/components/button/{ButtonBase.vue.js → common/ButtonBase.vue.js} +7 -7
  58. package/components/button/{Button.vue.d.ts → common/ButtonSuper.vue.d.ts} +3 -3
  59. package/components/button/{ButtonBase.vue.d.ts → v3/Button.vue.d.ts} +20 -4
  60. package/components/button/v3/Button.vue.js +102 -0
  61. package/components/button/{IconButton.vue.js → v3/IconButton.vue.js} +7 -7
  62. package/components/button/{ScrollButton.vue.js → v3/ScrollButton.vue.js} +6 -6
  63. package/components/button/v3/index.d.ts +79 -0
  64. package/components/button/v4/ButtonV4.vue.d.ts +57 -0
  65. package/components/button/v4/ButtonV4.vue.js +99 -0
  66. package/components/button/{index.d.ts → v4/index.d.ts} +33 -76
  67. package/components/button/v4/index.vue.js +6 -0
  68. package/components/checkbox/Checkbox.vue.d.ts +1 -1
  69. package/components/checkbox/index.d.ts +9 -9
  70. package/components/chip/{Chip.vue.js → v3/Chip.vue.js} +5 -5
  71. package/components/chip/v4/ChipV4.vue.d.ts +48 -0
  72. package/components/chip/v4/ChipV4.vue.js +76 -0
  73. package/components/chip/v4/index.d.ts +63 -0
  74. package/components/chip/v4/index.vue.js +6 -0
  75. package/components/dateRange/CalendarMonth.vue.js +3 -3
  76. package/components/dateRange/DateRange.vue.js +4 -4
  77. package/components/dialog/Dialog.vue.d.ts +1 -1
  78. package/components/dialog/Dialog.vue.js +8 -7
  79. package/components/dialog/index.d.ts +11 -11
  80. package/components/dropdown/common/Dropdown.common.d.ts +36 -0
  81. package/components/dropdown/common/Dropdown.common.vue.js +456 -0
  82. package/components/dropdown/{Label.vue.js → common/Label.vue.js} +5 -5
  83. package/components/dropdown/{Option.vue.js → common/Option.vue.js} +7 -7
  84. package/components/dropdown/{SearchInput.vue.js → common/SearchInput.vue.js} +8 -7
  85. package/components/dropdown/{Dropdown.vue.d.ts → v3/Dropdown.vue.d.ts} +15 -5
  86. package/components/dropdown/v3/Dropdown.vue.js +391 -0
  87. package/components/dropdown/{index.d.ts → v3/index.d.ts} +42 -20
  88. package/components/dropdown/v3/index.vue.js +12 -0
  89. package/components/dropdown/v4/DropdownV4.vue.d.ts +223 -0
  90. package/components/dropdown/v4/DropdownV4.vue.js +408 -0
  91. package/components/dropdown/v4/index.d.ts +433 -0
  92. package/components/dropdown/v4/index.vue.js +6 -0
  93. package/components/emptyState/EmptyState.vue.d.ts +1 -1
  94. package/components/emptyState/EmptyState.vue.js +4 -4
  95. package/components/emptyState/index.d.ts +11 -11
  96. package/components/filterDropdown/AddFilterButton.vue.js +2 -2
  97. package/components/filterDropdown/FilterDropdown.vue.js +5 -4
  98. package/components/filtersPanel/Filter.d.ts +1 -1
  99. package/components/filtersPanel/FilterSearchInput.vue.js +6 -6
  100. package/components/floatingToolbar/FloatingToolbar.vue.js +6 -5
  101. package/components/includeExclude/IncludeExclude.vue.d.ts +1 -1
  102. package/components/includeExclude/IncludeExclude.vue.js +4 -4
  103. package/components/includeExclude/IncludeExcludeAppHeader.vue.js +2 -2
  104. package/components/includeExclude/IncludeExcludeAppTrigger.vue.js +4 -4
  105. package/components/includeExclude/IncludeExcludeChipFilter.vue.js +3 -3
  106. package/components/includeExclude/IncludeExcludeDragDrop.vue.d.ts +1 -1
  107. package/components/includeExclude/IncludeExcludeDragDrop.vue.js +4 -4
  108. package/components/includeExclude/index.d.ts +22 -22
  109. package/components/input/Input.vue.d.ts +2 -2
  110. package/components/input/Input.vue.js +4 -4
  111. package/components/input/index.d.ts +16 -16
  112. package/components/menu/Menu.vue.d.ts +1 -1
  113. package/components/menu/index.d.ts +5 -5
  114. package/components/search/common/Search.common.d.ts +9 -0
  115. package/components/search/common/Search.common.vue.js +52 -0
  116. package/components/search/{Search.vue.js → v3/Search.vue.js} +19 -46
  117. package/components/search/{index.d.ts → v3/index.d.ts} +3 -3
  118. package/components/search/v4/SearchV4.vue.d.ts +51 -0
  119. package/components/search/v4/SearchV4.vue.js +70 -0
  120. package/components/search/v4/index.d.ts +72 -0
  121. package/components/search/v4/index.vue.js +6 -0
  122. package/components/snackbar/Snackbar.vue.d.ts +1 -1
  123. package/components/snackbar/Snackbar.vue.js +6 -5
  124. package/components/switch/{Switch.vue.js → v3/Switch.vue.js} +5 -5
  125. package/components/switch/v4/SwitchV4.vue.d.ts +37 -0
  126. package/components/switch/v4/SwitchV4.vue.js +87 -0
  127. package/components/switch/v4/index.d.ts +46 -0
  128. package/components/switch/v4/index.vue.js +6 -0
  129. package/components/table/Table.vue.js +3 -3
  130. package/components/table-cells/Editable.vue.js +1 -1
  131. package/components/tooltip/Tooltip.vue.d.ts +1 -1
  132. package/components/tooltip/index.d.ts +5 -5
  133. package/components/typography/index.d.ts +9 -9
  134. package/components/typography/v4/Typography.vue.d.ts +34 -0
  135. package/components/typography/v4/Typography.vue.js +68 -0
  136. package/components/typography/v4/index.d.ts +23 -0
  137. package/components/typography/v4/index.vue.js +6 -0
  138. package/design-foundation.stories/border-radius/BorderRadiusData.d.ts +5 -0
  139. package/design-foundation.stories/border-radius/BorderRadiusWrapper.vue.d.ts +4 -0
  140. package/design-foundation.stories/border-radius/index.d.ts +1 -0
  141. package/design-foundation.stories/colors/ColorsData.d.ts +114 -0
  142. package/design-foundation.stories/colors/ColorsStoryWrapper.vue.d.ts +3 -0
  143. package/design-foundation.stories/colors/index.d.ts +1 -0
  144. package/design-foundation.stories/elevations/ElevationStoryWrapper.vue.d.ts +4 -0
  145. package/design-foundation.stories/elevations/ElevationsData.d.ts +10 -0
  146. package/design-foundation.stories/elevations/index.d.ts +1 -0
  147. package/design-foundation.stories/typography/TypographyData.d.ts +7 -0
  148. package/design-foundation.stories/typography/TypographyStoryWrapper.vue.d.ts +3 -0
  149. package/design-foundation.stories/typography/index.d.ts +1 -0
  150. package/index.d.ts +1532 -5
  151. package/index.vue.js +28 -16
  152. package/package.json +39 -14
  153. package/styleguide.scss +77 -78
  154. package/styles/v4/border-radius.css +8 -0
  155. package/styles/v4/colors.css +100 -0
  156. package/styles/v4/elevations.css +10 -0
  157. package/styles/v4/fonts.css +1 -0
  158. package/styles/v4/fonts.css.map +1 -0
  159. package/styles/v4/fonts.scss +258 -0
  160. package/components/button/Button.vue.js +0 -65
  161. package/components/dropdown/Dropdown.vue.js +0 -785
  162. package/components/dropdown/index.vue.js +0 -12
  163. /package/components/button/{IconButton.vue.d.ts → v3/IconButton.vue.d.ts} +0 -0
  164. /package/components/button/{ScrollButton.vue.d.ts → v3/ScrollButton.vue.d.ts} +0 -0
  165. /package/components/button/{index.vue.js → v3/index.vue.js} +0 -0
  166. /package/components/chip/{Chip.vue.d.ts → v3/Chip.vue.d.ts} +0 -0
  167. /package/components/chip/{index.d.ts → v3/index.d.ts} +0 -0
  168. /package/components/chip/{index.vue.js → v3/index.vue.js} +0 -0
  169. /package/components/dropdown/{DropdownContext.d.ts → common/DropdownContext.d.ts} +0 -0
  170. /package/components/dropdown/{DropdownContext.vue.js → common/DropdownContext.vue.js} +0 -0
  171. /package/components/dropdown/{Label.vue.d.ts → common/Label.vue.d.ts} +0 -0
  172. /package/components/dropdown/{Option.vue.d.ts → common/Option.vue.d.ts} +0 -0
  173. /package/components/dropdown/{SearchInput.vue.d.ts → common/SearchInput.vue.d.ts} +0 -0
  174. /package/components/search/{Search.vue.d.ts → v3/Search.vue.d.ts} +0 -0
  175. /package/components/search/{index.vue.js → v3/index.vue.js} +0 -0
  176. /package/components/switch/{Switch.vue.d.ts → v3/Switch.vue.d.ts} +0 -0
  177. /package/components/switch/{index.d.ts → v3/index.d.ts} +0 -0
  178. /package/components/switch/{index.vue.js → v3/index.vue.js} +0 -0
@@ -4,11 +4,12 @@ import { useTimeoutFn } from '@vueuse/core';
4
4
  import Text from '../typography/Text.vue.js';
5
5
  import { NOOP } from '@vue/shared';
6
6
  import { Reason } from './Reason.vue.js';
7
- import IconButton from '../button/IconButton.vue.js';
8
- import Icon from '../icon/Icon.vue.js';
9
7
  import { DialogTestIdModifiers } from '../../testids/index.vue.js';
10
- /* empty css */import _export_sfc from '../../_virtual/plugin-vue_export-helper.vue.js';
11
-
8
+ /* empty css */import _export_sfc from '../../_virtual/plugin-vue_export-helper.vue.js';
9
+ import Icon from '../icon/Icon.vue.js';
10
+ /* empty css */import IconButton from '../button/v3/IconButton.vue.js';
11
+ /* empty css */import 'floating-vue';
12
+ /* empty css *//* empty css *//* empty css */
12
13
  import "../../Dialog.vue_vue_type_style_index_0_scoped_true_lang.css";
13
14
  const _hoisted_1 = ["data-testid"];
14
15
  const _hoisted_2 = ["data-testid"];
@@ -44,7 +45,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
45
  setup(__props, { emit }) {
45
46
  const props = __props;
46
47
  useCssVars((_ctx) => ({
47
- "7d57480a": __props.width
48
+ "49d1a718": __props.width
48
49
  }));
49
50
  const visible = ref(false);
50
51
  let openTimer = void 0;
@@ -136,7 +137,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
136
137
  _: 1
137
138
  })
138
139
  ], true) : createCommentVNode("", true),
139
- __props.showCloseButton ? (openBlock(), createBlock(IconButton, {
140
+ __props.showCloseButton ? (openBlock(), createBlock(unref(IconButton), {
140
141
  key: 1,
141
142
  class: "button close-button",
142
143
  size: "md",
@@ -202,6 +203,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
202
203
  };
203
204
  }
204
205
  });
205
- var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-55aea585"]]);
206
+ var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-544e927f"]]);
206
207
 
207
208
  export { Dialog as default };
@@ -1,4 +1,9 @@
1
1
  declare const DialogTypes: () => import("vue").DefineComponent<{
2
+ themeClass: {
3
+ type: import("vue").PropType<string>;
4
+ } & {
5
+ default: string;
6
+ };
2
7
  title: {
3
8
  type: import("vue").PropType<string>;
4
9
  } & {
@@ -68,11 +73,6 @@ declare const DialogTypes: () => import("vue").DefineComponent<{
68
73
  } & {
69
74
  default: any;
70
75
  };
71
- themeClass: {
72
- type: import("vue").PropType<string>;
73
- } & {
74
- default: string;
75
- };
76
76
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
77
77
  "update:modelValue": (value: boolean) => void;
78
78
  } & {
@@ -80,6 +80,11 @@ declare const DialogTypes: () => import("vue").DefineComponent<{
80
80
  } & {
81
81
  close: (reason: import("./Reason").Reason) => void;
82
82
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
83
+ themeClass: {
84
+ type: import("vue").PropType<string>;
85
+ } & {
86
+ default: string;
87
+ };
83
88
  title: {
84
89
  type: import("vue").PropType<string>;
85
90
  } & {
@@ -149,16 +154,12 @@ declare const DialogTypes: () => import("vue").DefineComponent<{
149
154
  } & {
150
155
  default: any;
151
156
  };
152
- themeClass: {
153
- type: import("vue").PropType<string>;
154
- } & {
155
- default: string;
156
- };
157
157
  }>> & {
158
158
  "onUpdate:modelValue"?: (value: boolean) => any;
159
159
  onClose?: (reason: import("./Reason").Reason) => any;
160
160
  onOpen?: () => any;
161
161
  }, {
162
+ themeClass: string;
162
163
  title: string;
163
164
  testId: string;
164
165
  content: string;
@@ -172,7 +173,6 @@ declare const DialogTypes: () => import("vue").DefineComponent<{
172
173
  showCloseButton: boolean;
173
174
  escapeToClose: boolean;
174
175
  beforeClose: (show: () => void) => void;
175
- themeClass: string;
176
176
  }>[];
177
177
  export { default as Dialog } from './Dialog.vue';
178
178
  export { DialogTypes };
@@ -0,0 +1,36 @@
1
+ import { UseVirtualListItem } from '@vueuse/core';
2
+ import { Ref } from 'vue';
3
+ export declare const dropdownCommon: (props: any, emit: any) => {
4
+ onKeydown: (event: any) => void;
5
+ location: import("vue").ComputedRef<any>;
6
+ open: Ref<boolean>;
7
+ toggleMenu: (value?: any, withFocus?: boolean) => void;
8
+ onButtonKeydown: (event: any) => void;
9
+ displayedValue: import("vue").ComputedRef<any>;
10
+ labelRef: Ref<HTMLLabelElement>;
11
+ query: Ref<string>;
12
+ containerProps: {
13
+ ref: Ref<HTMLElement>;
14
+ onScroll: () => void;
15
+ };
16
+ calculateTableHeight: import("vue").ComputedRef<number>;
17
+ wrapperProps: Ref<{
18
+ style: {
19
+ width: string;
20
+ height: string;
21
+ marginTop: string;
22
+ };
23
+ }>;
24
+ filteredOptions: import("vue").ComputedRef<any>;
25
+ allSelected: import("vue").ComputedRef<boolean>;
26
+ isIndeterminate: import("vue").ComputedRef<boolean>;
27
+ onSelectAll: () => void;
28
+ virtualOptions: Ref<UseVirtualListItem<unknown>[]>;
29
+ isSelected: (arr: any, element: any) => boolean;
30
+ selectedOption: import("vue").WritableComputedRef<unknown>;
31
+ onSelect: (option: any, index?: number) => void;
32
+ activeIndex: Ref<number>;
33
+ onCancel: () => void;
34
+ onApply: () => void;
35
+ scrollTo: (index: number) => void;
36
+ };
@@ -0,0 +1,456 @@
1
+ import { useToggle } from '../../../composables/useToggle.vue.js';
2
+ import { ref, computed, watch, useSlots, nextTick, toRaw, provide, onMounted } from 'vue';
3
+ import { isObjectInArray } from '../../../utils/array.vue.js';
4
+ import { objectsEqual } from '../../../utils/object.vue.js';
5
+ import { useClamp, useVirtualList, onClickOutside } from '@vueuse/core';
6
+ import { Mode, Type, DropdownContext } from './DropdownContext.vue.js';
7
+ import { pxToRem } from '../../../utils/style.vue.js';
8
+
9
+ const dropdownCommon = (props, emit) => {
10
+ const isSelected = (arr, element) => {
11
+ if (props.multi) {
12
+ return isObjectInArray(arr, element);
13
+ }
14
+ return toRaw(arr) === element;
15
+ };
16
+ const MULTILINE_LIST_HEIGHT = 48;
17
+ const LIST_HEIGHT = 34;
18
+ let Focus;
19
+ ((Focus2) => {
20
+ Focus2[Focus2["None"] = 0] = "None";
21
+ Focus2[Focus2["Next"] = 1] = "Next";
22
+ Focus2[Focus2["Previous"] = -1] = "Previous";
23
+ Focus2[Focus2["NextPage"] = 10] = "NextPage";
24
+ Focus2[Focus2["PrevPage"] = -10] = "PrevPage";
25
+ })(Focus || (Focus = {}));
26
+ const selectedOptionRef = ref(
27
+ props.selected
28
+ );
29
+ const selectedOption = computed({
30
+ get() {
31
+ return selectedOptionRef.value;
32
+ },
33
+ set(value) {
34
+ emit("update:selected", value);
35
+ }
36
+ });
37
+ watch(
38
+ () => props.selected,
39
+ () => {
40
+ selectedOptionRef.value = props.selected;
41
+ }
42
+ );
43
+ const slots = useSlots();
44
+ const listRef = ref(null);
45
+ const inputRef = ref(null);
46
+ const el = ref(null);
47
+ const activeOption = ref(null);
48
+ const labelRef = ref(null);
49
+ const buttonRef = ref(null);
50
+ const apply = ref(null);
51
+ const cancel = ref(null);
52
+ const IS_ON_TOP_PADDING = 8;
53
+ const location = computed(() => {
54
+ return buttonRef.value?.getBoundingClientRect().height + IS_ON_TOP_PADDING + props.distance;
55
+ });
56
+ const optionsIds = ref([]);
57
+ const selectedIndex = ref(-1);
58
+ const query = ref("");
59
+ const selectedOptionPrevious = ref([]);
60
+ const focusButton = () => buttonRef.value?.focus();
61
+ const [open, _toggle, disable] = useToggle({
62
+ disabled: props.disabled,
63
+ initialValue: props.defaultOpen
64
+ });
65
+ watch(
66
+ () => props.disabled,
67
+ (value) => {
68
+ if (value !== void 0) {
69
+ disable(value);
70
+ }
71
+ }
72
+ );
73
+ const toggle = (value) => {
74
+ isOpen.value = _toggle(value);
75
+ };
76
+ const isOpen = computed({
77
+ get() {
78
+ return props.isOpen;
79
+ },
80
+ set(value) {
81
+ emit("update:isOpen", value);
82
+ }
83
+ });
84
+ const maxClamped = computed(() => {
85
+ return filteredOptions.value.length - 1;
86
+ });
87
+ const activeIndex = useClamp(0, 0, maxClamped);
88
+ const selectedValue = computed(() => {
89
+ if (selectedOption.value) {
90
+ return props.displayValue(selectedOption.value);
91
+ }
92
+ return "";
93
+ });
94
+ const getMultiselectValueToShow = (selectedOption2) => {
95
+ if (!selectedOption2.value.length && !props.multiOptionsPlaceholderPrefix && !props.multiOptionsPlaceholderSuffix)
96
+ return props.placeholder;
97
+ const multipleOptionsPlaceholder = !props.multiOptionsPlaceholderPrefix && !props.multiOptionsPlaceholderSuffix ? `${selectedOption2.value.length} selected` : `${props.multiOptionsPlaceholderPrefix ?? ""}${selectedOption2.value.length ?? "0"}${props.multiOptionsPlaceholderSuffix ?? ""}`;
98
+ return selectedOption2.value.length == 1 && !!props.displayValue ? props.displayValue(selectedOption2.value[0]) : multipleOptionsPlaceholder;
99
+ };
100
+ const displayedValue = computed(() => {
101
+ if (!props.multi) {
102
+ return selectedOption.value ? props.displayValue(selectedOption.value) : props.placeholder;
103
+ }
104
+ if (!Array.isArray(selectedOptionRef.value)) {
105
+ return;
106
+ }
107
+ return getMultiselectValueToShow(selectedOptionRef);
108
+ });
109
+ const allSelected = computed(() => {
110
+ if (!Array.isArray(selectedOptionRef.value)) {
111
+ return;
112
+ }
113
+ return selectedOptionRef.value.length === filteredOptions.value.length;
114
+ });
115
+ const isIndeterminate = computed(() => {
116
+ if (!props.multi) {
117
+ return false;
118
+ }
119
+ if (!Array.isArray(selectedOptionRef.value)) {
120
+ return false;
121
+ }
122
+ return selectedOptionRef.value.length > 0 && selectedOptionRef.value.length < filteredOptions.value.length;
123
+ });
124
+ const queryChanged = (value) => {
125
+ query.value = value;
126
+ };
127
+ const filteredOptions = computed(
128
+ () => props.options.filter((option) => props.onSearch(option, query.value))
129
+ );
130
+ const hasSubtitle = computed(() => optionsIds.value[0]?.hasSubtitle);
131
+ const isMulti = computed(() => api.mode === Mode.Multi);
132
+ const itemHeight = computed(
133
+ () => hasSubtitle.value ? MULTILINE_LIST_HEIGHT : LIST_HEIGHT
134
+ );
135
+ const {
136
+ list: virtualOptions,
137
+ containerProps,
138
+ wrapperProps,
139
+ scrollTo
140
+ } = useVirtualList(filteredOptions, {
141
+ itemHeight: itemHeight.value
142
+ });
143
+ watch(
144
+ () => props.isOpen,
145
+ (value) => {
146
+ toggle(value);
147
+ }
148
+ );
149
+ watch([selectedIndex], async () => {
150
+ await nextTick();
151
+ });
152
+ watch(
153
+ [open, activeIndex, selectedIndex],
154
+ async ([openNewValue], [openOldValue]) => {
155
+ if (!open.value) {
156
+ return;
157
+ }
158
+ await nextTick();
159
+ if (selectedIndex.value !== -1 && openNewValue !== openOldValue) {
160
+ setTimeout(() => {
161
+ scrollTo(selectedIndex.value);
162
+ });
163
+ }
164
+ if (activeIndex.value) {
165
+ setTimeout(() => {
166
+ scrollTo(activeIndex.value);
167
+ });
168
+ }
169
+ }
170
+ );
171
+ const toggleMenu = (value, withFocus = false) => {
172
+ if (props.disabled) {
173
+ return;
174
+ }
175
+ toggle(value);
176
+ nextTick(() => {
177
+ if (open.value) {
178
+ emit("opened");
179
+ }
180
+ if (!open.value) {
181
+ emit("closed");
182
+ }
183
+ if (listRef.value && withFocus) {
184
+ listRef.value.focus();
185
+ }
186
+ });
187
+ };
188
+ watch(open, (isOpen2) => {
189
+ if (isOpen2) {
190
+ if (isMulti.value && Array.isArray(selectedOption.value)) {
191
+ selectedOptionPrevious.value = toRaw(selectedOption.value).slice();
192
+ }
193
+ return;
194
+ }
195
+ focusButton();
196
+ });
197
+ const onSelectAll = () => {
198
+ selectAll();
199
+ selectedOption.value = selectedOptionRef.value;
200
+ };
201
+ const selectAll = () => {
202
+ if (allSelected.value) {
203
+ selectedOptionRef.value = [];
204
+ return;
205
+ }
206
+ if (!Array.isArray(selectedOptionRef.value)) {
207
+ return;
208
+ }
209
+ if (selectedOptionRef.value.length === filteredOptions.value.length) {
210
+ selectedOptionRef.value = [];
211
+ return;
212
+ }
213
+ selectedOptionRef.value = filteredOptions.value;
214
+ };
215
+ const onSelect = (option, index) => {
216
+ option = toRaw(option);
217
+ const isDisabled = optionsIds.value[index]?.disabled;
218
+ if (isDisabled) {
219
+ return;
220
+ }
221
+ selectedIndex.value = index;
222
+ if (api.mode !== Mode.Multi) {
223
+ if (!props.keepOpen) {
224
+ toggleMenu(false);
225
+ }
226
+ api.goToOption(0 /* None */);
227
+ selectedOption.value = option;
228
+ queryChanged("");
229
+ focusButton();
230
+ if (api.type === Type.Search && inputRef.value) {
231
+ inputRef.value.value = props.displayValue(option);
232
+ }
233
+ return;
234
+ }
235
+ if (!Array.isArray(selectedOptionRef.value)) {
236
+ return;
237
+ }
238
+ inputRef.value?.focus();
239
+ const rawSelectedOption = toRaw(selectedOptionRef.value);
240
+ if (isObjectInArray(rawSelectedOption, option)) {
241
+ selectedOptionRef.value = rawSelectedOption.filter(
242
+ (item) => !objectsEqual(item, option)
243
+ );
244
+ return;
245
+ } else {
246
+ selectedOptionRef.value = [...rawSelectedOption, option];
247
+ return;
248
+ }
249
+ };
250
+ const canFocus = (index) => {
251
+ return optionsIds.value[index]?.disabled;
252
+ };
253
+ const api = {
254
+ activeIndex,
255
+ options: optionsIds,
256
+ selectedOption,
257
+ labelRef,
258
+ activeOption,
259
+ listRef,
260
+ clearable: props.clearable,
261
+ type: slots.input ? Type.Search : Type.Dropdown,
262
+ mode: props.multi ? Mode.Multi : Mode.Single,
263
+ query,
264
+ selectedValue,
265
+ toggle: toggleMenu,
266
+ disabled: props.disabled,
267
+ open,
268
+ mandatory: props.mandatory,
269
+ size: props.size,
270
+ placeholder: props.placeholder,
271
+ select: onSelect,
272
+ clearSelection: () => {
273
+ queryChanged("");
274
+ selectedOption.value = api.mode === Mode.Single ? null : [];
275
+ if (inputRef.value) {
276
+ inputRef.value.value = "";
277
+ }
278
+ },
279
+ search: queryChanged,
280
+ goToOption: async (focus) => {
281
+ if (!open.value) {
282
+ return;
283
+ }
284
+ let index = activeIndex.value + focus;
285
+ const totalDisabled = optionsIds.value.filter(
286
+ (item) => item.disabled
287
+ ).length;
288
+ const total = filteredOptions.value.length - totalDisabled;
289
+ if (index > total) {
290
+ index = total + 1;
291
+ }
292
+ while (true) {
293
+ if (!optionsIds.value[index]?.disabled) {
294
+ activeOption.value = filteredOptions.value[index];
295
+ activeIndex.value = index;
296
+ return;
297
+ }
298
+ if (focus === 1 /* Next */ || focus === 10 /* NextPage */) {
299
+ index = index + 1 /* Next */;
300
+ }
301
+ if (focus === -1 /* Previous */ || focus === -10 /* PrevPage */) {
302
+ index = index + -1 /* Previous */;
303
+ }
304
+ if (!canFocus(activeIndex.value)) {
305
+ continue;
306
+ }
307
+ activeOption.value = filteredOptions.value[index];
308
+ activeIndex.value = index;
309
+ return;
310
+ }
311
+ },
312
+ registerInput: (ref2) => {
313
+ inputRef.value = ref2.value;
314
+ },
315
+ registerOption: (id, disabled, hasSubtitle2) => {
316
+ optionsIds.value = [...optionsIds.value, { id, disabled, hasSubtitle: hasSubtitle2 }];
317
+ },
318
+ unRegisterOption(id) {
319
+ optionsIds.value = optionsIds.value.filter((item) => item.id !== id);
320
+ }
321
+ };
322
+ provide(DropdownContext, api);
323
+ onClickOutside(
324
+ listRef,
325
+ () => {
326
+ if (open.value) {
327
+ onCancel();
328
+ }
329
+ },
330
+ {
331
+ ignore: [buttonRef, apply, cancel, inputRef, containerProps.ref]
332
+ }
333
+ );
334
+ const resetInput = () => {
335
+ if (!inputRef.value) {
336
+ return;
337
+ }
338
+ inputRef.value.value = api.query.value = "";
339
+ };
340
+ onMounted(async () => {
341
+ if (props.autoFocus) {
342
+ await nextTick();
343
+ setTimeout(() => {
344
+ el.value.focus();
345
+ });
346
+ }
347
+ api.goToOption(0);
348
+ });
349
+ const onApply = () => {
350
+ selectedOption.value = selectedOptionRef.value;
351
+ emit("apply", selectedOption.value);
352
+ toggleMenu(false);
353
+ resetInput();
354
+ };
355
+ const onCancel = () => {
356
+ if (isMulti.value && Array.isArray(selectedOptionPrevious.value)) {
357
+ selectedOption.value = toRaw(selectedOptionPrevious.value).slice();
358
+ }
359
+ toggleMenu(false);
360
+ };
361
+ const onButtonKeydown = (event) => {
362
+ if (props.disableKeyboardEvents)
363
+ return;
364
+ switch (event.key) {
365
+ case "Space":
366
+ case "Enter":
367
+ case "ArrowUp":
368
+ case "ArrowDown": {
369
+ toggleMenu(true);
370
+ event.preventDefault();
371
+ }
372
+ }
373
+ };
374
+ const onKeydown = (event) => {
375
+ if (props.disableKeyboardEvents)
376
+ return;
377
+ switch (event.key) {
378
+ case "ArrowUp": {
379
+ api.goToOption(-1 /* Previous */);
380
+ event.preventDefault();
381
+ event.stopPropagation();
382
+ break;
383
+ }
384
+ case "ArrowDown": {
385
+ api.goToOption(1 /* Next */);
386
+ event.preventDefault();
387
+ event.stopPropagation();
388
+ break;
389
+ }
390
+ case "Escape": {
391
+ toggleMenu(false);
392
+ event.preventDefault();
393
+ break;
394
+ }
395
+ case "PageUp": {
396
+ api.goToOption(10 /* NextPage */);
397
+ event.preventDefault();
398
+ break;
399
+ }
400
+ case "PageDown": {
401
+ api.goToOption(-10 /* PrevPage */);
402
+ event.preventDefault();
403
+ break;
404
+ }
405
+ case "Enter": {
406
+ if (!open.value) {
407
+ toggleMenu(true);
408
+ return;
409
+ }
410
+ onSelect(filteredOptions.value[activeIndex.value], activeIndex.value);
411
+ if (api.mode === Mode.Single && !props.keepOpen) {
412
+ toggleMenu(false);
413
+ }
414
+ event.preventDefault();
415
+ break;
416
+ }
417
+ }
418
+ };
419
+ const calculateTableHeight = computed(() => {
420
+ const MAX_NUMBER_OF_OPTIONS = 7;
421
+ const PADDING_PX = 8;
422
+ const optionsLength = virtualOptions.value.length;
423
+ const showSelectAllAddition = props.showSelectAll ? 1 : 0;
424
+ const isThereMoreOptionsThenMax = optionsLength > MAX_NUMBER_OF_OPTIONS;
425
+ const numberOfRows = optionsLength + showSelectAllAddition;
426
+ const numToCalculate = isThereMoreOptionsThenMax ? MAX_NUMBER_OF_OPTIONS + 0.5 : numberOfRows;
427
+ return pxToRem(numToCalculate * itemHeight.value + PADDING_PX);
428
+ });
429
+ return {
430
+ onKeydown,
431
+ location,
432
+ open,
433
+ toggleMenu,
434
+ onButtonKeydown,
435
+ displayedValue,
436
+ labelRef,
437
+ query,
438
+ containerProps,
439
+ calculateTableHeight,
440
+ wrapperProps,
441
+ filteredOptions,
442
+ allSelected,
443
+ isIndeterminate,
444
+ onSelectAll,
445
+ virtualOptions,
446
+ isSelected,
447
+ selectedOption,
448
+ onSelect,
449
+ activeIndex,
450
+ onCancel,
451
+ onApply,
452
+ scrollTo
453
+ };
454
+ };
455
+
456
+ export { dropdownCommon };
@@ -1,10 +1,10 @@
1
1
  import { defineComponent, openBlock, createElementBlock, unref, normalizeClass, createVNode, withCtx, renderSlot, createBlock, createTextVNode, createCommentVNode } from 'vue';
2
- /* empty css */import _export_sfc from '../../_virtual/plugin-vue_export-helper.vue.js';
3
- import Text from '../typography/Text.vue.js';
2
+ /* empty css */import _export_sfc from '../../../_virtual/plugin-vue_export-helper.vue.js';
3
+ import Text from '../../typography/Text.vue.js';
4
4
  import { useDropdownContext } from './DropdownContext.vue.js';
5
- import { useId } from '../../composables/useId.vue.js';
5
+ import { useId } from '../../../composables/useId.vue.js';
6
6
  /* empty css */
7
- import "../../Label.vue_vue_type_style_index_0_scoped_true_lang.css";
7
+ import "../../../Label.vue_vue_type_style_index_0_scoped_true_lang.css";
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
9
  __name: "Label",
10
10
  setup(__props) {
@@ -36,6 +36,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  };
37
37
  }
38
38
  });
39
- var Label = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4bba4499"]]);
39
+ var Label = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5151f81e"]]);
40
40
 
41
41
  export { Label as default };
@@ -1,13 +1,13 @@
1
1
  import { defineComponent, ref, onMounted, onUnmounted, computed, toRaw, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, createBlock, createCommentVNode, renderSlot, createVNode, withCtx, createTextVNode, toDisplayString, withModifiers } from 'vue';
2
- /* empty css */import _export_sfc from '../../_virtual/plugin-vue_export-helper.vue.js';
3
- import Text from '../typography/Text.vue.js';
2
+ /* empty css */import _export_sfc from '../../../_virtual/plugin-vue_export-helper.vue.js';
3
+ import Text from '../../typography/Text.vue.js';
4
4
  import { useDropdownContext, Mode } from './DropdownContext.vue.js';
5
- import { useId } from '../../composables/useId.vue.js';
6
- import Checkbox from '../checkbox/Checkbox.vue.js';
7
- import Icon from '../icon/Icon.vue.js';
5
+ import { useId } from '../../../composables/useId.vue.js';
6
+ import Checkbox from '../../checkbox/Checkbox.vue.js';
7
+ import Icon from '../../icon/Icon.vue.js';
8
8
  import { NOOP } from '@vue/shared';
9
9
  /* empty css */
10
- import "../../Option.vue_vue_type_style_index_0_scoped_true_lang.css";
10
+ import "../../../Option.vue_vue_type_style_index_0_scoped_true_lang.css";
11
11
  const _hoisted_1 = {
12
12
  key: 1,
13
13
  class: "image"
@@ -128,6 +128,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
128
128
  };
129
129
  }
130
130
  });
131
- var Option = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0ea361f0"]]);
131
+ var Option = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c60d0d70"]]);
132
132
 
133
133
  export { Option as default };
@@ -1,10 +1,11 @@
1
1
  import { defineComponent, useSlots, ref, onMounted, computed, watch, renderSlot, unref, createElementVNode, normalizeClass, openBlock, createElementBlock, createCommentVNode, createVNode, withCtx, createBlock } from 'vue';
2
2
  import { useDropdownContext, Mode } from './DropdownContext.vue.js';
3
- import Icon from '../icon/Icon.vue.js';
4
- import IconButton from '../button/IconButton.vue.js';
5
- /* empty css */import _export_sfc from '../../_virtual/plugin-vue_export-helper.vue.js';
6
-
7
- import "../../SearchInput.vue_vue_type_style_index_0_scoped_true_lang.css";
3
+ import Icon from '../../icon/Icon.vue.js';
4
+ /* empty css */import _export_sfc from '../../../_virtual/plugin-vue_export-helper.vue.js';
5
+ /* empty css *//* empty css */import IconButton from '../../button/v3/IconButton.vue.js';
6
+ /* empty css */import 'floating-vue';
7
+ /* empty css *//* empty css *//* empty css */
8
+ import "../../../SearchInput.vue_vue_type_style_index_0_scoped_true_lang.css";
8
9
  const _hoisted_1 = {
9
10
  key: 0,
10
11
  class: "prefix"
@@ -86,7 +87,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
86
87
  onFocusout: _cache[1] || (_cache[1] = ($event) => isFocused.value = false),
87
88
  onInput: onChange
88
89
  }, null, 42, _hoisted_2),
89
- createVNode(IconButton, {
90
+ createVNode(unref(IconButton), {
90
91
  variant: "colorized",
91
92
  size: "sm",
92
93
  theme: "secondary",
@@ -114,6 +115,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
114
115
  };
115
116
  }
116
117
  });
117
- var SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-35368fc5"]]);
118
+ var SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f453145"]]);
118
119
 
119
120
  export { SearchInput as default };