@onereach/ui-components 2.69.7 → 2.69.8-beta.2189.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 (103) hide show
  1. package/dist/bundled/v2/{OrButton-4b99c680.js → OrButton-a846fa7e.js} +10 -1
  2. package/dist/bundled/v2/{OrCardCollection-754aa36f.js → OrCardCollection-0141a358.js} +1 -1
  3. package/dist/bundled/v2/{OrConfirm-cf334659.js → OrConfirm-23c3ce56.js} +1 -1
  4. package/dist/bundled/v2/OrPagination-379c10b8.js +308 -0
  5. package/dist/bundled/v2/{OrSelect-2e48be47.js → OrSelect-20226912.js} +15 -8
  6. package/dist/bundled/v2/components/index.d.ts +1 -0
  7. package/dist/bundled/v2/components/index.js +5 -4
  8. package/dist/bundled/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
  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-pagination-v3/OrPagination.stories3.d.ts +12 -0
  13. package/dist/bundled/v2/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
  14. package/dist/bundled/v2/components/or-pagination-v3/index.d.ts +2 -0
  15. package/dist/bundled/v2/components/or-pagination-v3/index.js +20 -0
  16. package/dist/bundled/v2/components/or-pagination-v3/styles.d.ts +4 -0
  17. package/dist/bundled/v2/components/or-pagination-v3/types.d.ts +4 -0
  18. package/dist/bundled/v2/components/or-select-v3/OrSelect.vue.d.ts +25 -14
  19. package/dist/bundled/v2/components/or-select-v3/index.d.ts +1 -0
  20. package/dist/bundled/v2/components/or-select-v3/index.js +1 -1
  21. package/dist/bundled/v2/components/or-select-v3/types.d.ts +1 -1
  22. package/dist/bundled/v2/index.js +6 -5
  23. package/dist/bundled/v3/{OrButton-a671b8a1.js → OrButton-2b27c1fd.js} +3 -2
  24. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-b0dc31ca.js → OrButton.vue_vue_type_script_lang-8c44986c.js} +9 -1
  25. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-365741ae.js → OrCardCollection.vue_vue_type_script_lang-2d78a51a.js} +2 -2
  26. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-68329ca1.js → OrConfirm.vue_vue_type_script_lang-05b21989.js} +2 -2
  27. package/dist/bundled/v3/OrPagination.vue_vue_type_script_lang-c96d7cd7.js +187 -0
  28. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-a5ecc5ed.js → OrSelect.vue_vue_type_script_lang-edc5eb2d.js} +6 -2
  29. package/dist/bundled/v3/components/index.d.ts +1 -0
  30. package/dist/bundled/v3/components/index.js +6 -5
  31. package/dist/bundled/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
  32. package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
  33. package/dist/bundled/v3/components/or-card-collection-v3/index.js +3 -3
  34. package/dist/bundled/v3/components/or-confirm-v3/index.js +3 -3
  35. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  36. package/dist/bundled/v3/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
  37. package/dist/bundled/v3/components/or-pagination-v3/index.d.ts +2 -0
  38. package/dist/bundled/v3/components/or-pagination-v3/index.js +22 -0
  39. package/dist/bundled/v3/components/or-pagination-v3/styles.d.ts +4 -0
  40. package/dist/bundled/v3/components/or-pagination-v3/types.d.ts +4 -0
  41. package/dist/bundled/v3/components/or-select-v3/OrSelect.vue.d.ts +25 -14
  42. package/dist/bundled/v3/components/or-select-v3/index.d.ts +1 -0
  43. package/dist/bundled/v3/components/or-select-v3/index.js +1 -1
  44. package/dist/bundled/v3/components/or-select-v3/types.d.ts +1 -1
  45. package/dist/bundled/v3/index.js +253 -162
  46. package/dist/esm/v2/{OrButton-357e1e2c.js → OrButton-835d4f11.js} +10 -1
  47. package/dist/esm/v2/{OrCardCollection-153b0179.js → OrCardCollection-3c38fc85.js} +1 -1
  48. package/dist/esm/v2/{OrConfirm-d67d5c00.js → OrConfirm-e2ab9b4c.js} +1 -1
  49. package/dist/esm/v2/OrPagination-c0dbec6a.js +308 -0
  50. package/dist/esm/v2/{OrSelect-b3794fd3.js → OrSelect-2b198f4f.js} +15 -8
  51. package/dist/esm/v2/components/index.d.ts +1 -0
  52. package/dist/esm/v2/components/index.js +5 -4
  53. package/dist/esm/v2/components/or-button-v3/OrButton.vue.d.ts +11 -0
  54. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  55. package/dist/esm/v2/components/or-card-collection-v3/index.js +2 -2
  56. package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
  57. package/dist/esm/v2/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  58. package/dist/esm/v2/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
  59. package/dist/esm/v2/components/or-pagination-v3/index.d.ts +2 -0
  60. package/dist/esm/v2/components/or-pagination-v3/index.js +18 -0
  61. package/dist/esm/v2/components/or-pagination-v3/styles.d.ts +4 -0
  62. package/dist/esm/v2/components/or-pagination-v3/types.d.ts +4 -0
  63. package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +25 -14
  64. package/dist/esm/v2/components/or-select-v3/index.d.ts +1 -0
  65. package/dist/esm/v2/components/or-select-v3/index.js +1 -1
  66. package/dist/esm/v2/components/or-select-v3/types.d.ts +1 -1
  67. package/dist/esm/v2/index.js +5 -4
  68. package/dist/esm/v3/{OrButton-bb6bf8a9.js → OrButton-0fa67a0d.js} +11 -2
  69. package/dist/esm/v3/{OrCardCollection-a09ad585.js → OrCardCollection-dbb3e839.js} +1 -1
  70. package/dist/esm/v3/{OrConfirm-b93b5131.js → OrConfirm-1bcd39b1.js} +1 -1
  71. package/dist/esm/v3/OrPagination-a703307d.js +269 -0
  72. package/dist/esm/v3/{OrSelect-a0718c44.js → OrSelect-f42de9d8.js} +19 -9
  73. package/dist/esm/v3/components/index.d.ts +1 -0
  74. package/dist/esm/v3/components/index.js +5 -4
  75. package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +11 -0
  76. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  77. package/dist/esm/v3/components/or-card-collection-v3/index.js +2 -2
  78. package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
  79. package/dist/esm/v3/components/or-pagination-v3/OrPagination.stories3.d.ts +12 -0
  80. package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +112 -0
  81. package/dist/esm/v3/components/or-pagination-v3/index.d.ts +2 -0
  82. package/dist/esm/v3/components/or-pagination-v3/index.js +17 -0
  83. package/dist/esm/v3/components/or-pagination-v3/styles.d.ts +4 -0
  84. package/dist/esm/v3/components/or-pagination-v3/types.d.ts +4 -0
  85. package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +25 -14
  86. package/dist/esm/v3/components/or-select-v3/index.d.ts +1 -0
  87. package/dist/esm/v3/components/or-select-v3/index.js +1 -1
  88. package/dist/esm/v3/components/or-select-v3/types.d.ts +1 -1
  89. package/dist/esm/v3/index.js +5 -4
  90. package/package.json +2 -3
  91. package/src/components/index.ts +1 -0
  92. package/src/components/or-button-v3/OrButton.stories3.ts +4 -0
  93. package/src/components/or-button-v3/OrButton.vue +6 -0
  94. package/src/components/or-button-v3/styles.ts +9 -1
  95. package/src/components/or-pagination-v3/OrPagination.docs.mdx +7 -0
  96. package/src/components/or-pagination-v3/OrPagination.stories3.ts +87 -0
  97. package/src/components/or-pagination-v3/OrPagination.vue +270 -0
  98. package/src/components/or-pagination-v3/index.ts +2 -0
  99. package/src/components/or-pagination-v3/styles.ts +38 -0
  100. package/src/components/or-pagination-v3/types.ts +4 -0
  101. package/src/components/or-select-v3/OrSelect.vue +26 -14
  102. package/src/components/or-select-v3/index.ts +1 -0
  103. package/src/components/or-select-v3/types.ts +1 -1
