@onereach/ui-components 2.69.1-beta.2090.0 → 2.69.1-beta.2097.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 (28) hide show
  1. package/dist/bundled/v2/{OrCardCollection-a8d5ce32.js → OrCardCollection-8606c407.js} +12 -4
  2. package/dist/bundled/v2/components/index.js +1 -1
  3. package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +8 -6
  4. package/dist/bundled/v2/components/or-card-collection-v3/index.js +1 -1
  5. package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +4 -0
  6. package/dist/bundled/v2/index.js +1 -1
  7. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-f9f329a2.js → OrCardCollection.vue_vue_type_script_lang-80c10c12.js} +5 -0
  8. package/dist/bundled/v3/components/index.js +1 -1
  9. package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +8 -6
  10. package/dist/bundled/v3/components/or-card-collection-v3/index.js +1 -1
  11. package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +4 -0
  12. package/dist/bundled/v3/index.js +9 -6
  13. package/dist/esm/v2/{OrCardCollection-95b051e1.js → OrCardCollection-e7a4ead6.js} +12 -4
  14. package/dist/esm/v2/components/index.js +1 -1
  15. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +8 -6
  16. package/dist/esm/v2/components/or-card-collection-v3/index.js +1 -1
  17. package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +4 -0
  18. package/dist/esm/v2/index.js +1 -1
  19. package/dist/esm/v3/{OrCardCollection-afd863fc.js → OrCardCollection-3bd67c5c.js} +12 -4
  20. package/dist/esm/v3/components/index.js +1 -1
  21. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +8 -6
  22. package/dist/esm/v3/components/or-card-collection-v3/index.js +1 -1
  23. package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +4 -0
  24. package/dist/esm/v3/index.js +1 -1
  25. package/package.json +1 -1
  26. package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +36 -12
  27. package/src/components/or-card-collection-v3/OrCardCollection.vue +16 -7
  28. package/src/components/or-card-collection-v3/types.ts +5 -0
