@onereach/ui-components 2.69.7-beta.2170.0 → 2.69.7-beta.2171.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 (117) hide show
  1. package/dist/bundled/v2/{OrButton-a846fa7e.js → OrButton-4b99c680.js} +1 -10
  2. package/dist/bundled/v2/{OrCardCollection-15d11d05.js → OrCardCollection-c4209a92.js} +1 -1
  3. package/dist/bundled/v2/{OrConfirm-ec3feaf5.js → OrConfirm-cab6535b.js} +1 -1
  4. package/dist/bundled/v2/{OrExpansionPanel-995caa85.js → OrExpansionPanel-d9a260e2.js} +32 -5
  5. package/dist/bundled/v2/{OrSelect-8a4d227e.js → OrSelect-9658e0f2.js} +9 -16
  6. package/dist/bundled/v2/components/index.d.ts +0 -1
  7. package/dist/bundled/v2/components/index.js +5 -6
  8. package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
  9. package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
  10. package/dist/bundled/v2/components/or-card-collection-v3/index.js +2 -2
  11. package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
  12. package/dist/bundled/v2/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  13. package/dist/bundled/v2/components/or-expansion-panel-v3/index.js +1 -1
  14. package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -25
  15. package/dist/bundled/v2/components/or-select-v3/index.d.ts +0 -1
  16. package/dist/bundled/v2/components/or-select-v3/index.js +2 -2
  17. package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
  18. package/dist/bundled/v2/index.js +6 -7
  19. package/dist/bundled/v3/{OrButton-2b27c1fd.js → OrButton-a671b8a1.js} +2 -3
  20. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-8c44986c.js → OrButton.vue_vue_type_script_lang-b0dc31ca.js} +1 -9
  21. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-bd852915.js → OrCardCollection.vue_vue_type_script_lang-9a2ae9a3.js} +2 -2
  22. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-9e4e2884.js → OrConfirm.vue_vue_type_script_lang-f57ffa1a.js} +2 -2
  23. package/dist/bundled/v3/{OrExpansionPanel.vue_vue_type_script_lang-7f9c6721.js → OrExpansionPanel.vue_vue_type_script_lang-5360f580.js} +31 -4
  24. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-94063fc4.js → OrSelect.vue_vue_type_script_lang-359d1a58.js} +4 -8
  25. package/dist/bundled/v3/components/index.d.ts +0 -1
  26. package/dist/bundled/v3/components/index.js +6 -7
  27. package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
  28. package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
  29. package/dist/bundled/v3/components/or-card-collection-v3/index.js +3 -3
  30. package/dist/bundled/v3/components/or-confirm-v3/index.js +3 -3
  31. package/dist/bundled/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  32. package/dist/bundled/v3/components/or-expansion-panel-v3/index.js +1 -1
  33. package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -25
  34. package/dist/bundled/v3/components/or-select-v3/index.d.ts +0 -1
  35. package/dist/bundled/v3/components/or-select-v3/index.js +2 -2
  36. package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
  37. package/dist/bundled/v3/index.js +163 -254
  38. package/dist/esm/v2/{OrButton-835d4f11.js → OrButton-357e1e2c.js} +1 -10
  39. package/dist/esm/v2/{OrCardCollection-024cfba9.js → OrCardCollection-57d11adf.js} +1 -1
  40. package/dist/esm/v2/{OrConfirm-5e8dd4b6.js → OrConfirm-ec7aef0e.js} +1 -1
  41. package/dist/esm/v2/{OrExpansionPanel-968ddc61.js → OrExpansionPanel-a123024e.js} +32 -5
  42. package/dist/esm/v2/{OrSelect-641184f0.js → OrSelect-7a2f6001.js} +9 -16
  43. package/dist/esm/v2/components/index.d.ts +0 -1
  44. package/dist/esm/v2/components/index.js +5 -6
  45. package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +0 -11
  46. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  47. package/dist/esm/v2/components/or-card-collection-v3/index.js +2 -2
  48. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  49. package/dist/esm/v2/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  50. package/dist/esm/v2/components/or-expansion-panel-v3/index.js +1 -1
  51. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +14 -25
  52. package/dist/esm/v2/components/or-select-v3/index.d.ts +0 -1
  53. package/dist/esm/v2/components/or-select-v3/index.js +2 -2
  54. package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
  55. package/dist/esm/v2/index.js +5 -6
  56. package/dist/esm/v3/{OrButton-0fa67a0d.js → OrButton-bb6bf8a9.js} +2 -11
  57. package/dist/esm/v3/{OrCardCollection-286d0f3f.js → OrCardCollection-2a6514f3.js} +1 -1
  58. package/dist/esm/v3/{OrConfirm-56ae1494.js → OrConfirm-5d56cbd3.js} +1 -1
  59. package/dist/esm/v3/{OrExpansionPanel-311e64cf.js → OrExpansionPanel-f8d7ff8d.js} +32 -5
  60. package/dist/esm/v3/{OrSelect-08bd0f60.js → OrSelect-4415b8d2.js} +10 -20
  61. package/dist/esm/v3/components/index.d.ts +0 -1
  62. package/dist/esm/v3/components/index.js +5 -6
  63. package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +0 -11
  64. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  65. package/dist/esm/v3/components/or-card-collection-v3/index.js +2 -2
  66. package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
  67. package/dist/esm/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +22 -3
  68. package/dist/esm/v3/components/or-expansion-panel-v3/index.js +1 -1
  69. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +14 -25
  70. package/dist/esm/v3/components/or-select-v3/index.d.ts +0 -1
  71. package/dist/esm/v3/components/or-select-v3/index.js +2 -2
  72. package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
  73. package/dist/esm/v3/index.js +5 -6
  74. package/package.json +1 -1
  75. package/src/components/index.ts +0 -1
  76. package/src/components/or-button-v3/OrButton.stories3.ts +0 -4
  77. package/src/components/or-button-v3/OrButton.vue +0 -6
  78. package/src/components/or-button-v3/styles.ts +1 -9
  79. package/src/components/or-expansion-panel-v3/OrExpansionPanel.stories3.ts +12 -2
  80. package/src/components/or-expansion-panel-v3/OrExpansionPanel.vue +39 -3
  81. package/src/components/or-select-v3/OrSelect.vue +14 -26
  82. package/src/components/or-select-v3/index.ts +0 -1
  83. package/src/components/or-select-v3/types.ts +1 -1
  84. package/dist/bundled/v2/OrPagination-379c10b8.js +0 -308
  85. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  86. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -112
  87. package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +0 -2
  88. package/dist/bundled/v2/components/or-pagination-v3/index.js +0 -20
  89. package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +0 -4
  90. package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +0 -4
  91. package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-c96d7cd7.js +0 -187
  92. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  93. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -112
  94. package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +0 -2
  95. package/dist/bundled/v3/components/or-pagination-v3/index.js +0 -22
  96. package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +0 -4
  97. package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +0 -4
  98. package/dist/esm/v2/OrPagination-c0dbec6a.js +0 -308
  99. package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  100. package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +0 -112
  101. package/dist/esm/v2/components/or-pagination-v3/index.d.ts +0 -2
  102. package/dist/esm/v2/components/or-pagination-v3/index.js +0 -18
  103. package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +0 -4
  104. package/dist/esm/v2/components/or-pagination-v3/types.d.ts +0 -4
  105. package/dist/esm/v3/OrPagination-a703307d.js +0 -269
  106. package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +0 -12
  107. package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +0 -112
  108. package/dist/esm/v3/components/or-pagination-v3/index.d.ts +0 -2
  109. package/dist/esm/v3/components/or-pagination-v3/index.js +0 -17
  110. package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +0 -4
  111. package/dist/esm/v3/components/or-pagination-v3/types.d.ts +0 -4
  112. package/src/components/or-pagination-v3/OrPagination.docs.mdx +0 -7
  113. package/src/components/or-pagination-v3/OrPagination.stories3.ts +0 -87
  114. package/src/components/or-pagination-v3/OrPagination.vue +0 -270
  115. package/src/components/or-pagination-v3/index.ts +0 -2
  116. package/src/components/or-pagination-v3/styles.ts +0 -38
  117. package/src/components/or-pagination-v3/types.ts +0 -4