@@ -23,13 +23,13 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
23
23
  dropdownStyles: import("@vue/composition-api").ComputedRef<string[]>;
24
24
  noSearchResultsStyles: import("@vue/composition-api").ComputedRef<string[]>;
25
25
  controlId: import("@vue/composition-api").Ref<string>;
26
- proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | string[]>;
26
+ proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number | (string | number)[]>;
27
27
  invalid: import("@vue/composition-api").ComputedRef<boolean>;
28
28
  readonly: import("@vue/composition-api").ComputedRef<boolean>;
29
29
  selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
30
30
  searchText: import("@vue/composition-api").Ref<string>;
31
31
  internalSearchOptions: import("@vue/composition-api").Ref<{
32
- value: string;
32
+ value: string | number;
33
33
  label: string;
34
34
  }[]>;
35
35
  resolvedSearchOptions: import("@vue/composition-api").ComputedRef<SelectOption[]>;
@@ -49,11 +49,11 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
49
49
  default: SelectOption[];
50
50
  };
51
51
  modelValue: {
52
- type: PropType<string | string[]>;
52
+ type: PropType<string | number | (string | number)[]>;
53
53
  default: undefined;
54
54
  };
55
55
  value: {
56
- type: PropType<string | string[]>;
56
+ type: PropType<string | number | (string | number)[]>;
57
57
  default: undefined;
58
58
  };
