@onereach/ui-components 11.11.2-beta.4502.0 → 11.11.2-beta.4503.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/bundled/v2/{OrList-ec3bc502.js → OrList-a1877407.js} +71 -66
  2. package/dist/bundled/v2/components/OrListV3/OrList.js +1 -1
  3. package/dist/bundled/v2/components/OrListV3/OrList.vue.d.ts +13 -28
  4. package/dist/bundled/v2/components/OrListV3/index.js +1 -1
  5. package/dist/bundled/v2/components/OrListV3/styles.d.ts +0 -2
  6. package/dist/bundled/v2/components/OrListV3/styles.js +1 -3
  7. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +7 -3
  8. package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +2 -2
  9. package/dist/bundled/v2/components/index.js +1 -1
  10. package/dist/bundled/v2/index.js +1 -1
  11. package/dist/bundled/v3/components/OrListV3/OrList.js +1 -1
  12. package/dist/bundled/v3/components/OrListV3/OrList.vue.d.ts +9 -20
  13. package/dist/bundled/v3/components/OrListV3/index.js +1 -1
  14. package/dist/bundled/v3/components/OrListV3/styles.d.ts +0 -2
  15. package/dist/bundled/v3/components/OrListV3/styles.js +1 -1
  16. package/dist/bundled/v3/components/{OrListV3-fb0f71e8.js → OrListV3-08054afc.js} +67 -68
  17. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +1 -1
  18. package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +1 -1
  19. package/dist/bundled/v3/components/OrSelectV3/index.js +1 -1
  20. package/dist/bundled/v3/components/OrSelectV3/styles.js +1 -1
  21. package/dist/bundled/v3/components/{OrSelectV3-c408277b.js → OrSelectV3-2f570a8e.js} +7 -3
  22. package/dist/bundled/v3/components/index.js +2 -2
  23. package/dist/bundled/v3/index.js +2 -2
  24. package/dist/esm/v2/{OrList-3192132a.js → OrList-d372b256.js} +67 -66
  25. package/dist/esm/v2/{OrListItem-82ea1e2b.js → OrListItem-1b4b8db3.js} +5 -4
  26. package/dist/esm/v2/{OrSelect-b9c733f5.js → OrSelect-0a307d1f.js} +7 -3
  27. package/dist/esm/v2/components/index.js +3 -3
  28. package/dist/esm/v2/components/or-list-v3/OrList.vue.d.ts +13 -28
  29. package/dist/esm/v2/components/or-list-v3/index.js +3 -6
  30. package/dist/esm/v2/components/or-list-v3/partials/index.js +1 -1
  31. package/dist/esm/v2/components/or-list-v3/partials/or-list-item/OrListItem.vue.d.ts +8 -8
  32. package/dist/esm/v2/components/or-list-v3/styles.d.ts +0 -2
  33. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +2 -2
  34. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  35. package/dist/esm/v2/index.js +3 -3
  36. package/dist/esm/v3/{OrList-769c6101.js → OrList-7897e5c3.js} +63 -65
  37. package/dist/esm/v3/{OrListItem-12fa8abd.js → OrListItem-63389e98.js} +5 -4
  38. package/dist/esm/v3/{OrSelect-a88e236a.js → OrSelect-fa01e6e5.js} +7 -3
  39. package/dist/esm/v3/components/index.js +3 -3
  40. package/dist/esm/v3/components/or-list-v3/OrList.vue.d.ts +9 -20
  41. package/dist/esm/v3/components/or-list-v3/index.js +3 -5
  42. package/dist/esm/v3/components/or-list-v3/partials/index.js +1 -1
  43. package/dist/esm/v3/components/or-list-v3/partials/or-list-item/OrListItem.vue.d.ts +7 -7
  44. package/dist/esm/v3/components/or-list-v3/styles.d.ts +0 -2
  45. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +1 -1
  46. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  47. package/dist/esm/v3/index.js +3 -3
  48. package/package.json +1 -1
  49. package/src/components/or-list-v3/OrList.vue +90 -86
  50. package/src/components/or-list-v3/partials/or-list-item/OrListItem.vue +5 -5
  51. package/src/components/or-list-v3/styles.ts +0 -4
  52. package/src/components/or-select-v3/OrSelect.vue +8 -3
@@ -1,10 +1,8 @@
1
- import { openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, resolveComponent, createVNode, withCtx, createTextVNode, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, normalizeProps, guardReactiveProps } from 'vue';
1
+ import { openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, resolveComponent, normalizeProps, guardReactiveProps, createVNode, withCtx, createTextVNode, toDisplayString, Fragment, renderList, createBlock, createCommentVNode } from 'vue';
2
2
  import { S as Sortable, v as v4 } from './OrList-c04514ef.js';
