@onereach/ui-components 10.2.1 → 10.2.2-beta.4280.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 (126) hide show
  1. package/dist/bundled/v2/{OrInput-b477f1d1.js → OrInput-6c85b7b7.js} +5 -5
  2. package/dist/bundled/v2/components/OrAutocompleteV3/OrAutocomplete.js +374 -0
  3. package/dist/bundled/v2/components/OrAutocompleteV3/OrAutocomplete.vue.d.ts +252 -0
  4. package/dist/bundled/v2/components/OrAutocompleteV3/index.d.ts +2 -0
  5. package/dist/bundled/v2/components/OrAutocompleteV3/index.js +1 -0
  6. package/dist/bundled/v2/components/OrAutocompleteV3/styles.d.ts +6 -0
  7. package/dist/bundled/v2/components/OrAutocompleteV3/styles.js +36 -0
  8. package/dist/bundled/v2/components/OrAutocompleteV3/types.d.ts +8 -0
  9. package/dist/bundled/v2/components/OrConfirmV3/OrConfirm.js +1 -1
  10. package/dist/bundled/v2/components/OrInputV3/OrInput.js +1 -1
  11. package/dist/bundled/v2/components/OrInputV3/index.js +1 -1
  12. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  13. package/dist/bundled/v2/components/OrSearchV3/OrSearch.js +1 -1
  14. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +9 -9
  15. package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +19 -19
  16. package/dist/bundled/v2/components/index.d.ts +1 -0
  17. package/dist/bundled/v2/components/index.js +2 -1
  18. package/dist/bundled/v2/index.js +3 -2
  19. package/dist/bundled/v3/components/OrAutocompleteV3/OrAutocomplete.js +1 -0
  20. package/dist/bundled/v3/components/OrAutocompleteV3/OrAutocomplete.vue.d.ts +175 -0
  21. package/dist/bundled/v3/components/OrAutocompleteV3/index.d.ts +2 -0
  22. package/dist/bundled/v3/components/OrAutocompleteV3/index.js +1 -0
  23. package/dist/bundled/v3/components/OrAutocompleteV3/styles.d.ts +6 -0
  24. package/dist/bundled/v3/components/OrAutocompleteV3/styles.js +1 -0
  25. package/dist/bundled/v3/components/OrAutocompleteV3/types.d.ts +8 -0
  26. package/dist/bundled/v3/components/OrAutocompleteV3-58c17fd2.js +353 -0
  27. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +1 -1
  28. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +1 -1
  29. package/dist/bundled/v3/components/OrCardCollectionV3/props.js +1 -1
  30. package/dist/bundled/v3/components/OrCardCollectionV3/styles.js +1 -1
  31. package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +1 -1
  32. package/dist/bundled/v3/components/OrConfirmV3/index.js +1 -1
  33. package/dist/bundled/v3/components/OrConfirmV3/props.js +1 -1
  34. package/dist/bundled/v3/components/OrConfirmV3/styles.js +1 -1
  35. package/dist/bundled/v3/components/{OrConfirmV3-ef96fd37.js → OrConfirmV3-88df8d46.js} +1 -1
  36. package/dist/bundled/v3/components/OrInputV3/OrInput.js +1 -1
  37. package/dist/bundled/v3/components/OrInputV3/index.js +1 -1
  38. package/dist/bundled/v3/components/OrInputV3/styles.js +1 -1
  39. package/dist/bundled/v3/components/{OrInputV3-ce85efcb.js → OrInputV3-8aa19578.js} +4 -4
  40. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  41. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  42. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  43. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  44. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  45. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  46. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  47. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  48. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  49. package/dist/bundled/v3/components/{OrRichTextEditorV3-358d7df2.js → OrRichTextEditorV3-af61be87.js} +1 -1
  50. package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +1 -1
  51. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +1 -1
  52. package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +17 -17
  53. package/dist/bundled/v3/components/OrSelectV3/index.js +1 -1
  54. package/dist/bundled/v3/components/OrSelectV3/styles.js +1 -1
  55. package/dist/bundled/v3/components/OrSelectV3/utils/castToMultipleValue.js +1 -1
  56. package/dist/bundled/v3/components/{OrSelectV3-0451208d.js → OrSelectV3-6651e587.js} +9 -9
  57. package/dist/bundled/v3/components/index.d.ts +1 -0
  58. package/dist/bundled/v3/components/index.js +6 -5
  59. package/dist/bundled/v3/index.js +7 -6
  60. package/dist/esm/v2/OrAutocomplete-4f827b8e.js +411 -0
  61. package/dist/esm/v2/{OrAvatar-9fdc8189.js → OrAvatar-d1c2fcbe.js} +1 -1
  62. package/dist/esm/v2/{OrCardCollection-2a2c0b31.js → OrCardCollection-84f61893.js} +1 -1
  63. package/dist/esm/v2/{OrConfirm-a3b6081f.js → OrConfirm-44c92c8d.js} +1 -1
  64. package/dist/esm/v2/{OrInput-a32b517e.js → OrInput-df9953c2.js} +5 -5
  65. package/dist/esm/v2/{OrRichTextEditor-734b8b27.js → OrRichTextEditor-27ab6bfe.js} +1 -1
  66. package/dist/esm/v2/{OrSearch-a57eb24f.js → OrSearch-b6abfe2e.js} +1 -1
  67. package/dist/esm/v2/{OrSelect-da3dfcbc.js → OrSelect-285da0dc.js} +9 -9
  68. package/dist/esm/v2/{OrTag-25029d10.js → OrTag-9abb4fc7.js} +1 -1
  69. package/dist/esm/{v3/color-911f1122.js → v2/color-e5b0b579.js} +15 -15
  70. package/dist/esm/v2/components/index.d.ts +1 -0
  71. package/dist/esm/v2/components/index.js +18 -17
  72. package/dist/esm/v2/components/or-autocomplete-v3/OrAutocomplete.vue.d.ts +252 -0
  73. package/dist/esm/v2/components/or-autocomplete-v3/index.d.ts +2 -0
  74. package/dist/esm/v2/components/or-autocomplete-v3/index.js +36 -0
  75. package/dist/esm/v2/components/or-autocomplete-v3/styles.d.ts +6 -0
  76. package/dist/esm/v2/components/or-autocomplete-v3/types.d.ts +8 -0
  77. package/dist/esm/v2/components/or-avatar-v3/index.js +2 -2
  78. package/dist/esm/v2/components/or-card-collection-v3/index.js +3 -3
  79. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  80. package/dist/esm/v2/components/or-input-v3/index.js +1 -1
  81. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +2 -2
  82. package/dist/esm/v2/components/or-search-v3/index.js +2 -2
  83. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +19 -19
  84. package/dist/esm/v2/components/or-select-v3/index.js +2 -2
  85. package/dist/esm/v2/components/or-tag/index.js +2 -2
  86. package/dist/esm/v2/index.js +14 -13
  87. package/dist/esm/v2/{isNumber-5fb80127.js → isNumber-387ab537.js} +1 -1
  88. package/dist/esm/v2/utils/index.js +2 -2
  89. package/dist/esm/v3/OrAutocomplete-2d82c3aa.js +356 -0
  90. package/dist/esm/v3/{OrAvatar-8befdf0c.js → OrAvatar-1cbce1de.js} +1 -1
  91. package/dist/esm/v3/{OrCardCollection-a39155b7.js → OrCardCollection-ea11bee2.js} +1 -1
  92. package/dist/esm/v3/{OrConfirm-dc97051e.js → OrConfirm-370112de.js} +1 -1
  93. package/dist/esm/v3/{OrInput-880cd853.js → OrInput-07ed979e.js} +4 -4
  94. package/dist/esm/v3/{OrRichTextEditor-b5684aab.js → OrRichTextEditor-8982c75b.js} +1 -1
  95. package/dist/esm/v3/{OrSearch-073955fc.js → OrSearch-0b347d36.js} +1 -1
  96. package/dist/esm/v3/{OrSelect-b8db5eca.js → OrSelect-698f85fa.js} +9 -9
  97. package/dist/esm/v3/{OrTag-c9542465.js → OrTag-cda9ec97.js} +1 -1
  98. package/dist/esm/{v2/color-911f1122.js → v3/color-e5b0b579.js} +15 -15
  99. package/dist/esm/v3/components/index.d.ts +1 -0
  100. package/dist/esm/v3/components/index.js +18 -17
  101. package/dist/esm/v3/components/or-autocomplete-v3/OrAutocomplete.vue.d.ts +175 -0
  102. package/dist/esm/v3/components/or-autocomplete-v3/index.d.ts +2 -0
  103. package/dist/esm/v3/components/or-autocomplete-v3/index.js +34 -0
  104. package/dist/esm/v3/components/or-autocomplete-v3/styles.d.ts +6 -0
  105. package/dist/esm/v3/components/or-autocomplete-v3/types.d.ts +8 -0
  106. package/dist/esm/v3/components/or-avatar-v3/index.js +2 -2
  107. package/dist/esm/v3/components/or-card-collection-v3/index.js +3 -3
  108. package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
  109. package/dist/esm/v3/components/or-input-v3/index.js +1 -1
  110. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +2 -2
  111. package/dist/esm/v3/components/or-search-v3/index.js +2 -2
  112. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +17 -17
  113. package/dist/esm/v3/components/or-select-v3/index.js +2 -2
  114. package/dist/esm/v3/components/or-tag/index.js +2 -2
  115. package/dist/esm/v3/index.js +13 -12
  116. package/dist/esm/v3/{isNumber-5fb80127.js → isNumber-387ab537.js} +1 -1
  117. package/dist/esm/v3/utils/index.js +2 -2
  118. package/package.json +2 -3
  119. package/src/components/index.ts +1 -0
  120. package/src/components/or-autocomplete-v3/OrAutocomplete.vue +364 -0
  121. package/src/components/or-autocomplete-v3/index.ts +2 -0
  122. package/src/components/or-autocomplete-v3/styles.ts +61 -0
  123. package/src/components/or-autocomplete-v3/types.ts +10 -0
  124. package/src/components/or-input-v3/OrInput.vue +3 -3
  125. package/src/components/or-select-v3/OrSelect.vue +10 -10
  126. /package/dist/bundled/v3/components/{OrCardCollectionV3-b9d360ef.js → OrCardCollectionV3-c151ce66.js} +0 -0
