loon-bulma-react 2026.0.67 → 2026.0.69

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.
@@ -1,9 +1,13 @@
1
1
  import { JSDateTime } from './../../../utils/JSDateTime.class';
2
2
  import { Locale } from 'date-fns';
3
3
  import React from 'react';
4
+ import { CalendarType } from '../Props';
4
5
  type MiniViewProps = {
5
6
  /** de viewDate waarop de mini-view start (optioneel, default = vandaag) */
6
7
  viewDate?: JSDateTime | Date;
8
+ /** de geselecteerde datum (optioneel, default = undefined) */
9
+ selectedDate?: JSDateTime | Date | undefined;
10
+ selectedViewType?: CalendarType | undefined;
7
11
  /** opties voor de weergave van de view */
8
12
  options?: MiniViewOptions;
9
13
  /** callback voor een geselecteerde datum (JS Date) */
@@ -21,5 +25,5 @@ type MiniViewOptions = {
21
25
  dateFormat?: string;
22
26
  locale?: Locale;
23
27
  };
24
- export declare function MiniView({ viewDate: vd, options: opts, onDateSelected, onJSDateTimeSelected }: MiniViewProps): React.JSX.Element;
28
+ export declare function MiniView({ viewDate: vd, selectedDate, selectedViewType, options: opts, onDateSelected, onJSDateTimeSelected }: MiniViewProps): React.JSX.Element;
25
29
  export {};
package/dist/index.js CHANGED
@@ -13158,17 +13158,18 @@ var Qg = {
13158
13158
  isAfter(e, t = !1) {
13159
13159
  return t ? this._date.valueOf() >= e.valueOf() : this._date.valueOf() > e.valueOf();
13160
13160
  }
13161
- hasSame(e, t = "millisecond") {
13162
- let n = new Date(e.valueOf());
13163
- switch (t) {
13164
- case "year": return this.yr === n.getFullYear();
13165
- case "month": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1;
13166
- case "day": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate();
13167
- case "hour": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours();
13168
- case "minute": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours() && this.min === n.getMinutes();
13169
- case "second": return this.yr === n.getFullYear() && this.m === n.getMonth() + 1 && this.d === n.getDate() && this.hr === n.getHours() && this.min === n.getMinutes() && this.sec === n.getSeconds();
13170
- case "millisecond": return this.valueOf() === n.valueOf();
13171
- default: throw Error(`invalid period '${t}' for hasSame()`);
13161
+ hasSame(t, n = "millisecond") {
13162
+ let r = new Date(t.valueOf());
13163
+ switch (n) {
13164
+ case "year": return this.yr === r.getFullYear();
13165
+ case "month": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1;
13166
+ case "week": return this.yr === r.getFullYear() && this.weekNr === e.fromDate(r).weekNr;
13167
+ case "day": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate();
13168
+ case "hour": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours();
13169
+ case "minute": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours() && this.min === r.getMinutes();
13170
+ case "second": return this.yr === r.getFullYear() && this.m === r.getMonth() + 1 && this.d === r.getDate() && this.hr === r.getHours() && this.min === r.getMinutes() && this.sec === r.getSeconds();
13171
+ case "millisecond": return this.valueOf() === r.valueOf();
13172
+ default: throw Error(`invalid period '${n}' for hasSame()`);
13172
13173
  }
13173
13174
  }
13174
13175
  equals(t) {
@@ -16754,12 +16755,12 @@ var Qy = {
16754
16755
  dateFormat: "EEEE dd MMMM yyyy",
16755
16756
  locale: n_
16756
16757
  };
16757
- function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTimeSelected: i }) {
16758
- let a = t.useMemo(() => r_.now(), []), [o, s] = t.useState(e instanceof Date ? r_.fromDate(e) : e);
16758
+ function $y({ viewDate: e = r_.now(), selectedDate: n = void 0, selectedViewType: r = void 0, options: i, onDateSelected: a, onJSDateTimeSelected: o }) {
16759
+ let s = t.useMemo(() => r_.now(), []), [c, l] = t.useState(e instanceof Date ? r_.fromDate(e) : e);
16759
16760
  t.useEffect(() => {
16760
- s(e instanceof Date ? r_.fromDate(e) : e);
16761
+ l(e instanceof Date ? r_.fromDate(e) : e);
16761
16762
  }, [e]);
16762
- function c(e) {
16763
+ function u(e) {
16763
16764
  return [
16764
16765
  e.weekNr.toString(),
16765
16766
  e,
@@ -16771,21 +16772,33 @@ function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTim
16771
16772
  e.plus({ days: 6 })
16772
16773
  ];
16773
16774
  }
16774
- function l(e) {
16775
- typeof e != "string" && (r && r(e.JSDate), i && i(e));
16775
+ function d(e) {
16776
+ typeof e != "string" && (a && a(e.JSDate), o && o(e));
16776
16777
  }
16777
- let u = t.useMemo(() => ({
16778
+ let f = t.useMemo(() => ({
16778
16779
  ...Qy,
16779
- ...n
16780
- }), [n]), d = t.useMemo(() => {
16780
+ ...i
16781
+ }), [i]), p = t.useMemo(() => {
16781
16782
  let e = [""], t = r_.now().startOf("week");
16782
- for (let n = 0; n < 7; n++) e.push(t.toFormat(u.weekDayFormat)), t = t.plus({ days: 1 });
16783
+ for (let n = 0; n < 7; n++) e.push(t.toFormat(f.weekDayFormat)), t = t.plus({ days: 1 });
16783
16784
  return e;
16784
- }, [u.weekDayFormat]), f = t.useMemo(() => {
16785
- let e = o.startOf("month").startOf("week"), t = o.endOf("month").endOf("week"), n = [];
16786
- for (; e <= t;) n = [...n, ...c(e)], e = e.plus({ weeks: 1 });
16787
- return n.length < 42 && (n = [...n, ...c(e)]), n;
16788
- }, [o]);
16785
+ }, [f.weekDayFormat]), m = t.useMemo(() => {
16786
+ let e = c.startOf("month").startOf("week"), t = c.endOf("month").endOf("week"), n = [];
16787
+ for (; e <= t;) n = [...n, ...u(e)], e = e.plus({ weeks: 1 });
16788
+ return n.length < 42 && (n = [...n, ...u(e)]), n;
16789
+ }, [c]);
16790
+ console.log(n, r);
16791
+ function h(e) {
16792
+ if (!n || !r) return !1;
16793
+ let t = n instanceof Date ? r_.fromDate(n) : n;
16794
+ switch (r) {
16795
+ case "w":
16796
+ case "l": return e.hasSame(n, "week");
16797
+ case "m": return e.hasSame(n, "month");
16798
+ case "v": return Math.ceil(e.weekNr / 52 * 13) === Math.ceil(t.weekNr / 52 * 13);
16799
+ default: return e.hasSame(t, "day");
16800
+ }
16801
+ }
16789
16802
  return /* @__PURE__ */ x("div", {
16790
16803
  className: "mini-calendar",
16791
16804
  children: [/* @__PURE__ */ x("div", {
@@ -16793,31 +16806,31 @@ function $y({ viewDate: e = r_.now(), options: n, onDateSelected: r, onJSDateTim
16793
16806
  children: [
16794
16807
  /* @__PURE__ */ b("button", {
16795
16808
  className: "mini-calendar-button is-left",
16796
- onClick: () => s(o.plus({ months: -1 })),
16809
+ onClick: () => l(c.plus({ months: -1 })),
16797
16810
  children: /* @__PURE__ */ b(Fo, { icon: ws })
16798
16811
  }),
16799
16812
  /* @__PURE__ */ b("div", {
16800
16813
  className: "is-flex-grow-1 is-flex-shrink-1",
16801
- children: o.toFormat(u.monthFormat)
16814
+ children: c.toFormat(f.monthFormat)
16802
16815
  }),
16803
16816
  /* @__PURE__ */ b("button", {
16804
16817
  className: "mini-calendar-button is-right",
16805
- onClick: () => s(o.plus({ months: 1 })),
16818
+ onClick: () => l(c.plus({ months: 1 })),
16806
16819
  children: /* @__PURE__ */ b(Fo, { icon: $o })
16807
16820
  })
16808
16821
  ]
16809
16822
  }), /* @__PURE__ */ x("div", {
16810
16823
  className: "mini-calendar-grid",
16811
- children: [d.map((e) => /* @__PURE__ */ b("div", {
16824
+ children: [p.map((e) => /* @__PURE__ */ b("div", {
16812
16825
  className: "mini-calendar-col",
16813
16826
  children: e
16814
- }, e)), f.map((e) => {
16827
+ }, e)), m.map((e) => {
16815
16828
  let t = typeof e == "string" ? "mini-calendar-row" : "mini-calendar-slot";
16816
- typeof e != "string" && e.hasSame(a, "day") && (t += " is-today"), typeof e != "string" && !e.hasSame(o, "month") && (t += " is-other-month");
16817
- let n = typeof e == "string" ? e : e.toFormat(u.dayFormat), r = typeof e == "string" ? "" : e.toFormat(u.dateFormat);
16829
+ typeof e != "string" && h(e) && (t += " is-view-period"), typeof e != "string" && e.hasSame(s, "day") ? t += " is-today" : typeof e != "string" && !e.hasSame(c, "month") && (t += " is-other-month");
16830
+ let n = typeof e == "string" ? e : e.toFormat(f.dayFormat), r = typeof e == "string" ? "" : e.toFormat(f.dateFormat);
16818
16831
  return /* @__PURE__ */ b("div", {
16819
16832
  className: t,
16820
- onClick: () => l(e),
16833
+ onClick: () => d(e),
16821
16834
  children: /* @__PURE__ */ b(tf, {
16822
16835
  content: r,
16823
16836
  delay: [1, .2],
@@ -51,37 +51,59 @@ $mini-cal-border-radius: 0.75rem;
51
51
  .mini-calendar-row {
52
52
  color: dv.$info;
53
53
  font-size: x-small;
54
- margin-top: auto;
55
- margin-bottom: auto;
54
+ // margin-top: auto;
55
+ // margin-bottom: auto;
56
56
  text-align: center;
57
57
  padding: 0.25em;
58
+ padding-top: 0.75em;
59
+ text-align: center;
60
+ vertical-align: middle;
58
61
  }
62
+
63
+ // .mini-calendar-row {
64
+ // // Week-number cell can react when the first day in that row is in the selected period.
65
+ // &:has(+ .mini-calendar-slot.is-view-period) {
66
+ // font-weight: 700;
67
+ // background-color: #337eff22;
68
+ // }
69
+ // }
70
+
59
71
  .mini-calendar-slot {
60
72
  vertical-align: middle;
61
73
  text-align: center;
62
- border-radius: $mini-cal-border-radius;
63
- transition: background-color 0.1s ease-in-out;
74
+ // border-radius: $mini-cal-border-radius;
75
+ transition: color 0.1s ease-in-out;
64
76
  padding: 0.25em;
65
77
 
66
- &.is-today {
67
- color: dv.$success;
68
- font-weight: bold;
78
+ &.is-other-month {
79
+ color: dv.$text-weak;
80
+ font-weight: 200;
81
+ }
82
+
83
+ &.is-view-period {
84
+ background-color: #337eff11;
85
+
86
+ // color: dv.$info;
69
87
  &:hover {
70
88
  cursor: pointer;
71
- background-color: dv.$success;
72
- color: fn.bulmaFindColorInvert(dv.$success);
89
+ color: dv.$info;
90
+ font-weight: 700;
73
91
  }
74
92
  }
75
93
 
76
- &.is-other-month {
77
- color: dv.$text-weak;
78
- font-weight: 200;
94
+ &.is-today {
95
+ color: dv.$success;
96
+ font-weight: 700;
97
+ &:hover {
98
+ cursor: pointer;
99
+ color: default;
100
+ }
79
101
  }
80
102
 
81
103
  &:hover {
82
104
  cursor: pointer;
83
- background-color: dv.$primary;
84
- color: fn.bulmaFindColorInvert(dv.$primary);
105
+ color: dv.$info;
106
+ font-weight: 700;
85
107
  }
86
108
  }
87
109
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loon-bulma-react",
3
3
  "private": false,
4
- "version": "2026.0.67",
4
+ "version": "2026.0.69",
5
5
  "description": "Bulma &amp; React componenten voor Loon Salarissoftware",
6
6
  "type": "module",
7
7
  "license": "MIT",