@onereach/ui-components 2.69.1-beta.2089.0 → 2.69.1-beta.2095.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/{OrButton-0e91a808.js → OrButton-66d37aff.js} +14 -1
- package/dist/bundled/v2/{OrCard-29116e1f.js → OrCard-58a1ba3e.js} +2 -2
- package/dist/bundled/v2/OrCardCollection-a9a779ea.js +228 -0
- package/dist/bundled/v2/{OrConfirm-18c534df.js → OrConfirm-e1ca1422.js} +1 -1
- package/dist/bundled/v2/OrPagination-354e9abd.js +296 -0
- package/dist/bundled/v2/{OrSearch-19f43fe5.js → OrSearch-9d402f56.js} +2 -2
- package/dist/bundled/v2/{OrSelect-759b4410.js → OrSelect-1c9421ad.js} +3 -3
- package/dist/bundled/v2/{OrSortHeader-9932d28f.js → OrSortHeader-396e6a7c.js} +2 -2
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +8 -7
- package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +4 -7
- package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +4 -5
- package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
- package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/bundled/v2/components/or-pagination-v3/index.js +20 -0
- package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +3 -0
- package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/bundled/v2/components/or-select-v3/index.d.ts +1 -0
- package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
- package/dist/bundled/v2/index.js +9 -8
- package/dist/bundled/v3/{OrButton-8ab33d9d.js → OrButton-9640286b.js} +3 -2
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-3718b300.js → OrButton.vue_vue_type_script_lang-06d8ead1.js} +13 -1
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +164 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-85472b12.js → OrConfirm.vue_vue_type_script_lang-f1b81f00.js} +2 -2
- package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-ff22b11c.js +180 -0
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-cb2d6612.js → OrSearch.vue_vue_type_script_lang-ed78b21f.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-dfadd12f.js → OrSelect.vue_vue_type_script_lang-d0626539.js} +2 -2
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +11 -10
- package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +4 -11
- package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +4 -5
- package/dist/bundled/v3/components/or-confirm-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
- package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/bundled/v3/components/or-pagination-v3/index.js +22 -0
- package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +3 -0
- package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/bundled/v3/components/or-select-v3/index.d.ts +1 -0
- package/dist/bundled/v3/components/or-select-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
- package/dist/bundled/v3/index.js +354 -292
- package/dist/esm/v2/{OrButton-357a5756.js → OrButton-3d4fc9da.js} +14 -1
- package/dist/esm/v2/OrCardCollection-4f001551.js +227 -0
- package/dist/esm/v2/{OrConfirm-b0b2e43c.js → OrConfirm-ba3f8c45.js} +1 -1
- package/dist/esm/v2/OrPagination-a56eb93b.js +296 -0
- package/dist/esm/v2/{OrSelect-ac382aa6.js → OrSelect-ca2510cd.js} +3 -3
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +5 -4
- package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-button-v3/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
- package/dist/esm/v2/components/or-card-collection-v3/index.js +4 -7
- package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +4 -5
- package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
- package/dist/esm/v2/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-pagination-v3/index.js +18 -0
- package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +3 -0
- package/dist/esm/v2/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/esm/v2/components/or-select-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-select-v3/index.js +1 -1
- package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
- package/dist/esm/v2/index.js +5 -4
- package/dist/esm/v3/{OrButton-f4b9ee51.js → OrButton-970ae320.js} +15 -2
- package/dist/esm/v3/OrCardCollection-5a0febaf.js +198 -0
- package/dist/esm/v3/{OrConfirm-906427ef.js → OrConfirm-7cb2f36b.js} +1 -1
- package/dist/esm/v3/OrPagination-d351a13b.js +257 -0
- package/dist/esm/v3/{OrSelect-fee9c099.js → OrSelect-bff22c7f.js} +3 -3
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +5 -4
- package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-button-v3/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
- package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -7
- package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +4 -5
- package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
- package/dist/esm/v3/components/or-pagination-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-pagination-v3/index.js +17 -0
- package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +3 -0
- package/dist/esm/v3/components/or-pagination-v3/types.d.ts +4 -0
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
- package/dist/esm/v3/components/or-select-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
- package/dist/esm/v3/index.js +5 -4
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/or-button-v3/OrButton.stories3.ts +4 -0
- package/src/components/or-button-v3/OrButton.vue +6 -0
- package/src/components/or-button-v3/styles.ts +15 -1
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +19 -160
- package/src/components/or-card-collection-v3/OrCardCollection.vue +74 -99
- package/src/components/or-card-collection-v3/styles.ts +1 -1
- package/src/components/or-card-collection-v3/types.ts +4 -5
- package/src/components/or-pagination-v3/OrPagination.docs.mdx +7 -0
- package/src/components/or-pagination-v3/OrPagination.stories3.ts +87 -0
- package/src/components/or-pagination-v3/OrPagination.vue +260 -0
- package/src/components/or-pagination-v3/index.ts +2 -0
- package/src/components/or-pagination-v3/styles.ts +30 -0
- package/src/components/or-pagination-v3/types.ts +4 -0
- package/src/components/or-select-v3/OrSelect.vue +3 -3
- package/src/components/or-select-v3/index.ts +1 -0
- package/src/components/or-select-v3/types.ts +1 -1
- package/dist/bundled/v2/OrCardCollection-a8d5ce32.js +0 -328
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-f9f329a2.js +0 -224
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/esm/v2/OrCardCollection-95b051e1.js +0 -328
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/dist/esm/v3/OrCardCollection-afd863fc.js +0 -274
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +0 -41
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +0 -42
- package/src/components/or-card-collection-v3/constatnts.ts +0 -12
|
@@ -3,10 +3,8 @@ import { Meta, StoryFn } from '@storybook/vue3';
|
|
|
3
3
|
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
4
4
|
import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
|
|
5
5
|
import OrCardCollection from './OrCardCollection.vue';
|
|
6
|
-
import { defaultViewModes } from './constatnts';
|
|
7
|
-
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
8
6
|
import { CardCollectionView } from './props';
|
|
9
|
-
import { CardCollectionItem } from './types';
|
|
7
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
10
8
|
|
|
11
9
|
export default {
|
|
12
10
|
title: 'Components/Card Collection',
|
|
@@ -72,14 +70,12 @@ 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
|
|
|
@@ -93,19 +89,16 @@ const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
|
93
89
|
},
|
|
94
90
|
|
|
95
91
|
template: `
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<template #addon>${args.addon}</template>
|
|
107
|
-
</OrCardCollection>
|
|
108
|
-
</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>
|
|
109
102
|
`,
|
|
110
103
|
});
|
|
111
104
|
|
|
@@ -113,7 +106,8 @@ export const Default = Template.bind({});
|
|
|
113
106
|
|
|
114
107
|
Default.args = {
|
|
115
108
|
// Slots
|
|
116
|
-
|
|
109
|
+
gridItem: '{{ item.label }} (grid)',
|
|
110
|
+
listItem: '{{ item.label }} (list)',
|
|
117
111
|
addon: '<OrIcon icon="info" />',
|
|
118
112
|
|
|
119
113
|
// Props
|
|
@@ -145,7 +139,7 @@ Default.args = {
|
|
|
145
139
|
'Yankee',
|
|
146
140
|
'Zulu',
|
|
147
141
|
], (item) => ({
|
|
148
|
-
|
|
142
|
+
id: item.toLowerCase(),
|
|
149
143
|
label: item,
|
|
150
144
|
})),
|
|
151
145
|
};
|
|
@@ -156,148 +150,13 @@ WithSorting.args = {
|
|
|
156
150
|
...Default.args,
|
|
157
151
|
|
|
158
152
|
// Props
|
|
159
|
-
|
|
160
|
-
sortOptions: [
|
|
153
|
+
sortHeaders: Array.from<string, CardCollectionSortHeader>([
|
|
161
154
|
'Foo',
|
|
162
155
|
'Bar',
|
|
163
156
|
'Baz',
|
|
164
157
|
'Qux',
|
|
165
|
-
],
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
170
|
-
components: {
|
|
171
|
-
OrCardCollection,
|
|
172
|
-
OrCard,
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
setup() {
|
|
176
|
-
return {
|
|
177
|
-
args,
|
|
178
|
-
onViewChange: action('viewChange'),
|
|
179
|
-
onSortChange: action('sortChange'),
|
|
180
|
-
onSearchChange: action('searchChange'),
|
|
181
|
-
};
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
template: `
|
|
185
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
186
|
-
<OrCardCollection
|
|
187
|
-
v-bind="args"
|
|
188
|
-
@viewChange="onViewChange"
|
|
189
|
-
@sortChange="onSortChange"
|
|
190
|
-
@searchChange="onSearchChange"
|
|
191
|
-
>
|
|
192
|
-
<template #grid="{items}">
|
|
193
|
-
<div class="typography-headline-3">Custom grid</div>
|
|
194
|
-
<div class="grid grid-cols-3">
|
|
195
|
-
<OrCard
|
|
196
|
-
v-for="item in items"
|
|
197
|
-
:key="item.key"
|
|
198
|
-
>
|
|
199
|
-
{{ item.label }}
|
|
200
|
-
</OrCard>
|
|
201
|
-
</div>
|
|
202
|
-
</template>
|
|
203
|
-
<template #list="{items}">
|
|
204
|
-
<div class="typography-headline-3">Custom list</div>
|
|
205
|
-
<ul>
|
|
206
|
-
<li
|
|
207
|
-
v-for="item in items"
|
|
208
|
-
:key="item.key"
|
|
209
|
-
>
|
|
210
|
-
- {{ item.label }}
|
|
211
|
-
</li>
|
|
212
|
-
</ul>
|
|
213
|
-
</template>
|
|
214
|
-
</OrCardCollection>
|
|
215
|
-
</div>
|
|
216
|
-
`,
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
OverrideViewContainer.args = {
|
|
220
|
-
...Default.args,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export const ExtraViewMode: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
224
|
-
components: {
|
|
225
|
-
OrCardCollection,
|
|
226
|
-
OrCard,
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
setup() {
|
|
230
|
-
return {
|
|
231
|
-
args,
|
|
232
|
-
defaultViewModes,
|
|
233
|
-
onViewChange: action('viewChange'),
|
|
234
|
-
onSearchChange: action('searchChange'),
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
template: `
|
|
239
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
240
|
-
<OrCardCollection
|
|
241
|
-
v-bind="args"
|
|
242
|
-
:view-modes="[...defaultViewModes, {view: 'mymode', icon: 'timeline'}]"
|
|
243
|
-
@viewChange="onViewChange"
|
|
244
|
-
@searchChange="onSearchChange"
|
|
245
|
-
>
|
|
246
|
-
<template #item="{item, mode}">
|
|
247
|
-
<OrCard>${args.item} ({{mode}})</OrCard>
|
|
248
|
-
</template>
|
|
249
|
-
<template #mymode="{items}">
|
|
250
|
-
<div class="typography-headline-3">My view mode</div>
|
|
251
|
-
<div class="grid grid-cols-3">
|
|
252
|
-
<OrCard
|
|
253
|
-
v-for="item in items"
|
|
254
|
-
:key="item.key"
|
|
255
|
-
>
|
|
256
|
-
{{ item.label }} (timeline)
|
|
257
|
-
</OrCard>
|
|
258
|
-
</div>
|
|
259
|
-
</template>
|
|
260
|
-
</OrCardCollection>
|
|
261
|
-
</div>
|
|
262
|
-
`,
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
ExtraViewMode.args = {
|
|
266
|
-
...Default.args,
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export const WithLink: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
270
|
-
components: {
|
|
271
|
-
OrCardCollection,
|
|
272
|
-
OrCard,
|
|
273
|
-
OrIcon,
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
setup() {
|
|
277
|
-
return {
|
|
278
|
-
args,
|
|
279
|
-
onViewChange: action('viewChange'),
|
|
280
|
-
onSortChange: action('sortChange'),
|
|
281
|
-
onSearchChange: action('searchChange'),
|
|
282
|
-
};
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
template: `
|
|
286
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
287
|
-
<OrCardCollection
|
|
288
|
-
v-bind="args"
|
|
289
|
-
@viewChange="onViewChange"
|
|
290
|
-
@sortChange="onSortChange"
|
|
291
|
-
@searchChange="onSearchChange"
|
|
292
|
-
>
|
|
293
|
-
<template #item="{item}">
|
|
294
|
-
<a href="#" @click.prevent><OrCard>${args.item}</OrCard></a>
|
|
295
|
-
</template>
|
|
296
|
-
</OrCardCollection>
|
|
297
|
-
</div>
|
|
298
|
-
`,
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
WithLink.args = {
|
|
302
|
-
...Default.args,
|
|
158
|
+
], (item) => ({
|
|
159
|
+
value: item.toLowerCase(),
|
|
160
|
+
label: item,
|
|
161
|
+
})),
|
|
303
162
|
};
|
|
@@ -6,105 +6,87 @@
|
|
|
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="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
|
-
{{
|
|
17
|
-
|
|
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)"
|
|
30
|
-
>
|
|
31
|
-
{{ sortItem }}
|
|
32
|
-
</OrMenuItem>
|
|
33
|
-
</OrMenu>
|
|
16
|
+
{{ header.label }}
|
|
17
|
+
</OrSortHeader>
|
|
34
18
|
</template>
|
|
35
19
|
</div>
|
|
36
20
|
|
|
37
|
-
<div
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
size="s"
|
|
43
|
-
@search="handleSearch"
|
|
21
|
+
<div :class="toolbarPanelStyles">
|
|
22
|
+
<OrInput
|
|
23
|
+
v-model="proxySearch"
|
|
24
|
+
:type="'search'"
|
|
25
|
+
:placeholder="'Search'"
|
|
26
|
+
:size="'s'"
|
|
44
27
|
/>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
28
|
+
|
|
29
|
+
<OrIconButton
|
|
30
|
+
:icon="'grid_view'"
|
|
31
|
+
@click="switchToGridView()"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<OrIconButton
|
|
35
|
+
:icon="'view_list'"
|
|
36
|
+
@click="switchToListView()"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<slot name="addon" />
|
|
56
40
|
</div>
|
|
57
41
|
</div>
|
|
58
42
|
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
:mode="proxyView"
|
|
66
|
-
>
|
|
67
|
-
<template v-slot:item="props">
|
|
43
|
+
<div :class="contentStyles">
|
|
44
|
+
<template v-if="proxyView === 'grid'">
|
|
45
|
+
<OrCard
|
|
46
|
+
v-for="item in items"
|
|
47
|
+
:key="item.id"
|
|
48
|
+
>
|
|
68
49
|
<slot
|
|
69
|
-
name="
|
|
70
|
-
v-bind="
|
|
50
|
+
name="gridItem"
|
|
51
|
+
v-bind="item"
|
|
71
52
|
/>
|
|
72
|
-
</
|
|
73
|
-
</
|
|
74
|
-
|
|
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>
|
|
75
68
|
</div>
|
|
76
69
|
</template>
|
|
77
70
|
|
|
78
71
|
<script lang="ts">
|
|
79
72
|
import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
80
73
|
import { useClassAttribute } from '../../hooks';
|
|
74
|
+
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
81
75
|
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
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';
|
|
85
78
|
import { CardCollectionView } from './props';
|
|
86
|
-
import {
|
|
87
|
-
|
|
88
|
-
CardCollectionToolbar,
|
|
89
|
-
CardCollectionToolbarPanel,
|
|
90
|
-
} from './styles';
|
|
91
|
-
import { CardCollectionItem, ViewMode } from './types';
|
|
92
|
-
import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
|
|
93
|
-
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
94
|
-
import { OrSearchV3 as OrSearch } from '../or-search-v3';
|
|
95
|
-
import { defaultViewModes } from './constatnts';
|
|
79
|
+
import { CardCollectionContent, CardCollectionContentViews, CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
|
|
80
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
96
81
|
|
|
97
82
|
export default defineComponent({
|
|
98
83
|
name: 'OrCardCollection',
|
|
99
84
|
|
|
100
85
|
components: {
|
|
101
|
-
|
|
86
|
+
OrCard,
|
|
102
87
|
OrIconButton,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
OrMenuItem,
|
|
106
|
-
OrIcon,
|
|
107
|
-
OrSearch,
|
|
88
|
+
OrInput,
|
|
89
|
+
OrSortHeader,
|
|
108
90
|
},
|
|
109
91
|
|
|
110
92
|
inheritAttrs: false,
|
|
@@ -116,23 +98,18 @@ export default defineComponent({
|
|
|
116
98
|
},
|
|
117
99
|
|
|
118
100
|
view: {
|
|
119
|
-
type: String as PropType<
|
|
101
|
+
type: String as PropType<CardCollectionView>,
|
|
120
102
|
default: CardCollectionView.Grid,
|
|
121
103
|
},
|
|
122
104
|
|
|
123
|
-
viewModes: {
|
|
124
|
-
type: Array as PropType<ViewMode[]>,
|
|
125
|
-
default: () => defaultViewModes,
|
|
126
|
-
},
|
|
127
|
-
|
|
128
105
|
sort: {
|
|
129
|
-
type:
|
|
106
|
+
type: Object as PropType<SortHeaderModel>,
|
|
130
107
|
default: undefined,
|
|
131
108
|
},
|
|
132
109
|
|
|
133
|
-
|
|
134
|
-
type: Array as PropType<
|
|
135
|
-
default:
|
|
110
|
+
sortHeaders: {
|
|
111
|
+
type: Array as PropType<CardCollectionSortHeader[]>,
|
|
112
|
+
default: undefined,
|
|
136
113
|
},
|
|
137
114
|
|
|
138
115
|
search: {
|
|
@@ -154,8 +131,6 @@ export default defineComponent({
|
|
|
154
131
|
setup(props, context) {
|
|
155
132
|
// Refs
|
|
156
133
|
const root = ref<HTMLElement>();
|
|
157
|
-
const sortMenu = ref<typeof OrMenu>();
|
|
158
|
-
const sortButton = ref<typeof OrButton>();
|
|
159
134
|
|
|
160
135
|
// Styles
|
|
161
136
|
const classAttribute = useClassAttribute();
|
|
@@ -174,21 +149,23 @@ export default defineComponent({
|
|
|
174
149
|
...CardCollectionToolbarPanel,
|
|
175
150
|
]);
|
|
176
151
|
|
|
152
|
+
const contentStyles = computed(() => [
|
|
153
|
+
...CardCollectionContent,
|
|
154
|
+
...CardCollectionContentViews[proxyView.value],
|
|
155
|
+
]);
|
|
156
|
+
|
|
177
157
|
// State
|
|
178
158
|
const proxyView = ref(props.view);
|
|
179
159
|
const proxySort = ref(props.sort);
|
|
180
160
|
const proxySearch = ref(props.search);
|
|
181
161
|
|
|
182
162
|
// Methods
|
|
183
|
-
function
|
|
184
|
-
proxyView.value =
|
|
185
|
-
}
|
|
186
|
-
function handleSort(sort: string) {
|
|
187
|
-
proxySort.value = sort;
|
|
163
|
+
function switchToGridView(): void {
|
|
164
|
+
proxyView.value = CardCollectionView.Grid;
|
|
188
165
|
}
|
|
189
166
|
|
|
190
|
-
function
|
|
191
|
-
|
|
167
|
+
function switchToListView(): void {
|
|
168
|
+
proxyView.value = CardCollectionView.List;
|
|
192
169
|
}
|
|
193
170
|
|
|
194
171
|
// Effects
|
|
@@ -218,17 +195,15 @@ export default defineComponent({
|
|
|
218
195
|
|
|
219
196
|
return {
|
|
220
197
|
root,
|
|
221
|
-
sortMenu,
|
|
222
|
-
sortButton,
|
|
223
198
|
rootStyles,
|
|
224
199
|
toolbarStyles,
|
|
225
200
|
toolbarPanelStyles,
|
|
201
|
+
contentStyles,
|
|
226
202
|
proxyView,
|
|
227
203
|
proxySort,
|
|
228
204
|
proxySearch,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
handleSearch,
|
|
205
|
+
switchToGridView,
|
|
206
|
+
switchToListView,
|
|
232
207
|
};
|
|
233
208
|
},
|
|
234
209
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
+
import { ref, watch } from 'vue-demi';
|
|
4
|
+
import OrPaginationDocs from './OrPagination.docs.mdx';
|
|
5
|
+
import OrPagination from './OrPagination.vue';
|
|
6
|
+
import { PaginationModel } from './types';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Pagination',
|
|
10
|
+
component: OrPagination,
|
|
11
|
+
|
|
12
|
+
argTypes: {
|
|
13
|
+
// Props
|
|
14
|
+
modelValue: {
|
|
15
|
+
control: { type: 'text' },
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
value: { // TODO: Remove Vue 2 fallback
|
|
19
|
+
table: { disable: true },
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
length: {
|
|
23
|
+
control: { type: 'number' },
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// Events
|
|
27
|
+
'update:modelValue': {
|
|
28
|
+
table: { disable: true },
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
input: {
|
|
32
|
+
table: { disable: true },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
parameters: {
|
|
37
|
+
layout: 'centered',
|
|
38
|
+
|
|
39
|
+
docs: {
|
|
40
|
+
page: OrPaginationDocs,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
design: {
|
|
44
|
+
type: 'figma',
|
|
45
|
+
url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=4063%3A35218&t=axoGLEPrByClXTTU-4',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
} as Meta<typeof OrPagination>;
|
|
49
|
+
|
|
50
|
+
const Template: StoryFn<typeof OrPagination> = (args) => ({
|
|
51
|
+
components: {
|
|
52
|
+
OrPagination,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
setup() {
|
|
56
|
+
// State
|
|
57
|
+
const model = ref<PaginationModel>();
|
|
58
|
+
|
|
59
|
+
// Effects
|
|
60
|
+
watch(model, (value) => {
|
|
61
|
+
console.debug(value);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
args,
|
|
66
|
+
model,
|
|
67
|
+
onUpdateModelValue: action('update:modelValue'),
|
|
68
|
+
onInput: action('input'),
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
template: `
|
|
73
|
+
<OrPagination
|
|
74
|
+
v-model="model"
|
|
75
|
+
v-bind="args"
|
|
76
|
+
@update:modelValue="onUpdateModelValue"
|
|
77
|
+
@input="onInput"
|
|
78
|
+
/>
|
|
79
|
+
`,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const Default = Template.bind({});
|
|
83
|
+
|
|
84
|
+
Default.args = {
|
|
85
|
+
// Props
|
|
86
|
+
length: 555,
|
|
87
|
+
};
|