@rotki/ui-library 2.9.1 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/components/accordions/accordion/RuiAccordion.vue.d.ts +3 -3
  2. package/dist/components/accordions/accordion/RuiAccordion.vue.js +87 -8
  3. package/dist/components/accordions/accordion/RuiAccordion.vue.js.map +1 -1
  4. package/dist/components/accordions/accordion/RuiAccordion.vue2.js +1 -62
  5. package/dist/components/accordions/accordion/RuiAccordion.vue2.js.map +1 -1
  6. package/dist/components/alerts/RuiAlert.vue.d.ts +3 -3
  7. package/dist/components/buttons/button/RuiButton.vue.d.ts +9 -5
  8. package/dist/components/buttons/button-group/RuiButtonGroup.vue.d.ts +9 -5
  9. package/dist/components/calendar/RuiCalendar.vue.js +12 -0
  10. package/dist/components/calendar/RuiCalendar.vue.js.map +1 -1
  11. package/dist/components/calendar/RuiCalendarMenu.vue.js +1 -1
  12. package/dist/components/calendar/RuiCalendarMenu.vue2.js +2 -2
  13. package/dist/components/calendar/RuiCalendarMenu.vue2.js.map +1 -1
  14. package/dist/components/calendar/state.js +1 -1
  15. package/dist/components/calendar/state.js.map +1 -1
  16. package/dist/components/cards/RuiCard.vue.d.ts +6 -6
  17. package/dist/components/date-time-picker/RuiDateTimePicker.vue.d.ts +3 -4
  18. package/dist/components/date-time-picker/RuiDateTimePicker.vue2.js +70 -251
  19. package/dist/components/date-time-picker/RuiDateTimePicker.vue2.js.map +1 -1
  20. package/dist/components/date-time-picker/use-date-time-selection.d.ts +38 -0
  21. package/dist/components/date-time-picker/use-date-time-selection.js +286 -0
  22. package/dist/components/date-time-picker/use-date-time-selection.js.map +1 -0
  23. package/dist/components/date-time-picker/use-keyboard-handler.d.ts +2 -0
  24. package/dist/components/date-time-picker/use-keyboard-handler.js +71 -60
  25. package/dist/components/date-time-picker/use-keyboard-handler.js.map +1 -1
  26. package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +29 -25
  27. package/dist/components/forms/auto-complete/RuiAutoComplete.vue2.js +5 -3
  28. package/dist/components/forms/auto-complete/RuiAutoComplete.vue2.js.map +1 -1
  29. package/dist/components/forms/checkbox/RuiCheckbox.vue.d.ts +2 -2
  30. package/dist/components/forms/checkbox/RuiCheckbox.vue2.js +13 -8
  31. package/dist/components/forms/checkbox/RuiCheckbox.vue2.js.map +1 -1
  32. package/dist/components/forms/radio-button/radio/RuiRadio.vue.d.ts +9 -5
  33. package/dist/components/forms/radio-button/radio/RuiRadio.vue2.js +12 -8
  34. package/dist/components/forms/radio-button/radio/RuiRadio.vue2.js.map +1 -1
  35. package/dist/components/forms/radio-button/radio-group/RuiRadioGroup.vue.d.ts +9 -5
  36. package/dist/components/forms/revealable-text-field/RuiRevealableTextField.vue.d.ts +4 -4
  37. package/dist/components/forms/select/RuiMenuSelect.vue.d.ts +29 -25
  38. package/dist/components/forms/select/RuiMenuSelect.vue2.js +4 -2
  39. package/dist/components/forms/select/RuiMenuSelect.vue2.js.map +1 -1
  40. package/dist/components/forms/slider/RuiSlider.vue2.js +14 -11
  41. package/dist/components/forms/slider/RuiSlider.vue2.js.map +1 -1
  42. package/dist/components/forms/switch/RuiSwitch.vue2.js +10 -7
  43. package/dist/components/forms/switch/RuiSwitch.vue2.js.map +1 -1
  44. package/dist/components/forms/text-area/RuiTextArea.vue.d.ts +3 -3
  45. package/dist/components/forms/text-area/RuiTextArea.vue2.js +15 -12
  46. package/dist/components/forms/text-area/RuiTextArea.vue2.js.map +1 -1
  47. package/dist/components/forms/text-field/RuiTextField.vue.d.ts +3 -3
  48. package/dist/components/forms/text-field/RuiTextField.vue2.js +13 -10
  49. package/dist/components/forms/text-field/RuiTextField.vue2.js.map +1 -1
  50. package/dist/components/icons/IconBrowser.vue.d.ts +3 -0
  51. package/dist/components/icons/LazyIcon.vue.d.ts +10 -0
  52. package/dist/components/overlays/badge/RuiBadge.vue.d.ts +3 -3
  53. package/dist/components/overlays/bottom-sheet/RuiBottomSheet.vue.d.ts +2 -2
  54. package/dist/components/overlays/dialog/RuiDialog.vue.d.ts +2 -2
  55. package/dist/components/overlays/menu/RuiMenu.vue.d.ts +2 -2
  56. package/dist/components/overlays/navigation-drawer/RuiNavigationDrawer.vue.d.ts +2 -2
  57. package/dist/components/overlays/notification/RuiNotification.vue.d.ts +2 -2
  58. package/dist/components/overlays/tooltip/RuiTooltip.vue.d.ts +2 -2
  59. package/dist/components/tables/RuiDataTable.vue.d.ts +9 -5
  60. package/dist/components/tables/RuiExpandButton.vue.d.ts +2 -2
  61. package/dist/components/tables/RuiTableHead.vue.d.ts +9 -5
  62. package/dist/components/tabs/tab/RuiTab.vue.d.ts +1 -1
  63. package/dist/components/tabs/tab-item/RuiTabItem.vue.d.ts +3 -3
  64. package/dist/components/tabs/tab-items/RuiTabItems.vue.d.ts +9 -5
  65. package/dist/components/time-picker/RuiTimePicker.vue2.js +0 -1
  66. package/dist/components/time-picker/RuiTimePicker.vue2.js.map +1 -1
  67. package/dist/composables/defaults/table.js +1 -1
  68. package/dist/composables/defaults/table.js.map +1 -1
  69. package/dist/composables/icons.js +1 -1
  70. package/dist/composables/icons.js.map +1 -1
  71. package/dist/composables/use-rui-i18n.js +1 -1
  72. package/dist/composables/use-rui-i18n.js.map +1 -1
  73. package/dist/style.css +98 -61
  74. package/dist/web-types.json +116 -72
  75. package/package.json +31 -40
  76. package/dist/components/accordions/accordion/RuiAccordion.vue3.js +0 -18
  77. package/dist/components/accordions/accordion/RuiAccordion.vue3.js.map +0 -1
