@onereach/ui-components 5.3.0-beta.3171.0 → 5.3.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 (34) hide show
  1. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +115 -39
  2. package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +13 -2
  3. package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
  4. package/dist/bundled/v2/components/OrSelectV3/styles.d.ts +0 -1
  5. package/dist/bundled/v2/components/OrSelectV3/styles.js +1 -8
  6. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-a69c2fd5.js → OrSelect.vue_vue_type_script_lang-21b9f7b7.js} +82 -29
  7. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +28 -23
  8. package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +10 -1
  9. package/dist/bundled/v3/components/OrSelectV3/index.js +2 -2
  10. package/dist/bundled/v3/components/OrSelectV3/styles.d.ts +0 -1
  11. package/dist/bundled/v3/components/OrSelectV3/styles.js +1 -8
  12. package/dist/bundled/v3/components/index.js +1 -1
  13. package/dist/bundled/v3/index.js +1 -1
  14. package/dist/esm/v2/{OrSelect-dcc41043.js → OrSelect-34782e78.js} +112 -44
  15. package/dist/esm/v2/components/index.js +1 -1
  16. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +13 -2
  17. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  18. package/dist/esm/v2/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue.d.ts +24 -0
  19. package/dist/esm/v2/components/or-select-v3/partials/or-select-placeholder/styles.d.ts +1 -0
  20. package/dist/esm/v2/components/or-select-v3/styles.d.ts +0 -1
  21. package/dist/esm/v2/index.js +1 -1
  22. package/dist/esm/v3/{OrSelect-a6e29937.js → OrSelect-ba0f0da3.js} +107 -57
  23. package/dist/esm/v3/components/index.js +1 -1
  24. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +10 -1
  25. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  26. package/dist/esm/v3/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue.d.ts +17 -0
  27. package/dist/esm/v3/components/or-select-v3/partials/or-select-placeholder/styles.d.ts +1 -0
  28. package/dist/esm/v3/components/or-select-v3/styles.d.ts +0 -1
  29. package/dist/esm/v3/index.js +1 -1
  30. package/package.json +3 -2
  31. package/src/components/or-select-v3/OrSelect.vue +25 -21
  32. package/src/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue +43 -0
  33. package/src/components/or-select-v3/partials/or-select-placeholder/styles.ts +11 -0
  34. package/src/components/or-select-v3/styles.ts +0 -12
@@ -1,25 +1,25 @@
1
- import { defineComponent, getCurrentInstance, ref, computed, toRef, onMounted, watch } from 'vue-demi';
1
+ import { defineComponent, ref, computed, getCurrentInstance, toRefs, onMounted, watch } from 'vue-demi';
2
2
  import { isEmptyValue } from '../../utils/isEmptyValue.js';
