akar 1.15.0 → 1.18.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.
- package/dist/avatar/avatar-image.js +4 -2
- package/dist/avatar/avatar-image.js.map +1 -1
- package/dist/calendar/calendar-root.js +6 -5
- package/dist/calendar/calendar-root.js.map +1 -1
- package/dist/collection/collection.js +6 -2
- package/dist/collection/collection.js.map +1 -1
- package/dist/combobox/combobox-content-impl.js +48 -34
- package/dist/combobox/combobox-content-impl.js.map +1 -1
- package/dist/combobox/combobox-content.js +4 -0
- package/dist/combobox/combobox-content.js.map +1 -1
- package/dist/context-menu/context-menu-content.js +4 -0
- package/dist/context-menu/context-menu-content.js.map +1 -1
- package/dist/context-menu/context-menu-radio-group.js +1 -1
- package/dist/context-menu/context-menu-radio-item.js +1 -1
- package/dist/context-menu/context-menu-sub-content.js +4 -0
- package/dist/context-menu/context-menu-sub-content.js.map +1 -1
- package/dist/date/calendar.date.js +25 -11
- package/dist/date/calendar.date.js.map +1 -1
- package/dist/date/comparators.date.js +10 -2
- package/dist/date/comparators.date.js.map +1 -1
- package/dist/date/parser.js +1 -0
- package/dist/date/parser.js.map +1 -1
- package/dist/date/use-date-field.js +59 -20
- package/dist/date/use-date-field.js.map +1 -1
- package/dist/date-picker/date-picker-content.js +4 -0
- package/dist/date-picker/date-picker-content.js.map +1 -1
- package/dist/date-picker/date-picker-root.js +10 -8
- package/dist/date-picker/date-picker-root.js.map +1 -1
- package/dist/date-range-picker/date-range-picker-content.js +4 -0
- package/dist/date-range-picker/date-range-picker-content.js.map +1 -1
- package/dist/date-range-picker/date-range-picker-root.js +11 -9
- package/dist/date-range-picker/date-range-picker-root.js.map +1 -1
- package/dist/date.d.ts +2 -2
- package/dist/date.js +2 -2
- package/dist/dialog/dialog-content.js.map +1 -1
- package/dist/dropdown-menu/dropdown-menu-content.js +4 -0
- package/dist/dropdown-menu/dropdown-menu-content.js.map +1 -1
- package/dist/dropdown-menu/dropdown-menu-radio-group.js +1 -1
- package/dist/dropdown-menu/dropdown-menu-radio-item.js +1 -1
- package/dist/dropdown-menu/dropdown-menu-sub-content.js +4 -0
- package/dist/dropdown-menu/dropdown-menu-sub-content.js.map +1 -1
- package/dist/editable/editable-input.js +1 -1
- package/dist/editable/editable-input.js.map +1 -1
- package/dist/focus-scope/focus-scope.js +2 -2
- package/dist/focus-scope/focus-scope.js.map +1 -1
- package/dist/focus-scope/stack.js +1 -4
- package/dist/focus-scope/stack.js.map +1 -1
- package/dist/hover-card/hover-card-content-impl.js +4 -0
- package/dist/hover-card/hover-card-content-impl.js.map +1 -1
- package/dist/hover-card/hover-card-content.js +4 -0
- package/dist/hover-card/hover-card-content.js.map +1 -1
- package/dist/index.d.ts +1185 -1376
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index2.d.ts +9 -2
- package/dist/index2.d.ts.map +1 -1
- package/dist/menu/menu-content-impl.js +4 -0
- package/dist/menu/menu-content-impl.js.map +1 -1
- package/dist/menu/menu-content.js +4 -0
- package/dist/menu/menu-content.js.map +1 -1
- package/dist/menu/menu-radio-group.js +1 -1
- package/dist/menu/menu-radio-group.js.map +1 -1
- package/dist/menu/menu-radio-item.js +1 -1
- package/dist/menu/menu-radio-item.js.map +1 -1
- package/dist/menu/menu-root-content-modal.js +4 -0
- package/dist/menu/menu-root-content-modal.js.map +1 -1
- package/dist/menu/menu-root-content-non-modal.js +4 -0
- package/dist/menu/menu-root-content-non-modal.js.map +1 -1
- package/dist/menu/menu-sub-content.js +4 -0
- package/dist/menu/menu-sub-content.js.map +1 -1
- package/dist/navigation-menu/navigation-menu-content-impl.js +1 -1
- package/dist/navigation-menu/navigation-menu-content.js +1 -1
- package/dist/navigation-menu/navigation-menu-item.js +1 -1
- package/dist/navigation-menu/navigation-menu-root.js +8 -6
- package/dist/navigation-menu/navigation-menu-root.js.map +1 -1
- package/dist/navigation-menu/navigation-menu-trigger.js +1 -1
- package/dist/navigation-menu/navigation-menu-viewport.js +1 -1
- package/dist/number-field/number-field-root.js +6 -1
- package/dist/number-field/number-field-root.js.map +1 -1
- package/dist/pin-input/pin-input-input.js +17 -11
- package/dist/pin-input/pin-input-input.js.map +1 -1
- package/dist/popover/popover-content-impl.js +4 -0
- package/dist/popover/popover-content-impl.js.map +1 -1
- package/dist/popover/popover-content-modal.js +4 -0
- package/dist/popover/popover-content-modal.js.map +1 -1
- package/dist/popover/popover-content-non-modal.js +4 -0
- package/dist/popover/popover-content-non-modal.js.map +1 -1
- package/dist/popover/popover-content.js +4 -0
- package/dist/popover/popover-content.js.map +1 -1
- package/dist/popper/popper-content.js +10 -2
- package/dist/popper/popper-content.js.map +1 -1
- package/dist/range-calendar/range-calendar-root.js +6 -5
- package/dist/range-calendar/range-calendar-root.js.map +1 -1
- package/dist/scroll-area/scroll-area-root.js.map +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-auto.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-glimpse.js +126 -0
- package/dist/scroll-area/scroll-area-scrollbar-glimpse.js.map +1 -0
- package/dist/scroll-area/scroll-area-scrollbar-impl.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-scroll.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar-visible.js +1 -1
- package/dist/scroll-area/scroll-area-scrollbar.js +11 -4
- package/dist/scroll-area/scroll-area-scrollbar.js.map +1 -1
- package/dist/select/select-content-impl.js +4 -0
- package/dist/select/select-content-impl.js.map +1 -1
- package/dist/select/select-content.js +4 -0
- package/dist/select/select-content.js.map +1 -1
- package/dist/select/select-popper-position.js +4 -0
- package/dist/select/select-popper-position.js.map +1 -1
- package/dist/shared/use-date-formatter.js +1 -1
- package/dist/shared/use-date-formatter.js.map +1 -1
- package/dist/shared/use-grace-area.js +1 -1
- package/dist/shared/use-grace-area.js.map +1 -1
- package/dist/tabs/tabs-content.js +5 -1
- package/dist/tabs/tabs-content.js.map +1 -1
- package/dist/tabs/tabs-root.js +12 -2
- package/dist/tabs/tabs-root.js.map +1 -1
- package/dist/tabs/tabs-trigger.js +1 -1
- package/dist/tabs/tabs-trigger.js.map +1 -1
- package/dist/time-field/time-field-input.js +3 -1
- package/dist/time-field/time-field-input.js.map +1 -1
- package/dist/time-field/time-field-root.js +26 -2
- package/dist/time-field/time-field-root.js.map +1 -1
- package/package.json +17 -16
- package/src/avatar/avatar-image.vue +1 -0
- package/src/calendar/calendar-root.vue +12 -11
- package/src/calendar/use-calendar.ts +2 -2
- package/src/collection/collection.ts +3 -2
- package/src/combobox/combobox-content-impl.vue +47 -32
- package/src/combobox/combobox-root.vue +1 -1
- package/src/date/calendar.date.ts +42 -17
- package/src/date/comparators.date.ts +11 -3
- package/src/date-picker/date-picker-anchor.vue +2 -2
- package/src/date-picker/date-picker-arrow.vue +2 -2
- package/src/date-picker/date-picker-close.vue +2 -2
- package/src/date-picker/date-picker-root.vue +11 -11
- package/src/date-picker/index.ts +71 -27
- package/src/date-range-picker/date-range-picker-anchor.vue +2 -2
- package/src/date-range-picker/date-range-picker-arrow.vue +2 -2
- package/src/date-range-picker/date-range-picker-close.vue +2 -2
- package/src/date-range-picker/date-range-picker-root.vue +14 -15
- package/src/date-range-picker/index.ts +4 -0
- package/src/editable/editable-input.vue +7 -1
- package/src/focus-scope/focus-scope.vue +2 -2
- package/src/index.ts +2 -0
- package/src/listbox/listbox-filter.vue +1 -1
- package/src/listbox/listbox-root.vue +1 -1
- package/src/menu/menu-radio-group.vue +5 -4
- package/src/menu/menu-radio-item.vue +2 -1
- package/src/navigation-menu/navigation-menu-item.vue +1 -1
- package/src/navigation-menu/navigation-menu-root.vue +14 -6
- package/src/number-field/number-field-root.vue +15 -7
- package/src/pin-input/pin-input-input.vue +26 -19
- package/src/popper/popper-content.vue +15 -5
- package/src/range-calendar/range-calendar-root.vue +14 -14
- package/src/scroll-area/index.ts +4 -0
- package/src/scroll-area/scroll-area-root.vue +1 -0
- package/src/scroll-area/scroll-area-scrollbar-glimpse.vue +145 -0
- package/src/scroll-area/scroll-area-scrollbar.vue +9 -0
- package/src/scroll-area/types.ts +1 -1
- package/src/shared/date/parser.ts +9 -0
- package/src/shared/date/use-date-field.ts +104 -21
- package/src/shared/index.ts +1 -1
- package/src/shared/use-date-formatter.ts +2 -1
- package/src/shared/use-grace-area.ts +1 -1
- package/src/tabs/tabs-content.vue +7 -1
- package/src/tabs/tabs-root.vue +14 -1
- package/src/tabs/tabs-trigger.vue +5 -2
- package/src/time-field/time-field-input.vue +7 -2
- package/src/time-field/time-field-root.vue +42 -3
- package/src/tree/tree-root.vue +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { DateValue } from '@internationalized/date';
|
|
3
|
-
|
|
4
3
|
import type { Ref } from 'vue';
|
|
5
4
|
import type { ACalendarRootProps, ADateFieldRoot, ADateFieldRootProps, APopoverRootEmits, APopoverRootProps } from '..';
|
|
6
|
-
import type { DateMatcher, WeekDayFormat } from '../date';
|
|
5
|
+
import type { DateMatcher, WeekDayFormat, WeekStartsOn } from '../date';
|
|
7
6
|
import type { DateStep, Granularity, HourCycle } from '../shared/date';
|
|
8
7
|
import type { Direction } from '../shared/types';
|
|
9
|
-
import {
|
|
8
|
+
import { getWeekStartsOn } from '../date';
|
|
9
|
+
import { createContext } from '../shared';
|
|
10
10
|
|
|
11
11
|
type DatePickerRootContext = {
|
|
12
12
|
id: Ref<string | undefined>;
|
|
@@ -23,7 +23,7 @@ type DatePickerRootContext = {
|
|
|
23
23
|
placeholder: Ref<DateValue>;
|
|
24
24
|
pagedNavigation: Ref<boolean>;
|
|
25
25
|
preventDeselect: Ref<boolean>;
|
|
26
|
-
weekStartsOn: Ref<
|
|
26
|
+
weekStartsOn: Ref<WeekStartsOn>;
|
|
27
27
|
weekdayFormat: Ref<WeekDayFormat>;
|
|
28
28
|
fixedWeeks: Ref<boolean>;
|
|
29
29
|
numberOfMonths: Ref<number>;
|
|
@@ -46,7 +46,7 @@ export type ADatePickerRootProps = Omit<ADateFieldRootProps, 'as' | 'asChild'> &
|
|
|
46
46
|
closeOnSelect?: boolean;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export type ADatePickerRootEmits = {
|
|
49
|
+
export type ADatePickerRootEmits = APopoverRootEmits & {
|
|
50
50
|
/** Event handler called whenever the model value changes */
|
|
51
51
|
'update:modelValue': [date: DateValue | undefined];
|
|
52
52
|
/** Event handler called whenever the placeholder value changes */
|
|
@@ -64,6 +64,7 @@ import { isSameDay } from '@internationalized/date';
|
|
|
64
64
|
import { useVModel } from '@vueuse/core';
|
|
65
65
|
import { computed, ref, toRefs, watch } from 'vue';
|
|
66
66
|
import { APopoverRoot } from '..';
|
|
67
|
+
import { useDirection, useLocale } from '../shared';
|
|
67
68
|
import { getDefaultDate } from '../shared/date';
|
|
68
69
|
|
|
69
70
|
defineOptions({
|
|
@@ -79,28 +80,25 @@ const props = withDefaults(
|
|
|
79
80
|
modal: false,
|
|
80
81
|
pagedNavigation: false,
|
|
81
82
|
preventDeselect: false,
|
|
82
|
-
weekStartsOn: 0,
|
|
83
83
|
weekdayFormat: 'narrow',
|
|
84
84
|
fixedWeeks: false,
|
|
85
85
|
numberOfMonths: 1,
|
|
86
86
|
disabled: false,
|
|
87
87
|
readonly: false,
|
|
88
88
|
placeholder: undefined,
|
|
89
|
-
locale: 'en',
|
|
90
89
|
isDateDisabled: undefined,
|
|
91
90
|
isDateUnavailable: undefined,
|
|
92
91
|
closeOnSelect: false,
|
|
93
92
|
},
|
|
94
93
|
);
|
|
95
94
|
|
|
96
|
-
const emits = defineEmits<ADatePickerRootEmits
|
|
95
|
+
const emits = defineEmits<ADatePickerRootEmits>();
|
|
97
96
|
|
|
98
97
|
const {
|
|
99
|
-
locale,
|
|
98
|
+
locale: propLocale,
|
|
100
99
|
disabled,
|
|
101
100
|
readonly,
|
|
102
101
|
pagedNavigation,
|
|
103
|
-
weekStartsOn,
|
|
104
102
|
weekdayFormat,
|
|
105
103
|
fixedWeeks,
|
|
106
104
|
numberOfMonths,
|
|
@@ -124,6 +122,8 @@ const {
|
|
|
124
122
|
} = toRefs(props);
|
|
125
123
|
|
|
126
124
|
const dir = useDirection(propDir);
|
|
125
|
+
const locale = useLocale(propLocale);
|
|
126
|
+
const weekStartsOn = computed(() => props.weekStartsOn ?? getWeekStartsOn(locale.value));
|
|
127
127
|
|
|
128
128
|
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
129
129
|
defaultValue: defaultValue.value,
|
|
@@ -134,7 +134,7 @@ const defaultDate = computed(() => getDefaultDate({
|
|
|
134
134
|
defaultPlaceholder: props.placeholder,
|
|
135
135
|
granularity: props.granularity,
|
|
136
136
|
defaultValue: modelValue.value,
|
|
137
|
-
locale:
|
|
137
|
+
locale: locale.value,
|
|
138
138
|
}));
|
|
139
139
|
|
|
140
140
|
const placeholder = useVModel(props, 'placeholder', emits, {
|
package/src/date-picker/index.ts
CHANGED
|
@@ -1,30 +1,74 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
export {
|
|
2
|
+
default as ADatePickerAnchor,
|
|
3
|
+
type ADatePickerAnchorProps,
|
|
4
|
+
} from './date-picker-anchor.vue';
|
|
5
|
+
export {
|
|
6
|
+
default as ADatePickerArrow,
|
|
7
|
+
type ADatePickerArrowProps,
|
|
8
|
+
} from './date-picker-arrow.vue';
|
|
9
|
+
export {
|
|
10
|
+
default as ADatePickerCalendar,
|
|
11
|
+
} from './date-picker-calendar.vue';
|
|
12
|
+
export {
|
|
13
|
+
default as ADatePickerCellTrigger,
|
|
14
|
+
type ADatePickerCellTriggerProps,
|
|
15
|
+
} from './date-picker-cell-trigger.vue';
|
|
16
|
+
export {
|
|
17
|
+
default as ADatePickerCell,
|
|
18
|
+
type ADatePickerCellProps,
|
|
19
|
+
} from './date-picker-cell.vue';
|
|
20
|
+
export {
|
|
21
|
+
default as ADatePickerClose,
|
|
22
|
+
type ADatePickerCloseProps,
|
|
23
|
+
} from './date-picker-close.vue';
|
|
24
|
+
export {
|
|
25
|
+
default as ADatePickerContent,
|
|
26
|
+
type ADatePickerContentEmits,
|
|
27
|
+
type ADatePickerContentProps,
|
|
28
|
+
} from './date-picker-content.vue';
|
|
29
|
+
export {
|
|
30
|
+
default as ADatePickerField,
|
|
31
|
+
} from './date-picker-field.vue';
|
|
32
|
+
export {
|
|
33
|
+
default as ADatePickerGridBody,
|
|
34
|
+
type ADatePickerGridBodyProps,
|
|
35
|
+
} from './date-picker-grid-body.vue';
|
|
36
|
+
export {
|
|
37
|
+
default as ADatePickerGridHead,
|
|
38
|
+
type ADatePickerGridHeadProps,
|
|
39
|
+
} from './date-picker-grid-head.vue';
|
|
40
|
+
export {
|
|
41
|
+
default as ADatePickerGridRow,
|
|
42
|
+
type ADatePickerGridRowProps,
|
|
43
|
+
} from './date-picker-grid-row.vue';
|
|
44
|
+
export {
|
|
45
|
+
default as ADatePickerGrid,
|
|
46
|
+
type ADatePickerGridProps,
|
|
47
|
+
} from './date-picker-grid.vue';
|
|
48
|
+
export {
|
|
49
|
+
default as ADatePickerHeadCell,
|
|
50
|
+
type ADatePickerHeadCellProps,
|
|
51
|
+
} from './date-picker-head-cell.vue';
|
|
52
|
+
export {
|
|
53
|
+
default as ADatePickerHeader,
|
|
54
|
+
type ADatePickerHeaderProps,
|
|
55
|
+
} from './date-picker-header.vue';
|
|
56
|
+
export {
|
|
57
|
+
default as ADatePickerHeading,
|
|
58
|
+
type ADatePickerHeadingProps,
|
|
59
|
+
} from './date-picker-heading.vue';
|
|
60
|
+
export {
|
|
61
|
+
default as ADatePickerInput,
|
|
62
|
+
type ADatePickerInputProps,
|
|
63
|
+
} from './date-picker-input.vue';
|
|
64
|
+
export {
|
|
65
|
+
default as ADatePickerNext,
|
|
66
|
+
type ADatePickerNextProps,
|
|
67
|
+
} from './date-picker-next.vue';
|
|
68
|
+
export {
|
|
69
|
+
default as ADatePickerPrev,
|
|
70
|
+
type ADatePickerPrevProps,
|
|
71
|
+
} from './date-picker-prev.vue';
|
|
28
72
|
export {
|
|
29
73
|
default as ADatePickerRoot,
|
|
30
74
|
type ADatePickerRootEmits,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverAnchorProps } from '..';
|
|
3
3
|
import { APopoverAnchor } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerAnchorProps extends APopoverAnchorProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerAnchorProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverArrowProps } from '..';
|
|
3
3
|
import { APopoverArrow } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerArrowProps extends APopoverArrowProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerArrowProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { APopoverCloseProps } from '..';
|
|
3
3
|
import { APopoverClose } from '..';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface ADateRangePickerCloseProps extends APopoverCloseProps {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script setup lang="ts">
|
|
9
|
-
const props = defineProps<
|
|
9
|
+
const props = defineProps<ADateRangePickerCloseProps>();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<template>
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { DateValue } from '@internationalized/date';
|
|
3
|
-
|
|
4
3
|
import type { Ref } from 'vue';
|
|
5
4
|
import type { ADateRangeFieldRoot, ADateRangeFieldRootProps, APopoverRootEmits, APopoverRootProps, ARangeCalendarRootProps } from '..';
|
|
6
|
-
import type { DateMatcher, WeekDayFormat } from '../date';
|
|
5
|
+
import type { DateMatcher, WeekDayFormat, WeekStartsOn } from '../date';
|
|
7
6
|
import type { DateRange, DateStep, Granularity, HourCycle } from '../shared/date';
|
|
8
|
-
|
|
9
7
|
import type { Direction } from '../shared/types';
|
|
10
|
-
import {
|
|
11
|
-
import { createContext, useDirection } from '../shared';
|
|
12
|
-
import { getDefaultDate } from '../shared/date';
|
|
8
|
+
import { createContext } from '../shared';
|
|
13
9
|
|
|
14
10
|
type DateRangePickerRootContext = {
|
|
15
11
|
id: Ref<string | undefined>;
|
|
@@ -26,7 +22,7 @@ type DateRangePickerRootContext = {
|
|
|
26
22
|
placeholder: Ref<DateValue>;
|
|
27
23
|
pagedNavigation: Ref<boolean>;
|
|
28
24
|
preventDeselect: Ref<boolean>;
|
|
29
|
-
weekStartsOn: Ref<
|
|
25
|
+
weekStartsOn: Ref<WeekStartsOn>;
|
|
30
26
|
weekdayFormat: Ref<WeekDayFormat>;
|
|
31
27
|
fixedWeeks: Ref<boolean>;
|
|
32
28
|
numberOfMonths: Ref<number>;
|
|
@@ -54,7 +50,7 @@ export type ADateRangePickerRootProps = Omit<ADateRangeFieldRootProps, 'as' | 'a
|
|
|
54
50
|
closeOnSelect?: boolean;
|
|
55
51
|
};
|
|
56
52
|
|
|
57
|
-
export type ADateRangePickerRootEmits = {
|
|
53
|
+
export type ADateRangePickerRootEmits = APopoverRootEmits & {
|
|
58
54
|
/** Event handler called whenever the model value changes */
|
|
59
55
|
'update:modelValue': [date: DateRange];
|
|
60
56
|
/** Event handler called whenever the placeholder value changes */
|
|
@@ -71,7 +67,11 @@ export const [
|
|
|
71
67
|
|
|
72
68
|
<script setup lang="ts">
|
|
73
69
|
import { useVModel } from '@vueuse/core';
|
|
74
|
-
import { ref, toRefs, watch } from 'vue';
|
|
70
|
+
import { computed, ref, toRefs, watch } from 'vue';
|
|
71
|
+
import { APopoverRoot } from '..';
|
|
72
|
+
import { getWeekStartsOn } from '../date';
|
|
73
|
+
import { useDirection, useLocale } from '../shared';
|
|
74
|
+
import { getDefaultDate } from '../shared/date';
|
|
75
75
|
|
|
76
76
|
defineOptions({
|
|
77
77
|
inheritAttrs: false,
|
|
@@ -86,14 +86,12 @@ const props = withDefaults(
|
|
|
86
86
|
modal: false,
|
|
87
87
|
pagedNavigation: false,
|
|
88
88
|
preventDeselect: false,
|
|
89
|
-
weekStartsOn: 0,
|
|
90
89
|
weekdayFormat: 'narrow',
|
|
91
90
|
fixedWeeks: false,
|
|
92
91
|
numberOfMonths: 1,
|
|
93
92
|
disabled: false,
|
|
94
93
|
readonly: false,
|
|
95
94
|
placeholder: undefined,
|
|
96
|
-
locale: 'en',
|
|
97
95
|
isDateDisabled: undefined,
|
|
98
96
|
isDateUnavailable: undefined,
|
|
99
97
|
isDateHighlightable: undefined,
|
|
@@ -103,14 +101,13 @@ const props = withDefaults(
|
|
|
103
101
|
},
|
|
104
102
|
);
|
|
105
103
|
|
|
106
|
-
const emits = defineEmits<ADateRangePickerRootEmits
|
|
104
|
+
const emits = defineEmits<ADateRangePickerRootEmits>();
|
|
107
105
|
|
|
108
106
|
const {
|
|
109
|
-
locale,
|
|
107
|
+
locale: propLocale,
|
|
110
108
|
disabled,
|
|
111
109
|
readonly,
|
|
112
110
|
pagedNavigation,
|
|
113
|
-
weekStartsOn,
|
|
114
111
|
weekdayFormat,
|
|
115
112
|
fixedWeeks,
|
|
116
113
|
numberOfMonths,
|
|
@@ -137,6 +134,8 @@ const {
|
|
|
137
134
|
} = toRefs(props);
|
|
138
135
|
|
|
139
136
|
const dir = useDirection(propsDir);
|
|
137
|
+
const locale = useLocale(propLocale);
|
|
138
|
+
const weekStartsOn = computed(() => props.weekStartsOn ?? getWeekStartsOn(locale.value));
|
|
140
139
|
|
|
141
140
|
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
142
141
|
defaultValue: props.defaultValue ?? { start: undefined, end: undefined },
|
|
@@ -147,7 +146,7 @@ const defaultDate = getDefaultDate({
|
|
|
147
146
|
defaultPlaceholder: props.placeholder,
|
|
148
147
|
granularity: props.granularity,
|
|
149
148
|
defaultValue: modelValue.value?.start,
|
|
150
|
-
locale:
|
|
149
|
+
locale: locale.value,
|
|
151
150
|
});
|
|
152
151
|
|
|
153
152
|
const placeholder = useVModel(props, 'placeholder', emits, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export {
|
|
2
2
|
default as ADateRangePickerAnchor,
|
|
3
|
+
type ADateRangePickerAnchorProps,
|
|
3
4
|
} from './date-range-picker-anchor.vue';
|
|
4
5
|
|
|
5
6
|
export {
|
|
6
7
|
default as ADateRangePickerArrow,
|
|
8
|
+
type ADateRangePickerArrowProps,
|
|
7
9
|
} from './date-range-picker-arrow.vue';
|
|
8
10
|
export {
|
|
9
11
|
default as ADateRangePickerCalendar,
|
|
@@ -20,10 +22,12 @@ export {
|
|
|
20
22
|
} from './date-range-picker-cell.vue';
|
|
21
23
|
export {
|
|
22
24
|
default as ADateRangePickerClose,
|
|
25
|
+
type ADateRangePickerCloseProps,
|
|
23
26
|
} from './date-range-picker-close.vue';
|
|
24
27
|
|
|
25
28
|
export {
|
|
26
29
|
default as ADateRangePickerContent,
|
|
30
|
+
type ADateRangePickerContentEmits,
|
|
27
31
|
type ADateRangePickerContentProps,
|
|
28
32
|
} from './date-range-picker-content.vue';
|
|
29
33
|
export {
|
|
@@ -45,7 +45,13 @@ watch(context.isEditing, (value) => {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
function handleSubmitKeyDown(event: KeyboardEvent) {
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
(context.submitMode.value === 'enter' || context.submitMode.value === 'both')
|
|
50
|
+
&& event.key === KEY_CODES.ENTER
|
|
51
|
+
&& !event.shiftKey
|
|
52
|
+
&& !event.metaKey
|
|
53
|
+
&& !event.isComposing
|
|
54
|
+
) {
|
|
49
55
|
context.submit();
|
|
50
56
|
}
|
|
51
57
|
}
|
|
@@ -38,7 +38,7 @@ import { isClient } from '@vueuse/shared';
|
|
|
38
38
|
import { nextTick, reactive, ref, watchEffect } from 'vue';
|
|
39
39
|
import { APrimitive } from '../primitive';
|
|
40
40
|
import { getActiveElement, useForwardExpose } from '../shared';
|
|
41
|
-
import { createFocusScopesStack
|
|
41
|
+
import { createFocusScopesStack } from './stack';
|
|
42
42
|
import {
|
|
43
43
|
AUTOFOCUS_ON_MOUNT,
|
|
44
44
|
AUTOFOCUS_ON_UNMOUNT,
|
|
@@ -162,7 +162,7 @@ watchEffect(async (cleanupFn) => {
|
|
|
162
162
|
container.dispatchEvent(mountEvent);
|
|
163
163
|
|
|
164
164
|
if (!mountEvent.defaultPrevented) {
|
|
165
|
-
focusFirst(
|
|
165
|
+
focusFirst(getTabbableCandidates(container), {
|
|
166
166
|
select: true,
|
|
167
167
|
});
|
|
168
168
|
if (getActiveElement() === previouslyFocusedElement) {
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './date-picker';
|
|
|
13
13
|
export * from './date-range-field';
|
|
14
14
|
export * from './date-range-picker';
|
|
15
15
|
export * from './dialog';
|
|
16
|
+
export { type FocusOutsideEvent, type PointerDownOutsideEvent } from './dismissable-layer';
|
|
16
17
|
export * from './drawer';
|
|
17
18
|
export * from './dropdown-menu';
|
|
18
19
|
export * from './editable';
|
|
@@ -55,6 +56,7 @@ export {
|
|
|
55
56
|
type DateRange,
|
|
56
57
|
type DateValue,
|
|
57
58
|
type SegmentPart,
|
|
59
|
+
type TimeValue,
|
|
58
60
|
useBodyScrollLock,
|
|
59
61
|
type UseDateFormatter,
|
|
60
62
|
useDateFormatter,
|
|
@@ -3,7 +3,7 @@ import type { APrimitiveProps } from '../primitive';
|
|
|
3
3
|
import { injectAListboxRootContext } from './listbox-root.vue';
|
|
4
4
|
|
|
5
5
|
export interface AListboxFilterProps extends APrimitiveProps {
|
|
6
|
-
/** The controlled value of the filter. Can be binded with
|
|
6
|
+
/** The controlled value of the filter. Can be binded with v-model. */
|
|
7
7
|
modelValue?: string;
|
|
8
8
|
/** Focus on element when mounted. */
|
|
9
9
|
autoFocus?: boolean;
|
|
@@ -43,7 +43,7 @@ export const [
|
|
|
43
43
|
] = createContext<ListboxRootContext<AcceptableValue>>('AListboxRoot');
|
|
44
44
|
|
|
45
45
|
export interface AListboxRootProps<T = AcceptableValue> extends APrimitiveProps, FormFieldProps {
|
|
46
|
-
/** The controlled value of the listbox. Can be binded with
|
|
46
|
+
/** The controlled value of the listbox. Can be binded with `v-model`. */
|
|
47
47
|
modelValue?: T | Array<T>;
|
|
48
48
|
/** The value of the listbox when initially rendered. Use when you do not need to control the state of the Listbox */
|
|
49
49
|
defaultValue?: T | Array<T>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Ref } from 'vue';
|
|
3
|
+
import type { AcceptableValue } from '../shared/types';
|
|
3
4
|
import type { AMenuGroupProps } from './menu-group.vue';
|
|
4
5
|
import { createContext } from '../shared';
|
|
5
6
|
|
|
6
7
|
interface MenuRadioGroupContext {
|
|
7
|
-
modelValue: Ref<
|
|
8
|
-
onValueChange: (payload:
|
|
8
|
+
modelValue: Ref<AcceptableValue>;
|
|
9
|
+
onValueChange: (payload: AcceptableValue) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface AMenuRadioGroupProps extends AMenuGroupProps {
|
|
12
13
|
/** The value of the selected item in the group. */
|
|
13
|
-
modelValue?:
|
|
14
|
+
modelValue?: AcceptableValue;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export type AMenuRadioGroupEmits = {
|
|
17
18
|
/** Event handler called when the value changes. */
|
|
18
|
-
'update:modelValue': [payload:
|
|
19
|
+
'update:modelValue': [payload: AcceptableValue];
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const [injectMenuRadioGroupContext, provideMenuRadioGroupContext]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { AcceptableValue } from '../shared/types';
|
|
2
3
|
import type {
|
|
3
4
|
AMenuItemEmits,
|
|
4
5
|
AMenuItemProps,
|
|
@@ -8,7 +9,7 @@ export type AMenuRadioItemEmits = AMenuItemEmits;
|
|
|
8
9
|
|
|
9
10
|
export interface AMenuRadioItemProps extends AMenuItemProps {
|
|
10
11
|
/** The unique value of the item. */
|
|
11
|
-
value:
|
|
12
|
+
value: AcceptableValue;
|
|
12
13
|
}
|
|
13
14
|
</script>
|
|
14
15
|
|
|
@@ -8,7 +8,7 @@ export interface ANavigationMenuItemProps extends APrimitiveProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* A unique value that associates the item with an active value when the navigation menu is controlled.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* This prop is managed automatically when uncontrolled.
|
|
12
12
|
*/
|
|
13
13
|
value?: string;
|
|
14
14
|
}
|
|
@@ -94,7 +94,7 @@ export const [
|
|
|
94
94
|
|
|
95
95
|
<script setup lang="ts">
|
|
96
96
|
import { isString } from '@vinicunca/perkakas';
|
|
97
|
-
import { refAutoReset, useDebounceFn, useVModel } from '@vueuse/core';
|
|
97
|
+
import { refAutoReset, useDebounceFn, useEventListener, useVModel } from '@vueuse/core';
|
|
98
98
|
import {
|
|
99
99
|
computed,
|
|
100
100
|
ref,
|
|
@@ -106,6 +106,7 @@ import {
|
|
|
106
106
|
APrimitive,
|
|
107
107
|
} from '../primitive';
|
|
108
108
|
import { useDirection, useForwardExpose, useId } from '../shared';
|
|
109
|
+
import { EVENT_ROOT_CONTENT_DISMISS } from './utils';
|
|
109
110
|
|
|
110
111
|
const props = withDefaults(
|
|
111
112
|
defineProps<ANavigationMenuRootProps>(),
|
|
@@ -185,6 +186,17 @@ watchEffect(() => {
|
|
|
185
186
|
);
|
|
186
187
|
});
|
|
187
188
|
|
|
189
|
+
function onItemDismiss() {
|
|
190
|
+
previousValue.value = modelValue.value;
|
|
191
|
+
modelValue.value = '';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
useEventListener(
|
|
195
|
+
rootNavigationMenu,
|
|
196
|
+
EVENT_ROOT_CONTENT_DISMISS,
|
|
197
|
+
onItemDismiss,
|
|
198
|
+
);
|
|
199
|
+
|
|
188
200
|
provideNavigationMenuContext({
|
|
189
201
|
isRootMenu: true,
|
|
190
202
|
modelValue,
|
|
@@ -225,10 +237,7 @@ provideNavigationMenuContext({
|
|
|
225
237
|
previousValue.value = modelValue.value;
|
|
226
238
|
modelValue.value = val;
|
|
227
239
|
},
|
|
228
|
-
onItemDismiss
|
|
229
|
-
previousValue.value = modelValue.value;
|
|
230
|
-
modelValue.value = '';
|
|
231
|
-
},
|
|
240
|
+
onItemDismiss,
|
|
232
241
|
});
|
|
233
242
|
</script>
|
|
234
243
|
|
|
@@ -236,7 +245,6 @@ provideNavigationMenuContext({
|
|
|
236
245
|
<ACollectionSlot>
|
|
237
246
|
<APrimitive
|
|
238
247
|
:ref="forwardRef"
|
|
239
|
-
aria-label="Main"
|
|
240
248
|
:as="as"
|
|
241
249
|
:as-child="asChild"
|
|
242
250
|
:data-orientation="orientation"
|
|
@@ -17,6 +17,8 @@ export interface ANumberFieldRootProps extends APrimitiveProps, FormFieldProps {
|
|
|
17
17
|
step?: number;
|
|
18
18
|
/** When `false`, prevents the value from snapping to the nearest increment of the step value */
|
|
19
19
|
stepSnapping?: boolean;
|
|
20
|
+
/** When `true`, the input will be focused when the value changes. */
|
|
21
|
+
focusOnChange?: boolean;
|
|
20
22
|
/** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */
|
|
21
23
|
formatOptions?: Intl.NumberFormatOptions;
|
|
22
24
|
/** The locale to use for formatting dates */
|
|
@@ -75,12 +77,16 @@ defineOptions({
|
|
|
75
77
|
inheritAttrs: false,
|
|
76
78
|
});
|
|
77
79
|
|
|
78
|
-
const props = withDefaults(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const props = withDefaults(
|
|
81
|
+
defineProps<ANumberFieldRootProps>(),
|
|
82
|
+
{
|
|
83
|
+
as: 'div',
|
|
84
|
+
defaultValue: undefined,
|
|
85
|
+
step: 1,
|
|
86
|
+
stepSnapping: true,
|
|
87
|
+
focusOnChange: true,
|
|
88
|
+
},
|
|
89
|
+
);
|
|
84
90
|
const emits = defineEmits<ANumberFieldRootEmits>();
|
|
85
91
|
const {
|
|
86
92
|
disabled,
|
|
@@ -143,7 +149,9 @@ const isIncreaseDisabled = computed(() => {
|
|
|
143
149
|
);
|
|
144
150
|
|
|
145
151
|
function handleChangingValue(type: 'decrease' | 'increase', multiplier = 1) {
|
|
146
|
-
|
|
152
|
+
if (props.focusOnChange) {
|
|
153
|
+
inputEl.value?.focus();
|
|
154
|
+
}
|
|
147
155
|
|
|
148
156
|
if (props.disabled || props.readonly) {
|
|
149
157
|
return;
|
|
@@ -61,10 +61,16 @@ function handleInput(event: InputEvent) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
function
|
|
65
|
-
const target = currentElement.value as HTMLInputElement;
|
|
64
|
+
function updatePlaceholder() {
|
|
66
65
|
nextTick(() => {
|
|
67
|
-
|
|
66
|
+
const target = currentElement.value as HTMLInputElement;
|
|
67
|
+
if (!target) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!target.value && target === getActiveElement()) {
|
|
72
|
+
target.placeholder = '';
|
|
73
|
+
} else {
|
|
68
74
|
target.placeholder = context.placeholder.value;
|
|
69
75
|
}
|
|
70
76
|
});
|
|
@@ -117,23 +123,28 @@ function handleDelete(event: KeyboardEvent) {
|
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
function handleFocus(event: FocusEvent) {
|
|
120
|
-
|
|
121
|
-
target.setSelectionRange(1, 1);
|
|
126
|
+
// In OTP mode, inputs should be filled one by one without skipping middle inputs
|
|
122
127
|
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
if (context.otp.value) {
|
|
129
|
+
const firstEmptyIndex = inputElements.value.findIndex((_, idx) => {
|
|
130
|
+
return context.currentModelValue.value[idx] === ''
|
|
131
|
+
|| context.currentModelValue.value[idx] === undefined;
|
|
132
|
+
});
|
|
126
133
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
target.placeholder = '';
|
|
134
|
+
if (firstEmptyIndex !== -1 && firstEmptyIndex < props.index) {
|
|
135
|
+
inputElements.value[firstEmptyIndex].focus();
|
|
136
|
+
return;
|
|
131
137
|
}
|
|
132
|
-
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const target = event.target as HTMLInputElement;
|
|
141
|
+
target.setSelectionRange(1, 1);
|
|
142
|
+
|
|
143
|
+
updatePlaceholder();
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
function handleBlur() {
|
|
136
|
-
|
|
147
|
+
updatePlaceholder();
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
function handlePaste(event: ClipboardEvent) {
|
|
@@ -200,11 +211,7 @@ function updateModelValueAt(
|
|
|
200
211
|
|
|
201
212
|
watch(
|
|
202
213
|
currentValue,
|
|
203
|
-
|
|
204
|
-
if (!currentValue.value) {
|
|
205
|
-
resetPlaceholder();
|
|
206
|
-
}
|
|
207
|
-
},
|
|
214
|
+
updatePlaceholder,
|
|
208
215
|
);
|
|
209
216
|
|
|
210
217
|
onMounted(() => {
|