@bitrise/bitkit-v2 0.3.154 → 0.3.155
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/atoms/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/BitkitCalendar/BitkitCalendar.d.ts +2 -2
- package/dist/components/BitkitCalendar/BitkitCalendar.js +52 -52
- package/dist/components/BitkitCalendar/components/CalendarFooter.d.ts +2 -2
- package/dist/components/BitkitCalendar/components/CalendarFooter.js +13 -12
- package/dist/components/BitkitCalendar/components/CalendarSelect.js +6 -6
- package/dist/theme/slot-recipes/DatePicker.recipe.d.ts +1 -1
- package/dist/theme/slot-recipes/DatePicker.recipe.js +4 -5
- package/dist/theme/slot-recipes/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -45,8 +45,8 @@ export interface DatePickerTableCellTriggerProps extends HTMLChakraProps<'span',
|
|
|
45
45
|
export declare const DatePickerTableCellTrigger: import('react').ForwardRefExoticComponent<DatePickerTableCellTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
46
46
|
export declare const DatePickerContext: (props: ArkDatePicker.ContextProps) => import('react').ReactNode;
|
|
47
47
|
export interface DatePickerProps extends DatePickerRootProps {
|
|
48
|
+
device: 'desktop' | 'mobile';
|
|
48
49
|
showOutsideDays?: boolean;
|
|
49
|
-
variant: 'desktop' | 'mobile';
|
|
50
50
|
}
|
|
51
51
|
export declare const DatePicker: {
|
|
52
52
|
Root: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -2,15 +2,15 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
export interface BitkitCalendarProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
defaultValue?: Date | Date[] | null;
|
|
5
|
+
device?: 'desktop' | 'mobile';
|
|
5
6
|
layout?: '1-month' | '2-month';
|
|
6
7
|
max?: Date;
|
|
7
8
|
min?: Date;
|
|
8
|
-
mode?: 'day' | 'range';
|
|
9
9
|
onValueChange?: (value: Date[] | null) => void;
|
|
10
|
+
selectionMode?: 'day' | 'range';
|
|
10
11
|
showOutsideDays?: boolean;
|
|
11
12
|
showSelectedDate?: boolean;
|
|
12
13
|
value?: Date[] | null;
|
|
13
|
-
variant?: 'desktop' | 'mobile';
|
|
14
14
|
}
|
|
15
15
|
declare const BitkitCalendar: import('react').ForwardRefExoticComponent<BitkitCalendarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default BitkitCalendar;
|
|
@@ -1,97 +1,97 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Box as
|
|
2
|
+
import { Box as p } from "@chakra-ui/react/box";
|
|
3
3
|
import { Portal as S } from "@chakra-ui/react/portal";
|
|
4
|
-
import { forwardRef as j, useMemo as
|
|
4
|
+
import { forwardRef as j, useMemo as v, useRef as N, useEffect as A } from "react";
|
|
5
5
|
import { DatePicker as a } from "../../atoms/DatePicker/DatePicker.js";
|
|
6
6
|
import { dateToCalendarDate as d, calendarDateToDate as E } from "./Calendar.utils.js";
|
|
7
7
|
import F from "./components/CalendarFooter.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import D from "./components/CalendarMonth.js";
|
|
9
|
+
import w from "./components/CalendarMonthSelect.js";
|
|
10
|
+
import V from "./components/CalendarNextTrigger.js";
|
|
11
11
|
import W from "./components/CalendarPrevTrigger.js";
|
|
12
12
|
import Y from "./components/CalendarTrigger.js";
|
|
13
|
-
import
|
|
13
|
+
import k from "./components/CalendarYearSelect.js";
|
|
14
14
|
import { useDatePickerContext as b } from "@ark-ui/react/date-picker";
|
|
15
15
|
const q = ({
|
|
16
16
|
layout: n,
|
|
17
17
|
max: i,
|
|
18
18
|
min: o,
|
|
19
|
-
|
|
20
|
-
showSelectedDate:
|
|
19
|
+
selectionMode: t,
|
|
20
|
+
showSelectedDate: m
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
22
|
+
const l = b(), s = N(t);
|
|
23
23
|
return A(() => {
|
|
24
|
-
|
|
24
|
+
s.current !== t && (l.clearValue(), s.current = t);
|
|
25
25
|
}, [t]), /* @__PURE__ */ r(a.Content, { children: [
|
|
26
26
|
/* @__PURE__ */ r(a.View, { view: "day", children: [
|
|
27
27
|
/* @__PURE__ */ r(a.ViewControl, { children: [
|
|
28
|
-
/* @__PURE__ */ r(
|
|
28
|
+
/* @__PURE__ */ r(p, { display: "flex", alignItems: "center", gap: "12", children: [
|
|
29
29
|
/* @__PURE__ */ e(W, {}),
|
|
30
|
-
/* @__PURE__ */ r(
|
|
31
|
-
/* @__PURE__ */ e(
|
|
32
|
-
/* @__PURE__ */ e(
|
|
30
|
+
/* @__PURE__ */ r(p, { display: "flex", alignItems: "center", children: [
|
|
31
|
+
/* @__PURE__ */ e(w, { offset: 0, layout: n, max: i, min: o }),
|
|
32
|
+
/* @__PURE__ */ e(k, { monthOffset: 0, max: i, min: o })
|
|
33
33
|
] }),
|
|
34
|
-
n === "1-month" && /* @__PURE__ */ e(
|
|
34
|
+
n === "1-month" && /* @__PURE__ */ e(V, {})
|
|
35
35
|
] }),
|
|
36
|
-
n === "2-month" && /* @__PURE__ */ r(
|
|
37
|
-
/* @__PURE__ */ e(
|
|
38
|
-
/* @__PURE__ */ e(
|
|
39
|
-
/* @__PURE__ */ e(
|
|
36
|
+
n === "2-month" && /* @__PURE__ */ r(p, { display: "flex", alignItems: "center", gap: "12", children: [
|
|
37
|
+
/* @__PURE__ */ e(w, { offset: 1, layout: n, max: i, min: o }),
|
|
38
|
+
/* @__PURE__ */ e(k, { monthOffset: 1, max: i, min: o }),
|
|
39
|
+
/* @__PURE__ */ e(V, {})
|
|
40
40
|
] })
|
|
41
41
|
] }),
|
|
42
42
|
/* @__PURE__ */ r(a.Months, { children: [
|
|
43
|
-
/* @__PURE__ */ e(
|
|
44
|
-
n === "2-month" && /* @__PURE__ */ e(
|
|
43
|
+
/* @__PURE__ */ e(D, { monthsIndex: 0 }),
|
|
44
|
+
n === "2-month" && /* @__PURE__ */ e(D, { monthsIndex: 1 })
|
|
45
45
|
] })
|
|
46
46
|
] }),
|
|
47
|
-
/* @__PURE__ */ e(F, {
|
|
47
|
+
/* @__PURE__ */ e(F, { selectionMode: t, showSelectedDate: m })
|
|
48
48
|
] });
|
|
49
49
|
}, z = j((n, i) => {
|
|
50
50
|
const {
|
|
51
51
|
children: o,
|
|
52
52
|
defaultValue: t,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
device: m = "desktop",
|
|
54
|
+
layout: l,
|
|
55
|
+
selectionMode: s = "range",
|
|
56
|
+
min: f,
|
|
56
57
|
max: c,
|
|
57
|
-
onValueChange:
|
|
58
|
-
showOutsideDays:
|
|
59
|
-
showSelectedDate:
|
|
60
|
-
value:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = n, u = x(() => l ? d(l) : void 0, [l]), C = x(() => c ? d(c) : void 0, [c]), I = M?.map(d), f = !o, g = /* @__PURE__ */ e(
|
|
58
|
+
onValueChange: u,
|
|
59
|
+
showOutsideDays: y = !1,
|
|
60
|
+
showSelectedDate: O = !1,
|
|
61
|
+
value: P,
|
|
62
|
+
...I
|
|
63
|
+
} = n, C = v(() => f ? d(f) : void 0, [f]), g = v(() => c ? d(c) : void 0, [c]), T = P?.map(d), h = !o, x = /* @__PURE__ */ e(
|
|
64
64
|
q,
|
|
65
65
|
{
|
|
66
|
-
layout:
|
|
67
|
-
max:
|
|
68
|
-
min:
|
|
69
|
-
|
|
70
|
-
showSelectedDate:
|
|
66
|
+
layout: l,
|
|
67
|
+
max: g,
|
|
68
|
+
min: C,
|
|
69
|
+
selectionMode: s,
|
|
70
|
+
showSelectedDate: O
|
|
71
71
|
}
|
|
72
|
-
),
|
|
72
|
+
), B = y ?? l === "1-month";
|
|
73
73
|
return /* @__PURE__ */ r(
|
|
74
74
|
a.Root,
|
|
75
75
|
{
|
|
76
76
|
defaultValue: t instanceof Array ? t.map(d) : t ? [d(t)] : void 0,
|
|
77
|
-
|
|
77
|
+
device: m,
|
|
78
|
+
numOfMonths: l === "2-month" ? 2 : 1,
|
|
78
79
|
ref: i,
|
|
79
|
-
inline:
|
|
80
|
-
min:
|
|
81
|
-
max:
|
|
82
|
-
onValueChange:
|
|
83
|
-
const R =
|
|
84
|
-
|
|
80
|
+
inline: h,
|
|
81
|
+
min: C,
|
|
82
|
+
max: g,
|
|
83
|
+
onValueChange: u ? (M) => {
|
|
84
|
+
const R = M.value?.map(E) || null;
|
|
85
|
+
u(R);
|
|
85
86
|
} : void 0,
|
|
86
|
-
selectionMode:
|
|
87
|
-
showOutsideDays:
|
|
87
|
+
selectionMode: s === "day" ? "single" : "range",
|
|
88
|
+
showOutsideDays: B,
|
|
88
89
|
startOfWeek: 1,
|
|
89
|
-
value:
|
|
90
|
-
|
|
91
|
-
...P,
|
|
90
|
+
value: T,
|
|
91
|
+
...I,
|
|
92
92
|
children: [
|
|
93
|
-
!
|
|
94
|
-
|
|
93
|
+
!h && /* @__PURE__ */ e(a.Control, { children: /* @__PURE__ */ e(Y, { children: o }) }),
|
|
94
|
+
h ? x : /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(a.Positioner, { children: x }) })
|
|
95
95
|
]
|
|
96
96
|
}
|
|
97
97
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type CalendarFooterProps = {
|
|
2
|
-
|
|
2
|
+
selectionMode?: 'day' | 'range';
|
|
3
3
|
showSelectedDate?: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const CalendarFooter: ({
|
|
5
|
+
declare const CalendarFooter: ({ selectionMode, showSelectedDate }: CalendarFooterProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export default CalendarFooter;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { Box as u } from "@chakra-ui/react/box";
|
|
3
3
|
import { Button as y } from "@chakra-ui/react/button";
|
|
4
|
-
import { Text as
|
|
5
|
-
import { CalendarDate as
|
|
4
|
+
import { Text as g } from "@chakra-ui/react/text";
|
|
5
|
+
import { CalendarDate as p } from "@internationalized/date";
|
|
6
6
|
import { calendarDateToDate as a } from "../Calendar.utils.js";
|
|
7
7
|
import { useDatePickerContext as D } from "@ark-ui/react/date-picker";
|
|
8
|
-
const
|
|
9
|
-
const { setOpen:
|
|
10
|
-
const t = /* @__PURE__ */ new Date(), r = new
|
|
11
|
-
|
|
8
|
+
const j = ({ selectionMode: n, showSelectedDate: i }) => {
|
|
9
|
+
const { setOpen: l, setValue: s, value: e } = D(), c = () => {
|
|
10
|
+
const t = /* @__PURE__ */ new Date(), r = new p(t.getFullYear(), t.getMonth() + 1, t.getDate());
|
|
11
|
+
s([r]), l(!1);
|
|
12
12
|
};
|
|
13
13
|
if (n === "day")
|
|
14
|
-
return /* @__PURE__ */ o(u, { display: "flex", justifyContent: "center", marginTop: "16", children: /* @__PURE__ */ o(y, { variant: "tertiary", size: "sm", onClick:
|
|
15
|
-
if (e.length === 2 &&
|
|
14
|
+
return /* @__PURE__ */ o(u, { display: "flex", justifyContent: "center", marginTop: "16", children: /* @__PURE__ */ o(y, { variant: "tertiary", size: "sm", onClick: c, children: "Today" }) });
|
|
15
|
+
if (e.length === 2 && i) {
|
|
16
16
|
const t = (f) => f.toLocaleDateString("en-US", {
|
|
17
|
+
weekday: "short",
|
|
17
18
|
month: "short",
|
|
18
|
-
day: "
|
|
19
|
+
day: "2-digit",
|
|
19
20
|
year: "numeric"
|
|
20
|
-
}), r = a(e[0]),
|
|
21
|
-
return /* @__PURE__ */ o(
|
|
21
|
+
}), r = a(e[0]), d = a(e[1]), m = `${t(r)} – ${t(d)}`;
|
|
22
|
+
return /* @__PURE__ */ o(g, { textAlign: "center", color: "text/secondary", marginTop: "24", textStyle: "body/lg/regular", children: m });
|
|
22
23
|
}
|
|
23
24
|
return null;
|
|
24
25
|
};
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
j as default
|
|
27
28
|
};
|
|
@@ -6,25 +6,25 @@ import { useSlotRecipe as f } from "@chakra-ui/react/styled-system";
|
|
|
6
6
|
import g from "../../../utilities/AssetSelectChevron.js";
|
|
7
7
|
import S from "../../BitkitSelectMenu/BitkitSelectMenu.js";
|
|
8
8
|
const C = (c) => {
|
|
9
|
-
const { contentProps: l, controlProps: n, defaultValue: s, items:
|
|
10
|
-
items:
|
|
11
|
-
groupBy: (
|
|
9
|
+
const { contentProps: l, controlProps: n, defaultValue: s, items: d, onValueChange: a, value: m } = c, o = u({
|
|
10
|
+
items: d,
|
|
11
|
+
groupBy: (p) => p.group || ""
|
|
12
12
|
}), t = f({ key: "datePickerSelect" })();
|
|
13
13
|
return /* @__PURE__ */ i(
|
|
14
14
|
r.Root,
|
|
15
15
|
{
|
|
16
16
|
collection: o,
|
|
17
17
|
defaultValue: s,
|
|
18
|
-
onValueChange:
|
|
18
|
+
onValueChange: a,
|
|
19
19
|
size: "md",
|
|
20
|
-
value:
|
|
20
|
+
value: m,
|
|
21
21
|
children: [
|
|
22
22
|
/* @__PURE__ */ e(r.HiddenSelect, {}),
|
|
23
23
|
/* @__PURE__ */ i(r.Control, { ...n, children: [
|
|
24
24
|
/* @__PURE__ */ e(r.Trigger, { css: t.trigger, children: /* @__PURE__ */ e(r.ValueText, {}) }),
|
|
25
25
|
/* @__PURE__ */ e(r.IndicatorGroup, { css: t.indicatorGroup, children: /* @__PURE__ */ e(r.Indicator, { asChild: !0, css: t.indicator, children: /* @__PURE__ */ e(g, { width: "20", height: "20" }) }) })
|
|
26
26
|
] }),
|
|
27
|
-
/* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(r.Positioner, { children: /* @__PURE__ */ e(S, { collection: o, contentProps: l }) }) })
|
|
27
|
+
/* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(r.Positioner, { children: /* @__PURE__ */ e(S, { collection: o, contentProps: l, size: "md" }) }) })
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
);
|
|
@@ -84,6 +84,7 @@ const i = a({
|
|
|
84
84
|
borderRadius: 0,
|
|
85
85
|
backgroundColor: "interactive/disabled",
|
|
86
86
|
color: "text/disabled",
|
|
87
|
+
cursor: "default",
|
|
87
88
|
"&:hover, &[data-outside-range]:hover": {
|
|
88
89
|
borderRadius: 0,
|
|
89
90
|
backgroundColor: "interactive/disabled",
|
|
@@ -91,16 +92,14 @@ const i = a({
|
|
|
91
92
|
}
|
|
92
93
|
},
|
|
93
94
|
"&[data-outside-range]": {
|
|
94
|
-
color: "text/tertiary"
|
|
95
|
-
cursor: "not-allowed"
|
|
95
|
+
color: "text/tertiary"
|
|
96
96
|
},
|
|
97
97
|
"&[data-outside-range][data-unavailable]": {
|
|
98
98
|
color: "text/disabled"
|
|
99
99
|
},
|
|
100
100
|
"&[data-outside-range][data-in-range], &[data-outside-range][data-in-range]:hover": {
|
|
101
101
|
backgroundColor: "interactive/moderate",
|
|
102
|
-
color: "interactive/bold"
|
|
103
|
-
cursor: "not-allowed"
|
|
102
|
+
color: "interactive/bold"
|
|
104
103
|
},
|
|
105
104
|
"&[data-outside-range][data-range-end]": {
|
|
106
105
|
backgroundColor: "interactive/highlight",
|
|
@@ -229,7 +228,7 @@ const i = a({
|
|
|
229
228
|
}
|
|
230
229
|
}
|
|
231
230
|
},
|
|
232
|
-
|
|
231
|
+
device: {
|
|
233
232
|
mobile: {
|
|
234
233
|
content: {
|
|
235
234
|
boxShadow: "none",
|