@onereach/ui-components 4.12.0 → 4.12.1-beta.2983.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 (160) hide show
  1. package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.js +26 -62
  2. package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +2 -25
  3. package/dist/bundled/v2/components/OrCardCollectionV3/index.js +6 -4
  4. package/dist/bundled/v2/components/OrCardCollectionV3/styles.js +6 -5
  5. package/dist/bundled/v2/components/OrCardCollectionV3/types.d.ts +0 -4
  6. package/dist/bundled/v2/components/OrDatePickerV3/OrDatePicker.js +1 -1
  7. package/dist/bundled/v2/components/OrDatePickerV3/index.js +1 -1
  8. package/dist/bundled/v2/components/OrDateTimePickerV3/OrDateTimePicker.js +1 -1
  9. package/dist/bundled/v2/components/OrDateTimePickerV3/index.js +1 -1
  10. package/dist/bundled/v2/components/OrMenuItemV3/styles.js +3 -1
  11. package/dist/bundled/v2/components/OrSortingV3/OrSortingV3.js +160 -0
  12. package/dist/bundled/v2/components/OrSortingV3/OrSortingV3.vue.d.ts +69 -0
  13. package/dist/bundled/v2/components/OrSortingV3/index.d.ts +2 -0
  14. package/dist/bundled/v2/components/OrSortingV3/index.js +34 -0
  15. package/dist/bundled/v2/components/OrSortingV3/styles.d.ts +2 -0
  16. package/dist/bundled/v2/components/OrSortingV3/styles.js +6 -0
  17. package/dist/bundled/v2/components/OrSortingV3/types.d.ts +4 -0
  18. package/dist/bundled/v2/components/index.d.ts +1 -1
  19. package/dist/bundled/v2/components/index.js +3 -3
  20. package/dist/bundled/v2/index.js +4 -4
  21. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-9d20dd3c.js → OrCardCollection.vue_vue_type_script_lang-9597e400.js} +5 -30
  22. package/dist/bundled/v3/{OrDatePicker.vue_vue_type_script_lang-d94c33ca.js → OrDatePicker.vue_vue_type_script_lang-04af0e24.js} +1 -1
  23. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-46b1735a.js → OrDateTimePicker.vue_vue_type_script_lang-ec06a304.js} +1 -1
  24. package/dist/bundled/v3/{OrDateTimePickerMonthSelect-57340c1e.js → OrDateTimePickerMonthSelect-1e284be4.js} +1 -1
  25. package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-32a27808.js → OrPagination.vue_vue_type_script_lang-f4c61af9.js} +1 -1
  26. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-69c5cd67.js → OrSelect.vue_vue_type_script_lang-fe9a7e7c.js} +1 -1
  27. package/dist/bundled/v3/OrSortingV3.vue_vue_type_script_lang-1bb22099.js +68 -0
  28. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-e9ea6c28.js → OrTabs.vue_vue_type_script_lang-366b95d9.js} +1 -1
  29. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +26 -51
  30. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +2 -5
  31. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +10 -7
  32. package/dist/bundled/v3/components/OrCardCollectionV3/styles.js +6 -5
  33. package/dist/bundled/v3/components/OrCardCollectionV3/types.d.ts +0 -4
  34. package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.js +4 -4
  35. package/dist/bundled/v3/components/OrDatePickerV3/index.js +3 -3
  36. package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.js +4 -4
  37. package/dist/bundled/v3/components/OrDateTimePickerV3/index.js +3 -3
  38. package/dist/bundled/v3/components/OrMenuItemV3/OrMenuItem.js +2 -2
  39. package/dist/bundled/v3/components/OrMenuItemV3/index.js +1 -1
  40. package/dist/bundled/v3/components/OrMenuItemV3/styles.js +3 -1
  41. package/dist/bundled/v3/components/OrPaginationV3/OrPagination.js +3 -3
  42. package/dist/bundled/v3/components/OrPaginationV3/index.js +2 -2
  43. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +3 -3
  44. package/dist/bundled/v3/components/OrSelectV3/index.js +2 -2
  45. package/dist/bundled/v3/components/OrSortingV3/OrSortingV3.js +88 -0
  46. package/dist/bundled/v3/components/OrSortingV3/OrSortingV3.vue.d.ts +36 -0
  47. package/dist/bundled/v3/components/OrSortingV3/index.d.ts +2 -0
  48. package/dist/bundled/v3/components/OrSortingV3/index.js +42 -0
  49. package/dist/bundled/v3/components/OrSortingV3/styles.d.ts +2 -0
  50. package/dist/bundled/v3/components/OrSortingV3/styles.js +6 -0
  51. package/dist/bundled/v3/components/OrSortingV3/types.d.ts +4 -0
  52. package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +3 -3
  53. package/dist/bundled/v3/components/OrTabsV3/index.js +2 -2
  54. package/dist/bundled/v3/components/index.d.ts +1 -1
  55. package/dist/bundled/v3/components/index.js +12 -11
  56. package/dist/bundled/v3/index.js +15 -15
  57. package/dist/esm/v2/{OrCardCollection-d29b850c.js → OrCardCollection-4e2fba5e.js} +24 -65
  58. package/dist/esm/v2/{OrDatePicker-365c393c.js → OrDatePicker-078c3498.js} +1 -1
  59. package/dist/esm/v2/{OrDateTimePicker-665b1585.js → OrDateTimePicker-22febde1.js} +1 -1
  60. package/dist/esm/v2/{OrDateTimePicker.vue_rollup-plugin-vue_script-a59d2087.js → OrDateTimePicker.vue_rollup-plugin-vue_script-f843a18d.js} +1 -1
  61. package/dist/esm/v2/{OrDateTimePickerPopoverHeader-3a99a29d.js → OrDateTimePickerPopoverHeader-f4dabe74.js} +1 -1
  62. package/dist/esm/v2/{OrMenuItem-b5bb6e11.js → OrMenuItem-8af38fc8.js} +3 -1
  63. package/dist/esm/v2/{OrPagination-b9a941dd.js → OrPagination-05a1c01b.js} +1 -1
  64. package/dist/esm/v2/{OrSelect-9893819d.js → OrSelect-925d2b50.js} +1 -1
  65. package/dist/esm/v2/OrSortingV3-6b5f1b51.js +139 -0
  66. package/dist/esm/v2/{OrTabs-80db5b36.js → OrTabs-e5b6986c.js} +1 -1
  67. package/dist/esm/v2/{OrTimePicker-13232692.js → OrTimePicker-3860cda8.js} +2 -2
  68. package/dist/esm/v2/components/index.d.ts +1 -1
  69. package/dist/esm/v2/components/index.js +11 -11
  70. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +2 -25
  71. package/dist/esm/v2/components/or-card-collection-v3/index.js +8 -7
  72. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +0 -4
  73. package/dist/esm/v2/components/or-date-picker-v3/index.js +3 -3
  74. package/dist/esm/v2/components/or-date-time-picker-v3/index.js +4 -4
  75. package/dist/esm/v2/components/or-menu-item-v3/index.js +1 -1
  76. package/dist/esm/v2/components/or-pagination-v3/index.js +2 -2
  77. package/dist/esm/v2/components/or-select-v3/index.js +2 -2
  78. package/dist/esm/v2/components/or-sorting-v3/OrSortingV3.vue.d.ts +69 -0
  79. package/dist/esm/v2/components/or-sorting-v3/index.d.ts +2 -0
  80. package/dist/esm/v2/components/or-sorting-v3/index.js +20 -0
  81. package/dist/esm/v2/components/or-sorting-v3/styles.d.ts +2 -0
  82. package/dist/esm/v2/components/or-sorting-v3/types.d.ts +4 -0
  83. package/dist/esm/v2/components/or-tabs-v3/index.js +2 -2
  84. package/dist/esm/v2/components/or-time-picker-v3/index.js +4 -4
  85. package/dist/esm/v2/index.js +11 -11
  86. package/dist/esm/v3/{OrCardCollection-305a9a2d.js → OrCardCollection-46544ba3.js} +25 -75
  87. package/dist/esm/v3/{OrDatePicker-aac79bce.js → OrDatePicker-4b5a93ad.js} +1 -1
  88. package/dist/esm/v3/{OrDateTimePicker-5a1af2fe.js → OrDateTimePicker-091fe6ac.js} +1 -1
  89. package/dist/esm/v3/{OrDateTimePickerPopoverHeader-a478e254.js → OrDateTimePickerPopoverHeader-be89989e.js} +1 -1
  90. package/dist/esm/v3/{OrMenuItem-331cb96b.js → OrMenuItem-e2344d0e.js} +3 -1
  91. package/dist/esm/v3/{OrPagination-1018acbc.js → OrPagination-a3904a4d.js} +1 -1
  92. package/dist/esm/v3/{OrSelect-a310d8be.js → OrSelect-0ef072dc.js} +1 -1
  93. package/dist/esm/v3/OrSortingV3-1ac9a2d5.js +115 -0
  94. package/dist/esm/v3/{OrTabs-328f5a69.js → OrTabs-3457d575.js} +1 -1
  95. package/dist/esm/v3/{OrTimePicker-aaf59858.js → OrTimePicker-c4b02958.js} +2 -2
  96. package/dist/esm/v3/components/index.d.ts +1 -1
  97. package/dist/esm/v3/components/index.js +10 -10
  98. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +2 -5
  99. package/dist/esm/v3/components/or-card-collection-v3/index.js +8 -7
  100. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +0 -4
  101. package/dist/esm/v3/components/or-date-picker-v3/index.js +3 -3
  102. package/dist/esm/v3/components/or-date-time-picker-v3/index.js +3 -3
  103. package/dist/esm/v3/components/or-menu-item-v3/index.js +1 -1
  104. package/dist/esm/v3/components/or-pagination-v3/index.js +2 -2
  105. package/dist/esm/v3/components/or-select-v3/index.js +2 -2
  106. package/dist/esm/v3/components/or-sorting-v3/OrSortingV3.vue.d.ts +36 -0
  107. package/dist/esm/v3/components/or-sorting-v3/index.d.ts +2 -0
  108. package/dist/esm/v3/components/or-sorting-v3/index.js +19 -0
  109. package/dist/esm/v3/components/or-sorting-v3/styles.d.ts +2 -0
  110. package/dist/esm/v3/components/or-sorting-v3/types.d.ts +4 -0
  111. package/dist/esm/v3/components/or-tabs-v3/index.js +2 -2
  112. package/dist/esm/v3/components/or-time-picker-v3/index.js +4 -4
  113. package/dist/esm/v3/index.js +10 -10
  114. package/package.json +2 -3
  115. package/src/components/index.ts +1 -1
  116. package/src/components/or-card-collection-v3/OrCardCollection.vue +17 -58
  117. package/src/components/or-card-collection-v3/styles.ts +6 -8
  118. package/src/components/or-card-collection-v3/types.ts +0 -5
  119. package/src/components/or-menu-item-v3/styles.ts +3 -0
  120. package/src/components/or-sorting-v3/OrSortingV3.vue +116 -0
  121. package/src/components/or-sorting-v3/index.ts +2 -0
  122. package/src/components/or-sorting-v3/styles.ts +5 -0
  123. package/src/components/or-sorting-v3/types.ts +4 -0
  124. package/dist/bundled/v2/components/OrSortHeaderV3/OrSortHeader.js +0 -109
  125. package/dist/bundled/v2/components/OrSortHeaderV3/OrSortHeader.vue.d.ts +0 -46
  126. package/dist/bundled/v2/components/OrSortHeaderV3/index.d.ts +0 -2
  127. package/dist/bundled/v2/components/OrSortHeaderV3/index.js +0 -8
  128. package/dist/bundled/v2/components/OrSortHeaderV3/styles.d.ts +0 -1
  129. package/dist/bundled/v2/components/OrSortHeaderV3/styles.js +0 -15
  130. package/dist/bundled/v2/components/OrSortHeaderV3/types.d.ts +0 -4
  131. package/dist/bundled/v3/OrSortHeader.vue_vue_type_script_lang-a444d88b.js +0 -57
  132. package/dist/bundled/v3/components/OrSortHeaderV3/OrSortHeader.js +0 -30
  133. package/dist/bundled/v3/components/OrSortHeaderV3/OrSortHeader.vue.d.ts +0 -34
  134. package/dist/bundled/v3/components/OrSortHeaderV3/index.d.ts +0 -2
  135. package/dist/bundled/v3/components/OrSortHeaderV3/index.js +0 -9
  136. package/dist/bundled/v3/components/OrSortHeaderV3/styles.d.ts +0 -1
  137. package/dist/bundled/v3/components/OrSortHeaderV3/styles.js +0 -15
  138. package/dist/bundled/v3/components/OrSortHeaderV3/types.d.ts +0 -4
  139. package/dist/esm/v2/OrSortHeader-46a92f09.js +0 -123
  140. package/dist/esm/v2/components/or-sort-header-v3/OrSortHeader.vue.d.ts +0 -46
  141. package/dist/esm/v2/components/or-sort-header-v3/index.d.ts +0 -2
  142. package/dist/esm/v2/components/or-sort-header-v3/index.js +0 -8
  143. package/dist/esm/v2/components/or-sort-header-v3/styles.d.ts +0 -1
  144. package/dist/esm/v2/components/or-sort-header-v3/types.d.ts +0 -4
  145. package/dist/esm/v3/OrSortHeader-21a443f9.js +0 -93
  146. package/dist/esm/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +0 -34
  147. package/dist/esm/v3/components/or-sort-header-v3/index.d.ts +0 -2
  148. package/dist/esm/v3/components/or-sort-header-v3/index.js +0 -8
  149. package/dist/esm/v3/components/or-sort-header-v3/styles.d.ts +0 -1
  150. package/dist/esm/v3/components/or-sort-header-v3/types.d.ts +0 -4
  151. package/src/components/or-sort-header-v3/OrSortHeader.docs.mdx +0 -3
  152. package/src/components/or-sort-header-v3/OrSortHeader.stories3.ts +0 -125
  153. package/src/components/or-sort-header-v3/OrSortHeader.vue +0 -95
  154. package/src/components/or-sort-header-v3/index.ts +0 -2
  155. package/src/components/or-sort-header-v3/styles.ts +0 -21
  156. package/src/components/or-sort-header-v3/types.ts +0 -4
  157. /package/dist/bundled/v2/{OrDateTimePickerMonthSelect-232c4dda.js → OrDateTimePickerMonthSelect-2e61ba21.js} +0 -0
  158. /package/dist/bundled/v2/components/{OrSortHeaderV3 → OrSortingV3}/types.js +0 -0
  159. /package/dist/bundled/v3/{OrMenuItem.vue_vue_type_script_lang-f35dcab4.js → OrMenuItem.vue_vue_type_script_lang-8f6994d5.js} +0 -0
  160. /package/dist/bundled/v3/components/{OrSortHeaderV3 → OrSortingV3}/types.js +0 -0
