@onereach/ui-components 8.16.3 → 8.16.4

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 (28) hide show
  1. package/dist/bundled/v2/components/OrSearchV3/OrSearch.js +37 -19
  2. package/dist/bundled/v2/components/OrSearchV3/OrSearch.vue.d.ts +6 -4
  3. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +1 -1
  4. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +1 -1
  5. package/dist/bundled/v3/components/OrCardCollectionV3/props.js +1 -1
  6. package/dist/bundled/v3/components/OrCardCollectionV3/styles.js +1 -1
  7. package/dist/bundled/v3/components/OrSearchV3/OrSearch.vue.d.ts +5 -4
  8. package/dist/bundled/v3/components/OrSearchV3/index.js +40 -22
  9. package/dist/bundled/v3/components/index.js +1 -1
  10. package/dist/bundled/v3/index.js +1 -1
  11. package/dist/esm/v2/{OrCardCollection-e7c0c61d.js → OrCardCollection-f2870c25.js} +1 -1
  12. package/dist/esm/v2/{OrSearch-de2423bc.js → OrSearch-2910207c.js} +39 -21
  13. package/dist/esm/v2/components/index.js +2 -2
  14. package/dist/esm/v2/components/or-card-collection-v3/index.js +3 -3
  15. package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +6 -4
  16. package/dist/esm/v2/components/or-search-v3/index.js +3 -3
  17. package/dist/esm/v2/index.js +2 -2
  18. package/dist/esm/v3/{OrCardCollection-ce6c8201.js → OrCardCollection-fc6fd56c.js} +1 -1
  19. package/dist/esm/v3/{OrSearch-9c6f1e16.js → OrSearch-fccacdba.js} +42 -24
  20. package/dist/esm/v3/components/index.js +2 -2
  21. package/dist/esm/v3/components/or-card-collection-v3/index.js +3 -3
  22. package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +5 -4
  23. package/dist/esm/v3/components/or-search-v3/index.js +3 -3
  24. package/dist/esm/v3/index.js +2 -2
  25. package/package.json +2 -2
  26. package/src/components/or-search-v3/OrSearch.vue +46 -19
  27. package/src/hooks/useProxyModelValue.ts +1 -1
  28. /package/dist/bundled/v3/components/{OrCardCollectionV3-6b1266a6.js → OrCardCollectionV3-dfd98c34.js} +0 -0
@@ -1,10 +1,11 @@
1
- import { defineComponent, ref, computed, reactive, watch } from 'vue-demi';
1
+ import { defineComponent, ref, computed, reactive, toRef, watch } from 'vue-demi';
2
2
  import __vue_component__$1 from '../OrInputV3/OrInput.js';
3
+ import { b as watchDebounced } from '../../index-1612099e.js';
3
4
  import { InputBoxSize } from '../OrInputBoxV3/props.js';
4
5
  import { useIdAttribute } from '../../hooks/useIdAttribute.js';
5
6
  import { useControlAttributes } from '../../hooks/useControlAttributes.js';
6
7
  import { useValidationAttributes } from '../../hooks/useValidationAttributes.js';
7
- import { b as watchDebounced } from '../../index-1612099e.js';
8
+ import { useProxyModelValue } from '../../hooks/useProxyModelValue.js';
8
9
  import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
9
10
 
