@bitrise/bitkit-v2 0.3.120 → 0.3.122
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 +69 -0
- package/dist/atoms/DatePicker/DatePicker.js +102 -0
- package/dist/components/BitkitCalendar/BitkitCalendar.d.ts +16 -0
- package/dist/components/BitkitCalendar/BitkitCalendar.js +102 -0
- package/dist/components/BitkitCalendar/Calendar.utils.d.ts +3 -0
- package/dist/components/BitkitCalendar/Calendar.utils.js +6 -0
- package/dist/components/BitkitCalendar/components/CalendarFooter.d.ts +6 -0
- package/dist/components/BitkitCalendar/components/CalendarFooter.js +27 -0
- package/dist/components/BitkitCalendar/components/CalendarMonth.d.ts +4 -0
- package/dist/components/BitkitCalendar/components/CalendarMonth.js +13 -0
- package/dist/components/BitkitCalendar/components/CalendarMonthSelect.d.ts +9 -0
- package/dist/components/BitkitCalendar/components/CalendarMonthSelect.js +46 -0
- package/dist/components/BitkitCalendar/components/CalendarNextTrigger.d.ts +2 -0
- package/dist/components/BitkitCalendar/components/CalendarNextTrigger.js +11 -0
- package/dist/components/BitkitCalendar/components/CalendarPrevTrigger.d.ts +2 -0
- package/dist/components/BitkitCalendar/components/CalendarPrevTrigger.js +11 -0
- package/dist/components/BitkitCalendar/components/CalendarSelect.d.ts +18 -0
- package/dist/components/BitkitCalendar/components/CalendarSelect.js +39 -0
- package/dist/components/BitkitCalendar/components/CalendarTrigger.d.ts +5 -0
- package/dist/components/BitkitCalendar/components/CalendarTrigger.js +18 -0
- package/dist/components/BitkitCalendar/components/CalendarYearSelect.d.ts +12 -0
- package/dist/components/BitkitCalendar/components/CalendarYearSelect.js +48 -0
- package/dist/components/BitkitNumberInput/BitkitNumberInput.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/main.js +1122 -1120
- package/dist/theme/recipes/Button.recipe.d.ts +5 -5
- package/dist/theme/recipes/Button.recipe.js +1 -1
- package/dist/theme/recipes/Spinner.recipe.js +3 -4
- package/dist/theme/recipes/common/InputAndTextarea.common.js +3 -3
- package/dist/theme/recipes/index.d.ts +5 -5
- package/dist/theme/semantic-tokens/semanticColors.js +42 -0
- package/dist/theme/slot-recipes/Avatar.recipe.d.ts +3 -3
- package/dist/theme/slot-recipes/Avatar.recipe.js +3 -3
- package/dist/theme/slot-recipes/Checkbox.recipe.js +1 -1
- package/dist/theme/slot-recipes/DatePicker.recipe.d.ts +40 -0
- package/dist/theme/slot-recipes/DatePicker.recipe.js +245 -0
- package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +39 -0
- package/dist/theme/slot-recipes/DatePickerSelect.recipe.js +57 -0
- package/dist/theme/slot-recipes/NativeSelect.recipe.d.ts +4 -4
- package/dist/theme/slot-recipes/NativeSelect.recipe.js +2 -2
- package/dist/theme/slot-recipes/NumberInput.recipe.d.ts +2 -2
- package/dist/theme/slot-recipes/NumberInput.recipe.js +11 -11
- package/dist/theme/slot-recipes/RadioGroup.recipe.d.ts +1 -1
- package/dist/theme/slot-recipes/Select.recipe.d.ts +10 -10
- package/dist/theme/slot-recipes/Select.recipe.js +24 -24
- package/dist/theme/slot-recipes/Switch.recipe.d.ts +6 -6
- package/dist/theme/slot-recipes/Tabs.recipe.d.ts +2 -2
- package/dist/theme/slot-recipes/Tag.recipe.d.ts +1 -1
- package/dist/theme/slot-recipes/Tooltip.recipe.js +2 -2
- package/dist/theme/slot-recipes/index.d.ts +106 -29
- package/dist/theme/slot-recipes/index.js +34 -30
- package/dist/theme/themeUtils.d.ts +6 -1
- package/dist/theme/themeUtils.js +12 -15
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DatePicker as ArkDatePicker } from '@ark-ui/react/date-picker';
|
|
2
|
+
import { HTMLChakraProps, UnstyledProp } from '@chakra-ui/react/styled-system';
|
|
3
|
+
declare const useStyles: () => Record<string, import('@chakra-ui/react').SystemStyleObject>;
|
|
4
|
+
export interface DatePickerRootProps extends HTMLChakraProps<'div', ArkDatePicker.RootProps>, UnstyledProp {
|
|
5
|
+
}
|
|
6
|
+
export declare const DatePickerRoot: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export interface DatePickerControlProps extends HTMLChakraProps<'div', ArkDatePicker.ControlProps>, UnstyledProp {
|
|
8
|
+
}
|
|
9
|
+
export declare const DatePickerControl: import('react').ForwardRefExoticComponent<DatePickerControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export interface DatePickerPositionerProps extends HTMLChakraProps<'div', ArkDatePicker.PositionerProps>, UnstyledProp {
|
|
11
|
+
}
|
|
12
|
+
export declare const DatePickerPositioner: import('react').ForwardRefExoticComponent<DatePickerPositionerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export interface DatePickerContentProps extends HTMLChakraProps<'div', ArkDatePicker.ContentProps>, UnstyledProp {
|
|
14
|
+
}
|
|
15
|
+
export declare const DatePickerContent: import('react').ForwardRefExoticComponent<DatePickerContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export interface DatePickerMonthsProps extends HTMLChakraProps<'div'>, UnstyledProp {
|
|
17
|
+
}
|
|
18
|
+
export declare const DatePickerMonths: import('react').ForwardRefExoticComponent<DatePickerMonthsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export interface DatePickerViewProps extends HTMLChakraProps<'div', ArkDatePicker.ViewProps>, UnstyledProp {
|
|
20
|
+
}
|
|
21
|
+
export declare const DatePickerView: import('react').ForwardRefExoticComponent<DatePickerViewProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export interface DatePickerViewControlProps extends HTMLChakraProps<'div', ArkDatePicker.ViewControlProps>, UnstyledProp {
|
|
23
|
+
}
|
|
24
|
+
export declare const DatePickerViewControl: import('react').ForwardRefExoticComponent<DatePickerViewControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export interface DatePickerTableProps extends HTMLChakraProps<'table', ArkDatePicker.TableProps>, UnstyledProp {
|
|
26
|
+
}
|
|
27
|
+
export declare const DatePickerTable: import('react').ForwardRefExoticComponent<DatePickerTableProps & import('react').RefAttributes<HTMLTableElement>>;
|
|
28
|
+
export interface DatePickerTableHeadProps extends HTMLChakraProps<'thead', ArkDatePicker.TableHeadProps>, UnstyledProp {
|
|
29
|
+
}
|
|
30
|
+
export declare const DatePickerTableHead: import('react').ForwardRefExoticComponent<DatePickerTableHeadProps & import('react').RefAttributes<HTMLTableSectionElement>>;
|
|
31
|
+
export interface DatePickerTableBodyProps extends HTMLChakraProps<'tbody', ArkDatePicker.TableBodyProps>, UnstyledProp {
|
|
32
|
+
}
|
|
33
|
+
export declare const DatePickerTableBody: import('react').ForwardRefExoticComponent<DatePickerTableBodyProps & import('react').RefAttributes<HTMLTableSectionElement>>;
|
|
34
|
+
export interface DatePickerTableRowProps extends HTMLChakraProps<'tr', ArkDatePicker.TableRowProps>, UnstyledProp {
|
|
35
|
+
}
|
|
36
|
+
export declare const DatePickerTableRow: import('react').ForwardRefExoticComponent<DatePickerTableRowProps & import('react').RefAttributes<HTMLTableRowElement>>;
|
|
37
|
+
export interface DatePickerTableHeaderProps extends HTMLChakraProps<'th', ArkDatePicker.TableHeaderProps>, UnstyledProp {
|
|
38
|
+
}
|
|
39
|
+
export declare const DatePickerTableHeader: import('react').ForwardRefExoticComponent<DatePickerTableHeaderProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
40
|
+
export interface DatePickerTableCellProps extends HTMLChakraProps<'td', ArkDatePicker.TableCellProps>, UnstyledProp {
|
|
41
|
+
}
|
|
42
|
+
export declare const DatePickerTableCell: import('react').ForwardRefExoticComponent<DatePickerTableCellProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
43
|
+
export interface DatePickerTableCellTriggerProps extends HTMLChakraProps<'span', ArkDatePicker.TableCellTriggerProps>, UnstyledProp {
|
|
44
|
+
}
|
|
45
|
+
export declare const DatePickerTableCellTrigger: import('react').ForwardRefExoticComponent<DatePickerTableCellTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
46
|
+
export declare const DatePickerContext: (props: ArkDatePicker.ContextProps) => import('react').ReactNode;
|
|
47
|
+
export interface DatePickerProps extends DatePickerRootProps {
|
|
48
|
+
showOutsideDays?: boolean;
|
|
49
|
+
variant: 'desktop' | 'mobile';
|
|
50
|
+
}
|
|
51
|
+
export declare const DatePicker: {
|
|
52
|
+
Root: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
53
|
+
Control: import('react').ForwardRefExoticComponent<DatePickerControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
54
|
+
Positioner: import('react').ForwardRefExoticComponent<DatePickerPositionerProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
55
|
+
Content: import('react').ForwardRefExoticComponent<DatePickerContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
56
|
+
Months: import('react').ForwardRefExoticComponent<DatePickerMonthsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
57
|
+
View: import('react').ForwardRefExoticComponent<DatePickerViewProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
58
|
+
ViewControl: import('react').ForwardRefExoticComponent<DatePickerViewControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
59
|
+
Table: import('react').ForwardRefExoticComponent<DatePickerTableProps & import('react').RefAttributes<HTMLTableElement>>;
|
|
60
|
+
TableHead: import('react').ForwardRefExoticComponent<DatePickerTableHeadProps & import('react').RefAttributes<HTMLTableSectionElement>>;
|
|
61
|
+
TableBody: import('react').ForwardRefExoticComponent<DatePickerTableBodyProps & import('react').RefAttributes<HTMLTableSectionElement>>;
|
|
62
|
+
TableRow: import('react').ForwardRefExoticComponent<DatePickerTableRowProps & import('react').RefAttributes<HTMLTableRowElement>>;
|
|
63
|
+
TableHeader: import('react').ForwardRefExoticComponent<DatePickerTableHeaderProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
64
|
+
TableCell: import('react').ForwardRefExoticComponent<DatePickerTableCellProps & import('react').RefAttributes<HTMLTableCellElement>>;
|
|
65
|
+
TableCellTrigger: import('react').ForwardRefExoticComponent<DatePickerTableCellTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
66
|
+
};
|
|
67
|
+
export { useStyles as useCalendarStyles };
|
|
68
|
+
export type { DatePickerOpenChangeDetails, DatePickerValueChangeDetails } from '@ark-ui/react/date-picker';
|
|
69
|
+
export { useDatePickerContext } from '@ark-ui/react/date-picker';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { DatePicker as e } from "@ark-ui/react/date-picker";
|
|
2
|
+
import { useDatePickerContext as x } from "@ark-ui/react/date-picker";
|
|
3
|
+
import { createSlotRecipeContext as r } from "@chakra-ui/react/styled-system";
|
|
4
|
+
const { withProvider: o, withContext: t, useStyles: u } = r({ key: "datePicker" }), a = o(
|
|
5
|
+
t(e.Root, "root", {
|
|
6
|
+
forwardAsChild: !0
|
|
7
|
+
}),
|
|
8
|
+
"root"
|
|
9
|
+
), l = t(e.Control, "control", {
|
|
10
|
+
forwardAsChild: !0
|
|
11
|
+
}), i = t(
|
|
12
|
+
e.Positioner,
|
|
13
|
+
"positioner",
|
|
14
|
+
{
|
|
15
|
+
forwardAsChild: !0
|
|
16
|
+
}
|
|
17
|
+
), n = t(e.Content, "content", {
|
|
18
|
+
forwardAsChild: !0
|
|
19
|
+
}), s = t("div", "months", {
|
|
20
|
+
forwardAsChild: !0
|
|
21
|
+
}), d = t(e.View, "view", {
|
|
22
|
+
forwardAsChild: !0
|
|
23
|
+
}), c = t(
|
|
24
|
+
e.ViewControl,
|
|
25
|
+
"viewControl",
|
|
26
|
+
{
|
|
27
|
+
forwardAsChild: !0
|
|
28
|
+
}
|
|
29
|
+
), C = t(e.Table, "table", {
|
|
30
|
+
forwardAsChild: !0
|
|
31
|
+
}), b = t(
|
|
32
|
+
e.TableHead,
|
|
33
|
+
"tableHead",
|
|
34
|
+
{
|
|
35
|
+
forwardAsChild: !0
|
|
36
|
+
}
|
|
37
|
+
), w = t(
|
|
38
|
+
e.TableBody,
|
|
39
|
+
"tableBody",
|
|
40
|
+
{
|
|
41
|
+
forwardAsChild: !0
|
|
42
|
+
}
|
|
43
|
+
), T = t(
|
|
44
|
+
e.TableRow,
|
|
45
|
+
"tableRow",
|
|
46
|
+
{
|
|
47
|
+
forwardAsChild: !0
|
|
48
|
+
}
|
|
49
|
+
), P = t(
|
|
50
|
+
e.TableHeader,
|
|
51
|
+
"tableHeader",
|
|
52
|
+
{
|
|
53
|
+
forwardAsChild: !0
|
|
54
|
+
}
|
|
55
|
+
), k = t(
|
|
56
|
+
e.TableCell,
|
|
57
|
+
"tableCell",
|
|
58
|
+
{
|
|
59
|
+
forwardAsChild: !0
|
|
60
|
+
}
|
|
61
|
+
), h = t(
|
|
62
|
+
e.TableCellTrigger,
|
|
63
|
+
"tableCellTrigger",
|
|
64
|
+
{
|
|
65
|
+
forwardAsChild: !0
|
|
66
|
+
}
|
|
67
|
+
), A = e.Context, g = {
|
|
68
|
+
Root: a,
|
|
69
|
+
Control: l,
|
|
70
|
+
Positioner: i,
|
|
71
|
+
Content: n,
|
|
72
|
+
Months: s,
|
|
73
|
+
View: d,
|
|
74
|
+
ViewControl: c,
|
|
75
|
+
Table: C,
|
|
76
|
+
TableHead: b,
|
|
77
|
+
TableBody: w,
|
|
78
|
+
TableRow: T,
|
|
79
|
+
TableHeader: P,
|
|
80
|
+
TableCell: k,
|
|
81
|
+
TableCellTrigger: h
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
g as DatePicker,
|
|
85
|
+
n as DatePickerContent,
|
|
86
|
+
A as DatePickerContext,
|
|
87
|
+
l as DatePickerControl,
|
|
88
|
+
s as DatePickerMonths,
|
|
89
|
+
i as DatePickerPositioner,
|
|
90
|
+
a as DatePickerRoot,
|
|
91
|
+
C as DatePickerTable,
|
|
92
|
+
w as DatePickerTableBody,
|
|
93
|
+
k as DatePickerTableCell,
|
|
94
|
+
h as DatePickerTableCellTrigger,
|
|
95
|
+
b as DatePickerTableHead,
|
|
96
|
+
P as DatePickerTableHeader,
|
|
97
|
+
T as DatePickerTableRow,
|
|
98
|
+
d as DatePickerView,
|
|
99
|
+
c as DatePickerViewControl,
|
|
100
|
+
u as useCalendarStyles,
|
|
101
|
+
x as useDatePickerContext
|
|
102
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface BitkitCalendarProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
defaultValue?: Date | Date[] | null;
|
|
5
|
+
layout?: '1-month' | '2-month';
|
|
6
|
+
max?: Date;
|
|
7
|
+
min?: Date;
|
|
8
|
+
mode?: 'day' | 'range';
|
|
9
|
+
onValueChange?: (value: Date[] | null) => void;
|
|
10
|
+
showOutsideDays?: boolean;
|
|
11
|
+
showSelectedDate?: boolean;
|
|
12
|
+
value?: Date[] | null;
|
|
13
|
+
variant?: 'desktop' | 'mobile';
|
|
14
|
+
}
|
|
15
|
+
declare const BitkitCalendar: import('react').ForwardRefExoticComponent<BitkitCalendarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default BitkitCalendar;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Box as h } from "@chakra-ui/react/box";
|
|
3
|
+
import { Portal as S } from "@chakra-ui/react/portal";
|
|
4
|
+
import { forwardRef as j, useMemo as x, useRef as N, useEffect as A } from "react";
|
|
5
|
+
import { DatePicker as a } from "../../atoms/DatePicker/DatePicker.js";
|
|
6
|
+
import { dateToCalendarDate as d, calendarDateToDate as E } from "./Calendar.utils.js";
|
|
7
|
+
import F from "./components/CalendarFooter.js";
|
|
8
|
+
import v from "./components/CalendarMonth.js";
|
|
9
|
+
import D from "./components/CalendarMonthSelect.js";
|
|
10
|
+
import w from "./components/CalendarNextTrigger.js";
|
|
11
|
+
import W from "./components/CalendarPrevTrigger.js";
|
|
12
|
+
import Y from "./components/CalendarTrigger.js";
|
|
13
|
+
import V from "./components/CalendarYearSelect.js";
|
|
14
|
+
import { useDatePickerContext as b } from "@ark-ui/react/date-picker";
|
|
15
|
+
const q = ({
|
|
16
|
+
layout: n,
|
|
17
|
+
max: i,
|
|
18
|
+
min: o,
|
|
19
|
+
mode: t,
|
|
20
|
+
showSelectedDate: s
|
|
21
|
+
}) => {
|
|
22
|
+
const m = b(), l = N(t);
|
|
23
|
+
return A(() => {
|
|
24
|
+
l.current !== t && (m.clearValue(), l.current = t);
|
|
25
|
+
}, [t]), /* @__PURE__ */ r(a.Content, { children: [
|
|
26
|
+
/* @__PURE__ */ r(a.View, { view: "day", children: [
|
|
27
|
+
/* @__PURE__ */ r(a.ViewControl, { children: [
|
|
28
|
+
/* @__PURE__ */ r(h, { display: "flex", alignItems: "center", gap: "12", children: [
|
|
29
|
+
/* @__PURE__ */ e(W, {}),
|
|
30
|
+
/* @__PURE__ */ r(h, { display: "flex", alignItems: "center", children: [
|
|
31
|
+
/* @__PURE__ */ e(D, { offset: 0, layout: n, max: i, min: o }),
|
|
32
|
+
/* @__PURE__ */ e(V, { monthOffset: 0, max: i, min: o })
|
|
33
|
+
] }),
|
|
34
|
+
n === "1-month" && /* @__PURE__ */ e(w, {})
|
|
35
|
+
] }),
|
|
36
|
+
n === "2-month" && /* @__PURE__ */ r(h, { display: "flex", alignItems: "center", gap: "12", children: [
|
|
37
|
+
/* @__PURE__ */ e(D, { offset: 1, layout: n, max: i, min: o }),
|
|
38
|
+
/* @__PURE__ */ e(V, { monthOffset: 1, max: i, min: o }),
|
|
39
|
+
/* @__PURE__ */ e(w, {})
|
|
40
|
+
] })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ r(a.Months, { children: [
|
|
43
|
+
/* @__PURE__ */ e(v, { monthsIndex: 0 }),
|
|
44
|
+
n === "2-month" && /* @__PURE__ */ e(v, { monthsIndex: 1 })
|
|
45
|
+
] })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ e(F, { mode: t, showSelectedDate: s })
|
|
48
|
+
] });
|
|
49
|
+
}, z = j((n, i) => {
|
|
50
|
+
const {
|
|
51
|
+
children: o,
|
|
52
|
+
defaultValue: t,
|
|
53
|
+
layout: s,
|
|
54
|
+
mode: m = "range",
|
|
55
|
+
min: l,
|
|
56
|
+
max: c,
|
|
57
|
+
onValueChange: p,
|
|
58
|
+
showOutsideDays: k = !1,
|
|
59
|
+
showSelectedDate: y = !1,
|
|
60
|
+
value: M,
|
|
61
|
+
variant: O = "desktop",
|
|
62
|
+
...P
|
|
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(
|
|
64
|
+
q,
|
|
65
|
+
{
|
|
66
|
+
layout: s,
|
|
67
|
+
max: C,
|
|
68
|
+
min: u,
|
|
69
|
+
mode: m,
|
|
70
|
+
showSelectedDate: y
|
|
71
|
+
}
|
|
72
|
+
), T = k ?? s === "1-month";
|
|
73
|
+
return /* @__PURE__ */ r(
|
|
74
|
+
a.Root,
|
|
75
|
+
{
|
|
76
|
+
defaultValue: t instanceof Array ? t.map(d) : t ? [d(t)] : void 0,
|
|
77
|
+
numOfMonths: s === "2-month" ? 2 : 1,
|
|
78
|
+
ref: i,
|
|
79
|
+
inline: f,
|
|
80
|
+
min: u,
|
|
81
|
+
max: C,
|
|
82
|
+
onValueChange: p ? (B) => {
|
|
83
|
+
const R = B.value?.map(E) || null;
|
|
84
|
+
p(R);
|
|
85
|
+
} : void 0,
|
|
86
|
+
selectionMode: m === "day" ? "single" : "range",
|
|
87
|
+
showOutsideDays: T,
|
|
88
|
+
startOfWeek: 1,
|
|
89
|
+
value: I,
|
|
90
|
+
variant: O,
|
|
91
|
+
...P,
|
|
92
|
+
children: [
|
|
93
|
+
!f && /* @__PURE__ */ e(a.Control, { children: /* @__PURE__ */ e(Y, { children: o }) }),
|
|
94
|
+
f ? g : /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(a.Positioner, { children: g }) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
z.displayName = "BitkitCalendar";
|
|
100
|
+
export {
|
|
101
|
+
z as default
|
|
102
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Box as u } from "@chakra-ui/react/box";
|
|
3
|
+
import { Button as y } from "@chakra-ui/react/button";
|
|
4
|
+
import { Text as p } from "@chakra-ui/react/text";
|
|
5
|
+
import { CalendarDate as g } from "@internationalized/date";
|
|
6
|
+
import { calendarDateToDate as a } from "../Calendar.utils.js";
|
|
7
|
+
import { useDatePickerContext as D } from "@ark-ui/react/date-picker";
|
|
8
|
+
const v = ({ mode: n, showSelectedDate: l }) => {
|
|
9
|
+
const { setOpen: i, setValue: c, value: e } = D(), m = () => {
|
|
10
|
+
const t = /* @__PURE__ */ new Date(), r = new g(t.getFullYear(), t.getMonth() + 1, t.getDate());
|
|
11
|
+
c([r]), i(!1);
|
|
12
|
+
};
|
|
13
|
+
if (n === "day")
|
|
14
|
+
return /* @__PURE__ */ o(u, { display: "flex", justifyContent: "center", marginTop: "16", children: /* @__PURE__ */ o(y, { variant: "tertiary", size: "sm", onClick: m, children: "Today" }) });
|
|
15
|
+
if (e.length === 2 && l) {
|
|
16
|
+
const t = (f) => f.toLocaleDateString("en-US", {
|
|
17
|
+
month: "short",
|
|
18
|
+
day: "numeric",
|
|
19
|
+
year: "numeric"
|
|
20
|
+
}), r = a(e[0]), s = a(e[1]), d = `${t(r)} – ${t(s)}`;
|
|
21
|
+
return /* @__PURE__ */ o(p, { textAlign: "center", color: "text/secondary", marginTop: "24", textStyle: "body/lg/regular", children: d });
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
v as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { Text as c } from "@chakra-ui/react/text";
|
|
3
|
+
import { DatePickerContext as h, DatePicker as r } from "../../../atoms/DatePicker/DatePicker.js";
|
|
4
|
+
const f = ({ monthsIndex: o }) => /* @__PURE__ */ e(h, { children: (n) => {
|
|
5
|
+
const t = n.getOffset({ months: o });
|
|
6
|
+
return /* @__PURE__ */ d(r.Table, { children: [
|
|
7
|
+
/* @__PURE__ */ e(r.TableHead, { children: /* @__PURE__ */ e(r.TableRow, { children: n.weekDays.map((l, a) => /* @__PURE__ */ e(r.TableHeader, { children: l.short }, a)) }) }),
|
|
8
|
+
/* @__PURE__ */ e(r.TableBody, { children: t.weeks.map((l, a) => /* @__PURE__ */ e(r.TableRow, { children: l.map((i, s) => /* @__PURE__ */ e(r.TableCell, { value: i, visibleRange: t.visibleRange, children: /* @__PURE__ */ e(r.TableCellTrigger, { children: /* @__PURE__ */ e(c, { as: "span", children: i.day }) }) }, s)) }, a)) })
|
|
9
|
+
] });
|
|
10
|
+
} });
|
|
11
|
+
export {
|
|
12
|
+
f as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
type CalendarMonthSelectProps = {
|
|
3
|
+
offset: number;
|
|
4
|
+
layout?: '1-month' | '2-month';
|
|
5
|
+
min?: CalendarDate;
|
|
6
|
+
max?: CalendarDate;
|
|
7
|
+
};
|
|
8
|
+
declare const CalendarMonthSelect: ({ offset, layout, min, max }: CalendarMonthSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default CalendarMonthSelect;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { CalendarDate as c } from "@internationalized/date";
|
|
3
|
+
import { rem as n } from "../../../theme/themeUtils.js";
|
|
4
|
+
import M from "./CalendarSelect.js";
|
|
5
|
+
import { useDatePickerContext as y } from "@ark-ui/react/date-picker";
|
|
6
|
+
const g = [
|
|
7
|
+
{ label: "January", value: "1" },
|
|
8
|
+
{ label: "February", value: "2" },
|
|
9
|
+
{ label: "March", value: "3" },
|
|
10
|
+
{ label: "April", value: "4" },
|
|
11
|
+
{ label: "May", value: "5" },
|
|
12
|
+
{ label: "June", value: "6" },
|
|
13
|
+
{ label: "July", value: "7" },
|
|
14
|
+
{ label: "August", value: "8" },
|
|
15
|
+
{ label: "September", value: "9" },
|
|
16
|
+
{ label: "October", value: "10" },
|
|
17
|
+
{ label: "November", value: "11" },
|
|
18
|
+
{ label: "December", value: "12" }
|
|
19
|
+
], S = ({ offset: s, layout: h, min: a, max: l }) => {
|
|
20
|
+
const e = y(), o = e.getOffset({ months: s }).visibleRange.start, m = g.filter((r) => {
|
|
21
|
+
if (!a && !l) return !0;
|
|
22
|
+
const t = parseInt(r.value, 10), i = o.year, u = new c(i, t, 1), v = u.add({ months: 1 }).subtract({ days: 1 }), f = a && v.compare(a) < 0, d = l && u.compare(l) > 0;
|
|
23
|
+
return !f && !d;
|
|
24
|
+
}), b = (r) => {
|
|
25
|
+
const t = parseInt(r.value[0], 10);
|
|
26
|
+
h === "1-month" ? e.focusMonth(t) : (e.setFocusedValue(new c(1990, 1, 1)), e.setFocusedValue(o.set({ month: t }).subtract({ months: s })));
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ p(
|
|
29
|
+
M,
|
|
30
|
+
{
|
|
31
|
+
contentProps: {
|
|
32
|
+
maxHeight: n(312),
|
|
33
|
+
width: n(148)
|
|
34
|
+
},
|
|
35
|
+
controlProps: {
|
|
36
|
+
width: n(114)
|
|
37
|
+
},
|
|
38
|
+
items: m,
|
|
39
|
+
onValueChange: b,
|
|
40
|
+
value: [o.month.toString()]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
S as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton as o } from "@chakra-ui/react";
|
|
3
|
+
import e from "../../../icons/16x16/IconChevronRight16.js";
|
|
4
|
+
import { useDatePickerContext as i } from "@ark-ui/react/date-picker";
|
|
5
|
+
const s = () => {
|
|
6
|
+
const t = i();
|
|
7
|
+
return /* @__PURE__ */ r(o, { ...t.getNextTriggerProps(), color: "button/secondary/fg", size: "sm", variant: "tertiary", children: /* @__PURE__ */ r(e, {}) });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
s as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton as e } from "@chakra-ui/react";
|
|
3
|
+
import o from "../../../icons/16x16/IconChevronLeft16.js";
|
|
4
|
+
import { useDatePickerContext as n } from "@ark-ui/react/date-picker";
|
|
5
|
+
const s = () => {
|
|
6
|
+
const t = n();
|
|
7
|
+
return /* @__PURE__ */ r(e, { ...t.getPrevTriggerProps(), color: "button/secondary/fg", size: "sm", variant: "tertiary", children: /* @__PURE__ */ r(o, {}) });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
s as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SelectContentProps, SelectControlProps, SelectRootProps } from '@chakra-ui/react/select';
|
|
2
|
+
export interface BitkitSelectProps {
|
|
3
|
+
controlProps?: SelectControlProps;
|
|
4
|
+
contentProps?: SelectContentProps;
|
|
5
|
+
defaultValue?: string[];
|
|
6
|
+
items: Array<{
|
|
7
|
+
group?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}>;
|
|
11
|
+
onValueChange?: SelectRootProps['onValueChange'];
|
|
12
|
+
value?: string[];
|
|
13
|
+
}
|
|
14
|
+
declare const CalendarSelect: {
|
|
15
|
+
(props: BitkitSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default CalendarSelect;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Box as f } from "@chakra-ui/react/box";
|
|
3
|
+
import { createListCollection as h } from "@chakra-ui/react/collection";
|
|
4
|
+
import { Portal as g } from "@chakra-ui/react/portal";
|
|
5
|
+
import { Select as r } from "@chakra-ui/react/select";
|
|
6
|
+
import { useSlotRecipe as C } from "@chakra-ui/react/styled-system";
|
|
7
|
+
import S from "../../../icons/16x16/IconChevronDown16.js";
|
|
8
|
+
import x from "../../BitkitSelectMenu/BitkitSelectMenu.js";
|
|
9
|
+
const P = (i) => {
|
|
10
|
+
const { contentProps: c, controlProps: l, defaultValue: s, items: a, onValueChange: d, value: m } = i, p = h({
|
|
11
|
+
items: a,
|
|
12
|
+
groupBy: (t) => t.group || ""
|
|
13
|
+
}), o = C({ key: "datePickerSelect" })();
|
|
14
|
+
return /* @__PURE__ */ n(
|
|
15
|
+
r.Root,
|
|
16
|
+
{
|
|
17
|
+
collection: p,
|
|
18
|
+
defaultValue: s,
|
|
19
|
+
onValueChange: d,
|
|
20
|
+
size: "md",
|
|
21
|
+
value: m,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ e(r.HiddenSelect, {}),
|
|
24
|
+
/* @__PURE__ */ n(r.Control, { ...l, children: [
|
|
25
|
+
/* @__PURE__ */ e(r.Trigger, { css: o.trigger, children: /* @__PURE__ */ e(r.ValueText, {}) }),
|
|
26
|
+
/* @__PURE__ */ e(r.IndicatorGroup, { css: o.indicatorGroup, children: /* @__PURE__ */ e(r.Indicator, { css: o.indicator, children: /* @__PURE__ */ e(r.Context, { children: (t) => {
|
|
27
|
+
const u = t.open;
|
|
28
|
+
return /* @__PURE__ */ e(f, { transform: u ? "rotate(180deg)" : "rotate(0deg)", transition: "transform 0.2s ease", children: /* @__PURE__ */ e(S, {}) });
|
|
29
|
+
} }) }) })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(r.Positioner, { children: /* @__PURE__ */ e(x, { contentProps: c }) }) })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
P.displayName = "CalendarSelect";
|
|
37
|
+
export {
|
|
38
|
+
P as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isValidElement as i, cloneElement as s } from "react";
|
|
2
|
+
import { useDatePickerContext as c } from "@ark-ui/react/date-picker";
|
|
3
|
+
const m = ({ children: r }) => {
|
|
4
|
+
const e = c().getTriggerProps();
|
|
5
|
+
if (!i(r))
|
|
6
|
+
throw new Error("CalendarTrigger children must be a valid React element");
|
|
7
|
+
const o = r.props, n = {
|
|
8
|
+
...o,
|
|
9
|
+
...e,
|
|
10
|
+
onClick: (t) => {
|
|
11
|
+
e.onClick?.(t), o.onClick?.(t);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
return s(r, n);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
m as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
type CalendarYearSelectProps = {
|
|
3
|
+
min?: CalendarDate;
|
|
4
|
+
max?: CalendarDate;
|
|
5
|
+
monthOffset: number;
|
|
6
|
+
yearsRange?: {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
declare const CalendarYearSelect: ({ monthOffset, max, min, yearsRange }: CalendarYearSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default CalendarYearSelect;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as h } from "react";
|
|
3
|
+
import { rem as l } from "../../../theme/themeUtils.js";
|
|
4
|
+
import S from "./CalendarSelect.js";
|
|
5
|
+
import { useDatePickerContext as Y } from "@ark-ui/react/date-picker";
|
|
6
|
+
const M = ({ monthOffset: f, max: a, min: n, yearsRange: r }) => {
|
|
7
|
+
const s = Y(), u = s.getOffset({ months: f }).visibleRange.start, c = (o) => {
|
|
8
|
+
const e = parseInt(o.value[0], 10);
|
|
9
|
+
s.focusYear(e);
|
|
10
|
+
}, m = h(() => {
|
|
11
|
+
const o = (/* @__PURE__ */ new Date()).getFullYear();
|
|
12
|
+
let e = [];
|
|
13
|
+
if (r?.from)
|
|
14
|
+
for (let t = r.from; t <= r.to; t++)
|
|
15
|
+
e.push({
|
|
16
|
+
label: t.toString(),
|
|
17
|
+
value: t.toString()
|
|
18
|
+
});
|
|
19
|
+
else
|
|
20
|
+
e = [o - 1, o, o + 1].map((t) => ({
|
|
21
|
+
label: t.toString(),
|
|
22
|
+
value: t.toString()
|
|
23
|
+
}));
|
|
24
|
+
return n || a ? e.filter((t) => {
|
|
25
|
+
const i = parseInt(t.value, 10), p = n && i < n.year, d = a && i > a.year;
|
|
26
|
+
return !p && !d;
|
|
27
|
+
}) : e;
|
|
28
|
+
}, [r?.from, r?.to, n, a]);
|
|
29
|
+
return /* @__PURE__ */ g(
|
|
30
|
+
S,
|
|
31
|
+
{
|
|
32
|
+
contentProps: {
|
|
33
|
+
maxHeight: l(312),
|
|
34
|
+
width: l(108)
|
|
35
|
+
},
|
|
36
|
+
controlProps: {
|
|
37
|
+
width: l(77)
|
|
38
|
+
},
|
|
39
|
+
defaultValue: [(/* @__PURE__ */ new Date()).getFullYear().toString()],
|
|
40
|
+
items: m,
|
|
41
|
+
onValueChange: c,
|
|
42
|
+
value: [u.year.toString()]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
M as default
|
|
48
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { Box as
|
|
2
|
+
import { Box as x } from "@chakra-ui/react/box";
|
|
3
3
|
import { NumberInput as i } from "@chakra-ui/react/number-input";
|
|
4
4
|
import { forwardRef as b } from "react";
|
|
5
5
|
import v from "../../icons/16x16/IconErrorCircleFilled16.js";
|
|
@@ -24,9 +24,9 @@ const W = b((a, d) => {
|
|
|
24
24
|
tooltip: I,
|
|
25
25
|
warningText: l,
|
|
26
26
|
...h
|
|
27
|
-
} = a,
|
|
27
|
+
} = a, w = e === "warning" || !!l, m = e === "error" || !!t;
|
|
28
28
|
let o;
|
|
29
|
-
return m ? o = n === "lg" ? /* @__PURE__ */ r(C, { color: "icon/negative" }) : /* @__PURE__ */ r(v, { color: "icon/negative" }) :
|
|
29
|
+
return m ? o = n === "lg" ? /* @__PURE__ */ r(C, { color: "icon/negative" }) : /* @__PURE__ */ r(v, { color: "icon/negative" }) : w && (o = n === "lg" ? /* @__PURE__ */ r(N, { color: "icon/warning" }) : /* @__PURE__ */ r(B, { color: "icon/warning" })), /* @__PURE__ */ r(
|
|
30
30
|
F,
|
|
31
31
|
{
|
|
32
32
|
disabled: e === "disabled",
|
|
@@ -49,7 +49,7 @@ const W = b((a, d) => {
|
|
|
49
49
|
...f,
|
|
50
50
|
children: [
|
|
51
51
|
/* @__PURE__ */ c(i.Control, { children: [
|
|
52
|
-
o && /* @__PURE__ */ r(
|
|
52
|
+
o && /* @__PURE__ */ r(x, { paddingInline: "12", display: "flex", alignItems: "center", justifyContent: "center", children: o }),
|
|
53
53
|
/* @__PURE__ */ r(i.DecrementTrigger, { _before: o ? j : void 0, children: /* @__PURE__ */ r(y, {}) }),
|
|
54
54
|
/* @__PURE__ */ r(i.IncrementTrigger, { children: /* @__PURE__ */ r(T, {}) })
|
|
55
55
|
] }),
|
|
@@ -3,6 +3,7 @@ export { default as BitkitAlert, type BitkitAlertProps } from './BitkitAlert/Bit
|
|
|
3
3
|
export { default as BitkitAvatar, type BitkitAvatarProps } from './BitkitAvatar/BitkitAvatar';
|
|
4
4
|
export { default as BitkitBadge, type BitkitBadgeProps } from './BitkitBadge/BitkitBadge';
|
|
5
5
|
export { default as BitkitButton, type BitkitButtonProps } from './BitkitButton/BitkitButton';
|
|
6
|
+
export { default as BitkitCalendar, type BitkitCalendarProps } from './BitkitCalendar/BitkitCalendar';
|
|
6
7
|
export { default as BitkitCard } from './BitkitCard/BitkitCard';
|
|
7
8
|
export { default as BitkitCheckbox, type BitkitCheckboxProps } from './BitkitCheckbox/BitkitCheckbox';
|
|
8
9
|
export { default as BitkitCheckboxGroup, type BitkitCheckboxGroupProps, } from './BitkitCheckboxGroup/BitkitCheckboxGroup';
|