3
3
  import { defineComponent, ref, computed, toRef, watch } from 'vue-demi';
4
- import { s as script$2 } from './OrButtonV3-0285739e.js';
5
- import { s as script$3 } from './OrIconV3-b5c97ea7.js';
6
- import { s as script$4 } from './OrIconButtonV3-94566a62.js';
7
- import { s as script$5 } from './OrLabelV3-2715e117.js';
4
+ import { s as script$2 } from './OrIconButtonV3-94566a62.js';
5
+ import { s as script$3 } from './OrLabelV3-2715e117.js';
8
6
  import { useProxyModelValue } from '../hooks/useProxyModelValue.js';
9
7
 
10
8
  const ListItem = [
@@ -29,22 +27,23 @@ const ListItemContent = [
29
27
  var script$1 = defineComponent({
30
28
  name: 'OrListItem',
31
29
  props: {
32
- draggable: {
30
+ selected: {
33
31
  type: Boolean,
34
32
  default: false
35
33
  },
36
- selected: {
34
+ disabled: {
37
35
  type: Boolean,
38
36
  default: false
39
37
  },
40
- disabled: {
38
+ draggable: {
41
39
  type: Boolean,
42
40
  default: false
43
41
  }
44
42
  },
45
43
  setup() {
46
- // Refs & Styles
44
+ // Refs
47
45
  const root = ref();
46
+ // Styles
48
47
  const rootStyles = computed(() => ['or-list-item-v3', ...ListItem]);
49
48
  const contentStyles = computed(() => [...ListItemContent]);
50
49
  return {
@@ -78,17 +77,13 @@ const List = [
78
77
  'layout-column',
79
78
  // Spacing
80
79
  'gap-md'];
81
- const ListHeader = [];
82
80
  const ListContent = [];
83
- const ListFooter = [];
84
81
 
85
82
  var script = defineComponent({
86
83
  name: 'OrList',
87
84
  components: {
88
- OrButton: script$2,
89
- OrIcon: script$3,
90
- OrIconButton: script$4,
91
- OrLabel: script$5,
85
+ OrIconButton: script$2,
86
+ OrLabel: script$3,
92
87
  OrListItem: script$1
93
88
  },
94
89
  model: {
@@ -112,9 +107,9 @@ var script = defineComponent({
112
107
  type: String,
113
108
  default: undefined
114
109
  },
115
- addButtonLabel: {
116
- type: String,
117
- default: 'Add Item'
110
+ disabled: {
111
+ type: Boolean,
112
+ default: false
118
113
  },
119
114
  canAdd: {
120
115
  type: Boolean,
@@ -127,24 +122,19 @@ var script = defineComponent({
127
122
  canReorder: {
128
123
  type: Boolean,
129
124
  default: true
130
- },
131
- disabled: {
132
- type: Boolean,
133
- default: false
134
125
  }
135
126
  },
136
127
  emits: ['update:modelValue', 'before:add', 'before:delete', 'before:reorder', 'add', 'delete', 'reorder'],
137
128
  expose: ['root'],
138
129
  setup(props, context) {
139
- // Refs & Styles
130
+ // Refs
140
131
  const root = ref();
141
- const rootStyles = computed(() => ['or-list-v3', ...List]);
142
- const headerStyles = computed(() => [...ListHeader]);
143
132
  const content = ref();
133
+ // Styles
134
+ const rootStyles = computed(() => ['or-list-v3', ...List]);
144
135
  const contentStyles = computed(() => [...ListContent]);
145
- const footerStyles = computed(() => [...ListFooter]);
146
136
  // State
147
- const model = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
137
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
148
138
  // Effects
149
139
  // #region Sortable
150
140
  let sortable;
@@ -156,11 +146,11 @@ var script = defineComponent({
156
146
  sortable = Sortable.create(content, {
157
147
  disabled: props.disabled,
158
148
  onUpdate: event => {
159
- context.emit('before:reorder', model.value);
160
- const nextModelValue = [...model.value];
149
+ context.emit('before:reorder', proxyModelValue.value);
150
+ const nextModelValue = [...proxyModelValue.value];
161
151
  const reorderedItem = nextModelValue.splice(event.oldIndex, 1)[0];
162
152
  nextModelValue.splice(event.newIndex, 0, reorderedItem);
163
- context.emit('reorder', reorderedItem, event.newIndex, event.oldIndex, model.value = nextModelValue);
153
+ context.emit('reorder', reorderedItem, event.newIndex, event.oldIndex, proxyModelValue.value = nextModelValue);
164
154
  }
165
155
  });
166
156
  }
@@ -171,27 +161,50 @@ var script = defineComponent({
171
161
  // #endregion
172
162
  // Methods
173
163
  function addItem() {
174
- context.emit('before:add', model.value);
164
+ context.emit('before:add', proxyModelValue.value);
175
165
  const addedItem = props.itemFactory();
176
- const nextModelValue = [...model.value, addedItem];
177
- context.emit('add', addedItem, nextModelValue.indexOf(addedItem), model.value = nextModelValue);
166
+ const nextModelValue = [...proxyModelValue.value, addedItem];
167
+ context.emit('add', addedItem, nextModelValue.indexOf(addedItem), proxyModelValue.value = nextModelValue);
178
168
  }
179
169
  function deleteItem(index) {
180
- context.emit('before:delete', model.value);
181
- const deletedItem = model.value[index];
182
- const nextModelValue = model.value.filter(item => item !== deletedItem);
183
- context.emit('delete', deletedItem, index, model.value = nextModelValue);
170
+ context.emit('before:delete', proxyModelValue.value);
171
+ const deletedItem = proxyModelValue.value[index];
172
+ const nextModelValue = proxyModelValue.value.filter(item => item !== deletedItem);
173
+ context.emit('delete', deletedItem, index, proxyModelValue.value = nextModelValue);
184
174
  }
175
+ // Handlers
176
+ // function onDragStart(event: DragEvent): void {
177
+ // console.log('dragstart', event);
178
+ // }
179
+ // function onDragEnter(event: DragEvent): void {
180
+ // console.log('dragenter', event);
181
+ // }
182
+ // function onDragOver(event: DragEvent): void {
183
+ // console.log('dragover', event);
184
+ // }
185
+ // function onDragLeave(event: DragEvent): void {
186
+ // console.log('dragleave', event);
187
+ // }
188
+ // function onDragEnd(event: DragEvent): void {
189
+ // console.log('dragend', event);
190
+ // }
191
+ // function onDrop(event: DragEvent): void {
192
+ // console.log('drop', event);
193
+ // }
185
194
  return {
186
195
  root,
187
- rootStyles,
188
- headerStyles,
189
196
  content,
197
+ rootStyles,
190
198
  contentStyles,
191
- footerStyles,
192
- model,
199
+ proxyModelValue,
193
200
  addItem,
194
201
  deleteItem,
202
+ // onDragStart,
203
+ // onDragEnter,
204
+ // onDragOver,
205
+ // onDragLeave,
206
+ // onDragEnd,
207
+ // onDrop,
195
208
  uuid: v4
196
209
  };
197
210
  }
@@ -205,39 +218,34 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
205
218
  const _component_OrLabel = resolveComponent("OrLabel");
206
219
  const _component_OrIconButton = resolveComponent("OrIconButton");
207
220
  const _component_OrListItem = resolveComponent("OrListItem");
208
- const _component_OrIcon = resolveComponent("OrIcon");
209
- const _component_OrButton = resolveComponent("OrButton");
210
221
  return openBlock(), createElementBlock("div", {
211
222
  ref: 'root',
212
223
  class: normalizeClass(_ctx.rootStyles),
213
224
  disabled: _ctx.disabled
214
- }, [_ctx.$slots['header'] || _ctx.$slots['label'] || _ctx.$slots['label-addon'] || _ctx.label ? (openBlock(), createElementBlock("div", {
215
- key: 0,
216
- class: normalizeClass(_ctx.headerStyles)
217
- }, [renderSlot(_ctx.$slots, "header", {
225
+ }, [renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps({
218
226
  addItem: _ctx.addItem,
219
227
  deleteItem: _ctx.deleteItem
220
- }, () => [createVNode(_component_OrLabel, {
228
+ })), () => [createVNode(_component_OrLabel, {
221
229
  disabled: _ctx.disabled
222
230
  }, {
223
231
  addon: withCtx(() => [renderSlot(_ctx.$slots, "label-addon")]),
224
232
  default: withCtx(() => [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(_ctx.label), 1 /* TEXT */)])]),
225
233
 
226
234
  _: 3 /* FORWARDED */
227
- }, 8 /* PROPS */, ["disabled"])])], 2 /* CLASS */)) : createCommentVNode("v-if", true), createElementVNode("div", {
235
+ }, 8 /* PROPS */, ["disabled"])]), createElementVNode("div", {
228
236
  ref: 'content',
229
237
  class: normalizeClass(_ctx.contentStyles)
230
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, (item, index) => {
238
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.proxyModelValue, (item, index) => {
231
239
  return openBlock(), createBlock(_component_OrListItem, {
232
240
  key: item.key || _ctx.uuid(),
233
- draggable: _ctx.canReorder,
234
241
  selected: _ctx.selection.includes(item),
235
- disabled: _ctx.disabled
242
+ disabled: _ctx.disabled,
243
+ draggable: _ctx.canReorder
236
244
  }, {
237
245
  default: withCtx(() => [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
238
246
  item,
239
247
  index,
240
- items: _ctx.model,
248
+ items: _ctx.proxyModelValue,
241
249
  addItem: _ctx.addItem,
242
250
  deleteItem: _ctx.deleteItem
243
251
  })), () => [createTextVNode(toDisplayString(item), 1 /* TEXT */)])]), _ctx.canDelete ? (openBlock(), createBlock(_component_OrIconButton, {
@@ -247,28 +255,19 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
247
255
  onClick: $event => _ctx.deleteItem(index)
248
256
  }, null, 8 /* PROPS */, ["disabled", "onClick"])) : createCommentVNode("v-if", true)]),
249
257
  _: 2 /* DYNAMIC */
250
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["draggable", "selected", "disabled"]);
251
- }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */), _ctx.$slots['footer'] || _ctx.canAdd ? (openBlock(), createElementBlock("div", {
252
- key: 1,
253
- class: normalizeClass(_ctx.footerStyles)
254
- }, [renderSlot(_ctx.$slots, "footer", {
258
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["selected", "disabled", "draggable"]);
259
+ }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */), renderSlot(_ctx.$slots, "footer", normalizeProps(guardReactiveProps({
255
260
  addItem: _ctx.addItem,
256
261
  deleteItem: _ctx.deleteItem
257
- }, () => [_ctx.canAdd ? (openBlock(), createBlock(_component_OrButton, {
262
+ })), () => [_ctx.canAdd ? (openBlock(), createBlock(_component_OrIconButton, {
258
263
  key: 0,
259
- variant: 'link',
264
+ icon: 'add',
260
265
  disabled: _ctx.disabled,
261
266
  onClick: _cache[0] || (_cache[0] = $event => _ctx.addItem())
262
- }, {
263
- default: withCtx(() => [renderSlot(_ctx.$slots, "add-button", {}, () => [createVNode(_component_OrIcon, {
264
- icon: 'add'
265
- }), createTextVNode(" " + toDisplayString(_ctx.addButtonLabel), 1 /* TEXT */)])]),
266
-
267
- _: 3 /* FORWARDED */
268
- }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)])], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 10 /* CLASS, PROPS */, _hoisted_1);
267
+ }, null, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)])], 10 /* CLASS, PROPS */, _hoisted_1);
269
268
  }
270
269
 
271
270
  script.render = render;
272
271
  script.__file = "src/components/or-list-v3/OrList.vue";
273
272
 
274
- export { List as L, script$1 as a, ListHeader as b, ListContent as c, ListFooter as d, script as s };
273
+ export { List as L, script$1 as a, ListContent as b, script as s };
@@ -1 +1 @@
1
- export { s as default } from '../OrSelectV3-c408277b.js';
1
+ export { s as default } from '../OrSelectV3-2f570a8e.js';
@@ -114,7 +114,7 @@ declare const _default: import("vue-demi").DefineComponent<{
114
114
  close: () => void;
115
115
  open: () => void;
116
116
  selectOption: (item: SelectItem) => void;
117
- deselectOption: (item: SelectItem) => void;
117
+ deselectOption: (value: SelectItem['value']) => void;
118
118
  toggleOption: (item: SelectItem) => void;
119
119
  isDesktop: import("vue-demi").ComputedRef<boolean>;
120
120
  isMobile: import("vue-demi").ComputedRef<boolean>;
@@ -1 +1 @@
1
- export { s as OrSelectV3 } from '../OrSelectV3-c408277b.js';
1
+ export { s as OrSelectV3 } from '../OrSelectV3-2f570a8e.js';
@@ -1 +1 @@
1
- export { S as Select, a as SelectControl, c as SelectDropdown, d as SelectDropdownDefault, e as SelectDropdownFlipped, f as SelectDropdownItem, g as SelectNoSearchResults, b as SelectSearchControl } from '../OrSelectV3-c408277b.js';
1
+ export { S as Select, a as SelectControl, c as SelectDropdown, d as SelectDropdownDefault, e as SelectDropdownFlipped, f as SelectDropdownItem, g as SelectNoSearchResults, b as SelectSearchControl } from '../OrSelectV3-2f570a8e.js';
@@ -746,9 +746,9 @@ var script = defineComponent({
746
746
  proxyModelValue.value = item.value;
747
747
  }
748
748
  }
749
- function deselectOption(item) {
749
+ function deselectOption(value) {
750
750
  if (props.multiple) {
751
- proxyModelValue.value = exclude(item.value, toArray(proxyModelValue.value));
751
+ proxyModelValue.value = exclude(value, toArray(proxyModelValue.value));
752
752
  } else {
753
753
  proxyModelValue.value = undefined;
754
754
  }
@@ -762,7 +762,11 @@ var script = defineComponent({
762
762
  proxyModelValue.value = exclude(item.value, model);
763
763
  }
764
764
  } else {
765
- proxyModelValue.value = proxyModelValue.value !== item.value ? item.value : undefined;
765
+ if (props.enableClear) {
766
+ proxyModelValue.value = proxyModelValue.value !== item.value ? item.value : undefined;
767
+ } else {
768
+ proxyModelValue.value = item.value;
769
+ }
766
770
  }
767
771
  searchText.value = '';
768
772
  }
@@ -59,7 +59,7 @@ export { L as LabelVariant, s as OrLabelV3 } from './OrLabelV3-2715e117.js';
59
59
  export { L as LinkColor, s as OrLinkV3 } from './OrLinkV3-56763fd9.js';
60
60
  export { s as OrList } from './OrList-c04514ef.js';
61
61
  export { default as OrListOfInputs } from './OrListOfInputs/OrListOfInputs.js';
62
- export { a as OrListItem, s as OrListV3 } from './OrListV3-fb0f71e8.js';
62
+ export { a as OrListItem, s as OrListV3 } from './OrListV3-08054afc.js';
63
63
  export { LoaderViews, OrLoader } from './OrLoader/index.js';
64
64
  export { a as LoaderColor, b as LoaderSize, L as LoaderVariant, s as OrLoaderV3 } from './OrLoaderV3-663cf3d7.js';
65
65
  export { s as OrMenuItemV3 } from './OrMenuItemV3-48d18ff8.js';
@@ -90,7 +90,7 @@ export { default as OrSearch } from './OrSearch/OrSearch.js';
90
90
  export { default as OrSearchV3 } from './OrSearchV3/OrSearch.js';
91
91
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControlV3-bedef411.js';
92
92
  export { s as OrSelect } from './OrSelect-d16a10d5.js';
93
- export { s as OrSelectV3 } from './OrSelectV3-c408277b.js';
93
+ export { s as OrSelectV3 } from './OrSelectV3-2f570a8e.js';
94
94
  export { OrSidebar, OrSidebarSide } from './OrSidebar/index.js';
95
95
  export { s as OrSidebarV3, S as SidebarPlacement } from './OrSidebarV3-363eebc1.js';
96
96
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeleton-c077c8d4.js';
@@ -34,7 +34,7 @@ export { InlineTextEditTrimmingTypes, InlineTextEditTypes, OrInlineTextEdit } fr
34
34
  export { s as OrInlineTextareaV3 } from './components/OrInlineTextareaV3-6b1f70a5.js';
35
35
  export { L as LinkColor, s as OrLinkV3 } from './components/OrLinkV3-56763fd9.js';
36
36
  export { default as OrListOfInputs } from './components/OrListOfInputs/OrListOfInputs.js';
37
- export { a as OrListItem, s as OrListV3 } from './components/OrListV3-fb0f71e8.js';
37
+ export { a as OrListItem, s as OrListV3 } from './components/OrListV3-08054afc.js';
38
38
  export { OR_NOTIFICATION_SIZE, OR_NOTIFICATION_TYPE, OrNotification } from './components/OrNotification/index.js';
39
39
  export { N as NotificationVariant, s as OrNotificationV3 } from './components/OrNotificationV3-f1e015b5.js';
40
40
  export { default as OrNumberInput } from './components/OrNumberInput/OrNumberInput.js';
@@ -50,7 +50,7 @@ export { F as Formats, s as OrRichTextEditorV3 } from './components/OrRichTextEd
50
50
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './components/OrRichTooltipV3-d4d16bda.js';
51
51
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './components/OrSegmentedControlV3-bedef411.js';
52
52
  export { s as OrSelect } from './components/OrSelect-d16a10d5.js';
53
- export { s as OrSelectV3 } from './components/OrSelectV3-c408277b.js';
53
+ export { s as OrSelectV3 } from './components/OrSelectV3-2f570a8e.js';
54
54
  export { OrSidebar, OrSidebarSide } from './components/OrSidebar/index.js';
55
55
  export { s as OrSidebarV3, S as SidebarPlacement } from './components/OrSidebarV3-363eebc1.js';
56
56
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './components/OrSkeleton-c077c8d4.js';
@@ -7,12 +7,9 @@ import '@vueuse/core';
7
7
  import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
8
8
  import '@onereach/styles/screens.json';
9
9
  import '@onereach/styles/tailwind.config.json';
10
- import { _ as __vue_component__$1 } from './OrButton-3a743a90.js';
11
- import './OrButton.vue_rollup-plugin-vue_script-e8900483.js';
12
- import { _ as __vue_component__$3 } from './OrIconButton-234b9ac1.js';
13
- import { _ as __vue_component__$2 } from './OrIcon-0a14dafc.js';
14
- import { _ as __vue_component__$4 } from './OrLabel-bf7e2ea2.js';
15
- import { _ as __vue_component__$5 } from './OrListItem-82ea1e2b.js';
10
+ import { _ as __vue_component__$1 } from './OrIconButton-234b9ac1.js';
11
+ import { _ as __vue_component__$2 } from './OrLabel-bf7e2ea2.js';
12
+ import { _ as __vue_component__$3 } from './OrListItem-1b4b8db3.js';
16
13
  import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
17
14
 
18
15
  const List = [
@@ -20,18 +17,14 @@ const List = [
20
17
  'layout-column',
21
18
  // Spacing
22
19
  'gap-md'];
23
- const ListHeader = [];
24
20
  const ListContent = [];
25
- const ListFooter = [];
26
21
 
27
22
  var script = defineComponent({
28
23
  name: 'OrList',
29
24
  components: {
30
- OrButton: __vue_component__$1,
31
- OrIcon: __vue_component__$2,
32
- OrIconButton: __vue_component__$3,
33
- OrLabel: __vue_component__$4,
34
- OrListItem: __vue_component__$5
25
+ OrIconButton: __vue_component__$1,
26
+ OrLabel: __vue_component__$2,
27
+ OrListItem: __vue_component__$3
35
28
  },
36
29
  model: {
37
30
  prop: 'modelValue',
@@ -54,9 +47,9 @@ var script = defineComponent({
54
47
  type: String,
55
48
  default: undefined
56
49
  },
57
- addButtonLabel: {
58
- type: String,
59
- default: 'Add Item'
50
+ disabled: {
51
+ type: Boolean,
52
+ default: false
60
53
  },
61
54
  canAdd: {
62
55
  type: Boolean,
@@ -69,24 +62,19 @@ var script = defineComponent({
69
62
  canReorder: {
70
63
  type: Boolean,
71
64
  default: true
72
- },
73
- disabled: {
74
- type: Boolean,
75
- default: false
76
65
  }
77
66
  },
78
67
  emits: ['update:modelValue', 'before:add', 'before:delete', 'before:reorder', 'add', 'delete', 'reorder'],
79
68
  expose: ['root'],
80
69
  setup(props, context) {
81
- // Refs & Styles
70
+ // Refs
82
71
  const root = ref();
83
- const rootStyles = computed(() => ['or-list-v3', ...List]);
84
- const headerStyles = computed(() => [...ListHeader]);
85
72
  const content = ref();
73
+ // Styles
74
+ const rootStyles = computed(() => ['or-list-v3', ...List]);
86
75
  const contentStyles = computed(() => [...ListContent]);
87
- const footerStyles = computed(() => [...ListFooter]);
88
76
  // State
89
- const model = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
77
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
90
78
  // Effects
91
79
  // #region Sortable
92
80
  let sortable;
@@ -98,11 +86,11 @@ var script = defineComponent({
98
86
  sortable = Sortable.create(content, {
99
87
  disabled: props.disabled,
100
88
  onUpdate: event => {
101
- context.emit('before:reorder', model.value);
102
- const nextModelValue = [...model.value];
89
+ context.emit('before:reorder', proxyModelValue.value);
90
+ const nextModelValue = [...proxyModelValue.value];
103
91
  const reorderedItem = nextModelValue.splice(event.oldIndex, 1)[0];
104
92
  nextModelValue.splice(event.newIndex, 0, reorderedItem);
105
- context.emit('reorder', reorderedItem, event.newIndex, event.oldIndex, model.value = nextModelValue);
93
+ context.emit('reorder', reorderedItem, event.newIndex, event.oldIndex, proxyModelValue.value = nextModelValue);
106
94
  }
107
95
  });
108
96
  }
@@ -113,27 +101,50 @@ var script = defineComponent({
113
101
  // #endregion
114
102
  // Methods
115
103
  function addItem() {
116
- context.emit('before:add', model.value);
104
+ context.emit('before:add', proxyModelValue.value);
117
105
  const addedItem = props.itemFactory();
118
- const nextModelValue = [...model.value, addedItem];
119
- context.emit('add', addedItem, nextModelValue.indexOf(addedItem), model.value = nextModelValue);
106
+ const nextModelValue = [...proxyModelValue.value, addedItem];
107
+ context.emit('add', addedItem, nextModelValue.indexOf(addedItem), proxyModelValue.value = nextModelValue);
120
108
  }
121
109
  function deleteItem(index) {
122
- context.emit('before:delete', model.value);
123
- const deletedItem = model.value[index];
124
- const nextModelValue = model.value.filter(item => item !== deletedItem);
125
- context.emit('delete', deletedItem, index, model.value = nextModelValue);
110
+ context.emit('before:delete', proxyModelValue.value);
111
+ const deletedItem = proxyModelValue.value[index];
112
+ const nextModelValue = proxyModelValue.value.filter(item => item !== deletedItem);
113
+ context.emit('delete', deletedItem, index, proxyModelValue.value = nextModelValue);
126
114
  }
115
+ // Handlers
116
+ // function onDragStart(event: DragEvent): void {
117
+ // console.log('dragstart', event);
118
+ // }
119
+ // function onDragEnter(event: DragEvent): void {
120
+ // console.log('dragenter', event);
121
+ // }
122
+ // function onDragOver(event: DragEvent): void {
123
+ // console.log('dragover', event);
124
+ // }
125
+ // function onDragLeave(event: DragEvent): void {
126
+ // console.log('dragleave', event);
127
+ // }
128
+ // function onDragEnd(event: DragEvent): void {
129
+ // console.log('dragend', event);
130
+ // }
131
+ // function onDrop(event: DragEvent): void {
132
+ // console.log('drop', event);
133
+ // }
127
134
  return {
128
135
  root,
129
- rootStyles,
130
- headerStyles,
131
136
  content,
137
+ rootStyles,
132
138
  contentStyles,
133
- footerStyles,
134
- model,
139
+ proxyModelValue,
135
140
  addItem,
136
141
  deleteItem,
142
+ // onDragStart,
143
+ // onDragEnter,
144
+ // onDragOver,
145
+ // onDragLeave,
146
+ // onDragEnd,
147
+ // onDrop,
137
148
  uuid: v4
138
149
  };
139
150
  }
@@ -153,8 +164,6 @@ var __vue_render__ = function () {
153
164
  attrs: {
154
165
  "disabled": _vm.disabled
155
166
  }
156
- }, [_vm.$slots['header'] || _vm.$slots['label'] || _vm.$slots['label-addon'] || _vm.label ? [_c('div', {
157
- class: _vm.headerStyles
158
167
  }, [_vm._t("header", function () {
159
168
  return [_c('OrLabel', {
160
169
  attrs: {
@@ -168,21 +177,21 @@ var __vue_render__ = function () {
168
177
  proxy: true
169
178
  }], null, true)
170
179
  }, [_vm._t("label", function () {
171
- return [_vm._v("\n " + _vm._s(_vm.label) + "\n ")];
180
+ return [_vm._v("\n " + _vm._s(_vm.label) + "\n ")];
172
181
  })], 2)];
173
- }, {
174
- "addItem": _vm.addItem,
175
- "deleteItem": _vm.deleteItem
176
- })], 2)] : _vm._e(), _vm._v(" "), _c('div', {
182
+ }, null, {
183
+ addItem: _vm.addItem,
184
+ deleteItem: _vm.deleteItem
185
+ }), _vm._v(" "), _c('div', {
177
186
  ref: 'content',
178
187
  class: _vm.contentStyles
179
- }, _vm._l(_vm.model, function (item, index) {
188
+ }, _vm._l(_vm.proxyModelValue, function (item, index) {
180
189
  return _c('OrListItem', {
181
190
  key: item.key || _vm.uuid(),
182
191
  attrs: {
183
- "draggable": _vm.canReorder,
184
192
  "selected": _vm.selection.includes(item),
185
- "disabled": _vm.disabled
193
+ "disabled": _vm.disabled,
194
+ "draggable": _vm.canReorder
186
195
  }
187
196
  }, [_c('div', {
188
197
  class: ['grow']
@@ -191,7 +200,7 @@ var __vue_render__ = function () {
191
200
  }, null, {
192
201
  item: item,
193
202
  index: index,
194
- items: _vm.model,
203
+ items: _vm.proxyModelValue,
195
204
  addItem: _vm.addItem,
196
205
  deleteItem: _vm.deleteItem
197
206
  })], 2), _vm._v(" "), _vm.canDelete ? [_c('OrIconButton', {
@@ -205,12 +214,10 @@ var __vue_render__ = function () {
205
214
  }
206
215
  }
207
216
  })] : _vm._e()], 2);
208
- }), 1), _vm._v(" "), _vm.$slots['footer'] || _vm.canAdd ? [_c('div', {
209
- class: _vm.footerStyles
210
- }, [_vm._t("footer", function () {
211
- return [_vm.canAdd ? [_c('OrButton', {
217
+ }), 1), _vm._v(" "), _vm._t("footer", function () {
218
+ return [_vm.canAdd ? [_c('OrIconButton', {
212
219
  attrs: {
213
- "variant": 'link',
220
+ "icon": 'add',
214
221
  "disabled": _vm.disabled
215
222
  },
216
223
  on: {
@@ -218,17 +225,11 @@ var __vue_render__ = function () {
218
225
  return _vm.addItem();
219
226
  }
220
227
  }
221
- }, [_vm._t("add-button", function () {
222
- return [_c('OrIcon', {
223
- attrs: {
224
- "icon": 'add'
225
- }
226
- }), _vm._v(" " + _vm._s(_vm.addButtonLabel) + "\n ")];
227
- })], 2)] : _vm._e()];
228
- }, {
229
- "addItem": _vm.addItem,
230
- "deleteItem": _vm.deleteItem
231
- })], 2)] : _vm._e()], 2);
228
+ })] : _vm._e()];
229
+ }, null, {
230
+ addItem: _vm.addItem,
231
+ deleteItem: _vm.deleteItem
232
+ })], 2);
232
233
  };
233
234
  var __vue_staticRenderFns__ = [];
234
235
 
@@ -23,22 +23,23 @@ const ListItemContent = [
23
23
  var script = defineComponent({
24
24
  name: 'OrListItem',
25
25
  props: {
26
- draggable: {
26
+ selected: {
27
27
  type: Boolean,
28
28
  default: false
29
29
  },
30
- selected: {
30
+ disabled: {
31
31
  type: Boolean,
32
32
  default: false
33
33
  },
34
- disabled: {
34
+ draggable: {
35
35
  type: Boolean,
36
36
  default: false
37
37
  }
38
38
  },
39
39
  setup() {
40
- // Refs & Styles
40
+ // Refs
41
41
  const root = ref();
42
+ // Styles
42
43
  const rootStyles = computed(() => ['or-list-item-v3', ...ListItem]);
43
44
  const contentStyles = computed(() => [...ListItemContent]);
44
45
  return {
@@ -322,9 +322,9 @@ var script = defineComponent({
322
322
  proxyModelValue.value = item.value;
323
323
  }
324
324
  }
325
- function deselectOption(item) {
325
+ function deselectOption(value) {
326
326
  if (props.multiple) {
327
- proxyModelValue.value = exclude(item.value, toArray(proxyModelValue.value));
327
+ proxyModelValue.value = exclude(value, toArray(proxyModelValue.value));
328
328
  } else {
329
329
  proxyModelValue.value = undefined;
330
330
  }
@@ -338,7 +338,11 @@ var script = defineComponent({
338
338
  proxyModelValue.value = exclude(item.value, model);
339
339
  }
340
340
  } else {
341
- proxyModelValue.value = proxyModelValue.value !== item.value ? item.value : undefined;
341
+ if (props.enableClear) {
342
+ proxyModelValue.value = proxyModelValue.value !== item.value ? item.value : undefined;
343
+ } else {
344
+ proxyModelValue.value = item.value;
345
+ }
342
346
  }
343
347
  searchText.value = '';
344
348
  }