@@ -1,5 +1,5 @@
1
- export { H as HSL_LIMITS, t as RX_ABBREVIATION_FROM_STRING, R as RX_ARRAY_NOTATION, a as RX_BV_PREFIX, u as RX_DATE, v as RX_DATE_SPLIT, b as RX_DIGITS, y as RX_ENCODED_COMMA, z as RX_ENCODE_REVERSE, c as RX_EXTENSION, d as RX_HASH, e as RX_HASH_ID, x as RX_HREF, f as RX_HTML_TAGS, g as RX_HYPHENATE, C as RX_LONG_COLOR, h as RX_LOWER_UPPER, i as RX_NUMBER, j as RX_PLUS, A as RX_QUERY_START, k as RX_REGEXP_REPLACE, B as RX_SHORT_COLOR, l as RX_SPACES, m as RX_SPACE_SPLIT, n as RX_STAR, o as RX_START_SPACE_WORD, w as RX_TIME, p as RX_TRIM_LEFT, q as RX_TRIM_RIGHT, r as RX_UNDERSCORE, s as RX_UN_KEBAB, I as generateColorFromString, F as generateHslFromString, J as getHashOfString, D as hexToRgb, G as hslToColorString, K as normalize, E as rgbToHex } from '../color-911f1122.js';
2
- export { C as CODE_BACKSPACE, a as CODE_BREAK, b as CODE_DELETE, c as CODE_DOWN, d as CODE_END, e as CODE_ENTER, f as CODE_ESC, g as CODE_HOME, h as CODE_LEFT, i as CODE_PAGEDOWN, j as CODE_PAGEUP, k as CODE_RIGHT, l as CODE_SPACE, m as CODE_UP, p as PLACEMENT_BOTTOM_END, o as PLACEMENT_BOTTOM_START, t as PLACEMENT_LEFT_END, s as PLACEMENT_LEFT_START, r as PLACEMENT_RIGHT_END, q as PLACEMENT_RIGHT_START, n as PLACEMENT_TOP_END, P as PLACEMENT_TOP_START, u as getAbbreviation, v as isDescendant, w as isNumber } from '../isNumber-5fb80127.js';
1
+ export { H as HSL_LIMITS, t as RX_ABBREVIATION_FROM_STRING, R as RX_ARRAY_NOTATION, a as RX_BV_PREFIX, u as RX_DATE, v as RX_DATE_SPLIT, b as RX_DIGITS, y as RX_ENCODED_COMMA, z as RX_ENCODE_REVERSE, c as RX_EXTENSION, d as RX_HASH, e as RX_HASH_ID, x as RX_HREF, f as RX_HTML_TAGS, g as RX_HYPHENATE, C as RX_LONG_COLOR, h as RX_LOWER_UPPER, i as RX_NUMBER, j as RX_PLUS, A as RX_QUERY_START, k as RX_REGEXP_REPLACE, B as RX_SHORT_COLOR, l as RX_SPACES, m as RX_SPACE_SPLIT, n as RX_STAR, o as RX_START_SPACE_WORD, w as RX_TIME, p as RX_TRIM_LEFT, q as RX_TRIM_RIGHT, r as RX_UNDERSCORE, s as RX_UN_KEBAB, I as generateColorFromString, F as generateHslFromString, J as getHashOfString, D as hexToRgb, G as hslToColorString, K as normalize, E as rgbToHex } from '../color-e5b0b579.js';
2
+ export { C as CODE_BACKSPACE, a as CODE_BREAK, b as CODE_DELETE, c as CODE_DOWN, d as CODE_END, e as CODE_ENTER, f as CODE_ESC, g as CODE_HOME, h as CODE_LEFT, i as CODE_PAGEDOWN, j as CODE_PAGEUP, k as CODE_RIGHT, l as CODE_SPACE, m as CODE_UP, p as PLACEMENT_BOTTOM_END, o as PLACEMENT_BOTTOM_START, t as PLACEMENT_LEFT_END, s as PLACEMENT_LEFT_START, r as PLACEMENT_RIGHT_END, q as PLACEMENT_RIGHT_START, n as PLACEMENT_TOP_END, P as PLACEMENT_TOP_START, u as getAbbreviation, v as isDescendant, w as isNumber } from '../isNumber-387ab537.js';
3
3
  export { M as MutationObs, f as addClass, c as cancelAF, e as contains, l as getAttr, q as getBCR, g as getById, t as getCS, w as getMaxZIndex, p as getStyle, m as hasAttr, i as hasClass, u as offset, v as position, b as reflow, k as removeAttr, h as removeClass, a as removeNode, o as removeStyle, r as requestAF, d as select, s as selectAll, j as setAttr, n as setStyle } from '../dom-53c9635b.js';
