@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.
Files changed (142) hide show
  1. package/dist/bundled/v2/{OrButton-0e91a808.js → OrButton-66d37aff.js} +14 -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/{OrConfirm-18c534df.js → OrConfirm-e1ca1422.js} +1 -1
  5. package/dist/bundled/v2/OrPagination-354e9abd.js +296 -0
  6. package/dist/bundled/v2/{OrSearch-19f43fe5.js → OrSearch-9d402f56.js} +2 -2
  7. package/dist/bundled/v2/{OrSelect-759b4410.js → OrSelect-1c9421ad.js} +3 -3
  8. package/dist/bundled/v2/{OrSortHeader-9932d28f.js → OrSortHeader-396e6a7c.js} +2 -2
  9. package/dist/bundled/v2/components/index.d.ts +1 -0
  10. package/dist/bundled/v2/components/index.js +8 -7
  11. package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
  12. package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
  13. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
  14. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
  15. package/dist/bundled/v2/components/or-card-collection-v3/index.js +4 -7
  16. package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +4 -5
  17. package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
  18. package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
  19. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  20. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
  21. package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +2 -0
  22. package/dist/bundled/v2/components/or-pagination-v3/index.js +20 -0
  23. package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +3 -0
  24. package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +4 -0
  25. package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
  26. package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  27. package/dist/bundled/v2/components/or-select-v3/index.d.ts +1 -0
  28. package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
  29. package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
  30. package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
  31. package/dist/bundled/v2/index.js +9 -8
  32. package/dist/bundled/v3/{OrButton-8ab33d9d.js → OrButton-9640286b.js} +3 -2
  33. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-3718b300.js → OrButton.vue_vue_type_script_lang-06d8ead1.js} +13 -1
  34. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +164 -0
  35. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-85472b12.js → OrConfirm.vue_vue_type_script_lang-f1b81f00.js} +2 -2
  36. package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-ff22b11c.js +180 -0
  37. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-cb2d6612.js → OrSearch.vue_vue_type_script_lang-ed78b21f.js} +1 -1
  38. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-dfadd12f.js → OrSelect.vue_vue_type_script_lang-d0626539.js} +2 -2
  39. package/dist/bundled/v3/components/index.d.ts +1 -0
  40. package/dist/bundled/v3/components/index.js +11 -10
  41. package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
  42. package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
  43. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
  44. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
  45. package/dist/bundled/v3/components/or-card-collection-v3/index.js +4 -11
  46. package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +4 -5
  47. package/dist/bundled/v3/components/or-confirm-v3/index.js +3 -3
  48. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  49. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
  50. package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +2 -0
  51. package/dist/bundled/v3/components/or-pagination-v3/index.js +22 -0
  52. package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +3 -0
  53. package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +4 -0
  54. package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
  55. package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  56. package/dist/bundled/v3/components/or-select-v3/index.d.ts +1 -0
  57. package/dist/bundled/v3/components/or-select-v3/index.js +1 -1
  58. package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
  59. package/dist/bundled/v3/index.js +354 -292
  60. package/dist/esm/v2/{OrButton-357a5756.js → OrButton-3d4fc9da.js} +14 -1
  61. package/dist/esm/v2/OrCardCollection-4f001551.js +227 -0
  62. package/dist/esm/v2/{OrConfirm-b0b2e43c.js → OrConfirm-ba3f8c45.js} +1 -1
  63. package/dist/esm/v2/OrPagination-a56eb93b.js +296 -0
  64. package/dist/esm/v2/{OrSelect-ac382aa6.js → OrSelect-ca2510cd.js} +3 -3
  65. package/dist/esm/v2/components/index.d.ts +1 -0
  66. package/dist/esm/v2/components/index.js +5 -4
  67. package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
  68. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  69. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
  70. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
  71. package/dist/esm/v2/components/or-card-collection-v3/index.js +4 -7
  72. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +4 -5
  73. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  74. package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  75. package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
  76. package/dist/esm/v2/components/or-pagination-v3/index.d.ts +2 -0
  77. package/dist/esm/v2/components/or-pagination-v3/index.js +18 -0
  78. package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +3 -0
  79. package/dist/esm/v2/components/or-pagination-v3/types.d.ts +4 -0
  80. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  81. package/dist/esm/v2/components/or-select-v3/index.d.ts +1 -0
  82. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  83. package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
  84. package/dist/esm/v2/index.js +5 -4
  85. package/dist/esm/v3/{OrButton-f4b9ee51.js → OrButton-970ae320.js} +15 -2
  86. package/dist/esm/v3/OrCardCollection-5a0febaf.js +198 -0
  87. package/dist/esm/v3/{OrConfirm-906427ef.js → OrConfirm-7cb2f36b.js} +1 -1
  88. package/dist/esm/v3/OrPagination-d351a13b.js +257 -0
  89. package/dist/esm/v3/{OrSelect-fee9c099.js → OrSelect-bff22c7f.js} +3 -3
  90. package/dist/esm/v3/components/index.d.ts +1 -0
  91. package/dist/esm/v3/components/index.js +5 -4
  92. package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
  93. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  94. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +0 -4
  95. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +37 -61
  96. package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -7
  97. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +4 -5
  98. package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
  99. package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  100. package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +110 -0
  101. package/dist/esm/v3/components/or-pagination-v3/index.d.ts +2 -0
  102. package/dist/esm/v3/components/or-pagination-v3/index.js +17 -0
  103. package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +3 -0
  104. package/dist/esm/v3/components/or-pagination-v3/types.d.ts +4 -0
  105. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  106. package/dist/esm/v3/components/or-select-v3/index.d.ts +1 -0
  107. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  108. package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
  109. package/dist/esm/v3/index.js +5 -4
  110. package/package.json +1 -1
  111. package/src/components/index.ts +1 -0
  112. package/src/components/or-button-v3/OrButton.stories3.ts +4 -0
  113. package/src/components/or-button-v3/OrButton.vue +6 -0
  114. package/src/components/or-button-v3/styles.ts +15 -1
  115. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +19 -160
  116. package/src/components/or-card-collection-v3/OrCardCollection.vue +74 -99
  117. package/src/components/or-card-collection-v3/styles.ts +1 -1
  118. package/src/components/or-card-collection-v3/types.ts +4 -5
  119. package/src/components/or-pagination-v3/OrPagination.docs.mdx +7 -0
  120. package/src/components/or-pagination-v3/OrPagination.stories3.ts +87 -0
  121. package/src/components/or-pagination-v3/OrPagination.vue +260 -0
  122. package/src/components/or-pagination-v3/index.ts +2 -0
  123. package/src/components/or-pagination-v3/styles.ts +30 -0
  124. package/src/components/or-pagination-v3/types.ts +4 -0
  125. package/src/components/or-select-v3/OrSelect.vue +3 -3
  126. package/src/components/or-select-v3/index.ts +1 -0
  127. package/src/components/or-select-v3/types.ts +1 -1
  128. package/dist/bundled/v2/OrCardCollection-a8d5ce32.js +0 -328
  129. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
  130. package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
  131. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-f9f329a2.js +0 -224
  132. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
  133. package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
  134. package/dist/esm/v2/OrCardCollection-95b051e1.js +0 -328
  135. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +0 -35
  136. package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +0 -4
  137. package/dist/esm/v3/OrCardCollection-afd863fc.js +0 -274
  138. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +0 -35
  139. package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +0 -4
  140. package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +0 -41
  141. package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +0 -42
  142. 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
