@stenajs-webui/calendar 19.0.0-next.59 → 19.0.0-next.60

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/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
1
  (function(){"use strict";try{var r=document.createElement("style");r.appendChild(document.createTextNode("._calendar_1w0de_1{--swui-calendar-day-width: 40px;--swui-calendar-day-height: 38px;--swui-calendar-day-border-radius: 4px;--swui-calendar-week-number-bg-color: transparent;--swui-calendar-week-number-text-color: var(--lhds-color-ui-500);--swui-calendar-week-number-clickable-text-color: var(--lhds-color-ui-500);--swui-calendar-week-day-text-color: var(--lhds-color-ui-500);--swui-calendar-week-day-clickable-text-color: var(--lhds-color-ui-500);--swui-calendar-wrapper-selected-border: var(--swui-primary-action-color);--swui-calendar-wrapper-selected-background: var(--swui-primary-action-color);--swui-calendar-wrapper-range-border: var(--lhds-color-blue-100);--swui-calendar-wrapper-range-background: var(--lhds-color-blue-100);--swui-calendar-wrapper-today-border: var(--lhds-color-ui-200);--swui-calendar-wrapper-today-background: var(--lhds-color-ui-200);--swui-calendar-text-selected-color: #fff;--swui-calendar-text-disabled-color: var(--swui-text-disabled-color);--swui-calendar-text-in-other-month-color: var(--swui-text-disabled-color)}._calendar_1w0de_1 table{border-spacing:0 4px}._calendar_1w0de_1 span{line-height:100%}._calendar_1w0de_1 tr td:last-child{border-top-right-radius:var(--swui-calendar-day-border-radius);border-bottom-right-radius:var(--swui-calendar-day-border-radius)}._calendar_1w0de_1 tr td:nth-child(2){border-top-left-radius:var(--swui-calendar-day-border-radius);border-bottom-left-radius:var(--swui-calendar-day-border-radius)}._calendar_1w0de_1 td{padding:0;width:var(--swui-calendar-day-width);height:var(--swui-calendar-day-height)}._timePicker_1w05d_1{overflow:hidden;width:180px}._timePickerColumn_1w05d_6{overflow-y:hidden;flex:1}._timePickerColumn_1w05d_6:hover{overflow-y:scroll}")),document.head.appendChild(r)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  import { jsx as i, jsxs as E, Fragment as ht } from "react/jsx-runtime";
3
3
  import { Box as I, Text as it, Clickable as Wt, Row as R, Space as $, Spacing as me, Column as B, Indent as gt, SeparatorLine as pe, parseIntElseUndefined as Jt, useBoolean as Ht, useDelayedFalse as Yt } from "@stenajs-webui/core";
4
- import { FlatButton as x, PrimaryButton as dt, stenaAngleLeft as Ot, stenaAngleRight as $t, stenaArrowLeft as be, stenaArrowRight as Qt, stenaAngleLeftDouble as Xt, stenaAngleRightDouble as Zt, stenaCalendar as yt, Icon as Ft, stenaArrowWideRight as ke, stenaClock as vt, stenaAngleDown as Se } from "@stenajs-webui/elements";
5
- import { isAfter as et, eachDayOfInterval as Pt, isSameDay as j, endOfMonth as Vt, startOfMonth as te, min as Me, addDays as q, max as Ee, subDays as Dt, format as W, getISOWeek as Bt, getDate as Ct, startOfWeek as ee, addWeeks as Re, getMonth as tt, getWeek as ne, getYear as wt, getISODay as Ae, addHours as Te, isBefore as xe, parse as ot, addMonths as Ce, addYears as Ne, subMonths as Ie, subYears as He, setWeek as Ye, isValid as Le } from "date-fns";
4
+ import { FlatButton as x, PrimaryButton as dt, stenaAngleLeft as Ot, stenaAngleRight as $t, stenaArrowLeft as be, stenaArrowRight as Qt, stenaAngleLeftDouble as Xt, stenaAngleRightDouble as Zt, TextInputButton as ke, stenaCalendar as yt, Icon as Ft, stenaArrowWideRight as Se, stenaClock as vt, stenaAngleDown as Me } from "@stenajs-webui/elements";
5
+ import { isAfter as et, eachDayOfInterval as Pt, isSameDay as j, endOfMonth as Vt, startOfMonth as te, min as Ee, addDays as q, max as Re, subDays as Dt, format as W, getISOWeek as Bt, getDate as Ct, startOfWeek as ee, addWeeks as Ae, getMonth as tt, getWeek as ne, getYear as wt, getISODay as Te, addHours as xe, isBefore as Ce, parse as ot, addMonths as Ne, addYears as Ie, subMonths as He, subYears as Ye, setWeek as Le, isValid as Ue } from "date-fns";
6
6
  import { enGB as jt } from "date-fns/locale";
7
- import { last as Ue, startCase as re, chunk as se, range as zt, debounce as We, padStart as Oe } from "lodash";
7
+ import { last as We, startCase as re, chunk as se, range as zt, debounce as Oe, padStart as $e } from "lodash";
8
8
  import * as ce from "react";
9
9
  import { useMemo as C, useState as S, useEffect as Q, useCallback as g, useRef as J } from "react";
10
10
  import Nt from "@emotion/styled";
11
- import { TextInput as nt, TextInputButton as $e, TextInputBox as Pe } from "@stenajs-webui/forms";
11
+ import { TextInput as nt, TextInputBox as Pe } from "@stenajs-webui/forms";
12
12
  import { useTippyInstance as Be, Popover as pt } from "@stenajs-webui/tooltip";
13
13
  import { cssColor as ie } from "@stenajs-webui/theme";
14
14
  const Z = {
@@ -40,8 +40,8 @@ const Z = {
40
40
  Vt(r)
41
41
  ), ze = (t = {}, e, n, r, s) => e && n ? mt(
42
42
  t,
43
- Ee([e, Dt(r, 1)]),
44
- Me([n, q(s, 1)])
43
+ Re([e, Dt(r, 1)]),
44
+ Ee([n, q(s, 1)])
45
45
  ) : mt(t, e, n), ur = (t, e, n) => {
46
46
  const r = W(e, Z.yearAndMonth), s = Bt(e), c = Ct(e);
47
47
  return {
@@ -113,7 +113,7 @@ const Z = {
113
113
  var s;
114
114
  if (!e.days.length)
115
115
  return { ...t };
116
- const n = e.days[0].date, r = (s = Ue(e.days)) == null ? void 0 : s.date;
116
+ const n = e.days[0].date, r = (s = We(e.days)) == null ? void 0 : s.date;
117
117
  return {
118
118
  ...mt(t, n, r)
119
119
  };
@@ -138,7 +138,7 @@ const Kt = (t, e, n, r) => {
138
138
  }, Ge = (t, e, n, r = !0) => {
139
139
  const s = new Date(t, e, 1), c = ee(s, { locale: n }), d = [];
140
140
  for (let o = 0; o < 6; o++) {
141
- const l = _t(Re(c, o), n);
141
+ const l = _t(Ae(c, o), n);
142
142
  if (o > 0 && l.startMonth !== e && !r)
143
143
  return d;
144
144
  d.push(l);
@@ -156,11 +156,11 @@ const Kt = (t, e, n, r) => {
156
156
  isLastWeekOfMonth: n
157
157
  };
158
158
  }, qe = (t, e) => {
159
- const n = Ae(t);
159
+ const n = Te(t);
160
160
  return {
161
161
  date: t,
162
162
  name: W(t, "EEE", e ? { locale: e } : void 0),
163
- dateString: W(Te(t, 12), Z.fullDate),
163
+ dateString: W(xe(t, 12), Z.fullDate),
164
164
  weekNumber: ne(t, { locale: e }),
165
165
  year: wt(t),
166
166
  month: tt(t),
@@ -303,7 +303,7 @@ const Kt = (t, e, n, r) => {
303
303
  ...rt,
304
304
  width: "37px",
305
305
  height: "37px"
306
- }, en = (t, e, n) => e && xe(t, e) ? j(t, e) : n && et(t, n) ? j(t, n) : !0, nn = function({
306
+ }, en = (t, e, n) => e && Ce(t, e) ? j(t, e) : n && et(t, n) ? j(t, n) : !0, nn = function({
307
307
  dayComponent: e,
308
308
  minDate: n,
309
309
  maxDate: r,
@@ -946,17 +946,17 @@ const an = (t, e, n) => {
946
946
  }, kn = (t, e, n, r) => {
947
947
  const s = g(() => {
948
948
  var a;
949
- const l = Ce(t, (a = n != null ? n : r) != null ? a : 1);
949
+ const l = Ne(t, (a = n != null ? n : r) != null ? a : 1);
950
950
  e == null || e(l);
951
951
  }, [e, t, n, r]), c = g(() => {
952
- const l = Ne(t, 1);
952
+ const l = Ie(t, 1);
953
953
  e == null || e(l);
954
954
  }, [e, t]), d = g(() => {
955
955
  var a;
956
- const l = Ie(t, (a = n != null ? n : r) != null ? a : 1);
956
+ const l = He(t, (a = n != null ? n : r) != null ? a : 1);
957
957
  e == null || e(l);
958
958
  }, [e, t, n, r]), o = g(() => {
959
- const l = He(t, 1);
959
+ const l = Ye(t, 1);
960
960
  e == null || e(l);
961
961
  }, [e, t]);
962
962
  return {
@@ -1260,7 +1260,7 @@ const Nn = ({
1260
1260
  return;
1261
1261
  const n = t.split("-"), r = parseInt(n[1], 10), s = parseInt(n[0], 10), c = new Date();
1262
1262
  c.setFullYear(s);
1263
- const d = ee(Ye(c, r), { locale: e });
1263
+ const d = ee(Le(c, r), { locale: e });
1264
1264
  return _t(d, e);
1265
1265
  };
1266
1266
  function br(t) {
@@ -1385,7 +1385,7 @@ const kt = "bottom", he = () => {
1385
1385
  {
1386
1386
  type: "date",
1387
1387
  onFocus: m,
1388
- buttonRight: /* @__PURE__ */ i($e, { onClick: m, icon: yt }),
1388
+ buttonRight: /* @__PURE__ */ i(ke, { onClick: m, icon: yt }),
1389
1389
  value: n ? W(n, t) : "",
1390
1390
  placeholder: e,
1391
1391
  size: 9,
@@ -1508,7 +1508,7 @@ function Mr({
1508
1508
  /* @__PURE__ */ i(
1509
1509
  Ft,
1510
1510
  {
1511
- icon: ke,
1511
+ icon: Se,
1512
1512
  color: ie("--lhds-color-ui-500"),
1513
1513
  size: 14
1514
1514
  }
@@ -1564,7 +1564,7 @@ const Er = ({
1564
1564
  P && (T(W(P, n)), e && setTimeout(() => b(!p), 200));
1565
1565
  },
1566
1566
  [T, n, e, b, p]
1567
- ), O = !!o && !/^[-/\\.0-9]+$/.test(o), Y = !!o && Le(ot(o, n, new Date())), _ = !!o && o.length >= n.length && !Y || O;
1567
+ ), O = !!o && !/^[-/\\.0-9]+$/.test(o), Y = !!o && Ue(ot(o, n, new Date())), _ = !!o && o.length >= n.length && !Y || O;
1568
1568
  return /* @__PURE__ */ i(I, { width: l, children: /* @__PURE__ */ i(
1569
1569
  pt,
1570
1570
  {
@@ -1754,7 +1754,7 @@ const Er = ({
1754
1754
  disabled: v
1755
1755
  }) => {
1756
1756
  const L = J(0), H = C(
1757
- () => We((G) => {
1757
+ () => Oe((G) => {
1758
1758
  G === 0 && (K == null || K());
1759
1759
  }, 10),
1760
1760
  [K]
@@ -1800,7 +1800,7 @@ const Er = ({
1800
1800
  /* @__PURE__ */ i(gt, { num: 0.5, children: /* @__PURE__ */ i(
1801
1801
  x,
1802
1802
  {
1803
- leftIcon: Se,
1803
+ leftIcon: Me,
1804
1804
  onClick: T,
1805
1805
  disabled: v,
1806
1806
  size: "small"
@@ -1936,7 +1936,7 @@ const Er = ({
1936
1936
  children: n ? /* @__PURE__ */ i(
1937
1937
  dt,
1938
1938
  {
1939
- label: Oe(String(e), 2, "0"),
1939
+ label: $e(String(e), 2, "0"),
1940
1940
  onClick: () => t && t(e)
1941
1941
  }
1942
1942
  ) : /* @__PURE__ */ i(