4
4
  export { p as pxToRem } from '../px-to-rem-0b26b83e.js';
5
5
  export { i as isAncestor } from '../isAncestor-9e33bd15.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "10.2.1",
3
+ "version": "10.2.2-beta.4280.0",
4
4
  "npmUnpacked": "4.15.2",
5
5
  "description": "Vue components library for v2/3",
6
6
  "sideEffects": false,
@@ -177,6 +177,5 @@
177
177
  "default": "./dist/bundled/v3/components/*/index.js"
178
178
  },
179
179
  "./package.json": "./package.json"
180
- },
181
- "gitHead": "2ee3faa9a82bf376dd84e72aba2b60b9600e2c0d"
180
+ }
182
181
  }
@@ -1,3 +1,4 @@
1
+ export * from './or-autocomplete-v3';
1
2
  export * from './or-avatar';
2
3
  export * from './or-avatar-v3';
3
4
  export * from './or-bottom-sheet-v3';
@@ -0,0 +1,364 @@
1
+ <template>
2
+ <div
3
+ :ref="'root'"
4
+ :class="rootStyles"
5
+ >
6
+ <template v-if="$slots.label || $slots.addon || label">
7
+ <OrLabel
8
+ :control-id="attributes.id"
9
+ :variant="'input'"
10
+ :required="required"
11
+ :disabled="disabled"
12
+ >
13
+ <slot name="label">
14
+ {{ label }}
15
+ </slot>
16
+
17
+ <template v-slot:addon>
18
+ <slot name="addon" />
19
+ </template>
20
+ </OrLabel>
21
+ </template>
22
+
23
+ <OrInputBox
24
+ :ref="'inputBox'"
25
+ :class="[popoverState === 'open' && (popover && popover.isFlipped ? 'rounded-t-0' : 'rounded-b-0')]"
26
+ :variant="disableDefaultStyles ? 'unstyled' : 'styled'"
27
+ :size="size"
28
+ :invalid="!!error"
29
+ :readonly="readonly"
30
+ :disabled="disabled"
31
+ >
32
+ <input
33
+ :ref="'сontrol'"
34
+ v-bind="attributes"
35
+ :class="controlStyles"
36
+ :type="'text'"
37
+ :value="searchText || selectedItem && selectedItem.label"
38
+ :placeholder="placeholder"
39
+ :required="required"
40
+ :readonly="readonly"
41
+ :disabled="disabled"
42
+ @input="$emit('input', $event); onInput($event)"
43
+ @keydown="$emit('keydown', $event)"
44
+ @keyup="$emit('keyup', $event)"
45
+ @focus="$emit('focus', $event)"
46
+ @blur="$emit('blur', $event)"
47
+ >
48
+
49
+ <template
50
+ v-if="loading"
51
+ v-slot:addon
52
+ >
53
+ <OrLoader
54
+ :variant="'circular'"
55
+ :color="error ? 'danger' : 'primary'"
56
+ :size="isMobile ? 'm' : 's'"
57
+ />
58
+ </template>
59
+
60
+ <template
61
+ v-else-if="enableClear && !readonly && model"
62
+ v-slot:addon
63
+ >
64
+ <OrIconButton
65
+ :icon="'close'"
66
+ :color="'inherit'"
67
+ :disabled="disabled"
68
+ @click="model = undefined"
69
+ />
70
+ </template>
71
+
72
+ <OrPopover
73
+ :ref="'popover'"
74
+ :class="dropdownStyles"
75
+ :custom-styles="dropdownStyles"
76
+ :is-open="!!searchText"
77
+ :variant="'auto'"
78
+ :trigger="inputBoxRoot"
79
+ :placement="'bottom'"
80
+ :offset="0"
81
+ :full-width="true"
82
+ :disable-default-styles="true"
83
+ @close="searchText = undefined"
84
+ >
85
+ <OrMenuItem
86
+ v-for="(item, i) in filteredItems"
87
+ :key="i"
88
+ :class="dropdownItemStyles"
89
+ @click="updateModel(item.value)"
90
+ >
91
+ {{ item.label }}
92
+ </OrMenuItem>
93
+ </OrPopover>
94
+ </OrInputBox>
95
+
96
+ <div
97
+ v-show="!error"
98
+ :class="['contents']"
99
+ >
100
+ <template v-if="$slots.hint || hint">
101
+ <OrHint :disabled="disabled">
102
+ <slot name="hint">
103
+ {{ hint }}
104
+ </slot>
105
+ </OrHint>
106
+ </template>
107
+ </div>
108
+
109
+ <div
110
+ v-show="typeof error === 'string' && error.length > 0"
111
+ :class="['contents']"
112
+ >
113
+ <OrError :disabled="disabled">
114
+ {{ error }}
115
+ </OrError>
116
+ </div>
117
+ </div>
118
+ </template>
119
+
120
+ <script lang="ts">
121
+ import { PropType, computed, defineComponent, reactive, ref, toRef, watch } from 'vue-demi';
122
+ import { useControlAttributes, useIdAttribute, useProxyModelValue, useResponsive, useValidationAttributes } from '../../hooks';
123
+ import { OrErrorV3 as OrError } from '../or-error-v3';
124
+ import { OrHintV3 as OrHint } from '../or-hint-v3';
125
+ import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
126
+ import { InputBoxSize, OrInputBoxV3 as OrInputBox } from '../or-input-box-v3';
127
+ import { OrLabelV3 as OrLabel } from '../or-label-v3';
128
+ import { OrLoaderV3 as OrLoader } from '../or-loader-v3';
129
+ import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
130
+ import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
131
+ import { Autocomplete, AutocompleteControl, AutocompleteDropdown, AutocompleteDropdownDefault, AutocompleteDropdownFlipped, AutocompleteDropdownItem } from './styles';
132
+ import { AutocompleteHandler, AutocompleteItem, AutocompleteModelValue } from './types';
133
+
134
+ export default defineComponent({
135
+ name: 'OrAutocomplete',
136
+
137
+ components: {
138
+ OrError,
139
+ OrHint,
140
+ OrIconButton,
141
+ OrInputBox,
142
+ OrLabel,
143
+ OrLoader,
144
+ OrMenuItem,
145
+ OrPopover,
146
+ },
147
+
148
+ model: {
149
+ prop: 'modelValue',
150
+ event: 'update:modelValue',
151
+ },
152
+
153
+ props: {
154
+ modelValue: {
155
+ type: undefined as unknown as PropType<AutocompleteModelValue>,
156
+ default: undefined,
157
+ },
158
+
159
+ items: {
160
+ type: Array as PropType<AutocompleteItem[]>,
161
+ default: () => [],
162
+ },
163
+
164
+ handler: {
165
+ type: Function as PropType<AutocompleteHandler>,
166
+
167
+ default: (
168
+ async (searchText, items) => {
169
+ return items.filter(({ label }) => new RegExp(searchText, 'i').test(label));
170
+ }
171
+ ) as AutocompleteHandler,
172
+ },
173
+
174
+ size: {
175
+ type: String as PropType<`${InputBoxSize}`>,
176
+ default: () => InputBoxSize.M,
177
+ },
178
+
179
+ label: {
180
+ type: String,
181
+ default: undefined,
182
+ },
183
+
184
+ placeholder: {
185
+ type: String,
186
+ default: undefined,
187
+ },
188
+
189
+ hint: {
190
+ type: String,
191
+ default: undefined,
192
+ },
193
+
194
+ error: {
195
+ type: [String, Boolean],
196
+ default: undefined,
197
+ },
198
+
199
+ loading: {
200
+ type: Boolean,
201
+ default: false,
202
+ },
203
+
204
+ required: {
205
+ type: Boolean,
206
+ default: false,
207
+ },
208
+
209
+ readonly: {
210
+ type: Boolean,
211
+ default: false,
212
+ },
213
+
214
+ disabled: {
215
+ type: Boolean,
216
+ default: false,
217
+ },
218
+
219
+ disableDefaultStyles: {
220
+ type: Boolean,
221
+ default: false,
222
+ },
223
+
224
+ enableClear: {
225
+ type: Boolean,
226
+ default: false,
227
+ },
228
+ },
229
+
230
+ emits: [
231
+ 'update:modelValue',
232
+
233
+ 'input',
234
+ 'keydown',
235
+ 'keyup',
236
+ 'focus',
237
+ 'blur',
238
+ ],
239
+
240
+ expose: [
241
+ 'root',
242
+ ],
243
+
244
+ setup(props, context) {
245
+ const attributes = reactive({
246
+ id: useIdAttribute(),
247
+ ...useControlAttributes(),
248
+ ...useValidationAttributes(),
249
+ });
250
+
251
+ // Refs & Styles
252
+ const root = ref<HTMLElement>();
253
+
254
+ const rootStyles = computed(() => [
255
+ 'or-autocomplete-v3',
256
+ ...Autocomplete,
257
+ ]);
258
+
259
+ const inputBox = ref<InstanceType<typeof OrInputBox>>();
260
+ const inputBoxRoot = computed(() => inputBox.value?.root);
261
+
262
+ const control = ref<HTMLElement>();
263
+
264
+ const controlStyles = computed(() => [
265
+ ...AutocompleteControl,
266
+ ]);
267
+
268
+ const popover = ref<InstanceType<typeof OrPopover>>();
269
+ const popoverRoot = computed(() => popover.value?.root);
270
+ const popoverState = computed(() => popover.value?.state);
271
+
272
+ const dropdownStyles = computed(() => [
273
+ 'or-autocomplete-popover-v3',
274
+ ...AutocompleteDropdown,
275
+ ...popover.value?.isFlipped ? AutocompleteDropdownFlipped : AutocompleteDropdownDefault,
276
+ ]);
277
+
278
+ const dropdownItemStyles = computed(() => [
279
+ ...AutocompleteDropdownItem,
280
+ ]);
281
+
282
+ // State
283
+ const model = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
284
+ const searchText = ref<string>();
285
+
286
+ const selectedItem = computed(() => {
287
+ return props.items.find(({ value }) => model.value === value);
288
+ });
289
+
290
+ const filteredItems = ref<AutocompleteItem[]>();
291
+
292
+ watch([
293
+ searchText,
294
+ () => props.items,
295
+ () => props.handler,
296
+ ], async ([
297
+ searchText,
298
+ items,
299
+ handler,
300
+ ]) => {
301
+ if (searchText) {
302
+ filteredItems.value = await handler(searchText, items);
303
+ }
304
+ }, { deep: true });
305
+
306
+ // Handlers
307
+ function onInput(event: InputEvent): void {
308
+ searchText.value = (event.target as HTMLInputElement).value;
309
+ }
310
+
311
+ // Methods
312
+ function updateModel(value: AutocompleteModelValue): void {
313
+ model.value = value;
314
+ searchText.value = undefined;
315
+ }
316
+
317
+ function focus(): void {
318
+ control.value?.focus();
319
+ }
320
+
321
+ function blur(): void {
322
+ control.value?.blur();
323
+ }
324
+
325
+ // Helpers
326
+ const { isMobile } = useResponsive();
327
+
328
+ return {
329
+ attributes,
330
+
331
+ root,
332
+ rootStyles,
333
+
334
+ inputBox,
335
+ inputBoxRoot,
336
+
337
+ control,
338
+ controlStyles,
339
+
340
+ popover,
341
+ popoverRoot,
342
+ popoverState,
343
+
344
+ dropdownStyles,
345
+ dropdownItemStyles,
346
+
347
+ model,
348
+ searchText,
349
+
350
+ selectedItem,
351
+ filteredItems,
352
+
353
+ onInput,
354
+
355
+ updateModel,
356
+
357
+ focus,
358
+ blur,
359
+
360
+ isMobile,
361
+ };
362
+ },
363
+ });
364
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as OrAutocompleteV3 } from './OrAutocomplete.vue';
2
+ export * from './types';
@@ -0,0 +1,61 @@
1
+ export const Autocomplete: string[] = [
2
+ // Layout
3
+ 'layout-column',
4
+
5
+ // Spacing
6
+ 'gap-xs',
7
+ ];
8
+
9
+ export const AutocompleteControl: string[] = [
10
+ // Box
11
+ 'w-full',
12
+
13
+ // Typography
14
+ 'typography-inherit',
15
+
16
+ // Theme
17
+ 'theme-background-transparent',
18
+ 'dark:theme-background-transparent-dark',
19
+
20
+ 'outline-none',
21
+
22
+ // Theme (placeholder)
23
+ 'placeholder:theme-foreground-outline',
24
+ 'dark:placeholder:theme-foreground-outline-dark',
25
+ ];
26
+
27
+ export const AutocompleteDropdown: string[] = [
28
+ // Overflow
29
+ 'overflow-y-auto',
30
+
31
+ // Box
32
+ 'max-h-[340px]',
33
+
34
+ // Theme
35
+ 'theme-background-default',
36
+ 'dark:theme-background-default-dark',
37
+
38
+ 'theme-border-1-outline',
39
+ 'dark:theme-border-1-outline-dark',
40
+ ];
41
+
42
+ export const AutocompleteDropdownDefault: string[] = [
43
+ // Shape
44
+ 'rounded-b-md',
45
+
46
+ // Theme
47
+ '!border-t-0',
48
+ ];
49
+
50
+ export const AutocompleteDropdownFlipped: string[] = [
51
+ // Shape
52
+ 'rounded-t-md',
53
+
54
+ // Theme
55
+ '!border-b-0',
56
+ ];
57
+
58
+ export const AutocompleteDropdownItem: string[] = [
59
+ // Typography
60
+ '!typography-body-2-regular',
61
+ ];
@@ -0,0 +1,10 @@
1
+ export type AutocompleteModelValue = string | number | object | null | undefined;
2
+
3
+ export interface AutocompleteItem {
4
+ value: NonNullable<AutocompleteModelValue>;
5
+ label: string;
6
+ }
7
+
8
+ export interface AutocompleteHandler {
9
+ (searchText: string, items: AutocompleteItem[]): Promise<AutocompleteItem[]>;
10
+ }
@@ -53,7 +53,7 @@
53
53
  <template v-if="loading">
