@onereach/ui-components 2.69.1-beta.2099.0 → 2.69.1-beta.2101.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 (85) hide show
  1. package/dist/bundled/v2/{OrAvatar-2fa559e1.js → OrAvatar-1ada4581.js} +7 -1
  2. package/dist/bundled/v2/{OrCard-29116e1f.js → OrCard-58a1ba3e.js} +2 -2
  3. package/dist/bundled/v2/OrCardCollection-a9a779ea.js +228 -0
  4. package/dist/bundled/v2/{OrSearch-a11b3621.js → OrSearch-9d402f56.js} +3 -9
  5. package/dist/bundled/v2/{OrSortHeader-9932d28f.js → OrSortHeader-396e6a7c.js} +2 -2
  6. package/dist/bundled/v2/components/index.js +5 -5
  7. package/dist/bundled/v2/components/or-avatar-v3/index.js +1 -1
  8. package/dist/bundled/v2/components/or-avatar-v3/props.d.ts +2 -1
  9. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
  10. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
  11. package/dist/bundled/v2/components/or-card-collection-v3/index.js +4 -7
  12. package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +3 -8
  13. package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
  14. package/dist/bundled/v2/components/or-search-v3/OrSearch.vue.d.ts +0 -13
  15. package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
  16. package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
  17. package/dist/bundled/v2/index.js +6 -6
  18. package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-22e46ce1.js → OrAvatar.vue_vue_type_script_lang-a0a72134.js} +7 -1
  19. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +164 -0
  20. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-85472b12.js → OrConfirm.vue_vue_type_script_lang-289b5600.js} +36 -6
  21. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-0ae8a6dd.js → OrSearch.vue_vue_type_script_lang-ed78b21f.js} +2 -8
  22. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-61b79a5a.js → OrTabs.vue_vue_type_script_lang-919b2021.js} +36 -10
  23. package/dist/bundled/v3/components/index.js +8 -10
  24. package/dist/bundled/v3/components/or-avatar-v3/index.js +1 -1
  25. package/dist/bundled/v3/components/or-avatar-v3/props.d.ts +2 -1
  26. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
  27. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
  28. package/dist/bundled/v3/components/or-card-collection-v3/index.js +4 -11
  29. package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +3 -8
  30. package/dist/bundled/v3/components/or-confirm-v3/index.js +1 -2
  31. package/dist/bundled/v3/components/or-search-v3/OrSearch.vue.d.ts +0 -13
  32. package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
  33. package/dist/bundled/v3/components/or-tabs-v3/index.js +1 -2
  34. package/dist/bundled/v3/index.js +298 -329
  35. package/dist/esm/v2/{OrAvatar-0afdef36.js → OrAvatar-95b029b4.js} +7 -1
  36. package/dist/esm/v2/OrCardCollection-4f001551.js +227 -0
  37. package/dist/esm/v2/{OrSearch-62d91301.js → OrSearch-ddb7c1fe.js} +1 -7
  38. package/dist/esm/v2/components/index.js +3 -3
  39. package/dist/esm/v2/components/or-avatar-v3/index.js +1 -1
  40. package/dist/esm/v2/components/or-avatar-v3/props.d.ts +2 -1
  41. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
  42. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
  43. package/dist/esm/v2/components/or-card-collection-v3/index.js +4 -7
  44. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +3 -8
  45. package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +0 -13
  46. package/dist/esm/v2/components/or-search-v3/index.js +1 -1
  47. package/dist/esm/v2/index.js +3 -3
  48. package/dist/esm/v3/{OrAvatar-ef88d31c.js → OrAvatar-9ed782da.js} +7 -1
  49. package/dist/esm/v3/OrCardCollection-5a0febaf.js +198 -0
  50. package/dist/esm/v3/{OrSearch-aafb93b4.js → OrSearch-cdde55ce.js} +1 -7
  51. package/dist/esm/v3/components/index.js +3 -3
  52. package/dist/esm/v3/components/or-avatar-v3/index.js +1 -1
  53. package/dist/esm/v3/components/or-avatar-v3/props.d.ts +2 -1
  54. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -5
  55. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +39 -65
  56. package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -7
  57. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +3 -8
  58. package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +0 -13
  59. package/dist/esm/v3/components/or-search-v3/index.js +1 -1
  60. package/dist/esm/v3/index.js +3 -3
  61. package/package.json +1 -1
  62. package/src/components/or-avatar-v3/props.ts +1 -0
  63. package/src/components/or-avatar-v3/styles.ts +9 -0
  64. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +28 -229
  65. package/src/components/or-card-collection-v3/OrCardCollection.vue +76 -119
  66. package/src/components/or-card-collection-v3/styles.ts +1 -1
  67. package/src/components/or-card-collection-v3/types.ts +3 -9
  68. package/src/components/or-search-v3/OrSearch.vue +1 -7
  69. package/dist/bundled/v2/OrCardCollection-953657a7.js +0 -347
  70. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
  71. package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
  72. package/dist/bundled/v3/OrButton-8ab33d9d.js +0 -33
  73. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-4debae8a.js +0 -229
  74. package/dist/bundled/v3/OrMenu-f26e8e55.js +0 -29
  75. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
  76. package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
  77. package/dist/esm/v2/OrCardCollection-55e282a7.js +0 -347
  78. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
  79. package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
  80. package/dist/esm/v3/OrCardCollection-0c6da4b8.js +0 -290
  81. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
  82. package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
  83. package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +0 -41
  84. package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +0 -42
  85. package/src/components/or-card-collection-v3/constatnts.ts +0 -12