@@ -165,6 +165,10 @@ var script = defineComponent({
165
165
  const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
166
166
  const toolbarStyles = computed(() => [...CardCollectionToolbar]);
167
167
  const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
168
+ const sortLabel = computed(() => {
169
+ var _a;
170
+ return (_a = props.sortOptions.find(item => item.value === props.sort)) === null || _a === void 0 ? void 0 : _a.label;
171
+ });
168
172
  // State
169
173
  const proxyView = ref(props.view);
170
174
  const proxySort = ref(props.sort);
@@ -208,6 +212,7 @@ var script = defineComponent({
208
212
  proxyView,
209
213
  proxySort,
210
214
  proxySearch,
215
+ sortLabel,
211
216
  switchView,
212
217
  handleSort,
213
218
  handleSearch
@@ -241,7 +246,7 @@ var __vue_render__ = function () {
241
246
  return _vm.sortMenu.toggle();
242
247
  }
243
248
  }
244
- }, [_vm._v("\n " + _vm._s(_vm.proxySort) + "\n "), _vm.sortMenu ? _c('OrIcon', {
249
+ }, [_vm._v("\n " + _vm._s(_vm.sortLabel) + "\n "), _vm.sortMenu ? _c('OrIcon', {
245
250
  attrs: {
246
251
  "icon": _vm.sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'
247
252
  }
@@ -255,10 +260,10 @@ var __vue_render__ = function () {
255
260
  key: sortItem,
256
261
  on: {
257
262
  "click": function ($event) {
258
- return _vm.handleSort(sortItem);
263
+ return _vm.handleSort(sortItem.value);
259
264
  }
260
265
  }
261
- }, [_vm._v("\n " + _vm._s(sortItem) + "\n ")]);
266
+ }, [_vm._v("\n " + _vm._s(sortItem.label) + "\n ")]);
262
267
  }), 1)] : _vm._e()], 2), _vm._v(" "), _c('div', {
263
268
  class: _vm.toolbarPanelStyles
264
269
  }, [_c('OrSearch', {
@@ -286,7 +291,10 @@ var __vue_render__ = function () {
286
291
  }
287
292
  }
288
293
  });
289
- }) : _vm._e(), _vm._v(" "), _vm._t("addon")], 2)], 1)]), _vm._v(" "), _vm._t(_vm.proxyView, function () {
294
+ }) : _vm._e(), _vm._v(" "), _vm._t("addon")], 2)], 1)]), _vm._v(" "), _vm._t("header", null, null, {
295
+ items: _vm.items,
296
+ mode: _vm.proxyView
297
+ }), _vm._v(" "), _vm._t(_vm.proxyView, function () {
290
298
  return [_c('OrCardCollectionView', {
291
299
  attrs: {
292
300
  "items": _vm.items,
@@ -8,7 +8,7 @@ export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTT
8
8
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, O as OrButtonV3 } from '../OrButton-0e91a808.js';
9
9
  export { O as OrCard } from '../OrCard-a6b30f8f.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from '../OrCardCollection-89428bbf.js';
11
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../OrCardCollection-a8d5ce32.js';
11
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../OrCardCollection-8606c407.js';
12
12
  export { _ as OrCardV3 } from '../OrCard-29116e1f.js';
13
13
  export { a as OrCarousel, _ as OrCarouselItem } from '../OrCarouselItem-6da755c0.js';
14
14
  export { O as OrCheckbox } from '../OrCheckbox-4cbddd67.js';
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { CardCollectionView } from './props';
3
- import { CardCollectionItem, ViewMode } from './types';
3
+ import { CardCollectionItem, SortOption, ViewMode } from './types';
4
4
  declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
5
5
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
6
6
  sortMenu: import("@vue/composition-api").Ref<(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, {
@@ -19,6 +19,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
19
19
  proxyView: import("@vue/composition-api").Ref<string>;
20
20
  proxySort: import("@vue/composition-api").Ref<string>;
21
21
  proxySearch: import("@vue/composition-api").Ref<string>;
22
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
22
23
  switchView: (view: string) => void;
23
24
  handleSort: (sort: string) => void;
24
25
  handleSearch: (search: string) => void;
@@ -40,7 +41,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
40
41
  default: undefined;
41
42
  };
42
43
  sortOptions: {
43
- type: PropType<string[]>;
44
+ type: PropType<SortOption[]>;
44
45
  default: () => never[];
45
46
  };
46
47
  search: {
@@ -65,7 +66,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
65
66
  default: undefined;
66
67
  };
67
68
  sortOptions: {
68
- type: PropType<string[]>;
69
+ type: PropType<SortOption[]>;
69
70
  default: () => never[];
70
71
  };
71
72
  search: {
@@ -78,7 +79,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
78
79
  items: CardCollectionItem[];
79
80
  view: string;
80
81
  viewModes: ViewMode[];
81
- sortOptions: string[];
82
+ sortOptions: SortOption[];
82
83
  } & {} & {
83
84
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
84
85
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -99,6 +100,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
99
100
  proxyView: import("@vue/composition-api").Ref<string>;
100
101
  proxySort: import("@vue/composition-api").Ref<string>;
101
102
  proxySearch: import("@vue/composition-api").Ref<string>;
103
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
102
104
  switchView: (view: string) => void;
103
105
  handleSort: (sort: string) => void;
104
106
  handleSearch: (search: string) => void;
@@ -108,7 +110,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
108
110
  items: CardCollectionItem[];
109
111
  view: string;
110
112
  viewModes: ViewMode[];
111
- sortOptions: string[];
113
+ sortOptions: SortOption[];
112
114
  } & {} & {
113
115
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
114
116
  }, {
@@ -117,6 +119,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
117
119
  items: CardCollectionItem[];
118
120
  view: string;
119
121
  viewModes: ViewMode[];
120
- sortOptions: string[];
122
+ sortOptions: SortOption[];
121
123
  }, true>);
122
124
  export default _default;
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../../OrCardCollection-a8d5ce32.js';
1
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../../OrCardCollection-8606c407.js';
2
2
  import '../../index-fa6eb4ca.js';
3
3
  import 'vue';
4
4
  import '@vue/composition-api/dist/vue-composition-api.mjs';
@@ -6,3 +6,7 @@ export interface ViewMode {
6
6
  view: string;
7
7
  icon: string;
8
8
  }
9
+ export interface SortOption {
10
+ label: string;
11
+ value: string;
12
+ }
@@ -13,7 +13,7 @@ export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTT
13
13
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, O as OrButtonV3 } from './OrButton-0e91a808.js';
14
14
  export { O as OrCard } from './OrCard-a6b30f8f.js';
15
15
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from './OrCardCollection-89428bbf.js';
16
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from './OrCardCollection-a8d5ce32.js';
16
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from './OrCardCollection-8606c407.js';
17
17
  export { _ as OrCardV3 } from './OrCard-29116e1f.js';
18
18
  export { a as OrCarousel, _ as OrCarouselItem } from './OrCarouselItem-6da755c0.js';
19
19
  export { O as OrCheckbox } from './OrCheckbox-4cbddd67.js';
@@ -171,6 +171,10 @@ var script = defineComponent({
171
171
  const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
172
172
  const toolbarStyles = computed(() => [...CardCollectionToolbar]);
173
173
  const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
174
+ const sortLabel = computed(() => {
175
+ var _a;
176
+ return (_a = props.sortOptions.find(item => item.value === props.sort)) === null || _a === void 0 ? void 0 : _a.label;
177
+ });
174
178
  // State
175
179
  const proxyView = ref(props.view);
176
180
  const proxySort = ref(props.sort);
@@ -214,6 +218,7 @@ var script = defineComponent({
214
218
  proxyView,
215
219
  proxySort,
216
220
  proxySearch,
221
+ sortLabel,
217
222
  switchView,
218
223
  handleSort,
219
224
  handleSearch
@@ -8,7 +8,7 @@ export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTT
8
8
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3 } from '../OrButton.vue_vue_type_script_lang-3718b300.js';
9
9
  export { s as OrCard } from '../OrCard.vue_vue_type_script_lang-90ba001b.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from '../OrCardCollection.vue_vue_type_script_lang-d8124dda.js';
11
- export { C as CardCollectionView, s as OrCardCollectionV3 } from '../OrCardCollection.vue_vue_type_script_lang-f9f329a2.js';
11
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from '../OrCardCollection.vue_vue_type_script_lang-80c10c12.js';
12
12
  export { s as OrCardV3 } from '../OrCard.vue_vue_type_script_lang-165de137.js';
13
13
  export { a as OrCarousel, s as OrCarouselItem } from '../OrCarouselItem.vue_vue_type_script_lang-ad286afc.js';
14
14
  export { s as OrCheckbox } from '../OrCheckbox.vue_vue_type_script_lang-d8a66818.js';
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { CardCollectionView } from './props';
3
- import { CardCollectionItem, ViewMode } from './types';
3
+ import { CardCollectionItem, SortOption, ViewMode } from './types';
4
4
  declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
5
5
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
6
6
  sortMenu: import("@vue/composition-api").Ref<(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, {
@@ -19,6 +19,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
19
19
  proxyView: import("@vue/composition-api").Ref<string>;
20
20
  proxySort: import("@vue/composition-api").Ref<string>;
21
21
  proxySearch: import("@vue/composition-api").Ref<string>;
22
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
22
23
  switchView: (view: string) => void;
23
24
  handleSort: (sort: string) => void;
24
25
  handleSearch: (search: string) => void;
@@ -40,7 +41,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
40
41
  default: undefined;
41
42
  };
42
43
  sortOptions: {
43
- type: PropType<string[]>;
44
+ type: PropType<SortOption[]>;
44
45
  default: () => never[];
45
46
  };
46
47
  search: {
@@ -65,7 +66,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
65
66
  default: undefined;
66
67
  };
67
68
  sortOptions: {
68
- type: PropType<string[]>;
69
+ type: PropType<SortOption[]>;
69
70
  default: () => never[];
70
71
  };
71
72
  search: {
@@ -78,7 +79,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
78
79
  items: CardCollectionItem[];
79
80
  view: string;
80
81
  viewModes: ViewMode[];
81
- sortOptions: string[];
82
+ sortOptions: SortOption[];
82
83
  } & {} & {
83
84
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
84
85
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -99,6 +100,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
99
100
  proxyView: import("@vue/composition-api").Ref<string>;
100
101
  proxySort: import("@vue/composition-api").Ref<string>;
101
102
  proxySearch: import("@vue/composition-api").Ref<string>;
103
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
102
104
  switchView: (view: string) => void;
103
105
  handleSort: (sort: string) => void;
104
106
  handleSearch: (search: string) => void;
@@ -108,7 +110,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
108
110
  items: CardCollectionItem[];
109
111
  view: string;
110
112
  viewModes: ViewMode[];
111
- sortOptions: string[];
113
+ sortOptions: SortOption[];
112
114
  } & {} & {
113
115
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
114
116
  }, {
@@ -117,6 +119,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
117
119
  items: CardCollectionItem[];
118
120
  view: string;
119
121
  viewModes: ViewMode[];
120
- sortOptions: string[];
122
+ sortOptions: SortOption[];
121
123
  }, true>);
122
124
  export default _default;
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, s as OrCardCollectionV3 } from '../../OrCardCollection.vue_vue_type_script_lang-f9f329a2.js';
1
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from '../../OrCardCollection.vue_vue_type_script_lang-80c10c12.js';
2
2
  import 'vue';
3
3
  import '../../OrIconButton-4bd33e3c.js';
4
4
  import '../../OrIconButton.vue_vue_type_script_lang-641f6e06.js';
@@ -6,3 +6,7 @@ export interface ViewMode {
6
6
  view: string;
7
7
  icon: string;
8
8
  }
9
+ export interface SortOption {
10
+ label: string;
11
+ value: string;
12
+ }
@@ -18,8 +18,8 @@ export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3
18
18
  import { s as script$6 } from './OrCardCollection.vue_vue_type_script_lang-d8124dda.js';
19
19
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from './OrCardCollection.vue_vue_type_script_lang-d8124dda.js';
20
20
  export { s as OrCard } from './OrCard.vue_vue_type_script_lang-90ba001b.js';
21
- import { s as script$7 } from './OrCardCollection.vue_vue_type_script_lang-f9f329a2.js';
22
- export { C as CardCollectionView, s as OrCardCollectionV3 } from './OrCardCollection.vue_vue_type_script_lang-f9f329a2.js';
21
+ import { s as script$7 } from './OrCardCollection.vue_vue_type_script_lang-80c10c12.js';
22
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from './OrCardCollection.vue_vue_type_script_lang-80c10c12.js';
23
23
  import { s as script$8 } from './OrCard.vue_vue_type_script_lang-165de137.js';
24
24
  export { s as OrCardV3 } from './OrCard.vue_vue_type_script_lang-165de137.js';
25
25
  import './OrCarouselItem-f4b9541d.js';
@@ -604,7 +604,7 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
604
604
  color: "inherit",
605
605
  onClick: _cache[0] || (_cache[0] = $event => _ctx.sortMenu.toggle())
606
606
  }, {
607
- default: withCtx(() => [createTextVNode(toDisplayString(_ctx.proxySort) + " ", 1 /* TEXT */), _ctx.sortMenu ? (openBlock(), createBlock(_component_OrIcon, {
607
+ default: withCtx(() => [createTextVNode(toDisplayString(_ctx.sortLabel) + " ", 1 /* TEXT */), _ctx.sortMenu ? (openBlock(), createBlock(_component_OrIcon, {
608
608
  key: 0,
609
609
  icon: _ctx.sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'
610
610
  }, null, 8 /* PROPS */, ["icon"])) : createCommentVNode("v-if", true)]),
@@ -616,9 +616,9 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
616
616
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.sortOptions, sortItem => {
617
617
  return openBlock(), createBlock(_component_OrMenuItem, {
618
618
  key: sortItem,
619
- onClick: $event => _ctx.handleSort(sortItem)
619
+ onClick: $event => _ctx.handleSort(sortItem.value)
620
620
  }, {
621
- default: withCtx(() => [createTextVNode(toDisplayString(sortItem), 1 /* TEXT */)]),
621
+ default: withCtx(() => [createTextVNode(toDisplayString(sortItem.label), 1 /* TEXT */)]),
622
622
 
623
623
  _: 2 /* DYNAMIC */
624
624
  }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"]);
@@ -642,7 +642,10 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
642
642
  },
643
643
  onClick: $event => _ctx.switchView(viewOption.view)
644
644
  }, null, 8 /* PROPS */, ["icon", "onClick"]);
645
- }), 128 /* KEYED_FRAGMENT */)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "addon")])], 2 /* CLASS */)], 2 /* CLASS */), renderSlot(_ctx.$slots, _ctx.proxyView, normalizeProps(guardReactiveProps({
645
+ }), 128 /* KEYED_FRAGMENT */)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "addon")])], 2 /* CLASS */)], 2 /* CLASS */), renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps({
646
+ items: _ctx.items,
647
+ mode: _ctx.proxyView
648
+ }))), renderSlot(_ctx.$slots, _ctx.proxyView, normalizeProps(guardReactiveProps({
646
649
  items: _ctx.items
647
650
  })), () => [createVNode(_component_OrCardCollectionView, {
648
651
  items: _ctx.items,
@@ -166,6 +166,10 @@ var script = defineComponent({
166
166
  const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
167
167
  const toolbarStyles = computed(() => [...CardCollectionToolbar]);
168
168
  const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
169
+ const sortLabel = computed(() => {
170
+ var _a;
171
+ return (_a = props.sortOptions.find(item => item.value === props.sort)) === null || _a === void 0 ? void 0 : _a.label;
172
+ });
169
173
  // State
170
174
  const proxyView = ref(props.view);
171
175
  const proxySort = ref(props.sort);
@@ -209,6 +213,7 @@ var script = defineComponent({
209
213
  proxyView,
210
214
  proxySort,
211
215
  proxySearch,
216
+ sortLabel,
212
217
  switchView,
213
218
  handleSort,
214
219
  handleSearch
@@ -242,7 +247,7 @@ var __vue_render__ = function () {
242
247
  return _vm.sortMenu.toggle();
243
248
  }
244
249
  }
245
- }, [_vm._v("\n " + _vm._s(_vm.proxySort) + "\n "), _vm.sortMenu ? _c('OrIcon', {
250
+ }, [_vm._v("\n " + _vm._s(_vm.sortLabel) + "\n "), _vm.sortMenu ? _c('OrIcon', {
246
251
  attrs: {
247
252
  "icon": _vm.sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'
248
253
  }
@@ -256,10 +261,10 @@ var __vue_render__ = function () {
256
261
  key: sortItem,
257
262
  on: {
258
263
  "click": function ($event) {
259
- return _vm.handleSort(sortItem);
264
+ return _vm.handleSort(sortItem.value);
260
265
  }
261
266
  }
262
- }, [_vm._v("\n " + _vm._s(sortItem) + "\n ")]);
267
+ }, [_vm._v("\n " + _vm._s(sortItem.label) + "\n ")]);
263
268
  }), 1)] : _vm._e()], 2), _vm._v(" "), _c('div', {
264
269
  class: _vm.toolbarPanelStyles
265
270
  }, [_c('OrSearch', {
@@ -287,7 +292,10 @@ var __vue_render__ = function () {
287
292
  }
288
293
  }
289
294
  });
290
- }) : _vm._e(), _vm._v(" "), _vm._t("addon")], 2)], 1)]), _vm._v(" "), _vm._t(_vm.proxyView, function () {
295
+ }) : _vm._e(), _vm._v(" "), _vm._t("addon")], 2)], 1)]), _vm._v(" "), _vm._t("header", null, null, {
296
+ items: _vm.items,
297
+ mode: _vm.proxyView
298
+ }), _vm._v(" "), _vm._t(_vm.proxyView, function () {
291
299
  return [_c('OrCardCollectionView', {
292
300
  attrs: {
293
301
  "items": _vm.items,
@@ -8,7 +8,7 @@ export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTT
8
8
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, _ as OrButtonV3 } from '../OrButton-357a5756.js';
9
9
  export { _ as OrCard } from '../OrCard-b7268256.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from '../OrCardCollection-f6b07557.js';
11
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../OrCardCollection-95b051e1.js';
11
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../OrCardCollection-e7a4ead6.js';
12
12
  export { _ as OrCardV3 } from '../OrCard-de799db0.js';
13
13
  export { a as OrCarousel, _ as OrCarouselItem } from '../OrCarouselItem-4e2cf3d8.js';
14
14
  export { _ as OrCheckbox } from '../OrCheckbox-915f1f0a.js';
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { CardCollectionView } from './props';
3
- import { CardCollectionItem, ViewMode } from './types';
3
+ import { CardCollectionItem, SortOption, ViewMode } from './types';
4
4
  declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
5
5
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
6
6
  sortMenu: import("@vue/composition-api").Ref<(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, {
@@ -19,6 +19,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
19
19
  proxyView: import("@vue/composition-api").Ref<string>;
20
20
  proxySort: import("@vue/composition-api").Ref<string>;
21
21
  proxySearch: import("@vue/composition-api").Ref<string>;
22
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
22
23
  switchView: (view: string) => void;
23
24
  handleSort: (sort: string) => void;
24
25
  handleSearch: (search: string) => void;
@@ -40,7 +41,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
40
41
  default: undefined;
41
42
  };
42
43
  sortOptions: {
43
- type: PropType<string[]>;
44
+ type: PropType<SortOption[]>;
44
45
  default: () => never[];
45
46
  };
46
47
  search: {
@@ -65,7 +66,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
65
66
  default: undefined;
66
67
  };
67
68
  sortOptions: {
68
- type: PropType<string[]>;
69
+ type: PropType<SortOption[]>;
69
70
  default: () => never[];
70
71
  };
71
72
  search: {
@@ -78,7 +79,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
78
79
  items: CardCollectionItem[];
79
80
  view: string;
80
81
  viewModes: ViewMode[];
81
- sortOptions: string[];
82
+ sortOptions: SortOption[];
82
83
  } & {} & {
83
84
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
84
85
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -99,6 +100,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
99
100
  proxyView: import("@vue/composition-api").Ref<string>;
100
101
  proxySort: import("@vue/composition-api").Ref<string>;
101
102
  proxySearch: import("@vue/composition-api").Ref<string>;
103
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
102
104
  switchView: (view: string) => void;
103
105
  handleSort: (sort: string) => void;
104
106
  handleSearch: (search: string) => void;
@@ -108,7 +110,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
108
110
  items: CardCollectionItem[];
109
111
  view: string;
110
112
  viewModes: ViewMode[];
111
- sortOptions: string[];
113
+ sortOptions: SortOption[];
112
114
  } & {} & {
113
115
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
114
116
  }, {
@@ -117,6 +119,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
117
119
  items: CardCollectionItem[];
118
120
  view: string;
119
121
  viewModes: ViewMode[];
120
- sortOptions: string[];
122
+ sortOptions: SortOption[];
121
123
  }, true>);
122
124
  export default _default;
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../../OrCardCollection-95b051e1.js';
1
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from '../../OrCardCollection-e7a4ead6.js';
2
2
  import 'vue-demi';
3
3
  import '../../useClassAttribute-47fdb016.js';
4
4
  import '@vueuse/core';
@@ -6,3 +6,7 @@ export interface ViewMode {
6
6
  view: string;
7
7
  icon: string;
8
8
  }
9
+ export interface SortOption {
10
+ label: string;
11
+ value: string;
12
+ }
@@ -8,7 +8,7 @@ export { a as BUTTON_COLOR, c as BUTTON_LOADER_TYPE, b as BUTTON_SIZE, B as BUTT
8
8
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, _ as OrButtonV3 } from './OrButton-357a5756.js';
9
9
  export { _ as OrCard } from './OrCard-b7268256.js';
10
10
  export { C as CARD_COLLECTION_LAYOUT, _ as OrCardCollection } from './OrCardCollection-f6b07557.js';
11
- export { C as CardCollectionView, _ as OrCardCollectionV3 } from './OrCardCollection-95b051e1.js';
11
+ export { C as CardCollectionView, _ as OrCardCollectionV3 } from './OrCardCollection-e7a4ead6.js';
12
12
  export { _ as OrCardV3 } from './OrCard-de799db0.js';
13
13
  export { a as OrCarousel, _ as OrCarouselItem } from './OrCarouselItem-4e2cf3d8.js';
14
14
  export { _ as OrCheckbox } from './OrCheckbox-915f1f0a.js';
@@ -142,6 +142,10 @@ var script = defineComponent({
142
142
  const rootStyles = computed(() => ['or-card-collection', ...CardCollectionRoot, classAttribute.value]);
143
143
  const toolbarStyles = computed(() => [...CardCollectionToolbar]);
144
144
  const toolbarPanelStyles = computed(() => [...CardCollectionToolbarPanel]);
145
+ const sortLabel = computed(() => {
146
+ var _a;
147
+ return (_a = props.sortOptions.find(item => item.value === props.sort)) === null || _a === void 0 ? void 0 : _a.label;
148
+ });
145
149
  // State
146
150
  const proxyView = ref(props.view);
147
151
  const proxySort = ref(props.sort);
@@ -185,6 +189,7 @@ var script = defineComponent({
185
189
  proxyView,
186
190
  proxySort,
187
191
  proxySearch,
192
+ sortLabel,
188
193
  switchView,
189
194
  handleSort,
190
195
  handleSearch
@@ -219,7 +224,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
219
224
  color: "inherit",
220
225
  onClick: _cache[0] || (_cache[0] = $event => _ctx.sortMenu.toggle())
221
226
  }, {
222
- default: withCtx(() => [createTextVNode(toDisplayString(_ctx.proxySort) + " ", 1 /* TEXT */), _ctx.sortMenu ? (openBlock(), createBlock(_component_OrIcon, {
227
+ default: withCtx(() => [createTextVNode(toDisplayString(_ctx.sortLabel) + " ", 1 /* TEXT */), _ctx.sortMenu ? (openBlock(), createBlock(_component_OrIcon, {
223
228
  key: 0,
224
229
  icon: _ctx.sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'
225
230
  }, null, 8 /* PROPS */, ["icon"])) : createCommentVNode("v-if", true)]),
@@ -231,9 +236,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
231
236
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.sortOptions, sortItem => {
232
237
  return openBlock(), createBlock(_component_OrMenuItem, {
233
238
  key: sortItem,
234
- onClick: $event => _ctx.handleSort(sortItem)
239
+ onClick: $event => _ctx.handleSort(sortItem.value)
235
240
  }, {
236
- default: withCtx(() => [createTextVNode(toDisplayString(sortItem), 1 /* TEXT */)]),
241
+ default: withCtx(() => [createTextVNode(toDisplayString(sortItem.label), 1 /* TEXT */)]),
237
242
 
238
243
  _: 2 /* DYNAMIC */
239
244
  }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"]);
@@ -257,7 +262,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
257
262
  },
258
263
  onClick: $event => _ctx.switchView(viewOption.view)
259
264
  }, null, 8 /* PROPS */, ["icon", "onClick"]);
260
- }), 128 /* KEYED_FRAGMENT */)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "addon")])], 2 /* CLASS */)], 2 /* CLASS */), renderSlot(_ctx.$slots, _ctx.proxyView, normalizeProps(guardReactiveProps({
265
+ }), 128 /* KEYED_FRAGMENT */)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "addon")])], 2 /* CLASS */)], 2 /* CLASS */), renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps({
266
+ items: _ctx.items,
267
+ mode: _ctx.proxyView
268
+ }))), renderSlot(_ctx.$slots, _ctx.proxyView, normalizeProps(guardReactiveProps({
261
269
  items: _ctx.items
262
270
  })), () => [createVNode(_component_OrCardCollectionView, {
263
271
  items: _ctx.items,
@@ -6,7 +6,7 @@ export { b as BUTTON_COLOR, d as BUTTON_LOADER_TYPE, c as BUTTON_SIZE, B as BUTT
6
6
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3 } from '../OrButton-f4b9ee51.js';
7
7
  export { s as OrCard } from '../OrCard-e3a5aea4.js';
8
8
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from '../OrCardCollection-a5e326ef.js';
9
- export { C as CardCollectionView, s as OrCardCollectionV3 } from '../OrCardCollection-afd863fc.js';
9
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from '../OrCardCollection-3bd67c5c.js';
10
10
  export { s as OrCardV3 } from '../OrCard-fd92f7c8.js';
11
11
  export { a as OrCarousel, s as OrCarouselItem } from '../OrCarouselItem-636d99a1.js';
12
12
  export { s as OrCheckbox } from '../OrCheckbox-ed4a19cf.js';
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { CardCollectionView } from './props';
3
- import { CardCollectionItem, ViewMode } from './types';
3
+ import { CardCollectionItem, SortOption, ViewMode } from './types';
4
4
  declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
5
5
  root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
6
6
  sortMenu: import("@vue/composition-api").Ref<(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, {
@@ -19,6 +19,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
19
19
  proxyView: import("@vue/composition-api").Ref<string>;
20
20
  proxySort: import("@vue/composition-api").Ref<string>;
21
21
  proxySearch: import("@vue/composition-api").Ref<string>;
22
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
22
23
  switchView: (view: string) => void;
23
24
  handleSort: (sort: string) => void;
24
25
  handleSearch: (search: string) => void;
@@ -40,7 +41,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
40
41
  default: undefined;
41
42
  };
42
43
  sortOptions: {
43
- type: PropType<string[]>;
44
+ type: PropType<SortOption[]>;
44
45
  default: () => never[];
45
46
  };
46
47
  search: {
@@ -65,7 +66,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
65
66
  default: undefined;
66
67
  };
67
68
  sortOptions: {
68
- type: PropType<string[]>;
69
+ type: PropType<SortOption[]>;
69
70
  default: () => never[];
70
71
  };
71
72
  search: {
@@ -78,7 +79,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
78
79
  items: CardCollectionItem[];
79
80
  view: string;
80
81
  viewModes: ViewMode[];
81
- sortOptions: string[];
82
+ sortOptions: SortOption[];
82
83
  } & {} & {
83
84
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
84
85
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -99,6 +100,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
99
100
  proxyView: import("@vue/composition-api").Ref<string>;
100
101
  proxySort: import("@vue/composition-api").Ref<string>;
101
102
  proxySearch: import("@vue/composition-api").Ref<string>;
103
+ sortLabel: import("@vue/composition-api").ComputedRef<string | undefined>;
102
104
  switchView: (view: string) => void;
103
105
  handleSort: (sort: string) => void;
104
106
  handleSearch: (search: string) => void;
@@ -108,7 +110,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
108
110
  items: CardCollectionItem[];
109
111
  view: string;
110
112
  viewModes: ViewMode[];
111
- sortOptions: string[];
113
+ sortOptions: SortOption[];
112
114
  } & {} & {
113
115
  [x: string & `on${string}`]: ((...args: any[]) => any) | undefined;
114
116
  }, {
@@ -117,6 +119,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
117
119
  items: CardCollectionItem[];
118
120
  view: string;
119
121
  viewModes: ViewMode[];
120
- sortOptions: string[];
122
+ sortOptions: SortOption[];
121
123
  }, true>);
122
124
  export default _default;
@@ -1,4 +1,4 @@
1
- export { C as CardCollectionView, s as OrCardCollectionV3 } from '../../OrCardCollection-afd863fc.js';
1
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from '../../OrCardCollection-3bd67c5c.js';
2
2
  import 'vue-demi';
3
3
  import '../../useClassAttribute-47fdb016.js';
4
4
  import '@vueuse/core';
@@ -6,3 +6,7 @@ export interface ViewMode {
6
6
  view: string;
7
7
  icon: string;
8
8
  }
9
+ export interface SortOption {
10
+ label: string;
11
+ value: string;
12
+ }
@@ -6,7 +6,7 @@ export { b as BUTTON_COLOR, d as BUTTON_LOADER_TYPE, c as BUTTON_SIZE, B as BUTT
6
6
  export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3 } from './OrButton-f4b9ee51.js';
7
7
  export { s as OrCard } from './OrCard-e3a5aea4.js';
8
8
  export { C as CARD_COLLECTION_LAYOUT, s as OrCardCollection } from './OrCardCollection-a5e326ef.js';
9
- export { C as CardCollectionView, s as OrCardCollectionV3 } from './OrCardCollection-afd863fc.js';
9
+ export { C as CardCollectionView, s as OrCardCollectionV3 } from './OrCardCollection-3bd67c5c.js';
10
10
  export { s as OrCardV3 } from './OrCard-fd92f7c8.js';
11
11
  export { a as OrCarousel, s as OrCarouselItem } from './OrCarouselItem-636d99a1.js';
12
12
  export { s as OrCheckbox } from './OrCheckbox-ed4a19cf.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.69.1-beta.2090.0",
3
+ "version": "2.69.1-beta.2097.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -1,5 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { Meta, StoryFn } from '@storybook/vue3';
3
+ import { ref } from 'vue-demi';
3
4
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
4
5
  import OrCardCollectionDocs from './OrCardCollection.docs.mdx';
5
6
  import OrCardCollection from './OrCardCollection.vue';
@@ -14,7 +15,7 @@ export default {
14
15
 
15
16
  argTypes: {
16
17
  // Slots
17
- gridItem: {
18
+ item: {
18
19
  type: {
19
20
  name: 'string',
20
21
  required: true,
@@ -23,10 +24,9 @@ export default {
23
24
  control: { type: 'text' },
24
25
  },
25
26
 
26
- listItem: {
27
+ header: {
27
28
  type: {
28
29
  name: 'string',
29
- required: true,
30
30
  },
31
31
 
32
32
  control: { type: 'text' },
@@ -46,7 +46,7 @@ export default {
46
46
  control: { type: 'object' },
47
47
  },
48
48
 
49
- sortHeaders: {
49
+ sortOptions: {
50
50
  control: { type: 'object' },
51
51
  },
52
52
 
@@ -84,10 +84,17 @@ const Template: StoryFn<typeof OrCardCollection> = (args) => ({
84
84
  },
85
85
 
86
86
  setup() {
87
+ const sort = ref(args.sort);
88
+ const onSortChange = (newSort: string) => {
89
+ sort.value = newSort;
90
+ action('searchChange')(newSort);
91
+ };
92
+
87
93
  return {
88
94
  args,
95
+ sort,
96
+ onSortChange,
89
97
  onViewChange: action('viewChange'),
90
- onSortChange: action('sortChange'),
91
98
  onSearchChange: action('searchChange'),
92
99
  };
93
100
  },
@@ -96,10 +103,14 @@ const Template: StoryFn<typeof OrCardCollection> = (args) => ({
96
103
  <div class="p-md bg-surface-1 dark:bg-surface-1-dark">
97
104
  <OrCardCollection
98
105
  v-bind="args"
106
+ :sort="sort"
99
107
  @viewChange="onViewChange"
100
108
  @sortChange="onSortChange"
101
109
  @searchChange="onSearchChange"
102
110
  >
111
+ <template #header>
112
+ ${args.header}
113
+ </template>
103
114
  <template #item="{item, mode}">
104
115
  <OrCard>${args.item} ({{mode}})</OrCard>
105
116
  </template>
@@ -156,12 +167,24 @@ WithSorting.args = {
156
167
  ...Default.args,
157
168
 
158
169
  // Props
159
- sort: 'Bar',
170
+ sort: 'bar',
160
171
  sortOptions: [
161
- 'Foo',
162
- 'Bar',
163
- 'Baz',
164
- 'Qux',
172
+ {
173
+ label: 'Foo',
174
+ value: 'foo',
175
+ },
176
+ {
177
+ label: 'Bar',
178
+ value: 'bar',
179
+ },
180
+ {
181
+ label: 'Baz',
182
+ value: 'baz',
183
+ },
184
+ {
185
+ label: 'Qux',
186
+ value: 'qux',
187
+ },
165
188
  ],
166
189
  };
167
190
 
@@ -189,8 +212,10 @@ export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) =>
189
212
  @sortChange="onSortChange"
190
213
  @searchChange="onSearchChange"
191
214
  >
215
+ <template #header="{mode}">
216
+ <div class="typography-headline-3">Custom {{ mode }}</div>
217
+ </template>
192
218
  <template #grid="{items}">
193
- <div class="typography-headline-3">Custom grid</div>
194
219
  <div class="grid grid-cols-3">
195
220
  <OrCard
196
221
  v-for="item in items"
@@ -201,7 +226,6 @@ export const OverrideViewContainer: StoryFn<typeof OrCardCollection> = (args) =>
201
226
  </div>
202
227
  </template>
203
228
  <template #list="{items}">
204
- <div class="typography-headline-3">Custom list</div>
205
229
  <ul>
206
230
  <li
207
231
  v-for="item in items"
@@ -13,7 +13,7 @@
13
13
  color="inherit"
14
14
  @click="sortMenu.toggle()"
15
15
  >
16
- {{ proxySort }}
16
+ {{ sortLabel }}
17
17
  <OrIcon
18
18
  v-if="sortMenu"
19
19
  :icon="sortMenu.isOpen ? 'arrow_drop_up' : 'arrow_drop_down'"
@@ -26,14 +26,13 @@
26
26
  <OrMenuItem
27
27
  v-for="sortItem in sortOptions"
28
28
  :key="sortItem"
29
- @click="handleSort(sortItem)"
29
+ @click="handleSort(sortItem.value)"
30
30
  >
31
- {{ sortItem }}
31
+ {{ sortItem.label }}
32
32
  </OrMenuItem>
33
33
  </OrMenu>
34
34
  </template>
35
35
  </div>
36
-
37
36
  <div
38
37
  :class="toolbarPanelStyles"
39
38
  >
@@ -55,7 +54,13 @@
55
54
  </div>
56
55
  </div>
57
56
  </div>
58
-
57
+ <slot
58
+ name="header"
59
+ v-bind="{
60
+ items,
61
+ mode: proxyView,
62
+ }"
63
+ />
59
64
  <slot
60
65
  :name="proxyView"
61
66
  v-bind="{items}"
@@ -88,7 +93,7 @@ import {
88
93
  CardCollectionToolbar,
89
94
  CardCollectionToolbarPanel,
90
95
  } from './styles';
91
- import { CardCollectionItem, ViewMode } from './types';
96
+ import { CardCollectionItem, SortOption, ViewMode } from './types';
92
97
  import OrCardCollectionView from './OrCardCollectionView.vue3.vue';
93
98
  import { OrButtonV3 as OrButton } from '../or-button-v3';
94
99
  import { OrSearchV3 as OrSearch } from '../or-search-v3';
@@ -131,7 +136,7 @@ export default defineComponent({
131
136
  },
132
137
 
133
138
  sortOptions: {
134
- type: Array as PropType<string[]>,
139
+ type: Array as PropType<SortOption[]>,
135
140
  default: () => [],
136
141
  },
137
142
 
@@ -174,6 +179,9 @@ export default defineComponent({
174
179
  ...CardCollectionToolbarPanel,
175
180
  ]);
176
181
 
182
+ const sortLabel = computed(() => {
183
+ return props.sortOptions.find(item => item.value === props.sort)?.label;
184
+ });
177
185
  // State
178
186
  const proxyView = ref(props.view);
179
187
  const proxySort = ref(props.sort);
@@ -226,6 +234,7 @@ export default defineComponent({
226
234
  proxyView,
227
235
  proxySort,
228
236
  proxySearch,
237
+ sortLabel,
229
238
  switchView,
230
239
  handleSort,
231
240
  handleSearch,
@@ -7,3 +7,8 @@ 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
+ }