@onereach/ui-components 2.68.1-beta.2067.0 → 2.68.1-beta.2068.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/{OrCard-29116e1f.js → OrCard-58a1ba3e.js} +2 -2
- package/dist/bundled/v2/{OrCardCollection-94a30a19.js → OrCardCollection-dac9fd1e.js} +53 -144
- package/dist/bundled/v2/{OrSearch-3ece0ef6.js → OrSearch-e34afaee.js} +2 -2
- package/dist/bundled/v2/{OrSelect-68aacb62.js → OrSelect-5fef3ccd.js} +1 -1
- package/dist/bundled/v2/{OrSortHeader-9932d28f.js → OrSortHeader-396e6a7c.js} +2 -2
- package/dist/bundled/v2/components/index.js +6 -6
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -3
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +28 -42
- 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 +1 -1
- package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-select-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/bundled/v2/hooks/index.js +1 -1
- package/dist/bundled/v2/index.js +7 -7
- package/dist/bundled/v2/{useOverflow-43299d81.js → useOverflow-bfea931e.js} +7 -3
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-0e029303.js → OrCardCollection.vue_vue_type_script_lang-7a07be47.js} +48 -98
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-18997376.js → OrConfirm.vue_vue_type_script_lang-2e7fa659.js} +36 -6
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-147a1fb9.js → OrSearch.vue_vue_type_script_lang-1d2a20e0.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-58b92fb0.js → OrSelect.vue_vue_type_script_lang-6fd881cf.js} +1 -1
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-61b79a5a.js → OrTabs.vue_vue_type_script_lang-919b2021.js} +36 -10
- package/dist/bundled/v3/components/index.js +9 -11
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -3
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +28 -42
- 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 +1 -1
- package/dist/bundled/v3/components/or-confirm-v3/index.js +1 -2
- package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-select-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-tabs-v3/index.js +1 -2
- package/dist/bundled/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/bundled/v3/hooks/index.js +1 -1
- package/dist/bundled/v3/index.js +301 -316
- package/dist/bundled/v3/{useOverflow-2468b718.js → useOverflow-f7916ce2.js} +7 -3
- package/dist/esm/v2/{OrCardCollection-54648673.js → OrCardCollection-e46b220e.js} +52 -144
- package/dist/esm/v2/{OrSelect-0e6e7868.js → OrSelect-81c1173a.js} +1 -1
- package/dist/esm/v2/components/index.js +3 -3
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -3
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +28 -42
- 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 +1 -1
- package/dist/esm/v2/components/or-select-v3/index.js +2 -2
- package/dist/esm/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/esm/v2/hooks/index.js +1 -1
- package/dist/esm/v2/index.js +3 -3
- package/dist/esm/v2/{useOverflow-ac506c65.js → useOverflow-2f535f6c.js} +7 -3
- package/dist/esm/v3/OrCardCollection-5924d035.js +198 -0
- package/dist/esm/v3/{OrSelect-2e00d4c8.js → OrSelect-fe1566ac.js} +1 -1
- package/dist/esm/v3/components/index.js +3 -3
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -3
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +28 -42
- 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 +1 -1
- package/dist/esm/v3/components/or-select-v3/index.js +2 -2
- package/dist/esm/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/esm/v3/hooks/index.js +1 -1
- package/dist/esm/v3/index.js +3 -3
- package/dist/esm/v3/{useOverflow-ac506c65.js → useOverflow-2f535f6c.js} +7 -3
- package/package.json +1 -1
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +19 -115
- package/src/components/or-card-collection-v3/OrCardCollection.vue +67 -93
- package/src/components/or-card-collection-v3/styles.ts +1 -1
- package/src/components/or-card-collection-v3/types.ts +1 -1
- package/src/components/or-tag-v3/OrTag.stories3.ts +112 -0
- package/src/hooks/useOverflow.ts +3 -2
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/bundled/v3/OrButton-8ab33d9d.js +0 -33
- package/dist/bundled/v3/OrMenu-f26e8e55.js +0 -29
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
- package/dist/esm/v3/OrCardCollection-9d0036fa.js +0 -259
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +0 -39
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +0 -40
|
@@ -3,9 +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 { OrCardV3 as OrCard } from '../or-card-v3';
|
|
7
6
|
import { CardCollectionView } from './props';
|
|
8
|
-
import { CardCollectionItem } from './types';
|
|
7
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
9
8
|
|
|
10
9
|
export default {
|
|
11
10
|
title: 'Components/Card Collection',
|
|
@@ -71,14 +70,12 @@ export default {
|
|
|
71
70
|
docs: {
|
|
72
71
|
page: OrCardCollectionDocs,
|
|
73
72
|
},
|
|
74
|
-
layout: 'fullscreen',
|
|
75
73
|
},
|
|
76
74
|
} as Meta<typeof OrCardCollection>;
|
|
77
75
|
|
|
78
76
|
const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
79
77
|
components: {
|
|
80
78
|
OrCardCollection,
|
|
81
|
-
OrCard,
|
|
82
79
|
OrIcon,
|
|
83
80
|
},
|
|
84
81
|
|
|
@@ -92,19 +89,16 @@ const Template: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
|
92
89
|
},
|
|
93
90
|
|
|
94
91
|
template: `
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<template #addon>${args.addon}</template>
|
|
106
|
-
</OrCardCollection>
|
|
107
|
-
</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>
|
|
108
102
|
`,
|
|
109
103
|
});
|
|
110
104
|
|
|
@@ -112,7 +106,8 @@ export const Default = Template.bind({});
|
|
|
112
106
|
|
|
113
107
|
Default.args = {
|
|
114
108
|
// Slots
|
|
115
|
-
|
|
109
|
+
gridItem: '{{ item.label }} (grid)',
|
|
110
|
+
listItem: '{{ item.label }} (list)',
|
|
116
111
|
addon: '<OrIcon icon="info" />',
|
|
117
112
|
|
|
118
113
|
// Props
|
|
@@ -144,7 +139,7 @@ Default.args = {
|
|
|
144
139
|
'Yankee',
|
|
145
140
|
'Zulu',
|
|
146
141
|
], (item) => ({
|
|
147
|
-
|
|
142
|
+
id: item.toLowerCase(),
|
|
148
143
|
label: item,
|
|
149
144
|
})),
|
|
150
145
|
};
|
|
@@ -155,104 +150,13 @@ WithSorting.args = {
|
|
|
155
150
|
...Default.args,
|
|
156
151
|
|
|
157
152
|
// Props
|
|
158
|
-
|
|
159
|
-
sortOptions: [
|
|
153
|
+
sortHeaders: Array.from<string, CardCollectionSortHeader>([
|
|
160
154
|
'Foo',
|
|
161
155
|
'Bar',
|
|
162
156
|
'Baz',
|
|
163
157
|
'Qux',
|
|
164
|
-
],
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
169
|
-
components: {
|
|
170
|
-
OrCardCollection,
|
|
171
|
-
OrCard,
|
|
172
|
-
OrIcon,
|
|
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.id"
|
|
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.id"
|
|
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
|
-
|
|
224
|
-
export const WithLink: StoryFn<typeof OrCardCollection> = (args) => ({
|
|
225
|
-
components: {
|
|
226
|
-
OrCardCollection,
|
|
227
|
-
OrCard,
|
|
228
|
-
OrIcon,
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
setup() {
|
|
232
|
-
return {
|
|
233
|
-
args,
|
|
234
|
-
onViewChange: action('viewChange'),
|
|
235
|
-
onSortChange: action('sortChange'),
|
|
236
|
-
onSearchChange: action('searchChange'),
|
|
237
|
-
};
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
template: `
|
|
241
|
-
<div class="p-md bg-surface-1 dark:bg-surface-1-dark">
|
|
242
|
-
<OrCardCollection
|
|
243
|
-
v-bind="args"
|
|
244
|
-
@viewChange="onViewChange"
|
|
245
|
-
@sortChange="onSortChange"
|
|
246
|
-
@searchChange="onSearchChange"
|
|
247
|
-
>
|
|
248
|
-
<template #item="{item}">
|
|
249
|
-
<a href="#" @click.prevent><OrCard>${args.item}</OrCard></a>
|
|
250
|
-
</template>
|
|
251
|
-
</OrCardCollection>
|
|
252
|
-
</div>
|
|
253
|
-
`,
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
WithLink.args = {
|
|
257
|
-
...Default.args,
|
|
158
|
+
], (item) => ({
|
|
159
|
+
value: item.toLowerCase(),
|
|
160
|
+
label: item,
|
|
161
|
+
})),
|
|
258
162
|
};
|
|
@@ -6,106 +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
|
-
<div class="layout-row gap-sm">
|
|
46
|
-
<OrIconButton
|
|
47
|
-
:icon="'grid_view'"
|
|
48
|
-
@click="switchToGridView()"
|
|
49
|
-
/>
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
<OrIconButton
|
|
30
|
+
:icon="'grid_view'"
|
|
31
|
+
@click="switchToGridView()"
|
|
32
|
+
/>
|
|
55
33
|
|
|
56
|
-
|
|
57
|
-
|
|
34
|
+
<OrIconButton
|
|
35
|
+
:icon="'view_list'"
|
|
36
|
+
@click="switchToListView()"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<slot name="addon" />
|
|
58
40
|
</div>
|
|
59
41
|
</div>
|
|
60
42
|
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
:mode="proxyView"
|
|
68
|
-
>
|
|
69
|
-
<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
|
+
>
|
|
70
49
|
<slot
|
|
71
|
-
name="
|
|
72
|
-
v-bind="
|
|
50
|
+
name="gridItem"
|
|
51
|
+
v-bind="item"
|
|
73
52
|
/>
|
|
74
|
-
</
|
|
75
|
-
</
|
|
76
|
-
|
|
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>
|
|
77
68
|
</div>
|
|
78
69
|
</template>
|
|
79
70
|
|
|
80
71
|
<script lang="ts">
|
|
81
72
|
import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
|
|
82
73
|
import { useClassAttribute } from '../../hooks';
|
|
74
|
+
import { OrCardV3 as OrCard } from '../or-card-v3';
|
|
83
75
|
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
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';
|
|
87
78
|
import { CardCollectionView } from './props';
|
|
88
|
-
import {
|
|
89
|
-
|
|
90
|
-
CardCollectionToolbar,
|
|
91
|
-
CardCollectionToolbarPanel,
|
|
92
|
-
} from './styles';
|
|
93
|
-
import { CardCollectionItem } from './types';
|
|
94
|
-
import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
|
|
95
|
-
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
96
|
-
import { OrSearchV3 as OrSearch } from '../or-search-v3';
|
|
79
|
+
import { CardCollectionContent, CardCollectionContentViews, CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
|
|
80
|
+
import { CardCollectionItem, CardCollectionSortHeader } from './types';
|
|
97
81
|
|
|
98
82
|
export default defineComponent({
|
|
99
83
|
name: 'OrCardCollection',
|
|
100
84
|
|
|
101
85
|
components: {
|
|
102
|
-
|
|
86
|
+
OrCard,
|
|
103
87
|
OrIconButton,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
OrMenuItem,
|
|
107
|
-
OrIcon,
|
|
108
|
-
OrSearch,
|
|
88
|
+
OrInput,
|
|
89
|
+
OrSortHeader,
|
|
109
90
|
},
|
|
110
91
|
|
|
111
92
|
inheritAttrs: false,
|
|
@@ -115,19 +96,20 @@ export default defineComponent({
|
|
|
115
96
|
type: Array as PropType<CardCollectionItem[]>,
|
|
116
97
|
default: [] as CardCollectionItem[],
|
|
117
98
|
},
|
|
99
|
+
|
|
118
100
|
view: {
|
|
119
101
|
type: String as PropType<CardCollectionView>,
|
|
120
102
|
default: CardCollectionView.Grid,
|
|
121
103
|
},
|
|
122
104
|
|
|
123
105
|
sort: {
|
|
124
|
-
type:
|
|
125
|
-
|
|
106
|
+
type: Object as PropType<SortHeaderModel>,
|
|
107
|
+
default: undefined,
|
|
126
108
|
},
|
|
127
109
|
|
|
128
|
-
|
|
129
|
-
type: Array as PropType<
|
|
130
|
-
default:
|
|
110
|
+
sortHeaders: {
|
|
111
|
+
type: Array as PropType<CardCollectionSortHeader[]>,
|
|
112
|
+
default: undefined,
|
|
131
113
|
},
|
|
132
114
|
|
|
133
115
|
search: {
|
|
@@ -149,8 +131,6 @@ export default defineComponent({
|
|
|
149
131
|
setup(props, context) {
|
|
150
132
|
// Refs
|
|
151
133
|
const root = ref<HTMLElement>();
|
|
152
|
-
const sortMenu = ref<typeof OrMenu>();
|
|
153
|
-
const sortButton = ref<typeof OrButton>();
|
|
154
134
|
|
|
155
135
|
// Styles
|
|
156
136
|
const classAttribute = useClassAttribute();
|
|
@@ -169,6 +149,11 @@ export default defineComponent({
|
|
|
169
149
|
...CardCollectionToolbarPanel,
|
|
170
150
|
]);
|
|
171
151
|
|
|
152
|
+
const contentStyles = computed(() => [
|
|
153
|
+
...CardCollectionContent,
|
|
154
|
+
...CardCollectionContentViews[proxyView.value],
|
|
155
|
+
]);
|
|
156
|
+
|
|
172
157
|
// State
|
|
173
158
|
const proxyView = ref(props.view);
|
|
174
159
|
const proxySort = ref(props.sort);
|
|
@@ -183,14 +168,6 @@ export default defineComponent({
|
|
|
183
168
|
proxyView.value = CardCollectionView.List;
|
|
184
169
|
}
|
|
185
170
|
|
|
186
|
-
function handleSort(sort: string) {
|
|
187
|
-
proxySort.value = sort;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function handleSearch(search: string) {
|
|
191
|
-
proxySearch.value = search;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
171
|
// Effects
|
|
195
172
|
watch(() => props.view, (value) => {
|
|
196
173
|
proxyView.value = value;
|
|
@@ -218,18 +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
205
|
switchToGridView,
|
|
230
206
|
switchToListView,
|
|
231
|
-
handleSort,
|
|
232
|
-
handleSearch,
|
|
233
207
|
};
|
|
234
208
|
},
|
|
235
209
|
});
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
+
import Faker from 'faker';
|
|
3
4
|
import OrTagDocs from './OrTag.docs.mdx';
|
|
4
5
|
import OrTag from './OrTag.vue';
|
|
5
6
|
import { TagColor, TagVariant } from './props';
|
|
7
|
+
import { OrButtonV3 as OrButton } from '../or-button-v3';
|
|
8
|
+
import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
|
|
9
|
+
import { useOverflow } from '../../hooks';
|
|
10
|
+
import { ref } from 'vue-demi';
|
|
6
11
|
|
|
7
12
|
export default {
|
|
8
13
|
title: 'Components/Tag',
|
|
@@ -77,6 +82,97 @@ const Template: StoryFn<typeof OrTag> = (args) => ({
|
|
|
77
82
|
`,
|
|
78
83
|
});
|
|
79
84
|
|
|
85
|
+
const ContainerTemplate: StoryFn<typeof OrTag> = (args) => ({
|
|
86
|
+
components: {
|
|
87
|
+
OrTag,
|
|
88
|
+
OrButton,
|
|
89
|
+
OrPopover,
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
setup() {
|
|
93
|
+
const container = ref<HTMLElement>();
|
|
94
|
+
const button = ref<InstanceType<typeof OrButton>>();
|
|
95
|
+
const popover = ref<InstanceType<typeof OrPopover>>();
|
|
96
|
+
|
|
97
|
+
const { innerItems, outerItems } = useOverflow(container);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
args,
|
|
101
|
+
container,
|
|
102
|
+
button,
|
|
103
|
+
popover,
|
|
104
|
+
innerItems,
|
|
105
|
+
outerItems,
|
|
106
|
+
handleClick: action('click'),
|
|
107
|
+
handleFocus: action('focus'),
|
|
108
|
+
handleBlur: action('blur'),
|
|
109
|
+
handleReset: action('reset'),
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
computed: {
|
|
114
|
+
tagsArr(): string[] {
|
|
115
|
+
return [
|
|
116
|
+
args.default,
|
|
117
|
+
...(typeof args.tags === 'string' ? args.tags.split(' ') : []),
|
|
118
|
+
];
|
|
119
|
+
},
|
|
120
|
+
hiddenTagsArr(): string[] {
|
|
121
|
+
return this.tagsArr.slice(this.innerItems?.length);
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
template: `
|
|
126
|
+
<div class="w-[512px] flex flex-row items-center overflow-hidden gap-xs">
|
|
127
|
+
<div
|
|
128
|
+
ref="container"
|
|
129
|
+
class="relative flex flex-row grow items-center overflow-hidden gap-xs"
|
|
130
|
+
>
|
|
131
|
+
<OrTag
|
|
132
|
+
v-for="tag in tagsArr"
|
|
133
|
+
v-bind="args"
|
|
134
|
+
@click="handleClick"
|
|
135
|
+
@focus="handleFocus"
|
|
136
|
+
@blur="handleBlur"
|
|
137
|
+
@reset="handleReset"
|
|
138
|
+
>
|
|
139
|
+
{{ tag }}
|
|
140
|
+
</OrTag>
|
|
141
|
+
</div>
|
|
142
|
+
<template v-if="outerItems?.length">
|
|
143
|
+
<OrButton
|
|
144
|
+
ref="button"
|
|
145
|
+
class="typography-caption-regular text-on-background dark:text-on-background-dark"
|
|
146
|
+
color="inherit"
|
|
147
|
+
variant="link"
|
|
148
|
+
@click="popover.open()"
|
|
149
|
+
>
|
|
150
|
+
+{{outerItems.length}}
|
|
151
|
+
</OrButton>
|
|
152
|
+
<OrPopover
|
|
153
|
+
ref="popover"
|
|
154
|
+
:trigger="button?.root"
|
|
155
|
+
>
|
|
156
|
+
<div
|
|
157
|
+
class="max-w-[192px] p-[16px] flex flex-row flex-wrap items-center overflow-hidden gap-xs"
|
|
158
|
+
>
|
|
159
|
+
<OrTag
|
|
160
|
+
v-for="tag in hiddenTagsArr"
|
|
161
|
+
v-bind="args"
|
|
162
|
+
@click="handleClick"
|
|
163
|
+
@focus="handleFocus"
|
|
164
|
+
@blur="handleBlur"
|
|
165
|
+
@reset="handleReset"
|
|
166
|
+
>
|
|
167
|
+
{{ tag }}
|
|
168
|
+
</OrTag>
|
|
169
|
+
</div>
|
|
170
|
+
</OrPopover>
|
|
171
|
+
</template>
|
|
172
|
+
</div>
|
|
173
|
+
`,
|
|
174
|
+
});
|
|
175
|
+
|
|
80
176
|
export const Default = Template.bind({});
|
|
81
177
|
|
|
82
178
|
Default.args = {
|
|
@@ -99,3 +195,19 @@ WithCustomColor.args = {
|
|
|
99
195
|
// Props
|
|
100
196
|
color: '#0000ff',
|
|
101
197
|
};
|
|
198
|
+
|
|
199
|
+
export const InsideContainer = ContainerTemplate.bind({});
|
|
200
|
+
|
|
201
|
+
InsideContainer.argTypes = {
|
|
202
|
+
tags: {
|
|
203
|
+
control: { type: 'text' },
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
InsideContainer.args = {
|
|
208
|
+
// Slots
|
|
209
|
+
default: 'First tag',
|
|
210
|
+
|
|
211
|
+
// Args
|
|
212
|
+
tags: Faker.lorem.words(32),
|
|
213
|
+
};
|
package/src/hooks/useOverflow.ts
CHANGED
|
@@ -20,10 +20,11 @@ export function useOverflow(
|
|
|
20
20
|
const container = containerRef.value;
|
|
21
21
|
|
|
22
22
|
if (container) {
|
|
23
|
+
const { x: containerOffset, width: containerWidth } = container.getBoundingClientRect();
|
|
23
24
|
const update = [...container.children].reduce(({ innerItems, outerItems }, child) => {
|
|
24
|
-
const item = child as HTMLElement, { x:
|
|
25
|
+
const item = child as HTMLElement, { x: itemOffset, width: itemWidth } = child.getBoundingClientRect();
|
|
25
26
|
|
|
26
|
-
if (
|
|
27
|
+
if (itemOffset + itemWidth >= containerOffset + containerWidth) {
|
|
27
28
|
item.style.setProperty('visibility', 'hidden');
|
|
28
29
|
|
|
29
30
|
return {
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PropType } from 'vue-demi';
|
|
2
|
-
import { CardCollectionItem } from './types';
|
|
3
|
-
import { CardCollectionView } from './props';
|
|
4
|
-
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
|
-
contentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
6
|
-
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
7
|
-
items: {
|
|
8
|
-
type: PropType<CardCollectionItem[]>;
|
|
9
|
-
default: CardCollectionItem[];
|
|
10
|
-
};
|
|
11
|
-
mode: {
|
|
12
|
-
type: PropType<CardCollectionView>;
|
|
13
|
-
required: true;
|
|
14
|
-
};
|
|
15
|
-
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
16
|
-
items: {
|
|
17
|
-
type: PropType<CardCollectionItem[]>;
|
|
18
|
-
default: CardCollectionItem[];
|
|
19
|
-
};
|
|
20
|
-
mode: {
|
|
21
|
-
type: PropType<CardCollectionView>;
|
|
22
|
-
required: true;
|
|
23
|
-
};
|
|
24
|
-
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
25
|
-
items: CardCollectionItem[];
|
|
26
|
-
mode: CardCollectionView;
|
|
27
|
-
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
28
|
-
contentStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
29
|
-
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
30
|
-
items: CardCollectionItem[];
|
|
31
|
-
mode: CardCollectionView;
|
|
32
|
-
} & {}, {
|
|
33
|
-
items: CardCollectionItem[];
|
|
34
|
-
}, true>);
|
|
35
|
-
export default _default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { s as script } from './OrButton.vue_vue_type_script_lang-3718b300.js';
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock, mergeProps, createElementVNode, normalizeClass, renderSlot, createBlock, Fragment, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
3
|
-
|
|
4
|
-
const _hoisted_1 = ["type", "disabled"];
|
|
5
|
-
const _hoisted_2 = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: /*#__PURE__*/normalizeClass(['absolute'])
|
|
8
|
-
};
|
|
9
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
10
|
-
const _component_OrLoader = resolveComponent("OrLoader");
|
|
11
|
-
return openBlock(), createElementBlock("button", mergeProps({
|
|
12
|
-
ref: "root"
|
|
13
|
-
}, _ctx.$attrs, {
|
|
14
|
-
class: _ctx.rootStyles,
|
|
15
|
-
type: _ctx.type,
|
|
16
|
-
disabled: _ctx.disabled,
|
|
17
|
-
onClick: _cache[0] || (_cache[0] = $event => _ctx.$emit('click', $event)),
|
|
18
|
-
onFocus: _cache[1] || (_cache[1] = $event => _ctx.$emit('focus', $event)),
|
|
19
|
-
onBlur: _cache[2] || (_cache[2] = $event => _ctx.$emit('blur', $event))
|
|
20
|
-
}), [createElementVNode("div", {
|
|
21
|
-
class: normalizeClass(['contents', _ctx.loading && 'invisible'])
|
|
22
|
-
}, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */), _ctx.loading ? (openBlock(), createElementBlock("div", _hoisted_2, [_ctx.variant !== 'link' ? (openBlock(), createBlock(_component_OrLoader, {
|
|
23
|
-
key: 0,
|
|
24
|
-
variant: 'circular',
|
|
25
|
-
color: 'inherit',
|
|
26
|
-
size: 's'
|
|
27
|
-
})) : (openBlock(), createElementBlock(Fragment, {
|
|
28
|
-
key: 1
|
|
29
|
-
}, [createTextVNode(toDisplayString(_ctx.loadingText) + "… ", 1 /* TEXT */)], 64 /* STABLE_FRAGMENT */))])) : createCommentVNode("v-if", true)], 16 /* FULL_PROPS */, _hoisted_1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
script.render = render;
|
|
33
|
-
script.__file = "src/components/or-button-v3/OrButton.vue";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { s as script } from './OrMenu.vue_vue_type_script_lang-2446a69a.js';
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock, mergeProps, createVNode, withCtx, createElementVNode, normalizeClass, withModifiers, renderSlot } from 'vue';
|
|
3
|
-
|
|
4
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5
|
-
const _component_OrPopover = resolveComponent("OrPopover");
|
|
6
|
-
return openBlock(), createElementBlock("div", mergeProps({
|
|
7
|
-
ref: "root"
|
|
8
|
-
}, _ctx.$attrs, {
|
|
9
|
-
class: _ctx.rootStyles
|
|
10
|
-
}), [createVNode(_component_OrPopover, {
|
|
11
|
-
ref: "popover",
|
|
12
|
-
variant: 'auto',
|
|
13
|
-
trigger: _ctx.trigger,
|
|
14
|
-
placement: _ctx.placement,
|
|
15
|
-
"full-width": false,
|
|
16
|
-
"disable-default-styles": false,
|
|
17
|
-
"onUpdate:state": _cache[1] || (_cache[1] = $event => _ctx.$emit('update:state', $event))
|
|
18
|
-
}, {
|
|
19
|
-
default: withCtx(() => [createElementVNode("div", {
|
|
20
|
-
class: normalizeClass(_ctx.bodyStyles),
|
|
21
|
-
onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
|
|
22
|
-
}, [renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)]),
|
|
23
|
-
|
|
24
|
-
_: 3 /* FORWARDED */
|
|
25
|
-
}, 8 /* PROPS */, ["trigger", "placement"])], 16 /* FULL_PROPS */);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
script.render = render;
|
|
29
|
-
script.__file = "src/components/or-menu-v3/OrMenu.vue";
|