@@ -7,13 +7,13 @@ export interface AccordionProps {
7
7
  }
8
8
  declare var __VLS_1: {
9
9
  open: boolean;
10
- }, __VLS_7: {};
10
+ }, __VLS_8: {};
11
11
  type __VLS_Slots = {} & {
12
12
  header?: (props: typeof __VLS_1) => any;
13
13
  } & {
14
- default?: (props: typeof __VLS_7) => any;
14
+ default?: (props: typeof __VLS_8) => 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 _sfc_main from "./RuiAccordion.vue2.js";
2
- import style0 from "./RuiAccordion.vue3.js";
3
- import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const cssModules = {
5
- "$style": style0
6
- };
7
- const RuiAccordion = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
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
- RuiAccordion as default
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,UAAU,OAA4B;AAC7C,UAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;AAC9C,cAAM,eAAA;AACN,eAAA;AAAA,MACF;AAAA,IACF;;AAIE,aAAAA,UAAA,GAAAC,mBA+CM,OA/CNC,WA+CM;AAAA,QA9CJ,OAAM;AAAA,QACL,cAAY,QAAA,OAAI,SAAA;AAAA,QACjB,kBAAA;AAAA,MAAA,GACQC,KAAAA,MAAM,GAAA;AAAA,QAGNC,KAAAA,OAAO,uBADfH,mBA0BM,OAAA;AAAA;UAxBH,IAAII,MAAA,SAAA;AAAA,UACL,OAAKC,eAAA,CAAC,+FAA6F,CAC1F,QAAA,yBAAyB,QAAA,WAAA,CAAU,CAAA,CAAA;AAAA,UAC5C,MAAK;AAAA,UACL,UAAS;AAAA,UACR,iBAAe,QAAA;AAAA,UACf,iBAAeD,MAAA,SAAA;AAAA,UAChB,0BAAA;AAAA,UACC,+CAAO;UACP,WAAO,OAAA,CAAA,MAAA,OAAA,CAAA,IAAA,CAAA,WAAE,UAAU,MAAM;AAAA,QAAA;UAE1BE,mBAOM,OAAA;AAAA,YANH,8BAAe,QAAA,YAAU;AAAA,UAAA;YAE1BC,WAGE,KAAA,QAAA,UAAA,EADC,MAAM,QAAA,MAAI;AAAA,UAAA;UAGfC,YAIEC,SAAA;AAAA,YAHA,OAAKJ,eAAA,CAAC,gDAA8C,EAAA,eAC3B,QAAA,KAAA,CAAI,CAAA;AAAA,YAC7B,MAAK;AAAA,UAAA;;QAID,QAAA,QAAQ,QAAA,sBADhBL,mBAaM,OAAA;AAAA;UAXH,IAAII,MAAA,SAAA;AAAA,UACL,OAAKC,eAAA,CAAC,8CACE,QAAA,YAAY,CAAA;AAAA,UACnB,gCAAiBD,MAAA,aAAA,GAAa;AAAA,UAC/B,MAAK;AAAA,UACJ,mBAAiBA,MAAA,SAAA;AAAA,UAClB,0BAAA;AAAA,QAAA;UAEAE,mBAEM,OAAA;AAAA,qBAFG;AAAA,YAAJ,KAAI;AAAA,UAAA;YACPC,WAAuB,KAAA,QAAA,SAAA;AAAA,UAAA;;;;;;"}
@@ -1,65 +1,4 @@
1
- import { defineComponent, useCssVars, unref, ref, createElementBlock, openBlock, mergeProps, createCommentVNode, normalizeClass, createElementVNode, createVNode, renderSlot } from "vue";
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":["../../../../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\nwithDefaults(defineProps<AccordionProps>(), {\n open: false,\n eager: false,\n headerGrow: false,\n headerClass: '',\n contentClass: '',\n});\n\nconst emit = defineEmits<{\n (e: 'click'): void;\n}>();\n\nfunction click() {\n emit('click');\n}\n\nconst inner = ref<HTMLDivElement>();\n\nconst { height: innerHeight } = useElementSize(inner);\n</script>\n\n<template>\n <div\n class=\"accordion\"\n :class=\"[$style.accordion, { [$style.open]: open }]\"\n v-bind=\"$attrs\"\n >\n <div\n v-if=\"$slots.header\"\n class=\"accordion__header flex gap-2 items-center\"\n :class=\"[headerClass, { 'w-full': headerGrow }]\"\n role=\"button\"\n @click=\"click()\"\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\"\n :class=\"$style.icon\"\n name=\"lu-chevron-down\"\n />\n </div>\n <div\n v-if=\"open || eager\"\n :class=\"[contentClass, $style.accordion__content]\"\n class=\"accordion__content\"\n >\n <div\n ref=\"inner\"\n >\n <slot\n name=\"default\"\n />\n </div>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" module>\n.accordion {\n @apply flex flex-col items-start;\n\n &.open {\n .accordion {\n &__content {\n height: calc(v-bind(innerHeight) * 1px);\n }\n }\n\n .icon {\n @apply transform -rotate-180;\n }\n }\n\n &__content {\n @apply grow transition-all overflow-hidden h-0 w-full;\n }\n\n .icon {\n @apply transition-all;\n }\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","$style","$attrs","$slots","_normalizeClass","_createElementVNode","_renderSlot","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,UAAM,OAAO;AAIb,aAAS,QAAQ;AACf,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,QAAQ,IAAA;AAEd,UAAM,EAAE,QAAQ,gBAAgB,eAAe,KAAK;;AAIlD,aAAAA,UAAA,GAAAC,mBAuCM,OAvCNC,WAuCM;AAAA,QAtCJ,OAAK,CAAC,aAAW,CACRC,KAAAA,OAAO,WAAS,EAAA,CAAKA,KAAAA,OAAO,IAAI,GAAG,QAAA,KAAA,CAAI,CAAA;AAAA,MAAA,GACxCC,KAAAA,MAAM,GAAA;AAAA,QAGNC,KAAAA,OAAO,uBADfJ,mBAoBM,OAAA;AAAA;UAlBJ,OAAKK,eAAA,CAAC,6CAA2C,CACxC,QAAA,yBAAyB,QAAA,WAAA,CAAU,CAAA,CAAA;AAAA,UAC5C,MAAK;AAAA,UACJ,+CAAO,MAAA;AAAA,QAAK;UAEbC,mBAOM,OAAA;AAAA,YANH,8BAAe,QAAA,YAAU;AAAA,UAAA;YAE1BC,WAGE,KAAA,QAAA,UAAA,EADC,MAAM,QAAA,MAAI;AAAA,UAAA;UAGfC,YAIEC,SAAA;AAAA,YAHA,OAAKJ,eAAA,CAAC,2BACEH,KAAAA,OAAO,IAAI,CAAA;AAAA,YACnB,MAAK;AAAA,UAAA;;QAID,QAAA,QAAQ,QAAA,sBADhBF,mBAYM,OAAA;AAAA;UAVH,wBAAQ,QAAA,cAAcE,YAAO,kBAAkB,GAC1C,oBAAoB,CAAA;AAAA,QAAA;UAE1BI,mBAMM,OAAA;AAAA,qBALA;AAAA,YAAJ,KAAI;AAAA,UAAA;YAEJC,WAEE,KAAA,QAAA,SAAA;AAAA,UAAA;;;;;;"}
1
+ {"version":3,"file":"RuiAccordion.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -9,11 +9,11 @@ export interface Props {
9
9
  actionText?: string;
10
10
  closeable?: boolean;
11
11
  }
12
- declare var __VLS_5: {}, __VLS_7: {};
12
+ declare var __VLS_6: {}, __VLS_8: {};
13
13
  type __VLS_Slots = {} & {
14
- title?: (props: typeof __VLS_5) => any;
14
+ title?: (props: typeof __VLS_6) => any;
15
15
  } & {
16
- default?: (props: typeof __VLS_7) => any;
16
+ default?: (props: typeof __VLS_8) => any;
17
17
  };
18
18
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
19
19
  close: () => any;
@@ -14,10 +14,12 @@ export interface Props<T = undefined> {
14
14
  modelValue?: T;
15
15
  hideFocusIndicator?: boolean;
16
16
  }
17
- declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
18
- props: __VLS_PrettifyLocal<Props<T> & {
17
+ declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
18
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T> & {
19
19
  "onUpdate:model-value"?: ((value?: T | undefined) => any) | undefined;
20
- }> & import("vue").PublicProps;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
21
23
  expose: (exposed: {}) => void;
22
24
  attrs: any;
23
25
  slots: {
@@ -33,6 +35,8 @@ declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typ
33
35
  };
34
36
  declare const _default: typeof __VLS_export;
35
37
  export default _default;
36
- type __VLS_PrettifyLocal<T> = {
38
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
39
+ [K in keyof T]: T[K];
40
+ } : {
37
41
  [K in keyof T as K]: T[K];
38
- } & {};
42
+ }) & {};
@@ -10,10 +10,12 @@ export interface Props<T = undefined> {
10
10
  modelValue?: T | T[];
11
11
  disabled?: boolean;
12
12
  }
13
- declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
14
- props: __VLS_PrettifyLocal<Props<T> & {
13
+ declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
14
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T> & {
15
15
  "onUpdate:modelValue"?: ((modelValue?: T | T[] | undefined) => any) | undefined;
16
- }> & import("vue").PublicProps;
16
+ }> & (typeof globalThis extends {
17
+ __VLS_PROPS_FALLBACK: infer P;
18
+ } ? P : {});
17
19
  expose: (exposed: {}) => void;
18
20
  attrs: any;
19
21
  slots: {};
@@ -23,6 +25,8 @@ declare const __VLS_export: <T = undefined>(__VLS_props: NonNullable<Awaited<typ
23
25
  };
24
26
  declare const _default: typeof __VLS_export;
25
27
  export default _default;
26
- type __VLS_PrettifyLocal<T> = {
28
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
29
+ [K in keyof T]: T[K];
30
+ } : {
27
31
  [K in keyof T as K]: T[K];
28
- } & {};
32
+ }) & {};
@@ -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,QAA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A,IAAA,CACD;;0BAICC,mBAmBM,OAAA;AAAA,QAlBJ,OAAKC,eAAA,CAAC,gBAAc,EAAA,MACJC,MAAA,MAAA,cAAmB,QAAA,WAAA,CAAU,CAAA;AAAA,MAAA;QAE7CC,YAQE,mBAAA;AAAA,UAPQ,aAAW,WAAA;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
+ {"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,KAA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U,CAAA;AAAA,MAAA;QAE7CC,YAQE,mBAAA;AAAA,UAPQ,aAAW,WAAA;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-649d1d22"]]);
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
- selectYear(nextYear);
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
- selectYear(previousYear);
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;AAEA,aAAS,iBAAiB;AACxB,UAAI,IAAI,QAAQ,MAAM,UAAU;AAC9B,YAAI,OAAO,MAAM,SAAS,SA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C,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;AAEtC,YAAI,aAAa,CAAC,UAAU,OAAO,KAAK,YAAY,IAAI,OAAO,EAAE,aAAa;AAC9E,YAAI,aAAa,CAAC,UAA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BAAwJ,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,4 +1,4 @@
1
- const CalendarStateSymbol = Symbol.for("rui:calendar");
1
+ const CalendarStateSymbol = /* @__PURE__ */ Symbol.for("rui:calendar");
2
2
  function getDaysOfWeek(locale = "en-US", format = "narrow") {
3
3
  const daysOfWeek = [];
4
4
  for (let i = 0; i < 7; i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sources":["../../../src/components/calendar/state.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue';\n\nexport const CalendarStateSymbol: InjectionKey<RuiCalendarState> = Symbol.for('rui:calendar');\n\nexport interface RuiCalendarState {\n viewMonth: Ref<number>;\n viewYear: Ref<number>;\n selectedDate: Ref<Date | undefined>;\n maxDate: ComputedRef<Date | undefined>;\n minDate: ComputedRef<Date | undefined>;\n isDark: ComputedRef<boolean>;\n allowEmpty: boolean;\n}\n\nexport interface MonthYearSelection {\n month: number;\n year: number;\n}\n\nexport function getDaysOfWeek(locale: Intl.LocalesArgument = 'en-US', format: 'narrow' | 'short' = 'narrow'): string[] {\n const daysOfWeek: string[] = [];\n for (let i = 0; i < 7; i++) {\n const date = new Date(2021, 0, 3 + i); // Jan 3, 2021 was a Sunday\n const dayName = new Intl.DateTimeFormat(locale, { weekday: format }).format(date);\n daysOfWeek.push(format === 'narrow' ? dayName : dayName.charAt(0));\n }\n return daysOfWeek;\n}\n\nexport function getShortMonthNames(locale: Intl.LocalesArgument = 'en-US'): string[] {\n const monthNames: string[] = [];\n for (let month = 0; month < 12; month++) {\n const date = new Date(2021, month, 1);\n const monthName = new Intl.DateTimeFormat(locale, { month: 'short' }).format(date);\n monthNames.push(monthName);\n }\n return monthNames;\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsD,OAAO,IAAI,cAAc;AAiBrF,SAAS,cAAc,SAA+B,SAAS,SAA6B,UAAoB;AACrH,QAAM,aAAuB,CAAA;AAC7B,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,OAAO,IAAI,KAAK,MAAM,GAAG,IAAI,CAAC;AACpC,UAAM,UAAU,IAAI,KAAK,eAAe,QAAQ,EAAE,SAAS,OAAA,CAAQ,EAAE,OAAO,IAAI;AAChF,eAAW,KAAK,WAAW,WAAW,UAAU,QAAQ,OAAO,CAAC,CAAC;AAAA,EACnE;AACA,SAAO;AACT;AAEO,SAAS,mBAAmB,SAA+B,SAAmB;AACnF,QAAM,aAAuB,CAAA;AAC7B,WAAS,QAAQ,GAAG,QAAQ,IAAI,SAAS;AACvC,UAAM,OAAO,IAAI,KAAK,MAAM,OAAO,CAAC;AACpC,UAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,QAAA,CAAS,EAAE,OAAO,IAAI;AACjF,eAAW,KAAK,SAAS;AAAA,EAC3B;AACA,SAAO;AACT;"}
1
+ {"version":3,"file":"state.js","sources":["../../../src/components/calendar/state.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue';\n\nexport const CalendarStateSymbol: InjectionKey<RuiCalendarState> = Symbol.for('rui:calendar');\n\nexport interface RuiCalendarState {\n viewMonth: Ref<number>;\n viewYear: Ref<number>;\n selectedDate: Ref<Date | undefined>;\n maxDate: ComputedRef<Date | undefined>;\n minDate: ComputedRef<Date | undefined>;\n isDark: ComputedRef<boolean>;\n allowEmpty: boolean;\n}\n\nexport interface MonthYearSelection {\n month: number;\n year: number;\n}\n\nexport function getDaysOfWeek(locale: Intl.LocalesArgument = 'en-US', format: 'narrow' | 'short' = 'narrow'): string[] {\n const daysOfWeek: string[] = [];\n for (let i = 0; i < 7; i++) {\n const date = new Date(2021, 0, 3 + i); // Jan 3, 2021 was a Sunday\n const dayName = new Intl.DateTimeFormat(locale, { weekday: format }).format(date);\n daysOfWeek.push(format === 'narrow' ? dayName : dayName.charAt(0));\n }\n return daysOfWeek;\n}\n\nexport function getShortMonthNames(locale: Intl.LocalesArgument = 'en-US'): string[] {\n const monthNames: string[] = [];\n for (let month = 0; month < 12; month++) {\n const date = new Date(2021, month, 1);\n const monthName = new Intl.DateTimeFormat(locale, { month: 'short' }).format(date);\n monthNames.push(monthName);\n }\n return monthNames;\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsD,uBAAO,IAAI,cAAc;AAiBrF,SAAS,cAAc,SAA+B,SAAS,SAA6B,UAAoB;AACrH,QAAM,aAAuB,CAAA;AAC7B,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,OAAO,IAAI,KAAK,MAAM,GAAG,IAAI,CAAC;AACpC,UAAM,UAAU,IAAI,KAAK,eAAe,QAAQ,EAAE,SAAS,OAAA,CAAQ,EAAE,OAAO,IAAI;AAChF,eAAW,KAAK,WAAW,WAAW,UAAU,QAAQ,OAAO,CAAC,CAAC;AAAA,EACnE;AACA,SAAO;AACT;AAEO,SAAS,mBAAmB,SAA+B,SAAmB;AACnF,QAAM,aAAuB,CAAA;AAC7B,WAAS,QAAQ,GAAG,QAAQ,IAAI,SAAS;AACvC,UAAM,OAAO,IAAI,KAAK,MAAM,OAAO,CAAC;AACpC,UAAM,YAAY,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,QAAA,CAAS,EAAE,OAAO,IAAI;AACjF,eAAW,KAAK,SAAS;AAAA,EAC3B;AACA,SAAO;AACT;"}
@@ -7,21 +7,21 @@ export interface Props {
7
7
  noPadding?: boolean;
8
8
  contentClass?: string;
9
9
  }
10
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_10: {}, __VLS_13: {}, __VLS_16: {}, __VLS_18: {}, __VLS_20: {};
10
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_12: {}, __VLS_15: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {};
11
11
  type __VLS_Slots = {} & {
12
12
  image?: (props: typeof __VLS_1) => any;
13
13
  } & {
14
14
  'custom-header'?: (props: typeof __VLS_3) => any;
15
15
  } & {
16
- prepend?: (props: typeof __VLS_10) => any;
16
+ prepend?: (props: typeof __VLS_12) => any;
17
17
  } & {
18
- header?: (props: typeof __VLS_13) => any;
18
+ header?: (props: typeof __VLS_15) => any;
19
19
  } & {
20
- subheader?: (props: typeof __VLS_16) => any;
20
+ subheader?: (props: typeof __VLS_18) => any;
21
21
  } & {
22
- default?: (props: typeof __VLS_18) => any;
22
+ default?: (props: typeof __VLS_20) => any;
23
23
  } & {
24
- footer?: (props: typeof __VLS_20) => any;
24
+ footer?: (props: typeof __VLS_22) => any;
25
25
  };
26
26
  declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
27
27
  dense: boolean;
@@ -1,4 +1,3 @@
1
- import type { TimeAccuracy } from '../../consts/time-accuracy.js';
2
1
  type DateFormat = 'year-first' | 'month-first' | 'day-first';
3
2
  type DateTimeModelType = 'date' | 'epoch-ms' | 'epoch';
4
3
  type ModelValueType<T extends DateTimeModelType> = T extends 'date' ? Date | undefined : T extends 'epoch-ms' ? number | undefined : T extends 'epoch' ? number | undefined : Date | number | undefined;
@@ -7,7 +6,7 @@ export interface RuiDateTimePickerProps {
7
6
  maxDate?: Date | number | 'now';
8
7
  format?: DateFormat;
9
8
  type?: DateTimeModelType;
10
- accuracy?: TimeAccuracy;
9
+ accuracy?: 'minute' | 'second' | 'millisecond';
11
10
  disabled?: boolean;
12
11
  allowEmpty?: boolean;
13
12
  readonly?: boolean;
@@ -34,7 +33,7 @@ declare const props: Readonly<{}> & {
34
33
  readonly maxDate: number | Date | "now" | undefined;
35
34
  readonly minDate: number | Date | undefined;
36
35
  readonly format: DateFormat;
37
- readonly accuracy: TimeAccuracy;
36
+ readonly accuracy: "minute" | "second" | "millisecond";
38
37
  readonly errorMessages: string | string[];
39
38
  readonly successMessages: string | string[];
40
39
  readonly required: boolean;
@@ -72,7 +71,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
72
71
  maxDate: Date | number | "now";
73
72
  minDate: Date | number;
74
73
  allowEmpty: boolean;
75
- accuracy: TimeAccuracy;
74
+ accuracy: "minute" | "second" | "millisecond";
76
75
  format: DateFormat;
77
76
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
78
77
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;