59
59
  multiple: {
@@ -88,6 +88,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
88
88
  type: BooleanConstructor;
89
89
  default: boolean;
90
90
  };
91
+ disableDefaultStyles: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
91
95
  enableSearch: {
92
96
  type: BooleanConstructor;
93
97
  default: boolean;
@@ -114,11 +118,11 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
114
118
  default: SelectOption[];
115
119
  };
116
120
  modelValue: {
117
- type: PropType<string | string[]>;
121
+ type: PropType<string | number | (string | number)[]>;
118
122
  default: undefined;
119
123
  };
120
124
  value: {
121
- type: PropType<string | string[]>;
125
+ type: PropType<string | number | (string | number)[]>;
122
126
  default: undefined;
123
127
  };
124
128
  multiple: {
@@ -153,6 +157,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
153
157
  type: BooleanConstructor;
154
158
  default: boolean;
155
159
  };
160
+ disableDefaultStyles: {
161
+ type: BooleanConstructor;
162
+ default: boolean;
163
+ };
156
164
  enableSearch: {
157
165
  type: BooleanConstructor;
158
166
  default: boolean;
@@ -173,8 +181,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
173
181
  label: string;
174
182
  options: SelectOption[];
175
183
  searchOptions: SelectOption[];
176
- modelValue: string | string[];
177
- value: string | string[];
184
+ modelValue: string | number | (string | number)[];
185
+ value: string | number | (string | number)[];
178
186
  multiple: boolean;
179
187
  size: SelectSize;
180
188
  placeholder: string;
@@ -182,6 +190,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
182
190
  error: string;
183
191
  required: boolean;
184
192
  disabled: boolean;
193
+ disableDefaultStyles: boolean;
185
194
  enableSearch: boolean;
186
195
  searchFunction: SelectSearchFunction;
187
196
  groupByFunction: SelectGroupByFunction;
@@ -210,13 +219,13 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
210
219
  dropdownStyles: import("@vue/composition-api").ComputedRef<string[]>;
211
220
  noSearchResultsStyles: import("@vue/composition-api").ComputedRef<string[]>;
212
221
  controlId: import("@vue/composition-api").Ref<string>;
213
- proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | string[]>;
222
+ proxyModelValue: import("@vue/composition-api").WritableComputedRef<string | number | (string | number)[]>;
214
223
  invalid: import("@vue/composition-api").ComputedRef<boolean>;
215
224
  readonly: import("@vue/composition-api").ComputedRef<boolean>;
216
225
  selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
217
226
  searchText: import("@vue/composition-api").Ref<string>;
218
227
  internalSearchOptions: import("@vue/composition-api").Ref<{
219
- value: string;
228
+ value: string | number;
220
229
  label: string;
221
230
  }[]>;
222
231
  resolvedSearchOptions: import("@vue/composition-api").ComputedRef<SelectOption[]>;
@@ -230,8 +239,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
230
239
  label: string;
231
240
  options: SelectOption[];
232
241
  searchOptions: SelectOption[];
233
- modelValue: string | string[];
234
- value: string | string[];
242
+ modelValue: string | number | (string | number)[];
243
+ value: string | number | (string | number)[];
235
244
  multiple: boolean;
236
245
  size: SelectSize;
237
246
  placeholder: string;
@@ -239,6 +248,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
239
248
  error: string;
240
249
  required: boolean;
241
250
  disabled: boolean;
251
+ disableDefaultStyles: boolean;
242
252
  enableSearch: boolean;
243
253
  searchFunction: SelectSearchFunction;
244
254
  groupByFunction: SelectGroupByFunction;
@@ -249,8 +259,8 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
249
259
  label: string;
250
260
  options: SelectOption[];
251
261
  searchOptions: SelectOption[];
252
- modelValue: string | string[];
253
- value: string | string[];
262
+ modelValue: string | number | (string | number)[];
263
+ value: string | number | (string | number)[];
254
264
  multiple: boolean;
255
265
  size: SelectSize;
256
266
  placeholder: string;
@@ -258,6 +268,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
258
268
  error: string;
259
269
  required: boolean;
260
270
  disabled: boolean;
271
+ disableDefaultStyles: boolean;
261
272
  enableSearch: boolean;
262
273
  searchFunction: SelectSearchFunction;
263
274
  groupByFunction: SelectGroupByFunction;
@@ -1,2 +1,3 @@
1
1
  export { default as OrSelectV3 } from './OrSelect.vue';
2
2
  export * from './props';
3
+ export * from './types';
@@ -1,4 +1,4 @@
1
- export { s as OrSelectV3 } from '../../OrSelect-a0718c44.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect-f42de9d8.js';
2
2
  export { a as SelectSize } from '../../OrInputBox-6d1b6059.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
@@ -1,5 +1,5 @@
1
1
  export interface SelectOption {
2
- value: string;
2
+ value: string | number;
3
3
  label: string;
4
4
  }
5
5
  export interface SelectSearchFunction {
@@ -3,10 +3,10 @@ export { a as AvatarColor, A as AvatarSize, s as OrAvatarV3 } from './OrAvatar-5
3
3
  export { s as OrBottomSheetV3 } from './OrBottomSheet-62817aec.js';
4
4
  export { s as OrButton, a as OrButtonColors, b as OrButtonSizes, O as OrButtonViews } from './OrButton-fca9019a.js';
5
5
  export { b as BUTTON_COLOR, d as BUTTON_LOADER_TYPE, c as BUTTON_SIZE, B as BUTTON_TYPE, I as ICON_BUTTON_TYPE, s as OrButtonV2, a as OrIconButton } from './OrIconButton-8be9c89f.js';
6
- export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3 } from './OrButton-bb6bf8a9.js';
6
+ export { a as ButtonColor, b as ButtonType, B as ButtonVariant, s as OrButtonV3 } from './OrButton-0fa67a0d.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 { D as DefaultCardCollectionViews, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-a09ad585.js';
9
+ export { D as DefaultCardCollectionViews, s as OrCardCollectionV3, d as defaultViewModes, g as gridView, l as listView } from './OrCardCollection-dbb3e839.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';
@@ -16,7 +16,7 @@ export { s as OrCode, O as OrCodeLanguages } from './OrCode-5ed69c23.js';
16
16
  export { s as OrCollapse } from './OrCollapse-445141ab.js';
17
17
  export { s as OrColorPicker, h as amber, n as black, b as blue, m as blueGrey, k as brown, c as cyan, j as deepOrange, d as deepPurple, g as green, i as indigo, l as lightBlue, e as lightGreen, f as lime, o as orange, p as pink, a as purple, r as red, t as teal, w as white, y as yellow } from './OrColorPicker-189cb097.js';
18
18
  export { s as OrConfirm } from './OrConfirm-f39bd784.js';
19
- export { C as ConfirmType, s as OrConfirmV3 } from './OrConfirm-b93b5131.js';
19
+ export { C as ConfirmType, s as OrConfirmV3 } from './OrConfirm-1bcd39b1.js';
20
20
  export { D as DEFAULT_TEXT, s as OrDateTimePicker, a as OrDateTimePickerItemTypes, O as OrDateTimePickerTypes } from './OrDateTimePicker-f2e08564.js';
21
21
  export { s as OrError } from './OrError-f90296db.js';
22
22
  export { s as OrErrorTagV3 } from './OrErrorTag-98252eef.js';
@@ -54,6 +54,7 @@ export { N as NotificationVariant, s as OrNotificationV3 } from './OrNotificatio
54
54
  export { s as OrOverflowMenu } from './OrOverflowMenu-e82cbcbe.js';
55
55
  export { s as OrOverlay } from './OrOverlay-451dce49.js';
56
56
  export { s as OrOverlayV3 } from './OrOverlay-738a44d5.js';
57
+ export { s as OrPaginationV3 } from './OrPagination-a703307d.js';
57
58
  export { s as OrProgress, O as OrProgressColors, a as OrProgressTypes } from './OrProgress-d0d52c86.js';
58
59
  export { s as OrProgressV3, P as ProgressColor, a as ProgressType } from './OrProgress-407002e0.js';
59
60
  export { s as OrRadio } from './OrRadio-c3ab11f2.js';
@@ -62,7 +63,7 @@ export { s as OrRadioV3 } from './OrRadio-54b6d0de.js';
62
63
  export { s as OrSearchV3 } from './OrSearch-9885d178.js';
63
64
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-171cad78.js';
64
65
  export { s as OrSelect } from './OrSelect-0821b907.js';
65
- export { s as OrSelectV3 } from './OrSelect-a0718c44.js';
66
+ export { s as OrSelectV3 } from './OrSelect-f42de9d8.js';
66
67
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
67
68
  export { O as OrSidebarPlacement, s as OrSidebarV3 } from './OrSidebar-a62972f5.js';
68
69
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-2b1610ce.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.69.7",
3
+ "version": "2.69.8-beta.2189.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -124,6 +124,5 @@
124
124
  "default": "./dist/bundled/v3/components/*/index.js"
125
125
  },
