@onereach/ui-components 2.57.3 → 2.58.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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
1
+ import { isVue3, defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
2
2
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
3
3
  import { u as useOverflow } from './useOverflow-ac506c65.js';
4
4
  import '@vueuse/core';
@@ -15,6 +15,31 @@ import { _ as __vue_component__$a } from './OrPopover-edd82c5d.js';
15
15
  import { _ as __vue_component__$b } from './OrTag-23de8510.js';
16
16
  import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
17
17
 
18
+ const created$1 = (element, binding) => {
19
+ element.addEventListener('keydown', event => {
20
+ event.preventDefault();
21
+ if (['Escape'].includes(event.key)) {
22
+ binding.value(event);
23
+ }
24
+ });
25
+ };
26
+ const DropdownClose = {
27
+ [isVue3 ? 'created' : 'bind']: created$1
28
+ };
29
+
30
+ const created = (element, binding) => {
31
+ element.addEventListener('keydown', event => {
32
+ event.preventDefault();
33
+ if (['Enter', ' '].includes(event.key)) {
34
+ binding.value(event);
35
+ }
36
+ });
37
+ element.addEventListener('click', binding.value);
38
+ };
39
+ const DropdownOpen = {
40
+ [isVue3 ? 'created' : 'bind']: created
41
+ };
42
+
18
43
  const SelectRoot = [
19
44
  // Layout
20
45
  'flex', 'flex-col',
@@ -62,6 +87,10 @@ var script = defineComponent({
62
87
  OrPopover: __vue_component__$a,
63
88
  OrTag: __vue_component__$b
64
89
  },
90
+ directives: {
91
+ DropdownClose,
92
+ DropdownOpen
93
+ },
65
94
  inheritAttrs: false,
66
95
  props: {
67
96
  options: {
@@ -299,6 +328,17 @@ var __vue_render__ = function () {
299
328
  proxy: true
300
329
  }], null, true)
301
330
  }, [_vm._v("\n " + _vm._s(_vm.label) + "\n\n ")])] : _vm._e(), _vm._v(" "), _c('OrInputBox', {
331
+ directives: [{
332
+ name: "dropdown-open",
333
+ rawName: "v-dropdown-open",
334
+ value: _vm.open,
335
+ expression: "open"
336
+ }, {
337
+ name: "dropdown-close",
338
+ rawName: "v-dropdown-close",
339
+ value: _vm.close,
340
+ expression: "close"
341
+ }],
302
342
  ref: "inputBox",
303
343
  class: [_vm.popoverState === 'open' && 'rounded-b-[0]'],
304
344
  attrs: {
@@ -306,12 +346,6 @@ var __vue_render__ = function () {
306
346
  "invalid": _vm.invalid,
307
347
  "readonly": _vm.readonly,
308
348
  "disabled": _vm.disabled
309
- },
310
- on: {
311
- "click": function ($event) {
312
- $event.stopPropagation();
313
- return _vm.open();
314
- }
315
349
  }
316
350
  }, [_c('div', {
317
351
  ref: "control",
@@ -323,8 +357,7 @@ var __vue_render__ = function () {
323
357
  },
324
358
  on: {
325
359
  "focus": function ($event) {
326
- _vm.$emit('focus', $event);
327
- _vm.open();
360
+ return _vm.$emit('focus', $event);
328
361
  },
329
362
  "blur": function ($event) {
330
363
  return _vm.$emit('blur', $event);
@@ -0,0 +1,4 @@
1
+ import { DirectiveHook } from 'vue-demi';
2
+ export declare const DropdownClose: {
3
+ [x: string]: DirectiveHook<any, import("vue-demi").VNode | null, any>;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { DirectiveHook } from 'vue-demi';
2
+ export declare const DropdownOpen: {
3
+ [x: string]: DirectiveHook<any, import("vue-demi").VNode | null, any>;
4
+ };
package/dist/v2/index.js CHANGED
@@ -64,7 +64,7 @@ export { _ as OrRadioGroup } from './OrRadioGroup-11424644.js';
64
64
  export { _ as OrRadioV3 } from './OrRadio-fd743245.js';
65
65
  export { _ as OrSearchV3 } from './OrSearch-b12a8f48.js';
66
66
  export { _ as OrSelect } from './OrSelect-ea27a70e.js';
67
- export { _ as OrSelectV3 } from './OrSelect-a8e01683.js';
67
+ export { _ as OrSelectV3 } from './OrSelect-f19c530e.js';
68
68
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-feacf13a.js';
69
69
  export { O as OrSidebarPlacement, _ as OrSidebarV3 } from './OrSidebar-2522cce0.js';
70
70
  export { _ as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-38aef640.js';
package/dist/v2/index2.js CHANGED
@@ -64,7 +64,7 @@ export { _ as OrRadioGroup } from './OrRadioGroup-11424644.js';
64
64
  export { _ as OrRadioV3 } from './OrRadio-fd743245.js';
65
65
  export { _ as OrSearchV3 } from './OrSearch-b12a8f48.js';
66
66
  export { _ as OrSelect } from './OrSelect-ea27a70e.js';
67
- export { _ as OrSelectV3 } from './OrSelect-a8e01683.js';
67
+ export { _ as OrSelectV3 } from './OrSelect-f19c530e.js';
68
68
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-feacf13a.js';
69
69
  export { O as OrSidebarPlacement, _ as OrSidebarV3 } from './OrSidebar-2522cce0.js';
70
70
  export { _ as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-38aef640.js';
@@ -1,4 +1,4 @@
1
- export { _ as OrSelectV3 } from './OrSelect-a8e01683.js';
1
+ export { _ as OrSelectV3 } from './OrSelect-f19c530e.js';
2
2
  export { a as SelectSize } from './OrInputBox-f4b747ab.js';
3
3
  import 'vue-demi';
4
4
  import './useClassAttribute-47fdb016.js';
@@ -1,4 +1,4 @@
1
- import { defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
1
+ import { isVue3, defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
2
2
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
3
3
  import { u as useOverflow } from './useOverflow-ac506c65.js';
4
4
  import '@vueuse/core';
@@ -13,7 +13,32 @@ import { s as script$8 } from './OrLabel-8cada750.js';
13
13
  import { s as script$9 } from './OrMenuItem-f7d575ba.js';
14
14
  import { s as script$a } from './OrPopover-5b07072d.js';
15
15
  import { s as script$b } from './OrTag-09cc3f1f.js';
16
- import { resolveComponent, openBlock, createElementBlock, mergeProps, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, normalizeClass, withModifiers, createElementVNode, Fragment, renderList } from 'vue';
16
+ import { resolveComponent, resolveDirective, openBlock, createElementBlock, mergeProps, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, withDirectives, normalizeClass, createElementVNode, Fragment, renderList, createVNode, withModifiers } from 'vue';
17
+
18
+ const created$1 = (element, binding) => {
19
+ element.addEventListener('keydown', event => {
20
+ event.preventDefault();
21
+ if (['Escape'].includes(event.key)) {
22
+ binding.value(event);
23
+ }
24
+ });
25
+ };
26
+ const DropdownClose = {
27
+ [isVue3 ? 'created' : 'bind']: created$1
28
+ };
29
+
30
+ const created = (element, binding) => {
31
+ element.addEventListener('keydown', event => {
32
+ event.preventDefault();
33
+ if (['Enter', ' '].includes(event.key)) {
34
+ binding.value(event);
35
+ }
36
+ });
37
+ element.addEventListener('click', binding.value);
38
+ };
39
+ const DropdownOpen = {
40
+ [isVue3 ? 'created' : 'bind']: created
41
+ };
17
42
 
18
43
  const SelectRoot = [
19
44
  // Layout
@@ -62,6 +87,10 @@ var script = defineComponent({
62
87
  OrPopover: script$a,
63
88
  OrTag: script$b
64
89
  },
90
+ directives: {
91
+ DropdownClose,
92
+ DropdownOpen
93
+ },
65
94
  inheritAttrs: false,
66
95
  props: {
67
96
  options: {
@@ -286,6 +315,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
286
315
  const _component_OrInputBox = resolveComponent("OrInputBox");
287
316
  const _component_OrHint = resolveComponent("OrHint");
288
317
  const _component_OrError = resolveComponent("OrError");
318
+ const _directive_dropdown_open = resolveDirective("dropdown-open");
319
+ const _directive_dropdown_close = resolveDirective("dropdown-close");
289
320
  return openBlock(), createElementBlock("div", mergeProps({
290
321
  ref: "root"
291
322
  }, _ctx.$attrs, {
@@ -301,14 +332,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
301
332
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.label) + " ", 1 /* TEXT */)]),
302
333
 
303
334
  _: 3 /* FORWARDED */
304
- }, 8 /* PROPS */, ["control-id", "required", "disabled"])) : createCommentVNode("v-if", true), createVNode(_component_OrInputBox, {
335
+ }, 8 /* PROPS */, ["control-id", "required", "disabled"])) : createCommentVNode("v-if", true), withDirectives((openBlock(), createBlock(_component_OrInputBox, {
305
336
  ref: "inputBox",
306
337
  class: normalizeClass([_ctx.popoverState === 'open' && 'rounded-b-[0]']),
307
338
  size: _ctx.size,
308
339
  invalid: _ctx.invalid,
309
340
  readonly: _ctx.readonly,
310
- disabled: _ctx.disabled,
311
- onClick: _cache[5] || (_cache[5] = withModifiers($event => _ctx.open(), ["stop"]))
341
+ disabled: _ctx.disabled
312
342
  }, {
313
343
  default: withCtx(() => [createElementVNode("div", {
314
344
  id: _ctx.controlId,
@@ -316,10 +346,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
316
346
  class: normalizeClass(_ctx.controlStyles),
317
347
  tabindex: !_ctx.disabled ? 0 : null,
318
348
  disabled: _ctx.disabled,
319
- onFocus: _cache[0] || (_cache[0] = $event => {
320
- _ctx.$emit('focus', $event);
321
- _ctx.open();
322
- }),
349
+ onFocus: _cache[0] || (_cache[0] = $event => _ctx.$emit('focus', $event)),
323
350
  onBlur: _cache[1] || (_cache[1] = $event => _ctx.$emit('blur', $event))
324
351
  }, [_ctx.proxyModelValue && _ctx.proxyModelValue.length > 0 ? (openBlock(), createElementBlock(Fragment, {
325
352
  key: 0
@@ -457,7 +484,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
457
484
  _: 3 /* FORWARDED */
458
485
  }, 8 /* PROPS */, ["class", "trigger"])]),
459
486
  _: 3 /* FORWARDED */
460
- }, 8 /* PROPS */, ["class", "size", "invalid", "readonly", "disabled"]), !_ctx.invalid ? (openBlock(), createBlock(_component_OrHint, {
487
+ }, 8 /* PROPS */, ["class", "size", "invalid", "readonly", "disabled"])), [[_directive_dropdown_open, _ctx.open], [_directive_dropdown_close, _ctx.close]]), !_ctx.invalid ? (openBlock(), createBlock(_component_OrHint, {
461
488
  key: 1,
462
489
  disabled: _ctx.disabled
463
490
  }, {
@@ -0,0 +1,4 @@
1
+ import { DirectiveHook } from 'vue-demi';
2
+ export declare const DropdownClose: {
3
+ [x: string]: DirectiveHook<any, import("vue-demi").VNode | null, any>;
4
+ };
@@ -0,0 +1,4 @@
1
+ import { DirectiveHook } from 'vue-demi';
2
+ export declare const DropdownOpen: {
3
+ [x: string]: DirectiveHook<any, import("vue-demi").VNode | null, any>;
4
+ };
package/dist/v3/index.js CHANGED
@@ -59,7 +59,7 @@ export { s as OrRadioGroup } from './OrRadioGroup-00785e41.js';
59
59
  export { s as OrRadioV3 } from './OrRadio-d7382a18.js';
60
60
  export { s as OrSearchV3 } from './OrSearch-565bd7b4.js';
61
61
  export { s as OrSelect } from './OrSelect-056731af.js';
62
- export { s as OrSelectV3 } from './OrSelect-844b41c6.js';
62
+ export { s as OrSelectV3 } from './OrSelect-ce017f05.js';
63
63
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
64
64
  export { O as OrSidebarPlacement, s as OrSidebarV3 } from './OrSidebar-96f8b7c3.js';
65
65
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-2b1610ce.js';
package/dist/v3/index2.js CHANGED
@@ -59,7 +59,7 @@ export { s as OrRadioGroup } from './OrRadioGroup-00785e41.js';
59
59
  export { s as OrRadioV3 } from './OrRadio-d7382a18.js';
60
60
  export { s as OrSearchV3 } from './OrSearch-565bd7b4.js';
61
61
  export { s as OrSelect } from './OrSelect-056731af.js';
62
- export { s as OrSelectV3 } from './OrSelect-844b41c6.js';
62
+ export { s as OrSelectV3 } from './OrSelect-ce017f05.js';
63
63
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
64
64
  export { O as OrSidebarPlacement, s as OrSidebarV3 } from './OrSidebar-96f8b7c3.js';
65
65
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-2b1610ce.js';
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from './OrSelect-844b41c6.js';
1
+ export { s as OrSelectV3 } from './OrSelect-ce017f05.js';
2
2
  export { a as SelectSize } from './OrInputBox-f44f1f5f.js';
3
3
  import 'vue-demi';
4
4
  import './useClassAttribute-47fdb016.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.57.3",
3
+ "version": "2.58.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -76,5 +76,5 @@
76
76
  "optional": true
77
77
  }
78
78
  },
79
- "gitHead": "f7c32546489ccc36cc7a5a4cb97d2cfcafef3194"
79
+ "gitHead": "f22379d759685379741c721d6d1236575c75ab26"
80
80
  }
@@ -21,12 +21,13 @@
21
21
 
22
22
  <OrInputBox
23
23
  ref="inputBox"
24
+ v-dropdown-open="open"
25
+ v-dropdown-close="close"
24
26
  :class="[popoverState === 'open' && 'rounded-b-[0]']"
25
27
  :size="size"
26
28
  :invalid="invalid"
27
29
  :readonly="readonly"
28
30
  :disabled="disabled"
29
- @click.stop="open()"
30
31
  >
31
32
  <div
32
33
  :id="controlId"
@@ -34,7 +35,7 @@
34
35
  :class="controlStyles"
35
36
  :tabindex="!disabled ? 0 : null"
36
37
  :disabled="disabled"
37
- @focus="$emit('focus', $event); open()"
38
+ @focus="$emit('focus', $event)"
38
39
  @blur="$emit('blur', $event)"
39
40
  >
40
41
  <template v-if="proxyModelValue && proxyModelValue.length > 0">
@@ -207,6 +208,8 @@
207
208
 
208
209
  <script lang="ts">
209
210
  import { computed, defineComponent, getCurrentInstance, onMounted, PropType, ref, watch } from 'vue-demi';
211
+ import { DropdownClose } from '../../directives/dropdown-close';
212
+ import { DropdownOpen } from '../../directives/dropdown-open';
210
213
  import { useClassAttribute, useOverflow } from '../../hooks';
211
214
  import { OrCheckboxV3 as OrCheckbox } from '../or-checkbox-v3';
212
215
  import { OrErrorV3 as OrError } from '../or-error-v3';
@@ -240,6 +243,11 @@ export default defineComponent({
240
243
  OrTag,
241
244
  },
242
245
 
246
+ directives: {
247
+ DropdownClose,
248
+ DropdownOpen,
249
+ },
250
+
243
251
  inheritAttrs: false,
244
252
 
245
253
  props: {
@@ -0,0 +1,15 @@
1
+ import { DirectiveBinding, DirectiveHook, isVue3 } from 'vue-demi';
2
+
3
+ const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<(event: Event) => void>) => {
4
+ element.addEventListener('keydown', (event) => {
5
+ event.preventDefault();
6
+
7
+ if (['Escape'].includes(event.key)) {
8
+ binding.value(event);
9
+ }
10
+ });
11
+ };
12
+
13
+ export const DropdownClose = {
14
+ [isVue3 ? 'created' : 'bind']: created,
15
+ };
@@ -0,0 +1,17 @@
1
+ import { DirectiveBinding, DirectiveHook, isVue3 } from 'vue-demi';
2
+
3
+ const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<(event: Event) => void>) => {
4
+ element.addEventListener('keydown', (event) => {
5
+ event.preventDefault();
6
+
7
+ if (['Enter', ' '].includes(event.key)) {
8
+ binding.value(event);
9
+ }
10
+ });
11
+
12
+ element.addEventListener('click', binding.value);
13
+ };
14
+
15
+ export const DropdownOpen = {
16
+ [isVue3 ? 'created' : 'bind']: created,
17
+ };