10
11
  var script = defineComponent({
@@ -12,11 +13,14 @@ var script = defineComponent({
12
13
  components: {
13
14
  OrInput: __vue_component__$1
14
15
  },
16
+ model: {
17
+ prop: 'modelValue',
18
+ event: 'update:modelValue'
19
+ },
15
20
  props: {
16
21
  modelValue: {
17
22
  type: String,
18
- default: '',
19
- required: false
23
+ default: ''
20
24
  },
21
25
  size: {
22
26
  type: String,
@@ -35,27 +39,35 @@ var script = defineComponent({
35
39
  default: false
36
40
  }
37
41
  },
38
- emits: ['search', 'input', 'keydown', 'keyup', 'focus', 'blur', 'clear'],
39
- expose: ['root', 'focus', 'clear'],
42
+ emits: ['update:modelValue', 'input', 'keydown', 'keyup', 'focus', 'blur', 'search', 'clear'],
43
+ expose: ['root', 'focus', 'blur', 'clear'],
40
44
  setup(props, context) {
41
- var _a;
42
45
  // Refs
43
46
  const root = ref();
44
47
  // Styles
45
48
  const rootStyles = computed(() => ['or-search-v3']);
46
49
  // State
47
- const localModelValue = ref((_a = props.modelValue) !== null && _a !== void 0 ? _a : '');
48
50
  const controlAttributes = reactive({
49
51
  id: useIdAttribute(),
50
52
  ...useControlAttributes(),
51
53
  ...useValidationAttributes()
52
54
  });
53
- // Events
54
- watchDebounced(localModelValue, () => localModelValue.value.length > 0 && context.emit('search', localModelValue.value), {
55
- debounce: props.debounce
55
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
56
+ const draftModelValue = ref(props.modelValue);
57
+ watch(proxyModelValue, value => {
58
+ draftModelValue.value = value;
59
+ });
60
+ watchDebounced(draftModelValue, value => {
61
+ if (value.length > 0) {
62
+ proxyModelValue.value = value;
63
+ context.emit('search', value);
64
+ }
65
+ }, {
66
+ debounce: toRef(props, 'debounce')
56
67
  });
57
- watch(localModelValue, (val, beforeVal) => {
58
- if (val.length === 0 && beforeVal.length > 0) {
68
+ watch(draftModelValue, (nextValue, prevValue) => {
69
+ if (nextValue.length === 0 && prevValue.length > 0) {
70
+ proxyModelValue.value = nextValue;
59
71
  context.emit('search', '');
60
72
  context.emit('clear');
61
73
  }
@@ -66,15 +78,22 @@ var script = defineComponent({
66
78
  (_a = root.value) === null || _a === void 0 ? void 0 : _a.focus(); // fixes error TS2349
67
79
  }
68
80
 
81
+ function blur() {
82
+ var _a;
83
+ (_a = root.value) === null || _a === void 0 ? void 0 : _a.blur(); // fixes error TS2349
84
+ }
85
+
69
86
  function clear() {
70
- localModelValue.value = '';
87
+ draftModelValue.value = '';
71
88
  }
72
89
  return {
73
90
  root,
74
91
  rootStyles,
75
- localModelValue,
76
92
  controlAttributes,
93
+ proxyModelValue,
94
+ draftModelValue,
77
95
  focus,
96
+ blur,
78
97
  clear
79
98
  };
80
99
  }
@@ -95,7 +114,6 @@ var __vue_render__ = function () {
95
114
  "type": 'search',
96
115
  "size": _vm.size,
97
116
  "placeholder": _vm.placeholder,
98
- "debounce": _vm.debounce,
99
117
  "disable-default-styles": _vm.disableDefaultStyles
100
118
  },
101
119
  on: {
@@ -116,11 +134,11 @@ var __vue_render__ = function () {
116
134
  }
117
135
  },
118
136
  model: {
119
- value: _vm.localModelValue,
137
+ value: _vm.draftModelValue,
120
138
  callback: function ($$v) {
121
- _vm.localModelValue = typeof $$v === 'string' ? $$v.trim() : $$v;
139
+ _vm.draftModelValue = typeof $$v === 'string' ? $$v.trim() : $$v;
122
140
  },
123
- expression: "localModelValue"
141
+ expression: "draftModelValue"
124
142
  }
125
143
  }, 'OrInput', _vm.controlAttributes, false));
126
144
  };
@@ -7,7 +7,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
7
7
  [x: number]: string;
8
8
  } | {}, true> | undefined>;
9
9
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
10
- localModelValue: import("@vue/composition-api").Ref<string>;
11
10
  controlAttributes: {
12
11
  required: boolean | undefined;
13
12
  minlength: number | undefined;
@@ -21,13 +20,15 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
21
20
  'force-state': string | undefined;
22
21
  id: string | undefined;
23
22
  };
23
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
24
+ draftModelValue: import("@vue/composition-api").Ref<string>;
24
25
  focus: () => void;
26
+ blur: () => void;
25
27
  clear: () => void;
26
28
  }> & import("@vue/composition-api").Data, {}, {}, {
27
29
  modelValue: {
28
30
  type: StringConstructor;
29
31
  default: string;
30
- required: false;
31
32
  };
32
33
  size: {
33
34
  type: PropType<"m" | "s">;
@@ -49,7 +50,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
49
50
  modelValue: {
50
51
  type: StringConstructor;
51
52
  default: string;
52
- required: false;
53
53
  };
54
54
  size: {
55
55
  type: PropType<"m" | "s">;
@@ -82,7 +82,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
82
82
  [x: number]: string;
83
83
  } | {}, true> | undefined>;
84
84
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
85
- localModelValue: import("@vue/composition-api").Ref<string>;
86
85
  controlAttributes: {
87
86
  required: boolean | undefined;
88
87
  minlength: number | undefined;
@@ -96,7 +95,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
96
95
  'force-state': string | undefined;
97
96
  id: string | undefined;
98
97
  };
98
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
99
+ draftModelValue: import("@vue/composition-api").Ref<string>;
99
100
  focus: () => void;
101
+ blur: () => void;
100
102
  clear: () => void;
101
103
  }>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
102
104
  modelValue: string;
@@ -1 +1 @@
1
- export { s as default } from '../OrCardCollectionV3-6b1266a6.js';
1
+ export { s as default } from '../OrCardCollectionV3-dfd98c34.js';
@@ -1 +1 @@
1
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollectionV3-6b1266a6.js';
1
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollectionV3-dfd98c34.js';
@@ -1 +1 @@
1
- export { C as CardCollectionView, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollectionV3-6b1266a6.js';
1
+ export { C as CardCollectionView, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollectionV3-dfd98c34.js';
@@ -1 +1 @@
1
- export { a as CardCollection, e as CardCollectionContent, f as CardCollectionContentViews, b as CardCollectionToolbar, c as CardCollectionToolbarPanel } from '../OrCardCollectionV3-6b1266a6.js';
1
+ export { a as CardCollection, e as CardCollectionContent, f as CardCollectionContentViews, b as CardCollectionToolbar, c as CardCollectionToolbarPanel } from '../OrCardCollectionV3-dfd98c34.js';
@@ -4,7 +4,6 @@ declare const _default: import("vue-demi").DefineComponent<{
4
4
  modelValue: {
5
5
  type: StringConstructor;
6
6
  default: string;
7
- required: false;
8
7
  };
9
8
  size: {
10
9
  type: PropType<"m" | "s">;
@@ -25,7 +24,6 @@ declare const _default: import("vue-demi").DefineComponent<{
25
24
  }, {
26
25
  root: import("vue-demi").Ref<any>;
27
26
  rootStyles: import("vue-demi").ComputedRef<string[]>;
28
- localModelValue: import("vue-demi").Ref<string>;
29
27
  controlAttributes: {
30
28
  required: boolean | undefined;
31
29
  minlength: number | undefined;
@@ -39,13 +37,15 @@ declare const _default: import("vue-demi").DefineComponent<{
39
37
  'force-state': string | undefined;
40
38
  id: string | undefined;
41
39
  };
40
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
41
+ draftModelValue: import("vue-demi").Ref<string>;
42
42
  focus: () => void;
43
+ blur: () => void;
43
44
  clear: () => void;
44
- }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("search" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear")[], "search" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
45
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("search" | "update:modelValue" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear")[], "search" | "update:modelValue" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
45
46
  modelValue: {
46
47
  type: StringConstructor;
47
48
  default: string;
48
- required: false;
49
49
  };
50
50
  size: {
51
51
  type: PropType<"m" | "s">;
@@ -65,6 +65,7 @@ declare const _default: import("vue-demi").DefineComponent<{
65
65
  };
66
66
  }>> & {
67
67
  onSearch?: ((...args: any[]) => any) | undefined;
68
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
68
69
  onInput?: ((...args: any[]) => any) | undefined;
69
70
  onKeydown?: ((...args: any[]) => any) | undefined;
70
71
  onKeyup?: ((...args: any[]) => any) | undefined;
@@ -1,23 +1,27 @@
1
1
  import { I as InputBoxSize } from '../OrInputBoxV3-ddd117f0.js';
2
2
  export { I as SearchSize } from '../OrInputBoxV3-ddd117f0.js';
3
3
  import { resolveComponent, openBlock, createBlock, mergeProps } from 'vue';
4
- import { defineComponent, ref, computed, reactive, watch } from 'vue-demi';
4
+ import { defineComponent, ref, computed, reactive, toRef, watch } from 'vue-demi';
5
5
  import { s as script$1 } from '../OrInputV3-5ed9b5fd.js';
6
+ import { m as watchDebounced } from '../OrBottomSheetV3-66815f6f.js';
6
7
  import { useIdAttribute } from '../../hooks/useIdAttribute.js';
7
8
  import { useControlAttributes } from '../../hooks/useControlAttributes.js';
8
9
  import { useValidationAttributes } from '../../hooks/useValidationAttributes.js';
9
- import { m as watchDebounced } from '../OrBottomSheetV3-66815f6f.js';
10
+ import { useProxyModelValue } from '../../hooks/useProxyModelValue.js';
10
11
 
11
12
  var script = defineComponent({
12
13
  name: 'OrSearch',
13
14
  components: {
14
15
  OrInput: script$1
15
16
  },
17
+ model: {
18
+ prop: 'modelValue',
19
+ event: 'update:modelValue'
20
+ },
16
21
  props: {
17
22
  modelValue: {
18
23
  type: String,
19
- default: '',
20
- required: false
24
+ default: ''
21
25
  },
22
26
  size: {
23
27
  type: String,
@@ -36,27 +40,35 @@ var script = defineComponent({
36
40
  default: false
37
41
  }
38
42
  },
39
- emits: ['search', 'input', 'keydown', 'keyup', 'focus', 'blur', 'clear'],
40
- expose: ['root', 'focus', 'clear'],
43
+ emits: ['update:modelValue', 'input', 'keydown', 'keyup', 'focus', 'blur', 'search', 'clear'],
44
+ expose: ['root', 'focus', 'blur', 'clear'],
41
45
  setup(props, context) {
42
- var _a;
43
46
  // Refs
44
47
  const root = ref();
45
48
  // Styles
46
49
  const rootStyles = computed(() => ['or-search-v3']);
47
50
  // State
48
- const localModelValue = ref((_a = props.modelValue) !== null && _a !== void 0 ? _a : '');
49
51
  const controlAttributes = reactive({
50
52
  id: useIdAttribute(),
51
53
  ...useControlAttributes(),
52
54
  ...useValidationAttributes()
53
55
  });
54
- // Events
55
- watchDebounced(localModelValue, () => localModelValue.value.length > 0 && context.emit('search', localModelValue.value), {
56
- debounce: props.debounce
56
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
57
+ const draftModelValue = ref(props.modelValue);
58
+ watch(proxyModelValue, value => {
59
+ draftModelValue.value = value;
57
60
  });
58
- watch(localModelValue, (val, beforeVal) => {
59
- if (val.length === 0 && beforeVal.length > 0) {
61
+ watchDebounced(draftModelValue, value => {
62
+ if (value.length > 0) {
63
+ proxyModelValue.value = value;
64
+ context.emit('search', value);
65
+ }
66
+ }, {
67
+ debounce: toRef(props, 'debounce')
68
+ });
69
+ watch(draftModelValue, (nextValue, prevValue) => {
70
+ if (nextValue.length === 0 && prevValue.length > 0) {
71
+ proxyModelValue.value = nextValue;
60
72
  context.emit('search', '');
61
73
  context.emit('clear');
62
74
  }
@@ -67,15 +79,22 @@ var script = defineComponent({
67
79
  (_a = root.value) === null || _a === void 0 ? void 0 : _a.focus(); // fixes error TS2349
68
80
  }
69
81
 
82
+ function blur() {
83
+ var _a;
84
+ (_a = root.value) === null || _a === void 0 ? void 0 : _a.blur(); // fixes error TS2349
85
+ }
86
+
70
87
  function clear() {
71
- localModelValue.value = '';
88
+ draftModelValue.value = '';
72
89
  }
73
90
  return {
74
91
  root,
75
92
  rootStyles,
76
- localModelValue,
77
93
  controlAttributes,
94
+ proxyModelValue,
95
+ draftModelValue,
78
96
  focus,
97
+ blur,
79
98
  clear
80
99
  };
81
100
  }
@@ -85,24 +104,23 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
85
104
  const _component_OrInput = resolveComponent("OrInput");
86
105
  return openBlock(), createBlock(_component_OrInput, mergeProps({
87
106
  ref: "root",
88
- modelValue: _ctx.localModelValue,
89
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.localModelValue = $event),
107
+ modelValue: _ctx.draftModelValue,
108
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.draftModelValue = $event),
90
109
  modelModifiers: {
91
110
  trim: true
92
- },
111
+ }
112
+ }, _ctx.controlAttributes, {
93
113
  class: _ctx.rootStyles,
94
114
  type: 'search',
95
115
  size: _ctx.size,
96
116
  placeholder: _ctx.placeholder,
97
- debounce: _ctx.debounce,
98
- "disable-default-styles": _ctx.disableDefaultStyles
99
- }, _ctx.controlAttributes, {
117
+ "disable-default-styles": _ctx.disableDefaultStyles,
100
118
  onInput: _cache[1] || (_cache[1] = $event => _ctx.$emit('input', $event)),
101
119
  onKeydown: _cache[2] || (_cache[2] = $event => _ctx.$emit('keydown', $event)),
102
120
  onKeyup: _cache[3] || (_cache[3] = $event => _ctx.$emit('keyup', $event)),
103
121
  onFocus: _cache[4] || (_cache[4] = $event => _ctx.$emit('focus', $event)),
104
122
  onBlur: _cache[5] || (_cache[5] = $event => _ctx.$emit('blur', $event))
105
- }), null, 16 /* FULL_PROPS */, ["modelValue", "class", "size", "placeholder", "debounce", "disable-default-styles"]);
123
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "class", "size", "placeholder", "disable-default-styles"]);
106
124
  }
107
125
 
108
126
  script.render = render;
@@ -8,7 +8,7 @@ export { B as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, a as BUTTON_SIZE, b as BUTT
8
8
  export { default as OrIconButton, default as OrIconButtonV2 } from './OrIconButtonV2/OrIconButton.js';
9
9
  export { default as OrCard } from './OrCard/OrCard.js';
10
10
  export { CARD_COLLECTION_LAYOUT, OrCardCollection } from './OrCardCollection/index.js';
11
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollectionV3-6b1266a6.js';
11
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollectionV3-dfd98c34.js';
12
12
  export { C as CardPadding, s as OrCardV3 } from './OrCardV3-f9908b34.js';
13
13
  export { default as OrCheckbox } from './OrCheckbox/OrCheckbox.js';
14
14
  export { default as OrCheckboxGroupV3 } from './OrCheckboxGroupV3/OrCheckboxGroup.js';
@@ -4,7 +4,7 @@ export { a as AvatarColor, A as AvatarSize, s as OrAvatarV3 } from './components
4
4
  export { OrButton, OrButtonColors, OrButtonSizes, OrButtonViews } from './components/OrButton/index.js';
5
5
  export { s as OrButtonGroupV3 } from './components/OrButtonGroupV3-e35a1f1c.js';
6
6
  export { CARD_COLLECTION_LAYOUT, OrCardCollection } from './components/OrCardCollection/index.js';
7
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './components/OrCardCollectionV3-6b1266a6.js';
7
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './components/OrCardCollectionV3-dfd98c34.js';
8
8
  export { C as CardPadding, s as OrCardV3 } from './components/OrCardV3-f9908b34.js';
9
9
  export { default as OrCheckboxGroupV3 } from './components/OrCheckboxGroupV3/OrCheckboxGroup.js';
10
10
  export { s as OrChip, a as OrChips } from './components/OrChips-ba5bb85b.js';
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, ref, watch } from 'vue-demi';
2
2
  import { _ as __vue_component__$2 } from './OrIconButton-edff56d4.js';
3
- import { _ as __vue_component__$4 } from './OrSearch-de2423bc.js';
3
+ import { _ as __vue_component__$4 } from './OrSearch-2910207c.js';
4
4
  import './OrInputBox.vue_rollup-plugin-vue_script-65ebcf4d.js';
5
5
  import { _ as __vue_component__$5 } from './OrLoader-784e2060.js';
6
6
  import { _ as __vue_component__$3 } from './OrSorting-65c84965.js';
@@ -1,12 +1,13 @@
1
- import { debouncedWatch } from '@vueuse/core';
2
- import { defineComponent, ref, computed, reactive, watch } from 'vue-demi';
3
- import { _ as __vue_component__$1 } from './OrInput-ac6484dd.js';
4
- import { I as InputBoxSize } from './OrInputBox.vue_rollup-plugin-vue_script-65ebcf4d.js';
1
+ import { watchDebounced } from '@vueuse/core';
2
+ import { defineComponent, ref, computed, reactive, toRef, watch } from 'vue-demi';
5
3
  import { a as useIdAttribute, u as useControlAttributes } from './useIdAttribute-859439f0.js';
6
4
  import './dom-aecadd9a.js';
5
+ import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
7
6
  import '@onereach/styles/tailwind/plugins/core';
8
7
  import '@onereach/styles/tailwind.config.json';
9
8
  import { u as useValidationAttributes } from './useValidationAttributes-d1abbe34.js';
9
+ import { _ as __vue_component__$1 } from './OrInput-ac6484dd.js';
10
+ import { I as InputBoxSize } from './OrInputBox.vue_rollup-plugin-vue_script-65ebcf4d.js';
10
11
  import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
11
12
 
12
13
  var script = defineComponent({
@@ -14,11 +15,14 @@ var script = defineComponent({
14
15
  components: {
15
16
  OrInput: __vue_component__$1
16
17
  },
18
+ model: {
19
+ prop: 'modelValue',
20
+ event: 'update:modelValue'
21
+ },
17
22
  props: {
18
23
  modelValue: {
19
24
  type: String,
20
- default: '',
21
- required: false
25
+ default: ''
22
26
  },
23
27
  size: {
24
28
  type: String,
@@ -37,27 +41,35 @@ var script = defineComponent({
37
41
  default: false
38
42
  }
39
43
  },
40
- emits: ['search', 'input', 'keydown', 'keyup', 'focus', 'blur', 'clear'],
41
- expose: ['root', 'focus', 'clear'],
44
+ emits: ['update:modelValue', 'input', 'keydown', 'keyup', 'focus', 'blur', 'search', 'clear'],
45
+ expose: ['root', 'focus', 'blur', 'clear'],
42
46
  setup(props, context) {
43
- var _a;
44
47
  // Refs
45
48
  const root = ref();
46
49
  // Styles
47
50
  const rootStyles = computed(() => ['or-search-v3']);
48
51
  // State
49
- const localModelValue = ref((_a = props.modelValue) !== null && _a !== void 0 ? _a : '');
50
52
  const controlAttributes = reactive({
51
53
  id: useIdAttribute(),
52
54
  ...useControlAttributes(),
53
55
  ...useValidationAttributes()
54
56
  });
55
- // Events
56
- debouncedWatch(localModelValue, () => localModelValue.value.length > 0 && context.emit('search', localModelValue.value), {
57
- debounce: props.debounce
57
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
58
+ const draftModelValue = ref(props.modelValue);
59
+ watch(proxyModelValue, value => {
60
+ draftModelValue.value = value;
58
61
  });
59
- watch(localModelValue, (val, beforeVal) => {
60
- if (val.length === 0 && beforeVal.length > 0) {
62
+ watchDebounced(draftModelValue, value => {
63
+ if (value.length > 0) {
64
+ proxyModelValue.value = value;
65
+ context.emit('search', value);
66
+ }
67
+ }, {
68
+ debounce: toRef(props, 'debounce')
69
+ });
70
+ watch(draftModelValue, (nextValue, prevValue) => {
71
+ if (nextValue.length === 0 && prevValue.length > 0) {
72
+ proxyModelValue.value = nextValue;
61
73
  context.emit('search', '');
62
74
  context.emit('clear');
63
75
  }
@@ -68,15 +80,22 @@ var script = defineComponent({
68
80
  (_a = root.value) === null || _a === void 0 ? void 0 : _a.focus(); // fixes error TS2349
69
81
  }
70
82
 
83
+ function blur() {
84
+ var _a;
85
+ (_a = root.value) === null || _a === void 0 ? void 0 : _a.blur(); // fixes error TS2349
86
+ }
87
+
71
88
  function clear() {
72
- localModelValue.value = '';
89
+ draftModelValue.value = '';
73
90
  }
74
91
  return {
75
92
  root,
76
93
  rootStyles,
77
- localModelValue,
78
94
  controlAttributes,
95
+ proxyModelValue,
96
+ draftModelValue,
79
97
  focus,
98
+ blur,
80
99
  clear
81
100
  };
82
101
  }
@@ -97,7 +116,6 @@ var __vue_render__ = function () {
97
116
  "type": 'search',
98
117
  "size": _vm.size,
99
118
  "placeholder": _vm.placeholder,
100
- "debounce": _vm.debounce,
101
119
  "disable-default-styles": _vm.disableDefaultStyles
102
120
  },
103
121
  on: {
@@ -118,11 +136,11 @@ var __vue_render__ = function () {
118
136
  }
119
137
  },
120
138
  model: {
121
- value: _vm.localModelValue,
139
+ value: _vm.draftModelValue,
122
140
  callback: function ($$v) {
123
- _vm.localModelValue = typeof $$v === 'string' ? $$v.trim() : $$v;
141
+ _vm.draftModelValue = typeof $$v === 'string' ? $$v.trim() : $$v;
124
142
  },
125
- expression: "localModelValue"
143
+ expression: "draftModelValue"
126
144
  }
127
145
  }, 'OrInput', _vm.controlAttributes, false));
128
146
  };
@@ -10,7 +10,7 @@ export { _ as OrIconButton, _ as OrIconButtonV2 } from '../OrIconButton-f6370222
10
10
  export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTTON_TYPE, I as ICON_BUTTON_TYPE } from '../OrIconButton.vue_rollup-plugin-vue_styles.0-02ba7b68.js';
11
11
  export { _ as OrCard } from '../OrCard-c44d9783.js';
12
12
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from '../OrCardCollection-d7e546a0.js';
13
- export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-e7c0c61d.js';
13
+ export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-f2870c25.js';
14
14
  export { C as CardPadding, _ as OrCardV3 } from '../OrCard-54dce216.js';
15
15
  export { _ as OrCheckbox } from '../OrCheckbox-3337d903.js';
16
16
  export { _ as OrCheckboxGroupV3 } from '../OrCheckboxGroup-f8781127.js';
@@ -99,7 +99,7 @@ export { _ as OrRatingV3 } from '../OrRating-abf1b609.js';
99
99
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from '../OrResizeablePanel-757f7dc1.js';
100
100
  export { F as Formats, _ as OrRichTextEditorV3 } from '../OrRichTextEditor-7466a45d.js';
101
101
  export { _ as OrSearch } from '../OrSearch-ddf244e6.js';
102
- export { _ as OrSearchV3 } from '../OrSearch-de2423bc.js';
102
+ export { _ as OrSearchV3 } from '../OrSearch-2910207c.js';
103
103
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-00583234.js';
104
104
  export { _ as OrSelect } from '../OrSelect-d271f7a3.js';
105
105
  export { _ as OrSelectV3 } from '../OrSelect-30f5ce68.js';
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../../OrCardCollection-e7c0c61d.js';
1
+ export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../../OrCardCollection-f2870c25.js';
2
2
  import 'vue-demi';
3
3
  import '../../OrIconButton-edff56d4.js';
4
4
  import '../../OrIcon-3f99ef27.js';
@@ -20,11 +20,11 @@ import '../../OrOverlay-9aa5020f.js';
20
20
  import '../../OrTeleport.vue2-9eb0eaee.js';
21
21
  import 'portal-vue';
22
22
  import '../../useTheme-0ef25778.js';
23
- import '../../OrSearch-de2423bc.js';
24
- import '../../OrInput-ac6484dd.js';
23
+ import '../../OrSearch-2910207c.js';
25
24
  import '../../useIdAttribute-859439f0.js';
26
25
  import '../../useProxyModelValue-940010d2.js';
27
26
  import '../../useValidationAttributes-d1abbe34.js';
27
+ import '../../OrInput-ac6484dd.js';
28
28
  import '../../OrError-916e928e.js';
29
29
  import '../../OrHint-1220face.js';
30
30
  import '../../OrInputBox-140c344d.js';
@@ -7,7 +7,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
7
7
  [x: number]: string;
8
8
  } | {}, true> | undefined>;
9
9
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
10
- localModelValue: import("@vue/composition-api").Ref<string>;
11
10
  controlAttributes: {
12
11
  required: boolean | undefined;
13
12
  minlength: number | undefined;
@@ -21,13 +20,15 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
21
20
  'force-state': string | undefined;
22
21
  id: string | undefined;
23
22
  };
23
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
24
+ draftModelValue: import("@vue/composition-api").Ref<string>;
24
25
  focus: () => void;
26
+ blur: () => void;
25
27
  clear: () => void;
26
28
  }> & import("@vue/composition-api").Data, {}, {}, {
27
29
  modelValue: {
28
30
  type: StringConstructor;
29
31
  default: string;
30
- required: false;
31
32
  };
32
33
  size: {
33
34
  type: PropType<"m" | "s">;
@@ -49,7 +50,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
49
50
  modelValue: {
50
51
  type: StringConstructor;
51
52
  default: string;
52
- required: false;
53
53
  };
54
54
  size: {
55
55
  type: PropType<"m" | "s">;
@@ -82,7 +82,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
82
82
  [x: number]: string;
83
83
  } | {}, true> | undefined>;
84
84
  rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
85
- localModelValue: import("@vue/composition-api").Ref<string>;
86
85
  controlAttributes: {
87
86
  required: boolean | undefined;
88
87
  minlength: number | undefined;
@@ -96,7 +95,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
96
95
  'force-state': string | undefined;
97
96
  id: string | undefined;
98
97
  };
98
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
99
+ draftModelValue: import("@vue/composition-api").Ref<string>;
99
100
  focus: () => void;
101
+ blur: () => void;
100
102
  clear: () => void;
101
103
  }>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
102
104
  modelValue: string;
@@ -1,17 +1,17 @@
1
- export { _ as OrSearchV3 } from '../../OrSearch-de2423bc.js';
1
+ export { _ as OrSearchV3 } from '../../OrSearch-2910207c.js';
2
2
  export { I as SearchSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-65ebcf4d.js';
3
3
  import '@vueuse/core';
4
4
  import 'vue-demi';
5
- import '../../OrInput-ac6484dd.js';
6
5
  import '../../useIdAttribute-859439f0.js';
7
6
  import '../../dom-aecadd9a.js';
8
7
  import 'lodash/isElement';
9
8
  import 'lodash/get';
10
9
  import '../../useProxyModelValue-940010d2.js';
11
- import '../../useResponsive-1baf3485.js';
12
10
  import '@onereach/styles/tailwind/plugins/core';
13
11
  import '@onereach/styles/tailwind.config.json';
14
12
  import '../../useValidationAttributes-d1abbe34.js';
13
+ import '../../OrInput-ac6484dd.js';
14
+ import '../../useResponsive-1baf3485.js';
15
15
  import '../../OrError-916e928e.js';
16
16
  import '../../normalize-component-6e8e3d80.js';
17
17
  import '../../OrHint-1220face.js';
@@ -10,7 +10,7 @@ export { _ as OrIconButton, _ as OrIconButtonV2 } from './OrIconButton-f6370222.
10
10
  export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTTON_TYPE, I as ICON_BUTTON_TYPE } from './OrIconButton.vue_rollup-plugin-vue_styles.0-02ba7b68.js';
11
11
  export { _ as OrCard } from './OrCard-c44d9783.js';
12
12
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from './OrCardCollection-d7e546a0.js';
13
- export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-e7c0c61d.js';
13
+ export { C as CardCollectionView, _ as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-f2870c25.js';
14
14
  export { C as CardPadding, _ as OrCardV3 } from './OrCard-54dce216.js';
15
15
  export { _ as OrCheckbox } from './OrCheckbox-3337d903.js';
16
16
  export { _ as OrCheckboxGroupV3 } from './OrCheckboxGroup-f8781127.js';
@@ -99,7 +99,7 @@ export { _ as OrRatingV3 } from './OrRating-abf1b609.js';
99
99
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanel-757f7dc1.js';
100
100
  export { F as Formats, _ as OrRichTextEditorV3 } from './OrRichTextEditor-7466a45d.js';
101
101
  export { _ as OrSearch } from './OrSearch-ddf244e6.js';
102
- export { _ as OrSearchV3 } from './OrSearch-de2423bc.js';
102
+ export { _ as OrSearchV3 } from './OrSearch-2910207c.js';
103
103
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-00583234.js';
104
104
  export { _ as OrSelect } from './OrSelect-d271f7a3.js';
105
105
  export { _ as OrSelectV3 } from './OrSelect-30f5ce68.js';
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, ref, watch } from 'vue-demi';
2
2
  import { s as script$2 } from './OrIconButton-13fd3f96.js';
3
- import { s as script$4 } from './OrSearch-9c6f1e16.js';
3
+ import { s as script$4 } from './OrSearch-fccacdba.js';
4
4
  import './OrInputBox-8c1a29dd.js';
5
5
  import { s as script$5 } from './OrLoader-b7d415dd.js';
6
6
  import { s as script$3 } from './OrSorting-15a719a1.js';
@@ -1,12 +1,13 @@
1
- import { debouncedWatch } from '@vueuse/core';
2
- import { defineComponent, ref, computed, reactive, watch } from 'vue-demi';
3
- import { s as script$1 } from './OrInput-2810a760.js';
4
- import { I as InputBoxSize } from './OrInputBox-8c1a29dd.js';
1
+ import { watchDebounced } from '@vueuse/core';
2
+ import { defineComponent, ref, computed, reactive, toRef, watch } from 'vue-demi';
5
3
  import { a as useIdAttribute, u as useControlAttributes } from './useIdAttribute-859439f0.js';
6
4
  import './dom-aecadd9a.js';
5
+ import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
7
6
  import '@onereach/styles/tailwind/plugins/core';
8
7
  import '@onereach/styles/tailwind.config.json';
9
8
  import { u as useValidationAttributes } from './useValidationAttributes-d1abbe34.js';
9
+ import { s as script$1 } from './OrInput-2810a760.js';
10
+ import { I as InputBoxSize } from './OrInputBox-8c1a29dd.js';
10
11
  import { resolveComponent, openBlock, createBlock, mergeProps } from 'vue';
11
12
 
12
13
  var script = defineComponent({
@@ -14,11 +15,14 @@ var script = defineComponent({
14
15
  components: {
15
16
  OrInput: script$1
16
17
  },
18
+ model: {
19
+ prop: 'modelValue',
20
+ event: 'update:modelValue'
21
+ },
17
22
  props: {
18
23
  modelValue: {
19
24
  type: String,
20
- default: '',
21
- required: false
25
+ default: ''
22
26
  },
23
27
  size: {
24
28
  type: String,
@@ -37,27 +41,35 @@ var script = defineComponent({
37
41
  default: false
38
42
  }
39
43
  },
40
- emits: ['search', 'input', 'keydown', 'keyup', 'focus', 'blur', 'clear'],
41
- expose: ['root', 'focus', 'clear'],
44
+ emits: ['update:modelValue', 'input', 'keydown', 'keyup', 'focus', 'blur', 'search', 'clear'],
45
+ expose: ['root', 'focus', 'blur', 'clear'],
42
46
  setup(props, context) {
43
- var _a;
44
47
  // Refs
45
48
  const root = ref();
46
49
  // Styles
47
50
  const rootStyles = computed(() => ['or-search-v3']);
48
51
  // State
49
- const localModelValue = ref((_a = props.modelValue) !== null && _a !== void 0 ? _a : '');
50
52
  const controlAttributes = reactive({
51
53
  id: useIdAttribute(),
52
54
  ...useControlAttributes(),
53
55
  ...useValidationAttributes()
54
56
  });
55
- // Events
56
- debouncedWatch(localModelValue, () => localModelValue.value.length > 0 && context.emit('search', localModelValue.value), {
57
- debounce: props.debounce
57
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
58
+ const draftModelValue = ref(props.modelValue);
59
+ watch(proxyModelValue, value => {
60
+ draftModelValue.value = value;
61
+ });
62
+ watchDebounced(draftModelValue, value => {
63
+ if (value.length > 0) {
64
+ proxyModelValue.value = value;
65
+ context.emit('search', value);
66
+ }
67
+ }, {
68
+ debounce: toRef(props, 'debounce')
58
69
  });
59
- watch(localModelValue, (val, beforeVal) => {
60
- if (val.length === 0 && beforeVal.length > 0) {
70
+ watch(draftModelValue, (nextValue, prevValue) => {
71
+ if (nextValue.length === 0 && prevValue.length > 0) {
72
+ proxyModelValue.value = nextValue;
61
73
  context.emit('search', '');
62
74
  context.emit('clear');
63
75
  }
@@ -68,15 +80,22 @@ var script = defineComponent({
68
80
  (_a = root.value) === null || _a === void 0 ? void 0 : _a.focus(); // fixes error TS2349
69
81
  }
70
82
 
83
+ function blur() {
84
+ var _a;
85
+ (_a = root.value) === null || _a === void 0 ? void 0 : _a.blur(); // fixes error TS2349
86
+ }
87
+
71
88
  function clear() {
72
- localModelValue.value = '';
89
+ draftModelValue.value = '';
73
90
  }
74
91
  return {
75
92
  root,
76
93
  rootStyles,
77
- localModelValue,
78
94
  controlAttributes,
95
+ proxyModelValue,
96
+ draftModelValue,
79
97
  focus,
98
+ blur,
80
99
  clear
81
100
  };
82
101
  }
@@ -86,24 +105,23 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
86
105
  const _component_OrInput = resolveComponent("OrInput");
87
106
  return openBlock(), createBlock(_component_OrInput, mergeProps({
88
107
  ref: "root",
89
- modelValue: _ctx.localModelValue,
90
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.localModelValue = $event),
108
+ modelValue: _ctx.draftModelValue,
109
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.draftModelValue = $event),
91
110
  modelModifiers: {
92
111
  trim: true
93
- },
112
+ }
113
+ }, _ctx.controlAttributes, {
94
114
  class: _ctx.rootStyles,
95
115
  type: 'search',
96
116
  size: _ctx.size,
97
117
  placeholder: _ctx.placeholder,
98
- debounce: _ctx.debounce,
99
- "disable-default-styles": _ctx.disableDefaultStyles
100
- }, _ctx.controlAttributes, {
118
+ "disable-default-styles": _ctx.disableDefaultStyles,
101
119
  onInput: _cache[1] || (_cache[1] = $event => _ctx.$emit('input', $event)),
102
120
  onKeydown: _cache[2] || (_cache[2] = $event => _ctx.$emit('keydown', $event)),
103
121
  onKeyup: _cache[3] || (_cache[3] = $event => _ctx.$emit('keyup', $event)),
104
122
  onFocus: _cache[4] || (_cache[4] = $event => _ctx.$emit('focus', $event)),
105
123
  onBlur: _cache[5] || (_cache[5] = $event => _ctx.$emit('blur', $event))
106
- }), null, 16 /* FULL_PROPS */, ["modelValue", "class", "size", "placeholder", "debounce", "disable-default-styles"]);
124
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "class", "size", "placeholder", "disable-default-styles"]);
107
125
  }
108
126
 
109
127
  script.render = render;
@@ -8,7 +8,7 @@ export { s as OrButtonV2 } from '../OrButton-f4098587.js';
8
8
  export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTTON_TYPE, I as ICON_BUTTON_TYPE, s as OrIconButton, s as OrIconButtonV2 } from '../OrIconButton-4424a0dc.js';
9
9
  export { s as OrCard } from '../OrCard-e3a5aea4.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from '../OrCardCollection-7fd78cc8.js';
11
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-ce6c8201.js';
11
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../OrCardCollection-fc6fd56c.js';
12
12
  export { C as CardPadding, s as OrCardV3 } from '../OrCard-d3320b27.js';
13
13
  export { s as OrCheckbox } from '../OrCheckbox-42ed332c.js';
14
14
  export { s as OrCheckboxGroupV3 } from '../OrCheckboxGroup-e12e94c8.js';
@@ -95,7 +95,7 @@ export { s as OrRatingV3 } from '../OrRating-ec9462c5.js';
95
95
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from '../OrResizeablePanel-525d396f.js';
96
96
  export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditor-d9182fa2.js';
97
97
  export { s as OrSearch } from '../OrSearch-aa57d4e8.js';
98
- export { s as OrSearchV3 } from '../OrSearch-9c6f1e16.js';
98
+ export { s as OrSearchV3 } from '../OrSearch-fccacdba.js';
99
99
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-adbf7f4e.js';
100
100
  export { s as OrSelect } from '../OrSelect-a366e668.js';
101
101
  export { s as OrSelectV3 } from '../OrSelect-a65c0b08.js';
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../../OrCardCollection-ce6c8201.js';
1
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from '../../OrCardCollection-fc6fd56c.js';
2
2
  import 'vue-demi';
3
3
  import '../../OrIconButton-13fd3f96.js';
4
4
  import '../../OrIcon-b2e2d0aa.js';
@@ -19,11 +19,11 @@ import '../../OrBottomSheet-e33d1de9.js';
19
19
  import '../../OrOverlay-d00d79f1.js';
20
20
  import '../../OrTeleport.vue3-bf77eed4.js';
21
21
  import '../../useTheme-0ef25778.js';
22
- import '../../OrSearch-9c6f1e16.js';
23
- import '../../OrInput-2810a760.js';
22
+ import '../../OrSearch-fccacdba.js';
24
23
  import '../../useIdAttribute-859439f0.js';
25
24
  import '../../useProxyModelValue-940010d2.js';
26
25
  import '../../useValidationAttributes-d1abbe34.js';
26
+ import '../../OrInput-2810a760.js';
27
27
  import '../../OrError-69bd7f6a.js';
28
28
  import '../../OrHint-55d3de35.js';
29
29
  import '../../OrInputBox-8c1a29dd.js';
@@ -4,7 +4,6 @@ declare const _default: import("vue-demi").DefineComponent<{
4
4
  modelValue: {
5
5
  type: StringConstructor;
6
6
  default: string;
7
- required: false;
8
7
  };
9
8
  size: {
10
9
  type: PropType<"m" | "s">;
@@ -25,7 +24,6 @@ declare const _default: import("vue-demi").DefineComponent<{
25
24
  }, {
26
25
  root: import("vue-demi").Ref<any>;
27
26
  rootStyles: import("vue-demi").ComputedRef<string[]>;
28
- localModelValue: import("vue-demi").Ref<string>;
29
27
  controlAttributes: {
30
28
  required: boolean | undefined;
31
29
  minlength: number | undefined;
@@ -39,13 +37,15 @@ declare const _default: import("vue-demi").DefineComponent<{
39
37
  'force-state': string | undefined;
40
38
  id: string | undefined;
41
39
  };
40
+ proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string>;
41
+ draftModelValue: import("vue-demi").Ref<string>;
42
42
  focus: () => void;
43
+ blur: () => void;
43
44
  clear: () => void;
44
- }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("search" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear")[], "search" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
45
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("search" | "update:modelValue" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear")[], "search" | "update:modelValue" | "input" | "keydown" | "keyup" | "focus" | "blur" | "clear", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
45
46
  modelValue: {
46
47
  type: StringConstructor;
47
48
  default: string;
48
- required: false;
49
49
  };
50
50
  size: {
51
51
  type: PropType<"m" | "s">;
@@ -65,6 +65,7 @@ declare const _default: import("vue-demi").DefineComponent<{
65
65
  };
66
66
  }>> & {
67
67
  onSearch?: ((...args: any[]) => any) | undefined;
68
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
68
69
  onInput?: ((...args: any[]) => any) | undefined;
69
70
  onKeydown?: ((...args: any[]) => any) | undefined;
70
71
  onKeyup?: ((...args: any[]) => any) | undefined;
@@ -1,17 +1,17 @@
1
- export { s as OrSearchV3 } from '../../OrSearch-9c6f1e16.js';
1
+ export { s as OrSearchV3 } from '../../OrSearch-fccacdba.js';
2
2
  export { I as SearchSize } from '../../OrInputBox-8c1a29dd.js';
3
3
  import '@vueuse/core';
4
4
  import 'vue-demi';
5
- import '../../OrInput-2810a760.js';
6
5
  import '../../useIdAttribute-859439f0.js';
7
6
  import '../../dom-aecadd9a.js';
8
7
  import 'lodash/isElement';
9
8
  import 'lodash/get';
10
9
  import '../../useProxyModelValue-940010d2.js';
11
- import '../../useResponsive-1baf3485.js';
12
10
  import '@onereach/styles/tailwind/plugins/core';
13
11
  import '@onereach/styles/tailwind.config.json';
14
12
  import '../../useValidationAttributes-d1abbe34.js';
13
+ import '../../OrInput-2810a760.js';
14
+ import '../../useResponsive-1baf3485.js';
15
15
  import '../../OrError-69bd7f6a.js';
16
16
  import 'vue';
17
17
  import '../../OrHint-55d3de35.js';
@@ -8,7 +8,7 @@ export { s as OrButtonV2 } from './OrButton-f4098587.js';
8
8
  export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTTON_TYPE, I as ICON_BUTTON_TYPE, s as OrIconButton, s as OrIconButtonV2 } from './OrIconButton-4424a0dc.js';
9
9
  export { s as OrCard } from './OrCard-e3a5aea4.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from './OrCardCollection-7fd78cc8.js';
11
- export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-ce6c8201.js';
11
+ export { C as CardCollectionView, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-fc6fd56c.js';
12
12
  export { C as CardPadding, s as OrCardV3 } from './OrCard-d3320b27.js';
13
13
  export { s as OrCheckbox } from './OrCheckbox-42ed332c.js';
14
14
  export { s as OrCheckboxGroupV3 } from './OrCheckboxGroup-e12e94c8.js';
@@ -95,7 +95,7 @@ export { s as OrRatingV3 } from './OrRating-ec9462c5.js';
95
95
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanel-525d396f.js';
96
96
  export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditor-d9182fa2.js';
97
97
  export { s as OrSearch } from './OrSearch-aa57d4e8.js';
98
- export { s as OrSearchV3 } from './OrSearch-9c6f1e16.js';
98
+ export { s as OrSearchV3 } from './OrSearch-fccacdba.js';
99
99
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-adbf7f4e.js';
100
100
  export { s as OrSelect } from './OrSelect-a366e668.js';
101
101
  export { s as OrSelectV3 } from './OrSelect-a65c0b08.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "8.16.3",
3
+ "version": "8.16.4",
4
4
  "npmUnpacked": "4.15.2",
5
5
  "description": "Vue components library for v2/3",
6
6
  "sideEffects": false,
@@ -177,5 +177,5 @@
177
177
  },
178
178
  "./package.json": "./package.json"
179
179
  },
180
- "gitHead": "33df1b7f5022fb9b193ed8523f7a5c076492909a"
180
+ "gitHead": "7302352c135f6dcd05f25ecb3c646017ce025ad9"
181
181
  }
@@ -1,14 +1,13 @@
1
1
  <template>
2
2
  <OrInput
3
3
  ref="root"
4
- v-model.trim="localModelValue"
4
+ v-model.trim="draftModelValue"
5
+ v-bind="controlAttributes"
5
6
  :class="rootStyles"
6
7
  :type="'search'"
7
8
  :size="size"
8
9
  :placeholder="placeholder"
9
- :debounce="debounce"
10
10
  :disable-default-styles="disableDefaultStyles"
11
- v-bind="controlAttributes"
12
11
  @input="$emit('input', $event)"
13
12
  @keydown="$emit('keydown', $event)"
14
13
  @keyup="$emit('keyup', $event)"
@@ -18,11 +17,11 @@
18
17
  </template>
19
18
 
20
19
  <script lang="ts">
21
- import { debouncedWatch } from '@vueuse/core';
22
- import { computed, defineComponent, PropType, reactive, ref, watch } from 'vue-demi';
20
+ import { watchDebounced } from '@vueuse/core';
21
+ import { PropType, computed, defineComponent, reactive, ref, toRef, watch } from 'vue-demi';
22
+ import { useControlAttributes, useIdAttribute, useProxyModelValue, useValidationAttributes } from '../../hooks';
23
23
  import { OrInputV3 as OrInput } from '../or-input-v3';
24
24
  import { SearchSize } from './props';
25
- import { useControlAttributes, useIdAttribute, useValidationAttributes } from '../../hooks';
26
25
 
27
26
  export default defineComponent({
28
27
  name: 'OrSearch',
@@ -31,11 +30,15 @@ export default defineComponent({
31
30
  OrInput,
32
31
  },
33
32
 
33
+ model: {
34
+ prop: 'modelValue',
35
+ event: 'update:modelValue',
36
+ },
37
+
34
38
  props: {
35
39
  modelValue: {
36
40
  type: String,
37
41
  default: '',
38
- required: false,
39
42
  },
40
43
 
41
44
  size: {
@@ -60,18 +63,23 @@ export default defineComponent({
60
63
  },
61
64
 
62
65
  emits: [
63
- 'search',
66
+ 'update:modelValue',
67
+
64
68
  'input',
65
69
  'keydown',
66
70
  'keyup',
67
71
  'focus',
68
72
  'blur',
73
+
74
+ 'search',
69
75
  'clear',
70
76
  ],
71
77
 
72
78
  expose: [
73
79
  'root',
80
+
74
81
  'focus',
82
+ 'blur',
75
83
  'clear',
76
84
  ],
77
85
 
@@ -85,22 +93,33 @@ export default defineComponent({
85
93
  ]);
86
94
 
87
95
  // State
88
- const localModelValue = ref(props.modelValue ?? '');
89
96
  const controlAttributes = reactive({
90
97
  id: useIdAttribute(),
91
98
  ...useControlAttributes(),
92
99
  ...useValidationAttributes(),
93
100
  });
94
101
 
95
- // Events
96
- debouncedWatch(
97
- localModelValue,
98
- () => localModelValue.value.length > 0 && context.emit('search', localModelValue.value),
99
- { debounce: props.debounce },
100
- );
102
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
103
+ const draftModelValue = ref(props.modelValue);
104
+
105
+ watch(proxyModelValue, (value) => {
106
+ draftModelValue.value = value;
107
+ });
108
+
109
+ watchDebounced(draftModelValue, (value) => {
110
+ if (value.length > 0) {
111
+ proxyModelValue.value = value;
112
+
113
+ context.emit('search', value);
114
+ }
115
+ }, {
116
+ debounce: toRef(props, 'debounce'),
117
+ });
118
+
119
+ watch(draftModelValue, (nextValue, prevValue) => {
120
+ if (nextValue.length === 0 && prevValue.length > 0) {
121
+ proxyModelValue.value = nextValue;
101
122
 
102
- watch(localModelValue, (val, beforeVal) => {
103
- if (val.length === 0 && beforeVal.length > 0) {
104
123
  context.emit('search', '');
105
124
  context.emit('clear');
106
125
  }
@@ -111,16 +130,24 @@ export default defineComponent({
111
130
  (root.value as { focus: () => void; } | undefined)?.focus(); // fixes error TS2349
112
131
  }
113
132
 
133
+ function blur(): void {
134
+ (root.value as { blur: () => void; } | undefined)?.blur(); // fixes error TS2349
135
+ }
136
+
114
137
  function clear(): void {
115
- localModelValue.value = '';
138
+ draftModelValue.value = '';
116
139
  }
117
140
 
118
141
  return {
119
142
  root,
120
143
  rootStyles,
121
- localModelValue,
144
+
122
145
  controlAttributes,
146
+ proxyModelValue,
147
+ draftModelValue,
148
+
123
149
  focus,
150
+ blur,
124
151
  clear,
125
152
  };
126
153
  },
@@ -1,4 +1,4 @@
1
- import { ComputedRef, Ref, WritableComputedRef, computed } from 'vue-demi';
1
+ import { Ref, WritableComputedRef, computed } from 'vue-demi';
2
2
 
3
3
  export type UseProxyModelValueEmit<T> = (event: 'update:modelValue', value: T) => void;
4
4