@tecsinapse/cortex-react 1.9.11 → 1.9.12-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/CalendarCell.js +2 -0
- package/dist/cjs/components/DatePicker/DatePickerInput.js +9 -13
- package/dist/cjs/components/DatePicker/DatePickerInputBase.js +46 -6
- package/dist/cjs/components/DatePicker/DateRangePickerInput.js +8 -22
- package/dist/cjs/components/DatePicker/DateSegment.js +7 -1
- package/dist/cjs/components/GroupButton.js +2 -0
- package/dist/cjs/components/Popover/Content.js +5 -3
- package/dist/cjs/components/Popover/Trigger.js +16 -3
- package/dist/cjs/components/ProgressBar/Progress.js +2 -0
- package/dist/cjs/hooks/useCalendar.js +1 -1
- package/dist/cjs/hooks/useCalendarCell.js +2 -2
- package/dist/cjs/hooks/useDatePickerInput.js +1 -1
- package/dist/cjs/hooks/useDateRangePickerInput.js +4 -4
- package/dist/cjs/hooks/useFloatingElement.js +5 -1
- package/dist/cjs/styles/date-picker-input-base.js +18 -0
- package/dist/cjs/styles/date-segment.js +18 -0
- package/dist/cjs/utils/date.js +1 -0
- package/dist/esm/components/Calendar/CalendarCell.js +2 -0
- package/dist/esm/components/DatePicker/DatePickerInput.js +9 -13
- package/dist/esm/components/DatePicker/DatePickerInputBase.js +47 -7
- package/dist/esm/components/DatePicker/DateRangePickerInput.js +8 -22
- package/dist/esm/components/DatePicker/DateSegment.js +7 -1
- package/dist/esm/components/GroupButton.js +2 -0
- package/dist/esm/components/Popover/Content.js +5 -3
- package/dist/esm/components/Popover/Trigger.js +16 -3
- package/dist/esm/components/ProgressBar/Progress.js +2 -0
- package/dist/esm/hooks/useCalendar.js +1 -1
- package/dist/esm/hooks/useCalendarCell.js +2 -2
- package/dist/esm/hooks/useDatePickerInput.js +1 -1
- package/dist/esm/hooks/useDateRangePickerInput.js +4 -4
- package/dist/esm/hooks/useFloatingElement.js +6 -2
- package/dist/esm/styles/date-picker-input-base.js +16 -0
- package/dist/esm/styles/date-segment.js +16 -0
- package/dist/esm/utils/date.js +1 -0
- package/dist/types/components/Calendar/Calendar.d.ts +1 -1
- package/dist/types/components/Calendar/RangeCalendar.d.ts +2 -2
- package/dist/types/components/DatePicker/DatePickerInput.d.ts +3 -3
- package/dist/types/components/DatePicker/DatePickerInputBase.d.ts +8 -3
- package/dist/types/components/DatePicker/DateRangePickerInput.d.ts +3 -3
- package/dist/types/components/Popover/Content.d.ts +3 -2
- package/dist/types/components/Popover/Trigger.d.ts +2 -1
- package/dist/types/components/Popover/index.d.ts +2 -2
- package/dist/types/hooks/useCalendar.d.ts +1 -1
- package/dist/types/hooks/useDatePickerInput.d.ts +1 -1
- package/dist/types/hooks/useDateRangePickerInput.d.ts +1 -1
- package/dist/types/styles/date-picker-input-base.d.ts +49 -0
- package/dist/types/styles/date-segment.d.ts +49 -0
- package/dist/types/styles/index.d.ts +2 -0
- package/dist/types/styles/menubar.d.ts +5 -5
- package/dist/types/utils/date.d.ts +1 -1
- package/package.json +2 -2
|
@@ -10,6 +10,8 @@ require('currency.js');
|
|
|
10
10
|
require('react-dropzone');
|
|
11
11
|
require('uuid');
|
|
12
12
|
var calendarCell = require('../../styles/calendar-cell.js');
|
|
13
|
+
require('../../styles/date-picker-input-base.js');
|
|
14
|
+
require('../../styles/date-segment.js');
|
|
13
15
|
require('../../styles/groupButton.js');
|
|
14
16
|
require('../../styles/progressBar.js');
|
|
15
17
|
var Table = require('../Table.js');
|
|
@@ -13,32 +13,28 @@ require('uuid');
|
|
|
13
13
|
var Calendar = require('../Calendar/Calendar.js');
|
|
14
14
|
var index = require('../Popover/index.js');
|
|
15
15
|
var Context = require('../Popover/Context.js');
|
|
16
|
-
var Content = require('
|
|
16
|
+
var Content = require('../Select/Content.js');
|
|
17
17
|
var DateField = require('./DateField.js');
|
|
18
18
|
var DatePickerInputBase = require('./DatePickerInputBase.js');
|
|
19
19
|
|
|
20
20
|
const DatePickerInputWithPopover = (props) => {
|
|
21
21
|
const { setIsOpen } = Context.usePopoverContext();
|
|
22
|
-
const { onChange, value, label, variants } = props;
|
|
22
|
+
const { onChange, value, label, variants, disabled } = props;
|
|
23
23
|
const { fieldProps, state, ref } = useDatePickerInput.useDatePickerInput({ value, onChange });
|
|
24
|
-
return /* @__PURE__ */ React.createElement("div", { ref, "data-testid": "date-picker-input" }, /* @__PURE__ */ React.createElement(index.Popover.Trigger,
|
|
24
|
+
return /* @__PURE__ */ React.createElement("div", { ref, "data-testid": "date-picker-input" }, /* @__PURE__ */ React.createElement(index.Popover.Trigger, { disabled: true }, /* @__PURE__ */ React.createElement(
|
|
25
25
|
DatePickerInputBase.DatePickerInputBase,
|
|
26
26
|
{
|
|
27
27
|
variants: {
|
|
28
28
|
...variants,
|
|
29
29
|
intent: state.isInvalid ? "error" : variants?.intent
|
|
30
30
|
},
|
|
31
|
-
label
|
|
31
|
+
label,
|
|
32
|
+
disabled,
|
|
33
|
+
value,
|
|
34
|
+
onClean: () => state.setValue(null),
|
|
35
|
+
onToggle: () => setIsOpen((open) => !open)
|
|
32
36
|
},
|
|
33
|
-
/* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
34
|
-
DateField.DateField,
|
|
35
|
-
{
|
|
36
|
-
...fieldProps,
|
|
37
|
-
onChange: (value2) => {
|
|
38
|
-
state.setDateValue(value2);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
))
|
|
37
|
+
/* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(DateField.DateField, { ...fieldProps, isDisabled: disabled }))
|
|
42
38
|
)), /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-inherit shadow-none border-none" }, /* @__PURE__ */ React.createElement(
|
|
43
39
|
Calendar.Calendar,
|
|
44
40
|
{
|
|
@@ -2,20 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var io = require('react-icons/io');
|
|
5
6
|
var lia = require('react-icons/lia');
|
|
7
|
+
require('../../styles/calendar-cell.js');
|
|
8
|
+
var datePickerInputBase = require('../../styles/date-picker-input-base.js');
|
|
9
|
+
require('../../styles/date-segment.js');
|
|
10
|
+
require('../../styles/groupButton.js');
|
|
11
|
+
require('../../styles/progressBar.js');
|
|
6
12
|
var index = require('../Input/index.js');
|
|
7
13
|
|
|
14
|
+
const { icon } = datePickerInputBase.datePickerInputBase();
|
|
8
15
|
const DatePickerInputBase = ({
|
|
9
16
|
children,
|
|
10
17
|
variants,
|
|
11
|
-
label
|
|
18
|
+
label,
|
|
19
|
+
disabled = false,
|
|
20
|
+
value,
|
|
21
|
+
onClean,
|
|
22
|
+
onToggle
|
|
12
23
|
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
const showCloseIcon = React.useMemo(() => {
|
|
25
|
+
const hasDate = value != void 0;
|
|
26
|
+
const hasStartDate = value?.start != void 0;
|
|
27
|
+
const hasEndDate = value?.end != void 0;
|
|
28
|
+
if (value && "start" in value) return hasStartDate && hasEndDate;
|
|
29
|
+
return hasDate;
|
|
30
|
+
}, [value]);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(index.Input.Face, { variants, "data-testid": "date-picker-input-base" }, /* @__PURE__ */ React.createElement("span", { className: cortexCore.labelStyle({}) }, label), /* @__PURE__ */ React.createElement("div", { className: cortexCore.inputBox("", label, "w-full flex flex-row") }, children), /* @__PURE__ */ React.createElement(index.Input.Right, { className: "mt-centi" }, showCloseIcon ? /* @__PURE__ */ React.createElement(
|
|
32
|
+
"button",
|
|
15
33
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
onClick: onClean,
|
|
35
|
+
disabled,
|
|
36
|
+
"data-testid": "date-picker-input-base-clean-button"
|
|
37
|
+
},
|
|
38
|
+
/* @__PURE__ */ React.createElement(
|
|
39
|
+
io.IoMdClose,
|
|
40
|
+
{
|
|
41
|
+
className: icon({ disabled }),
|
|
42
|
+
"data-testid": "date-picker-input-base-clean-icon"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
) : /* @__PURE__ */ React.createElement(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
onClick: onToggle,
|
|
49
|
+
disabled,
|
|
50
|
+
"data-testid": "date-picker-input-base-calendar-button"
|
|
51
|
+
},
|
|
52
|
+
/* @__PURE__ */ React.createElement(
|
|
53
|
+
lia.LiaCalendar,
|
|
54
|
+
{
|
|
55
|
+
className: icon({ disabled }),
|
|
56
|
+
"data-testid": "date-picker-input-base-calendar-icon"
|
|
57
|
+
}
|
|
58
|
+
)
|
|
19
59
|
)));
|
|
20
60
|
};
|
|
21
61
|
|
|
@@ -19,36 +19,22 @@ var DatePickerInputBase = require('./DatePickerInputBase.js');
|
|
|
19
19
|
|
|
20
20
|
const DateRangePickerInputWithPopover = (props) => {
|
|
21
21
|
const { setIsOpen } = Context.usePopoverContext();
|
|
22
|
-
const { onChange, value, label, variants } = props;
|
|
22
|
+
const { onChange, value, label, variants, disabled = false } = props;
|
|
23
23
|
const { endFieldProps, startFieldProps, ref, state } = useDateRangePickerInput.useDateRangePickerInput({ value, onChange });
|
|
24
|
-
return /* @__PURE__ */ React.createElement("div", { ref, "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React.createElement(index.Popover.Trigger,
|
|
24
|
+
return /* @__PURE__ */ React.createElement("div", { ref, "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React.createElement(index.Popover.Trigger, { disabled: true }, /* @__PURE__ */ React.createElement(
|
|
25
25
|
DatePickerInputBase.DatePickerInputBase,
|
|
26
26
|
{
|
|
27
27
|
variants: {
|
|
28
28
|
...variants,
|
|
29
29
|
intent: state.isInvalid ? "error" : variants?.intent
|
|
30
30
|
},
|
|
31
|
-
label
|
|
31
|
+
label,
|
|
32
|
+
disabled,
|
|
33
|
+
value,
|
|
34
|
+
onClean: () => state.setValue(null),
|
|
35
|
+
onToggle: () => setIsOpen((open) => !open)
|
|
32
36
|
},
|
|
33
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React.createElement(
|
|
34
|
-
DateField.DateField,
|
|
35
|
-
{
|
|
36
|
-
...startFieldProps,
|
|
37
|
-
value: date.dateToCalendarDate(value?.start),
|
|
38
|
-
onChange: (value2) => {
|
|
39
|
-
state.setDate("start", value2);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
), /* @__PURE__ */ React.createElement("span", null, "-"), /* @__PURE__ */ React.createElement(
|
|
43
|
-
DateField.DateField,
|
|
44
|
-
{
|
|
45
|
-
...endFieldProps,
|
|
46
|
-
value: date.dateToCalendarDate(value?.end),
|
|
47
|
-
onChange: (value2) => {
|
|
48
|
-
state.setDate("end", value2);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
))
|
|
37
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React.createElement(DateField.DateField, { ...startFieldProps, isDisabled: disabled }), /* @__PURE__ */ React.createElement("span", null, "-"), /* @__PURE__ */ React.createElement(DateField.DateField, { ...endFieldProps, isDisabled: disabled }))
|
|
52
38
|
)), /* @__PURE__ */ React.createElement(index.Popover.Content, { className: "bg-inherit shadow-none border-none" }, /* @__PURE__ */ React.createElement(
|
|
53
39
|
RangeCalendar.RangeCalendar,
|
|
54
40
|
{
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var reactAria = require('react-aria');
|
|
5
|
+
require('../../styles/calendar-cell.js');
|
|
6
|
+
require('../../styles/date-picker-input-base.js');
|
|
7
|
+
var dateSegment = require('../../styles/date-segment.js');
|
|
8
|
+
require('../../styles/groupButton.js');
|
|
9
|
+
require('../../styles/progressBar.js');
|
|
5
10
|
|
|
11
|
+
const { base } = dateSegment.dateSegment();
|
|
6
12
|
const DateSegment = ({ segment, state }) => {
|
|
7
13
|
const ref = React.useRef(null);
|
|
8
14
|
const { segmentProps } = reactAria.useDateSegment(segment, state, ref);
|
|
@@ -11,7 +17,7 @@ const DateSegment = ({ segment, state }) => {
|
|
|
11
17
|
{
|
|
12
18
|
...segmentProps,
|
|
13
19
|
ref,
|
|
14
|
-
className:
|
|
20
|
+
className: base({ disabled: state.isDisabled })
|
|
15
21
|
},
|
|
16
22
|
segment.text
|
|
17
23
|
);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
require('../styles/calendar-cell.js');
|
|
6
|
+
require('../styles/date-picker-input-base.js');
|
|
7
|
+
require('../styles/date-segment.js');
|
|
6
8
|
var groupButton = require('../styles/groupButton.js');
|
|
7
9
|
require('../styles/progressBar.js');
|
|
8
10
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var react = require('@floating-ui/react');
|
|
3
4
|
var clsx = require('clsx');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var Context = require('./Context.js');
|
|
6
|
-
var react = require('@floating-ui/react');
|
|
7
7
|
|
|
8
8
|
const PopoverContent = ({
|
|
9
9
|
children,
|
|
10
|
-
className
|
|
10
|
+
className,
|
|
11
|
+
modal = false,
|
|
12
|
+
...rest
|
|
11
13
|
}) => {
|
|
12
14
|
const {
|
|
13
15
|
isOpen,
|
|
@@ -19,7 +21,7 @@ const PopoverContent = ({
|
|
|
19
21
|
getFloatingProps,
|
|
20
22
|
context
|
|
21
23
|
} = Context.usePopoverContext();
|
|
22
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen && /* @__PURE__ */ React.createElement(react.FloatingFocusManager, { context, modal
|
|
24
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen && /* @__PURE__ */ React.createElement(react.FloatingFocusManager, { ...rest, context, modal }, /* @__PURE__ */ React.createElement(
|
|
23
25
|
"div",
|
|
24
26
|
{
|
|
25
27
|
ref: refs.setFloating,
|
|
@@ -4,10 +4,23 @@ require('@internationalized/date');
|
|
|
4
4
|
var react = require('../../utils/react.js');
|
|
5
5
|
var Context = require('./Context.js');
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const isDisabledProps = {
|
|
8
|
+
onClick: () => void 0,
|
|
9
|
+
onKeyDown: () => void 0,
|
|
10
|
+
onMouseDown: () => void 0,
|
|
11
|
+
onKeyUp: () => void 0,
|
|
12
|
+
onPointerDown: () => void 0
|
|
13
|
+
};
|
|
14
|
+
const PopoverTrigger = ({
|
|
15
|
+
children,
|
|
16
|
+
disabled = false
|
|
17
|
+
}) => {
|
|
8
18
|
const { triggerProps } = Context.usePopoverContext();
|
|
9
|
-
const isDisabled = children.props?.disabled;
|
|
10
|
-
return react.cloneWithProps(children,
|
|
19
|
+
const isDisabled = disabled ?? children.props?.disabled;
|
|
20
|
+
return react.cloneWithProps(children, {
|
|
21
|
+
...triggerProps,
|
|
22
|
+
...isDisabled ? isDisabledProps : {}
|
|
23
|
+
});
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
exports.PopoverTrigger = PopoverTrigger;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
require('../../styles/calendar-cell.js');
|
|
5
|
+
require('../../styles/date-picker-input-base.js');
|
|
6
|
+
require('../../styles/date-segment.js');
|
|
5
7
|
require('../../styles/groupButton.js');
|
|
6
8
|
var progressBar = require('../../styles/progressBar.js');
|
|
7
9
|
|
|
@@ -11,7 +11,7 @@ const useCalendar = ({ value, onChange }) => {
|
|
|
11
11
|
const state = reactStately.useCalendarState({
|
|
12
12
|
locale,
|
|
13
13
|
createCalendar: date.createCalendar,
|
|
14
|
-
defaultValue: date$1.dateToCalendarDate(value),
|
|
14
|
+
defaultValue: value ? date$1.dateToCalendarDate(value) : null,
|
|
15
15
|
onChange: (value2) => onChange(date$1.calendarDateToDate(value2))
|
|
16
16
|
});
|
|
17
17
|
const { calendarProps, title } = reactAria.useCalendar({}, state);
|
|
@@ -14,8 +14,8 @@ const useCalendarCell = ({ state, date: date$1 }) => {
|
|
|
14
14
|
formattedDate
|
|
15
15
|
} = reactAria.useCalendarCell({ date: date$1 }, state, ref);
|
|
16
16
|
const rangeStateHighlitedRange = state?.highlightedRange;
|
|
17
|
-
const isSameDayStart = rangeStateHighlitedRange ? date.isSameDay(date$1, state?.highlightedRange?.start) : void 0;
|
|
18
|
-
const isSameDayEnd = rangeStateHighlitedRange ? date.isSameDay(date$1, state?.highlightedRange?.end) : void 0;
|
|
17
|
+
const isSameDayStart = rangeStateHighlitedRange && date$1 ? date.isSameDay(date$1, state?.highlightedRange?.start) : void 0;
|
|
18
|
+
const isSameDayEnd = rangeStateHighlitedRange && date$1 ? date.isSameDay(date$1, state?.highlightedRange?.end) : void 0;
|
|
19
19
|
const isSelectionStart = isSameDayStart && !isSameDayEnd;
|
|
20
20
|
const isSelectionEnd = isSameDayEnd && !isSameDayStart;
|
|
21
21
|
const inRange = date$1 > rangeStateHighlitedRange?.start && date$1 < rangeStateHighlitedRange?.end;
|
|
@@ -10,7 +10,7 @@ const useDatePickerInput = ({
|
|
|
10
10
|
onChange
|
|
11
11
|
}) => {
|
|
12
12
|
const state = reactStately.useDatePickerState({
|
|
13
|
-
defaultValue: date.dateToCalendarDate(value),
|
|
13
|
+
defaultValue: value ? date.dateToCalendarDate(value) : null,
|
|
14
14
|
onChange: (value2) => {
|
|
15
15
|
onChange(date.calendarDateToDate(value2));
|
|
16
16
|
}
|
|
@@ -10,14 +10,14 @@ const useDateRangePickerInput = ({
|
|
|
10
10
|
onChange
|
|
11
11
|
}) => {
|
|
12
12
|
const state = reactStately.useDateRangePickerState({
|
|
13
|
-
defaultValue: {
|
|
13
|
+
defaultValue: value ? {
|
|
14
14
|
start: date.dateToCalendarDate(value?.start),
|
|
15
15
|
end: date.dateToCalendarDate(value?.end)
|
|
16
|
-
},
|
|
16
|
+
} : null,
|
|
17
17
|
onChange: (value2) => {
|
|
18
18
|
onChange({
|
|
19
|
-
start: date.calendarDateToDate(value2.start),
|
|
20
|
-
end: date.calendarDateToDate(value2.end)
|
|
19
|
+
start: value2 ? date.calendarDateToDate(value2.start) : void 0,
|
|
20
|
+
end: value2 ? date.calendarDateToDate(value2.end) : void 0
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
});
|
|
@@ -33,7 +33,11 @@ const useFloatingElement = ({
|
|
|
33
33
|
const click = react.useClick(context, { enabled: trigger === "click" });
|
|
34
34
|
const dismiss = react.useDismiss(context);
|
|
35
35
|
const role = react.useRole(context);
|
|
36
|
-
const hover = react.useHover(context, {
|
|
36
|
+
const hover = react.useHover(context, {
|
|
37
|
+
enabled: trigger === "hover",
|
|
38
|
+
delay,
|
|
39
|
+
handleClose: react.safePolygon()
|
|
40
|
+
});
|
|
37
41
|
const { getReferenceProps, getFloatingProps } = react.useInteractions([
|
|
38
42
|
click,
|
|
39
43
|
dismiss,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tailwindVariants = require('tailwind-variants');
|
|
4
|
+
|
|
5
|
+
const datePickerInputBase = tailwindVariants.tv({
|
|
6
|
+
slots: {
|
|
7
|
+
icon: "cursor-pointer"
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
disabled: {
|
|
11
|
+
true: {
|
|
12
|
+
icon: "text-secondary-light cursor-default"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
exports.datePickerInputBase = datePickerInputBase;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tailwindVariants = require('tailwind-variants');
|
|
4
|
+
|
|
5
|
+
const dateSegment = tailwindVariants.tv({
|
|
6
|
+
slots: {
|
|
7
|
+
base: "focus:outline-none focus:bg-secondary-light"
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
disabled: {
|
|
11
|
+
true: {
|
|
12
|
+
base: "text-secondary-light"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
exports.dateSegment = dateSegment;
|
package/dist/cjs/utils/date.js
CHANGED
|
@@ -8,6 +8,8 @@ import 'currency.js';
|
|
|
8
8
|
import 'react-dropzone';
|
|
9
9
|
import 'uuid';
|
|
10
10
|
import { calendarCell } from '../../styles/calendar-cell.js';
|
|
11
|
+
import '../../styles/date-picker-input-base.js';
|
|
12
|
+
import '../../styles/date-segment.js';
|
|
11
13
|
import '../../styles/groupButton.js';
|
|
12
14
|
import '../../styles/progressBar.js';
|
|
13
15
|
import { Td } from '../Table.js';
|
|
@@ -11,32 +11,28 @@ import 'uuid';
|
|
|
11
11
|
import { Calendar } from '../Calendar/Calendar.js';
|
|
12
12
|
import { Popover } from '../Popover/index.js';
|
|
13
13
|
import { usePopoverContext } from '../Popover/Context.js';
|
|
14
|
-
import { Content } from '
|
|
14
|
+
import { Content } from '../Select/Content.js';
|
|
15
15
|
import { DateField } from './DateField.js';
|
|
16
16
|
import { DatePickerInputBase } from './DatePickerInputBase.js';
|
|
17
17
|
|
|
18
18
|
const DatePickerInputWithPopover = (props) => {
|
|
19
19
|
const { setIsOpen } = usePopoverContext();
|
|
20
|
-
const { onChange, value, label, variants } = props;
|
|
20
|
+
const { onChange, value, label, variants, disabled } = props;
|
|
21
21
|
const { fieldProps, state, ref } = useDatePickerInput({ value, onChange });
|
|
22
|
-
return /* @__PURE__ */ React__default.createElement("div", { ref, "data-testid": "date-picker-input" }, /* @__PURE__ */ React__default.createElement(Popover.Trigger,
|
|
22
|
+
return /* @__PURE__ */ React__default.createElement("div", { ref, "data-testid": "date-picker-input" }, /* @__PURE__ */ React__default.createElement(Popover.Trigger, { disabled: true }, /* @__PURE__ */ React__default.createElement(
|
|
23
23
|
DatePickerInputBase,
|
|
24
24
|
{
|
|
25
25
|
variants: {
|
|
26
26
|
...variants,
|
|
27
27
|
intent: state.isInvalid ? "error" : variants?.intent
|
|
28
28
|
},
|
|
29
|
-
label
|
|
29
|
+
label,
|
|
30
|
+
disabled,
|
|
31
|
+
value,
|
|
32
|
+
onClean: () => state.setValue(null),
|
|
33
|
+
onToggle: () => setIsOpen((open) => !open)
|
|
30
34
|
},
|
|
31
|
-
/* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(
|
|
32
|
-
DateField,
|
|
33
|
-
{
|
|
34
|
-
...fieldProps,
|
|
35
|
-
onChange: (value2) => {
|
|
36
|
-
state.setDateValue(value2);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
))
|
|
35
|
+
/* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(DateField, { ...fieldProps, isDisabled: disabled }))
|
|
40
36
|
)), /* @__PURE__ */ React__default.createElement(Popover.Content, { className: "bg-inherit shadow-none border-none" }, /* @__PURE__ */ React__default.createElement(
|
|
41
37
|
Calendar,
|
|
42
38
|
{
|
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
import { labelStyle, inputBox } from '@tecsinapse/cortex-core';
|
|
2
|
-
import React__default from 'react';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { IoMdClose } from 'react-icons/io';
|
|
3
4
|
import { LiaCalendar } from 'react-icons/lia';
|
|
5
|
+
import '../../styles/calendar-cell.js';
|
|
6
|
+
import { datePickerInputBase } from '../../styles/date-picker-input-base.js';
|
|
7
|
+
import '../../styles/date-segment.js';
|
|
8
|
+
import '../../styles/groupButton.js';
|
|
9
|
+
import '../../styles/progressBar.js';
|
|
4
10
|
import { Input } from '../Input/index.js';
|
|
5
11
|
|
|
12
|
+
const { icon } = datePickerInputBase();
|
|
6
13
|
const DatePickerInputBase = ({
|
|
7
14
|
children,
|
|
8
15
|
variants,
|
|
9
|
-
label
|
|
16
|
+
label,
|
|
17
|
+
disabled = false,
|
|
18
|
+
value,
|
|
19
|
+
onClean,
|
|
20
|
+
onToggle
|
|
10
21
|
}) => {
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
const showCloseIcon = useMemo(() => {
|
|
23
|
+
const hasDate = value != void 0;
|
|
24
|
+
const hasStartDate = value?.start != void 0;
|
|
25
|
+
const hasEndDate = value?.end != void 0;
|
|
26
|
+
if (value && "start" in value) return hasStartDate && hasEndDate;
|
|
27
|
+
return hasDate;
|
|
28
|
+
}, [value]);
|
|
29
|
+
return /* @__PURE__ */ React__default.createElement(Input.Face, { variants, "data-testid": "date-picker-input-base" }, /* @__PURE__ */ React__default.createElement("span", { className: labelStyle({}) }, label), /* @__PURE__ */ React__default.createElement("div", { className: inputBox("", label, "w-full flex flex-row") }, children), /* @__PURE__ */ React__default.createElement(Input.Right, { className: "mt-centi" }, showCloseIcon ? /* @__PURE__ */ React__default.createElement(
|
|
30
|
+
"button",
|
|
13
31
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
onClick: onClean,
|
|
33
|
+
disabled,
|
|
34
|
+
"data-testid": "date-picker-input-base-clean-button"
|
|
35
|
+
},
|
|
36
|
+
/* @__PURE__ */ React__default.createElement(
|
|
37
|
+
IoMdClose,
|
|
38
|
+
{
|
|
39
|
+
className: icon({ disabled }),
|
|
40
|
+
"data-testid": "date-picker-input-base-clean-icon"
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
) : /* @__PURE__ */ React__default.createElement(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
onClick: onToggle,
|
|
47
|
+
disabled,
|
|
48
|
+
"data-testid": "date-picker-input-base-calendar-button"
|
|
49
|
+
},
|
|
50
|
+
/* @__PURE__ */ React__default.createElement(
|
|
51
|
+
LiaCalendar,
|
|
52
|
+
{
|
|
53
|
+
className: icon({ disabled }),
|
|
54
|
+
"data-testid": "date-picker-input-base-calendar-icon"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
17
57
|
)));
|
|
18
58
|
};
|
|
19
59
|
|
|
@@ -17,36 +17,22 @@ import { DatePickerInputBase } from './DatePickerInputBase.js';
|
|
|
17
17
|
|
|
18
18
|
const DateRangePickerInputWithPopover = (props) => {
|
|
19
19
|
const { setIsOpen } = usePopoverContext();
|
|
20
|
-
const { onChange, value, label, variants } = props;
|
|
20
|
+
const { onChange, value, label, variants, disabled = false } = props;
|
|
21
21
|
const { endFieldProps, startFieldProps, ref, state } = useDateRangePickerInput({ value, onChange });
|
|
22
|
-
return /* @__PURE__ */ React__default.createElement("div", { ref, "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React__default.createElement(Popover.Trigger,
|
|
22
|
+
return /* @__PURE__ */ React__default.createElement("div", { ref, "data-testid": "date-range-picker-input" }, /* @__PURE__ */ React__default.createElement(Popover.Trigger, { disabled: true }, /* @__PURE__ */ React__default.createElement(
|
|
23
23
|
DatePickerInputBase,
|
|
24
24
|
{
|
|
25
25
|
variants: {
|
|
26
26
|
...variants,
|
|
27
27
|
intent: state.isInvalid ? "error" : variants?.intent
|
|
28
28
|
},
|
|
29
|
-
label
|
|
29
|
+
label,
|
|
30
|
+
disabled,
|
|
31
|
+
value,
|
|
32
|
+
onClean: () => state.setValue(null),
|
|
33
|
+
onToggle: () => setIsOpen((open) => !open)
|
|
30
34
|
},
|
|
31
|
-
/* @__PURE__ */ React__default.createElement("div", { className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React__default.createElement(
|
|
32
|
-
DateField,
|
|
33
|
-
{
|
|
34
|
-
...startFieldProps,
|
|
35
|
-
value: dateToCalendarDate(value?.start),
|
|
36
|
-
onChange: (value2) => {
|
|
37
|
-
state.setDate("start", value2);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
), /* @__PURE__ */ React__default.createElement("span", null, "-"), /* @__PURE__ */ React__default.createElement(
|
|
41
|
-
DateField,
|
|
42
|
-
{
|
|
43
|
-
...endFieldProps,
|
|
44
|
-
value: dateToCalendarDate(value?.end),
|
|
45
|
-
onChange: (value2) => {
|
|
46
|
-
state.setDate("end", value2);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
))
|
|
35
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "flex flex-row gap-x-micro items-center" }, /* @__PURE__ */ React__default.createElement(DateField, { ...startFieldProps, isDisabled: disabled }), /* @__PURE__ */ React__default.createElement("span", null, "-"), /* @__PURE__ */ React__default.createElement(DateField, { ...endFieldProps, isDisabled: disabled }))
|
|
50
36
|
)), /* @__PURE__ */ React__default.createElement(Popover.Content, { className: "bg-inherit shadow-none border-none" }, /* @__PURE__ */ React__default.createElement(
|
|
51
37
|
RangeCalendar,
|
|
52
38
|
{
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { useDateSegment } from 'react-aria';
|
|
3
|
+
import '../../styles/calendar-cell.js';
|
|
4
|
+
import '../../styles/date-picker-input-base.js';
|
|
5
|
+
import { dateSegment } from '../../styles/date-segment.js';
|
|
6
|
+
import '../../styles/groupButton.js';
|
|
7
|
+
import '../../styles/progressBar.js';
|
|
3
8
|
|
|
9
|
+
const { base } = dateSegment();
|
|
4
10
|
const DateSegment = ({ segment, state }) => {
|
|
5
11
|
const ref = React__default.useRef(null);
|
|
6
12
|
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
@@ -9,7 +15,7 @@ const DateSegment = ({ segment, state }) => {
|
|
|
9
15
|
{
|
|
10
16
|
...segmentProps,
|
|
11
17
|
ref,
|
|
12
|
-
className:
|
|
18
|
+
className: base({ disabled: state.isDisabled })
|
|
13
19
|
},
|
|
14
20
|
segment.text
|
|
15
21
|
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import '../styles/calendar-cell.js';
|
|
4
|
+
import '../styles/date-picker-input-base.js';
|
|
5
|
+
import '../styles/date-segment.js';
|
|
4
6
|
import { groupButton } from '../styles/groupButton.js';
|
|
5
7
|
import '../styles/progressBar.js';
|
|
6
8
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { FloatingFocusManager } from '@floating-ui/react';
|
|
1
2
|
import clsx from 'clsx';
|
|
2
3
|
import React__default from 'react';
|
|
3
4
|
import { usePopoverContext } from './Context.js';
|
|
4
|
-
import { FloatingFocusManager } from '@floating-ui/react';
|
|
5
5
|
|
|
6
6
|
const PopoverContent = ({
|
|
7
7
|
children,
|
|
8
|
-
className
|
|
8
|
+
className,
|
|
9
|
+
modal = false,
|
|
10
|
+
...rest
|
|
9
11
|
}) => {
|
|
10
12
|
const {
|
|
11
13
|
isOpen,
|
|
@@ -17,7 +19,7 @@ const PopoverContent = ({
|
|
|
17
19
|
getFloatingProps,
|
|
18
20
|
context
|
|
19
21
|
} = usePopoverContext();
|
|
20
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isOpen && /* @__PURE__ */ React__default.createElement(FloatingFocusManager, { context, modal
|
|
22
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, isOpen && /* @__PURE__ */ React__default.createElement(FloatingFocusManager, { ...rest, context, modal }, /* @__PURE__ */ React__default.createElement(
|
|
21
23
|
"div",
|
|
22
24
|
{
|
|
23
25
|
ref: refs.setFloating,
|
|
@@ -2,10 +2,23 @@ import '@internationalized/date';
|
|
|
2
2
|
import { cloneWithProps } from '../../utils/react.js';
|
|
3
3
|
import { usePopoverContext } from './Context.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isDisabledProps = {
|
|
6
|
+
onClick: () => void 0,
|
|
7
|
+
onKeyDown: () => void 0,
|
|
8
|
+
onMouseDown: () => void 0,
|
|
9
|
+
onKeyUp: () => void 0,
|
|
10
|
+
onPointerDown: () => void 0
|
|
11
|
+
};
|
|
12
|
+
const PopoverTrigger = ({
|
|
13
|
+
children,
|
|
14
|
+
disabled = false
|
|
15
|
+
}) => {
|
|
6
16
|
const { triggerProps } = usePopoverContext();
|
|
7
|
-
const isDisabled = children.props?.disabled;
|
|
8
|
-
return cloneWithProps(children,
|
|
17
|
+
const isDisabled = disabled ?? children.props?.disabled;
|
|
18
|
+
return cloneWithProps(children, {
|
|
19
|
+
...triggerProps,
|
|
20
|
+
...isDisabled ? isDisabledProps : {}
|
|
21
|
+
});
|
|
9
22
|
};
|
|
10
23
|
|
|
11
24
|
export { PopoverTrigger };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import '../../styles/calendar-cell.js';
|
|
3
|
+
import '../../styles/date-picker-input-base.js';
|
|
4
|
+
import '../../styles/date-segment.js';
|
|
3
5
|
import '../../styles/groupButton.js';
|
|
4
6
|
import { ProgressVariants } from '../../styles/progressBar.js';
|
|
5
7
|
|
|
@@ -9,7 +9,7 @@ const useCalendar = ({ value, onChange }) => {
|
|
|
9
9
|
const state = useCalendarState({
|
|
10
10
|
locale,
|
|
11
11
|
createCalendar,
|
|
12
|
-
defaultValue: dateToCalendarDate(value),
|
|
12
|
+
defaultValue: value ? dateToCalendarDate(value) : null,
|
|
13
13
|
onChange: (value2) => onChange(calendarDateToDate(value2))
|
|
14
14
|
});
|
|
15
15
|
const { calendarProps, title } = useCalendar$1({}, state);
|
|
@@ -12,8 +12,8 @@ const useCalendarCell = ({ state, date }) => {
|
|
|
12
12
|
formattedDate
|
|
13
13
|
} = useCalendarCell$1({ date }, state, ref);
|
|
14
14
|
const rangeStateHighlitedRange = state?.highlightedRange;
|
|
15
|
-
const isSameDayStart = rangeStateHighlitedRange ? isSameDay(date, state?.highlightedRange?.start) : void 0;
|
|
16
|
-
const isSameDayEnd = rangeStateHighlitedRange ? isSameDay(date, state?.highlightedRange?.end) : void 0;
|
|
15
|
+
const isSameDayStart = rangeStateHighlitedRange && date ? isSameDay(date, state?.highlightedRange?.start) : void 0;
|
|
16
|
+
const isSameDayEnd = rangeStateHighlitedRange && date ? isSameDay(date, state?.highlightedRange?.end) : void 0;
|
|
17
17
|
const isSelectionStart = isSameDayStart && !isSameDayEnd;
|
|
18
18
|
const isSelectionEnd = isSameDayEnd && !isSameDayStart;
|
|
19
19
|
const inRange = date > rangeStateHighlitedRange?.start && date < rangeStateHighlitedRange?.end;
|
|
@@ -8,7 +8,7 @@ const useDatePickerInput = ({
|
|
|
8
8
|
onChange
|
|
9
9
|
}) => {
|
|
10
10
|
const state = useDatePickerState({
|
|
11
|
-
defaultValue: dateToCalendarDate(value),
|
|
11
|
+
defaultValue: value ? dateToCalendarDate(value) : null,
|
|
12
12
|
onChange: (value2) => {
|
|
13
13
|
onChange(calendarDateToDate(value2));
|
|
14
14
|
}
|
|
@@ -8,14 +8,14 @@ const useDateRangePickerInput = ({
|
|
|
8
8
|
onChange
|
|
9
9
|
}) => {
|
|
10
10
|
const state = useDateRangePickerState({
|
|
11
|
-
defaultValue: {
|
|
11
|
+
defaultValue: value ? {
|
|
12
12
|
start: dateToCalendarDate(value?.start),
|
|
13
13
|
end: dateToCalendarDate(value?.end)
|
|
14
|
-
},
|
|
14
|
+
} : null,
|
|
15
15
|
onChange: (value2) => {
|
|
16
16
|
onChange({
|
|
17
|
-
start: calendarDateToDate(value2.start),
|
|
18
|
-
end: calendarDateToDate(value2.end)
|
|
17
|
+
start: value2 ? calendarDateToDate(value2.start) : void 0,
|
|
18
|
+
end: value2 ? calendarDateToDate(value2.end) : void 0
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useFloating, autoUpdate, offset, flip, shift, arrow, useClick, useDismiss, useRole, useHover, useInteractions } from '@floating-ui/react';
|
|
1
|
+
import { useFloating, autoUpdate, offset, flip, shift, arrow, useClick, useDismiss, useRole, useHover, safePolygon, useInteractions } from '@floating-ui/react';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
const useFloatingElement = ({
|
|
@@ -31,7 +31,11 @@ const useFloatingElement = ({
|
|
|
31
31
|
const click = useClick(context, { enabled: trigger === "click" });
|
|
32
32
|
const dismiss = useDismiss(context);
|
|
33
33
|
const role = useRole(context);
|
|
34
|
-
const hover = useHover(context, {
|
|
34
|
+
const hover = useHover(context, {
|
|
35
|
+
enabled: trigger === "hover",
|
|
36
|
+
delay,
|
|
37
|
+
handleClose: safePolygon()
|
|
38
|
+
});
|
|
35
39
|
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
36
40
|
click,
|
|
37
41
|
dismiss,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const datePickerInputBase = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
icon: "cursor-pointer"
|
|
6
|
+
},
|
|
7
|
+
variants: {
|
|
8
|
+
disabled: {
|
|
9
|
+
true: {
|
|
10
|
+
icon: "text-secondary-light cursor-default"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { datePickerInputBase };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
|
|
3
|
+
const dateSegment = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
base: "focus:outline-none focus:bg-secondary-light"
|
|
6
|
+
},
|
|
7
|
+
variants: {
|
|
8
|
+
disabled: {
|
|
9
|
+
true: {
|
|
10
|
+
base: "text-secondary-light"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { dateSegment };
|
package/dist/esm/utils/date.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export interface DatePickerInputProps extends
|
|
2
|
+
import { InputProps } from '../Input';
|
|
3
|
+
export interface DatePickerInputProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
4
4
|
value?: Date;
|
|
5
|
-
onChange: (date
|
|
5
|
+
onChange: (date?: Date) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare const DatePickerInput: (props: DatePickerInputProps) => JSX.Element;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { DateRange } from '../Calendar';
|
|
3
|
+
import { InputProps } from '../Input';
|
|
4
|
+
interface DatePickerInputBaseProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
4
5
|
children: React.ReactElement;
|
|
6
|
+
value?: Date | DateRange;
|
|
7
|
+
onClean?: () => void;
|
|
8
|
+
onToggle?: () => void;
|
|
9
|
+
disabled?: boolean;
|
|
5
10
|
}
|
|
6
|
-
export declare const DatePickerInputBase: ({ children, variants, label, }: DatePickerInputBaseProps) => JSX.Element;
|
|
11
|
+
export declare const DatePickerInputBase: ({ children, variants, label, disabled, value, onClean, onToggle, }: DatePickerInputBaseProps) => JSX.Element;
|
|
7
12
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DateRange } from '../Calendar/RangeCalendar';
|
|
3
|
-
import {
|
|
4
|
-
export interface DateRangePickerInputProps extends
|
|
3
|
+
import { InputProps } from '../Input';
|
|
4
|
+
export interface DateRangePickerInputProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
5
5
|
value?: DateRange;
|
|
6
|
-
onChange: (date
|
|
6
|
+
onChange: (date?: DateRange) => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const DateRangePickerInput: (props: DateRangePickerInputProps) => JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type FloatingFocusManagerProps } from '@floating-ui/react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
export interface PopoverContentProps {
|
|
3
|
+
export interface PopoverContentProps extends Omit<FloatingFocusManagerProps, 'children' | 'context'> {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
className?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare const PopoverContent: ({ children, className, }: PopoverContentProps) => JSX.Element;
|
|
7
|
+
export declare const PopoverContent: ({ children, className, modal, ...rest }: PopoverContentProps) => JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface PopoverTriggerProps {
|
|
3
3
|
children: React.ReactElement;
|
|
4
|
+
disabled?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare const PopoverTrigger: ({ children }: PopoverTriggerProps) => React.FunctionComponentElement<any>;
|
|
6
|
+
export declare const PopoverTrigger: ({ children, disabled, }: PopoverTriggerProps) => React.FunctionComponentElement<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Popover: {
|
|
3
3
|
Root: ({ children, placement, trigger, ...props }: import("./Root").PopoverRootProps) => JSX.Element;
|
|
4
|
-
Trigger: ({ children }: import("./Trigger").PopoverTriggerProps) => import("react").FunctionComponentElement<any>;
|
|
5
|
-
Content: ({ children, className, }: import("./Content").PopoverContentProps) => JSX.Element;
|
|
4
|
+
Trigger: ({ children, disabled, }: import("./Trigger").PopoverTriggerProps) => import("react").FunctionComponentElement<any>;
|
|
5
|
+
Content: ({ children, className, modal, ...rest }: import("./Content").PopoverContentProps) => JSX.Element;
|
|
6
6
|
Provider: ({ children, placement, trigger, ...props }: import("./Provider").PopoverProviderProps) => JSX.Element;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface useCalendarProps {
|
|
2
2
|
value?: Date;
|
|
3
|
-
onChange: (value
|
|
3
|
+
onChange: (value?: Date) => void;
|
|
4
4
|
}
|
|
5
5
|
export declare const useCalendar: ({ value, onChange }: useCalendarProps) => {
|
|
6
6
|
calendarProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface useDatePickerInputProps {
|
|
3
3
|
value?: Date;
|
|
4
|
-
onChange: (date
|
|
4
|
+
onChange: (date?: Date) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare const useDatePickerInput: ({ value, onChange, }: useDatePickerInputProps) => {
|
|
7
7
|
fieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { DateRange } from '../components';
|
|
3
3
|
interface useDateRangePickerInputProps {
|
|
4
4
|
value?: DateRange;
|
|
5
|
-
onChange: (date
|
|
5
|
+
onChange: (date?: DateRange) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare const useDateRangePickerInput: ({ value, onChange, }: useDateRangePickerInputProps) => {
|
|
8
8
|
startFieldProps: import("react-aria").AriaDatePickerProps<import("react-aria").DateValue>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const datePickerInputBase: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: {
|
|
4
|
+
icon: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
icon: string;
|
|
9
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
10
|
+
disabled: {
|
|
11
|
+
true: {
|
|
12
|
+
icon: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
disabled: {
|
|
17
|
+
true: {
|
|
18
|
+
icon: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}>, {
|
|
22
|
+
disabled: {
|
|
23
|
+
true: {
|
|
24
|
+
icon: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
icon: string;
|
|
29
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
30
|
+
disabled: {
|
|
31
|
+
true: {
|
|
32
|
+
icon: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
icon: string;
|
|
37
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
38
|
+
disabled: {
|
|
39
|
+
true: {
|
|
40
|
+
icon: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
disabled: {
|
|
45
|
+
true: {
|
|
46
|
+
icon: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}>, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const dateSegment: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: {
|
|
4
|
+
base: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
base: string;
|
|
9
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
10
|
+
disabled: {
|
|
11
|
+
true: {
|
|
12
|
+
base: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
disabled: {
|
|
17
|
+
true: {
|
|
18
|
+
base: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}>, {
|
|
22
|
+
disabled: {
|
|
23
|
+
true: {
|
|
24
|
+
base: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
base: string;
|
|
29
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
30
|
+
disabled: {
|
|
31
|
+
true: {
|
|
32
|
+
base: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
base: string;
|
|
37
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
38
|
+
disabled: {
|
|
39
|
+
true: {
|
|
40
|
+
base: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
disabled: {
|
|
45
|
+
true: {
|
|
46
|
+
base: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}>, unknown, unknown, undefined>>;
|
|
@@ -172,16 +172,16 @@ export declare const mostUsedItem: import("tailwind-variants").TVReturnType<{
|
|
|
172
172
|
export declare const item: import("tailwind-variants").TVReturnType<{
|
|
173
173
|
[key: string]: {
|
|
174
174
|
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
175
|
-
container?: import("tailwind-merge").ClassNameValue;
|
|
176
175
|
icon?: import("tailwind-merge").ClassNameValue;
|
|
176
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
177
177
|
textBehavior?: import("tailwind-merge").ClassNameValue;
|
|
178
178
|
};
|
|
179
179
|
};
|
|
180
180
|
} | {
|
|
181
181
|
[x: string]: {
|
|
182
182
|
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
183
|
-
container?: import("tailwind-merge").ClassNameValue;
|
|
184
183
|
icon?: import("tailwind-merge").ClassNameValue;
|
|
184
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
185
185
|
textBehavior?: import("tailwind-merge").ClassNameValue;
|
|
186
186
|
};
|
|
187
187
|
};
|
|
@@ -192,16 +192,16 @@ export declare const item: import("tailwind-variants").TVReturnType<{
|
|
|
192
192
|
}, undefined, import("tailwind-variants/dist/config").TVConfig<unknown, {
|
|
193
193
|
[key: string]: {
|
|
194
194
|
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
195
|
-
container?: import("tailwind-merge").ClassNameValue;
|
|
196
195
|
icon?: import("tailwind-merge").ClassNameValue;
|
|
196
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
197
197
|
textBehavior?: import("tailwind-merge").ClassNameValue;
|
|
198
198
|
};
|
|
199
199
|
};
|
|
200
200
|
} | {}>, {
|
|
201
201
|
[key: string]: {
|
|
202
202
|
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
203
|
-
container?: import("tailwind-merge").ClassNameValue;
|
|
204
203
|
icon?: import("tailwind-merge").ClassNameValue;
|
|
204
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
205
205
|
textBehavior?: import("tailwind-merge").ClassNameValue;
|
|
206
206
|
};
|
|
207
207
|
};
|
|
@@ -216,8 +216,8 @@ export declare const item: import("tailwind-variants").TVReturnType<{
|
|
|
216
216
|
}, undefined, import("tailwind-variants/dist/config").TVConfig<unknown, {
|
|
217
217
|
[key: string]: {
|
|
218
218
|
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
219
|
-
container?: import("tailwind-merge").ClassNameValue;
|
|
220
219
|
icon?: import("tailwind-merge").ClassNameValue;
|
|
220
|
+
container?: import("tailwind-merge").ClassNameValue;
|
|
221
221
|
textBehavior?: import("tailwind-merge").ClassNameValue;
|
|
222
222
|
};
|
|
223
223
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CalendarDate } from '@internationalized/date';
|
|
2
2
|
export declare const dateToCalendarDate: (value?: Date) => CalendarDate;
|
|
3
|
-
export declare const calendarDateToDate: (value: CalendarDate) => Date;
|
|
3
|
+
export declare const calendarDateToDate: (value: CalendarDate) => Date | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.12-beta.1",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-dom": ">=18.0.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "8f626686ff07da013f3d9ea353b94dfe615cd087"
|
|
52
52
|
}
|