@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
@@ -0,0 +1,260 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ >
7
+ <div :class="offsetControlStyles">
8
+ <OrButton
9
+ :variant="'link'"
10
+ :color="'inherit'"
11
+ :disabled="currentPage === firstPage"
12
+ @click.stop="toPreviousPage()"
13
+ >
14
+ <OrIcon :icon="'keyboard_arrow_left'" />
15
+ </OrButton>
16
+
17
+ <OrButton
18
+ v-for="(page, index) in buttonGroup"
19
+ :key="index"
20
+ :variant="'link'"
21
+ :color="'inherit'"
22
+ :activated="currentPage === page"
23
+ @click.stop="typeof page === 'number' && toPage(page)"
24
+ >
25
+ {{ page }}
26
+ </OrButton>
27
+
28
+ <OrButton
29
+ :variant="'link'"
30
+ :color="'inherit'"
31
+ :disabled="currentPage === lastPage"
32
+ @click.stop="toNextPage()"
33
+ >
34
+ <OrIcon :icon="'keyboard_arrow_right'" />
35
+ </OrButton>
36
+ </div>
37
+
38
+ <div :class="limitControlStyles">
39
+ Per page:
40
+
41
+ <OrButton
42
+ ref="limitButton"
43
+ :variant="'link'"
44
+ :color="'inherit'"
45
+ :activated="true"
46
+ @click.stop="limitMenu.open()"
47
+ >
48
+ {{ currentLimit }} <OrIcon :icon="'arrow_drop_down'" />
49
+ </OrButton>
50
+
51
+ <OrMenu
52
+ ref="limitMenu"
53
+ :trigger="limitButtonRoot"
54
+ >
55
+ <OrMenuItem
56
+ v-for="pageSize in pageSizeOptions"
57
+ :key="pageSize"
58
+ @click.stop="currentLimit = pageSize"
59
+ >
60
+ {{ pageSize }}
61
+ </OrMenuItem>
62
+ </OrMenu>
63
+ </div>
64
+ </div>
65
+ </template>
66
+
67
+ <script lang="ts">
68
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
69
+ import { useClassAttribute } from '../../hooks';
70
+ import { OrButtonV3 as OrButton } from '../or-button-v3';
71
+ import { OrIconV3 as OrIcon } from '../or-icon-v3';
72
+ import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
73
+ import { OrMenuV3 as OrMenu } from '../or-menu-v3';
74
+ import { PaginationLimitControl, PaginationOffsetControl, PaginationRoot } from './styles';
75
+ import { PaginationModel } from './types';
76
+
77
+ export default defineComponent({
78
+ name: 'OrPagination',
79
+
80
+ components: {
81
+ OrButton,
82
+ OrIcon,
83
+ OrMenu,
84
+ OrMenuItem,
85
+ },
86
+
87
+ inheritAttrs: false,
88
+
89
+ props: {
90
+ modelValue: {
91
+ type: Object as PropType<PaginationModel>,
92
+ default: {} as PaginationModel,
93
+ },
94
+
95
+ value: { // TODO: Remove Vue 2 fallback
96
+ type: Object as PropType<PaginationModel>,
97
+ default: {} as PaginationModel,
98
+ },
99
+
100
+ length: {
101
+ type: Number,
102
+ required: true,
103
+ },
104
+
105
+ pageSizeOptions: {
106
+ type: Array as PropType<number[]>,
107
+ default: [50, 20, 10, 5] as number[],
108
+ },
109
+ },
110
+
111
+ emits: [
112
+ 'update:modelValue',
113
+
114
+ 'input',
115
+ ],
116
+
117
+ expose: [
118
+ 'root',
119
+ ],
120
+
121
+ setup(props, context) {
122
+ // Refs
123
+ const root = ref<HTMLElement>();
124
+
125
+ const limitButton = ref<InstanceType<typeof OrButton>>();
126
+ const limitButtonRoot = computed(() => limitButton.value?.root);
127
+
128
+ const limitMenu = ref<InstanceType<typeof OrMenu>>();
129
+ const limitMenuRoot = computed(() => limitMenu.value?.root);
130
+
131
+ // Styles
132
+ const classAttribute = useClassAttribute();
133
+
134
+ const rootStyles = computed(() => [
135
+ 'or-pagination',
136
+ ...PaginationRoot,
137
+ classAttribute.value,
138
+ ]);
139
+
140
+ const offsetControlStyles = computed(() => [
141
+ ...PaginationOffsetControl,
142
+ ]);
143
+
144
+ const limitControlStyles = computed(() => [
145
+ ...PaginationLimitControl,
146
+ ]);
147
+
148
+ // State
149
+ const proxyModelValue = computed({
150
+ get: () => {
151
+ return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
152
+ },
153
+
154
+ set: (value) => {
155
+ context.emit('input', value);
156
+ context.emit('update:modelValue', value);
157
+ },
158
+ });
159
+
160
+ const currentLimit = computed<number>({
161
+ get: () => {
162
+ return proxyModelValue.value.limit ?? props.pageSizeOptions[0];
163
+ },
164
+
165
+ set: (value) => {
166
+ proxyModelValue.value = {
167
+ limit: value,
168
+ offset: currentOffset.value,
169
+ };
170
+ },
171
+ });
172
+
173
+ const currentOffset = computed<number>({
174
+ get: () => {
175
+ return proxyModelValue.value.offset ?? 0;
176
+ },
177
+
178
+ set: (value) => {
179
+ proxyModelValue.value = {
180
+ limit: currentLimit.value,
181
+ offset: value,
182
+ };
183
+ },
184
+ });
185
+
186
+ const currentPage = computed<number>({
187
+ get: () => {
188
+ return Math.floor(currentOffset.value / currentLimit.value) + 1;
189
+ },
190
+
191
+ set: (value) => {
192
+ currentOffset.value = (value - 1) * currentLimit.value;
193
+ },
194
+ });
195
+
196
+ const firstPage = computed<number>(() => {
197
+ return 1;
198
+ });
199
+
200
+ const lastPage = computed<number>(() => {
201
+ return Math.ceil(props.length / currentLimit.value);
202
+ });
203
+
204
+ const buttonGroup = computed<(number | string)[]>(() => {
205
+ return Array.from({ length: lastPage.value }, (_, index) => index + 1)
206
+ .map((page) => {
207
+ switch (true) {
208
+ case page > firstPage.value && page < currentPage.value - 1:
209
+ case page > currentPage.value + 1 && page < lastPage.value:
210
+ return '…';
211
+
212
+ default:
213
+ return page;
214
+ }
215
+ })
216
+ .reduce((accumulator, page) => {
217
+ if (accumulator[accumulator.length - 1] === page) {
218
+ return accumulator;
219
+ }
220
+
221
+ return [...accumulator, page];
222
+ }, [] as (number | string)[]);
223
+ });
224
+
225
+ // Functions
226
+ function toPreviousPage(): void {
227
+ currentPage.value = currentPage.value - 1;
228
+ }
229
+
230
+ function toNextPage(): void {
231
+ currentPage.value = currentPage.value + 1;
232
+ }
233
+
234
+ function toPage(page: number): void {
235
+ currentPage.value = page;
236
+ }
237
+
238
+ return {
239
+ root,
240
+ limitButton,
241
+ limitButtonRoot,
242
+ limitMenu,
243
+ limitMenuRoot,
244
+ rootStyles,
245
+ offsetControlStyles,
246
+ limitControlStyles,
247
+ proxyModelValue,
248
+ currentLimit,
249
+ currentOffset,
250
+ currentPage,
251
+ firstPage,
252
+ lastPage,
253
+ buttonGroup,
254
+ toPreviousPage,
255
+ toNextPage,
256
+ toPage,
257
+ };
258
+ },
259
+ });
260
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as OrPaginationV3 } from './OrPagination.vue';
2
+ export * from './types';
@@ -0,0 +1,30 @@
1
+ export const PaginationRoot: string[] = [
2
+ // Layout
3
+ 'layout-row',
4
+
5
+ // Spacing
6
+ 'gap-xl',
7
+
8
+ // Typography
9
+ 'typography-caption-regular',
10
+
11
+ // Theme
12
+ 'theme-foreground-outline',
13
+ 'dark:theme-foreground-outline-dark',
14
+ ];
15
+
16
+ export const PaginationOffsetControl: string[] = [
17
+ // Layout
18
+ 'layout-row',
19
+
20
+ // Spacing
21
+ 'gap-md',
22
+ ];
23
+
24
+ export const PaginationLimitControl: string[] = [
25
+ // Layout
26
+ 'layout-row',
27
+
28
+ // Spacing
29
+ 'gap-sm',
30
+ ];
@@ -0,0 +1,4 @@
1
+ export interface PaginationModel {
2
+ limit: number;
3
+ offset: number;
4
+ }
@@ -38,7 +38,7 @@
38
38
  @focus="$emit('focus', $event)"
