@tecsinapse/cortex-react 1.3.0-beta.0 → 1.3.0-beta.1
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/cjs/components/Calendar.js +1 -0
- package/dist/cjs/components/DateField.js +25 -0
- package/dist/cjs/components/DatePickerInput.js +48 -0
- package/dist/cjs/components/DatePickerInputBase.js +24 -0
- package/dist/cjs/components/DateRangePickerInput.js +62 -0
- package/dist/cjs/components/DateSegment.js +9 -1
- package/dist/cjs/components/RangeCalendar.js +24 -32
- package/dist/cjs/components/SearchInput.js +3 -2
- package/dist/cjs/components/Table.js +2 -2
- package/dist/cjs/components/utils.js +14 -0
- package/dist/cjs/hooks/useCalendar.js +3 -6
- package/dist/cjs/hooks/useDatePickerInput.js +31 -0
- package/dist/cjs/hooks/useDateRangePickerInput.js +33 -0
- package/dist/cjs/hooks/useRangeCalendar.js +36 -0
- package/dist/cjs/index.js +14 -4
- package/dist/cjs/service/SnackbarSonner.js +3 -2
- package/dist/cjs/styles/calendar-cell.js +3 -3
- package/dist/esm/components/Calendar.js +1 -0
- package/dist/esm/components/DateField.js +23 -0
- package/dist/esm/components/DatePickerInput.js +46 -0
- package/dist/esm/components/DatePickerInputBase.js +22 -0
- package/dist/esm/components/DateRangePickerInput.js +60 -0
- package/dist/esm/components/DateSegment.js +9 -1
- package/dist/esm/components/RangeCalendar.js +24 -32
- package/dist/esm/components/SearchInput.js +3 -2
- package/dist/esm/components/Table.js +2 -2
- package/dist/esm/components/utils.js +13 -1
- package/dist/esm/hooks/useCalendar.js +4 -7
- package/dist/esm/hooks/useDatePickerInput.js +29 -0
- package/dist/esm/hooks/useDateRangePickerInput.js +31 -0
- package/dist/esm/hooks/useRangeCalendar.js +34 -0
- package/dist/esm/index.js +7 -2
- package/dist/esm/service/SnackbarSonner.js +3 -2
- package/dist/esm/styles/calendar-cell.js +3 -3
- package/dist/types/components/Calendar.d.ts +1 -1
- package/dist/types/components/DateField.d.ts +5 -0
- package/dist/types/components/DatePickerInput.d.ts +6 -0
- package/dist/types/components/DatePickerInputBase.d.ts +8 -0
- package/dist/types/components/DateRangePickerInput.d.ts +7 -0
- package/dist/types/components/RangeCalendar.d.ts +1 -1
- package/dist/types/components/index.d.ts +3 -1
- package/dist/types/components/utils.d.ts +3 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/useCalendar.d.ts +1 -1
- package/dist/types/hooks/useDatePickerInput.d.ts +10 -0
- package/dist/types/hooks/useDateRangePickerInput.d.ts +12 -0
- package/dist/types/hooks/useRangeCalendar.d.ts +12 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/tests/DateField.test.d.ts +1 -0
- package/dist/types/tests/DatePickerInput.test.d.ts +1 -0
- package/dist/types/tests/DatePickerInputBase.test.d.ts +1 -0
- package/dist/types/tests/DateRangePickerInput.test.d.ts +1 -0
- package/dist/types/tests/RangeCalendar.test.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import 'react-aria';
|
|
4
|
+
import 'react-stately';
|
|
5
|
+
import { dateToCalendarDate } from './utils.js';
|
|
6
|
+
import { useDateRangePickerInput } from '../hooks/useDateRangePickerInput.js';
|
|
7
|
+
import { DateField } from './DateField.js';
|
|
8
|
+
import { DatePickerInputBase } from './DatePickerInputBase.js';
|
|
9
|
+
import { RangeCalendar } from './RangeCalendar.js';
|
|
10
|
+
|
|
11
|
+
const DateRangePickerInput = (props) => {
|
|
12
|
+
const { onChange, value, label, variants } = props;
|
|
13
|
+
const { endFieldProps, startFieldProps, ref, state } = useDateRangePickerInput({ value, onChange });
|
|
14
|
+
return /* @__PURE__ */ React.createElement("div", { "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React.createElement(
|
|
15
|
+
DatePickerInputBase,
|
|
16
|
+
{
|
|
17
|
+
onClickCalendar: () => state.isOpen ? state.close() : state.open(),
|
|
18
|
+
variants: {
|
|
19
|
+
...variants,
|
|
20
|
+
intent: state.isInvalid ? "error" : variants?.intent
|
|
21
|
+
},
|
|
22
|
+
label
|
|
23
|
+
},
|
|
24
|
+
/* @__PURE__ */ React.createElement("div", { ref, className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React.createElement(
|
|
25
|
+
DateField,
|
|
26
|
+
{
|
|
27
|
+
...startFieldProps,
|
|
28
|
+
value: dateToCalendarDate(value?.start),
|
|
29
|
+
onChange: (value2) => {
|
|
30
|
+
state.setDate("start", value2);
|
|
31
|
+
state.close();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
), /* @__PURE__ */ React.createElement("span", null, "-"), /* @__PURE__ */ React.createElement(
|
|
35
|
+
DateField,
|
|
36
|
+
{
|
|
37
|
+
...endFieldProps,
|
|
38
|
+
value: dateToCalendarDate(value?.end),
|
|
39
|
+
onChange: (value2) => {
|
|
40
|
+
state.setDate("end", value2);
|
|
41
|
+
state.close();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
))
|
|
45
|
+
), state.isOpen ? /* @__PURE__ */ React.createElement("div", { className: "absolute" }, /* @__PURE__ */ React.createElement(
|
|
46
|
+
RangeCalendar,
|
|
47
|
+
{
|
|
48
|
+
value,
|
|
49
|
+
onChange: (value2) => {
|
|
50
|
+
state.setDateRange({
|
|
51
|
+
start: dateToCalendarDate(value2.start),
|
|
52
|
+
end: dateToCalendarDate(value2.end)
|
|
53
|
+
});
|
|
54
|
+
state.close();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
)) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { DateRangePickerInput };
|
|
@@ -4,7 +4,15 @@ import { useDateSegment } from 'react-aria';
|
|
|
4
4
|
const DateSegment = ({ segment, state }) => {
|
|
5
5
|
const ref = React.useRef(null);
|
|
6
6
|
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
7
|
-
return /* @__PURE__ */ React.createElement(
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
...segmentProps,
|
|
11
|
+
ref,
|
|
12
|
+
className: "focus:outline-none focus:bg-secondary-light"
|
|
13
|
+
},
|
|
14
|
+
segment.text
|
|
15
|
+
);
|
|
8
16
|
};
|
|
9
17
|
|
|
10
18
|
export { DateSegment };
|
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
import { createCalendar, CalendarDate, getLocalTimeZone } from '@internationalized/date';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import 'react-aria';
|
|
4
|
+
import 'react-stately';
|
|
5
|
+
import { useRangeCalendar } from '../hooks/useRangeCalendar.js';
|
|
5
6
|
import { CalendarGrid } from './CalendarGrid.js';
|
|
6
7
|
import { CalendarHeader } from './CalendarHeader.js';
|
|
7
8
|
|
|
8
9
|
const RangeCalendar = ({ value, onChange }) => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
createCalendar,
|
|
13
|
-
defaultValue: {
|
|
14
|
-
start: new CalendarDate(
|
|
15
|
-
value.start.getFullYear(),
|
|
16
|
-
value.start.getMonth(),
|
|
17
|
-
value.start.getDate()
|
|
18
|
-
),
|
|
19
|
-
end: new CalendarDate(
|
|
20
|
-
value.end.getFullYear(),
|
|
21
|
-
value.end.getMonth(),
|
|
22
|
-
value.end.getDate()
|
|
23
|
-
)
|
|
24
|
-
},
|
|
25
|
-
onChange: (value2) => onChange({
|
|
26
|
-
start: value2.start.toDate(getLocalTimeZone()),
|
|
27
|
-
end: value2.end.toDate(getLocalTimeZone())
|
|
28
|
-
})
|
|
10
|
+
const { calendarProps, state, title, ref } = useRangeCalendar({
|
|
11
|
+
value,
|
|
12
|
+
onChange
|
|
29
13
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return /* @__PURE__ */ React.createElement("div", { ...calendarProps, className: "calendar", ref }, /* @__PURE__ */ React.createElement(
|
|
33
|
-
CalendarHeader,
|
|
14
|
+
return /* @__PURE__ */ React.createElement(
|
|
15
|
+
"div",
|
|
34
16
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
...calendarProps,
|
|
18
|
+
className: "calendar",
|
|
19
|
+
ref,
|
|
20
|
+
"data-testid": "calendar-range-div"
|
|
21
|
+
},
|
|
22
|
+
/* @__PURE__ */ React.createElement(
|
|
23
|
+
CalendarHeader,
|
|
24
|
+
{
|
|
25
|
+
onClickPrevButton: () => state.focusPreviousPage(),
|
|
26
|
+
onClickNextButton: () => state.focusNextPage(),
|
|
27
|
+
title
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ React.createElement(CalendarGrid, { state })
|
|
31
|
+
);
|
|
40
32
|
};
|
|
41
33
|
|
|
42
34
|
export { RangeCalendar };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import 'clsx';
|
|
3
|
+
import '@internationalized/date';
|
|
3
4
|
import './Badge.js';
|
|
4
5
|
import './BaseSnackbar.js';
|
|
5
6
|
import 'react-icons/md';
|
|
6
7
|
import './Card.js';
|
|
7
8
|
import { Button } from './Button.js';
|
|
8
|
-
import '@internationalized/date';
|
|
9
9
|
import 'react-aria';
|
|
10
10
|
import 'react-stately';
|
|
11
11
|
import { useDebouncedState } from '../hooks/useDebouncedState.js';
|
|
12
12
|
import './CalendarCell.js';
|
|
13
13
|
import '@tecsinapse/cortex-core';
|
|
14
14
|
import 'react-icons/fa';
|
|
15
|
+
import 'react-icons/lia';
|
|
16
|
+
import { Input } from './Input.js';
|
|
15
17
|
import 'react-icons/io';
|
|
16
18
|
import './GroupButton.js';
|
|
17
19
|
import './Hint.js';
|
|
18
|
-
import { Input } from './Input.js';
|
|
19
20
|
import './Modal.js';
|
|
20
21
|
import '../styles/calendar-cell.js';
|
|
21
22
|
import '../styles/groupButton.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { tHead, tRow, tHeadCell, hr, tCell, tFoot, tRoot } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
4
|
const THead = ({
|
|
5
5
|
children,
|
|
@@ -37,6 +37,6 @@ const Table = ({
|
|
|
37
37
|
const Td = ({
|
|
38
38
|
children,
|
|
39
39
|
...rest
|
|
40
|
-
}) => /* @__PURE__ */ React.createElement("td", {
|
|
40
|
+
}) => /* @__PURE__ */ React.createElement("td", { "data-testid": "td", ...rest }, children);
|
|
41
41
|
|
|
42
42
|
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CalendarDate, getLocalTimeZone } from '@internationalized/date';
|
|
2
|
+
|
|
1
3
|
const getNameInitials = (name) => {
|
|
2
4
|
const nameSplit = name.split(" ");
|
|
3
5
|
const length = nameSplit.length;
|
|
@@ -6,5 +8,15 @@ const getNameInitials = (name) => {
|
|
|
6
8
|
}
|
|
7
9
|
return name[0];
|
|
8
10
|
};
|
|
11
|
+
const dateToCalendarDate = (value) => {
|
|
12
|
+
return new CalendarDate(
|
|
13
|
+
value?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear(),
|
|
14
|
+
value?.getMonth() ? value.getMonth() + 1 : (/* @__PURE__ */ new Date()).getMonth() + 1,
|
|
15
|
+
value?.getDate() ?? (/* @__PURE__ */ new Date()).getDate()
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
const calendarDateToDate = (value) => {
|
|
19
|
+
return value.toDate(getLocalTimeZone());
|
|
20
|
+
};
|
|
9
21
|
|
|
10
|
-
export { getNameInitials };
|
|
22
|
+
export { calendarDateToDate, dateToCalendarDate, getNameInitials };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { createCalendar
|
|
1
|
+
import { createCalendar } from '@internationalized/date';
|
|
2
2
|
import { useLocale, useCalendar as useCalendar$1 } from 'react-aria';
|
|
3
3
|
import { useCalendarState } from 'react-stately';
|
|
4
|
+
import { dateToCalendarDate, calendarDateToDate } from '../components/utils.js';
|
|
4
5
|
|
|
5
6
|
const useCalendar = ({ value, onChange }) => {
|
|
6
7
|
const { locale } = useLocale();
|
|
7
8
|
const state = useCalendarState({
|
|
8
9
|
locale,
|
|
9
10
|
createCalendar,
|
|
10
|
-
defaultValue:
|
|
11
|
-
|
|
12
|
-
value.getMonth(),
|
|
13
|
-
value.getDate()
|
|
14
|
-
),
|
|
15
|
-
onChange: (value2) => onChange(value2.toDate(getLocalTimeZone()))
|
|
11
|
+
defaultValue: dateToCalendarDate(value),
|
|
12
|
+
onChange: (value2) => onChange(calendarDateToDate(value2))
|
|
16
13
|
});
|
|
17
14
|
const { calendarProps, title } = useCalendar$1({}, state);
|
|
18
15
|
return {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { useDatePicker } from 'react-aria';
|
|
3
|
+
import { useDatePickerState } from 'react-stately';
|
|
4
|
+
import { dateToCalendarDate, calendarDateToDate } from '../components/utils.js';
|
|
5
|
+
|
|
6
|
+
const useDatePickerInput = ({
|
|
7
|
+
value,
|
|
8
|
+
onChange
|
|
9
|
+
}) => {
|
|
10
|
+
const state = useDatePickerState({
|
|
11
|
+
defaultValue: dateToCalendarDate(value),
|
|
12
|
+
onChange: (value2) => {
|
|
13
|
+
onChange(calendarDateToDate(value2));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const ref = useRef(null);
|
|
17
|
+
const { fieldProps } = useDatePicker(
|
|
18
|
+
{ "aria-label": "date-picker-field" },
|
|
19
|
+
state,
|
|
20
|
+
ref
|
|
21
|
+
);
|
|
22
|
+
return {
|
|
23
|
+
fieldProps,
|
|
24
|
+
state,
|
|
25
|
+
ref
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { useDatePickerInput };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { useDateRangePicker } from 'react-aria';
|
|
3
|
+
import { useDateRangePickerState } from 'react-stately';
|
|
4
|
+
import { dateToCalendarDate, calendarDateToDate } from '../components/utils.js';
|
|
5
|
+
|
|
6
|
+
const useDateRangePickerInput = ({
|
|
7
|
+
value,
|
|
8
|
+
onChange
|
|
9
|
+
}) => {
|
|
10
|
+
const state = useDateRangePickerState({
|
|
11
|
+
defaultValue: {
|
|
12
|
+
start: dateToCalendarDate(value?.start),
|
|
13
|
+
end: dateToCalendarDate(value?.end)
|
|
14
|
+
},
|
|
15
|
+
onChange: (value2) => {
|
|
16
|
+
onChange({
|
|
17
|
+
start: calendarDateToDate(value2.start),
|
|
18
|
+
end: calendarDateToDate(value2.end)
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const ref = useRef(null);
|
|
23
|
+
const { startFieldProps, endFieldProps } = useDateRangePicker(
|
|
24
|
+
{ "aria-label": "date-range-picker-field" },
|
|
25
|
+
state,
|
|
26
|
+
ref
|
|
27
|
+
);
|
|
28
|
+
return { startFieldProps, endFieldProps, state, ref };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { useDateRangePickerInput };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createCalendar } from '@internationalized/date';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { useLocale, useRangeCalendar as useRangeCalendar$1 } from 'react-aria';
|
|
4
|
+
import { useRangeCalendarState } from 'react-stately';
|
|
5
|
+
import { dateToCalendarDate, calendarDateToDate } from '../components/utils.js';
|
|
6
|
+
|
|
7
|
+
const useRangeCalendar = ({
|
|
8
|
+
value,
|
|
9
|
+
onChange
|
|
10
|
+
}) => {
|
|
11
|
+
const { locale } = useLocale();
|
|
12
|
+
const state = useRangeCalendarState({
|
|
13
|
+
locale,
|
|
14
|
+
createCalendar,
|
|
15
|
+
defaultValue: {
|
|
16
|
+
start: dateToCalendarDate(value?.start),
|
|
17
|
+
end: dateToCalendarDate(value?.end)
|
|
18
|
+
},
|
|
19
|
+
onChange: (value2) => onChange({
|
|
20
|
+
start: calendarDateToDate(value2.start),
|
|
21
|
+
end: calendarDateToDate(value2.end)
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
const { calendarProps, title } = useRangeCalendar$1({}, state, ref);
|
|
26
|
+
return {
|
|
27
|
+
calendarProps,
|
|
28
|
+
title,
|
|
29
|
+
state,
|
|
30
|
+
ref
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { useRangeCalendar };
|
package/dist/esm/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export { Breadcrumbs } from './components/Breadcrumbs.js';
|
|
|
5
5
|
export { Button } from './components/Button.js';
|
|
6
6
|
export { Calendar } from './components/Calendar.js';
|
|
7
7
|
export { Card } from './components/Card.js';
|
|
8
|
+
export { DatePickerInput } from './components/DatePickerInput.js';
|
|
9
|
+
export { DateRangePickerInput } from './components/DateRangePickerInput.js';
|
|
8
10
|
export { DefaultSnack } from './components/DefaultSnack.js';
|
|
9
11
|
export { Drawer } from './components/Drawer.js';
|
|
10
12
|
export { GroupButton } from './components/GroupButton.js';
|
|
@@ -18,10 +20,13 @@ export { Skeleton } from './components/Skeleton.js';
|
|
|
18
20
|
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td } from './components/Table.js';
|
|
19
21
|
export { Tag } from './components/Tag.js';
|
|
20
22
|
export { TextArea } from './components/TextArea.js';
|
|
21
|
-
export { Toggle } from './components/Toggle.js';
|
|
22
23
|
export { TimeFieldInput } from './components/TimeFieldInput.js';
|
|
23
|
-
export {
|
|
24
|
+
export { Toggle } from './components/Toggle.js';
|
|
24
25
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
25
26
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
26
27
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
28
|
+
export { useDatePickerInput } from './hooks/useDatePickerInput.js';
|
|
29
|
+
export { useDateRangePickerInput } from './hooks/useDateRangePickerInput.js';
|
|
27
30
|
export { useDebouncedState } from './hooks/useDebouncedState.js';
|
|
31
|
+
export { useRangeCalendar } from './hooks/useRangeCalendar.js';
|
|
32
|
+
export { SnackbarSonner } from './service/SnackbarSonner.js';
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { toast } from 'sonner';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import 'clsx';
|
|
4
|
+
import '@internationalized/date';
|
|
4
5
|
import '../components/Badge.js';
|
|
5
6
|
import '../components/BaseSnackbar.js';
|
|
6
7
|
import 'react-icons/md';
|
|
7
8
|
import '../components/Card.js';
|
|
8
9
|
import '../components/Button.js';
|
|
9
|
-
import '@internationalized/date';
|
|
10
10
|
import 'react-aria';
|
|
11
11
|
import 'react-stately';
|
|
12
12
|
import '../components/CalendarCell.js';
|
|
13
13
|
import '@tecsinapse/cortex-core';
|
|
14
14
|
import 'react-icons/fa';
|
|
15
|
+
import 'react-icons/lia';
|
|
16
|
+
import '../components/Input.js';
|
|
15
17
|
import { DefaultSnack } from '../components/DefaultSnack.js';
|
|
16
18
|
import '../components/GroupButton.js';
|
|
17
19
|
import '../components/Hint.js';
|
|
18
|
-
import '../components/Input.js';
|
|
19
20
|
import '../components/Modal.js';
|
|
20
21
|
import '../styles/calendar-cell.js';
|
|
21
22
|
import '../styles/groupButton.js';
|
|
@@ -2,13 +2,13 @@ import { tv } from 'tailwind-variants';
|
|
|
2
2
|
|
|
3
3
|
const calendarCell = tv({
|
|
4
4
|
slots: {
|
|
5
|
-
cell: "text-center rounded-mili text-black",
|
|
5
|
+
cell: "text-center rounded-mili text-black hover:bg-primary-light",
|
|
6
6
|
button: "flex aspect-square items-center justify-center"
|
|
7
7
|
},
|
|
8
8
|
variants: {
|
|
9
9
|
isSelected: {
|
|
10
10
|
true: {
|
|
11
|
-
cell: "bg-primary-medium text-white"
|
|
11
|
+
cell: "bg-primary-medium text-white hover:bg-primary-medium"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
isSelectionStart: {
|
|
@@ -28,7 +28,7 @@ const calendarCell = tv({
|
|
|
28
28
|
},
|
|
29
29
|
isOutsideVisibleRange: {
|
|
30
30
|
true: {
|
|
31
|
-
cell: "text-secondary-light cursor-default",
|
|
31
|
+
cell: "text-secondary-light cursor-default hover:bg-white-500",
|
|
32
32
|
button: "cursor-default"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputPropsBase } from './Input';
|
|
3
|
+
interface DatePickerInputBaseProps extends InputPropsBase {
|
|
4
|
+
onClickCalendar: () => void;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
}
|
|
7
|
+
export declare const DatePickerInputBase: ({ children, variants, label, onClickCalendar, }: DatePickerInputBaseProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InputPropsBase } from './Input';
|
|
2
|
+
import { DateRange } from './RangeCalendar';
|
|
3
|
+
export interface DateRangePickerInputProps extends InputPropsBase {
|
|
4
|
+
value?: DateRange;
|
|
5
|
+
onChange: (date: DateRange) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DateRangePickerInput: (props: DateRangePickerInputProps) => JSX.Element;
|
|
@@ -3,8 +3,8 @@ export type DateRange = {
|
|
|
3
3
|
end: Date;
|
|
4
4
|
};
|
|
5
5
|
interface RangeCalendarProps {
|
|
6
|
+
value?: DateRange;
|
|
6
7
|
onChange: (value: DateRange) => void;
|
|
7
|
-
value: DateRange;
|
|
8
8
|
}
|
|
9
9
|
export declare const RangeCalendar: ({ value, onChange }: RangeCalendarProps) => JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -5,6 +5,8 @@ export * from './Breadcrumbs';
|
|
|
5
5
|
export * from './Button';
|
|
6
6
|
export * from './Calendar';
|
|
7
7
|
export * from './Card';
|
|
8
|
+
export * from './DatePickerInput';
|
|
9
|
+
export * from './DateRangePickerInput';
|
|
8
10
|
export * from './DefaultSnack';
|
|
9
11
|
export * from './Drawer';
|
|
10
12
|
export * from './GroupButton';
|
|
@@ -18,5 +20,5 @@ export * from './Skeleton';
|
|
|
18
20
|
export * from './Table';
|
|
19
21
|
export * from './Tag';
|
|
20
22
|
export * from './TextArea';
|
|
21
|
-
export * from './Toggle';
|
|
22
23
|
export * from './TimeFieldInput';
|
|
24
|
+
export * from './Toggle';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface useDatePickerInputProps {
|
|
2
|
+
value?: Date;
|
|
3
|
+
onChange: (date: Date) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const useDatePickerInput: ({ value, onChange, }: useDatePickerInputProps) => {
|
|
6
|
+
fieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
|
|
7
|
+
state: import("react-stately").DatePickerState;
|
|
8
|
+
ref: import("react").MutableRefObject<null>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DateRange } from '../components';
|
|
2
|
+
interface useDateRangePickerInputProps {
|
|
3
|
+
value?: DateRange;
|
|
4
|
+
onChange: (date: DateRange) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useDateRangePickerInput: ({ value, onChange, }: useDateRangePickerInputProps) => {
|
|
7
|
+
startFieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
|
|
8
|
+
endFieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
|
|
9
|
+
state: import("react-stately").DateRangePickerState;
|
|
10
|
+
ref: import("react").MutableRefObject<null>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DateRange } from '../components';
|
|
2
|
+
interface useRangeCalendarProps {
|
|
3
|
+
value?: DateRange;
|
|
4
|
+
onChange: (value: DateRange) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useRangeCalendar: ({ value, onChange, }: useRangeCalendarProps) => {
|
|
7
|
+
calendarProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
|
|
8
|
+
title: string;
|
|
9
|
+
state: import("react-stately").RangeCalendarState;
|
|
10
|
+
ref: import("react").MutableRefObject<null>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.1",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react-dom": ">=18.0.0",
|
|
40
40
|
"tailwind": ">=3.3.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "db686bfbca61f00d03a355fbb00cfa88646b68ed"
|
|
43
43
|
}
|