@@ -1,13 +1,10 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { Meta, StoryFn } from '@storybook/vue3';
3
- import { ref } from 'vue-demi';
4
3
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
5
4
  import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
6
5
  import OrCardCollection from './OrCardCollection.vue';
7
- import { defaultViewModes } from './constatnts';
8
- import { OrCardV3 as OrCard } from '../or-card-v3';
9
6
  import { CardCollectionView } from './props';
10
- import { CardCollectionItem } from './types';
7
+ import { CardCollectionItem, CardCollectionSortHeader } from './types';
11
8
 
12
9
  export default {
13
10
  title: 'Components/Card Collection',
@@ -15,7 +12,7 @@ export default {
15
12
 
16
13
  argTypes: {
17
14
  // Slots
18
- item: {
15
+ gridItem: {
19
16
  type: {
20
17
  name: 'string',
21
18
  required: true,
@@ -24,9 +21,10 @@ export default {
24
21
  control: { type: 'text' },
25
22
  },
26
23
 
27
- header: {
24
+ listItem: {
28
25
  type: {
29
26
  name: 'string',
27
+ required: true,
30
28
  },
31
29
 
32
30
  control: { type: 'text' },
@@ -46,7 +44,7 @@ export default {
46
44
  control: { type: 'object' },
47
45
  },
48
46
 
49
- sortOptions: {
47
+ sortHeaders: {
50
48
  control: { type: 'object' },
51
49
  },
52
50
 
@@ -72,48 +70,35 @@ export default {
72
70
  docs: {
73
71
  page: OrCardCollectionDocs,
74
72
  },
75
- layout: 'fullscreen',
76
73
  },
77
74
  } as Meta<typeof OrCardCollection>;
78
75
 
79
76
  const Template: StoryFn<typeof OrCardCollection> = (args) => ({
80
77
  components: {
81
78
  OrCardCollection,
82
- OrCard,
83
79
  OrIcon,
84
80
  },
85
81
 
86
82
  setup() {
87
- const sort = ref(args.sort);
88
- const onSortChange = (newSort: string) => {
89
- sort.value = newSort;
90
- action('searchChange')(newSort);
91
- };
92
-
93
83
  return {
94
84
  args,
95
- sort,
96
- onSortChange,
97
85
  onViewChange: action('viewChange'),
86
+ onSortChange: action('sortChange'),
98
87
  onSearchChange: action('searchChange'),
99
88
  };
100
89
  },
101
90
 
102
91
  template: `
103
- <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
104
- <OrCardCollection
105
- v-bind="args"
106
- :sort="sort"
107
- @viewChange="onViewChange"
108
- @sortChange="onSortChange"
109
- @searchChange="onSearchChange"
110
- >
111
- <template #item="{item, mode}">
112
- <OrCard>${args.item} ({{mode}})</OrCard>
113
- </template>
114
- <template #addon>${args.addon}</template>
115
- </OrCardCollection>
116
- </div>
92
+ <OrCardCollection
93
+ v-bind="args"
94
+ @viewChange="onViewChange"
95
+ @sortChange="onSortChange"
96
+ @searchChange="onSearchChange"
97
+ >
98
+ <template #gridItem="item">${args.gridItem}</template>
99
+ <template #listItem="item">${args.listItem}</template>
100
+ <template #addon>${args.addon}</template>
101
+ </OrCardCollection>
117
102
  `,
118
103
  });
119
104
 
@@ -121,7 +106,8 @@ export const Default = Template.bind({});
121
106
 
122
107
  Default.args = {
123
108
  // Slots
124
- item: '{{ item.label }}',
109
+ gridItem: '{{ item.label }} (grid)',
110
+ listItem: '{{ item.label }} (list)',
125
111
  addon: '<OrIcon icon="info" />',
126
112
 
127
113
  // Props
@@ -153,7 +139,7 @@ Default.args = {
153
139
  'Yankee',
154
140
  'Zulu',
155
141
  ], (item) => ({
156
- key: item.toLowerCase(),
142
+ id: item.toLowerCase(),
157
143
  label: item,
158
144
  })),
159
145
  };
@@ -164,200 +150,13 @@ WithSorting.args = {
164
150
  ...Default.args,
165
151
 
166
152
  // Props
167
- sort: 'bar',
168
- sortOptions: [
169
- {
170
- label: 'Foo',
171
- value: 'foo',
172
- },
173
- {
174
- label: 'Bar',
175
- value: 'bar',
176
- },
177
- {
178
- label: 'Baz',
179
- value: 'baz',
180
- },
181
- {
182
- label: 'Qux',
183
- value: 'qux',
184
- },
185
- ],
186
- };
187
-
188
-
189
- export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) => ({
190
- components: {
191
- OrCardCollection,
192
- OrCard,
193
- },
194
-
195
- setup() {
196
- return {
197
- args,
198
- onViewChange: action('viewChange'),
199
- onSortChange: action('sortChange'),
200
- onSearchChange: action('searchChange'),
201
- };
202
- },
203
-
204
- template: `
205
- <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
206
- <OrCardCollection
207
- v-bind="args"
208
- @viewChange="onViewChange"
209
- @sortChange="onSortChange"
210
- @searchChange="onSearchChange"
211
- >
212
- <template #header="{mode}">
213
- ${args.header}
214
- </template>
215
- <template #grid="{items}">
216
- <div class="grid grid-cols-3">
217
- <OrCard
218
- v-for="item in items"
219
- :key="item.key"
220
- >
221
- {{ item.label }}
222
- </OrCard>
223
- </div>
224
- </template>
225
- <template #list="{items}">
226
- <ul>
227
- <li
228
- v-for="item in items"
229
- :key="item.key"
230
- >
231
- - {{ item.label }}
232
- </li>
233
- </ul>
234
- </template>
235
- </OrCardCollection>
236
- </div>
237
- `,
238
- });
239
-
240
- OverrideViewContainer.args = {
241
- ...Default.args,
242
- header: '<div class="typography-headline-3">Custom {{ mode }}</div>',
243
- };
244
-
245
- export const ExtraViewMode: StoryFn<typeof OrCardCollection> = (args) => ({
246
- components: {
247
- OrCardCollection,
248
- OrCard,
249
- },
250
-
251
- setup() {
252
- return {
253
- args,
254
- defaultViewModes,
255
- onViewChange: action('viewChange'),
256
- onSearchChange: action('searchChange'),
257
- };
258
- },
259
-
260
- template: `
261
- <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
262
- <OrCardCollection
263
- v-bind="args"
264
- :view-modes="[...defaultViewModes, {view: 'mymode', icon: 'timeline'}]"
265
- @viewChange="onViewChange"
266
- @searchChange="onSearchChange"
267
- >
268
- <template #item="{item, mode}">
269
- <OrCard>${args.item} ({{mode}})</OrCard>
270
- </template>
271
- <template #mymode="{items}">
272
- <div class="typography-headline-3">My view mode</div>
273
- <div class="grid grid-cols-3">
274
- <OrCard
275
- v-for="item in items"
276
- :key="item.key"
277
- >
278
- {{ item.label }} (timeline)
279
- </OrCard>
280
- </div>
281
- </template>
282
- </OrCardCollection>
283
- </div>
284
- `,
285
- });
286
-
287
- ExtraViewMode.args = {
288
- ...Default.args,
289
- };
290
-
291
- export const WithLink: StoryFn<typeof OrCardCollection> = (args) => ({
292
- components: {
293
- OrCardCollection,
294
- OrCard,
295
- OrIcon,
296
- },
297
-
298
- setup() {
299
- return {
300
- args,
301
- onViewChange: action('viewChange'),
302
- onSortChange: action('sortChange'),
303
- onSearchChange: action('searchChange'),
304
- };
305
- },
306
-
307
- template: `
308
- <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
309
- <OrCardCollection
310
- v-bind="args"
311
- @viewChange="onViewChange"
312
- @sortChange="onSortChange"
313
- @searchChange="onSearchChange"
314
- >
315
- <template #item="{item}">
316
- <a href="#" @click.prevent><OrCard>${args.item}</OrCard></a>
317
- </template>
318
- </OrCardCollection>
319
- </div>
320
- `,
321
- });
322
-
323
- WithLink.args = {
324
- ...Default.args,
325
- };
326
-
327
- export const EmptySearchResults: StoryFn<typeof OrCardCollection> = (args) => ({
328
- components: {
329
- OrCardCollection,
330
- OrCard,
331
- OrIcon,
332
- },
333
-
334
- setup() {
335
- return {
336
- args,
337
- onViewChange: action('viewChange'),
338
- onSortChange: action('sortChange'),
339
- onSearchChange: action('searchChange'),
340
- };
341
- },
342
-
343
- template: `
344
- <div class="p-md h-screen bg-surface-1 dark:bg-surface-1-dark">
345
- <OrCardCollection
346
- v-bind="args"
347
- @viewChange="onViewChange"
348
- @sortChange="onSortChange"
349
- @searchChange="onSearchChange"
350
- >
351
- <template #noSearchResults="{search}">
352
- <p class="text-center typography-headline-3">No results for "{{search}}"</p>
353
- </template>
354
- </OrCardCollection>
355
- </div>
356
- `,
357
- });
358
-
359
- EmptySearchResults.args = {
360
- ...Default.args,
361
- search: 'My favorite ..',
362
- items: [],
153
+ sortHeaders: Array.from<string, CardCollectionSortHeader>([
154
+ 'Foo',
155
+ 'Bar',
156
+ 'Baz',
157
+ 'Qux',
158
+ ], (item) => ({
159
+ value: item.toLowerCase(),
160
+ label: item,
161
+ })),
363
162
  };
@@ -6,119 +6,87 @@
6
6
  >
7
7
  <div :class="toolbarStyles">
8
8
  <div :class="toolbarPanelStyles">
9
- <template v-if="sortOptions.length">
10
- <OrButton
11
- ref="sortButton"
12
- variant="link"
13
- color="inherit"
14
- @click="sortMenu.toggle()"
9
+ <template v-if="sortHeaders">
10
+ <OrSortHeader
11
+ v-for="header in sortHeaders"
12
+ :key="header.value"
13
+ v-model="proxySort"
14
+ :input-value="header.value"
15
15
  >
16
- {{ sortLabel }}
17
- <OrIcon
18
- v-if="sortMenu"
19
- :icon="sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'"
20
- />
21
- </OrButton>
22
- <OrMenu
23
- ref="sortMenu"
24
- :trigger="sortButton && sortButton.root"
25
- >
26
- <OrMenuItem
27
- v-for="sortItem in sortOptions"
28
- :key="sortItem"
29
- @click="handleSort(sortItem.value)"
30
- >
31
- {{ sortItem.label }}
32
- </OrMenuItem>
33
- </OrMenu>
16
+ {{ header.label }}
17
+ </OrSortHeader>
34
18
  </template>
35
19
  </div>
36
- <div
37
- :class="toolbarPanelStyles"
38
- >
39
- <OrSearch
20
+
21
+ <div :class="toolbarPanelStyles">
22
+ <OrInput
40
23
  v-model="proxySearch"
41
- class="md:w-[350px]"
42
- size="s"
43
- @search="handleSearch"
24
+ :type="'search'"
25
+ :placeholder="'Search'"
26
+ :size="'s'"
27
+ />
28
+
29
+ <OrIconButton
30
+ :icon="'grid_view'"
31
+ @click="switchToGridView()"
32
+ />
33
+
34
+ <OrIconButton
35
+ :icon="'view_list'"
36
+ @click="switchToListView()"
44
37
  />
45
- <div class="layout-row gap-sm">
46
- <template v-if="viewModes.length > 1">
47
- <OrIconButton
48
- v-for="viewOption in viewModes"
49
- :key="viewOption.view"
50
- :icon="{icon: viewOption.icon, variant: viewOption.view === proxyView ? 'filled' : 'outlined'}"
51
- @click="switchView(viewOption.view)"
52
- />
53
- </template>
54
- <slot name="addon" />
55
- </div>
38
+
39
+ <slot name="addon" />
56
40
  </div>
57
41
  </div>
58
- <slot
59
- name="header"
60
- v-bind="{
61
- items,
62
- mode: proxyView,
63
- }"
64
- />
65
- <slot
66
- v-if="items.length"
67
- :name="proxyView"
68
- v-bind="{items}"
69
- >
70
- <OrCardCollectionView
71
- :items="items"
72
- :mode="proxyView"
73
- >
74
- <template v-slot:item="props">
42
+
43
+ <div :class="contentStyles">
44
+ <template v-if="proxyView === 'grid'">
45
+ <OrCard
46
+ v-for="item in items"
47
+ :key="item.id"
48
+ >
75
49
  <slot
76
- name="item"
77
- v-bind="props"
50
+ name="gridItem"
51
+ v-bind="item"
78
52
  />
79
- </template>
80
- </OrCardCollectionView>
81
- </slot>
82
- <slot
83
- v-else-if="items.length === 0 && proxySearch.length > 0"
84
- name="noSearchResults"
85
- v-bind="{search: proxySearch}"
86
- >
87
- No results
88
- </slot>
53
+ </OrCard>
54
+ </template>
55
+
56
+ <template v-if="proxyView === 'list'">
57
+ <OrCard
58
+ v-for="item in items"
59
+ :key="item.id"
60
+ >
61
+ <slot
62
+ name="listItem"
63
+ v-bind="item"
64
+ />
65
+ </OrCard>
66
+ </template>
67
+ </div>
89
68
  </div>
90
69
  </template>
91
70
 
92
71
  <script lang="ts">
93
72
  import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
94
73
  import { useClassAttribute } from '../../hooks';
74
+ import { OrCardV3 as OrCard } from '../or-card-v3';
95
75
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
96
- import { OrMenuV3 as OrMenu } from '../or-menu-v3';
97
- import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
98
- import { OrIconV3 as OrIcon } from '../or-icon-v3';
76
+ import { OrInputV3 as OrInput } from '../or-input-v3';
77
+ import { OrSortHeaderV3 as OrSortHeader, SortHeaderModel } from '../or-sort-header-v3';
99
78
  import { CardCollectionView } from './props';
100
- import {
101
- CardCollectionRoot,
102
- CardCollectionToolbar,
103
- CardCollectionToolbarPanel,
104
- } from './styles';
105
- import { CardCollectionItem, SortOption, ViewMode } from './types';
106
- import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
107
- import { OrButtonV3 as OrButton } from '../or-button-v3';
108
- import { OrSearchV3 as OrSearch } from '../or-search-v3';
109
- import { defaultViewModes } from './constatnts';
79
+ import { CardCollectionContent, CardCollectionContentViews, CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
80
+ import { CardCollectionItem, CardCollectionSortHeader } from './types';
110
81
 
111
82
  export default defineComponent({
112
83
  name: 'OrCardCollection',
113
84
 
114
85
  components: {
115
- OrCardCollectionView,
86
+ OrCard,
116
87
  OrIconButton,
117
- OrButton,
118
- OrMenu,
119
- OrMenuItem,
120
- OrIcon,
121
- OrSearch,
88
+ OrInput,
89
+ OrSortHeader,
122
90
  },
123
91
 
124
92
  inheritAttrs: false,
@@ -130,28 +98,23 @@ export default defineComponent({
130
98
  },
131
99
 
132
100
  view: {
133
- type: String,
101
+ type: String as PropType<CardCollectionView>,
134
102
  default: CardCollectionView.Grid,
135
103
  },
136
104
 
137
- viewModes: {
138
- type: Array as PropType<ViewMode[]>,
139
- default: () => defaultViewModes,
140
- },
141
-
142
105
  sort: {
143
- type: String,
106
+ type: Object as PropType<SortHeaderModel>,
144
107
  default: undefined,
145
108
  },
146
109
 
147
- sortOptions: {
148
- type: Array as PropType<SortOption[]>,
149
- default: () => [],
110
+ sortHeaders: {
111
+ type: Array as PropType<CardCollectionSortHeader[]>,
112
+ default: undefined,
150
113
  },
151
114
 
152
115
  search: {
153
116
  type: String,
154
- default: '',
117
+ default: undefined,
155
118
  },
156
119
  },
157
120
 
@@ -168,8 +131,6 @@ export default defineComponent({
168
131
  setup(props, context) {
169
132
  // Refs
170
133
  const root = ref<HTMLElement>();
171
- const sortMenu = ref<typeof OrMenu>();
172
- const sortButton = ref<typeof OrButton>();
173
134
 
174
135
  // Styles
175
136
  const classAttribute = useClassAttribute();
@@ -188,24 +149,23 @@ export default defineComponent({
188
149
  ...CardCollectionToolbarPanel,
189
150
  ]);
190
151
 
191
- const sortLabel = computed(() => {
192
- return props.sortOptions.find(item => item.value === props.sort)?.label;
193
- });
152
+ const contentStyles = computed(() => [
153
+ ...CardCollectionContent,
154
+ ...CardCollectionContentViews[proxyView.value],
155
+ ]);
156
+
194
157
  // State
195
158
  const proxyView = ref(props.view);
196
159
  const proxySort = ref(props.sort);
197
160
  const proxySearch = ref(props.search);
198
161
 
199
162
  // Methods
200
- function switchView(view: string): void {
201
- proxyView.value = view;
202
- }
203
- function handleSort(sort: string) {
204
- proxySort.value = sort;
163
+ function switchToGridView(): void {
164
+ proxyView.value = CardCollectionView.Grid;
205
165
  }
206
166
 
207
- function handleSearch(search: string) {
208
- proxySearch.value = search;
167
+ function switchToListView(): void {
168
+ proxyView.value = CardCollectionView.List;
209
169
  }
210
170
 
211
171
  // Effects
@@ -235,18 +195,15 @@ export default defineComponent({
235
195
 
236
196
  return {
237
197
  root,
238
- sortMenu,
239
- sortButton,
240
198
  rootStyles,
241
199
  toolbarStyles,
242
200
  toolbarPanelStyles,
201
+ contentStyles,
243
202
  proxyView,
244
203
  proxySort,
245
204
  proxySearch,
246
- sortLabel,
247
- switchView,
248
- handleSort,
249
- handleSearch,
205
+ switchToGridView,
206
+ switchToListView,
250
207
  };
251
208
  },
252
209
  });
@@ -25,7 +25,7 @@ export const CardCollectionToolbarPanel: string[] = [
25
25
  'layout-row',
26
26
 
27
27
  // Spacing
28
- 'gap-lg+',
28
+ 'gap-sm+',
29
29
  ];
30
30
 
31
31
  export const CardCollectionContent: string[] = [
@@ -1,14 +1,8 @@
1
1
  export interface CardCollectionItem {
2
- key?: string;
3
- [key: string|number]: any;
2
+ id: string;
4
3
  }
5
4
 
6
- export interface ViewMode {
7
- view: string;
8
- icon: string;
9
- }
10
-
11
- export interface SortOption {
12
- label: string;
5
+ export interface CardCollectionSortHeader {
13
6
  value: string;
7
+ label: string;
14
8
  }
@@ -35,12 +35,6 @@ export default defineComponent({
35
35
  inheritAttrs: false,
36
36
 
37
37
  props: {
38
- modelValue: {
39
- type: String,
40
- default: '',
41
- required: false,
42
- },
43
-
44
38
  size: {
45
39
  type: String as PropType<SearchSize>,
46
40
  default: SearchSize.M,
@@ -96,7 +90,7 @@ export default defineComponent({
96
90
  ]);
97
91
 
98
92
  // State
99
- const localModelValue = ref(props.modelValue ?? '');
93
+ const localModelValue = ref('');
100
94
 
101
95
  // Events
102
96
  debouncedWatch(