@onereach/ui-components-vue2 19.2.0 → 19.2.1
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.
- package/dist/bundled/{OrDateTimePickerTimeSelect-08982514.js → OrDateTimePickerTimeSelect-bc45d3c7.js} +11 -8
- package/dist/bundled/components/OrDateTimePickerV3/OrDateTimePicker.js +1 -1
- package/dist/bundled/components/OrDateTimePickerV3/index.js +2 -1
- package/dist/bundled/components/OrDateTimePickerV3/utils/index.d.ts +1 -0
- package/dist/bundled/components/OrDateTimePickerV3/utils/index.js +1 -0
- package/dist/bundled/components/OrDateTimePickerV3/utils/scrollToElementWithinContainer.d.ts +1 -0
- package/dist/bundled/components/OrDateTimePickerV3/utils/scrollToElementWithinContainer.js +13 -0
- package/dist/bundled/components/OrTimePickerV3/OrTimePicker.js +1 -1
- package/dist/bundled/components/OrTimeRangePickerV3/OrTimeRangePicker.js +1 -1
- package/dist/bundled/components/index.js +2 -1
- package/dist/bundled/index.js +2 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/or-data-grid-v3/index.js +1 -1
- package/dist/esm/components/or-data-grid-v3/partials/index.js +1 -1
- package/dist/esm/components/or-date-format-v3/index.js +1 -1
- package/dist/esm/components/or-date-picker-v3/index.js +1 -1
- package/dist/esm/components/or-date-range-picker-v3/index.js +1 -1
- package/dist/esm/components/or-date-time-format-v3/index.js +1 -1
- package/dist/esm/components/or-date-time-picker-v3/index.js +1 -1
- package/dist/esm/components/or-date-time-picker-v3/partials/index.js +11 -9
- package/dist/esm/components/or-date-time-picker-v3/utils/index.d.ts +1 -0
- package/dist/esm/components/or-date-time-picker-v3/utils/index.js +1 -1
- package/dist/esm/components/or-date-time-picker-v3/utils/scrollToElementWithinContainer.d.ts +1 -0
- package/dist/esm/components/or-time-format-v3/index.js +1 -1
- package/dist/esm/components/or-time-picker-v3/index.js +1 -1
- package/dist/esm/components/or-time-range-picker-v3/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/scrollToElementWithinContainer-f5107b92.js +36 -0
- package/package.json +3 -3
- package/dist/esm/formatTime-a1de80d6.js +0 -24
|
@@ -4,6 +4,7 @@ import { formatTime } from './components/OrDateTimePickerV3/utils/formatTime.js'
|
|
|
4
4
|
import { useProxyModelValue } from './hooks/useProxyModelValue.js';
|
|
5
5
|
import { n as normalizeComponent } from './normalize-component-cf2db48b.js';
|
|
6
6
|
import __vue_component__$2 from './components/OrButtonV3/OrButton.js';
|
|
7
|
+
import { scrollToElementWithinContainer } from './components/OrDateTimePickerV3/utils/scrollToElementWithinContainer.js';
|
|
7
8
|
import { TimeFormat } from './types/TimeFormat.js';
|
|
8
9
|
|
|
9
10
|
const DateTimePickerTimeControl = [
|
|
@@ -202,6 +203,8 @@ var script = defineComponent({
|
|
|
202
203
|
var _a;
|
|
203
204
|
// Refs & Styles
|
|
204
205
|
const root = ref();
|
|
206
|
+
const hoursContainer = ref();
|
|
207
|
+
const minutesContainer = ref();
|
|
205
208
|
const hoursButtons = ref([]);
|
|
206
209
|
const minutesButtons = ref([]);
|
|
207
210
|
const rootStyles = computed(() => ['or-date-time-picker-time-select-v3', ...DateTimePickerTimeSelect]);
|
|
@@ -230,17 +233,13 @@ var script = defineComponent({
|
|
|
230
233
|
}
|
|
231
234
|
const activeHourButton = getActiveButton(hoursButtons.value, hoursOptions.value);
|
|
232
235
|
const activeMinuteButton = getActiveButton(minutesButtons.value, minutesOptions.value);
|
|
233
|
-
if (activeHourButton) {
|
|
236
|
+
if (activeHourButton && hoursContainer.value) {
|
|
234
237
|
// scroll to the active hour button within the hours container.
|
|
235
|
-
activeHourButton.
|
|
236
|
-
block: 'center'
|
|
237
|
-
});
|
|
238
|
+
scrollToElementWithinContainer(activeHourButton, hoursContainer.value);
|
|
238
239
|
}
|
|
239
|
-
if (activeMinuteButton) {
|
|
240
|
+
if (activeMinuteButton && minutesContainer.value) {
|
|
240
241
|
// scroll to the active minute button within the minutes container.
|
|
241
|
-
activeMinuteButton.
|
|
242
|
-
block: 'center'
|
|
243
|
-
});
|
|
242
|
+
scrollToElementWithinContainer(activeMinuteButton, minutesContainer.value);
|
|
244
243
|
}
|
|
245
244
|
});
|
|
246
245
|
}, {
|
|
@@ -310,6 +309,8 @@ var script = defineComponent({
|
|
|
310
309
|
return {
|
|
311
310
|
root,
|
|
312
311
|
rootStyles,
|
|
312
|
+
hoursContainer,
|
|
313
|
+
minutesContainer,
|
|
313
314
|
hoursButtons,
|
|
314
315
|
minutesButtons,
|
|
315
316
|
buttonGroupStyles,
|
|
@@ -337,6 +338,7 @@ var __vue_render__ = function () {
|
|
|
337
338
|
ref: 'root',
|
|
338
339
|
class: _vm.rootStyles
|
|
339
340
|
}, [_c('div', {
|
|
341
|
+
ref: 'hoursContainer',
|
|
340
342
|
class: _vm.buttonGroupStyles
|
|
341
343
|
}, _vm._l(_vm.hoursOptions, function (value) {
|
|
342
344
|
return _c('OrButton', {
|
|
@@ -357,6 +359,7 @@ var __vue_render__ = function () {
|
|
|
357
359
|
}
|
|
358
360
|
}, [_vm._v("\n " + _vm._s(_vm.formatHours(value)) + "\n ")]);
|
|
359
361
|
}), 1), _vm._v("\n\n :\n\n "), _c('div', {
|
|
362
|
+
ref: 'minutesContainer',
|
|
360
363
|
class: _vm.buttonGroupStyles
|
|
361
364
|
}, _vm._l(_vm.minutesOptions, function (value) {
|
|
362
365
|
return _c('OrButton', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, toRef, watch } from 'vue-demi';
|
|
2
2
|
import { O as OrDateTimePickerDateControl, a as OrDateTimePickerDateSelect, b as OrDateTimePickerMonthSelect } from '../../OrDateTimePickerMonthSelect-ae771d05.js';
|
|
3
3
|
import { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from '../../OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
4
|
-
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-
|
|
4
|
+
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
5
5
|
import { DateTimePicker, DateTimePickerDatePopover, DateTimePickerTimePopover } from './styles.js';
|
|
6
6
|
import __vue_component__$1 from '../OrErrorV3/OrError.js';
|
|
7
7
|
import __vue_component__$2 from '../OrHintV3/OrHint.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { default as OrDateTimePickerV3 } from './OrDateTimePicker.js';
|
|
2
2
|
export { O as OrDateTimePickerDateControl, a as OrDateTimePickerDateSelect, b as OrDateTimePickerMonthSelect } from '../../OrDateTimePickerMonthSelect-ae771d05.js';
|
|
3
3
|
export { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from '../../OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
4
|
-
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-
|
|
4
|
+
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
5
5
|
export { formatDate } from './utils/formatDate.js';
|
|
6
6
|
export { formatMobileDate } from './utils/formatMobileDate.js';
|
|
7
7
|
export { formatMobileTime } from './utils/formatMobileTime.js';
|
|
8
8
|
export { formatTime } from './utils/formatTime.js';
|
|
9
9
|
export { getCurrentDate } from './utils/getCurrentDate.js';
|
|
10
10
|
export { getNextMonthDate } from './utils/getNextMonthDate.js';
|
|
11
|
+
export { scrollToElementWithinContainer } from './utils/scrollToElementWithinContainer.js';
|
|
@@ -4,3 +4,4 @@ export { formatMobileTime } from './formatMobileTime.js';
|
|
|
4
4
|
export { formatTime } from './formatTime.js';
|
|
5
5
|
export { getCurrentDate } from './getCurrentDate.js';
|
|
6
6
|
export { getNextMonthDate } from './getNextMonthDate.js';
|
|
7
|
+
export { scrollToElementWithinContainer } from './scrollToElementWithinContainer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scrollToElementWithinContainer: (element: HTMLElement, container: HTMLElement) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const scrollToElementWithinContainer = (element, container) => {
|
|
2
|
+
const elementRect = element.getBoundingClientRect();
|
|
3
|
+
const containerRect = container.getBoundingClientRect();
|
|
4
|
+
// Determine if the element is fully visible within the container by comparing their positions.
|
|
5
|
+
const isFullyVisible = elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;
|
|
6
|
+
if (!isFullyVisible) {
|
|
7
|
+
// Calculate the new scrollTop value to center the element within the container.
|
|
8
|
+
// This involves adjusting for the height of the element and container, ensuring the element is centered.
|
|
9
|
+
container.scrollTop = element.offsetTop - container.offsetTop - container.clientHeight / 2 + element.clientHeight / 2;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { scrollToElementWithinContainer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, toRef, watch } from 'vue-demi';
|
|
2
2
|
import { TimePicker, TimePickerPopover } from './styles.js';
|
|
3
|
-
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-
|
|
3
|
+
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
4
4
|
import { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from '../../OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
5
5
|
import __vue_component__$1 from '../OrErrorV3/OrError.js';
|
|
6
6
|
import __vue_component__$2 from '../OrHintV3/OrHint.js';
|
|
@@ -9,7 +9,7 @@ import __vue_component__$6 from '../OrLabelV3/OrLabel.js';
|
|
|
9
9
|
import __vue_component__$7 from '../OrPopoverV3/OrPopover.js';
|
|
10
10
|
import useResponsive from '../../hooks/useResponsive/useResponsive.js';
|
|
11
11
|
import { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from '../../OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
12
|
-
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-
|
|
12
|
+
import { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../../OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
13
13
|
import { DropdownClose } from '../../directives/dropdown-close.js';
|
|
14
14
|
import { DropdownOpen } from '../../directives/dropdown-open.js';
|
|
15
15
|
import { a as InputBoxVariant } from '../../types-98e9a758.js';
|
|
@@ -54,13 +54,14 @@ export { DEFAULT_TEXT, OrDateTimePickerItemTypes, OrDateTimePickerTypes } from '
|
|
|
54
54
|
export { default as OrDateTimePickerV3 } from './OrDateTimePickerV3/OrDateTimePicker.js';
|
|
55
55
|
export { O as OrDateTimePickerDateControl, a as OrDateTimePickerDateSelect, b as OrDateTimePickerMonthSelect } from '../OrDateTimePickerMonthSelect-ae771d05.js';
|
|
56
56
|
export { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from '../OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
57
|
-
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../OrDateTimePickerTimeSelect-
|
|
57
|
+
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from '../OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
58
58
|
export { formatDate } from './OrDateTimePickerV3/utils/formatDate.js';
|
|
59
59
|
export { formatMobileDate } from './OrDateTimePickerV3/utils/formatMobileDate.js';
|
|
60
60
|
export { formatMobileTime } from './OrDateTimePickerV3/utils/formatMobileTime.js';
|
|
61
61
|
export { formatTime } from './OrDateTimePickerV3/utils/formatTime.js';
|
|
62
62
|
export { getCurrentDate } from './OrDateTimePickerV3/utils/getCurrentDate.js';
|
|
63
63
|
export { getNextMonthDate } from './OrDateTimePickerV3/utils/getNextMonthDate.js';
|
|
64
|
+
export { scrollToElementWithinContainer } from './OrDateTimePickerV3/utils/scrollToElementWithinContainer.js';
|
|
64
65
|
export { default as OrDrawerV3 } from './OrDrawerV3/OrDrawer.js';
|
|
65
66
|
export { D as DrawerPlacement } from '../styles-2d38e808.js';
|
|
66
67
|
export { default as OrDropAreaV3 } from './OrDropAreaV3/OrDropArea.js';
|
package/dist/bundled/index.js
CHANGED
|
@@ -113,13 +113,14 @@ export { ConfirmType } from './components/OrConfirmV3/props.js';
|
|
|
113
113
|
export { DEFAULT_TEXT, OrDateTimePickerItemTypes, OrDateTimePickerTypes } from './components/OrDateTimePicker/constants.js';
|
|
114
114
|
export { O as OrDateTimePickerDateControl, a as OrDateTimePickerDateSelect, b as OrDateTimePickerMonthSelect } from './OrDateTimePickerMonthSelect-ae771d05.js';
|
|
115
115
|
export { O as OrDateTimePickerMobileControl, a as OrDateTimePickerPopoverFooter, b as OrDateTimePickerPopoverHeader } from './OrDateTimePickerPopoverHeader-4cf1ef26.js';
|
|
116
|
-
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from './OrDateTimePickerTimeSelect-
|
|
116
|
+
export { O as OrDateTimePickerTimeControl, a as OrDateTimePickerTimeSelect } from './OrDateTimePickerTimeSelect-bc45d3c7.js';
|
|
117
117
|
export { formatDate } from './components/OrDateTimePickerV3/utils/formatDate.js';
|
|
118
118
|
export { formatMobileDate } from './components/OrDateTimePickerV3/utils/formatMobileDate.js';
|
|
119
119
|
export { formatMobileTime } from './components/OrDateTimePickerV3/utils/formatMobileTime.js';
|
|
120
120
|
export { formatTime } from './components/OrDateTimePickerV3/utils/formatTime.js';
|
|
121
121
|
export { getCurrentDate } from './components/OrDateTimePickerV3/utils/getCurrentDate.js';
|
|
122
122
|
export { getNextMonthDate } from './components/OrDateTimePickerV3/utils/getNextMonthDate.js';
|
|
123
|
+
export { scrollToElementWithinContainer } from './components/OrDateTimePickerV3/utils/scrollToElementWithinContainer.js';
|
|
123
124
|
export { D as DrawerPlacement } from './styles-2d38e808.js';
|
|
124
125
|
export { DropAreaSize } from './components/OrDropAreaV3/props.js';
|
|
125
126
|
export { approximateFileSize } from './components/OrDropAreaV3/utils/approximateFileSize.js';
|
|
@@ -43,7 +43,7 @@ export { OrDateTimeFormatV3 } from './or-date-time-format-v3/index.js';
|
|
|
43
43
|
export { DEFAULT_TEXT, OrDateTimePicker, OrDateTimePickerItemTypes, OrDateTimePickerTypes } from './or-date-time-picker/index.js';
|
|
44
44
|
export { _ as OrDateTimePickerV3 } from '../OrDateTimePicker-a35cc5b7.js';
|
|
45
45
|
export { OrDateTimePickerDateControl, OrDateTimePickerDateSelect, OrDateTimePickerMobileControl, OrDateTimePickerMonthSelect, OrDateTimePickerPopoverFooter, OrDateTimePickerPopoverHeader, OrDateTimePickerTimeControl, OrDateTimePickerTimeSelect } from './or-date-time-picker-v3/partials/index.js';
|
|
46
|
-
export { f as formatDate, a as formatTime } from '../
|
|
46
|
+
export { f as formatDate, a as formatTime, s as scrollToElementWithinContainer } from '../scrollToElementWithinContainer-f5107b92.js';
|
|
47
47
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from '../getCurrentDate-9b88f8a8.js';
|
|
48
48
|
export { getNextMonthDate } from './or-date-time-picker-v3/utils/index.js';
|
|
49
49
|
export { DrawerPlacement, OrDrawerV3 } from './or-drawer-v3/index.js';
|
|
@@ -59,7 +59,7 @@ import '../../tokens/index.js';
|
|
|
59
59
|
import '../../OrDateTimePicker.vue_rollup-plugin-vue_script-aba23066.js';
|
|
60
60
|
import '../or-date-time-picker-v3/partials/index.js';
|
|
61
61
|
import '../../useTimeMask-4bcbb554.js';
|
|
62
|
-
import '../../
|
|
62
|
+
import '../../scrollToElementWithinContainer-f5107b92.js';
|
|
63
63
|
import '../../getCurrentDate-9b88f8a8.js';
|
|
64
64
|
import '../../OrDateTimePicker-a35cc5b7.js';
|
|
65
65
|
import '../or-rating-v3/index.js';
|
|
@@ -43,7 +43,7 @@ import '../../or-input-box-v3/index.js';
|
|
|
43
43
|
import '../../../OrInputBox.vue_rollup-plugin-vue_script-0207994e.js';
|
|
44
44
|
import '../../or-date-time-picker-v3/partials/index.js';
|
|
45
45
|
import '../../../useTimeMask-4bcbb554.js';
|
|
46
|
-
import '../../../
|
|
46
|
+
import '../../../scrollToElementWithinContainer-f5107b92.js';
|
|
47
47
|
import '../../or-button-v3/index.js';
|
|
48
48
|
import '../../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
49
49
|
import '../../or-loader-v3/index.js';
|
|
@@ -7,7 +7,7 @@ import '@onereach/styles/tailwind.config.json';
|
|
|
7
7
|
import '../../types/index.js';
|
|
8
8
|
import '../../OrDateTimePicker.vue_rollup-plugin-vue_script-aba23066.js';
|
|
9
9
|
import '../or-date-time-picker-v3/partials/index.js';
|
|
10
|
-
import { f as formatDate } from '../../
|
|
10
|
+
import { f as formatDate } from '../../scrollToElementWithinContainer-f5107b92.js';
|
|
11
11
|
import { n as normalizeComponent } from '../../normalize-component-cf2db48b.js';
|
|
12
12
|
import '../../tokens/index.js';
|
|
13
13
|
import 'lodash/get';
|
|
@@ -23,7 +23,7 @@ import '../../tokens/index.js';
|
|
|
23
23
|
import 'lodash/get';
|
|
24
24
|
import 'lodash/isElement';
|
|
25
25
|
import '../../useTimeMask-4bcbb554.js';
|
|
26
|
-
import '../../
|
|
26
|
+
import '../../scrollToElementWithinContainer-f5107b92.js';
|
|
27
27
|
import '../or-button-v3/index.js';
|
|
28
28
|
import '../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
29
29
|
import '../../constants-873d04a2.js';
|
|
@@ -25,7 +25,7 @@ import 'lodash/get';
|
|
|
25
25
|
import 'lodash/isElement';
|
|
26
26
|
import '@onereach/styles/screens.json';
|
|
27
27
|
import '../../useTimeMask-4bcbb554.js';
|
|
28
|
-
import '../../
|
|
28
|
+
import '../../scrollToElementWithinContainer-f5107b92.js';
|
|
29
29
|
import '../or-button-v3/index.js';
|
|
30
30
|
import '../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
31
31
|
import '../../constants-873d04a2.js';
|
|
@@ -7,7 +7,7 @@ import '@onereach/styles/tailwind.config.json';
|
|
|
7
7
|
import '../../types/index.js';
|
|
8
8
|
import '../../OrDateTimePicker.vue_rollup-plugin-vue_script-aba23066.js';
|
|
9
9
|
import '../or-date-time-picker-v3/partials/index.js';
|
|
10
|
-
import { f as formatDate, a as formatTime } from '../../
|
|
10
|
+
import { f as formatDate, a as formatTime } from '../../scrollToElementWithinContainer-f5107b92.js';
|
|
11
11
|
import { n as normalizeComponent } from '../../normalize-component-cf2db48b.js';
|
|
12
12
|
import '../../tokens/index.js';
|
|
13
13
|
import 'lodash/get';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { _ as OrDateTimePickerV3 } from '../../OrDateTimePicker-a35cc5b7.js';
|
|
2
2
|
export { OrDateTimePickerDateControl, OrDateTimePickerDateSelect, OrDateTimePickerMobileControl, OrDateTimePickerMonthSelect, OrDateTimePickerPopoverFooter, OrDateTimePickerPopoverHeader, OrDateTimePickerTimeControl, OrDateTimePickerTimeSelect } from './partials/index.js';
|
|
3
|
-
export { f as formatDate, a as formatTime } from '../../
|
|
3
|
+
export { f as formatDate, a as formatTime, s as scrollToElementWithinContainer } from '../../scrollToElementWithinContainer-f5107b92.js';
|
|
4
4
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from '../../getCurrentDate-9b88f8a8.js';
|
|
5
5
|
export { getNextMonthDate } from './utils/index.js';
|
|
6
6
|
import '../../OrDateTimePicker.vue_rollup-plugin-vue_script-aba23066.js';
|
|
@@ -6,7 +6,7 @@ import '@vueuse/core';
|
|
|
6
6
|
import { u as useProxyModelValue } from '../../../useProxyModelValue-42e265dd.js';
|
|
7
7
|
import '@onereach/styles/screens.json';
|
|
8
8
|
import '@onereach/styles/tailwind.config.json';
|
|
9
|
-
import { f as formatDate, a as formatTime } from '../../../
|
|
9
|
+
import { f as formatDate, a as formatTime, s as scrollToElementWithinContainer } from '../../../scrollToElementWithinContainer-f5107b92.js';
|
|
10
10
|
import { n as normalizeComponent } from '../../../normalize-component-cf2db48b.js';
|
|
11
11
|
import { OrButtonV3 as __vue_component__$8 } from '../../or-button-v3/index.js';
|
|
12
12
|
import '../../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
@@ -1033,6 +1033,8 @@ var script = defineComponent({
|
|
|
1033
1033
|
var _a;
|
|
1034
1034
|
// Refs & Styles
|
|
1035
1035
|
const root = ref();
|
|
1036
|
+
const hoursContainer = ref();
|
|
1037
|
+
const minutesContainer = ref();
|
|
1036
1038
|
const hoursButtons = ref([]);
|
|
1037
1039
|
const minutesButtons = ref([]);
|
|
1038
1040
|
const rootStyles = computed(() => ['or-date-time-picker-time-select-v3', ...DateTimePickerTimeSelect]);
|
|
@@ -1061,17 +1063,13 @@ var script = defineComponent({
|
|
|
1061
1063
|
}
|
|
1062
1064
|
const activeHourButton = getActiveButton(hoursButtons.value, hoursOptions.value);
|
|
1063
1065
|
const activeMinuteButton = getActiveButton(minutesButtons.value, minutesOptions.value);
|
|
1064
|
-
if (activeHourButton) {
|
|
1066
|
+
if (activeHourButton && hoursContainer.value) {
|
|
1065
1067
|
// scroll to the active hour button within the hours container.
|
|
1066
|
-
activeHourButton.
|
|
1067
|
-
block: 'center'
|
|
1068
|
-
});
|
|
1068
|
+
scrollToElementWithinContainer(activeHourButton, hoursContainer.value);
|
|
1069
1069
|
}
|
|
1070
|
-
if (activeMinuteButton) {
|
|
1070
|
+
if (activeMinuteButton && minutesContainer.value) {
|
|
1071
1071
|
// scroll to the active minute button within the minutes container.
|
|
1072
|
-
activeMinuteButton.
|
|
1073
|
-
block: 'center'
|
|
1074
|
-
});
|
|
1072
|
+
scrollToElementWithinContainer(activeMinuteButton, minutesContainer.value);
|
|
1075
1073
|
}
|
|
1076
1074
|
});
|
|
1077
1075
|
}, {
|
|
@@ -1141,6 +1139,8 @@ var script = defineComponent({
|
|
|
1141
1139
|
return {
|
|
1142
1140
|
root,
|
|
1143
1141
|
rootStyles,
|
|
1142
|
+
hoursContainer,
|
|
1143
|
+
minutesContainer,
|
|
1144
1144
|
hoursButtons,
|
|
1145
1145
|
minutesButtons,
|
|
1146
1146
|
buttonGroupStyles,
|
|
@@ -1168,6 +1168,7 @@ var __vue_render__ = function () {
|
|
|
1168
1168
|
ref: 'root',
|
|
1169
1169
|
class: _vm.rootStyles
|
|
1170
1170
|
}, [_c('div', {
|
|
1171
|
+
ref: 'hoursContainer',
|
|
1171
1172
|
class: _vm.buttonGroupStyles
|
|
1172
1173
|
}, _vm._l(_vm.hoursOptions, function (value) {
|
|
1173
1174
|
return _c('OrButton', {
|
|
@@ -1188,6 +1189,7 @@ var __vue_render__ = function () {
|
|
|
1188
1189
|
}
|
|
1189
1190
|
}, [_vm._v("\n " + _vm._s(_vm.formatHours(value)) + "\n ")]);
|
|
1190
1191
|
}), 1), _vm._v("\n\n :\n\n "), _c('div', {
|
|
1192
|
+
ref: 'minutesContainer',
|
|
1191
1193
|
class: _vm.buttonGroupStyles
|
|
1192
1194
|
}, _vm._l(_vm.minutesOptions, function (value) {
|
|
1193
1195
|
return _c('OrButton', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as formatDate, a as formatTime } from '../../../
|
|
1
|
+
export { f as formatDate, a as formatTime, s as scrollToElementWithinContainer } from '../../../scrollToElementWithinContainer-f5107b92.js';
|
|
2
2
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from '../../../getCurrentDate-9b88f8a8.js';
|
|
3
3
|
import '../../../types/index.js';
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scrollToElementWithinContainer: (element: HTMLElement, container: HTMLElement) => void;
|
|
@@ -7,7 +7,7 @@ import '@onereach/styles/screens.json';
|
|
|
7
7
|
import '@onereach/styles/tailwind.config.json';
|
|
8
8
|
import '../../OrDateTimePicker.vue_rollup-plugin-vue_script-aba23066.js';
|
|
9
9
|
import '../or-date-time-picker-v3/partials/index.js';
|
|
10
|
-
import { a as formatTime } from '../../
|
|
10
|
+
import { a as formatTime } from '../../scrollToElementWithinContainer-f5107b92.js';
|
|
11
11
|
import { n as normalizeComponent } from '../../normalize-component-cf2db48b.js';
|
|
12
12
|
import 'lodash/get';
|
|
13
13
|
import 'lodash/isElement';
|
|
@@ -23,7 +23,7 @@ import 'lodash/get';
|
|
|
23
23
|
import 'lodash/isElement';
|
|
24
24
|
import '../../tokens/index.js';
|
|
25
25
|
import '../../useTimeMask-4bcbb554.js';
|
|
26
|
-
import '../../
|
|
26
|
+
import '../../scrollToElementWithinContainer-f5107b92.js';
|
|
27
27
|
import '../or-button-v3/index.js';
|
|
28
28
|
import '../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
29
29
|
import '../../constants-873d04a2.js';
|
|
@@ -24,7 +24,7 @@ import 'lodash/isElement';
|
|
|
24
24
|
import '../../tokens/index.js';
|
|
25
25
|
import '@onereach/styles/screens.json';
|
|
26
26
|
import '../../useTimeMask-4bcbb554.js';
|
|
27
|
-
import '../../
|
|
27
|
+
import '../../scrollToElementWithinContainer-f5107b92.js';
|
|
28
28
|
import '../or-button-v3/index.js';
|
|
29
29
|
import '../../OrButton.vue_rollup-plugin-vue_script-f6318956.js';
|
|
30
30
|
import '../../constants-873d04a2.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export { OrDateTimeFormatV3 } from './components/or-date-time-format-v3/index.js
|
|
|
43
43
|
export { DEFAULT_TEXT, OrDateTimePicker, OrDateTimePickerItemTypes, OrDateTimePickerTypes } from './components/or-date-time-picker/index.js';
|
|
44
44
|
export { _ as OrDateTimePickerV3 } from './OrDateTimePicker-a35cc5b7.js';
|
|
45
45
|
export { OrDateTimePickerDateControl, OrDateTimePickerDateSelect, OrDateTimePickerMobileControl, OrDateTimePickerMonthSelect, OrDateTimePickerPopoverFooter, OrDateTimePickerPopoverHeader, OrDateTimePickerTimeControl, OrDateTimePickerTimeSelect } from './components/or-date-time-picker-v3/partials/index.js';
|
|
46
|
-
export { f as formatDate, a as formatTime } from './
|
|
46
|
+
export { f as formatDate, a as formatTime, s as scrollToElementWithinContainer } from './scrollToElementWithinContainer-f5107b92.js';
|
|
47
47
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from './getCurrentDate-9b88f8a8.js';
|
|
48
48
|
export { getNextMonthDate } from './components/or-date-time-picker-v3/utils/index.js';
|
|
49
49
|
export { DrawerPlacement, OrDrawerV3 } from './components/or-drawer-v3/index.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TimeFormat } from './types/index.js';
|
|
2
|
+
|
|
3
|
+
const formatDate = (value, format, locale) => {
|
|
4
|
+
if (typeof format === 'function') {
|
|
5
|
+
return format(value, locale);
|
|
6
|
+
}
|
|
7
|
+
return value.toLocaleString(locale, {
|
|
8
|
+
dateStyle: format,
|
|
9
|
+
timeZone: 'UTC'
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const formatTime = (value, format, locale) => {
|
|
14
|
+
if (typeof format === 'function') {
|
|
15
|
+
return format(value, locale);
|
|
16
|
+
}
|
|
17
|
+
return value.toLocaleString(locale, {
|
|
18
|
+
timeStyle: 'short',
|
|
19
|
+
hourCycle: format !== TimeFormat.Auto ? format : undefined,
|
|
20
|
+
timeZone: 'UTC'
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const scrollToElementWithinContainer = (element, container) => {
|
|
25
|
+
const elementRect = element.getBoundingClientRect();
|
|
26
|
+
const containerRect = container.getBoundingClientRect();
|
|
27
|
+
// Determine if the element is fully visible within the container by comparing their positions.
|
|
28
|
+
const isFullyVisible = elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;
|
|
29
|
+
if (!isFullyVisible) {
|
|
30
|
+
// Calculate the new scrollTop value to center the element within the container.
|
|
31
|
+
// This involves adjusting for the height of the element and container, ensuring the element is centered.
|
|
32
|
+
container.scrollTop = element.offsetTop - container.offsetTop - container.clientHeight / 2 + element.clientHeight / 2;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { formatTime as a, formatDate as f, scrollToElementWithinContainer as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components-vue2",
|
|
3
|
-
"version": "19.2.
|
|
3
|
+
"version": "19.2.1",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@codemirror/view": "^6",
|
|
36
36
|
"@floating-ui/dom": "1.5.3",
|
|
37
37
|
"@lezer/highlight": "*",
|
|
38
|
-
"@onereach/styles": "^19.2.
|
|
38
|
+
"@onereach/styles": "^19.2.1",
|
|
39
39
|
"@splidejs/splide": "4.0.6",
|
|
40
40
|
"@tiptap/core": "2.0.3",
|
|
41
41
|
"@tiptap/extension-blockquote": "2.0.3",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"default": "./dist/bundled/components/*/index.js"
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "22dfd1cd755742885366f9877c8748ff50a08593"
|
|
138
138
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { TimeFormat } from './types/index.js';
|
|
2
|
-
|
|
3
|
-
const formatDate = (value, format, locale) => {
|
|
4
|
-
if (typeof format === 'function') {
|
|
5
|
-
return format(value, locale);
|
|
6
|
-
}
|
|
7
|
-
return value.toLocaleString(locale, {
|
|
8
|
-
dateStyle: format,
|
|
9
|
-
timeZone: 'UTC'
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const formatTime = (value, format, locale) => {
|
|
14
|
-
if (typeof format === 'function') {
|
|
15
|
-
return format(value, locale);
|
|
16
|
-
}
|
|
17
|
-
return value.toLocaleString(locale, {
|
|
18
|
-
timeStyle: 'short',
|
|
19
|
-
hourCycle: format !== TimeFormat.Auto ? format : undefined,
|
|
20
|
-
timeZone: 'UTC'
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { formatTime as a, formatDate as f };
|