54
54
  <OrLoader
55
55
  :variant="'circular'"
56
- :color="'primary'"
56
+ :color="error ? 'danger' : 'primary'"
57
57
  :size="isMobile ? 'm' : 's'"
58
58
  />
59
59
  </template>
@@ -69,11 +69,11 @@
69
69
  </template>
70
70
 
71
71
  <template v-if="type === 'search'">
72
- <template v-if="modelValue">
72
+ <template v-if="modelValue && !readonly">
73
73
  <OrIconButton
74
74
  :icon="'close'"
75
75
  :color="'inherit'"
76
- :disabled="readonly || disabled"
76
+ :disabled="disabled"
77
77
  @click.stop="$emit('update:modelValue', '')"
78
78
  />
79
79
  </template>
@@ -310,6 +310,11 @@ export default defineComponent({
310
310
  },
311
311
 
312
312
  props: {
313
+ modelValue: {
314
+ type: [Object, String, Number, Array] as PropType<SelectValue>,
315
+ default: undefined,
316
+ },
317
+
313
318
  options: {
314
319
  type: Array as PropType<SelectOption[]>,
315
320
  default: () => [],
@@ -320,16 +325,16 @@ export default defineComponent({
320
325
  default: () => [],
321
326
  },
322
327
 
323
- modelValue: {
324
- type: [Object, String, Number, Array] as PropType<SelectValue>,
325
- default: undefined,
326
- },
327
-
328
328
  multiple: {
329
329
  type: Boolean,
330
330
  default: false,
331
331
  },
332
332
 
333
+ overflow: {
334
+ type: String as PropType<`${TagsOverflow}`>,
335
+ default: () => TagsOverflow.Hidden,
336
+ },
337
+
333
338
  size: {
334
339
  type: String as PropType<`${InputBoxSize}`>,
335
340
  default: () => InputBoxSize.M,
@@ -397,11 +402,6 @@ export default defineComponent({
397
402
  type: Boolean,
398
403
  default: false,
399
404
  },
400
-
401
- overflow: {
402
- type: String as PropType<`${TagsOverflow}`>,
403
- default: () => TagsOverflow.Hidden,
404
- },
405
405
  },
406
406
 
407
407
  emits: [