@@ -6,30 +6,11 @@
6
6
  <div :class="toolbarStyles">
7
7
  <div :class="toolbarPanelStyles">
8
8
  <template v-if="sortOptions.length">
9
- <OrButton
10
- ref="sortButton"
11
- variant="link"
12
- color="inherit"
13
- @click="sortMenu.toggle()"
14
- >
15
- {{ sortLabel }}
16
- <OrIcon
17
- v-if="sortMenu"
18
- :icon="sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'"
19
- />
20
- </OrButton>
21
- <OrMenu
22
- ref="sortMenu"
23
- :trigger="sortButton && sortButton.root"
24
- >
25
- <OrMenuItem
26
- v-for="sortItem in sortOptions"
27
- :key="sortItem"
28
- @click="handleSort(sortItem.value)"
29
- >
30
- {{ sortItem.label }}
31
- </OrMenuItem>
32
- </OrMenu>
9
+ <OrSorting
10
+ :sort="sort"
11
+ :options="sortOptions"
12
+ @change="$emit('sortChange', $event)"
13
+ />
33
14
  </template>
34
15
  </div>
35
16
  <div
@@ -40,20 +21,22 @@
40
21
  class="md:w-[350px]"
41
22
  :placeholder="searchPlaceholder"
42
23
  :debounce="searchDebounce"
