@tecsinapse/cortex-react 1.3.0-beta.0 → 1.3.0-beta.2
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/Input.js +16 -16
- package/dist/cjs/components/RangeCalendar.js +24 -32
- package/dist/cjs/components/Select/GroupedOptions.js +32 -0
- package/dist/cjs/components/Select/Option.js +25 -0
- package/dist/cjs/components/Select/Options.js +29 -0
- package/dist/cjs/components/Select/Popover.js +13 -0
- package/dist/cjs/components/Select/Root.js +31 -0
- package/dist/cjs/components/Select/Trigger.js +28 -0
- package/dist/cjs/components/Select/context.js +10 -0
- package/dist/cjs/components/Select/index.js +19 -0
- 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/useOutsideClickListener.js +22 -0
- package/dist/cjs/hooks/useRangeCalendar.js +36 -0
- package/dist/cjs/index.js +33 -17
- package/dist/cjs/service/SnackbarSonner.js +10 -3
- 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/Input.js +12 -12
- package/dist/esm/components/RangeCalendar.js +24 -32
- package/dist/esm/components/Select/GroupedOptions.js +30 -0
- package/dist/esm/components/Select/Option.js +23 -0
- package/dist/esm/components/Select/Options.js +27 -0
- package/dist/esm/components/Select/Popover.js +11 -0
- package/dist/esm/components/Select/Root.js +29 -0
- package/dist/esm/components/Select/Trigger.js +26 -0
- package/dist/esm/components/Select/context.js +8 -0
- package/dist/esm/components/Select/index.js +17 -0
- 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/useOutsideClickListener.js +20 -0
- package/dist/esm/hooks/useRangeCalendar.js +34 -0
- package/dist/esm/index.js +17 -7
- package/dist/esm/service/SnackbarSonner.js +10 -3
- 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/Input.d.ts +5 -5
- package/dist/types/components/RangeCalendar.d.ts +1 -1
- package/dist/types/components/SearchInput.d.ts +3 -2
- package/dist/types/components/Select/GroupedOptions.d.ts +6 -0
- package/dist/types/components/Select/Option.d.ts +5 -0
- package/dist/types/components/Select/Options.d.ts +5 -0
- package/dist/types/components/Select/Popover.d.ts +5 -0
- package/dist/types/components/Select/Root.d.ts +8 -0
- package/dist/types/components/Select/Trigger.d.ts +5 -0
- package/dist/types/components/Select/context.d.ts +10 -0
- package/dist/types/components/Select/index.d.ts +8 -0
- package/dist/types/components/index.d.ts +5 -2
- package/dist/types/components/utils.d.ts +3 -0
- package/dist/types/hooks/index.d.ts +4 -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/useOutsideClickListener.d.ts +7 -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/dist/types/tests/useOutsideClickListener.test.d.ts +1 -0
- package/package.json +6 -4
- package/dist/cjs/components/SearchInput.js +0 -82
- package/dist/cjs/components/Select.js +0 -101
- package/dist/esm/components/SearchInput.js +0 -80
- package/dist/esm/components/Select.js +0 -96
- package/dist/types/components/Select.d.ts +0 -27
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { selectVariants } from '@tecsinapse/cortex-core';
|
|
2
|
+
import React, { useContext, useMemo } from 'react';
|
|
3
|
+
import { IoChevronDownOutline } from 'react-icons/io5';
|
|
4
|
+
import { SelectContext } from './context.js';
|
|
5
|
+
|
|
6
|
+
const { button } = selectVariants();
|
|
7
|
+
const SelectTrigger = ({ label, disabled }) => {
|
|
8
|
+
const { value, setOpen, labelExtractor, open } = useContext(SelectContext);
|
|
9
|
+
const placeholder = useMemo(
|
|
10
|
+
() => value ? labelExtractor(value) : label,
|
|
11
|
+
[label, value]
|
|
12
|
+
);
|
|
13
|
+
return /* @__PURE__ */ React.createElement(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
className: button({ disabled }),
|
|
17
|
+
onClick: () => setOpen?.(!open),
|
|
18
|
+
disabled,
|
|
19
|
+
role: "button"
|
|
20
|
+
},
|
|
21
|
+
/* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" }, placeholder),
|
|
22
|
+
/* @__PURE__ */ React.createElement(IoChevronDownOutline, null)
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { SelectTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SelectGroupedOptions } from './GroupedOptions.js';
|
|
2
|
+
import { SelectOption } from './Option.js';
|
|
3
|
+
import { SelectOptions } from './Options.js';
|
|
4
|
+
import { SelectPopover } from './Popover.js';
|
|
5
|
+
import { SelectRoot } from './Root.js';
|
|
6
|
+
import { SelectTrigger } from './Trigger.js';
|
|
7
|
+
|
|
8
|
+
const Select = {
|
|
9
|
+
Root: SelectRoot,
|
|
10
|
+
Trigger: SelectTrigger,
|
|
11
|
+
Popover: SelectPopover,
|
|
12
|
+
Options: SelectOptions,
|
|
13
|
+
GroupedOptions: SelectGroupedOptions,
|
|
14
|
+
Option: SelectOption
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Select };
|
|
@@ -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,20 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useOutsideClickListener = ({
|
|
4
|
+
ref,
|
|
5
|
+
onClickOutside
|
|
6
|
+
}) => {
|
|
7
|
+
const handleClickOutside = useCallback((event) => {
|
|
8
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
9
|
+
onClickOutside?.();
|
|
10
|
+
}
|
|
11
|
+
}, []);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
document.addEventListener("click", handleClickOutside, true);
|
|
14
|
+
return () => {
|
|
15
|
+
document.removeEventListener("click", handleClickOutside, true);
|
|
16
|
+
};
|
|
17
|
+
}, [handleClickOutside]);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { useOutsideClickListener };
|
|
@@ -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,23 +5,33 @@ 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';
|
|
11
13
|
export { Hint } from './components/Hint.js';
|
|
12
|
-
export {
|
|
14
|
+
export { Input, InputBox, InputFace, InputLeft, InputRight, InputRoot } from './components/Input.js';
|
|
13
15
|
export { Modal } from './components/Modal.js';
|
|
14
16
|
export { ProgressBar } from './components/ProgressBar.js';
|
|
15
17
|
export { RangeCalendar } from './components/RangeCalendar.js';
|
|
16
|
-
|
|
18
|
+
import 'react';
|
|
19
|
+
import 'react-icons/ai';
|
|
20
|
+
import 'react-icons/io5';
|
|
21
|
+
import 'tailwind-merge';
|
|
22
|
+
export { useCalendar } from './hooks/useCalendar.js';
|
|
23
|
+
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
24
|
+
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
25
|
+
export { useDatePickerInput } from './hooks/useDatePickerInput.js';
|
|
26
|
+
export { useDateRangePickerInput } from './hooks/useDateRangePickerInput.js';
|
|
27
|
+
export { useDebouncedState } from './hooks/useDebouncedState.js';
|
|
28
|
+
export { useOutsideClickListener } from './hooks/useOutsideClickListener.js';
|
|
29
|
+
export { useRangeCalendar } from './hooks/useRangeCalendar.js';
|
|
30
|
+
export { Select } from './components/Select/index.js';
|
|
17
31
|
export { Skeleton } from './components/Skeleton.js';
|
|
18
32
|
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td } from './components/Table.js';
|
|
19
33
|
export { Tag } from './components/Tag.js';
|
|
20
34
|
export { TextArea } from './components/TextArea.js';
|
|
21
|
-
export { Toggle } from './components/Toggle.js';
|
|
22
35
|
export { TimeFieldInput } from './components/TimeFieldInput.js';
|
|
36
|
+
export { Toggle } from './components/Toggle.js';
|
|
23
37
|
export { SnackbarSonner } from './service/SnackbarSonner.js';
|
|
24
|
-
export { useCalendar } from './hooks/useCalendar.js';
|
|
25
|
-
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
26
|
-
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
27
|
-
export { useDebouncedState } from './hooks/useDebouncedState.js';
|
|
@@ -1,26 +1,33 @@
|
|
|
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';
|
|
22
23
|
import '../styles/progressBar.js';
|
|
23
|
-
import '
|
|
24
|
+
import 'react-icons/ai';
|
|
25
|
+
import 'react-icons/io5';
|
|
26
|
+
import 'tailwind-merge';
|
|
27
|
+
import '../components/Select/GroupedOptions.js';
|
|
28
|
+
import '../components/Select/context.js';
|
|
29
|
+
import '../components/Select/Popover.js';
|
|
30
|
+
import '../components/Select/Trigger.js';
|
|
24
31
|
import '../components/Tag.js';
|
|
25
32
|
import '../components/TextArea.js';
|
|
26
33
|
import '../components/Toggle.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;
|
|
@@ -6,15 +6,15 @@ export interface InputPropsBase {
|
|
|
6
6
|
}
|
|
7
7
|
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, InputPropsBase {
|
|
8
8
|
}
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const InputBox: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
10
10
|
type DivBaseProps = React.HTMLAttributes<HTMLDivElement>;
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
11
|
+
export declare const InputFace: React.ForwardRefExoticComponent<DivBaseProps & Pick<InputPropsBase, "variants"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const InputRoot: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export declare const InputLeft: React.ForwardRefExoticComponent<DivBaseProps & {
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
className?: string | undefined;
|
|
16
16
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
export declare const
|
|
17
|
+
export declare const InputRight: React.ForwardRefExoticComponent<DivBaseProps & {
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
className?: string | undefined;
|
|
20
20
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
interface SearchInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick' | 'onChange'> {
|
|
2
3
|
label?: string;
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
isSubmitting?: boolean;
|
|
@@ -6,5 +7,5 @@ interface SearchInputProps {
|
|
|
6
7
|
onClick?: (value: string) => void;
|
|
7
8
|
BOUNCE_TIMEOUT?: number;
|
|
8
9
|
}
|
|
9
|
-
declare const SearchInput: ({ label, placeholder, isSubmitting, onChange, onClick, BOUNCE_TIMEOUT, }: SearchInputProps) => JSX.Element;
|
|
10
|
+
declare const SearchInput: ({ label, placeholder, isSubmitting, onChange, onClick, BOUNCE_TIMEOUT, className, ...rest }: SearchInputProps) => JSX.Element;
|
|
10
11
|
export default SearchInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface SelectGroupedOptionsProps<T> {
|
|
2
|
+
onSelect: (value: T) => void;
|
|
3
|
+
options?: Map<string, T[]>;
|
|
4
|
+
groupedLabelExtractor: (value: string) => string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SelectGroupedOptions: <T>({ onSelect, groupedLabelExtractor, options, }: SelectGroupedOptionsProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SelectRootProps<T> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
value?: T;
|
|
5
|
+
keyExtractor: (value: T) => string;
|
|
6
|
+
labelExtractor: (value: T) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SelectRoot: <T>({ children, value, keyExtractor, labelExtractor, }: SelectRootProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
interface SelectContextProps<T> {
|
|
3
|
+
value?: T;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
setOpen?: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
keyExtractor: (value: T) => string;
|
|
7
|
+
labelExtractor: (value: T) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SelectContext: import("react").Context<SelectContextProps<any>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Select: {
|
|
2
|
+
Root: <T>({ children, value, keyExtractor, labelExtractor, }: import("./Root").SelectRootProps<T>) => JSX.Element;
|
|
3
|
+
Trigger: ({ label, disabled }: import("./Trigger").SelectTriggerProps) => JSX.Element;
|
|
4
|
+
Popover: ({ children }: import("./Popover").SelectPopoverProps) => JSX.Element;
|
|
5
|
+
Options: <T_1>({ onSelect, options, }: import("./Options").SelectOptionsProps<T_1>) => JSX.Element;
|
|
6
|
+
GroupedOptions: <T_2>({ onSelect, groupedLabelExtractor, options, }: import("./GroupedOptions").SelectGroupedOptionsProps<T_2>) => JSX.Element;
|
|
7
|
+
Option: <T_3>({ onSelectOption, option, }: import("./Option").SelectOptionProps<T_3>) => JSX.Element;
|
|
8
|
+
};
|
|
@@ -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';
|
|
@@ -13,10 +15,11 @@ export * from './Input';
|
|
|
13
15
|
export * from './Modal';
|
|
14
16
|
export * from './ProgressBar';
|
|
15
17
|
export * from './RangeCalendar';
|
|
16
|
-
export
|
|
18
|
+
export * from './SearchInput';
|
|
19
|
+
export * from './Select';
|
|
17
20
|
export * from './Skeleton';
|
|
18
21
|
export * from './Table';
|
|
19
22
|
export * from './Tag';
|
|
20
23
|
export * from './TextArea';
|
|
21
|
-
export * from './Toggle';
|
|
22
24
|
export * from './TimeFieldInput';
|
|
25
|
+
export * from './Toggle';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './useCalendar';
|
|
2
2
|
export * from './useCalendarCell';
|
|
3
3
|
export * from './useCalendarGrid';
|
|
4
|
+
export * from './useDatePickerInput';
|
|
5
|
+
export * from './useDateRangePickerInput';
|
|
4
6
|
export * from './useDebouncedState';
|
|
7
|
+
export * from './useOutsideClickListener';
|
|
8
|
+
export * from './useRangeCalendar';
|
|
@@ -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,7 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
interface useOutsideClickListenerProps {
|
|
3
|
+
ref: MutableRefObject<any>;
|
|
4
|
+
onClickOutside?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useOutsideClickListener: ({ ref, onClickOutside, }: useOutsideClickListenerProps) => void;
|
|
7
|
+
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|