@@ -53,7 +53,6 @@ export * from './or-notification-v3';
53
53
  export * from './or-overflow-menu';
54
54
  export * from './or-overlay';
55
55
  export * from './or-overlay-v3';
56
- export * from './or-pagination-v3';
57
56
  export * from './or-popover-v3';
58
57
  export * from './or-progress';
59
58
  export * from './or-progress-v3';
@@ -36,10 +36,6 @@ export default {
36
36
  options: Object.values(ButtonColor),
37
37
  },
38
38
 
39
- activated: {
40
- table: { disable: true },
41
- },
42
-
43
39
  disabled: {
44
40
  control: { type: 'boolean' },
45
41
  },
@@ -4,7 +4,6 @@
4
4
  v-bind="$attrs"
5
5
  :class="rootStyles"
6
6
  :type="type"
7
- :activated="activated ? '' : null"
8
7
  :disabled="disabled"
9
8
  @click="$emit('click', $event)"
10
9
  @focus="$emit('focus', $event)"
@@ -64,11 +63,6 @@ export default defineComponent({
64
63
  default: ButtonColor.Primary,
65
64
  },
66
65
 
67
- activated: {
68
- type: Boolean,
69
- default: false,
70
- },
71
-
72
66
  disabled: {
73
67
  type: Boolean,
74
68
  default: false,
@@ -116,13 +116,5 @@ export const ButtonRootColors: Record<`${ButtonColor}-${ButtonVariant}`, string[
116
116
  'dark:theme-preset-4-error-dark',
117
117
  ],
118
118
 
119
- 'inherit-link': [
120
- // Theme
121
- 'theme-foreground-inherit',
122
- 'dark:theme-foreground-inherit',
123
-
124
- // Theme (activated)
125
- 'activated:theme-foreground-default',
126
- 'dark:activated:theme-foreground-default-dark',
127
- ],
119
+ 'inherit-link': [],
128
120
  };
@@ -1,4 +1,6 @@
1
1
  import { Meta, StoryFn } from '@storybook/vue3';
2
+ import { action } from '@storybook/addon-actions';
3
+
2
4
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
3
5
  import OrExpansionPanelDocs from './OrExpansionPanel.docs.mdx';
4
6
  import OrExpansionPanel from './OrExpansionPanel.vue';
@@ -67,11 +69,19 @@ const Template: StoryFn<typeof OrExpansionPanel> = (args) => ({
67
69
  },
68
70
 
69
71
  setup() {
70
- return { args };
72
+ return {
73
+ args,
74
+ handleOpen: action('open'),
75
+ handleClose: action('close'),
76
+ };
71
77
  },
72
78
 
73
79
  template: `
74
- <OrExpansionPanel v-bind="args">
80
+ <OrExpansionPanel
81
+ v-bind="args"
82
+ @open="handleOpen"
83
+ @close="handleClose"
84
+ >
75
85
  ${args.default}
76
86
 
77
87
  <template #addon>
@@ -10,7 +10,7 @@
10
10
  :class="headerStyles"
11
11
  :tabindex="!disabled ? 0 : null"
12
12
  :disabled="disabled ? '' : null"
13
- @click.stop="expanded = !expanded"
13
+ @click.stop="expanded ? close(): open()"
14
14
  >
15
15
  <OrIcon
16
16
  :class="[expanded ? 'rotate-0' : 'rotate-[-90deg]']"
@@ -33,7 +33,7 @@
33
33
  </template>
34
34
 
35
35
  <script lang="ts">
36
- import { computed, defineComponent, PropType, ref } from 'vue-demi';
36
+ import { computed, defineComponent, PropType, ref, watch } from 'vue-demi';
37
37
  import { useClassAttribute } from '../../hooks';
38
38
  import { OrIconV3 as OrIcon } from '../or-icon-v3';
39
39
  import { ExpansionPanelColor, ExpansionPanelVariant } from './props';
@@ -54,6 +54,11 @@ export default defineComponent({
54
54
  required: true,
55
55
  },
56
56
 
57
+ isOpen: {
58
+ type: Boolean as PropType<boolean>,
59
+ default: false,
60
+ },
61
+
57
62
  variant: {
58
63
  type: String as PropType<ExpansionPanelVariant>,
59
64
  default: ExpansionPanelVariant.Default,
@@ -70,11 +75,18 @@ export default defineComponent({
70
75
  },
71
76
  },
72
77
 
78
+ emits: [
79
+ 'open',
80
+ 'close',
81
+ ],
82
+
73
83
  expose: [
74
84
  'root',
85
+ 'open',
86
+ 'close',
75
87
  ],
76
88
 
77
- setup(props) {
89
+ setup(props, context) {
78
90
  // Refs
79
91
  const root = ref<HTMLElement>();
80
92
 
@@ -100,12 +112,36 @@ export default defineComponent({
100
112
  // State
101
113
  const expanded = ref(false);
102
114
 
115
+ // Events
116
+ watch(expanded, (value) => {
117
+ context.emit(value ? 'open' : 'close');
118
+ });
119
+
120
+ watch(() => props.isOpen, (newIsOpen) => {
121
+ if (newIsOpen) {
122
+ open();
123
+ } else {
124
+ close();
125
+ }
126
+ }, { immediate: true });
127
+
128
+ // Methods
129
+ function open(): void {
130
+ expanded.value = true;
131
+ }
132
+
133
+ function close(): void {
134
+ expanded.value = false;
135
+ }
136
+
103
137
  return {
104
138
  root,
105
139
  rootStyles,
106
140
  headerStyles,
107
141
  addonStyles,
108
142
  expanded,
143
+ open,
144
+ close,
109
145
  };
110
146
  },
111
147
  });
@@ -24,7 +24,6 @@
24
24
  v-dropdown-open="toggle"
25
25
  v-dropdown-close="close"
26
26
  :class="[popoverState === 'open' && 'rounded-b-0']"
27
- :variant="disableDefaultStyles ? 'unstyled' : 'styled'"
28
27
  :size="size"
29
28
  :invalid="invalid"
30
29
  :readonly="readonly"
@@ -39,12 +38,12 @@
39
38
  @focus="$emit('focus', $event)"
40
39
  @blur="$emit('blur', $event)"
41
40
  >
42
- <template v-if="multiple">
43
- <slot
44
- name="valueTemplate"
45
- :model="proxyModelValue"
46
- >
47
- <template v-if="proxyModelValue && proxyModelValue.length > 0">
41
+ <template v-if="proxyModelValue && proxyModelValue.length > 0">
42
+ <template v-if="multiple">
43
+ <slot
44
+ name="valueTemplate"
45
+ :model="proxyModelValue"
46
+ >
48
47
  <OrTag
49
48
  v-for="option in selection"
50
49
  :key="option.value"
@@ -53,16 +52,10 @@
53
52
  >
54
53
  {{ option.label }}
55
54
  </OrTag>
56
- </template>
57
-
58
- <template v-else>
59
- <span :class="placeholderStyles">{{ placeholder }}</span>
60
- </template>
61
- </slot>
62
- </template>
55
+ </slot>
56
+ </template>
63
57
 
64
- <template v-else>
65
- <template v-if="proxyModelValue">
58
+ <template v-else>
66
59
  <slot
67
60
  name="valueTemplate"
68
61
  :model="proxyModelValue"
@@ -70,10 +63,10 @@
70
63
  {{ selection.label }}
71
64
  </slot>
72
65
  </template>
66
+ </template>
73
67
 
74
- <template v-else>
75
- <span :class="placeholderStyles">{{ placeholder }}</span>
76
- </template>
68
+ <template v-else>
69
+ <span :class="placeholderStyles">{{ placeholder }}</span>
77
70
  </template>
78
71
  </div>
79
72
 
@@ -272,12 +265,12 @@ export default defineComponent({
272
265
  },
273
266
 
274
267
  modelValue: {
275
- type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
268
+ type: [String, Array] as PropType<string | string[]>,
276
269
  default: undefined,
277
270
  },
278
271
 
279
272
  value: { // TODO: Remove Vue 2 fallback
280
- type: [String, Number, Array] as PropType<string | number | (string | number)[]>,
273
+ type: [String, Array] as PropType<string | string[]>,
281
274
  default: undefined,
282
275
  },
283
276
 
@@ -321,11 +314,6 @@ export default defineComponent({
321
314
  default: false,
322
315
  },
323
316
 
324
- disableDefaultStyles: {
325
- type: Boolean,
326
- default: false,
327
- },
328
-
329
317
  enableSearch: {
330
318
  type: Boolean,
331
319
  default: false,
@@ -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,308 +0,0 @@
1
- import './index-fa6eb4ca.js';
2
- import { O as OrButton } from './OrButton-a846fa7e.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
- const PaginationItem = [
30
- // Typography
31
- 'typography-caption-regular',
32
- // Typography (activated)
33
- 'activated:typography-caption-bold'];
34
-
35
- var script = defineComponent({
36
- name: 'OrPagination',
37
- components: {
38
- OrButton,
39
- OrIcon,
40
- OrMenu,
41
- OrMenuItem
42
- },
43
- inheritAttrs: false,
44
- props: {
45
- modelValue: {
46
- type: Object,
47
- default: undefined
48
- },
49
- value: {
50
- type: Object,
51
- default: undefined
52
- },
53
- length: {
54
- type: Number,
55
- required: true
56
- },
57
- pageSizeOptions: {
58
- type: Array,
59
- default: () => [50, 20, 10, 5]
60
- }
61
- },
62
- emits: ['update:modelValue', 'input'],
63
- expose: ['root'],
64
- setup(props, context) {
65
- // Refs
66
- const root = ref();
67
- const limitButton = ref();
68
- const limitButtonRoot = computed(() => {
69
- var _a;
70
- return (_a = limitButton.value) === null || _a === void 0 ? void 0 : _a.root;
71
- });
72
- const limitMenu = ref();
73
- const limitMenuRoot = computed(() => {
74
- var _a;
75
- return (_a = limitMenu.value) === null || _a === void 0 ? void 0 : _a.root;
76
- });
77
- // Styles
78
- const classAttribute = useClassAttribute();
79
- const rootStyles = computed(() => ['or-pagination', ...PaginationRoot, classAttribute.value]);
80
- const offsetControlStyles = computed(() => [...PaginationOffsetControl]);
81
- const limitControlStyles = computed(() => [...PaginationLimitControl]);
82
- const itemStyles = computed(() => [...PaginationItem]);
83
- // State
84
- const proxyModelValue = computed({
85
- get: () => {
86
- var _a;
87
- return (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value; // TODO: Remove Vue 2 fallback
88
- },
89
-
90
- set: value => {
91
- context.emit('input', value);
92
- context.emit('update:modelValue', value);
93
- }
94
- });
95
- const currentLimit = computed({
96
- get: () => {
97
- var _a, _b;
98
- return (_b = (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.limit) !== null && _b !== void 0 ? _b : props.pageSizeOptions[0];
99
- },
100
- set: value => {
101
- proxyModelValue.value = {
102
- limit: value,
103
- offset: 0
104
- };
105
- }
106
- });
107
- const currentOffset = computed({
108
- get: () => {
109
- var _a, _b;
110
- return (_b = (_a = proxyModelValue.value) === null || _a === void 0 ? void 0 : _a.offset) !== null && _b !== void 0 ? _b : 0;
111
- },
112
- set: value => {
113
- proxyModelValue.value = {
114
- limit: currentLimit.value,
115
- offset: value
116
- };
117
- }
118
- });
119
- const currentPage = computed({
120
- get: () => {
121
- return Math.floor(currentOffset.value / currentLimit.value) + 1;
122
- },
123
- set: value => {
124
- currentOffset.value = (value - 1) * currentLimit.value;
125
- }
126
- });
127
- const firstPage = computed(() => {
128
- return 1;
129
- });
130
- const lastPage = computed(() => {
131
- return Math.ceil(props.length / currentLimit.value);
132
- });
133
- const buttonGroup = computed(() => {
134
- return Array.from({
135
- length: lastPage.value
136
- }, (_, index) => index + 1).map(page => {
137
- switch (true) {
138
- case page > firstPage.value && page < currentPage.value - 1:
139
- case page > currentPage.value + 1 && page < lastPage.value:
140
- return '…';
141
- default:
142
- return page;
143
- }
144
- }).reduce((accumulator, page) => {
145
- if (accumulator[accumulator.length - 1] === page) {
146
- return accumulator;
147
- }
148
- return [...accumulator, page];
149
- }, []);
150
- });
151
- // Functions
152
- function toPreviousPage() {
153
- currentPage.value = currentPage.value - 1;
154
- }
155
- function toNextPage() {
156
- currentPage.value = currentPage.value + 1;
157
- }
158
- function toPage(page) {
159
- currentPage.value = page;
160
- }
161
- return {
162
- root,
163
- limitButton,
164
- limitButtonRoot,
165
- limitMenu,
166
- limitMenuRoot,
167
- rootStyles,
168
- offsetControlStyles,
169
- limitControlStyles,
170
- itemStyles,
171
- proxyModelValue,
172
- currentLimit,
173
- currentOffset,
174
- currentPage,
175
- firstPage,
176
- lastPage,
177
- buttonGroup,
178
- toPreviousPage,
179
- toNextPage,
180
- toPage
181
- };
182
- }
183
- });
184
-
185
- /* script */
186
- const __vue_script__ = script;
187
-
188
- /* template */
189
- var __vue_render__ = function () {
190
- var _vm = this;
191
- var _h = _vm.$createElement;
192
- var _c = _vm._self._c || _h;
193
- return _c('div', _vm._b({
194
- ref: "root",
195
- class: _vm.rootStyles
196
- }, 'div', _vm.$attrs, false), [_c('div', {
197
- class: _vm.offsetControlStyles
198
- }, [_c('OrButton', {
199
- class: _vm.itemStyles,
200
- attrs: {
201
- "variant": 'link',
202
- "color": 'inherit',
203
- "disabled": _vm.currentPage === _vm.firstPage
204
- },
205
- on: {
206
- "click": function ($event) {
207
- $event.stopPropagation();
208
- return _vm.toPreviousPage();
209
- }
210
- }
211
- }, [_c('OrIcon', {
212
- attrs: {
213
- "icon": 'keyboard_arrow_left'
214
- }
215
- })], 1), _vm._v(" "), _vm._l(_vm.buttonGroup, function (page, index) {
216
- return _c('OrButton', {
217
- key: index,
218
- class: _vm.itemStyles,
219
- attrs: {
220
- "variant": 'link',
221
- "color": 'inherit',
222
- "activated": _vm.currentPage === page
223
- },
224
- on: {
225
- "click": function ($event) {
226
- $event.stopPropagation();
227
- typeof page === 'number' && _vm.toPage(page);
228
- }
229
- }
230
- }, [_vm._v("\n " + _vm._s(page) + "\n ")]);
231
- }), _vm._v(" "), _c('OrButton', {
232
- class: _vm.itemStyles,
233
- attrs: {
234
- "variant": 'link',
235
- "color": 'inherit',
236
- "disabled": _vm.currentPage === _vm.lastPage
237
- },
238
- on: {
239
- "click": function ($event) {
240
- $event.stopPropagation();
241
- return _vm.toNextPage();
242
- }
243
- }
244
- }, [_c('OrIcon', {
245
- attrs: {
246
- "icon": 'keyboard_arrow_right'
247
- }
248
- })], 1)], 2), _vm._v(" "), _c('div', {
249
- class: _vm.limitControlStyles
250
- }, [_vm._v("\n Per page:\n\n "), _c('OrButton', {
251
- ref: "limitButton",
252
- class: _vm.itemStyles,
253
- attrs: {
254
- "variant": 'link',
255
- "color": 'inherit',
256
- "activated": true
257
- },
258
- on: {
259
- "click": function ($event) {
260
- $event.stopPropagation();
261
- return _vm.limitMenu.open();
262
- }
263
- }
264
- }, [_vm._v("\n " + _vm._s(_vm.currentLimit) + " "), _c('OrIcon', {
265
- attrs: {
266
- "icon": 'arrow_drop_down'
267
- }
268
- })], 1), _vm._v(" "), _c('OrMenu', {
269
- ref: "limitMenu",
270
- attrs: {
271
- "trigger": _vm.limitButtonRoot,
272
- "placement": 'top'
273
- }
274
- }, _vm._l(_vm.pageSizeOptions, function (pageSize) {
275
- return _c('OrMenuItem', {
276
- key: pageSize,
277
- on: {
278
- "click": function ($event) {
279
- $event.stopPropagation();
280
- _vm.currentLimit = pageSize;
281
- }
282
- }
283
- }, [_vm._v("\n " + _vm._s(pageSize) + "\n ")]);
284
- }), 1)], 1)]);
285
- };
286
- var __vue_staticRenderFns__ = [];
287
-
288
- /* style */
289
- const __vue_inject_styles__ = undefined;
290
- /* scoped */
291
- const __vue_scope_id__ = undefined;
292
- /* module identifier */
293
- const __vue_module_identifier__ = undefined;
294
- /* functional template */
295
- const __vue_is_functional_template__ = false;
296
- /* style inject */
297
-
298
- /* style inject SSR */
299
-
300
- /* style inject shadow dom */
301
-
302
- const __vue_component__ = /*#__PURE__*/normalizeComponent({
303
- render: __vue_render__,
304
- staticRenderFns: __vue_staticRenderFns__
305
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
306
- var __vue_component__$1 = __vue_component__;
307
-
308
- 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>)>;