126
126
  "./package.json": "./package.json"
127
- },
128
- "gitHead": "8656340cabbccd699ec9f5b339c8f065325872c7"
127
+ }
129
128
  }
@@ -53,6 +53,7 @@ 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';
56
57
  export * from './or-popover-v3';
57
58
  export * from './or-progress';
58
59
  export * from './or-progress-v3';
@@ -36,6 +36,10 @@ export default {
36
36
  options: Object.values(ButtonColor),
37
37
  },
38
38
 
39
+ activated: {
40
+ table: { disable: true },
41
+ },
42
+
39
43
  disabled: {
40
44
  control: { type: 'boolean' },
41
45
  },
@@ -4,6 +4,7 @@
4
4
  v-bind="$attrs"
5
5
  :class="rootStyles"
6
6
  :type="type"
7
+ :activated="activated ? '' : null"
7
8
  :disabled="disabled"
8
9
  @click="$emit('click', $event)"
9
10
  @focus="$emit('focus', $event)"
@@ -63,6 +64,11 @@ export default defineComponent({
63
64
  default: ButtonColor.Primary,
64
65
  },
65
66
 
67
+ activated: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
71
+
66
72
  disabled: {
67
73
  type: Boolean,
68
74
  default: false,
@@ -116,5 +116,13 @@ export const ButtonRootColors: Record<`${ButtonColor}-${ButtonVariant}`, string[
116
116
  'dark:theme-preset-4-error-dark',
117
117
  ],
118
118
 
119
- 'inherit-link': [],
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
+ ],
120
128
  };
