@onereach/ui-components 4.1.0 → 4.1.1-beta.2532.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.
@@ -210,6 +210,8 @@ var script = defineComponent({
210
210
  } else {
211
211
  internalSearchOptions.value = await props.searchFunction(searchText, options);
212
212
  }
213
+ }, {
214
+ deep: true
213
215
  });
214
216
  const groupedOptions = computed(() => {
215
217
  const groupBy = props.groupByFunction;
@@ -180,6 +180,8 @@ var script = defineComponent({
180
180
  } else {
181
181
  internalSearchOptions.value = await props.searchFunction(searchText, options);
182
182
  }
183
+ }, {
184
+ deep: true
183
185
  });
184
186
  const groupedOptions = computed(() => {
185
187
  const groupBy = props.groupByFunction;
@@ -1,5 +1,5 @@
1
- import { s as script } from '../../OrSelect.vue_vue_type_script_lang-410f4efc.js';
2
- export { s as default } from '../../OrSelect.vue_vue_type_script_lang-410f4efc.js';
1
+ import { s as script } from '../../OrSelect.vue_vue_type_script_lang-f7601423.js';
2
+ export { s as default } from '../../OrSelect.vue_vue_type_script_lang-f7601423.js';
3
3
  import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, withDirectives, createElementVNode, Fragment, renderList, createVNode, withModifiers, vShow } from 'vue';
4
4
  import 'vue-demi';
5
5
  import './styles.js';
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from '../../OrSelect.vue_vue_type_script_lang-410f4efc.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect.vue_vue_type_script_lang-f7601423.js';
2
2
  export { InputBoxSize as SelectSize } from '../OrInputBoxV3/props.js';
3
3
  import 'vue-demi';
4
4
  import './styles.js';
@@ -104,7 +104,7 @@ export { s as OrSearchV3 } from '../OrSearch.vue_vue_type_script_lang-36ad17a9.j
104
104
  export { s as OrSegmentedControlV3 } from '../OrSegmentedControl.vue_vue_type_script_lang-d1b4694c.js';
105
105
  export { SegmentedControlSize } from './OrSegmentedControlV3/props.js';
106
106
  export { s as OrSelect } from '../OrSelect.vue_vue_type_script_lang-d2fecd97.js';
107
- export { s as OrSelectV3 } from '../OrSelect.vue_vue_type_script_lang-410f4efc.js';
107
+ export { s as OrSelectV3 } from '../OrSelect.vue_vue_type_script_lang-f7601423.js';
108
108
  export { s as OrSidebar } from '../OrSidebar.vue_vue_type_script_lang-00e9cda7.js';
109
109
  export { OrSidebarSide } from './OrSidebar/constants.js';
110
110
  export { s as OrSidebarV3 } from '../OrSidebar.vue_vue_type_script_lang-ed7c92fb.js';
@@ -71,7 +71,7 @@ export { s as OrSegmentedControlV3 } from './OrSegmentedControl.vue_vue_type_scr
71
71
  import './components/OrSelect/OrSelect.js';
72
72
  export { s as OrSelect } from './OrSelect.vue_vue_type_script_lang-d2fecd97.js';
73
73
  import './components/OrSelectV3/OrSelect.js';
74
- export { s as OrSelectV3 } from './OrSelect.vue_vue_type_script_lang-410f4efc.js';
74
+ export { s as OrSelectV3 } from './OrSelect.vue_vue_type_script_lang-f7601423.js';
75
75
  import './components/OrSidebar/OrSidebar.js';
76
76
  export { s as OrSidebar } from './OrSidebar.vue_vue_type_script_lang-00e9cda7.js';
77
77
  import './components/OrSidebarV3/OrSidebar.js';
@@ -211,6 +211,8 @@ var script = defineComponent({
211
211
  } else {
212
212
  internalSearchOptions.value = await props.searchFunction(searchText, options);
213
213
  }
214
+ }, {
215
+ deep: true
214
216
  });
215
217
  const groupedOptions = computed(() => {
216
218
  const groupBy = props.groupByFunction;
@@ -71,7 +71,7 @@ export { _ as OrSearch } from '../OrSearch-49ceaac4.js';
71
71
  export { _ as OrSearchV3 } from '../OrSearch-a3038272.js';
72
72
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-a1ea5b72.js';
73
73
  export { _ as OrSelect } from '../OrSelect-eb5cc918.js';
74
- export { _ as OrSelectV3 } from '../OrSelect-209a7a2c.js';
74
+ export { _ as OrSelectV3 } from '../OrSelect-40183874.js';
75
75
  export { _ as OrSidebar, O as OrSidebarSide } from '../OrSidebar-feacf13a.js';
76
76
  export { _ as OrSidebarV3 } from '../OrSidebar-26785a1e.js';
77
77
  export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-9c424133.js';
@@ -1,4 +1,4 @@
1
- export { _ as OrSelectV3 } from '../../OrSelect-209a7a2c.js';
1
+ export { _ as OrSelectV3 } from '../../OrSelect-40183874.js';
2
2
  export { a as SelectSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-23426690.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
@@ -71,7 +71,7 @@ export { _ as OrSearch } from './OrSearch-49ceaac4.js';
71
71
  export { _ as OrSearchV3 } from './OrSearch-a3038272.js';
72
72
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-a1ea5b72.js';
73
73
  export { _ as OrSelect } from './OrSelect-eb5cc918.js';
74
- export { _ as OrSelectV3 } from './OrSelect-209a7a2c.js';
74
+ export { _ as OrSelectV3 } from './OrSelect-40183874.js';
75
75
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-feacf13a.js';
76
76
  export { _ as OrSidebarV3 } from './OrSidebar-26785a1e.js';
77
77
  export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-9c424133.js';
@@ -210,6 +210,8 @@ var script = defineComponent({
210
210
  } else {
211
211
  internalSearchOptions.value = await props.searchFunction(searchText, options);
212
212
  }
213
+ }, {
214
+ deep: true
213
215
  });
214
216
  const groupedOptions = computed(() => {
215
217
  const groupBy = props.groupByFunction;
@@ -69,7 +69,7 @@ export { s as OrSearch } from '../OrSearch-fb2dd591.js';
69
69
  export { s as OrSearchV3 } from '../OrSearch-d5d46937.js';
70
70
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-4587c7a9.js';
71
71
  export { s as OrSelect } from '../OrSelect-3d923250.js';
72
- export { s as OrSelectV3 } from '../OrSelect-f2911b60.js';
72
+ export { s as OrSelectV3 } from '../OrSelect-5502d82d.js';
73
73
  export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-375c85a3.js';
74
74
  export { s as OrSidebarV3 } from '../OrSidebar-0d715029.js';
75
75
  export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-4d7497ec.js';
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from '../../OrSelect-f2911b60.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect-5502d82d.js';
2
2
  export { a as SelectSize } from '../../OrInputBox-11389afd.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
@@ -69,7 +69,7 @@ export { s as OrSearch } from './OrSearch-fb2dd591.js';
69
69
  export { s as OrSearchV3 } from './OrSearch-d5d46937.js';
70
70
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-4587c7a9.js';
71
71
  export { s as OrSelect } from './OrSelect-3d923250.js';
72
- export { s as OrSelectV3 } from './OrSelect-f2911b60.js';
72
+ export { s as OrSelectV3 } from './OrSelect-5502d82d.js';
73
73
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
74
74
  export { s as OrSidebarV3 } from './OrSidebar-0d715029.js';
75
75
  export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-4d7497ec.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "4.1.0",
3
+ "version": "4.1.1-beta.2532.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -152,6 +152,5 @@
152
152
  "default": "./dist/bundled/v3/components/*/index.js"
153
153
  },
154
154
  "./package.json": "./package.json"
155
- },
156
- "gitHead": "8fb5f7fb27288c734ecbdefc2892d99b3e3d8f57"
155
+ }
157
156
  }
@@ -1,7 +1,9 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { Meta, StoryFn } from '@storybook/vue3';
3
- import { ref, watch } from 'vue-demi';
3
+ import { ref, watch, onMounted } from 'vue-demi';
4
4
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
5
+ import { OrInputV3 as OrInput } from '../or-input-v3';
6
+ import { OrButtonV3 as OrButton } from '../or-button-v3';
5
7
  import OrSelectDocs from './OrSelect.docs.mdx';
6
8
  import OrSelect from './OrSelect.vue';
7
9
  import { SelectSize } from './props';
@@ -217,6 +219,113 @@ const Template: StoryFn<typeof OrSelect> = (args) => ({
217
219
  `,
218
220
  });
219
221
 
222
+ const AddTemplate: StoryFn<typeof OrSelect> = (args) => ({
223
+ components: {
224
+ OrIcon,
225
+ OrInput,
226
+ OrButton,
227
+ OrSelect,
228
+ },
229
+
230
+ setup() {
231
+ // State
232
+ const model = ref<string | string[]>();
233
+ const inputValue = ref<string>();
234
+ const options = ref<SelectOption[]>();
235
+ const searchOptions = ref<SelectOption[]>();
236
+
237
+ // Handlers
238
+ const onSearch = (searchText: string) => {
239
+ if (args.externalControl) {
240
+ searchOptions.value = searchText
241
+ ? (args.options as SelectOption[]).filter((option) => option.label === searchText)
242
+ : args.options;
243
+ }
244
+
245
+ action('search')(searchText);
246
+ };
247
+
248
+ const addModel = () => {
249
+ if (!inputValue.value || !options.value) return;
250
+
251
+ const newOption = {
252
+ value: inputValue.value.toLowerCase(),
253
+ label: inputValue.value,
254
+ } as SelectOption;
255
+
256
+ options.value.push(newOption);
257
+
258
+ if (args.multiple) {
259
+ (model.value as string[]).push(newOption.value as string);
260
+ } else {
261
+ model.value = newOption.value as string;
262
+ }
263
+
264
+ inputValue.value = undefined;
265
+ };
266
+
267
+ // Effects
268
+ watch(model, (value) => {
269
+ console.debug(value);
270
+ }, { deep: true });
271
+
272
+ // delayed setting of options case
273
+ onMounted(() => {
274
+ options.value = args.options;
275
+ searchOptions.value = args.options;
276
+ });
277
+
278
+ return {
279
+ args,
280
+ model,
281
+ inputValue,
282
+ options,
283
+ searchOptions,
284
+ onUpdate: action('update:modelValue'),
285
+ onFocus: action('focus'),
286
+ onBlur: action('blur'),
287
+ onSearch,
288
+ addModel,
289
+ };
290
+ },
291
+
292
+ template: `
293
+ <div class="flex flex-col gap-md">
294
+ <OrSelect
295
+ v-model="model"
296
+ v-bind="args"
297
+ :options="options"
298
+ :search-options="searchOptions"
299
+ @update:modelValue="onUpdate"
300
+ @focus="onFocus"
301
+ @blur="onBlur"
302
+ @search="onSearch"
303
+ >
304
+ <template #addon>
305
+ ${args.addon}
306
+ </template>
307
+
308
+ ${args.valueTemplate}
309
+ ${args.optionTemplate}
310
+ ${args.noSearchResultsTemplate}
311
+ </OrSelect>
312
+ <div class="flex flex-row gap-sm">
313
+ <OrInput
314
+ v-model="inputValue"
315
+ placeholder="Enter new option to add & select it"
316
+ class="grow"
317
+ />
318
+ <OrButton
319
+ variant="outlined"
320
+ @click="addModel"
321
+ >
322
+ Add
323
+ </OrButton>
324
+ </div>
325
+ </div>
326
+ `,
327
+ });
328
+
220
329
  export const Default = Template.bind({});
221
330
 
222
331
  Default.args = {
@@ -261,6 +370,12 @@ Default.args = {
261
370
  hint: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
262
371
  };
263
372
 
373
+ export const ExternalModelUpdateTemplate = AddTemplate.bind({});
374
+
375
+ ExternalModelUpdateTemplate.args = {
376
+ ...Default.args,
377
+ };
378
+
264
379
  export const CustomValueTemplate = Template.bind({});
265
380
 
266
381
  CustomValueTemplate.args = {
@@ -452,7 +452,7 @@ export default defineComponent({
452
452
  } else {
453
453
  internalSearchOptions.value = await props.searchFunction(searchText, options);
454
454
  }
455
- });
455
+ }, { deep: true });
456
456
 
457
457
  const groupedOptions = computed(() => {
458
458
  const groupBy = props.groupByFunction;