3
- import { Select, SelectControl, SelectSearchControl, SelectPlaceholder, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './styles.js';
4
- import __vue_component__$1 from '../OrCheckboxV3/OrCheckbox.js';
5
- import __vue_component__$2 from '../OrErrorV3/OrError.js';
6
- import __vue_component__$3 from '../OrExpansionPanelV3/OrExpansionPanel.js';
7
- import __vue_component__$4 from '../OrHintV3/OrHint.js';
8
- import __vue_component__$5 from '../OrIconV3/OrIcon.js';
9
- import __vue_component__$6 from '../OrIconButtonV3/OrIconButton.js';
10
- import __vue_component__$7 from '../OrInputV3/OrInput.js';
11
- import __vue_component__$8 from '../OrInputBoxV3/OrInputBox.js';
12
- import __vue_component__$9 from '../OrLabelV3/OrLabel.js';
13
- import __vue_component__$a from '../OrMenuItemV3/OrMenuItem.js';
14
- import __vue_component__$b from '../OrPopoverV3/OrPopover.js';
15
- import __vue_component__$c from '../OrTagV3/OrTag.js';
3
+ import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
4
+ import { Select, SelectControl, SelectSearchControl, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './styles.js';
5
+ import __vue_component__$2 from '../OrCheckboxV3/OrCheckbox.js';
6
+ import __vue_component__$3 from '../OrErrorV3/OrError.js';
7
+ import __vue_component__$4 from '../OrExpansionPanelV3/OrExpansionPanel.js';
8
+ import __vue_component__$5 from '../OrHintV3/OrHint.js';
9
+ import __vue_component__$6 from '../OrIconV3/OrIcon.js';
10
+ import __vue_component__$7 from '../OrIconButtonV3/OrIconButton.js';
11
+ import __vue_component__$8 from '../OrInputV3/OrInput.js';
12
+ import __vue_component__$9 from '../OrInputBoxV3/OrInputBox.js';
13
+ import __vue_component__$a from '../OrLabelV3/OrLabel.js';
14
+ import __vue_component__$b from '../OrMenuItemV3/OrMenuItem.js';
15
+ import __vue_component__$c from '../OrPopoverV3/OrPopover.js';
16
+ import __vue_component__$d from '../OrTagV3/OrTag.js';
16
17
  import { useOverflow } from '../../hooks/useOverflow.js';
17
18
  import { DropdownClose } from '../../directives/dropdown-close.js';
18
19
  import { DropdownOpen } from '../../directives/dropdown-open.js';
19
20
  import { InputBoxSize } from '../OrInputBoxV3/props.js';
20
21
  import { useProxyModelValue } from '../../hooks/useProxyModelValue.js';
21
22
  import useResponsive from '../../hooks/useResponsive/useResponsive.js';
22
- import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
23
23
  import '../OrCheckboxV3/styles.js';
24
24
  import '../OrLabelV3/props.js';
25
25
  import '../../hooks/useIdAttribute.js';
@@ -64,20 +64,87 @@ import '../../utils/isVisible.js';
64
64
  import '../OrTagV3/props.js';
65
65
  import '../OrTagV3/styles.js';
66
66
 
67
+ const SelectPlaceholder = [
68
+ // Interactivity
69
+ 'interactivity-none',
70
+ // Typography
71
+ 'typography-inherit truncate',
72
+ // Theme
73
+ 'theme-foreground-outline', 'dark:theme-foreground-outline-dark'];
74
+
75
+ var script$1 = defineComponent({
76
+ props: {
77
+ disabled: {
78
+ type: Boolean,
79
+ default: false
80
+ }
81
+ },
82
+ expose: ['root'],
83
+ setup() {
84
+ // Refs
85
+ const root = ref();
86
+ // Styles
87
+ const rootStyles = computed(() => ['or-select-placeholder-v3', ...SelectPlaceholder]);
88
+ return {
89
+ root,
90
+ rootStyles
91
+ };
92
+ }
93
+ });
94
+
95
+ /* script */
96
+ const __vue_script__$1 = script$1;
97
+
98
+ /* template */
99
+ var __vue_render__$1 = function () {
100
+ var _vm = this;
101
+ var _h = _vm.$createElement;
102
+ var _c = _vm._self._c || _h;
103
+ return _c('div', {
104
+ ref: "root",
105
+ class: _vm.rootStyles,
106
+ attrs: {
107
+ "disabled": _vm.disabled ? '' : null
108
+ }
109
+ }, [_vm._t("default")], 2);
110
+ };
111
+ var __vue_staticRenderFns__$1 = [];
112
+
113
+ /* style */
114
+ const __vue_inject_styles__$1 = undefined;
115
+ /* scoped */
116
+ const __vue_scope_id__$1 = undefined;
117
+ /* module identifier */
118
+ const __vue_module_identifier__$1 = undefined;
119
+ /* functional template */
120
+ const __vue_is_functional_template__$1 = false;
121
+ /* style inject */
122
+
123
+ /* style inject SSR */
124
+
125
+ /* style inject shadow dom */
126
+
127
+ const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
128
+ render: __vue_render__$1,
129
+ staticRenderFns: __vue_staticRenderFns__$1
130
+ }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
131
+ var OrSelectPlaceholder = __vue_component__$1;
132
+
67
133
  var script = defineComponent({
68
134
  components: {
69
- OrCheckbox: __vue_component__$1,
70
- OrError: __vue_component__$2,
71
- OrExpansionPanel: __vue_component__$3,
72
- OrHint: __vue_component__$4,
73
- OrIcon: __vue_component__$5,
74
- OrIconButton: __vue_component__$6,
75
- OrInput: __vue_component__$7,
76
- OrInputBox: __vue_component__$8,
77
- OrLabel: __vue_component__$9,
78
- OrMenuItem: __vue_component__$a,
79
- OrPopover: __vue_component__$b,
80
- OrTag: __vue_component__$c
135
+ OrCheckbox: __vue_component__$2,
136
+ OrError: __vue_component__$3,
137
+ OrExpansionPanel: __vue_component__$4,
138
+ OrHint: __vue_component__$5,
139
+ OrIcon: __vue_component__$6,
140
+ OrIconButton: __vue_component__$7,
141
+ OrInput: __vue_component__$8,
142
+ OrInputBox: __vue_component__$9,
143
+ OrLabel: __vue_component__$a,
144
+ OrMenuItem: __vue_component__$b,
145
+ OrPopover: __vue_component__$c,
146
+ OrSelectPlaceholder,
147
+ OrTag: __vue_component__$d
81
148
  },
82
149
  directives: {
83
150
  DropdownClose,
@@ -144,6 +211,10 @@ var script = defineComponent({
144
211
  type: Boolean,
145
212
  default: false
146
213
  },
214
+ enableClear: {
215
+ type: Boolean,
216
+ default: false
217
+ },
147
218
  searchFunction: {
148
219
  type: Function,
149
220
  default: async (searchText, options) => {
@@ -187,11 +258,15 @@ var script = defineComponent({
187
258
  var _a;
188
259
  return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
189
260
  });
261
+ // Props
262
+ const {
263
+ enableClear,
264
+ modelValue
265
+ } = toRefs(props);
190
266
  // Styles
191
267
  const rootStyles = computed(() => ['or-select-v3', ...Select]);
192
268
  const controlStyles = computed(() => [...SelectControl]);
193
269
  const searchControlStyles = computed(() => [...SelectSearchControl]);
194
- const placeholderStyles = computed(() => [...SelectPlaceholder]);
195
270
  const dropdownStyles = computed(() => {
196
271
  var _a;
197
272
  return [...SelectDropdown, ...(((_a = popover.value) === null || _a === void 0 ? void 0 : _a.isFlipped) ? SelectDropdownFlipped : SelectDropdownDefault)];
@@ -200,10 +275,13 @@ var script = defineComponent({
200
275
  const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
201
276
  // State
202
277
  const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
203
- const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
278
+ const proxyModelValue = useProxyModelValue(modelValue, context.emit);
204
279
  const isEmptyModelValue = computed(() => {
205
280
  return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
206
281
  });
282
+ const showClear = computed(() => {
283
+ return enableClear.value && !isEmptyModelValue.value;
284
+ });
207
285
  onMounted(() => {
208
286
  if (!proxyModelValue.value && props.multiple) {
209
287
  proxyModelValue.value = [];
@@ -303,7 +381,6 @@ var script = defineComponent({
303
381
  rootStyles,
304
382
  controlStyles,
305
383
  searchControlStyles,
306
- placeholderStyles,
307
384
  dropdownStyles,
308
385
  dropdownItemStyles,
309
386
  noSearchResultsStyles,
@@ -311,6 +388,7 @@ var script = defineComponent({
311
388
  proxyModelValue,
312
389
  readonly,
313
390
  isEmptyModelValue,
391
+ showClear,
314
392
  selection,
315
393
  searchText,
316
394
  internalSearchOptions,
@@ -395,8 +473,8 @@ var __vue_render__ = function () {
395
473
  return _c('OrTag', {
396
474
  key: option.value,
397
475
  attrs: {
398
- "variant": 'reset',
399
- "disabled": _vm.disabled || _vm.readonly
476
+ "variant": _vm.readonly || _vm.disabled ? 'tag' : 'reset',
477
+ "disabled": _vm.disabled
400
478
  },
401
479
  on: {
402
480
  "reset": function ($event) {
@@ -407,10 +485,9 @@ var __vue_render__ = function () {
407
485
  });
408
486
  }, {
409
487
  "model": _vm.proxyModelValue
410
- })] : _vm.popoverState === 'closed' || !_vm.enableSearch ? [_c('span', {
411
- class: _vm.placeholderStyles,
488
+ })] : _vm.popoverState === 'closed' || !_vm.enableSearch ? [_c('OrSelectPlaceholder', {
412
489
  attrs: {
413
- "disabled": _vm.disabled ? '' : null
490
+ "disabled": _vm.disabled
414
491
  }
415
492
  }, [_vm._v("\n " + _vm._s(_vm.placeholder) + "\n ")])] : _vm._e()] : [!_vm.isEmptyModelValue ? [_vm._t("valueTemplate", function () {
416
493
  return [_c('span', {
@@ -418,10 +495,9 @@ var __vue_render__ = function () {
418
495
  }, [_vm._v("\n " + _vm._s(_vm.selection && _vm.selection.label) + "\n ")])];
419
496
  }, {
420
497
  "model": _vm.proxyModelValue
421
- })] : _vm.popoverState === 'closed' || !_vm.enableSearch ? [_c('span', {
422
- class: _vm.placeholderStyles,
498
+ })] : _vm.popoverState === 'closed' || !_vm.enableSearch ? [_c('OrSelectPlaceholder', {
423
499
  attrs: {
424
- "disabled": _vm.disabled ? '' : null
500
+ "disabled": _vm.disabled
425
501
  }
426
502
  }, [_vm._v("\n " + _vm._s(_vm.placeholder) + "\n ")])] : _vm._e()]], 2), _vm._v(" "), _vm.multiple && _vm.outerItems.length > 0 ? [_vm._v("\n +" + _vm._s(_vm.outerItems.length) + "\n ")] : _vm._e(), _vm._v(" "), _vm.popoverState === 'open' && _vm.enableSearch && _vm.isDesktop ? [_c('OrInput', {
427
503
  ref: "searchControl",
@@ -448,7 +524,7 @@ var __vue_render__ = function () {
448
524
  class: ['grow']
449
525
  })], _vm._v(" "), _c('div', {
450
526
  class: ['layout-inline-row', 'gap-sm']
451
- }, [_vm.popoverState === 'closed' && !_vm.isEmptyModelValue ? [_c('OrIconButton', {
527
+ }, [_vm.showClear ? [_c('OrIconButton', {
452
528
  attrs: {
453
529
  "icon": 'close',
454
530
  "color": 'inherit',
@@ -21,7 +21,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
21
21
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
22
22
  controlStyles: import("@vue/composition-api").ComputedRef<string[]>;
23
23
  searchControlStyles: import("@vue/composition-api").ComputedRef<string[]>;
24
- placeholderStyles: import("@vue/composition-api").ComputedRef<string[]>;
25
24
  dropdownStyles: import("@vue/composition-api").ComputedRef<string[]>;
26
25
  dropdownItemStyles: import("@vue/composition-api").ComputedRef<string[]>;
27
26
  noSearchResultsStyles: import("@vue/composition-api").ComputedRef<string[]>;
@@ -29,6 +28,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
29
28
  proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
30
29
  readonly: import("@vue/composition-api").ComputedRef<boolean>;
31
30
  isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
31
+ showClear: import("@vue/composition-api").ComputedRef<boolean>;
32
32
  selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
33
33
  searchText: import("@vue/composition-api").Ref<string>;
34
34
  internalSearchOptions: import("@vue/composition-api").Ref<{
@@ -102,6 +102,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
102
102
  type: BooleanConstructor;
103
103
  default: boolean;
104
104
  };
105
+ enableClear: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
105
109
  searchFunction: {
106
110
  type: PropType<SelectSearchFunction>;
107
111
  default: SelectSearchFunction;
@@ -171,6 +175,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
171
175
  type: BooleanConstructor;
172
176
  default: boolean;
173
177
  };
178
+ enableClear: {
179
+ type: BooleanConstructor;
180
+ default: boolean;
181
+ };
174
182
  searchFunction: {
175
183
  type: PropType<SelectSearchFunction>;
176
184
  default: SelectSearchFunction;
@@ -198,6 +206,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
198
206
  disabled: boolean;
199
207
  disableDefaultStyles: boolean;
200
208
  enableSearch: boolean;
209
+ enableClear: boolean;
201
210
  searchFunction: SelectSearchFunction;
202
211
  groupByFunction: SelectGroupByFunction;
203
212
  externalControl: boolean;
@@ -223,7 +232,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
223
232
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
224
233
  controlStyles: import("@vue/composition-api").ComputedRef<string[]>;
225
234
  searchControlStyles: import("@vue/composition-api").ComputedRef<string[]>;
226
- placeholderStyles: import("@vue/composition-api").ComputedRef<string[]>;
227
235
  dropdownStyles: import("@vue/composition-api").ComputedRef<string[]>;
228
236
  dropdownItemStyles: import("@vue/composition-api").ComputedRef<string[]>;
229
237
  noSearchResultsStyles: import("@vue/composition-api").ComputedRef<string[]>;
@@ -231,6 +239,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
231
239
  proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
232
240
  readonly: import("@vue/composition-api").ComputedRef<boolean>;
233
241
  isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
242
+ showClear: import("@vue/composition-api").ComputedRef<boolean>;
234
243
  selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
235
244
  searchText: import("@vue/composition-api").Ref<string>;
236
245
  internalSearchOptions: import("@vue/composition-api").Ref<{
@@ -262,6 +271,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
262
271
  disabled: boolean;
263
272
  disableDefaultStyles: boolean;
264
273
  enableSearch: boolean;
274
+ enableClear: boolean;
265
275
  searchFunction: SelectSearchFunction;
266
276
  groupByFunction: SelectGroupByFunction;
267
277
  externalControl: boolean;
@@ -282,6 +292,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
282
292
  disabled: boolean;
283
293
  disableDefaultStyles: boolean;
284
294
  enableSearch: boolean;
295
+ enableClear: boolean;
285
296
  searchFunction: SelectSearchFunction;
286
297
  groupByFunction: SelectGroupByFunction;
287
298
  externalControl: boolean;
@@ -2,13 +2,13 @@ export { default as OrSelectV3 } from './OrSelect.js';
2
2
  export { InputBoxSize as SelectSize } from '../OrInputBoxV3/props.js';
3
3
  import 'vue-demi';
4
4
  import '../../utils/isEmptyValue.js';
5
+ import '../../normalize-component-6e8e3d80.js';
5
6
  import './styles.js';
6
7
  import '../OrCheckboxV3/OrCheckbox.js';
7
8
  import '../OrCheckboxV3/styles.js';
8
9
  import '../OrLabelV3/OrLabel.js';
9
10
  import '../OrLabelV3/props.js';
10
11
  import '../OrLabelV3/styles.js';
11
- import '../../normalize-component-6e8e3d80.js';
12
12
  import '../../hooks/useIdAttribute.js';
13
13
  import '../../hooks/useControlAttributes.js';
14
14
  import '../../hooks/useProxyModelValue.js';
@@ -1,7 +1,6 @@
1
1
  export declare const Select: string[];
2
2
  export declare const SelectControl: string[];
3
3
  export declare const SelectSearchControl: string[];
4
- export declare const SelectPlaceholder: string[];
5
4
  export declare const SelectDropdown: string[];
6
5
  export declare const SelectDropdownDefault: string[];
7
6
  export declare const SelectDropdownFlipped: string[];
@@ -19,13 +19,6 @@ const SelectSearchControl = [
19
19
  'grow',
20
20
  // Spacing
21
21
  '!mx-lg md:!-mx-sm+', '!my-sm md:!my-none'];
22
- const SelectPlaceholder = [
23
- // Theme
24
- 'theme-foreground-outline', 'dark:theme-foreground-outline-dark',
25
- // Interactivity
26
- 'select-none',
27
- // Typography
28
- 'truncate'];
29
22
  const SelectDropdown = [
30
23
  // Overflow
31
24
  'overflow-y-auto',
@@ -58,4 +51,4 @@ const SelectNoSearchResults = [
58
51
  // Theme
59
52
  'theme-foreground-outline', 'dark:theme-foreground-outline-dark'];
60
53
 
61
- export { Select, SelectControl, SelectDropdown, SelectDropdownDefault, SelectDropdownFlipped, SelectDropdownItem, SelectNoSearchResults, SelectPlaceholder, SelectSearchControl };
54
+ export { Select, SelectControl, SelectDropdown, SelectDropdownDefault, SelectDropdownFlipped, SelectDropdownItem, SelectNoSearchResults, SelectSearchControl };
@@ -1,10 +1,11 @@
1
- import { defineComponent, getCurrentInstance, ref, computed, toRef, onMounted, watch } from 'vue-demi';
1
+ import { defineComponent, ref, computed, getCurrentInstance, toRefs, onMounted, watch } from 'vue-demi';
2
2
  import { isEmptyValue } from './utils/isEmptyValue.js';
3
- import { Select, SelectControl, SelectSearchControl, SelectPlaceholder, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './components/OrSelectV3/styles.js';
3
+ import { openBlock, createElementBlock, normalizeClass, renderSlot } from 'vue';
4
+ import { Select, SelectControl, SelectSearchControl, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './components/OrSelectV3/styles.js';
4
5
  import './components/OrCheckboxV3/OrCheckbox.js';
5
6
  import './components/OrErrorV3/OrError.js';
6
7
  import './components/OrExpansionPanelV3/OrExpansionPanel.js';
7
- import { s as script$3 } from './OrExpansionPanel.vue_vue_type_script_lang-fa265d9a.js';
8
+ import { s as script$4 } from './OrExpansionPanel.vue_vue_type_script_lang-fa265d9a.js';
8
9
  import './components/OrHintV3/OrHint.js';
9
10
  import './components/OrIconV3/OrIcon.js';
10
11
  import './components/OrIconButtonV3/OrIconButton.js';
@@ -14,38 +15,79 @@ import './components/OrLabelV3/OrLabel.js';
14
15
  import './components/OrMenuItemV3/OrMenuItem.js';
15
16
  import './components/OrPopoverV3/OrPopover.js';
16
17
  import './components/OrTagV3/OrTag.js';
17
- import { s as script$c } from './OrTag.vue_vue_type_script_lang-6c4b09f4.js';
18
+ import { s as script$d } from './OrTag.vue_vue_type_script_lang-6c4b09f4.js';
18
19
  import { useOverflow } from './hooks/useOverflow.js';
19
- import { s as script$1 } from './OrCheckbox.vue_vue_type_script_lang-38736023.js';
20
- import { s as script$2 } from './OrError.vue_vue_type_script_lang-df7b5e32.js';
21
- import { s as script$4 } from './OrHint.vue_vue_type_script_lang-0f5e8377.js';
22
- import { s as script$5 } from './OrIcon.vue_vue_type_script_lang-73f9cc63.js';
23
- import { s as script$6 } from './OrIconButton.vue_vue_type_script_lang-41affeb4.js';
24
- import { s as script$7 } from './OrInput.vue_vue_type_script_lang-4a384d2b.js';
25
- import { s as script$8 } from './OrInputBox.vue_vue_type_script_lang-137cb650.js';
26
- import { s as script$9 } from './OrLabel.vue_vue_type_script_lang-fcdfd80d.js';
27
- import { s as script$a } from './OrMenuItem.vue_vue_type_script_lang-1785286a.js';
28
- import { s as script$b } from './OrPopover.vue_vue_type_script_lang-d766f723.js';
20
+ import { s as script$2 } from './OrCheckbox.vue_vue_type_script_lang-38736023.js';
21
+ import { s as script$3 } from './OrError.vue_vue_type_script_lang-df7b5e32.js';
22
+ import { s as script$5 } from './OrHint.vue_vue_type_script_lang-0f5e8377.js';
23
+ import { s as script$6 } from './OrIcon.vue_vue_type_script_lang-73f9cc63.js';
24
+ import { s as script$7 } from './OrIconButton.vue_vue_type_script_lang-41affeb4.js';
25
+ import { s as script$8 } from './OrInput.vue_vue_type_script_lang-4a384d2b.js';
26
+ import { s as script$9 } from './OrInputBox.vue_vue_type_script_lang-137cb650.js';
27
+ import { s as script$a } from './OrLabel.vue_vue_type_script_lang-fcdfd80d.js';
28
+ import { s as script$b } from './OrMenuItem.vue_vue_type_script_lang-1785286a.js';
29
+ import { s as script$c } from './OrPopover.vue_vue_type_script_lang-d766f723.js';
29
30
  import { DropdownClose } from './directives/dropdown-close.js';
30
31
  import { DropdownOpen } from './directives/dropdown-open.js';
31
32
  import { InputBoxSize } from './components/OrInputBoxV3/props.js';
32
33
  import { useProxyModelValue } from './hooks/useProxyModelValue.js';
33
34
  import useResponsive from './hooks/useResponsive/useResponsive.js';
34
35
 
36
+ const SelectPlaceholder = [
37
+ // Interactivity
38
+ 'interactivity-none',
39
+ // Typography
40
+ 'typography-inherit truncate',
41
+ // Theme
42
+ 'theme-foreground-outline', 'dark:theme-foreground-outline-dark'];
43
+
44
+ var script$1 = defineComponent({
45
+ props: {
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false
49
+ }
50
+ },
51
+ expose: ['root'],
52
+ setup() {
53
+ // Refs
54
+ const root = ref();
55
+ // Styles
56
+ const rootStyles = computed(() => ['or-select-placeholder-v3', ...SelectPlaceholder]);
57
+ return {
58
+ root,
59
+ rootStyles
60
+ };
61
+ }
62
+ });
63
+
64
+ const _hoisted_1 = ["disabled"];
65
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
66
+ return openBlock(), createElementBlock("div", {
67
+ ref: "root",
68
+ class: normalizeClass(_ctx.rootStyles),
69
+ disabled: _ctx.disabled ? '' : null
70
+ }, [renderSlot(_ctx.$slots, "default")], 10 /* CLASS, PROPS */, _hoisted_1);
71
+ }
72
+
73
+ script$1.render = render;
74
+ script$1.__file = "src/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue";
75
+
35
76
  var script = defineComponent({
36
77
  components: {
37
- OrCheckbox: script$1,
38
- OrError: script$2,
39
- OrExpansionPanel: script$3,
40
- OrHint: script$4,
41
- OrIcon: script$5,
42
- OrIconButton: script$6,
43
- OrInput: script$7,
44
- OrInputBox: script$8,
45
- OrLabel: script$9,
46
- OrMenuItem: script$a,
47
- OrPopover: script$b,
48
- OrTag: script$c
78
+ OrCheckbox: script$2,
79
+ OrError: script$3,
80
+ OrExpansionPanel: script$4,
81
+ OrHint: script$5,
82
+ OrIcon: script$6,
83
+ OrIconButton: script$7,
84
+ OrInput: script$8,
85
+ OrInputBox: script$9,
86
+ OrLabel: script$a,
87
+ OrMenuItem: script$b,
88
+ OrPopover: script$c,
89
+ OrSelectPlaceholder: script$1,
90
+ OrTag: script$d
49
91
  },
50
92
  directives: {
51
93
  DropdownClose,
@@ -112,6 +154,10 @@ var script = defineComponent({
112
154
  type: Boolean,
113
155
  default: false
114
156
  },
157
+ enableClear: {
158
+ type: Boolean,
159
+ default: false
160
+ },
115
161
  searchFunction: {
116
162
  type: Function,
117
163
  default: async (searchText, options) => {
@@ -155,11 +201,15 @@ var script = defineComponent({
155
201
  var _a;
156
202
  return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
157
203
  });
204
+ // Props
205
+ const {
206
+ enableClear,
207
+ modelValue
208
+ } = toRefs(props);
158
209
  // Styles
159
210
  const rootStyles = computed(() => ['or-select-v3', ...Select]);
160
211
  const controlStyles = computed(() => [...SelectControl]);
161
212
  const searchControlStyles = computed(() => [...SelectSearchControl]);
162
- const placeholderStyles = computed(() => [...SelectPlaceholder]);
163
213
  const dropdownStyles = computed(() => {
164
214
  var _a;
165
215
  return [...SelectDropdown, ...(((_a = popover.value) === null || _a === void 0 ? void 0 : _a.isFlipped) ? SelectDropdownFlipped : SelectDropdownDefault)];
@@ -168,10 +218,13 @@ var script = defineComponent({
168
218
  const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
169
219
  // State
170
220
  const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
171
- const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
221
+ const proxyModelValue = useProxyModelValue(modelValue, context.emit);
172
222
  const isEmptyModelValue = computed(() => {
173
223
  return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
174
224
  });
225
+ const showClear = computed(() => {
226
+ return enableClear.value && !isEmptyModelValue.value;
227
+ });
175
228
  onMounted(() => {
176
229
  if (!proxyModelValue.value && props.multiple) {
177
230
  proxyModelValue.value = [];
@@ -271,7 +324,6 @@ var script = defineComponent({
271
324
  rootStyles,
272
325
  controlStyles,
273
326
  searchControlStyles,
274
- placeholderStyles,
275
327
  dropdownStyles,
276
328
  dropdownItemStyles,
277
329
  noSearchResultsStyles,
@@ -279,6 +331,7 @@ var script = defineComponent({
279
331
  proxyModelValue,
280
332
  readonly,
281
333
  isEmptyModelValue,
334
+ showClear,
282
335
  selection,
283
336
  searchText,
284
337
  internalSearchOptions,
@@ -1,5 +1,5 @@
1
- import { s as script } from '../../OrSelect.vue_vue_type_script_lang-a69c2fd5.js';
2
- export { s as default } from '../../OrSelect.vue_vue_type_script_lang-a69c2fd5.js';
1
+ import { s as script } from '../../OrSelect.vue_vue_type_script_lang-21b9f7b7.js';
2
+ export { s as default } from '../../OrSelect.vue_vue_type_script_lang-21b9f7b7.js';
3
3
  import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, withDirectives, createElementVNode, Fragment, renderList, withModifiers, createVNode, vShow } from 'vue';
4
4
  import 'vue-demi';
5
5
  import '../../utils/isEmptyValue.js';
@@ -83,27 +83,26 @@ import '../../directives/dropdown-close.js';
83
83
  import '../../directives/dropdown-open.js';
84
84
 
85
85
  const _hoisted_1 = ["id", "tabindex", "disabled"];
86
- const _hoisted_2 = ["disabled"];
87
- const _hoisted_3 = {
86
+ const _hoisted_2 = {
88
87
  class: "truncate"
89
88
  };
90
- const _hoisted_4 = ["disabled"];
91
- const _hoisted_5 = {
89
+ const _hoisted_3 = {
92
90
  key: 2,
93
91
  class: /*#__PURE__*/normalizeClass(['grow'])
94
92
  };
95
- const _hoisted_6 = {
93
+ const _hoisted_4 = {
96
94
  class: /*#__PURE__*/normalizeClass(['layout-inline-row', 'gap-sm'])
97
95
  };
98
- const _hoisted_7 = {
96
+ const _hoisted_5 = {
99
97
  class: /*#__PURE__*/normalizeClass(['contents'])
100
98
  };
101
- const _hoisted_8 = {
99
+ const _hoisted_6 = {
102
100
  class: /*#__PURE__*/normalizeClass(['contents'])
103
101
  };
104
102
  function render(_ctx, _cache, $props, $setup, $data, $options) {
105
103
  const _component_OrLabel = resolveComponent("OrLabel");
106
104
  const _component_OrTag = resolveComponent("OrTag");
105
+ const _component_OrSelectPlaceholder = resolveComponent("OrSelectPlaceholder");
107
106
  const _component_OrInput = resolveComponent("OrInput");
108
107
  const _component_OrIconButton = resolveComponent("OrIconButton");
109
108
  const _component_OrIcon = resolveComponent("OrIcon");
@@ -155,28 +154,34 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
155
154
  }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selection, option => {
156
155
  return openBlock(), createBlock(_component_OrTag, {
157
156
  key: option.value,
158
- variant: 'reset',
159
- disabled: _ctx.disabled || _ctx.readonly,
157
+ variant: _ctx.readonly || _ctx.disabled ? 'tag' : 'reset',
158
+ disabled: _ctx.disabled,
160
159
  onReset: $event => _ctx.deselect(option)
161
160
  }, {
162
161
  default: withCtx(() => [createTextVNode(toDisplayString(option.label), 1 /* TEXT */)]),
163
162
 
164
163
  _: 2 /* DYNAMIC */
165
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["disabled", "onReset"]);
166
- }), 128 /* KEYED_FRAGMENT */))]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createElementBlock("span", {
164
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant", "disabled", "onReset"]);
165
+ }), 128 /* KEYED_FRAGMENT */))]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createBlock(_component_OrSelectPlaceholder, {
167
166
  key: 1,
168
- class: normalizeClass(_ctx.placeholderStyles),
169
- disabled: _ctx.disabled ? '' : null
170
- }, toDisplayString(_ctx.placeholder), 11 /* TEXT, CLASS, PROPS */, _hoisted_2)) : createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */)) : (openBlock(), createElementBlock(Fragment, {
167
+ disabled: _ctx.disabled
168
+ }, {
169
+ default: withCtx(() => [createTextVNode(toDisplayString(_ctx.placeholder), 1 /* TEXT */)]),
170
+
171
+ _: 1 /* STABLE */
172
+ }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */)) : (openBlock(), createElementBlock(Fragment, {
171
173
  key: 1
172
174
  }, [!_ctx.isEmptyModelValue ? renderSlot(_ctx.$slots, "valueTemplate", {
173
175
  key: 0,
174
176
  model: _ctx.proxyModelValue
175
- }, () => [createElementVNode("span", _hoisted_3, toDisplayString(_ctx.selection && _ctx.selection.label), 1 /* TEXT */)]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createElementBlock("span", {
177
+ }, () => [createElementVNode("span", _hoisted_2, toDisplayString(_ctx.selection && _ctx.selection.label), 1 /* TEXT */)]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createBlock(_component_OrSelectPlaceholder, {
176
178
  key: 1,
177
- class: normalizeClass(_ctx.placeholderStyles),
178
- disabled: _ctx.disabled ? '' : null
179
- }, toDisplayString(_ctx.placeholder), 11 /* TEXT, CLASS, PROPS */, _hoisted_4)) : createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */))], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_1), _ctx.multiple && _ctx.outerItems.length > 0 ? (openBlock(), createElementBlock(Fragment, {
179
+ disabled: _ctx.disabled
180
+ }, {
181
+ default: withCtx(() => [createTextVNode(toDisplayString(_ctx.placeholder), 1 /* TEXT */)]),
182
+
183
+ _: 1 /* STABLE */
184
+ }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */))], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_1), _ctx.multiple && _ctx.outerItems.length > 0 ? (openBlock(), createElementBlock(Fragment, {
180
185
  key: 0
181
186
  }, [createTextVNode(" +" + toDisplayString(_ctx.outerItems.length), 1 /* TEXT */)], 64 /* STABLE_FRAGMENT */)) : createCommentVNode("v-if", true), _ctx.popoverState === 'open' && _ctx.enableSearch && _ctx.isDesktop ? (openBlock(), createBlock(_component_OrInput, {
182
187
  key: 1,
@@ -189,7 +194,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
189
194
  size: _ctx.size,
190
195
  "disable-default-styles": true,
191
196
  onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
192
- }, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_5)), createElementVNode("div", _hoisted_6, [_ctx.popoverState === 'closed' && !_ctx.isEmptyModelValue ? (openBlock(), createBlock(_component_OrIconButton, {
197
+ }, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_3)), createElementVNode("div", _hoisted_4, [_ctx.showClear ? (openBlock(), createBlock(_component_OrIconButton, {
193
198
  key: 0,
194
199
  icon: 'close',
195
200
  color: 'inherit',
@@ -318,14 +323,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
318
323
  _: 3 /* FORWARDED */
319
324
  }, 8 /* PROPS */, ["trigger", "custom-styles"])]),
320
325
  _: 3 /* FORWARDED */
321
- }, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), withDirectives(createElementVNode("div", _hoisted_7, [_ctx.hint ? (openBlock(), createBlock(_component_OrHint, {
326
+ }, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), withDirectives(createElementVNode("div", _hoisted_5, [_ctx.hint ? (openBlock(), createBlock(_component_OrHint, {
322
327
  key: 0,
323
328
  disabled: _ctx.disabled
324
329
  }, {
325
330
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.hint), 1 /* TEXT */)]),
326
331
 
327
332
  _: 1 /* STABLE */
328
- }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 512 /* NEED_PATCH */), [[vShow, !_ctx.error]]), withDirectives(createElementVNode("div", _hoisted_8, [createVNode(_component_OrError, {
333
+ }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 512 /* NEED_PATCH */), [[vShow, !_ctx.error]]), withDirectives(createElementVNode("div", _hoisted_6, [createVNode(_component_OrError, {
329
334
  disabled: _ctx.disabled
330
335
  }, {
331
336
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.error), 1 /* TEXT */)]),