@@ -0,0 +1,7 @@
1
+ import { DocsPage } from '@storybook/addon-docs';
2
+
3
+ ```ts
4
+ import { OrPaginationV3 as OrPagination } from '@onereach/ui-components';
5
+ ```
6
+
7
+ <DocsPage />
@@ -0,0 +1,87 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { Meta, StoryFn } from '@storybook/vue3';
3
+ import { ref, watch } from 'vue-demi';
4
+ import OrPaginationDocs from './OrPagination.docs.mdx';
5
+ import OrPagination from './OrPagination.vue';
6
+ import { PaginationModel } from './types';
7
+
8
+ export default {
9
+ title: 'Components/Pagination',
10
+ component: OrPagination,
11
+
12
+ argTypes: {
13
+ // Props
14
+ modelValue: {
15
+ control: { type: 'text' },
16
+ },
17
+
18
+ value: { // TODO: Remove Vue 2 fallback
19
+ table: { disable: true },
20
+ },
21
+
22
+ length: {
23
+ control: { type: 'number' },
24
+ },
25
+
26
+ // Events
27
+ 'update:modelValue': {
28
+ table: { disable: true },
29
+ },
30
+
31
+ input: {
32
+ table: { disable: true },
33
+ },
34
+ },
35
+
36
+ parameters: {
37
+ layout: 'centered',
38
+
39
+ docs: {
40
+ page: OrPaginationDocs,
41
+ },
42
+
43
+ design: {
44
+ type: 'figma',
45
+ url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=4063%3A35218&t=axoGLEPrByClXTTU-4',
46
+ },
47
+ },
48
+ } as Meta<typeof OrPagination>;
49
+
50
+ const Template: StoryFn<typeof OrPagination> = (args) => ({
51
+ components: {
52
+ OrPagination,
53
+ },
54
+
55
+ setup() {
56
+ // State
57
+ const model = ref<PaginationModel>();
58
+
59
+ // Effects
60
+ watch(model, (value) => {
61
+ console.debug(value);
62
+ });
63
+
64
+ return {
65
+ args,
66
+ model,
67
+ onUpdateModelValue: action('update:modelValue'),
68
+ onInput: action('input'),
69
+ };
70
+ },
71
+
72
+ template: `
73
+ <OrPagination
74
+ v-model="model"
75
+ v-bind="args"
76
+ @update:modelValue="onUpdateModelValue"
77
+ @input="onInput"
78
+ />
79
+ `,
80
+ });
81
+
82
+ export const Default = Template.bind({});
83
+
84
+ Default.args = {
85
+ // Props
86
+ length: 555,
87
+ };
@@ -0,0 +1,270 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ v-bind="$attrs"
5
+ :class="rootStyles"
6
+ >
7
+ <div :class="offsetControlStyles">
8
+ <OrButton
9
+ :class="itemStyles"
10
+ :variant="'link'"
11
+ :color="'inherit'"
12
+ :disabled="currentPage === firstPage"
13
+ @click.stop="toPreviousPage()"
14
+ >
15
+ <OrIcon :icon="'keyboard_arrow_left'" />
16
+ </OrButton>
17
+
18
+ <OrButton
19
+ v-for="(page, index) in buttonGroup"
20
+ :key="index"
21
+ :class="itemStyles"
22
+ :variant="'link'"
23
+ :color="'inherit'"
24
+ :activated="currentPage === page"
25
+ @click.stop="typeof page === 'number' && toPage(page)"
26
+ >
27
+ {{ page }}
28
+ </OrButton>
29
+
30
+ <OrButton
31
+ :class="itemStyles"
32
+ :variant="'link'"
33
+ :color="'inherit'"
34
+ :disabled="currentPage === lastPage"
35
+ @click.stop="toNextPage()"
36
+ >
37
+ <OrIcon :icon="'keyboard_arrow_right'" />
38
+ </OrButton>
39
+ </div>
40
+
41
+ <div :class="limitControlStyles">
42
+ Per page:
43
+
44
+ <OrButton
45
+ ref="limitButton"
46
+ :class="itemStyles"
47
+ :variant="'link'"
48
+ :color="'inherit'"
49
+ :activated="true"
50
+ @click.stop="limitMenu.open()"
51
+ >
52
+ {{ currentLimit }} <OrIcon :icon="'arrow_drop_down'" />
53
+ </OrButton>
54
+
55
+ <OrMenu
56
+ ref="limitMenu"
57
+ :trigger="limitButtonRoot"
58
+ :placement="'top'"
59
+ >
60
+ <OrMenuItem
61
+ v-for="pageSize in pageSizeOptions"
62
+ :key="pageSize"
63
+ @click.stop="currentLimit = pageSize"
64
+ >
65
+ {{ pageSize }}
66
+ </OrMenuItem>
67
+ </OrMenu>
68
+ </div>
69
+ </div>
70
+ </template>
71
+
72
+ <script lang="ts">
73
+ import { computed, defineComponent, PropType, ref } from 'vue-demi';
74
+ import { useClassAttribute } from '../../hooks';
75
+ import { OrButtonV3 as OrButton } from '../or-button-v3';
76
+ import { OrIconV3 as OrIcon } from '../or-icon-v3';
77
+ import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
78
+ import { OrMenuV3 as OrMenu } from '../or-menu-v3';
79
+ import { PaginationItem, PaginationLimitControl, PaginationOffsetControl, PaginationRoot } from './styles';
80
+ import { PaginationModel } from './types';
81
+
82
+ export default defineComponent({
83
+ name: 'OrPagination',
84
+
85
+ components: {
86
+ OrButton,
87
+ OrIcon,
88
+ OrMenu,
89
+ OrMenuItem,
90
+ },
91
+
92
+ inheritAttrs: false,
93
+
94
+ props: {
95
+ modelValue: {
96
+ type: Object as PropType<PaginationModel>,
97
+ default: undefined,
98
+ },
99
+
100
+ value: { // TODO: Remove Vue 2 fallback
101
+ type: Object as PropType<PaginationModel>,
102
+ default: undefined,
103
+ },
104
+
105
+ length: {
106
+ type: Number,
107
+ required: true,
108
+ },
109
+
110
+ pageSizeOptions: {
111
+ type: Array as PropType<number[]>,
112
+ default: () => [50, 20, 10, 5],
113
+ },
114
+ },
115
+
116
+ emits: [
117
+ 'update:modelValue',
118
+
119
+ 'input',
120
+ ],
121
+
122
+ expose: [
123
+ 'root',
124
+ ],
125
+
126
+ setup(props, context) {
127
+ // Refs
128
+ const root = ref<HTMLElement>();
129
+
130
+ const limitButton = ref<InstanceType<typeof OrButton>>();
131
+ const limitButtonRoot = computed(() => limitButton.value?.root);
132
+
133
+ const limitMenu = ref<InstanceType<typeof OrMenu>>();
134
+ const limitMenuRoot = computed(() => limitMenu.value?.root);
135
+
136
+ // Styles
137
+ const classAttribute = useClassAttribute();
138
+
139
+ const rootStyles = computed(() => [
140
+ 'or-pagination',
141
+ ...PaginationRoot,
142
+ classAttribute.value,
143
+ ]);
144
+
145
+ const offsetControlStyles = computed(() => [
146
+ ...PaginationOffsetControl,
147
+ ]);
148
+
149
+ const limitControlStyles = computed(() => [
150
+ ...PaginationLimitControl,
151
+ ]);
152
+
153
+ const itemStyles = computed(() => [
154
+ ...PaginationItem,
155
+ ]);
156
+
157
+ // State
158
+ const proxyModelValue = computed({
159
+ get: () => {
160
+ return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
161
+ },
162
+
163
+ set: (value) => {
164
+ context.emit('input', value);
165
+ context.emit('update:modelValue', value);
166
+ },
167
+ });
168
+
169
+ const currentLimit = computed<number>({
170
+ get: () => {
171
+ return proxyModelValue.value?.limit ?? props.pageSizeOptions[0];
172
+ },
173
+
174
+ set: (value) => {
175
+ proxyModelValue.value = {
176
+ limit: value,
177
+ offset: 0,
178
+ };
179
+ },
180
+ });
181
+
182
+ const currentOffset = computed<number>({
183
+ get: () => {
184
+ return proxyModelValue.value?.offset ?? 0;
185
+ },
186
+
187
+ set: (value) => {
188
+ proxyModelValue.value = {
189
+ limit: currentLimit.value,
190
+ offset: value,
191
+ };
192
+ },
193
+ });
194
+
195
+ const currentPage = computed<number>({
196
+ get: () => {
197
+ return Math.floor(currentOffset.value / currentLimit.value) + 1;
198
+ },
199
+
200
+ set: (value) => {
201
+ currentOffset.value = (value - 1) * currentLimit.value;
202
+ },
203
+ });
204
+
205
+ const firstPage = computed<number>(() => {
206
+ return 1;
207
+ });
208
+
209
+ const lastPage = computed<number>(() => {
210
+ return Math.ceil(props.length / currentLimit.value);
211
+ });
212
+
213
+ const buttonGroup = computed<(number | string)[]>(() => {
214
+ return Array.from({ length: lastPage.value }, (_, index) => index + 1)
215
+ .map((page) => {
216
+ switch (true) {
217
+ case page > firstPage.value && page < currentPage.value - 1:
218
+ case page > currentPage.value + 1 && page < lastPage.value:
219
+ return '…';
220
+
221
+ default:
222
+ return page;
223
+ }
224
+ })
225
+ .reduce((accumulator, page) => {
226
+ if (accumulator[accumulator.length - 1] === page) {
227
+ return accumulator;
228
+ }
229
+
230
+ return [...accumulator, page];
231
+ }, [] as (number | string)[]);
232
+ });
233
+
234
+ // Functions
235
+ function toPreviousPage(): void {
236
+ currentPage.value = currentPage.value - 1;
237
+ }
238
+
239
+ function toNextPage(): void {
240
+ currentPage.value = currentPage.value + 1;
241
+ }
242
+
243
+ function toPage(page: number): void {
244
+ currentPage.value = page;
245
+ }
246
+
247
+ return {
248
+ root,
249
+ limitButton,
250
+ limitButtonRoot,
251
+ limitMenu,
252
+ limitMenuRoot,
253
+ rootStyles,
254
+ offsetControlStyles,
255
+ limitControlStyles,
256
+ itemStyles,
257
+ proxyModelValue,
258
+ currentLimit,
259
+ currentOffset,
260
+ currentPage,
261
+ firstPage,
262
+ lastPage,
263
+ buttonGroup,
264
+ toPreviousPage,
265
+ toNextPage,
266
+ toPage,
267
+ };
268
+ },
269
+ });
270
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as OrPaginationV3 } from './OrPagination.vue';
2
+ export * from './types';
@@ -0,0 +1,38 @@
1
+ export const PaginationRoot: string[] = [
2
+ // Layout
3
+ 'layout-row',
4
+
5
+ // Spacing
6
+ 'gap-xl',
7
+
8
+ // Typography
9
+ 'typography-caption-regular',
10
+
11
+ // Theme
12
+ 'theme-foreground-outline',
13
+ 'dark:theme-foreground-outline-dark',
14
+ ];
15
+
16
+ export const PaginationOffsetControl: string[] = [
17
+ // Layout
18
+ 'layout-row',
19
+
20
+ // Spacing
21
+ 'gap-md',
22
+ ];
23
+
24
+ export const PaginationLimitControl: string[] = [
25
+ // Layout
26
+ 'layout-row',
27
+
28
+ // Spacing
29
+ 'gap-sm',
30
+ ];
31
+
32
+ export const PaginationItem: string[] = [
33
+ // Typography
34
+ 'typography-caption-regular',
35
+
36
+ // Typography (activated)
37
+ 'activated:typography-caption-bold',
38
+ ];
@@ -0,0 +1,4 @@
1
+ export interface PaginationModel {
2
+ limit: number;
3
+ offset: number;
4
+ }