@onereach/ui-components 2.69.1-beta.2095.0 → 2.69.1-beta.2099.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 (151) hide show
  1. package/dist/bundled/v2/{OrButton-66d37aff.js → OrButton-0e91a808.js} +1 -14
  2. package/dist/bundled/v2/{OrCard-58a1ba3e.js → OrCard-29116e1f.js} +2 -2
  3. package/dist/bundled/v2/OrCardCollection-953657a7.js +347 -0
  4. package/dist/bundled/v2/{OrConfirm-e1ca1422.js → OrConfirm-18c534df.js} +1 -1
  5. package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-a11b3621.js} +9 -3
  6. package/dist/bundled/v2/{OrSelect-1c9421ad.js → OrSelect-759b4410.js} +3 -3
  7. package/dist/bundled/v2/{OrSortHeader-396e6a7c.js → OrSortHeader-9932d28f.js} +2 -2
  8. package/dist/bundled/v2/components/index.d.ts +0 -1
  9. package/dist/bundled/v2/components/index.js +7 -8
  10. package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
  11. package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
  12. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +5 -0
  13. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +65 -39
  14. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
  15. package/dist/bundled/v2/components/or-card-collection-v3/constatnts.d.ts +4 -0
  16. package/dist/bundled/v2/components/or-card-collection-v3/index.js +7 -4
  17. package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +8 -3
  18. package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
  19. package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
  20. package/dist/bundled/v2/components/or-search-v3/OrSearch.vue.d.ts +13 -0
  21. package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
  22. package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  23. package/dist/bundled/v2/components/or-select-v3/index.d.ts +0 -1
  24. package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
  25. package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
  26. package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
  27. package/dist/bundled/v2/index.js +8 -9
  28. package/dist/bundled/v3/{OrButton-9640286b.js → OrButton-8ab33d9d.js} +2 -3
  29. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-06d8ead1.js → OrButton.vue_vue_type_script_lang-3718b300.js} +1 -13
  30. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-4debae8a.js +229 -0
  31. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-f1b81f00.js → OrConfirm.vue_vue_type_script_lang-85472b12.js} +2 -2
  32. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-0ae8a6dd.js} +8 -2
  33. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-d0626539.js → OrSelect.vue_vue_type_script_lang-dfadd12f.js} +2 -2
  34. package/dist/bundled/v3/components/index.d.ts +0 -1
  35. package/dist/bundled/v3/components/index.js +10 -11
  36. package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
  37. package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
  38. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +5 -0
  39. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +65 -39
  40. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
  41. package/dist/bundled/v3/components/or-card-collection-v3/constatnts.d.ts +4 -0
  42. package/dist/bundled/v3/components/or-card-collection-v3/index.js +11 -4
  43. package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +8 -3
  44. package/dist/bundled/v3/components/or-confirm-v3/index.js +3 -3
  45. package/dist/bundled/v3/components/or-search-v3/OrSearch.vue.d.ts +13 -0
  46. package/dist/bundled/v3/components/or-search-v3/index.js +1 -1
  47. package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  48. package/dist/bundled/v3/components/or-select-v3/index.d.ts +0 -1
  49. package/dist/bundled/v3/components/or-select-v3/index.js +1 -1
  50. package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
  51. package/dist/bundled/v3/index.js +300 -351
  52. package/dist/esm/v2/{OrButton-3d4fc9da.js → OrButton-357a5756.js} +1 -14
  53. package/dist/esm/v2/OrCardCollection-55e282a7.js +347 -0
  54. package/dist/esm/v2/{OrConfirm-ba3f8c45.js → OrConfirm-b0b2e43c.js} +1 -1
  55. package/dist/esm/v2/{OrSearch-ddb7c1fe.js → OrSearch-62d91301.js} +7 -1
  56. package/dist/esm/v2/{OrSelect-ca2510cd.js → OrSelect-ac382aa6.js} +3 -3
  57. package/dist/esm/v2/components/index.d.ts +0 -1
  58. package/dist/esm/v2/components/index.js +5 -6
  59. package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
  60. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  61. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +5 -0
  62. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +65 -39
  63. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
  64. package/dist/esm/v2/components/or-card-collection-v3/constatnts.d.ts +4 -0
  65. package/dist/esm/v2/components/or-card-collection-v3/index.js +7 -4
  66. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +8 -3
  67. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  68. package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +13 -0
  69. package/dist/esm/v2/components/or-search-v3/index.js +1 -1
  70. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  71. package/dist/esm/v2/components/or-select-v3/index.d.ts +0 -1
  72. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  73. package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
  74. package/dist/esm/v2/index.js +5 -6
  75. package/dist/esm/v3/{OrButton-970ae320.js → OrButton-f4b9ee51.js} +2 -15
  76. package/dist/esm/v3/OrCardCollection-0c6da4b8.js +290 -0
  77. package/dist/esm/v3/{OrConfirm-7cb2f36b.js → OrConfirm-906427ef.js} +1 -1
  78. package/dist/esm/v3/{OrSearch-cdde55ce.js → OrSearch-aafb93b4.js} +7 -1
  79. package/dist/esm/v3/{OrSelect-bff22c7f.js → OrSelect-fee9c099.js} +3 -3
  80. package/dist/esm/v3/components/index.d.ts +0 -1
  81. package/dist/esm/v3/components/index.js +5 -6
  82. package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
  83. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  84. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +5 -0
  85. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +65 -39
  86. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
  87. package/dist/esm/v3/components/or-card-collection-v3/constatnts.d.ts +4 -0
  88. package/dist/esm/v3/components/or-card-collection-v3/index.js +7 -4
  89. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +8 -3
  90. package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
  91. package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +13 -0
  92. package/dist/esm/v3/components/or-search-v3/index.js +1 -1
  93. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -14
  94. package/dist/esm/v3/components/or-select-v3/index.d.ts +0 -1
  95. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  96. package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
  97. package/dist/esm/v3/index.js +5 -6
  98. package/package.json +1 -1
  99. package/src/components/index.ts +0 -1
  100. package/src/components/or-button-v3/OrButton.stories3.ts +0 -4
  101. package/src/components/or-button-v3/OrButton.vue +0 -6
  102. package/src/components/or-button-v3/styles.ts +1 -15
  103. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +229 -28
  104. package/src/components/or-card-collection-v3/OrCardCollection.vue +119 -76
  105. package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +41 -0
  106. package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +42 -0
  107. package/src/components/or-card-collection-v3/constatnts.ts +12 -0
  108. package/src/components/or-card-collection-v3/styles.ts +1 -1
  109. package/src/components/or-card-collection-v3/types.ts +9 -3
  110. package/src/components/or-search-v3/OrSearch.vue +7 -1
  111. package/src/components/or-select-v3/OrSelect.vue +3 -3
  112. package/src/components/or-select-v3/index.ts +0 -1
  113. package/src/components/or-select-v3/types.ts +1 -1
  114. package/dist/bundled/v2/OrCardCollection-a9a779ea.js +0 -228
  115. package/dist/bundled/v2/OrPagination-354e9abd.js +0 -296
  116. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  117. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
  118. package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +0 -2
  119. package/dist/bundled/v2/components/or-pagination-v3/index.js +0 -20
  120. package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +0 -3
  121. package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +0 -4
  122. package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +0 -164
  123. package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-ff22b11c.js +0 -180
  124. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  125. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
  126. package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +0 -2
  127. package/dist/bundled/v3/components/or-pagination-v3/index.js +0 -22
  128. package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +0 -3
  129. package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +0 -4
  130. package/dist/esm/v2/OrCardCollection-4f001551.js +0 -227
  131. package/dist/esm/v2/OrPagination-a56eb93b.js +0 -296
  132. package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  133. package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
  134. package/dist/esm/v2/components/or-pagination-v3/index.d.ts +0 -2
  135. package/dist/esm/v2/components/or-pagination-v3/index.js +0 -18
  136. package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +0 -3
  137. package/dist/esm/v2/components/or-pagination-v3/types.d.ts +0 -4
  138. package/dist/esm/v3/OrCardCollection-5a0febaf.js +0 -198
  139. package/dist/esm/v3/OrPagination-d351a13b.js +0 -257
  140. package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  141. package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -110
  142. package/dist/esm/v3/components/or-pagination-v3/index.d.ts +0 -2
  143. package/dist/esm/v3/components/or-pagination-v3/index.js +0 -17
  144. package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +0 -3
  145. package/dist/esm/v3/components/or-pagination-v3/types.d.ts +0 -4
  146. package/src/components/or-pagination-v3/OrPagination.docs.mdx +0 -7
  147. package/src/components/or-pagination-v3/OrPagination.stories3.ts +0 -87
  148. package/src/components/or-pagination-v3/OrPagination.vue +0 -260
  149. package/src/components/or-pagination-v3/index.ts +0 -2
  150. package/src/components/or-pagination-v3/styles.ts +0 -30
  151. package/src/components/or-pagination-v3/types.ts +0 -4
