@rotki/ui-library 2.9.0 → 2.10.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/components/accordions/accordion/RuiAccordion.vue.d.ts +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue.js +87 -8
- package/dist/components/accordions/accordion/RuiAccordion.vue.js.map +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue2.js +1 -62
- package/dist/components/accordions/accordion/RuiAccordion.vue2.js.map +1 -1
- package/dist/components/calendar/RuiCalendar.vue.js +12 -0
- package/dist/components/calendar/RuiCalendar.vue.js.map +1 -1
- package/dist/components/calendar/RuiCalendarMenu.vue.js +1 -1
- package/dist/components/calendar/RuiCalendarMenu.vue2.js +2 -2
- package/dist/components/calendar/RuiCalendarMenu.vue2.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +4 -0
- package/dist/components/date-time-picker/RuiDateTimePicker.vue2.js +19 -8
- package/dist/components/date-time-picker/RuiDateTimePicker.vue2.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +49 -16
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue2.js +22 -13
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue2.js.map +1 -1
- package/dist/components/forms/checkbox/RuiCheckbox.vue.d.ts +2 -0
- package/dist/components/forms/checkbox/RuiCheckbox.vue2.js +19 -8
- package/dist/components/forms/checkbox/RuiCheckbox.vue2.js.map +1 -1
- package/dist/components/forms/radio-button/radio/RuiRadio.vue.d.ts +1 -0
- package/dist/components/forms/radio-button/radio/RuiRadio.vue2.js +18 -8
- package/dist/components/forms/radio-button/radio/RuiRadio.vue2.js.map +1 -1
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue.d.ts +1 -0
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue2.js +12 -3
- package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue2.js.map +1 -1
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue.d.ts +1 -0
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue.js +2 -1
- package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue.js.map +1 -1
- package/dist/components/forms/select/RuiMenuSelect.vue.d.ts +49 -16
- package/dist/components/forms/select/RuiMenuSelect.vue2.js +18 -9
- package/dist/components/forms/select/RuiMenuSelect.vue2.js.map +1 -1
- package/dist/components/forms/slider/RuiSlider.vue.d.ts +2 -0
- package/dist/components/forms/slider/RuiSlider.vue2.js +23 -12
- package/dist/components/forms/slider/RuiSlider.vue2.js.map +1 -1
- package/dist/components/forms/switch/RuiSwitch.vue.d.ts +2 -0
- package/dist/components/forms/switch/RuiSwitch.vue2.js +16 -7
- package/dist/components/forms/switch/RuiSwitch.vue2.js.map +1 -1
- package/dist/components/forms/text-area/RuiTextArea.vue.d.ts +2 -0
- package/dist/components/forms/text-area/RuiTextArea.vue2.js +28 -15
- package/dist/components/forms/text-area/RuiTextArea.vue2.js.map +1 -1
- package/dist/components/forms/text-field/RuiTextField.vue.d.ts +2 -0
- package/dist/components/forms/text-field/RuiTextField.vue2.js +26 -13
- package/dist/components/forms/text-field/RuiTextField.vue2.js.map +1 -1
- package/dist/components/icons/IconBrowser.vue.d.ts +3 -0
- package/dist/components/icons/LazyIcon.vue.d.ts +10 -0
- package/dist/style.css +97 -60
- package/dist/web-types.json +155 -1
- package/package.json +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue3.js +0 -18
- package/dist/components/accordions/accordion/RuiAccordion.vue3.js.map +0 -1
|
@@ -13,7 +13,7 @@ type __VLS_Slots = {} & {
|
|
|
13
13
|
} & {
|
|
14
14
|
default?: (props: typeof __VLS_7) => any;
|
|
15
15
|
};
|
|
16
|
-
declare const __VLS_base: import("vue").DefineComponent<AccordionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
declare const __VLS_base: import("vue").DefineComponent<AccordionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
17
|
click: () => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<AccordionProps> & Readonly<{
|
|
19
19
|
onClick?: (() => any) | undefined;
|
|
@@ -1,11 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent, useId, ref, computed, createElementBlock, openBlock, mergeProps, createCommentVNode, unref, normalizeClass, createElementVNode, createVNode, renderSlot, normalizeStyle } from "vue";
|
|
2
|
+
import RuiIcon from "../../icons/RuiIcon.vue.js";
|
|
3
|
+
import { useElementSize } from "@vueuse/core";
|
|
4
|
+
import { get } from "@vueuse/shared";
|
|
5
|
+
const _hoisted_1 = ["data-state"];
|
|
6
|
+
const _hoisted_2 = ["id", "aria-expanded", "aria-controls"];
|
|
7
|
+
const _hoisted_3 = ["id", "aria-labelledby"];
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
...{
|
|
10
|
+
name: "RuiAccordion",
|
|
11
|
+
inheritAttrs: false
|
|
12
|
+
},
|
|
13
|
+
__name: "RuiAccordion",
|
|
14
|
+
props: {
|
|
15
|
+
open: { type: Boolean, default: false },
|
|
16
|
+
eager: { type: Boolean, default: false },
|
|
17
|
+
headerGrow: { type: Boolean, default: false },
|
|
18
|
+
headerClass: { default: "" },
|
|
19
|
+
contentClass: { default: "" }
|
|
20
|
+
},
|
|
21
|
+
emits: ["click"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const props = __props;
|
|
24
|
+
const emit = __emit;
|
|
25
|
+
const triggerId = useId();
|
|
26
|
+
const contentId = useId();
|
|
27
|
+
const inner = ref();
|
|
28
|
+
const { height: innerHeight } = useElementSize(inner);
|
|
29
|
+
const contentHeight = computed(() => props.open ? `${get(innerHeight)}px` : "0px");
|
|
30
|
+
function toggle() {
|
|
31
|
+
emit("click");
|
|
32
|
+
}
|
|
33
|
+
function onKeydown(event) {
|
|
34
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
toggle();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return (_ctx, _cache) => {
|
|
40
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
41
|
+
class: "flex flex-col items-start",
|
|
42
|
+
"data-state": __props.open ? "open" : "closed",
|
|
43
|
+
"data-accordion": ""
|
|
44
|
+
}, _ctx.$attrs), [
|
|
45
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
46
|
+
key: 0,
|
|
47
|
+
id: unref(triggerId),
|
|
48
|
+
class: normalizeClass(["flex gap-2 items-center cursor-pointer outline-none focus-visible:bg-rui-primary/10 rounded", [__props.headerClass, { "w-full": __props.headerGrow }]]),
|
|
49
|
+
role: "button",
|
|
50
|
+
tabindex: "0",
|
|
51
|
+
"aria-expanded": __props.open,
|
|
52
|
+
"aria-controls": unref(contentId),
|
|
53
|
+
"data-accordion-trigger": "",
|
|
54
|
+
onClick: _cache[0] || (_cache[0] = ($event) => toggle()),
|
|
55
|
+
onKeydown: _cache[1] || (_cache[1] = ($event) => onKeydown($event))
|
|
56
|
+
}, [
|
|
57
|
+
createElementVNode("div", {
|
|
58
|
+
class: normalizeClass({ grow: __props.headerGrow })
|
|
59
|
+
}, [
|
|
60
|
+
renderSlot(_ctx.$slots, "header", { open: __props.open })
|
|
61
|
+
], 2),
|
|
62
|
+
createVNode(RuiIcon, {
|
|
63
|
+
class: normalizeClass(["text-rui-text-secondary transition-transform", { "-rotate-180": __props.open }]),
|
|
64
|
+
name: "lu-chevron-down"
|
|
65
|
+
}, null, 8, ["class"])
|
|
66
|
+
], 42, _hoisted_2)) : createCommentVNode("", true),
|
|
67
|
+
__props.open || __props.eager ? (openBlock(), createElementBlock("div", {
|
|
68
|
+
key: 1,
|
|
69
|
+
id: unref(contentId),
|
|
70
|
+
class: normalizeClass(["grow transition-all overflow-hidden w-full", __props.contentClass]),
|
|
71
|
+
style: normalizeStyle({ height: unref(contentHeight) }),
|
|
72
|
+
role: "region",
|
|
73
|
+
"aria-labelledby": unref(triggerId),
|
|
74
|
+
"data-accordion-content": ""
|
|
75
|
+
}, [
|
|
76
|
+
createElementVNode("div", {
|
|
77
|
+
ref_key: "inner",
|
|
78
|
+
ref: inner
|
|
79
|
+
}, [
|
|
80
|
+
renderSlot(_ctx.$slots, "default")
|
|
81
|
+
], 512)
|
|
82
|
+
], 14, _hoisted_3)) : createCommentVNode("", true)
|
|
83
|
+
], 16, _hoisted_1);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
8
87
|
export {
|
|
9
|
-
|
|
88
|
+
_sfc_main as default
|
|
10
89
|
};
|
|
11
90
|
//# sourceMappingURL=RuiAccordion.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordion.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RuiAccordion.vue.js","sources":["../../../../src/components/accordions/accordion/RuiAccordion.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport Icon from '@/components/icons/RuiIcon.vue';\n\nexport interface AccordionProps {\n open?: boolean;\n eager?: boolean;\n headerGrow?: boolean;\n headerClass?: string;\n contentClass?: string;\n}\n\ndefineOptions({\n name: 'RuiAccordion',\n inheritAttrs: false,\n});\n\nconst props = withDefaults(defineProps<AccordionProps>(), {\n open: false,\n eager: false,\n headerGrow: false,\n headerClass: '',\n contentClass: '',\n});\n\nconst emit = defineEmits<{\n click: [];\n}>();\n\nconst triggerId = useId();\nconst contentId = useId();\n\nconst inner = ref<HTMLDivElement>();\nconst { height: innerHeight } = useElementSize(inner);\n\nconst contentHeight = computed<string>(() => (props.open ? `${get(innerHeight)}px` : '0px'));\n\nfunction toggle(): void {\n emit('click');\n}\n\nfunction onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n toggle();\n }\n}\n</script>\n\n<template>\n <div\n class=\"flex flex-col items-start\"\n :data-state=\"open ? 'open' : 'closed'\"\n data-accordion\n v-bind=\"$attrs\"\n >\n <div\n v-if=\"$slots.header\"\n :id=\"triggerId\"\n class=\"flex gap-2 items-center cursor-pointer outline-none focus-visible:bg-rui-primary/10 rounded\"\n :class=\"[headerClass, { 'w-full': headerGrow }]\"\n role=\"button\"\n tabindex=\"0\"\n :aria-expanded=\"open\"\n :aria-controls=\"contentId\"\n data-accordion-trigger\n @click=\"toggle()\"\n @keydown=\"onKeydown($event)\"\n >\n <div\n :class=\"{ grow: headerGrow }\"\n >\n <slot\n name=\"header\"\n :open=\"open\"\n />\n </div>\n <Icon\n class=\"text-rui-text-secondary transition-transform\"\n :class=\"{ '-rotate-180': open }\"\n name=\"lu-chevron-down\"\n />\n </div>\n <div\n v-if=\"open || eager\"\n :id=\"contentId\"\n class=\"grow transition-all overflow-hidden w-full\"\n :class=\"contentClass\"\n :style=\"{ height: contentHeight }\"\n role=\"region\"\n :aria-labelledby=\"triggerId\"\n data-accordion-content\n >\n <div ref=\"inner\">\n <slot name=\"default\" />\n </div>\n </div>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","$attrs","$slots","_unref","_normalizeClass","_createElementVNode","_renderSlot","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,UAAM,QAAQ;AAQd,UAAM,OAAO;AAIb,UAAM,YAAY,MAAA;AAClB,UAAM,YAAY,MAAA;AAElB,UAAM,QAAQ,IAAA;AACd,UAAM,EAAE,QAAQ,gBAAgB,eAAe,KAAK;AAEpD,UAAM,gBAAgB,SAAiB,MAAO,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,KAAM;AAE3F,aAAS,SAAe;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,aAAS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AAAA,UAAA;YACPC,WAAuB,KAAA,QAAA,SAAA;AAAA,UAAA;;;;;;"}
|
|
@@ -1,65 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import RuiIcon from "../../icons/RuiIcon.vue.js";
|
|
3
|
-
import { useElementSize } from "@vueuse/core";
|
|
4
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
-
...{
|
|
6
|
-
name: "RuiAccordion",
|
|
7
|
-
inheritAttrs: false
|
|
8
|
-
},
|
|
9
|
-
__name: "RuiAccordion",
|
|
10
|
-
props: {
|
|
11
|
-
open: { type: Boolean, default: false },
|
|
12
|
-
eager: { type: Boolean, default: false },
|
|
13
|
-
headerGrow: { type: Boolean, default: false },
|
|
14
|
-
headerClass: { default: "" },
|
|
15
|
-
contentClass: { default: "" }
|
|
16
|
-
},
|
|
17
|
-
emits: ["click"],
|
|
18
|
-
setup(__props, { emit: __emit }) {
|
|
19
|
-
useCssVars((_ctx) => ({
|
|
20
|
-
"fcb53c98": unref(innerHeight)
|
|
21
|
-
}));
|
|
22
|
-
const emit = __emit;
|
|
23
|
-
function click() {
|
|
24
|
-
emit("click");
|
|
25
|
-
}
|
|
26
|
-
const inner = ref();
|
|
27
|
-
const { height: innerHeight } = useElementSize(inner);
|
|
28
|
-
return (_ctx, _cache) => {
|
|
29
|
-
return openBlock(), createElementBlock("div", mergeProps({
|
|
30
|
-
class: ["accordion", [_ctx.$style.accordion, { [_ctx.$style.open]: __props.open }]]
|
|
31
|
-
}, _ctx.$attrs), [
|
|
32
|
-
_ctx.$slots.header ? (openBlock(), createElementBlock("div", {
|
|
33
|
-
key: 0,
|
|
34
|
-
class: normalizeClass(["accordion__header flex gap-2 items-center", [__props.headerClass, { "w-full": __props.headerGrow }]]),
|
|
35
|
-
role: "button",
|
|
36
|
-
onClick: _cache[0] || (_cache[0] = ($event) => click())
|
|
37
|
-
}, [
|
|
38
|
-
createElementVNode("div", {
|
|
39
|
-
class: normalizeClass({ grow: __props.headerGrow })
|
|
40
|
-
}, [
|
|
41
|
-
renderSlot(_ctx.$slots, "header", { open: __props.open })
|
|
42
|
-
], 2),
|
|
43
|
-
createVNode(RuiIcon, {
|
|
44
|
-
class: normalizeClass(["text-rui-text-secondary", _ctx.$style.icon]),
|
|
45
|
-
name: "lu-chevron-down"
|
|
46
|
-
}, null, 8, ["class"])
|
|
47
|
-
], 2)) : createCommentVNode("", true),
|
|
48
|
-
__props.open || __props.eager ? (openBlock(), createElementBlock("div", {
|
|
49
|
-
key: 1,
|
|
50
|
-
class: normalizeClass([[__props.contentClass, _ctx.$style.accordion__content], "accordion__content"])
|
|
51
|
-
}, [
|
|
52
|
-
createElementVNode("div", {
|
|
53
|
-
ref_key: "inner",
|
|
54
|
-
ref: inner
|
|
55
|
-
}, [
|
|
56
|
-
renderSlot(_ctx.$slots, "default")
|
|
57
|
-
], 512)
|
|
58
|
-
], 2)) : createCommentVNode("", true)
|
|
59
|
-
], 16);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
});
|
|
1
|
+
import _sfc_main from "./RuiAccordion.vue.js";
|
|
63
2
|
export {
|
|
64
3
|
_sfc_main as default
|
|
65
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiAccordion.vue2.js","sources":[
|
|
1
|
+
{"version":3,"file":"RuiAccordion.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -67,6 +67,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
67
67
|
function selectMonth(selection) {
|
|
68
68
|
set(viewMonth, selection.month);
|
|
69
69
|
set(viewYear, selection.year);
|
|
70
|
+
if (isDefined(selectedDate)) {
|
|
71
|
+
const current = get(selectedDate);
|
|
72
|
+
const currentDay = current.getDate();
|
|
73
|
+
const daysInNewMonth = new Date(selection.year, selection.month + 1, 0).getDate();
|
|
74
|
+
const adjustedDay = Math.min(currentDay, daysInNewMonth);
|
|
75
|
+
const newDate = new Date(current);
|
|
76
|
+
newDate.setFullYear(selection.year);
|
|
77
|
+
newDate.setDate(1);
|
|
78
|
+
newDate.setMonth(selection.month);
|
|
79
|
+
newDate.setDate(adjustedDay);
|
|
80
|
+
set(selectedDate, newDate);
|
|
81
|
+
}
|
|
70
82
|
}
|
|
71
83
|
watch([selectedDate], ([date]) => {
|
|
72
84
|
if (!date && !props.allowEmpty)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiCalendar.vue.js","sources":["../../../src/components/calendar/RuiCalendar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { computed, provide, ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport { useRotkiTheme } from '@/composables/theme';\nimport RuiCalendarGrid from './RuiCalendarGrid.vue';\nimport RuiCalendarHeader from './RuiCalendarHeader.vue';\n\nexport interface CalendarProps {\n maxDate?: Date | number;\n minDate?: Date | number;\n allowEmpty?: boolean;\n borderless?: boolean;\n}\n\ndefineOptions({\n name: 'RuiCalendar',\n inheritAttrs: false,\n});\n\nconst model = defineModel<Date | undefined>({ required: false });\nconst isMenuOpen = defineModel<boolean>('menu-open', { required: false, default: false });\n\nconst props = withDefaults(defineProps<CalendarProps>(), {\n maxDate: undefined,\n minDate: undefined,\n allowEmpty: false,\n borderless: false,\n});\n\nconst emit = defineEmits<{\n 'update:pages': [{ title: string }[]];\n}>();\n\nconst currentDate = ref(isDefined(model) ? new Date(get(model)) : new Date());\nconst selectedDate = ref(isDefined(model) ? new Date(get(model)) : undefined);\nconst viewMonth = ref(get(currentDate).getMonth());\nconst viewYear = ref(get(currentDate).getFullYear());\n\nconst { isDark } = useRotkiTheme();\n\nconst monthTitle = computed<string>(() => {\n const date = new Date(get(viewYear), get(viewMonth));\n return date.toLocaleString('default', { month: 'long', year: 'numeric' });\n});\n\nprovide(CalendarStateSymbol.valueOf(), {\n viewMonth,\n viewYear,\n selectedDate,\n maxDate: computed(() => props.maxDate ? new Date(props.maxDate) : undefined),\n minDate: computed(() => props.minDate ? new Date(props.minDate) : undefined),\n isDark,\n allowEmpty: props.allowEmpty,\n} satisfies RuiCalendarState);\n\nfunction moveMonth(delta: number) {\n let newMonth = get(viewMonth) + delta;\n let newYear = get(viewYear);\n\n if (newMonth > 11) {\n newMonth = 0;\n newYear++;\n }\n else if (newMonth < 0) {\n newMonth = 11;\n newYear--;\n }\n\n set(viewMonth, newMonth);\n set(viewYear, newYear);\n\n emit('update:pages', [{ title: get(monthTitle) }]);\n}\n\nfunction move(date: Date | number) {\n const newDate = new Date(date);\n set(viewMonth, newDate.getMonth());\n set(viewYear, newDate.getFullYear());\n}\n\nfunction selectMonth(selection: MonthYearSelection) {\n set(viewMonth, selection.month);\n set(viewYear, selection.year);\n}\n\nwatch([selectedDate], ([date]) => {\n if (!date && !props.allowEmpty)\n return;\n\n if (date) {\n set(model, new Date(date));\n\n if (get(viewMonth) !== date.getMonth()) {\n set(viewMonth, date.getMonth());\n }\n\n if (get(viewYear) !== date.getFullYear()) {\n set(viewYear, date.getFullYear());\n }\n }\n else {\n set(model, undefined);\n }\n});\n\nwatch(model, (newValue) => {\n if (newValue === undefined) {\n set(selectedDate, undefined);\n return;\n }\n\n const date = new Date(newValue);\n\n if (isDefined(selectedDate) && get(selectedDate).getTime() !== date.getTime()) {\n set(selectedDate, new Date(newValue));\n set(viewMonth, date.getMonth());\n set(viewYear, date.getFullYear());\n }\n});\n\ndefineExpose({\n move,\n});\n</script>\n\n<template>\n <div\n class=\"rui-calendar\"\n :class=\"{ dark: isDark, bordered: !borderless }\"\n >\n <RuiCalendarHeader\n v-model:menu-open=\"isMenuOpen\"\n :title=\"monthTitle\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n @prev-month=\"moveMonth(-1)\"\n @next-month=\"moveMonth(1)\"\n @select-month=\"selectMonth($event)\"\n />\n\n <RuiCalendarGrid\n v-model=\"selectedDate\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n />\n </div>\n</template>\n\n<style lang=\"scss\">\n.rui-calendar {\n @apply w-[18.75rem] bg-white overflow-hidden;\n\n &.bordered {\n @apply rounded-md shadow-sm border border-rui-grey-200;\n }\n\n &.dark {\n @apply bg-rui-grey-900;\n\n &.bordered {\n @apply border-rui-grey-800;\n }\n }\n}\n</style>\n"],"names":["_useModel","_createElementBlock","_normalizeClass","_unref","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAM,QAAQA,8BAAiD;AAC/D,UAAM,aAAaA,kBAAqB,WAAgD;AAExF,UAAM,QAAQ;AAOd,UAAM,OAAO;AAIb,UAAM,cAAc,IAAI,UAAU,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,oBAAI,MAAM;AAC5E,UAAM,eAAe,IAAI,UAAU,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,MAAS;AAC5E,UAAM,YAAY,IAAI,IAAI,WAAW,EAAE,UAAU;AACjD,UAAM,WAAW,IAAI,IAAI,WAAW,EAAE,aAAa;AAEnD,UAAM,EAAE,OAAA,IAAW,cAAA;AAEnB,UAAM,aAAa,SAAiB,MAAM;AACxC,YAAM,OAAO,IAAI,KAAK,IAAI,QAAQ,GAAG,IAAI,SAAS,CAAC;AACnD,aAAO,KAAK,eAAe,WAAW,EAAE,OAAO,QAAQ,MAAM,WAAW;AAAA,IAC1E,CAAC;AAED,YAAQ,oBAAoB,WAAW;AAAA,MACrC;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,SAAS,MAAM,MAAM,UAAU,IAAI,KAAK,MAAM,OAAO,IAAI,MAAS;AAAA,MAC3E,SAAS,SAAS,MAAM,MAAM,UAAU,IAAI,KAAK,MAAM,OAAO,IAAI,MAAS;AAAA,MAC3E;AAAA,MACA,YAAY,MAAM;AAAA,IAAA,CACQ;AAE5B,aAAS,UAAU,OAAe;AAChC,UAAI,WAAW,IAAI,SAAS,IAAI;AAChC,UAAI,UAAU,IAAI,QAAQ;AAE1B,UAAI,WAAW,IAAI;AACjB,mBAAW;AACX;AAAA,MACF,WACS,WAAW,GAAG;AACrB,mBAAW;AACX;AAAA,MACF;AAEA,UAAI,WAAW,QAAQ;AACvB,UAAI,UAAU,OAAO;AAErB,WAAK,gBAAgB,CAAC,EAAE,OAAO,IAAI,UAAU,EAAA,CAAG,CAAC;AAAA,IACnD;AAEA,aAAS,KAAK,MAAqB;AACjC,YAAM,UAAU,IAAI,KAAK,IAAI;AAC7B,UAAI,WAAW,QAAQ,UAAU;AACjC,UAAI,UAAU,QAAQ,aAAa;AAAA,IACrC;AAEA,aAAS,YAAY,WAA+B;AAClD,UAAI,WAAW,UAAU,KAAK;AAC9B,UAAI,UAAU,UAAU,IAAI;AAAA,
|
|
1
|
+
{"version":3,"file":"RuiCalendar.vue.js","sources":["../../../src/components/calendar/RuiCalendar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { computed, provide, ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport { useRotkiTheme } from '@/composables/theme';\nimport RuiCalendarGrid from './RuiCalendarGrid.vue';\nimport RuiCalendarHeader from './RuiCalendarHeader.vue';\n\nexport interface CalendarProps {\n maxDate?: Date | number;\n minDate?: Date | number;\n allowEmpty?: boolean;\n borderless?: boolean;\n}\n\ndefineOptions({\n name: 'RuiCalendar',\n inheritAttrs: false,\n});\n\nconst model = defineModel<Date | undefined>({ required: false });\nconst isMenuOpen = defineModel<boolean>('menu-open', { required: false, default: false });\n\nconst props = withDefaults(defineProps<CalendarProps>(), {\n maxDate: undefined,\n minDate: undefined,\n allowEmpty: false,\n borderless: false,\n});\n\nconst emit = defineEmits<{\n 'update:pages': [{ title: string }[]];\n}>();\n\nconst currentDate = ref(isDefined(model) ? new Date(get(model)) : new Date());\nconst selectedDate = ref(isDefined(model) ? new Date(get(model)) : undefined);\nconst viewMonth = ref(get(currentDate).getMonth());\nconst viewYear = ref(get(currentDate).getFullYear());\n\nconst { isDark } = useRotkiTheme();\n\nconst monthTitle = computed<string>(() => {\n const date = new Date(get(viewYear), get(viewMonth));\n return date.toLocaleString('default', { month: 'long', year: 'numeric' });\n});\n\nprovide(CalendarStateSymbol.valueOf(), {\n viewMonth,\n viewYear,\n selectedDate,\n maxDate: computed(() => props.maxDate ? new Date(props.maxDate) : undefined),\n minDate: computed(() => props.minDate ? new Date(props.minDate) : undefined),\n isDark,\n allowEmpty: props.allowEmpty,\n} satisfies RuiCalendarState);\n\nfunction moveMonth(delta: number) {\n let newMonth = get(viewMonth) + delta;\n let newYear = get(viewYear);\n\n if (newMonth > 11) {\n newMonth = 0;\n newYear++;\n }\n else if (newMonth < 0) {\n newMonth = 11;\n newYear--;\n }\n\n set(viewMonth, newMonth);\n set(viewYear, newYear);\n\n emit('update:pages', [{ title: get(monthTitle) }]);\n}\n\nfunction move(date: Date | number) {\n const newDate = new Date(date);\n set(viewMonth, newDate.getMonth());\n set(viewYear, newDate.getFullYear());\n}\n\nfunction selectMonth(selection: MonthYearSelection) {\n set(viewMonth, selection.month);\n set(viewYear, selection.year);\n\n // If there's a selected date, update it with the new year/month\n if (isDefined(selectedDate)) {\n const current = get(selectedDate);\n const currentDay = current.getDate();\n // Handle day overflow (e.g., Jan 31 -> Feb 28) by checking BEFORE setting month\n const daysInNewMonth = new Date(selection.year, selection.month + 1, 0).getDate();\n const adjustedDay = Math.min(currentDay, daysInNewMonth);\n\n const newDate = new Date(current);\n newDate.setFullYear(selection.year);\n newDate.setDate(1); // Set to 1st to avoid overflow when changing month\n newDate.setMonth(selection.month);\n newDate.setDate(adjustedDay);\n set(selectedDate, newDate);\n }\n}\n\nwatch([selectedDate], ([date]) => {\n if (!date && !props.allowEmpty)\n return;\n\n if (date) {\n set(model, new Date(date));\n\n if (get(viewMonth) !== date.getMonth()) {\n set(viewMonth, date.getMonth());\n }\n\n if (get(viewYear) !== date.getFullYear()) {\n set(viewYear, date.getFullYear());\n }\n }\n else {\n set(model, undefined);\n }\n});\n\nwatch(model, (newValue) => {\n if (newValue === undefined) {\n set(selectedDate, undefined);\n return;\n }\n\n const date = new Date(newValue);\n\n if (isDefined(selectedDate) && get(selectedDate).getTime() !== date.getTime()) {\n set(selectedDate, new Date(newValue));\n set(viewMonth, date.getMonth());\n set(viewYear, date.getFullYear());\n }\n});\n\ndefineExpose({\n move,\n});\n</script>\n\n<template>\n <div\n class=\"rui-calendar\"\n :class=\"{ dark: isDark, bordered: !borderless }\"\n >\n <RuiCalendarHeader\n v-model:menu-open=\"isMenuOpen\"\n :title=\"monthTitle\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n @prev-month=\"moveMonth(-1)\"\n @next-month=\"moveMonth(1)\"\n @select-month=\"selectMonth($event)\"\n />\n\n <RuiCalendarGrid\n v-model=\"selectedDate\"\n :view-month=\"viewMonth\"\n :view-year=\"viewYear\"\n />\n </div>\n</template>\n\n<style lang=\"scss\">\n.rui-calendar {\n @apply w-[18.75rem] bg-white overflow-hidden;\n\n &.bordered {\n @apply rounded-md shadow-sm border border-rui-grey-200;\n }\n\n &.dark {\n @apply bg-rui-grey-900;\n\n &.bordered {\n @apply border-rui-grey-800;\n }\n }\n}\n</style>\n"],"names":["_useModel","_createElementBlock","_normalizeClass","_unref","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAM,QAAQA,8BAAiD;AAC/D,UAAM,aAAaA,kBAAqB,WAAgD;AAExF,UAAM,QAAQ;AAOd,UAAM,OAAO;AAIb,UAAM,cAAc,IAAI,UAAU,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,oBAAI,MAAM;AAC5E,UAAM,eAAe,IAAI,UAAU,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,MAAS;AAC5E,UAAM,YAAY,IAAI,IAAI,WAAW,EAAE,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AA;AAAA,qEAAA,WAAU,QAAA;AAAA,UAC5B,OAAO,WAAA;AAAA,UACP,cAAY,UAAA;AAAA,UACZ,aAAW,SAAA;AAAA,UACX,mDAAY,UAAS,EAAA;AAAA,UACrB,mDAAY,UAAS,CAAA;AAAA,UACrB,eAAY,OAAA,CAAA,MAAA,OAAA,CAAA,IAAA,CAAA,WAAE,YAAY,MAAM;AAAA,QAAA;QAGnCA,YAIE,iBAAA;AAAA,sBAHS,aAAA;AAAA,uEAAA,aAAY,QAAA;AAAA,UACpB,cAAY,UAAA;AAAA,UACZ,aAAW,SAAA;AAAA,QAAA;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./RuiCalendarMenu.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const RuiCalendarMenu = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const RuiCalendarMenu = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b1a30957"]]);
|
|
5
5
|
export {
|
|
6
6
|
RuiCalendarMenu as default
|
|
7
7
|
};
|
|
@@ -151,7 +151,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
151
151
|
function handleNext() {
|
|
152
152
|
if (get(viewMode) === "months") {
|
|
153
153
|
const nextYear = props.viewYear + 1;
|
|
154
|
-
|
|
154
|
+
emit("select", { month: props.viewMonth, year: nextYear });
|
|
155
155
|
} else {
|
|
156
156
|
const lastYearInRange = get(startYear) + 11;
|
|
157
157
|
set(startYear, lastYearInRange + 1);
|
|
@@ -160,7 +160,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
160
160
|
function handlePrev() {
|
|
161
161
|
if (get(viewMode) === "months") {
|
|
162
162
|
const previousYear = props.viewYear - 1;
|
|
163
|
-
|
|
163
|
+
emit("select", { month: props.viewMonth, year: previousYear });
|
|
164
164
|
} else {
|
|
165
165
|
const firstYearInRange = get(startYear);
|
|
166
166
|
set(startYear, firstYearInRange - 12);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiCalendarMenu.vue2.js","sources":["../../../src/components/calendar/RuiCalendarMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n getShortMonthNames,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport RuiMenu from '@/components/overlays/menu/RuiMenu.vue';\nimport RuiButton from '../buttons/button/RuiButton.vue';\n\ndefineOptions({\n name: 'RuiCalendarMenu',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>();\n\nconst props = defineProps<{\n anchorEl: HTMLElement | undefined;\n viewMonth: number;\n viewYear: number;\n}>();\n\nconst emit = defineEmits<{\n select: [MonthYearSelection];\n}>();\n\n// Core reactive state - minimal\nconst viewMode = ref<'months' | 'years'>('months');\nconst startYear = ref<number>(props.viewYear - 6);\n\n// Pre-calculated constants\nconst months = getShortMonthNames();\nconst calendarState = inject<RuiCalendarState>(CalendarStateSymbol) as RuiCalendarState;\n\n// Pre-calculated arrays for performance - using refs for better control\nconst yearRange = ref<number[]>([]);\nconst monthsInRange = ref<boolean[]>([]);\nconst yearsInRange = ref<boolean[]>([]);\nconst title = ref<string>('');\nconst canGoToNext = ref<boolean>(true);\nconst canGoToPrev = ref<boolean>(true);\n\n// Pre-calculation functions using VueUse get/set\nfunction calculateYearRange() {\n const start = get(startYear);\n set(yearRange, Array.from({ length: 12 }, (_, i) => start + i));\n}\n\nfunction calculateTitle() {\n if (get(viewMode) === 'months') {\n set(title, props.viewYear.toString());\n }\n else {\n const range = get(yearRange);\n set(title, `${range[0]} - ${range.at(-1)}`);\n }\n}\n\nfunction calculateNavigation() {\n const { maxDate, minDate } = calendarState;\n const mode = get(viewMode);\n\n if (mode === 'months') {\n const nextYear = props.viewYear + 1;\n const previousYear = props.viewYear - 1;\n\n set(canGoToNext, !isDefined(maxDate) || nextYear <= get(maxDate).getFullYear());\n set(canGoToPrev, !isDefined(minDate) || previousYear >= get(minDate).getFullYear());\n }\n else {\n const lastYearInRange = get(startYear) + 11;\n const firstYearInRange = get(startYear);\n\n // Check if we can navigate to the next range of years\n const nextRangeStart = lastYearInRange + 1;\n set(canGoToNext, !isDefined(maxDate) || nextRangeStart <= get(maxDate).getFullYear());\n\n // Check if we can navigate to the previous range of years\n const prevRangeEnd = firstYearInRange - 1;\n set(canGoToPrev, !isDefined(minDate) || prevRangeEnd >= get(minDate).getFullYear());\n }\n}\n\nfunction calculateMonthsInRange() {\n const { minDate, maxDate } = calendarState;\n const currentYear = props.viewYear;\n const result = new Array(12).fill(true);\n\n if (isDefined(minDate) || isDefined(maxDate)) {\n for (let month = 0; month < 12; month++) {\n const date = new Date(currentYear, month);\n if (isDefined(maxDate) && date > get(maxDate)) {\n result[month] = false;\n }\n if (isDefined(minDate) && date < get(minDate)) {\n result[month] = false;\n }\n }\n }\n\n set(monthsInRange, result);\n}\n\nfunction calculateYearsInRange() {\n const { minDate, maxDate } = calendarState;\n const range = get(yearRange);\n const currentMonth = props.viewMonth;\n\n if (!isDefined(minDate) && !isDefined(maxDate)) {\n set(yearsInRange, new Array(range.length).fill(true));\n return;\n }\n\n const result = range.map((year) => {\n const date = new Date(year, currentMonth);\n if (isDefined(maxDate) && date > get(maxDate)) {\n return false;\n }\n return !isDefined(minDate) || date >= get(minDate);\n });\n\n set(yearsInRange, result);\n}\n\n// Initial calculations\ncalculateYearRange();\ncalculateTitle();\ncalculateNavigation();\ncalculateMonthsInRange();\ncalculateYearsInRange();\n\n// Watchers for recalculation only when needed\nwatch(startYear, () => {\n calculateYearRange();\n calculateTitle();\n calculateNavigation();\n calculateYearsInRange();\n});\n\nwatch(viewMode, () => {\n calculateTitle();\n calculateNavigation();\n});\n\nwatch(() => props.viewYear, () => {\n calculateTitle();\n calculateNavigation();\n calculateMonthsInRange();\n calculateYearsInRange();\n});\n\nwatch(() => props.viewMonth, () => {\n calculateYearsInRange();\n});\n\nfunction toggleSelection() {\n set(viewMode, get(viewMode) === 'months' ? 'years' : 'months');\n}\n\nfunction selectMonth(month: number) {\n if (!get(monthsInRange)[month])\n return;\n emit('select', { month, year: props.viewYear });\n set(modelValue, false);\n}\n\nfunction selectYear(year: number) {\n const yearIndex = get(yearRange).indexOf(year);\n if (yearIndex === -1 || !get(yearsInRange)[yearIndex])\n return;\n\n emit('select', { month: props.viewMonth, year });\n set(viewMode, 'months');\n}\n\nfunction handleNext() {\n if (get(viewMode) === 'months') {\n const nextYear = props.viewYear + 1;\n selectYear(nextYear);\n }\n else {\n const lastYearInRange = get(startYear) + 11;\n set(startYear, lastYearInRange + 1);\n }\n}\n\nfunction handlePrev() {\n if (get(viewMode) === 'months') {\n const previousYear = props.viewYear - 1;\n selectYear(previousYear);\n }\n else {\n const firstYearInRange = get(startYear);\n set(startYear, firstYearInRange - 12);\n }\n}\n</script>\n\n<template>\n <RuiMenu\n v-model=\"modelValue\"\n :anchor-el=\"anchorEl\"\n placement=\"bottom-start\"\n >\n <div class=\"menu-container\">\n <div class=\"menu-header\">\n <RuiButton\n type=\"button\"\n class=\"nav-button\"\n icon\n :disabled=\"!get(canGoToPrev)\"\n variant=\"text\"\n @click.stop=\"handlePrev()\"\n >\n <RuiIcon\n name=\"lu-chevron-left\"\n size=\"20\"\n />\n </RuiButton>\n\n <div\n class=\"flex-1 text-center cursor-pointer\"\n @click.stop=\"toggleSelection()\"\n >\n {{ get(title) }}\n </div>\n\n <RuiButton\n type=\"button\"\n class=\"nav-button\"\n icon\n :disabled=\"!get(canGoToNext)\"\n variant=\"text\"\n @click.stop=\"handleNext()\"\n >\n <RuiIcon\n name=\"lu-chevron-right\"\n size=\"20\"\n />\n </RuiButton>\n </div>\n\n <div\n v-if=\"viewMode === 'months'\"\n class=\"month-grid\"\n >\n <button\n v-for=\"(month, index) in months\"\n :key=\"index\"\n type=\"button\"\n class=\"h-9 w-full flex items-center justify-center text-sm font-medium rounded-md transition-colors duration-150 ease-in-out border-none outline-none cursor-pointer focus:ring-2 focus:ring-rui-primary focus:ring-opacity-50\"\n :class=\"[\n {\n 'bg-rui-primary text-white hover:bg-rui-primary-darker active:bg-rui-primary-darker dark:bg-rui-primary dark:text-white dark:hover:bg-rui-primary-darker': index === viewMonth && get(monthsInRange)[index],\n 'bg-gray-300 text-gray-500 dark:bg-gray-600 dark:text-gray-400': index === viewMonth && !get(monthsInRange)[index],\n 'text-gray-700 bg-transparent hover:bg-gray-100 active:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:active:bg-gray-600': index !== viewMonth && get(monthsInRange)[index],\n 'opacity-50 cursor-not-allowed bg-transparent hover:bg-transparent active:bg-transparent dark:hover:bg-transparent dark:active:bg-transparent pointer-events-none text-gray-400 dark:text-gray-600': !get(monthsInRange)[index],\n },\n ]\"\n :disabled=\"!get(monthsInRange)[index]\"\n @click.stop=\"selectMonth(index)\"\n >\n {{ month.substring(0, 3) }}\n </button>\n </div>\n\n <div\n v-else-if=\"viewMode === 'years'\"\n class=\"year-grid\"\n >\n <button\n v-for=\"(year, index) in yearRange\"\n :key=\"year\"\n type=\"button\"\n class=\"h-9 w-full flex items-center justify-center text-sm font-medium rounded-md transition-colors duration-150 ease-in-out border-none outline-none cursor-pointer focus:ring-2 focus:ring-rui-primary focus:ring-opacity-50\"\n :class=\"[\n {\n 'bg-rui-primary text-white hover:bg-rui-primary-darker active:bg-rui-primary-darker dark:bg-rui-primary dark:text-white dark:hover:bg-rui-primary-darker': year === viewYear && get(yearsInRange)[index],\n 'bg-gray-300 text-gray-500 dark:bg-gray-600 dark:text-gray-400': year === viewYear && !get(yearsInRange)[index],\n 'text-gray-700 bg-transparent hover:bg-gray-100 active:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:active:bg-gray-600': year !== viewYear && get(yearsInRange)[index],\n 'opacity-50 cursor-not-allowed bg-transparent hover:bg-transparent active:bg-transparent dark:hover:bg-transparent dark:active:bg-transparent pointer-events-none text-gray-400 dark:text-gray-600': !get(yearsInRange)[index],\n },\n ]\"\n :disabled=\"!get(yearsInRange)[index]\"\n @click.stop=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n </div>\n </div>\n </RuiMenu>\n</template>\n\n<style scoped>\n.menu-container {\n @apply w-64 shadow-lg overflow-hidden;\n}\n\n.menu-header {\n @apply flex items-center justify-center p-1 font-medium text-gray-800 dark:text-gray-200;\n @apply border-b border-rui-grey-200 dark:border-rui-grey-800 cursor-pointer hover:bg-rui-grey-100 dark:hover:bg-rui-grey-800;\n}\n\n.month-grid {\n @apply grid grid-cols-3 gap-1 p-2;\n}\n\n.year-grid {\n @apply grid grid-cols-3 gap-1 p-2;\n}\n</style>\n"],"names":["_useModel","_createBlock","_createElementVNode","_createVNode","_unref","_toDisplayString","_openBlock","_createElementBlock","_Fragment","_renderList","_withModifiers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,UAAM,aAAaA,8BAAqB;AAExC,UAAM,QAAQ;AAMd,UAAM,OAAO;AAKb,UAAM,WAAW,IAAwB,QAAQ;AACjD,UAAM,YAAY,IAAY,MAAM,WAAW,CAAC;AAGhD,UAAM,SAAS,mBAAA;AACf,UAAM,gBAAgB,OAAyB,mBAAmB;AAGlE,UAAM,YAAY,IAAc,EAAE;AAClC,UAAM,gBAAgB,IAAe,EAAE;AACvC,UAAM,eAAe,IAAe,EAAE;AACtC,UAAM,QAAQ,IAAY,EAAE;AAC5B,UAAM,cAAc,IAAa,IAAI;AACrC,UAAM,cAAc,IAAa,IAAI;AAGrC,aAAS,qBAAqB;AAC5B,YAAM,QAAQ,IAAI,SAAS;AAC3B,UAAI,WAAW,MAAM,KAAK,EAAE,QAAQ,GAAA,GAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC;AAAA,IAChE;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AAM,UAAS,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA;AAAA;kBAKT,SAAA,UAAQ,WADrBC,UAAA,GAAAC,mBAsBM,OAtBN,YAsBM;AAAA,eAlBJD,UAAA,IAAA,GAAAC,mBAiBSC,UAAA,MAAAC,WAhBiB,UAAA,OAAS,CAAzB,MAAM,UAAK;oCADrBF,mBAiBS,UAAA;AAAA,kBAfN,KAAK;AAAA,kBACN,MAAK;AAAA,kBACL,uBAAM,2NAAyN;AAAA;sBAC9B,2JAAA,SAAS,QAAA,YAAYH,WAAI,aAAA,KAAY,EAAE,KAAK;AAAA,sBAAkF,iEAAA,SAAS,QAAA,YAAQ,CAAKA,WAAI,aAAA,KAAY,EAAE,KAAK;AAAA,sBAAwJ,uIAAA,SAAS,QAAA,YAAYA,WAAI,aAAA,KAAY,EAAE,KAAK;AAAA,4NAAuNA,MAAA,GAAA,EAAI,aAAA,KAAY,EAAE,KAAK;AAAA,oBAAA;AAAA;kBAQ7xB,UAAQ,CAAGA,MAAA,GAAA,EAAI,aAAA,KAAY,EAAE,KAAK;AAAA,kBAClC,SAAKM,cAAA,CAAA,WAAO,WAAW,IAAI,GAAA,CAAA,MAAA,CAAA;AAAA,gBAAA,mBAEzB,IAAI,GAAA,IAAA,UAAA;AAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"RuiCalendarMenu.vue2.js","sources":["../../../src/components/calendar/RuiCalendarMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { get, isDefined, set } from '@vueuse/core';\nimport { ref, watch } from 'vue';\nimport {\n CalendarStateSymbol,\n getShortMonthNames,\n type MonthYearSelection,\n type RuiCalendarState,\n} from '@/components/calendar/state';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport RuiMenu from '@/components/overlays/menu/RuiMenu.vue';\nimport RuiButton from '../buttons/button/RuiButton.vue';\n\ndefineOptions({\n name: 'RuiCalendarMenu',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<boolean>();\n\nconst props = defineProps<{\n anchorEl: HTMLElement | undefined;\n viewMonth: number;\n viewYear: number;\n}>();\n\nconst emit = defineEmits<{\n select: [MonthYearSelection];\n}>();\n\n// Core reactive state - minimal\nconst viewMode = ref<'months' | 'years'>('months');\nconst startYear = ref<number>(props.viewYear - 6);\n\n// Pre-calculated constants\nconst months = getShortMonthNames();\nconst calendarState = inject<RuiCalendarState>(CalendarStateSymbol) as RuiCalendarState;\n\n// Pre-calculated arrays for performance - using refs for better control\nconst yearRange = ref<number[]>([]);\nconst monthsInRange = ref<boolean[]>([]);\nconst yearsInRange = ref<boolean[]>([]);\nconst title = ref<string>('');\nconst canGoToNext = ref<boolean>(true);\nconst canGoToPrev = ref<boolean>(true);\n\n// Pre-calculation functions using VueUse get/set\nfunction calculateYearRange() {\n const start = get(startYear);\n set(yearRange, Array.from({ length: 12 }, (_, i) => start + i));\n}\n\nfunction calculateTitle() {\n if (get(viewMode) === 'months') {\n set(title, props.viewYear.toString());\n }\n else {\n const range = get(yearRange);\n set(title, `${range[0]} - ${range.at(-1)}`);\n }\n}\n\nfunction calculateNavigation() {\n const { maxDate, minDate } = calendarState;\n const mode = get(viewMode);\n\n if (mode === 'months') {\n const nextYear = props.viewYear + 1;\n const previousYear = props.viewYear - 1;\n\n set(canGoToNext, !isDefined(maxDate) || nextYear <= get(maxDate).getFullYear());\n set(canGoToPrev, !isDefined(minDate) || previousYear >= get(minDate).getFullYear());\n }\n else {\n const lastYearInRange = get(startYear) + 11;\n const firstYearInRange = get(startYear);\n\n // Check if we can navigate to the next range of years\n const nextRangeStart = lastYearInRange + 1;\n set(canGoToNext, !isDefined(maxDate) || nextRangeStart <= get(maxDate).getFullYear());\n\n // Check if we can navigate to the previous range of years\n const prevRangeEnd = firstYearInRange - 1;\n set(canGoToPrev, !isDefined(minDate) || prevRangeEnd >= get(minDate).getFullYear());\n }\n}\n\nfunction calculateMonthsInRange() {\n const { minDate, maxDate } = calendarState;\n const currentYear = props.viewYear;\n const result = new Array(12).fill(true);\n\n if (isDefined(minDate) || isDefined(maxDate)) {\n for (let month = 0; month < 12; month++) {\n const date = new Date(currentYear, month);\n if (isDefined(maxDate) && date > get(maxDate)) {\n result[month] = false;\n }\n if (isDefined(minDate) && date < get(minDate)) {\n result[month] = false;\n }\n }\n }\n\n set(monthsInRange, result);\n}\n\nfunction calculateYearsInRange() {\n const { minDate, maxDate } = calendarState;\n const range = get(yearRange);\n const currentMonth = props.viewMonth;\n\n if (!isDefined(minDate) && !isDefined(maxDate)) {\n set(yearsInRange, new Array(range.length).fill(true));\n return;\n }\n\n const result = range.map((year) => {\n const date = new Date(year, currentMonth);\n if (isDefined(maxDate) && date > get(maxDate)) {\n return false;\n }\n return !isDefined(minDate) || date >= get(minDate);\n });\n\n set(yearsInRange, result);\n}\n\n// Initial calculations\ncalculateYearRange();\ncalculateTitle();\ncalculateNavigation();\ncalculateMonthsInRange();\ncalculateYearsInRange();\n\n// Watchers for recalculation only when needed\nwatch(startYear, () => {\n calculateYearRange();\n calculateTitle();\n calculateNavigation();\n calculateYearsInRange();\n});\n\nwatch(viewMode, () => {\n calculateTitle();\n calculateNavigation();\n});\n\nwatch(() => props.viewYear, () => {\n calculateTitle();\n calculateNavigation();\n calculateMonthsInRange();\n calculateYearsInRange();\n});\n\nwatch(() => props.viewMonth, () => {\n calculateYearsInRange();\n});\n\nfunction toggleSelection() {\n set(viewMode, get(viewMode) === 'months' ? 'years' : 'months');\n}\n\nfunction selectMonth(month: number) {\n if (!get(monthsInRange)[month])\n return;\n emit('select', { month, year: props.viewYear });\n set(modelValue, false);\n}\n\nfunction selectYear(year: number) {\n const yearIndex = get(yearRange).indexOf(year);\n if (yearIndex === -1 || !get(yearsInRange)[yearIndex])\n return;\n\n emit('select', { month: props.viewMonth, year });\n set(viewMode, 'months');\n}\n\nfunction handleNext() {\n if (get(viewMode) === 'months') {\n const nextYear = props.viewYear + 1;\n // Emit directly - navigation is already constrained by canGoToNext\n emit('select', { month: props.viewMonth, year: nextYear });\n }\n else {\n const lastYearInRange = get(startYear) + 11;\n set(startYear, lastYearInRange + 1);\n }\n}\n\nfunction handlePrev() {\n if (get(viewMode) === 'months') {\n const previousYear = props.viewYear - 1;\n // Emit directly - navigation is already constrained by canGoToPrev\n emit('select', { month: props.viewMonth, year: previousYear });\n }\n else {\n const firstYearInRange = get(startYear);\n set(startYear, firstYearInRange - 12);\n }\n}\n</script>\n\n<template>\n <RuiMenu\n v-model=\"modelValue\"\n :anchor-el=\"anchorEl\"\n placement=\"bottom-start\"\n >\n <div class=\"menu-container\">\n <div class=\"menu-header\">\n <RuiButton\n type=\"button\"\n class=\"nav-button\"\n icon\n :disabled=\"!get(canGoToPrev)\"\n variant=\"text\"\n @click.stop=\"handlePrev()\"\n >\n <RuiIcon\n name=\"lu-chevron-left\"\n size=\"20\"\n />\n </RuiButton>\n\n <div\n class=\"flex-1 text-center cursor-pointer\"\n @click.stop=\"toggleSelection()\"\n >\n {{ get(title) }}\n </div>\n\n <RuiButton\n type=\"button\"\n class=\"nav-button\"\n icon\n :disabled=\"!get(canGoToNext)\"\n variant=\"text\"\n @click.stop=\"handleNext()\"\n >\n <RuiIcon\n name=\"lu-chevron-right\"\n size=\"20\"\n />\n </RuiButton>\n </div>\n\n <div\n v-if=\"viewMode === 'months'\"\n class=\"month-grid\"\n >\n <button\n v-for=\"(month, index) in months\"\n :key=\"index\"\n type=\"button\"\n class=\"h-9 w-full flex items-center justify-center text-sm font-medium rounded-md transition-colors duration-150 ease-in-out border-none outline-none cursor-pointer focus:ring-2 focus:ring-rui-primary focus:ring-opacity-50\"\n :class=\"[\n {\n 'bg-rui-primary text-white hover:bg-rui-primary-darker active:bg-rui-primary-darker dark:bg-rui-primary dark:text-white dark:hover:bg-rui-primary-darker': index === viewMonth && get(monthsInRange)[index],\n 'bg-gray-300 text-gray-500 dark:bg-gray-600 dark:text-gray-400': index === viewMonth && !get(monthsInRange)[index],\n 'text-gray-700 bg-transparent hover:bg-gray-100 active:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:active:bg-gray-600': index !== viewMonth && get(monthsInRange)[index],\n 'opacity-50 cursor-not-allowed bg-transparent hover:bg-transparent active:bg-transparent dark:hover:bg-transparent dark:active:bg-transparent pointer-events-none text-gray-400 dark:text-gray-600': !get(monthsInRange)[index],\n },\n ]\"\n :disabled=\"!get(monthsInRange)[index]\"\n @click.stop=\"selectMonth(index)\"\n >\n {{ month.substring(0, 3) }}\n </button>\n </div>\n\n <div\n v-else-if=\"viewMode === 'years'\"\n class=\"year-grid\"\n >\n <button\n v-for=\"(year, index) in yearRange\"\n :key=\"year\"\n type=\"button\"\n class=\"h-9 w-full flex items-center justify-center text-sm font-medium rounded-md transition-colors duration-150 ease-in-out border-none outline-none cursor-pointer focus:ring-2 focus:ring-rui-primary focus:ring-opacity-50\"\n :class=\"[\n {\n 'bg-rui-primary text-white hover:bg-rui-primary-darker active:bg-rui-primary-darker dark:bg-rui-primary dark:text-white dark:hover:bg-rui-primary-darker': year === viewYear && get(yearsInRange)[index],\n 'bg-gray-300 text-gray-500 dark:bg-gray-600 dark:text-gray-400': year === viewYear && !get(yearsInRange)[index],\n 'text-gray-700 bg-transparent hover:bg-gray-100 active:bg-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:active:bg-gray-600': year !== viewYear && get(yearsInRange)[index],\n 'opacity-50 cursor-not-allowed bg-transparent hover:bg-transparent active:bg-transparent dark:hover:bg-transparent dark:active:bg-transparent pointer-events-none text-gray-400 dark:text-gray-600': !get(yearsInRange)[index],\n },\n ]\"\n :disabled=\"!get(yearsInRange)[index]\"\n @click.stop=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n </div>\n </div>\n </RuiMenu>\n</template>\n\n<style scoped>\n.menu-container {\n @apply w-64 shadow-lg overflow-hidden;\n}\n\n.menu-header {\n @apply flex items-center justify-center p-1 font-medium text-gray-800 dark:text-gray-200;\n @apply border-b border-rui-grey-200 dark:border-rui-grey-800 cursor-pointer hover:bg-rui-grey-100 dark:hover:bg-rui-grey-800;\n}\n\n.month-grid {\n @apply grid grid-cols-3 gap-1 p-2;\n}\n\n.year-grid {\n @apply grid grid-cols-3 gap-1 p-2;\n}\n</style>\n"],"names":["_useModel","_createBlock","_createElementVNode","_createVNode","_unref","_toDisplayString","_openBlock","_createElementBlock","_Fragment","_renderList","_withModifiers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,UAAM,aAAaA,8BAAqB;AAExC,UAAM,QAAQ;AAMd,UAAM,OAAO;AAKb,UAAM,WAAW,IAAwB,QAAQ;AACjD,UAAM,YAAY,IAAY,MAAM,WAAW,CAAC;AAGhD,UAAM,SAAS,mBAAA;AACf,UAAM,gBAAgB,OAAyB,mBAAmB;AAGlE,UAAM,YAAY,IAAc,EAAE;AAClC,UAAM,gBAAgB,IAAe,EAAE;AACvC,UAAM,eAAe,IAAe,EAAE;AACtC,UAAM,QAAQ,IAAY,EAAE;AAC5B,UAAM,cAAc,IAAa,IAAI;AACrC,UAAM,cAAc,IAAa,IAAI;AAGrC,aAAS,qBAAqB;AAC5B,YAAM,QAAQ,IAAI,SAAS;AAC3B,UAAI,WAAW,MAAM,KAAK,EAAE,QAAQ,GAAA,GAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC;AAAA,IAChE;AAEA,aAAS,iBAAiB;AACxB,UAAI,IAAI,QAAQ,MAAM,UAAU;AAC9B,YAAI,OAAO,MAAM,SAAS,SAAA,CAAU;AAAA,MACtC,OACK;AACH,cAAM,QAAQ,IAAI,SAAS;AAC3B,YAAI,OAAO,GAAG,MAAM,CAAC,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE;AAAA,MAC5C;AAAA,IACF;AAEA,aAAS,sBAAsB;AAC7B,YAAM,EAAE,SAAS,QAAA,IAAY;AAC7B,YAAM,OAAO,IAAI,QAAQ;AAEzB,UAAI,SAAS,UAAU;AACrB,cAAM,WAAW,MAAM,WAAW;AAClC,cAAM,eAAe,MAAM,WAAW;AAE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,EAAE,KAAK;AAAA,sBAAkF,iEAAA,SAAS,QAAA,YAAQ,CAAKA,WAAI,aAAA,KAAY,EAAE,KAAK;AAAA,sBAAwJ,uIAAA,SAAS,QAAA,YAAYA,WAAI,aAAA,KAAY,EAAE,KAAK;AAAA,4NAAuNA,MAAA,GAAA,EAAI,aAAA,KAAY,EAAE,KAAK;AAAA,oBAAA;AAAA;kBAQ7xB,UAAQ,CAAGA,MAAA,GAAA,EAAI,aAAA,KAAY,EAAE,KAAK;AAAA,kBAClC,SAAKM,cAAA,CAAA,WAAO,WAAW,IAAI,GAAA,CAAA,MAAA,CAAA;AAAA,gBAAA,mBAEzB,IAAI,GAAA,IAAA,UAAA;AAAA;;;;;;;;;"}
|
|
@@ -18,6 +18,7 @@ export interface RuiDateTimePickerProps {
|
|
|
18
18
|
errorMessages?: string | string[];
|
|
19
19
|
successMessages?: string | string[];
|
|
20
20
|
hideDetails?: boolean;
|
|
21
|
+
required?: boolean;
|
|
21
22
|
}
|
|
22
23
|
type __VLS_Props = RuiDateTimePickerProps;
|
|
23
24
|
declare const props: Readonly<{}> & {
|
|
@@ -36,10 +37,12 @@ declare const props: Readonly<{}> & {
|
|
|
36
37
|
readonly accuracy: TimeAccuracy;
|
|
37
38
|
readonly errorMessages: string | string[];
|
|
38
39
|
readonly successMessages: string | string[];
|
|
40
|
+
readonly required: boolean;
|
|
39
41
|
} & {
|
|
40
42
|
readonly disabled: boolean;
|
|
41
43
|
readonly dense: boolean;
|
|
42
44
|
readonly readonly: boolean;
|
|
45
|
+
readonly required: boolean;
|
|
43
46
|
readonly hideDetails: boolean;
|
|
44
47
|
readonly allowEmpty: boolean;
|
|
45
48
|
};
|
|
@@ -64,6 +67,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
64
67
|
errorMessages: string | string[];
|
|
65
68
|
successMessages: string | string[];
|
|
66
69
|
hint: string;
|
|
70
|
+
required: boolean;
|
|
67
71
|
hideDetails: boolean;
|
|
68
72
|
maxDate: Date | number | "now";
|
|
69
73
|
minDate: Date | number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRootAttrs, getNonRootAttrs } from "../../utils/helpers.js";
|
|
2
|
-
import { defineComponent, mergeModels, useCssVars, unref, computed, useModel, ref, watch, onMounted, createBlock, openBlock, mergeProps, isRef, withCtx, createVNode, renderSlot, createElementVNode, createElementBlock, createCommentVNode, normalizeClass, toDisplayString, withModifiers, nextTick } from "vue";
|
|
2
|
+
import { defineComponent, mergeModels, useCssVars, unref, computed, useModel, ref, watch, onMounted, createBlock, openBlock, mergeProps, isRef, withCtx, createVNode, renderSlot, createElementVNode, createElementBlock, createCommentVNode, normalizeClass, createTextVNode, toDisplayString, withModifiers, nextTick } from "vue";
|
|
3
3
|
import { logicOr, logicAnd } from "@vueuse/math";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import RuiButton from "../buttons/button/RuiButton.vue.js";
|
|
@@ -13,8 +13,12 @@ import { useRuiI8n } from "../../composables/use-rui-i18n.js";
|
|
|
13
13
|
import { RUI_I18N_KEYS } from "../../i18n/keys.js";
|
|
14
14
|
import { useFocusWithin, useFocus, isDefined, watchIgnorable } from "@vueuse/core";
|
|
15
15
|
import { get, set } from "@vueuse/shared";
|
|
16
|
-
const _hoisted_1 = ["tabindex"];
|
|
17
|
-
const _hoisted_2 =
|
|
16
|
+
const _hoisted_1 = ["data-error", "tabindex"];
|
|
17
|
+
const _hoisted_2 = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "text-rui-error"
|
|
20
|
+
};
|
|
21
|
+
const _hoisted_3 = ["disabled", "value", "placeholder", "readonly", "aria-invalid"];
|
|
18
22
|
const MILLISECONDS = 1e3;
|
|
19
23
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
24
|
...{
|
|
@@ -37,7 +41,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
41
|
hint: { default: void 0 },
|
|
38
42
|
errorMessages: { default: () => [] },
|
|
39
43
|
successMessages: { default: () => [] },
|
|
40
|
-
hideDetails: { type: Boolean, default: false }
|
|
44
|
+
hideDetails: { type: Boolean, default: false },
|
|
45
|
+
required: { type: Boolean, default: false }
|
|
41
46
|
}, {
|
|
42
47
|
"modelValue": { required: true },
|
|
43
48
|
"modelModifiers": {}
|
|
@@ -45,7 +50,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
50
|
emits: ["update:modelValue"],
|
|
46
51
|
setup(__props) {
|
|
47
52
|
useCssVars((_ctx) => ({
|
|
48
|
-
"
|
|
53
|
+
"a9f07354": unref(labelWithQuote)
|
|
49
54
|
}));
|
|
50
55
|
const modelValue = useModel(__props, "modelValue");
|
|
51
56
|
const props = __props;
|
|
@@ -185,7 +190,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
185
190
|
const labelWithQuote = computed(() => {
|
|
186
191
|
if (!props.label)
|
|
187
192
|
return '"\\200B"';
|
|
188
|
-
|
|
193
|
+
const asterisk = props.required ? "﹡" : "";
|
|
194
|
+
return `' ${props.label}${asterisk} '`;
|
|
189
195
|
});
|
|
190
196
|
const isOutlined = computed(() => props.variant === "outlined");
|
|
191
197
|
const formattedDisplay = computed(() => {
|
|
@@ -442,6 +448,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
442
448
|
},
|
|
443
449
|
{
|
|
444
450
|
"data-id": "activator",
|
|
451
|
+
"data-error": hasError ? "" : void 0,
|
|
445
452
|
tabindex: __props.disabled || props.readonly ? -1 : 0,
|
|
446
453
|
onClick: _cache[8] || (_cache[8] = ($event) => setInputFocus())
|
|
447
454
|
}
|
|
@@ -455,7 +462,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
455
462
|
"pr-2": !unref(valueSet) && !open && unref(isOutlined)
|
|
456
463
|
}
|
|
457
464
|
])
|
|
458
|
-
},
|
|
465
|
+
}, [
|
|
466
|
+
createTextVNode(toDisplayString(__props.label) + " ", 1),
|
|
467
|
+
props.required ? (openBlock(), createElementBlock("span", _hoisted_2, " ﹡ ")) : createCommentVNode("", true)
|
|
468
|
+
], 2)) : createCommentVNode("", true),
|
|
459
469
|
createElementVNode("span", {
|
|
460
470
|
class: normalizeClass([_ctx.$style.icon__wrapper, _ctx.$style.icon__prepend])
|
|
461
471
|
}, [
|
|
@@ -477,13 +487,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
477
487
|
type: "text",
|
|
478
488
|
placeholder: unref(dateFormat),
|
|
479
489
|
readonly: __props.readonly,
|
|
490
|
+
"aria-invalid": hasError,
|
|
480
491
|
onFocus: _cache[0] || (_cache[0] = ($event) => unref(handleFocus)()),
|
|
481
492
|
onSelect: _cache[1] || (_cache[1] = ($event) => unref(handleInputSelection)($event)),
|
|
482
493
|
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleInputClick($event), ["stop"])),
|
|
483
494
|
onKeydown: _cache[3] || (_cache[3] = ($event) => unref(handleKeyDown)($event)),
|
|
484
495
|
onPaste: _cache[4] || (_cache[4] = ($event) => unref(handlePaste)($event)),
|
|
485
496
|
onInput: _cache[5] || (_cache[5] = ($event) => unref(handleInput)($event))
|
|
486
|
-
}, null, 40,
|
|
497
|
+
}, null, 40, _hoisted_3)
|
|
487
498
|
], 2),
|
|
488
499
|
__props.allowEmpty && unref(valueSet) && !__props.disabled ? (openBlock(), createBlock(RuiButton, {
|
|
489
500
|
key: 1,
|