@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.
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +115 -39
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +13 -2
- package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
- package/dist/bundled/v2/components/OrSelectV3/styles.d.ts +0 -1
- package/dist/bundled/v2/components/OrSelectV3/styles.js +1 -8
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-a69c2fd5.js → OrSelect.vue_vue_type_script_lang-21b9f7b7.js} +82 -29
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +28 -23
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +10 -1
- package/dist/bundled/v3/components/OrSelectV3/index.js +2 -2
- package/dist/bundled/v3/components/OrSelectV3/styles.d.ts +0 -1
- package/dist/bundled/v3/components/OrSelectV3/styles.js +1 -8
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/index.js +1 -1
- package/dist/esm/v2/{OrSelect-dcc41043.js → OrSelect-34782e78.js} +112 -44
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +13 -2
- package/dist/esm/v2/components/or-select-v3/index.js +1 -1
- package/dist/esm/v2/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue.d.ts +24 -0
- package/dist/esm/v2/components/or-select-v3/partials/or-select-placeholder/styles.d.ts +1 -0
- package/dist/esm/v2/components/or-select-v3/styles.d.ts +0 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrSelect-a6e29937.js → OrSelect-ba0f0da3.js} +107 -57
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +10 -1
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue.d.ts +17 -0
- package/dist/esm/v3/components/or-select-v3/partials/or-select-placeholder/styles.d.ts +1 -0
- package/dist/esm/v3/components/or-select-v3/styles.d.ts +0 -1
- package/dist/esm/v3/index.js +1 -1
- package/package.json +3 -2
- package/src/components/or-select-v3/OrSelect.vue +25 -21
- package/src/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue +43 -0
- package/src/components/or-select-v3/partials/or-select-placeholder/styles.ts +11 -0
- package/src/components/or-select-v3/styles.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, computed, getCurrentInstance, toRefs, onMounted, watch } from 'vue-demi';
|
|
2
2
|
import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-06d651cf.js';
|
|
3
3
|
import { u as useOverflow } from './useOverflow-c856b7b7.js';
|
|
4
4
|
import '@vueuse/core';
|
|
@@ -6,19 +6,59 @@ import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
|
|
|
6
6
|
import { u as useResponsive } from './useResponsive-a02e95b7.js';
|
|
7
7
|
import '@onereach/styles/tailwind.config.json';
|
|
8
8
|
import { i as isEmptyValue } from './isEmptyValue-fd56a6e4.js';
|
|
9
|
-
import { s as script$
|
|
10
|
-
import { s as script$
|
|
11
|
-
import { s as script$
|
|
12
|
-
import { s as script$
|
|
13
|
-
import { s as script$
|
|
14
|
-
import { s as script$
|
|
15
|
-
import { s as script$
|
|
16
|
-
import { s as script$
|
|
17
|
-
import { s as script$
|
|
18
|
-
import { s as script$
|
|
19
|
-
import { s as script$
|
|
20
|
-
import { s as script$
|
|
21
|
-
import {
|
|
9
|
+
import { s as script$2 } from './OrCheckbox-4433eaa6.js';
|
|
10
|
+
import { s as script$3 } from './OrError-c01d0c29.js';
|
|
11
|
+
import { s as script$4 } from './OrExpansionPanel-cb469c25.js';
|
|
12
|
+
import { s as script$5 } from './OrHint-06ab89d7.js';
|
|
13
|
+
import { s as script$7 } from './OrIconButton-6b7afbb3.js';
|
|
14
|
+
import { s as script$6 } from './OrIcon-62793572.js';
|
|
15
|
+
import { s as script$9, I as InputBoxSize } from './OrInputBox-912a6254.js';
|
|
16
|
+
import { s as script$8 } from './OrInput-4aa8ef29.js';
|
|
17
|
+
import { s as script$a } from './OrLabel-d4c46bb6.js';
|
|
18
|
+
import { s as script$b } from './OrMenuItem-54062d59.js';
|
|
19
|
+
import { s as script$c } from './OrPopover-4ae174d0.js';
|
|
20
|
+
import { s as script$d } from './OrTag-05c5e0fd.js';
|
|
21
|
+
import { openBlock, createElementBlock, normalizeClass, renderSlot, resolveComponent, resolveDirective, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode, withDirectives, createElementVNode, Fragment, renderList, withModifiers, createVNode, vShow } from 'vue';
|
|
22
|
+
|
|
23
|
+
const SelectPlaceholder = [
|
|
24
|
+
// Interactivity
|
|
25
|
+
'interactivity-none',
|
|
26
|
+
// Typography
|
|
27
|
+
'typography-inherit truncate',
|
|
28
|
+
// Theme
|
|
29
|
+
'theme-foreground-outline', 'dark:theme-foreground-outline-dark'];
|
|
30
|
+
|
|
31
|
+
var script$1 = defineComponent({
|
|
32
|
+
props: {
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
expose: ['root'],
|
|
39
|
+
setup() {
|
|
40
|
+
// Refs
|
|
41
|
+
const root = ref();
|
|
42
|
+
// Styles
|
|
43
|
+
const rootStyles = computed(() => ['or-select-placeholder-v3', ...SelectPlaceholder]);
|
|
44
|
+
return {
|
|
45
|
+
root,
|
|
46
|
+
rootStyles
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const _hoisted_1$1 = ["disabled"];
|
|
52
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
53
|
+
return openBlock(), createElementBlock("div", {
|
|
54
|
+
ref: "root",
|
|
55
|
+
class: normalizeClass(_ctx.rootStyles),
|
|
56
|
+
disabled: _ctx.disabled ? '' : null
|
|
57
|
+
}, [renderSlot(_ctx.$slots, "default")], 10 /* CLASS, PROPS */, _hoisted_1$1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
script$1.render = render$1;
|
|
61
|
+
script$1.__file = "src/components/or-select-v3/partials/or-select-placeholder/OrSelectPlaceholder.vue";
|
|
22
62
|
|
|
23
63
|
const Select = [
|
|
24
64
|
// Layout
|
|
@@ -41,13 +81,6 @@ const SelectSearchControl = [
|
|
|
41
81
|
'grow',
|
|
42
82
|
// Spacing
|
|
43
83
|
'!mx-lg md:!-mx-sm+', '!my-sm md:!my-none'];
|
|
44
|
-
const SelectPlaceholder = [
|
|
45
|
-
// Theme
|
|
46
|
-
'theme-foreground-outline', 'dark:theme-foreground-outline-dark',
|
|
47
|
-
// Interactivity
|
|
48
|
-
'select-none',
|
|
49
|
-
// Typography
|
|
50
|
-
'truncate'];
|
|
51
84
|
const SelectDropdown = [
|
|
52
85
|
// Overflow
|
|
53
86
|
'overflow-y-auto',
|
|
@@ -82,18 +115,19 @@ const SelectNoSearchResults = [
|
|
|
82
115
|
|
|
83
116
|
var script = defineComponent({
|
|
84
117
|
components: {
|
|
85
|
-
OrCheckbox: script$
|
|
86
|
-
OrError: script$
|
|
87
|
-
OrExpansionPanel: script$
|
|
88
|
-
OrHint: script$
|
|
89
|
-
OrIcon: script$
|
|
90
|
-
OrIconButton: script$
|
|
91
|
-
OrInput: script$
|
|
92
|
-
OrInputBox: script$
|
|
93
|
-
OrLabel: script$
|
|
94
|
-
OrMenuItem: script$
|
|
95
|
-
OrPopover: script$
|
|
96
|
-
|
|
118
|
+
OrCheckbox: script$2,
|
|
119
|
+
OrError: script$3,
|
|
120
|
+
OrExpansionPanel: script$4,
|
|
121
|
+
OrHint: script$5,
|
|
122
|
+
OrIcon: script$6,
|
|
123
|
+
OrIconButton: script$7,
|
|
124
|
+
OrInput: script$8,
|
|
125
|
+
OrInputBox: script$9,
|
|
126
|
+
OrLabel: script$a,
|
|
127
|
+
OrMenuItem: script$b,
|
|
128
|
+
OrPopover: script$c,
|
|
129
|
+
OrSelectPlaceholder: script$1,
|
|
130
|
+
OrTag: script$d
|
|
97
131
|
},
|
|
98
132
|
directives: {
|
|
99
133
|
DropdownClose,
|
|
@@ -160,6 +194,10 @@ var script = defineComponent({
|
|
|
160
194
|
type: Boolean,
|
|
161
195
|
default: false
|
|
162
196
|
},
|
|
197
|
+
enableClear: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: false
|
|
200
|
+
},
|
|
163
201
|
searchFunction: {
|
|
164
202
|
type: Function,
|
|
165
203
|
default: async (searchText, options) => {
|
|
@@ -203,11 +241,15 @@ var script = defineComponent({
|
|
|
203
241
|
var _a;
|
|
204
242
|
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
205
243
|
});
|
|
244
|
+
// Props
|
|
245
|
+
const {
|
|
246
|
+
enableClear,
|
|
247
|
+
modelValue
|
|
248
|
+
} = toRefs(props);
|
|
206
249
|
// Styles
|
|
207
250
|
const rootStyles = computed(() => ['or-select-v3', ...Select]);
|
|
208
251
|
const controlStyles = computed(() => [...SelectControl]);
|
|
209
252
|
const searchControlStyles = computed(() => [...SelectSearchControl]);
|
|
210
|
-
const placeholderStyles = computed(() => [...SelectPlaceholder]);
|
|
211
253
|
const dropdownStyles = computed(() => {
|
|
212
254
|
var _a;
|
|
213
255
|
return [...SelectDropdown, ...(((_a = popover.value) === null || _a === void 0 ? void 0 : _a.isFlipped) ? SelectDropdownFlipped : SelectDropdownDefault)];
|
|
@@ -216,10 +258,13 @@ var script = defineComponent({
|
|
|
216
258
|
const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
|
|
217
259
|
// State
|
|
218
260
|
const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
|
|
219
|
-
const proxyModelValue = useProxyModelValue(
|
|
261
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
220
262
|
const isEmptyModelValue = computed(() => {
|
|
221
263
|
return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
|
|
222
264
|
});
|
|
265
|
+
const showClear = computed(() => {
|
|
266
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
267
|
+
});
|
|
223
268
|
onMounted(() => {
|
|
224
269
|
if (!proxyModelValue.value && props.multiple) {
|
|
225
270
|
proxyModelValue.value = [];
|
|
@@ -319,7 +364,6 @@ var script = defineComponent({
|
|
|
319
364
|
rootStyles,
|
|
320
365
|
controlStyles,
|
|
321
366
|
searchControlStyles,
|
|
322
|
-
placeholderStyles,
|
|
323
367
|
dropdownStyles,
|
|
324
368
|
dropdownItemStyles,
|
|
325
369
|
noSearchResultsStyles,
|
|
@@ -327,6 +371,7 @@ var script = defineComponent({
|
|
|
327
371
|
proxyModelValue,
|
|
328
372
|
readonly,
|
|
329
373
|
isEmptyModelValue,
|
|
374
|
+
showClear,
|
|
330
375
|
selection,
|
|
331
376
|
searchText,
|
|
332
377
|
internalSearchOptions,
|
|
@@ -345,27 +390,26 @@ var script = defineComponent({
|
|
|
345
390
|
});
|
|
346
391
|
|
|
347
392
|
const _hoisted_1 = ["id", "tabindex", "disabled"];
|
|
348
|
-
const _hoisted_2 =
|
|
349
|
-
const _hoisted_3 = {
|
|
393
|
+
const _hoisted_2 = {
|
|
350
394
|
class: "truncate"
|
|
351
395
|
};
|
|
352
|
-
const
|
|
353
|
-
const _hoisted_5 = {
|
|
396
|
+
const _hoisted_3 = {
|
|
354
397
|
key: 2,
|
|
355
398
|
class: /*#__PURE__*/normalizeClass(['grow'])
|
|
356
399
|
};
|
|
357
|
-
const
|
|
400
|
+
const _hoisted_4 = {
|
|
358
401
|
class: /*#__PURE__*/normalizeClass(['layout-inline-row', 'gap-sm'])
|
|
359
402
|
};
|
|
360
|
-
const
|
|
403
|
+
const _hoisted_5 = {
|
|
361
404
|
class: /*#__PURE__*/normalizeClass(['contents'])
|
|
362
405
|
};
|
|
363
|
-
const
|
|
406
|
+
const _hoisted_6 = {
|
|
364
407
|
class: /*#__PURE__*/normalizeClass(['contents'])
|
|
365
408
|
};
|
|
366
409
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
367
410
|
const _component_OrLabel = resolveComponent("OrLabel");
|
|
368
411
|
const _component_OrTag = resolveComponent("OrTag");
|
|
412
|
+
const _component_OrSelectPlaceholder = resolveComponent("OrSelectPlaceholder");
|
|
369
413
|
const _component_OrInput = resolveComponent("OrInput");
|
|
370
414
|
const _component_OrIconButton = resolveComponent("OrIconButton");
|
|
371
415
|
const _component_OrIcon = resolveComponent("OrIcon");
|
|
@@ -417,28 +461,34 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
417
461
|
}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selection, option => {
|
|
418
462
|
return openBlock(), createBlock(_component_OrTag, {
|
|
419
463
|
key: option.value,
|
|
420
|
-
variant: 'reset',
|
|
421
|
-
disabled: _ctx.disabled
|
|
464
|
+
variant: _ctx.readonly || _ctx.disabled ? 'tag' : 'reset',
|
|
465
|
+
disabled: _ctx.disabled,
|
|
422
466
|
onReset: $event => _ctx.deselect(option)
|
|
423
467
|
}, {
|
|
424
468
|
default: withCtx(() => [createTextVNode(toDisplayString(option.label), 1 /* TEXT */)]),
|
|
425
469
|
|
|
426
470
|
_: 2 /* DYNAMIC */
|
|
427
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["disabled", "onReset"]);
|
|
428
|
-
}), 128 /* KEYED_FRAGMENT */))]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(),
|
|
471
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant", "disabled", "onReset"]);
|
|
472
|
+
}), 128 /* KEYED_FRAGMENT */))]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createBlock(_component_OrSelectPlaceholder, {
|
|
429
473
|
key: 1,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
474
|
+
disabled: _ctx.disabled
|
|
475
|
+
}, {
|
|
476
|
+
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.placeholder), 1 /* TEXT */)]),
|
|
477
|
+
|
|
478
|
+
_: 1 /* STABLE */
|
|
479
|
+
}, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 64 /* STABLE_FRAGMENT */)) : (openBlock(), createElementBlock(Fragment, {
|
|
433
480
|
key: 1
|
|
434
481
|
}, [!_ctx.isEmptyModelValue ? renderSlot(_ctx.$slots, "valueTemplate", {
|
|
435
482
|
key: 0,
|
|
436
483
|
model: _ctx.proxyModelValue
|
|
437
|
-
}, () => [createElementVNode("span",
|
|
484
|
+
}, () => [createElementVNode("span", _hoisted_2, toDisplayString(_ctx.selection && _ctx.selection.label), 1 /* TEXT */)]) : _ctx.popoverState === 'closed' || !_ctx.enableSearch ? (openBlock(), createBlock(_component_OrSelectPlaceholder, {
|
|
438
485
|
key: 1,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
486
|
+
disabled: _ctx.disabled
|
|
487
|
+
}, {
|
|
488
|
+
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.placeholder), 1 /* TEXT */)]),
|
|
489
|
+
|
|
490
|
+
_: 1 /* STABLE */
|
|
491
|
+
}, 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, {
|
|
442
492
|
key: 0
|
|
443
493
|
}, [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, {
|
|
444
494
|
key: 1,
|
|
@@ -451,7 +501,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
451
501
|
size: _ctx.size,
|
|
452
502
|
"disable-default-styles": true,
|
|
453
503
|
onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
|
|
454
|
-
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div",
|
|
504
|
+
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_3)), createElementVNode("div", _hoisted_4, [_ctx.showClear ? (openBlock(), createBlock(_component_OrIconButton, {
|
|
455
505
|
key: 0,
|
|
456
506
|
icon: 'close',
|
|
457
507
|
color: 'inherit',
|
|
@@ -580,14 +630,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
580
630
|
_: 3 /* FORWARDED */
|
|
581
631
|
}, 8 /* PROPS */, ["trigger", "custom-styles"])]),
|
|
582
632
|
_: 3 /* FORWARDED */
|
|
583
|
-
}, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), withDirectives(createElementVNode("div",
|
|
633
|
+
}, 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, {
|
|
584
634
|
key: 0,
|
|
585
635
|
disabled: _ctx.disabled
|
|
586
636
|
}, {
|
|
587
637
|
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.hint), 1 /* TEXT */)]),
|
|
588
638
|
|
|
589
639
|
_: 1 /* STABLE */
|
|
590
|
-
}, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 512 /* NEED_PATCH */), [[vShow, !_ctx.error]]), withDirectives(createElementVNode("div",
|
|
640
|
+
}, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 512 /* NEED_PATCH */), [[vShow, !_ctx.error]]), withDirectives(createElementVNode("div", _hoisted_6, [createVNode(_component_OrError, {
|
|
591
641
|
disabled: _ctx.disabled
|
|
592
642
|
}, {
|
|
593
643
|
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.error), 1 /* TEXT */)]),
|
|
@@ -75,7 +75,7 @@ export { s as OrSearch } from '../OrSearch-2800e9bf.js';
|
|
|
75
75
|
export { s as OrSearchV3 } from '../OrSearch-98342176.js';
|
|
76
76
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-851db474.js';
|
|
77
77
|
export { s as OrSelect } from '../OrSelect-9520d6e6.js';
|
|
78
|
-
export { s as OrSelectV3 } from '../OrSelect-
|
|
78
|
+
export { s as OrSelectV3 } from '../OrSelect-ba0f0da3.js';
|
|
79
79
|
export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-aaf73310.js';
|
|
80
80
|
export { s as OrSidebarV3 } from '../OrSidebar-8f9b7502.js';
|
|
81
81
|
export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-79a7c625.js';
|
|
@@ -58,6 +58,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
58
58
|
type: BooleanConstructor;
|
|
59
59
|
default: boolean;
|
|
60
60
|
};
|
|
61
|
+
enableClear: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
61
65
|
searchFunction: {
|
|
62
66
|
type: PropType<SelectSearchFunction>;
|
|
63
67
|
default: SelectSearchFunction;
|
|
@@ -82,7 +86,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
82
86
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
83
87
|
controlStyles: import("vue-demi").ComputedRef<string[]>;
|
|
84
88
|
searchControlStyles: import("vue-demi").ComputedRef<string[]>;
|
|
85
|
-
placeholderStyles: import("vue-demi").ComputedRef<string[]>;
|
|
86
89
|
dropdownStyles: import("vue-demi").ComputedRef<string[]>;
|
|
87
90
|
dropdownItemStyles: import("vue-demi").ComputedRef<string[]>;
|
|
88
91
|
noSearchResultsStyles: import("vue-demi").ComputedRef<string[]>;
|
|
@@ -90,6 +93,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
90
93
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[] | undefined>;
|
|
91
94
|
readonly: import("vue-demi").ComputedRef<boolean>;
|
|
92
95
|
isEmptyModelValue: import("vue-demi").ComputedRef<boolean>;
|
|
96
|
+
showClear: import("vue-demi").ComputedRef<boolean>;
|
|
93
97
|
selection: import("vue-demi").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
94
98
|
searchText: import("vue-demi").Ref<string>;
|
|
95
99
|
internalSearchOptions: import("vue-demi").Ref<{
|
|
@@ -163,6 +167,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
163
167
|
type: BooleanConstructor;
|
|
164
168
|
default: boolean;
|
|
165
169
|
};
|
|
170
|
+
enableClear: {
|
|
171
|
+
type: BooleanConstructor;
|
|
172
|
+
default: boolean;
|
|
173
|
+
};
|
|
166
174
|
searchFunction: {
|
|
167
175
|
type: PropType<SelectSearchFunction>;
|
|
168
176
|
default: SelectSearchFunction;
|
|
@@ -195,6 +203,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
195
203
|
disabled: boolean;
|
|
196
204
|
disableDefaultStyles: boolean;
|
|
197
205
|
enableSearch: boolean;
|
|
206
|
+
enableClear: boolean;
|
|
198
207
|
searchFunction: SelectSearchFunction;
|
|
199
208
|
groupByFunction: SelectGroupByFunction;
|
|
200
209
|
externalControl: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
|
+
disabled: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
}, {
|
|
7
|
+
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
8
|
+
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
9
|
+
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
10
|
+
disabled: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>>, {
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SelectPlaceholder: string[];
|
|
@@ -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[];
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -75,7 +75,7 @@ export { s as OrSearch } from './OrSearch-2800e9bf.js';
|
|
|
75
75
|
export { s as OrSearchV3 } from './OrSearch-98342176.js';
|
|
76
76
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-851db474.js';
|
|
77
77
|
export { s as OrSelect } from './OrSelect-9520d6e6.js';
|
|
78
|
-
export { s as OrSelectV3 } from './OrSelect-
|
|
78
|
+
export { s as OrSelectV3 } from './OrSelect-ba0f0da3.js';
|
|
79
79
|
export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-aaf73310.js';
|
|
80
80
|
export { s as OrSidebarV3 } from './OrSidebar-8f9b7502.js';
|
|
81
81
|
export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-79a7c625.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "5.3.0
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2/3",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -156,5 +156,6 @@
|
|
|
156
156
|
"default": "./dist/bundled/v3/components/*/index.js"
|
|
157
157
|
},
|
|
158
158
|
"./package.json": "./package.json"
|
|
159
|
-
}
|
|
159
|
+
},
|
|
160
|
+
"gitHead": "7da78a6b42da15543fd27404761ce65ab98cd645"
|
|
160
161
|
}
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
<OrTag
|
|
48
48
|
v-for="option in selection"
|
|
49
49
|
:key="option.value"
|
|
50
|
-
:variant="'reset'"
|
|
51
|
-
:disabled="disabled
|
|
50
|
+
:variant="readonly || disabled ? 'tag' : 'reset'"
|
|
51
|
+
:disabled="disabled"
|
|
52
52
|
@reset="deselect(option)"
|
|
53
53
|
>
|
|
54
54
|
{{ option.label }}
|
|
@@ -57,12 +57,9 @@
|
|
|
57
57
|
</template>
|
|
58
58
|
|
|
59
59
|
<template v-else-if="popoverState === 'closed' || !enableSearch">
|
|
60
|
-
<
|
|
61
|
-
:class="placeholderStyles"
|
|
62
|
-
:disabled="disabled ? '' : null"
|
|
63
|
-
>
|
|
60
|
+
<OrSelectPlaceholder :disabled="disabled">
|
|
64
61
|
{{ placeholder }}
|
|
65
|
-
</
|
|
62
|
+
</OrSelectPlaceholder>
|
|
66
63
|
</template>
|
|
67
64
|
</template>
|
|
68
65
|
|
|
@@ -79,12 +76,9 @@
|
|
|
79
76
|
</template>
|
|
80
77
|
|
|
81
78
|
<template v-else-if="popoverState === 'closed' || !enableSearch">
|
|
82
|
-
<
|
|
83
|
-
:class="placeholderStyles"
|
|
84
|
-
:disabled="disabled ? '' : null"
|
|
85
|
-
>
|
|
79
|
+
<OrSelectPlaceholder :disabled="disabled">
|
|
86
80
|
{{ placeholder }}
|
|
87
|
-
</
|
|
81
|
+
</OrSelectPlaceholder>
|
|
88
82
|
</template>
|
|
89
83
|
</template>
|
|
90
84
|
</div>
|
|
@@ -111,7 +105,7 @@
|
|
|
111
105
|
</template>
|
|
112
106
|
|
|
113
107
|
<div :class="['layout-inline-row', 'gap-sm']">
|
|
114
|
-
<template v-if="
|
|
108
|
+
<template v-if="showClear">
|
|
115
109
|
<OrIconButton
|
|
116
110
|
:icon="'close'"
|
|
117
111
|
:color="'inherit'"
|
|
@@ -269,7 +263,7 @@
|
|
|
269
263
|
</template>
|
|
270
264
|
|
|
271
265
|
<script lang="ts">
|
|
272
|
-
import { computed, defineComponent, getCurrentInstance, onMounted, PropType, ref,
|
|
266
|
+
import { computed, defineComponent, getCurrentInstance, onMounted, PropType, ref, toRefs, watch } from 'vue-demi';
|
|
273
267
|
import { DropdownClose, DropdownOpen } from '../../directives';
|
|
274
268
|
import { useOverflow, useProxyModelValue, useResponsive } from '../../hooks';
|
|
275
269
|
import { isEmptyValue } from '../../utils/isEmptyValue';
|
|
@@ -285,8 +279,9 @@ import { OrLabelV3 as OrLabel } from '../or-label-v3';
|
|
|
285
279
|
import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
|
|
286
280
|
import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
|
|
287
281
|
import { OrTagV3 as OrTag } from '../or-tag-v3';
|
|
282
|
+
import OrSelectPlaceholder from './partials/or-select-placeholder/OrSelectPlaceholder.vue';
|
|
288
283
|
import { SelectSize } from './props';
|
|
289
|
-
import { Select, SelectControl, SelectDropdown, SelectDropdownDefault, SelectDropdownFlipped, SelectDropdownItem, SelectNoSearchResults,
|
|
284
|
+
import { Select, SelectControl, SelectDropdown, SelectDropdownDefault, SelectDropdownFlipped, SelectDropdownItem, SelectNoSearchResults, SelectSearchControl } from './styles';
|
|
290
285
|
import { SelectGroupByFunction, SelectOption, SelectSearchFunction } from './types';
|
|
291
286
|
|
|
292
287
|
export default defineComponent({
|
|
@@ -302,6 +297,7 @@ export default defineComponent({
|
|
|
302
297
|
OrLabel,
|
|
303
298
|
OrMenuItem,
|
|
304
299
|
OrPopover,
|
|
300
|
+
OrSelectPlaceholder,
|
|
305
301
|
OrTag,
|
|
306
302
|
},
|
|
307
303
|
|
|
@@ -386,6 +382,11 @@ export default defineComponent({
|
|
|
386
382
|
default: false,
|
|
387
383
|
},
|
|
388
384
|
|
|
385
|
+
enableClear: {
|
|
386
|
+
type: Boolean,
|
|
387
|
+
default: false,
|
|
388
|
+
},
|
|
389
|
+
|
|
389
390
|
searchFunction: {
|
|
390
391
|
type: Function as PropType<SelectSearchFunction>,
|
|
391
392
|
|
|
@@ -435,6 +436,9 @@ export default defineComponent({
|
|
|
435
436
|
const popoverRoot = computed(() => popover.value?.root);
|
|
436
437
|
const popoverState = computed(() => popover.value?.state);
|
|
437
438
|
|
|
439
|
+
// Props
|
|
440
|
+
const { enableClear, modelValue } = toRefs(props);
|
|
441
|
+
|
|
438
442
|
// Styles
|
|
439
443
|
const rootStyles = computed(() => [
|
|
440
444
|
'or-select-v3',
|
|
@@ -449,10 +453,6 @@ export default defineComponent({
|
|
|
449
453
|
...SelectSearchControl,
|
|
450
454
|
]);
|
|
451
455
|
|
|
452
|
-
const placeholderStyles = computed(() => [
|
|
453
|
-
...SelectPlaceholder,
|
|
454
|
-
]);
|
|
455
|
-
|
|
456
456
|
const dropdownStyles = computed(() => [
|
|
457
457
|
...SelectDropdown,
|
|
458
458
|
...popover.value?.isFlipped ? SelectDropdownFlipped : SelectDropdownDefault,
|
|
@@ -469,7 +469,7 @@ export default defineComponent({
|
|
|
469
469
|
// State
|
|
470
470
|
const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
|
|
471
471
|
|
|
472
|
-
const proxyModelValue = useProxyModelValue(
|
|
472
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
473
473
|
|
|
474
474
|
const isEmptyModelValue = computed(() => {
|
|
475
475
|
return Array.isArray(proxyModelValue.value)
|
|
@@ -477,6 +477,10 @@ export default defineComponent({
|
|
|
477
477
|
: isEmptyValue(proxyModelValue.value);
|
|
478
478
|
});
|
|
479
479
|
|
|
480
|
+
const showClear = computed(() => {
|
|
481
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
482
|
+
});
|
|
483
|
+
|
|
480
484
|
onMounted(() => {
|
|
481
485
|
if (!proxyModelValue.value && props.multiple) {
|
|
482
486
|
proxyModelValue.value = [];
|
|
@@ -598,7 +602,6 @@ export default defineComponent({
|
|
|
598
602
|
rootStyles,
|
|
599
603
|
controlStyles,
|
|
600
604
|
searchControlStyles,
|
|
601
|
-
placeholderStyles,
|
|
602
605
|
dropdownStyles,
|
|
603
606
|
dropdownItemStyles,
|
|
604
607
|
noSearchResultsStyles,
|
|
@@ -606,6 +609,7 @@ export default defineComponent({
|
|
|
606
609
|
proxyModelValue,
|
|
607
610
|
readonly,
|
|
608
611
|
isEmptyModelValue,
|
|
612
|
+
showClear,
|
|
609
613
|
selection,
|
|
610
614
|
searchText,
|
|
611
615
|
internalSearchOptions,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
:class="rootStyles"
|
|
5
|
+
:disabled="disabled ? '' : null"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, ref } from 'vue-demi';
|
|
13
|
+
import { SelectPlaceholder } from './styles';
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
props: {
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
expose: [
|
|
24
|
+
'root',
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
setup() {
|
|
28
|
+
// Refs
|
|
29
|
+
const root = ref<HTMLElement>();
|
|
30
|
+
|
|
31
|
+
// Styles
|
|
32
|
+
const rootStyles = computed(() => [
|
|
33
|
+
'or-select-placeholder-v3',
|
|
34
|
+
...SelectPlaceholder,
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
root,
|
|
39
|
+
rootStyles,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
@@ -32,18 +32,6 @@ export const SelectSearchControl: string[] = [
|
|
|
32
32
|
'!my-sm md:!my-none',
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
-
export const SelectPlaceholder: string[] = [
|
|
36
|
-
// Theme
|
|
37
|
-
'theme-foreground-outline',
|
|
38
|
-
'dark:theme-foreground-outline-dark',
|
|
39
|
-
|
|
40
|
-
// Interactivity
|
|
41
|
-
'select-none',
|
|
42
|
-
|
|
43
|
-
// Typography
|
|
44
|
-
'truncate',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
35
|
export const SelectDropdown: string[] = [
|
|
48
36
|
// Overflow
|
|
49
37
|
'overflow-y-auto',
|