39
39
  @blur="$emit('blur', $event)"
40
40
  >
41
- <template v-if="proxyModelValue && proxyModelValue.length > 0">
41
+ <template v-if="proxyModelValue !== undefined">
42
42
  <template v-if="multiple">
43
43
  <slot
44
44
  name="valueTemplate"
@@ -265,12 +265,12 @@ export default defineComponent({
265
265
  },
266
266
 
267
267
  modelValue: {
268
- type: [String, Array] as PropType<string | string[]>,
268
+ type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
269
269
  default: undefined,
270
270
  },
271
271
 
272
272
  value: { // TODO: Remove Vue 2 fallback
273
- type: [String, Array] as PropType<string | string[]>,
273
+ type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
274
274
  default: undefined,
275
275
  },
276
276
 
@@ -1,2 +1,3 @@
1
1
  export { default as OrSelectV3 } from './OrSelect.vue';
2
2
  export * from './props';
3
+ export * from './types';
@@ -1,5 +1,5 @@
1
1
  export interface SelectOption {
2
- value: string;
2
+ value: string | number;
3
3
  label: string;
4
4
  }
5
5
 
@@ -1,328 +0,0 @@
1
- import './index-fa6eb4ca.js';
2
- import { defineComponent, computed, ref, watch } from '@vue/composition-api/dist/vue-composition-api.mjs';
3
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
4
- import { O as OrIconButton } from './OrIconButton-a215104c.js';
5
- import { O as OrButton } from './OrButton-0e91a808.js';
6
- import { O as OrMenu } from './OrMenu-fa47c888.js';
7
- import { O as OrMenuItem } from './OrMenuItem-26420908.js';
8
- import { O as OrIcon } from './OrIcon-8625385f.js';
9
- import { O as OrSearch } from './OrSearch-19f43fe5.js';
10
- import { u as useClassAttribute } from './useClassAttribute-9bf33346.js';
11
-
12
- var CardCollectionView;
13
- (function (CardCollectionView) {
14
- CardCollectionView["Grid"] = "grid";
15
- CardCollectionView["List"] = "list";
16
- })(CardCollectionView || (CardCollectionView = {}));
17
-
18
- const CardCollectionRoot = [
19
- // Layout
20
- 'layout-column',
21
- // Spacing
22
- 'gap-md'];
23
- const CardCollectionToolbar = [
24
- // Layout
25
- 'layout-row justify-between',
26
- // Typography
27
- 'typography-body-2-regular',
28
- // Theme
29
- 'theme-foreground-default', 'dark:theme-foreground-default-dark'];
30
- const CardCollectionToolbarPanel = [
31
- // Layout
32
- 'layout-row',
33
- // Spacing
34
- 'gap-lg+'];
35
- const CardCollectionContent = [
36
- // Layout
37
- 'grid',
38
- // Spacing
39
- 'gap-sm md:gap-md'];
40
- const CardCollectionContentViews = {
41
- 'grid': [
42
- // Layout
43
- 'sm:grid-cols-1', 'md:grid-cols-2', 'lg:grid-cols-4', 'xl:grid-cols-6'],
44
- 'list': []
45
- };
46
-
47
- var script$1 = defineComponent({
48
- name: 'OrCardCollectionView',
49
- props: {
50
- items: {
51
- type: Array,
52
- default: []
53
- },
54
- mode: {
55
- type: String,
56
- required: true
57
- }
58
- },
59
- setup(props) {
60
- const contentStyles = computed(() => [...CardCollectionContent, ...CardCollectionContentViews[props.mode]]);
61
- return {
62
- contentStyles
63
- };
64
- }
65
- });
66
-
67
- /* script */
68
- const __vue_script__$1 = script$1;
69
-
70
- /* template */
71
- var __vue_render__$1 = function () {
72
- var _vm = this;
73
- var _h = _vm.$createElement;
74
- var _c = _vm._self._c || _h;
75
- return _c('div', {
76
- class: _vm.contentStyles
77
- }, [_vm._l(_vm.items, function (item) {
78
- return _vm._t("item", function () {
79
- return [_vm._v("\n " + _vm._s(item.key) + "\n ")];
80
- }, null, {
81
- item: item,
82
- mode: _vm.mode
83
- });
84
- })], 2);
85
- };
86
- var __vue_staticRenderFns__$1 = [];
87
-
88
- /* style */
89
- const __vue_inject_styles__$1 = undefined;
90
- /* scoped */
91
- const __vue_scope_id__$1 = undefined;
92
- /* module identifier */
93
- const __vue_module_identifier__$1 = undefined;
94
- /* functional template */
95
- const __vue_is_functional_template__$1 = false;
96
- /* style inject */
97
-
98
- /* style inject SSR */
99
-
100
- /* style inject shadow dom */
101
-
102
- const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
103
- render: __vue_render__$1,
104
- staticRenderFns: __vue_staticRenderFns__$1
105
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
106
- var OrCardCollectionView = __vue_component__$2;
107
-
108
- const gridView = {
109
- view: 'grid',
110
- icon: 'grid_view'
111
- };
112
- const listView = {
113
- view: 'list',
114
- icon: 'view_agenda'
115
- };
116
- const defaultViewModes = [gridView, listView];
117
-
118
- var script = defineComponent({
119
- name: 'OrCardCollection',
120
- components: {
121
- OrCardCollectionView,
122
- OrIconButton,
123
- OrButton,
124
- OrMenu,
125
- OrMenuItem,
126
- OrIcon,
127
- OrSearch
128
- },
129
- inheritAttrs: false,
130
- props: {
131
- items: {
132
- type: Array,
133
- default: []
134
- },
135
- view: {
136
- type: String,
137
- default: CardCollectionView.Grid
138
- },
139
- viewModes: {
140
- type: Array,
141
- default: () => defaultViewModes
142
- },
143
- sort: {
144
- type: String,
145
- default: undefined
146
- },
147
- sortOptions: {
148
- type: Array,
149
- default: () => []
150
- },
151
- search: {
152
- type: String,
153
- default: undefined
154
- }
155
- },
156
- emits: ['viewChange', 'sortChange', 'searchChange'],
157
- expose: ['root'],
158
- setup(props, context) {
159
- // Refs
160
- const root = ref();
161
- const sortMenu = ref();
162
- const sortButton = ref();
163
- // Styles
164
- const classAttribute = useClassAttribute();
165
- const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
166
- const toolbarStyles = computed(() => [...CardCollectionToolbar]);
167
- const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
168
- // State
169
- const proxyView = ref(props.view);
170
- const proxySort = ref(props.sort);
171
- const proxySearch = ref(props.search);
172
- // Methods
173
- function switchView(view) {
174
- proxyView.value = view;
175
- }
176
- function handleSort(sort) {
177
- proxySort.value = sort;
178
- }
179
- function handleSearch(search) {
180
- proxySearch.value = search;
181
- }
182
- // Effects
183
- watch(() => props.view, value => {
184
- proxyView.value = value;
185
- });
186
- watch(proxyView, value => {
187
- context.emit('viewChange', value);
188
- });
189
- watch(() => props.sort, value => {
190
- proxySort.value = value;
191
- });
192
- watch(proxySort, value => {
193
- context.emit('sortChange', value);
194
- });
195
- watch(() => props.search, value => {
196
- proxySearch.value = value;
197
- });
198
- watch(proxySearch, value => {
199
- context.emit('searchChange', value);
200
- });
201
- return {
202
- root,
203
- sortMenu,
204
- sortButton,
205
- rootStyles,
206
- toolbarStyles,
207
- toolbarPanelStyles,
208
- proxyView,
209
- proxySort,
210
- proxySearch,
211
- switchView,
212
- handleSort,
213
- handleSearch
214
- };
215
- }
216
- });
217
-
218
- /* script */
219
- const __vue_script__ = script;
220
-
221
- /* template */
222
- var __vue_render__ = function () {
223
- var _vm = this;
224
- var _h = _vm.$createElement;
225
- var _c = _vm._self._c || _h;
226
- return _c('div', _vm._b({
227
- ref: "root",
228
- class: _vm.rootStyles
229
- }, 'div', _vm.$attrs, false), [_c('div', {
230
- class: _vm.toolbarStyles
231
- }, [_c('div', {
232
- class: _vm.toolbarPanelStyles
233
- }, [_vm.sortOptions.length ? [_c('OrButton', {
234
- ref: "sortButton",
235
- attrs: {
236
- "variant": "link",
237
- "color": "inherit"
238
- },
239
- on: {
240
- "click": function ($event) {
241
- return _vm.sortMenu.toggle();
242
- }
243
- }
244
- }, [_vm._v("\n " + _vm._s(_vm.proxySort) + "\n "), _vm.sortMenu ? _c('OrIcon', {
245
- attrs: {
246
- "icon": _vm.sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'
247
- }
248
- }) : _vm._e()], 1), _vm._v(" "), _c('OrMenu', {
249
- ref: "sortMenu",
250
- attrs: {
251
- "trigger": _vm.sortButton && _vm.sortButton.root
252
- }
253
- }, _vm._l(_vm.sortOptions, function (sortItem) {
254
- return _c('OrMenuItem', {
255
- key: sortItem,
256
- on: {
257
- "click": function ($event) {
258
- return _vm.handleSort(sortItem);
259
- }
260
- }
261
- }, [_vm._v("\n " + _vm._s(sortItem) + "\n ")]);
262
- }), 1)] : _vm._e()], 2), _vm._v(" "), _c('div', {
263
- class: _vm.toolbarPanelStyles
264
- }, [_c('OrSearch', {
265
- staticClass: "md:w-[350px]",
266
- attrs: {
267
- "size": "s"
268
- },
269
- on: {
270
- "search": _vm.handleSearch
271
- }
272
- }), _vm._v(" "), _c('div', {
273
- staticClass: "layout-row gap-sm"
274
- }, [_vm.viewModes.length > 1 ? _vm._l(_vm.viewModes, function (viewOption) {
275
- return _c('OrIconButton', {
276
- key: viewOption.view,
277
- attrs: {
278
- "icon": {
279
- icon: viewOption.icon,
280
- variant: viewOption.view === _vm.proxyView ? 'filled' : 'outlined'
281
- }
282
- },
283
- on: {
284
- "click": function ($event) {
285
- return _vm.switchView(viewOption.view);
286
- }
287
- }
288
- });
289
- }) : _vm._e(), _vm._v(" "), _vm._t("addon")], 2)], 1)]), _vm._v(" "), _vm._t(_vm.proxyView, function () {
290
- return [_c('OrCardCollectionView', {
291
- attrs: {
292
- "items": _vm.items,
293
- "mode": _vm.proxyView
294
- },
295
- scopedSlots: _vm._u([{
296
- key: "item",
297
- fn: function (props) {
298
- return [_vm._t("item", null, null, props)];
299
- }
300
- }], null, true)
301
- })];
302
- }, null, {
303
- items: _vm.items
304
- })], 2);
305
- };
306
- var __vue_staticRenderFns__ = [];
307
-
308
- /* style */
309
- const __vue_inject_styles__ = undefined;
310
- /* scoped */
311
- const __vue_scope_id__ = undefined;
312
- /* module identifier */
313
- const __vue_module_identifier__ = undefined;
314
- /* functional template */
315
- const __vue_is_functional_template__ = false;
316
- /* style inject */
317
-
318
- /* style inject SSR */
319
-
320
- /* style inject shadow dom */
321
-
322
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
323
- render: __vue_render__,
324
- staticRenderFns: __vue_staticRenderFns__
325
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
326
- var __vue_component__$1 = __vue_component__;
327
-
328
- export { CardCollectionView as C, __vue_component__$1 as _ };
@@ -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,4 +0,0 @@
1
- import { ViewMode } from './types';
2
- export declare const gridView: ViewMode;
3
- export declare const listView: ViewMode;
4
- export declare const defaultViewModes: ViewMode[];