@@ -0,0 +1,12 @@
1
+ import { ViewMode } from './types';
2
+
3
+ export const gridView: ViewMode = {
4
+ view: 'grid',
5
+ icon: 'grid_view',
6
+ };
7
+ export const listView: ViewMode = {
8
+ view: 'list',
9
+ icon: 'view_agenda',
10
+ };
11
+
12
+ export const defaultViewModes = [gridView, listView];
@@ -25,7 +25,7 @@ export const CardCollectionToolbarPanel: string[] = [
25
25
  'layout-row',
26
26
 
27
27
  // Spacing
28
- 'gap-sm+',
28
+ 'gap-lg+',
29
29
  ];
30
30
 
31
31
  export const CardCollectionContent: string[] = [
@@ -1,8 +1,14 @@
1
1
  export interface CardCollectionItem {
2
- id: string;
2
+ key?: string;
3
+ [key: string|number]: any;
3
4
  }
4
5
 
5
- export interface CardCollectionSortHeader {
6
- value: string;
6
+ export interface ViewMode {
7
+ view: string;
8
+ icon: string;
9
+ }
10
+
11
+ export interface SortOption {
7
12
  label: string;
13
+ value: string;
8
14
  }
@@ -35,6 +35,12 @@ export default defineComponent({
35
35
  inheritAttrs: false,
36
36
 
37
37
  props: {
38
+ modelValue: {
39
+ type: String,
40
+ default: '',
41
+ required: false,
42
+ },
43
+
38
44
  size: {
39
45
  type: String as PropType<SearchSize>,
40
46
  default: SearchSize.M,
@@ -90,7 +96,7 @@ export default defineComponent({
90
96
  ]);
91
97
 
92
98
  // State
93
- const localModelValue = ref('');
99
+ const localModelValue = ref(props.modelValue ?? '');
94
100
 
95
101
  // Events
96
102
  debouncedWatch(
@@ -38,7 +38,7 @@
38
38
  @focus="$emit('focus', $event)"
39
39
  @blur="$emit('blur', $event)"
40
40
  >
41
- <template v-if="proxyModelValue !== undefined">
41
+ <template v-if="proxyModelValue && proxyModelValue.length > 0">
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, Number, Array] as PropType<string | number | (string | number)[]>,
268
+ type: [String, Array] as PropType<string | string[]>,
269
269
  default: undefined,
270
270
  },
271
271
 
272
272
  value: { // TODO: Remove Vue 2 fallback
273
- type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
273
+ type: [String, Array] as PropType<string | string[]>,
274
274
  default: undefined,
275
275
  },
276
276
 
@@ -1,3 +1,2 @@
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 | number;
2
+ value: string;
3
3
  label: string;
4
4
  }
5
5
 
@@ -1,228 +0,0 @@
1
- import './index-fa6eb4ca.js';
2
- import { O as OrCard } from './OrCard-58a1ba3e.js';
3
- import { O as OrIconButton } from './OrIconButton-a215104c.js';
4
- import { O as OrInput } from './OrInput-8b90e08f.js';
5
- import { O as OrSortHeader } from './OrSortHeader-396e6a7c.js';
6
- import { u as useClassAttribute } from './useClassAttribute-9bf33346.js';
7
- import { defineComponent, ref, computed, watch } from '@vue/composition-api/dist/vue-composition-api.mjs';
8
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
9
-
10
- var CardCollectionView;
11
- (function (CardCollectionView) {
12
- CardCollectionView["Grid"] = "grid";
13
- CardCollectionView["List"] = "list";
14
- })(CardCollectionView || (CardCollectionView = {}));
15
-
16
- const CardCollectionRoot = [
17
- // Layout
18
- 'layout-column',
19
- // Spacing
20
- 'gap-md'];
21
- const CardCollectionToolbar = [
22
- // Layout
23
- 'layout-row justify-between',
24
- // Typography
25
- 'typography-body-2-regular',
26
- // Theme
27
- 'theme-foreground-default', 'dark:theme-foreground-default-dark'];
28
- const CardCollectionToolbarPanel = [
29
- // Layout
30
- 'layout-row',
31
- // Spacing
32
- 'gap-sm+'];
33
- const CardCollectionContent = [
34
- // Layout
35
- 'grid',
36
- // Spacing
37
- 'gap-sm md:gap-md'];
38
- const CardCollectionContentViews = {
39
- 'grid': [
40
- // Layout
41
- 'sm:grid-cols-1', 'md:grid-cols-2', 'lg:grid-cols-4', 'xl:grid-cols-6'],
42
- 'list': []
43
- };
44
-
45
- var script = defineComponent({
46
- name: 'OrCardCollection',
47
- components: {
48
- OrCard,
49
- OrIconButton,
50
- OrInput,
51
- OrSortHeader
52
- },
53
- inheritAttrs: false,
54
- props: {
55
- items: {
56
- type: Array,
57
- default: []
58
- },
59
- view: {
60
- type: String,
61
- default: CardCollectionView.Grid
62
- },
63
- sort: {
64
- type: Object,
65
- default: undefined
66
- },
67
- sortHeaders: {
68
- type: Array,
69
- default: undefined
70
- },
71
- search: {
72
- type: String,
73
- default: undefined
74
- }
75
- },
76
- emits: ['viewChange', 'sortChange', 'searchChange'],
77
- expose: ['root'],
78
- setup(props, context) {
79
- // Refs
80
- const root = ref();
81
- // Styles
82
- const classAttribute = useClassAttribute();
83
- const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
84
- const toolbarStyles = computed(() => [...CardCollectionToolbar]);
85
- const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
86
- const contentStyles = computed(() => [...CardCollectionContent, ...CardCollectionContentViews[proxyView.value]]);
87
- // State
88
- const proxyView = ref(props.view);
89
- const proxySort = ref(props.sort);
90
- const proxySearch = ref(props.search);
91
- // Methods
92
- function switchToGridView() {
93
- proxyView.value = CardCollectionView.Grid;
94
- }
95
- function switchToListView() {
96
- proxyView.value = CardCollectionView.List;
97
- }
98
- // Effects
99
- watch(() => props.view, value => {
100
- proxyView.value = value;
101
- });
102
- watch(proxyView, value => {
103
- context.emit('viewChange', value);
104
- });
105
- watch(() => props.sort, value => {
106
- proxySort.value = value;
107
- });
108
- watch(proxySort, value => {
109
- context.emit('sortChange', value);
110
- });
111
- watch(() => props.search, value => {
112
- proxySearch.value = value;
113
- });
114
- watch(proxySearch, value => {
115
- context.emit('searchChange', value);
116
- });
117
- return {
118
- root,
119
- rootStyles,
120
- toolbarStyles,
121
- toolbarPanelStyles,
122
- contentStyles,
123
- proxyView,
124
- proxySort,
125
- proxySearch,
126
- switchToGridView,
127
- switchToListView
128
- };
129
- }
130
- });
131
-
132
- /* script */
133
- const __vue_script__ = script;
134
-
135
- /* template */
136
- var __vue_render__ = function () {
137
- var _vm = this;
138
- var _h = _vm.$createElement;
139
- var _c = _vm._self._c || _h;
140
- return _c('div', _vm._b({
141
- ref: "root",
142
- class: _vm.rootStyles
143
- }, 'div', _vm.$attrs, false), [_c('div', {
144
- class: _vm.toolbarStyles
145
- }, [_c('div', {
146
- class: _vm.toolbarPanelStyles
147
- }, [_vm.sortHeaders ? _vm._l(_vm.sortHeaders, function (header) {
148
- return _c('OrSortHeader', {
149
- key: header.value,
150
- attrs: {
151
- "input-value": header.value
152
- },
153
- model: {
154
- value: _vm.proxySort,
155
- callback: function ($$v) {
156
- _vm.proxySort = $$v;
157
- },
158
- expression: "proxySort"
159
- }
160
- }, [_vm._v("\n " + _vm._s(header.label) + "\n ")]);
161
- }) : _vm._e()], 2), _vm._v(" "), _c('div', {
162
- class: _vm.toolbarPanelStyles
163
- }, [_c('OrInput', {
164
- attrs: {
165
- "type": 'search',
166
- "placeholder": 'Search',
167
- "size": 's'
168
- },
169
- model: {
170
- value: _vm.proxySearch,
171
- callback: function ($$v) {
172
- _vm.proxySearch = $$v;
173
- },
174
- expression: "proxySearch"
175
- }
176
- }), _vm._v(" "), _c('OrIconButton', {
177
- attrs: {
178
- "icon": 'grid_view'
179
- },
180
- on: {
181
- "click": function ($event) {
182
- return _vm.switchToGridView();
183
- }
184
- }
185
- }), _vm._v(" "), _c('OrIconButton', {
186
- attrs: {
187
- "icon": 'view_list'
188
- },
189
- on: {
190
- "click": function ($event) {
191
- return _vm.switchToListView();
192
- }
193
- }
194
- }), _vm._v(" "), _vm._t("addon")], 2)]), _vm._v(" "), _c('div', {
195
- class: _vm.contentStyles
196
- }, [_vm.proxyView === 'grid' ? _vm._l(_vm.items, function (item) {
197
- return _c('OrCard', {
198
- key: item.id
199
- }, [_vm._t("gridItem", null, null, item)], 2);
200
- }) : _vm._e(), _vm._v(" "), _vm.proxyView === 'list' ? _vm._l(_vm.items, function (item) {
201
- return _c('OrCard', {
202
- key: item.id
203
- }, [_vm._t("listItem", null, null, item)], 2);
204
- }) : _vm._e()], 2)]);
205
- };
206
- var __vue_staticRenderFns__ = [];
207
-
208
- /* style */
209
- const __vue_inject_styles__ = undefined;
210
- /* scoped */
211
- const __vue_scope_id__ = undefined;
212
- /* module identifier */
213
- const __vue_module_identifier__ = undefined;
214
- /* functional template */
215
- const __vue_is_functional_template__ = false;
216
- /* style inject */
217
-
218
- /* style inject SSR */
219
-
220
- /* style inject shadow dom */
221
-
222
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
223
- render: __vue_render__,
224
- staticRenderFns: __vue_staticRenderFns__
225
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
226
- var __vue_component__$1 = __vue_component__;
227
-
228
- export { CardCollectionView as C, __vue_component__$1 as _ };
@@ -1,296 +0,0 @@
1
- import './index-fa6eb4ca.js';
2
- import { O as OrButton } from './OrButton-66d37aff.js';
3
- import { O as OrIcon } from './OrIcon-8625385f.js';
4
- import { O as OrMenu } from './OrMenu-fa47c888.js';
5
- import { O as OrMenuItem } from './OrMenuItem-26420908.js';
6
- import { u as useClassAttribute } from './useClassAttribute-9bf33346.js';
7
- import { defineComponent, ref, computed } from '@vue/composition-api/dist/vue-composition-api.mjs';
8
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
9
-
10
- const PaginationRoot = [
11
- // Layout
12
- 'layout-row',
13
- // Spacing
14
- 'gap-xl',
15
- // Typography
16
- 'typography-caption-regular',
17
- // Theme
18
- 'theme-foreground-outline', 'dark:theme-foreground-outline-dark'];
19
- const PaginationOffsetControl = [
20
- // Layout
21
- 'layout-row',
22
- // Spacing
23
- 'gap-md'];
24
- const PaginationLimitControl = [
25
- // Layout
26
- 'layout-row',
27
- // Spacing
28
- 'gap-sm'];
29
-
30
- var script = defineComponent({
31
- name: 'OrPagination',
32
- components: {
33
- OrButton,
34
- OrIcon,
35
- OrMenu,
36
- OrMenuItem
37
- },
38
- inheritAttrs: false,
39
- props: {
40
- modelValue: {
41
- type: Object,
42
- default: {}
43
- },
44
- value: {
45
- type: Object,
46
- default: {}
47
- },
48
- length: {
49
- type: Number,
50
- required: true
51
- },
52
- pageSizeOptions: {
53
- type: Array,
54
- default: [50, 20, 10, 5]
55
- }
56
- },
57
- emits: ['update:modelValue', 'input'],
58
- expose: ['root'],
59
- setup(props, context) {
60
- // Refs
61
- const root = ref();
62
- const limitButton = ref();
63
- const limitButtonRoot = computed(() => {
64
- var _a;
65
- return (_a = limitButton.value) === null || _a === void 0 ? void 0 : _a.root;
66
- });
67
- const limitMenu = ref();
68
- const limitMenuRoot = computed(() => {
69
- var _a;
70
- return (_a = limitMenu.value) === null || _a === void 0 ? void 0 : _a.root;
71
- });
72
- // Styles
73
- const classAttribute = useClassAttribute();
74
- const rootStyles = computed(() => ['or-pagination', ...PaginationRoot, classAttribute.value]);
75
- const offsetControlStyles = computed(() => [...PaginationOffsetControl]);
76
- const limitControlStyles = computed(() => [...PaginationLimitControl]);
77
- // State
78
- const proxyModelValue = computed({
79
- get: () => {
80
- var _a;
81
- return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
82
- },
83
-
84
- set: value => {
85
- context.emit('input', value);
86
- context.emit('update:modelValue', value);
87
- }
88
- });
89
- const currentLimit = computed({
90
- get: () => {
91
- var _a;
92
- return (_a = proxyModelValue.value.limit) !== null && _a !== void 0 ? _a : props.pageSizeOptions[0];
93
- },
94
- set: value => {
95
- proxyModelValue.value = {
96
- limit: value,
97
- offset: currentOffset.value
98
- };
99
- }
100
- });
101
- const currentOffset = computed({
102
- get: () => {
103
- var _a;
104
- return (_a = proxyModelValue.value.offset) !== null && _a !== void 0 ? _a : 0;
105
- },
106
- set: value => {
107
- proxyModelValue.value = {
108
- limit: currentLimit.value,
109
- offset: value
110
- };
111
- }
112
- });
113
- const currentPage = computed({
114
- get: () => {
115
- return Math.floor(currentOffset.value / currentLimit.value) + 1;
116
- },
117
- set: value => {
118
- currentOffset.value = (value - 1) * currentLimit.value;
119
- }
120
- });
121
- const firstPage = computed(() => {
122
- return 1;
123
- });
124
- const lastPage = computed(() => {
125
- return Math.ceil(props.length / currentLimit.value);
126
- });
127
- const buttonGroup = computed(() => {
128
- return Array.from({
129
- length: lastPage.value
130
- }, (_, index) => index + 1).map(page => {
131
- switch (true) {
132
- case page > firstPage.value && page < currentPage.value - 1:
133
- case page > currentPage.value + 1 && page < lastPage.value:
134
- return '…';
135
- default:
136
- return page;
137
- }
138
- }).reduce((accumulator, page) => {
139
- if (accumulator[accumulator.length - 1] === page) {
140
- return accumulator;
141
- }
142
- return [...accumulator, page];
143
- }, []);
144
- });
145
- // Functions
146
- function toPreviousPage() {
147
- currentPage.value = currentPage.value - 1;
148
- }
149
- function toNextPage() {
150
- currentPage.value = currentPage.value + 1;
151
- }
152
- function toPage(page) {
153
- currentPage.value = page;
154
- }
155
- return {
156
- root,
157
- limitButton,
158
- limitButtonRoot,
159
- limitMenu,
160
- limitMenuRoot,
161
- rootStyles,
162
- offsetControlStyles,
163
- limitControlStyles,
164
- proxyModelValue,
165
- currentLimit,
166
- currentOffset,
167
- currentPage,
168
- firstPage,
169
- lastPage,
170
- buttonGroup,
171
- toPreviousPage,
172
- toNextPage,
173
- toPage
174
- };
175
- }
176
- });
177
-
178
- /* script */
179
- const __vue_script__ = script;
180
-
181
- /* template */
182
- var __vue_render__ = function () {
183
- var _vm = this;
184
- var _h = _vm.$createElement;
185
- var _c = _vm._self._c || _h;
186
- return _c('div', _vm._b({
187
- ref: "root",
188
- class: _vm.rootStyles
189
- }, 'div', _vm.$attrs, false), [_c('div', {
190
- class: _vm.offsetControlStyles
191
- }, [_c('OrButton', {
192
- attrs: {
193
- "variant": 'link',
194
- "color": 'inherit',
195
- "disabled": _vm.currentPage === _vm.firstPage
196
- },
197
- on: {
198
- "click": function ($event) {
199
- $event.stopPropagation();
200
- return _vm.toPreviousPage();
201
- }
202
- }
203
- }, [_c('OrIcon', {
204
- attrs: {
205
- "icon": 'keyboard_arrow_left'
206
- }
207
- })], 1), _vm._v(" "), _vm._l(_vm.buttonGroup, function (page, index) {
208
- return _c('OrButton', {
209
- key: index,
210
- attrs: {
211
- "variant": 'link',
212
- "color": 'inherit',
213
- "activated": _vm.currentPage === page
214
- },
215
- on: {
216
- "click": function ($event) {
217
- $event.stopPropagation();
218
- typeof page === 'number' && _vm.toPage(page);
219
- }
220
- }
221
- }, [_vm._v("\n " + _vm._s(page) + "\n ")]);
222
- }), _vm._v(" "), _c('OrButton', {
223
- attrs: {
224
- "variant": 'link',
225
- "color": 'inherit',
226
- "disabled": _vm.currentPage === _vm.lastPage
227
- },
228
- on: {
229
- "click": function ($event) {
230
- $event.stopPropagation();
231
- return _vm.toNextPage();
232
- }
233
- }
234
- }, [_c('OrIcon', {
235
- attrs: {
236
- "icon": 'keyboard_arrow_right'
237
- }
238
- })], 1)], 2), _vm._v(" "), _c('div', {
239
- class: _vm.limitControlStyles
240
- }, [_vm._v("\n Per page:\n\n "), _c('OrButton', {
241
- ref: "limitButton",
242
- attrs: {
243
- "variant": 'link',
244
- "color": 'inherit',
245
- "activated": true
246
- },
247
- on: {
248
- "click": function ($event) {
249
- $event.stopPropagation();
250
- return _vm.limitMenu.open();
251
- }
252
- }
253
- }, [_vm._v("\n " + _vm._s(_vm.currentLimit) + " "), _c('OrIcon', {
254
- attrs: {
255
- "icon": 'arrow_drop_down'
256
- }
257
- })], 1), _vm._v(" "), _c('OrMenu', {
258
- ref: "limitMenu",
259
- attrs: {
260
- "trigger": _vm.limitButtonRoot
261
- }
262
- }, _vm._l(_vm.pageSizeOptions, function (pageSize) {
263
- return _c('OrMenuItem', {
264
- key: pageSize,
265
- on: {
266
- "click": function ($event) {
267
- $event.stopPropagation();
268
- _vm.currentLimit = pageSize;
269
- }
270
- }
271
- }, [_vm._v("\n " + _vm._s(pageSize) + "\n ")]);
272
- }), 1)], 1)]);
273
- };
274
- var __vue_staticRenderFns__ = [];
275
-
276
- /* style */
277
- const __vue_inject_styles__ = undefined;
278
- /* scoped */
279
- const __vue_scope_id__ = undefined;
280
- /* module identifier */
281
- const __vue_module_identifier__ = undefined;
282
- /* functional template */
283
- const __vue_is_functional_template__ = false;
284
- /* style inject */
285
-
286
- /* style inject SSR */
287
-
288
- /* style inject shadow dom */
289
-
290
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
291
- render: __vue_render__,
292
- staticRenderFns: __vue_staticRenderFns__
293
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
294
- var __vue_component__$1 = __vue_component__;
295
-
296
- export { __vue_component__$1 as _ };
@@ -1,12 +0,0 @@
1
- import { Meta, StoryFn } from '@storybook/vue3';
2
- declare const _default: Meta<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
3
- [x: string]: ((...args: any[]) => any) | null;
4
- } | string[], {} & {}, {
5
- [x: number]: string;
6
- } | {}, true>)>;
7
- export default _default;
8
- export declare const Default: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
9
- [x: string]: ((...args: any[]) => any) | null;
10
- } | string[], {} & {}, {
11
- [x: number]: string;
12
- } | {}, true>)>;