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