- <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
97
- <OrCardCollection
98
- v-bind="args"
99
- @viewChange="onViewChange"
100
- @sortChange="onSortChange"
101
- @searchChange="onSearchChange"
102
- >
103
- <template #item="{item, mode}">
104
- <OrCard>${args.item} ({{mode}})</OrCard>
105
- </template>
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
- item: '{{ item.label }}',
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
- key: item.toLowerCase(),
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
- sort: 'Bar',
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="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
- {{ proxySort }}
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)"
30
- >
31
- {{ sortItem }}
32
- </OrMenuItem>
33
- </OrMenu>
16
+ {{ header.label }}
17
+ </OrSortHeader>
34
18
  </template>
35
19
  </div>
36
20
 
37
- <div
38
- :class="toolbarPanelStyles"
39
- >
40
- <OrSearch
41
- class="md:w-[350px]"
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
- <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>
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
- <slot
60
- :name="proxyView"
61
- v-bind="{items}"
62
- >
63
- <OrCardCollectionView
64
- :items="items"
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="item"
70
- v-bind="props"
50
+ name="gridItem"
51
+ v-bind="item"
71
52
  />
72
- </template>
73
- </OrCardCollectionView>
74
- </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>
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 { OrMenuV3 as OrMenu } from '../or-menu-v3';
83
- import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
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
- CardCollectionRoot,
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
- OrCardCollectionView,
86
+ OrCard,
102
87
  OrIconButton,
103
- OrButton,
104
- OrMenu,
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<string>,
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: String,
106
+ type: Object as PropType<SortHeaderModel>,
130
107
  default: undefined,
131
108
  },
132
109
 
133
- sortOptions: {
134
- type: Array as PropType<string[]>,
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 switchView(view: string): void {
184
- proxyView.value = view;
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 handleSearch(search: string) {
191
- proxySearch.value = search;
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
- switchView,
230
- handleSort,
231
- handleSearch,
205
+ switchToGridView,
206
+ switchToListView,
232
207
  };
233
208
  },
234
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,9 +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;
5
+ export interface CardCollectionSortHeader {
6
+ value: string;
7
+ label: string;
9
8
  }
@@ -0,0 +1,7 @@
1
+ import { DocsPage } from '@storybook/addon-docs';
2
+
3
+ ```ts
4
+ import { OrPaginationV3 as OrPagination } from '@onereach/ui-components';
5
+ ```
6
+
7
+ <DocsPage />
@@ -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
+ };