43
- size="s"
44
24
  @search="handleSearch"
45
25
  />
46
- <div class="layout-row gap-sm">
47
- <template v-if="viewModes.length > 1">
26
+
27
+ <template v-if="viewModes.length > 1">
28
+ <div class="layout-row gap-sm">
48
29
  <OrIconButton
49
30
  v-for="viewOption in viewModes"
50
31
  :key="viewOption.view"
51
- :icon="{icon: viewOption.icon, variant: viewOption.view === proxyView ? 'filled' : 'outlined'}"
32
+ size="l"
33
+ :icon="{icon: viewOption.icon}"
34
+ :selected="viewOption.view === proxyView"
52
35
  @click="switchView(viewOption.view)"
53
36
  />
54
- </template>
55
- <slot name="addon" />
56
- </div>
37
+ </div>
38
+ </template>
39
+ <slot name="addon" />
57
40
  </div>
58
41
  </div>
59
42
 
@@ -95,16 +78,13 @@
95
78
 
96
79
  <script lang="ts">
97
80
  import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
98
- import { OrButtonV3 as OrButton } from '../or-button-v3';
99
81
  import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
100
- import { OrIconV3 as OrIcon } from '../or-icon-v3';
101
- import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
102
- import { OrMenuV3 as OrMenu } from '../or-menu-v3';
103
82
  import { OrSearchV3 as OrSearch } from '../or-search-v3';
104
83
  import OrCardCollectionView from './partials/OrCardCollectionView.vue3.vue';
84
+ import { OrSortingV3 as OrSorting, SortOption } from '../or-sorting-v3';
105
85
  import { defaultViewModes, gridView } from './props';
106
86
  import { CardCollectionRoot, CardCollectionToolbar, CardCollectionToolbarPanel } from './styles';
107
- import { CardCollectionItem, SortOption, ViewMode } from './types';
87
+ import { CardCollectionItem, ViewMode } from './types';
108
88
 
109
89
  export default defineComponent({
110
90
  name: 'OrCardCollection',
@@ -112,10 +92,7 @@ export default defineComponent({
112
92
  components: {
113
93
  OrCardCollectionView,
114
94
  OrIconButton,
115
- OrButton,
116
- OrMenu,
117
- OrMenuItem,
118
- OrIcon,
95
+ OrSorting,
119
96
  OrSearch,
120
97
  },
121
98
 
@@ -174,8 +151,6 @@ export default defineComponent({
174
151
  setup(props, context) {
175
152
  // Refs
176
153
  const root = ref<HTMLElement>();
177
- const sortMenu = ref<typeof OrMenu>();
178
- const sortButton = ref<typeof OrButton>();
179
154
 
180
155
  // Styles
181
156
  const rootStyles = computed(() => [
@@ -197,16 +172,12 @@ export default defineComponent({
197
172
 
198
173
  // State
199
174
  const proxyView = ref(props.view);
200
- const proxySort = ref(props.sort);
201
175
  const proxySearch = ref(props.search);
202
176
 
203
177
  // Methods
204
178
  function switchView(view: string): void {
205
179
  proxyView.value = view;
206
180
  }
207
- function handleSort(sort: string) {
208
- proxySort.value = sort;
209
- }
210
181
 
211
182
  function handleSearch(search: string) {
212
183
  proxySearch.value = search;
@@ -221,14 +192,6 @@ export default defineComponent({
221
192
  context.emit('viewChange', value);
222
193
  });
223
194
 
224
- watch(() => props.sort, (value) => {
225
- proxySort.value = value;
226
- });
227
-
228
- watch(proxySort, (value) => {
229
- context.emit('sortChange', value);
230
- });
231
-
232
195
  watch(() => props.search, (value) => {
233
196
  proxySearch.value = value;
234
197
  });
@@ -239,17 +202,13 @@ export default defineComponent({
239
202
 
240
203
  return {
241
204
  root,
242
- sortMenu,
243
- sortButton,
244
205
  rootStyles,
245
206
  toolbarStyles,
246
207
  toolbarPanelStyles,
247
208
  proxyView,
248
- proxySort,
249
209
  proxySearch,
250
210
  sortLabel,
251
211
  switchView,
252
- handleSort,
253
212
  handleSearch,
254
213
  };
255
214
  },
@@ -7,9 +7,6 @@ export const CardCollectionRoot: string[] = [
7
7
  // Spacing
8
8
  'gap-md',
9
9
  'max-h-full',
10
-
11
- // Overflow
12
- 'overflow-hidden',
13
10
  ];
14
11
 
15
12
  export const CardCollectionToolbar: string[] = [
@@ -40,16 +37,17 @@ export const CardCollectionContent: string[] = [
40
37
  'gap-sm md:gap-md',
41
38
 
42
39
  // Overflow
43
- 'overflow-auto',
40
+ 'overflow-y-auto',
41
+ 'p-xs*',
42
+ '-m-xs*',
43
+ // '-mr-sm*',
44
44
  ];
45
45
 
46
46
  export const CardCollectionContentViews: Record<DefaultCardCollectionViews, string[]> = {
47
47
  'grid': [
48
48
  // Layout
49
- 'sm:grid-cols-1',
50
- 'md:grid-cols-2',
51
- 'lg:grid-cols-4',
52
- 'xl:grid-cols-6',
49
+ 'grid-cols-1',
50
+ 'md:grid-cols-5',
53
51
  ],
54
52
 
55
53
  'list': [
@@ -7,8 +7,3 @@ export interface ViewMode {
7
7
  view: string;
8
8
  icon: string;
9
9
  }
10
-
11
- export interface SortOption {
12
- label: string;
13
- value: string;
14
- }
@@ -31,4 +31,7 @@ export const MenuItemRoot: string[] = [
31
31
  // Theme (active)
32
32
  'active:theme-foreground-default',
33
33
  'dark:active:theme-foreground-default-dark',
34
+
35
+ // Theme (selected)
36
+ 'selected:text-on-background dark:selected:text-on-background-dark',
34
37
  ];
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div
3
+ :ref="root"
4
+ :class="rootStyles"
5
+ >
6
+ <OrButton
7
+ ref="sortButton"
8
+ variant="link"
9
+ color="primary"
10
+ @click="sortMenu.toggle()"
11
+ >
12
+ <span
13
+ :class="sortLabelStyles"
14
+ >
15
+ {{ sortLabel }}
16
+ </span>
17
+ <OrIcon
18
+ v-if="sortMenu"
19
+ :icon="sortMenu.state === 'open' ? 'arrow_drop_up' : 'arrow_drop_down'"
20
+ />
21
+ </OrButton>
22
+ <OrMenu
23
+ ref="sortMenu"
24
+ :trigger="sortButton && sortButton.root"
25
+ placement="bottom-start"
26
+ >
27
+ <OrMenuItem
28
+ v-for="item in options"
29
+ :key="item.value"
30
+ :selected="item.value === proxySort"
31
+ @click="handleSort(item.value)"
32
+ >
33
+ {{ item.label }}
34
+ </OrMenuItem>
35
+ </OrMenu>
36
+ </div>
37
+ </template>
38
+ <script lang="ts">
39
+ import { defineComponent, ref, PropType, computed, watch } from 'vue-demi';
40
+ import { OrMenuV3 as OrMenu } from '../or-menu-v3';
41
+ import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
42
+ import { OrButtonV3 as OrButton } from '../or-button-v3';
43
+ import { OrIconV3 as OrIcon } from '../or-icon-v3';
44
+ import { SortOption } from './types';
45
+ import { SortingLabel, SortingRoot } from './styles';
46
+
47
+ export default defineComponent({
48
+ name: 'OrSorting',
49
+ components: {
50
+ OrMenu,
51
+ OrMenuItem,
52
+ OrButton,
53
+ OrIcon,
54
+ },
55
+ props: {
56
+ sort: {
57
+ type: String,
58
+ default: undefined,
59
+ },
60
+ options: {
61
+ type: Array as PropType<SortOption[]>,
62
+ default: () => [],
63
+ },
64
+ },
65
+ emits: [
66
+ 'change',
67
+ ],
68
+ setup(props, context) {
69
+ // Refs
70
+ const root = ref<HTMLElement>();
71
+ const sortMenu = ref<typeof OrMenu>();
72
+ const sortButton = ref<typeof OrButton>();
73
+
74
+ // State
75
+ const proxySort = ref(props.sort);
76
+ const sortLabel = computed(() => {
77
+ return props.options.find(item => item.value === props.sort)?.label;
78
+ });
79
+
80
+ // Methods
81
+ function handleSort(sort: string) {
82
+ proxySort.value = sort;
83
+ }
84
+
85
+ // Effects
86
+ watch(() => props.sort, (value) => {
87
+ proxySort.value = value;
88
+ });
89
+
90
+ watch(proxySort, (value) => {
91
+ context.emit('change', value);
92
+ });
93
+
94
+ const rootStyles = computed(() => [
95
+ 'or-sorting-v3',
96
+ ...SortingRoot,
97
+ ]);
98
+
99
+ const sortLabelStyles = computed(() => [
100
+ ...SortingLabel,
101
+ ]);
102
+
103
+ return {
104
+ root,
105
+ sortMenu,
106
+ sortButton,
107
+ sortLabel,
108
+ proxySort,
109
+ handleSort,
110
+ rootStyles,
111
+ sortLabelStyles,
112
+ };
113
+ },
114
+ });
115
+
116
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as OrSortingV3 } from './OrSortingV3.vue';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ export const SortingRoot = [];
2
+ export const SortingLabel = [
3
+ // Theme
4
+ 'text-on-background dark:text-on-background-dark',
5
+ ];
@@ -0,0 +1,4 @@
1
+ export interface SortOption {
2
+ label: string;
3
+ value: string;
4
+ }
@@ -1,109 +0,0 @@
1
- import { defineComponent, ref, computed, toRef } from 'vue-demi';
2
- import { SortHeaderRoot } from './styles.js';
3
- import __vue_component__$1 from '../OrIconV3/OrIcon.js';
4
- import { useProxyModelValue } from '../../hooks/useProxyModelValue.js';
5
- import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
6
- import '../OrIconV3/props.js';
7
- import '../OrIconV3/styles.js';
8
-
9
- var script = defineComponent({
10
- name: 'OrSortHeader',
11
- components: {
12
- OrIcon: __vue_component__$1
13
- },
14
- model: {
15
- prop: 'modelValue',
16
- event: 'update:modelValue'
17
- },
18
- props: {
19
- modelValue: {
20
- type: Object,
21
- default: undefined
22
- },
23
- value: {
24
- type: String,
25
- required: true
26
- }
27
- },
28
- emits: ['update:modelValue', 'focus', 'blur'],
29
- expose: ['root'],
30
- setup(props, context) {
31
- // Refs
32
- const root = ref();
33
- // Styles
34
- const rootStyles = computed(() => ['or-sort-header-v3', ...SortHeaderRoot]);
35
- // State
36
- const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
37
- const activated = computed(() => {
38
- var _a;
39
- return ((_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.column) === props.value;
40
- });
41
- // Methods
42
- function toggleDirection() {
43
- var _a;
44
- proxyModelValue.value = {
45
- column: props.value,
46
- direction: ((_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.direction) === 'asc' ? 'desc' : 'asc'
47
- };
48
- }
49
- return {
50
- root,
51
- rootStyles,
52
- proxyModelValue,
53
- activated,
54
- toggleDirection
55
- };
56
- }
57
- });
58
-
59
- /* script */
60
- const __vue_script__ = script;
61
-
62
- /* template */
63
- var __vue_render__ = function () {
64
- var _vm = this;
65
- var _h = _vm.$createElement;
66
- var _c = _vm._self._c || _h;
67
- return _c('div', {
68
- ref: "root",
69
- class: _vm.rootStyles,
70
- attrs: {
71
- "activated": _vm.activated ? '' : null
72
- },
73
- on: {
74
- "click": function ($event) {
75
- $event.stopPropagation();
76
- return _vm.toggleDirection();
77
- }
78
- }
79
- }, [_vm._t("default"), _vm._v(" "), _vm.activated ? [_c('OrIcon', {
80
- class: {
81
- 'rotate-180': _vm.proxyModelValue.direction === 'asc'
82
- },
83
- attrs: {
84
- "icon": 'arrow_downward'
85
- }
86
- })] : _vm._e()], 2);
87
- };
88
- var __vue_staticRenderFns__ = [];
89
-
90
- /* style */
91
- const __vue_inject_styles__ = undefined;
92
- /* scoped */
93
- const __vue_scope_id__ = undefined;
94
- /* module identifier */
95
- const __vue_module_identifier__ = undefined;
96
- /* functional template */
97
- const __vue_is_functional_template__ = false;
98
- /* style inject */
99
-
100
- /* style inject SSR */
101
-
102
- /* style inject shadow dom */
103
-
104
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
105
- render: __vue_render__,
106
- staticRenderFns: __vue_staticRenderFns__
107
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
108
-
109
- export { __vue_component__ as default };
@@ -1,46 +0,0 @@
1
- import { PropType } from 'vue-demi';
2
- import { SortHeaderModel } from './types';
3
- declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
4
- root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
5
- rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
6
- proxyModelValue: import("../../hooks").UseProxyModelValueReturn<SortHeaderModel>;
7
- activated: import("@vue/composition-api").ComputedRef<boolean>;
8
- toggleDirection: () => void;
9
- }> & import("@vue/composition-api").Data, {}, {}, {
10
- modelValue: {
11
- type: PropType<SortHeaderModel>;
12
- default: undefined;
13
- };
14
- value: {
15
- type: StringConstructor;
16
- required: true;
17
- };
18
- }, import("@vue/composition-api").ExtractPropTypes<{
19
- modelValue: {
20
- type: PropType<SortHeaderModel>;
21
- default: undefined;
22
- };
23
- value: {
24
- type: StringConstructor;
25
- required: true;
26
- };
27
- }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
28
- modelValue: SortHeaderModel;
29
- value: string;
30
- } & {} & {
31
- [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
32
- }, import("@vue/composition-api").ShallowUnwrapRef<{
33
- root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
34
- rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
35
- proxyModelValue: import("../../hooks").UseProxyModelValueReturn<SortHeaderModel>;
36
- activated: import("@vue/composition-api").ComputedRef<boolean>;
37
- toggleDirection: () => void;
38
- }>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
39
- modelValue: SortHeaderModel;
40
- value: string;
41
- } & {} & {
42
- [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
43
- }, {
44
- modelValue: SortHeaderModel;
45
- }, true>);
46
- export default _default;
@@ -1,2 +0,0 @@
1
- export { default as OrSortHeaderV3 } from './OrSortHeader.vue';
2
- export * from './types';
@@ -1,8 +0,0 @@
1
- export { default as OrSortHeaderV3 } from './OrSortHeader.js';
2
- import 'vue-demi';
3
- import './styles.js';
4
- import '../OrIconV3/OrIcon.js';
5
- import '../OrIconV3/props.js';
6
- import '../OrIconV3/styles.js';
7
- import '../../normalize-component-6e8e3d80.js';
8
- import '../../hooks/useProxyModelValue.js';
@@ -1 +0,0 @@
1
- export declare const SortHeaderRoot: string[];
@@ -1,15 +0,0 @@
1
- const SortHeaderRoot = [
2
- // Layout
3
- 'layout-row',
4
- // Interactivity
5
- 'interactivity-auto',
6
- // Typography
7
- 'typography-caption-regular',
8
- // Typography (activated)
9
- 'activated:typography-caption-semibold',
10
- // Theme
11
- 'theme-foreground-outline', 'dark:theme-foreground-outline-dark',
12
- // Theme (activated)
13
- 'activated:theme-foreground-default', 'dark:activated:theme-foreground-default-dark'];
14
-
15
- export { SortHeaderRoot };
@@ -1,4 +0,0 @@
1
- export interface SortHeaderModel {
2
- column: string;
3
- direction: 'asc' | 'desc';
4
- }
@@ -1,57 +0,0 @@
1
- import { defineComponent, ref, computed, toRef } from 'vue-demi';
2
- import { SortHeaderRoot } from './components/OrSortHeaderV3/styles.js';
3
- import './components/OrIconV3/OrIcon.js';
4
- import { s as script$1 } from './OrIcon.vue_vue_type_script_lang-73f9cc63.js';
5
- import { useProxyModelValue } from './hooks/useProxyModelValue.js';
6
-
7
- var script = defineComponent({
8
- name: 'OrSortHeader',
9
- components: {
10
- OrIcon: script$1
11
- },
12
- model: {
13
- prop: 'modelValue',
14
- event: 'update:modelValue'
15
- },
16
- props: {
17
- modelValue: {
18
- type: Object,
19
- default: undefined
20
- },
21
- value: {
22
- type: String,
23
- required: true
24
- }
25
- },
26
- emits: ['update:modelValue', 'focus', 'blur'],
27
- expose: ['root'],
28
- setup(props, context) {
29
- // Refs
30
- const root = ref();
31
- // Styles
32
- const rootStyles = computed(() => ['or-sort-header-v3', ...SortHeaderRoot]);
33
- // State
34
- const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
35
- const activated = computed(() => {
36
- var _a;
37
- return ((_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.column) === props.value;
38
- });
39
- // Methods
40
- function toggleDirection() {
41
- var _a;
42
- proxyModelValue.value = {
43
- column: props.value,
44
- direction: ((_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.direction) === 'asc' ? 'desc' : 'asc'
45
- };
46
- }
47
- return {
48
- root,
49
- rootStyles,
50
- proxyModelValue,
51
- activated,
52
- toggleDirection
53
- };
54
- }
55
- });
56
-
57
- export { script as s };
@@ -1,30 +0,0 @@
1
- import { s as script } from '../../OrSortHeader.vue_vue_type_script_lang-a444d88b.js';
2
- export { s as default } from '../../OrSortHeader.vue_vue_type_script_lang-a444d88b.js';
3
- import { resolveComponent, openBlock, createElementBlock, normalizeClass, withModifiers, renderSlot, createBlock, createCommentVNode } from 'vue';
4
- import 'vue-demi';
5
- import './styles.js';
6
- import '../OrIconV3/OrIcon.js';
7
- import '../../OrIcon.vue_vue_type_script_lang-73f9cc63.js';
8
- import '../OrIconV3/props.js';
9
- import '../OrIconV3/styles.js';
10
- import '../../hooks/useProxyModelValue.js';
11
-
12
- const _hoisted_1 = ["activated"];
13
- function render(_ctx, _cache, $props, $setup, $data, $options) {
14
- const _component_OrIcon = resolveComponent("OrIcon");
15
- return openBlock(), createElementBlock("div", {
16
- ref: "root",
17
- class: normalizeClass(_ctx.rootStyles),
18
- activated: _ctx.activated ? '' : null,
19
- onClick: _cache[0] || (_cache[0] = withModifiers($event => _ctx.toggleDirection(), ["stop"]))
20
- }, [renderSlot(_ctx.$slots, "default"), _ctx.activated ? (openBlock(), createBlock(_component_OrIcon, {
21
- key: 0,
22
- class: normalizeClass({
23
- 'rotate-180': _ctx.proxyModelValue.direction === 'asc'
24
- }),
25
- icon: 'arrow_downward'
26
- }, null, 8 /* PROPS */, ["class"])) : createCommentVNode("v-if", true)], 10 /* CLASS, PROPS */, _hoisted_1);
27
- }
28
-
29
- script.render = render;
30
- script.__file = "src/components/or-sort-header-v3/OrSortHeader.vue";
@@ -1,34 +0,0 @@
1
- import { PropType } from 'vue-demi';
2
- import { SortHeaderModel } from './types';
3
- declare const _default: import("vue-demi").DefineComponent<{
4
- modelValue: {
5
- type: PropType<SortHeaderModel>;
6
- default: undefined;
7
- };
8
- value: {
9
- type: StringConstructor;
10
- required: true;
11
- };
12
- }, {
13
- root: import("vue-demi").Ref<HTMLElement | undefined>;
14
- rootStyles: import("vue-demi").ComputedRef<string[]>;
15
- proxyModelValue: import("../../hooks").UseProxyModelValueReturn<SortHeaderModel | undefined>;
16
- activated: import("vue-demi").ComputedRef<boolean>;
17
- toggleDirection: () => void;
18
- }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("update:modelValue" | "focus" | "blur")[], "update:modelValue" | "focus" | "blur", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
19
- modelValue: {
20
- type: PropType<SortHeaderModel>;
21
- default: undefined;
22
- };
23
- value: {
24
- type: StringConstructor;
25
- required: true;
26
- };
27
- }>> & {
28
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
29
- onFocus?: ((...args: any[]) => any) | undefined;
30
- onBlur?: ((...args: any[]) => any) | undefined;
31
- }, {
32
- modelValue: SortHeaderModel;
33
- }>;
34
- export default _default;
@@ -1,2 +0,0 @@
1
- export { default as OrSortHeaderV3 } from './OrSortHeader.vue';
2
- export * from './types';
@@ -1,9 +0,0 @@
1
- export { s as OrSortHeaderV3 } from '../../OrSortHeader.vue_vue_type_script_lang-a444d88b.js';
2
- import 'vue-demi';
3
- import './styles.js';
4
- import '../OrIconV3/OrIcon.js';
5
- import '../../OrIcon.vue_vue_type_script_lang-73f9cc63.js';
6
- import '../OrIconV3/props.js';
7
- import '../OrIconV3/styles.js';
8
- import 'vue';
9
- import '../../hooks/useProxyModelValue.js';
@@ -1 +0,0 @@
1
- export declare const SortHeaderRoot: string[];