@wallarm-org/design-system 1.0.0-rc-feature-AS-877-fix-filter-code.4 → 1.0.0-rc-feature-AS-884.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/components/Calendar/CalendarContent.js +1 -1
- package/dist/components/Calendar/CalendarGrid.js +6 -6
- package/dist/components/Calendar/CalendarGrids.js +1 -1
- package/dist/components/Calendar/CalendarHeader.js +3 -3
- package/dist/components/Calendar/CalendarInputHeader.js +6 -9
- package/dist/components/Calendar/CalendarKeyboardHints.js +21 -16
- package/dist/components/DateFormatProvider/DateFormatProvider.d.ts +30 -0
- package/dist/components/DateFormatProvider/DateFormatProvider.js +18 -0
- package/dist/components/DateFormatProvider/context.d.ts +23 -0
- package/dist/components/DateFormatProvider/context.js +3 -0
- package/dist/components/DateFormatProvider/index.d.ts +4 -0
- package/dist/components/DateFormatProvider/index.js +3 -0
- package/dist/components/DateFormatProvider/useDateFormat.d.ts +11 -0
- package/dist/components/DateFormatProvider/useDateFormat.js +7 -0
- package/dist/components/DateInput/DateInput.d.ts +32 -21
- package/dist/components/DateInput/DateInput.js +49 -31
- package/dist/components/DateInput/index.d.ts +0 -2
- package/dist/components/DateInput/index.js +1 -2
- package/dist/components/DateInput/internal/DateInputInternal.d.ts +31 -0
- package/dist/components/DateInput/{DateInputInternal.js → internal/DateInputInternal.js} +31 -25
- package/dist/components/DateInput/internal/index.d.ts +1 -0
- package/dist/components/DateInput/internal/index.js +2 -0
- package/dist/components/DateRangeInput/DateRangeContext/DateRangeProvider.d.ts +18 -13
- package/dist/components/DateRangeInput/DateRangeContext/DateRangeProvider.js +26 -29
- package/dist/components/DateRangeInput/DateRangeContext/types.d.ts +5 -2
- package/dist/components/DateRangeInput/DateRangeContext/useDateRangeContext.d.ts +9 -16
- package/dist/components/DateRangeInput/DateRangeContext/useDateRangeContext.js +5 -1
- package/dist/components/DateRangeInput/DateRangeEndValue.d.ts +2 -11
- package/dist/components/DateRangeInput/DateRangeEndValue.js +2 -3
- package/dist/components/DateRangeInput/DateRangeGroup.js +2 -3
- package/dist/components/DateRangeInput/DateRangeInput.d.ts +14 -22
- package/dist/components/DateRangeInput/DateRangeInput.js +31 -8
- package/dist/components/DateRangeInput/DateRangeInputInternal.d.ts +9 -3
- package/dist/components/DateRangeInput/DateRangeInputInternal.js +39 -24
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.d.ts +4 -2
- package/dist/components/DateRangeInput/DateRangeSegmentGroup.js +35 -55
- package/dist/components/DateRangeInput/DateRangeSeparator.d.ts +2 -1
- package/dist/components/DateRangeInput/DateRangeSeparator.js +3 -5
- package/dist/components/DateRangeInput/DateRangeStartValue.d.ts +2 -4
- package/dist/components/DateRangeInput/DateRangeStartValue.js +2 -3
- package/dist/components/DateRangeInput/types.d.ts +24 -32
- package/dist/components/FilterInput/FilterInput.js +4 -2
- package/dist/components/FilterInput/FilterInputContext/types.d.ts +6 -0
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContextValue.d.ts +3 -0
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContextValue.js +7 -1
- package/dist/components/FilterInput/FilterInputErrors/FilterInputErrors.js +5 -9
- package/dist/components/FilterInput/FilterInputErrors/parseFilterInputErrors.js +3 -2
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/FilterInputChip.d.ts +2 -1
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/FilterInputChip.js +15 -14
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/Segment.d.ts +1 -2
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/Segment.js +18 -9
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/index.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/index.js +2 -1
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/segmentVariant.d.ts +6 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/segmentVariant.js +6 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputConnectorChip/FilterInputConnectorChip.js +1 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputField.js +3 -2
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/FilterInputDateValueMenu.js +1 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/FieldMenuSections.d.ts +3 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/FieldMenuSections.js +7 -3
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/FilterInputFieldMenu.js +9 -4
- package/dist/components/FilterInput/FilterInputMenu/FilterInputMenu.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputMenu.js +3 -2
- package/dist/components/FilterInput/FilterInputMenu/FilterInputOperatorMenu.js +3 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/FilterInputValueMenu.js +4 -2
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/ValueMenuItem.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/ValueMenuItem.js +2 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/useValueMenuState.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/useValueMenuState.js +8 -3
- package/dist/components/FilterInput/FilterInputMenu/hooks/useKeyboardNav.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputMenu/hooks/useKeyboardNav.js +9 -7
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useBlurCommit.d.ts +33 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useBlurCommit.js +42 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipActions.d.ts +27 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipActions.js +55 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipEditing.d.ts +5 -5
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipEditing.js +7 -6
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.d.ts +6 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +54 -87
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.d.ts +9 -2
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.js +33 -8
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow.d.ts +3 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow.js +12 -11
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useResetState.d.ts +42 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useResetState.js +41 -0
- package/dist/components/FilterInput/hooks/useFilterInputExpression/buildChips.js +7 -8
- package/dist/components/FilterInput/hooks/useFilterInputExpression/useFilterInputExpression.d.ts +1 -0
- package/dist/components/FilterInput/hooks/useFilterInputExpression/useFilterInputExpression.js +11 -0
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useFilterInputSelection.d.ts +5 -2
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useFilterInputSelection.js +4 -2
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useSelectionClipboard.d.ts +9 -2
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useSelectionClipboard.js +9 -5
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useSelectionKeyboard.d.ts +2 -1
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useSelectionKeyboard.js +3 -2
- package/dist/components/FilterInput/lib/dom.d.ts +9 -1
- package/dist/components/FilterInput/lib/dom.js +1 -1
- package/dist/components/FilterInput/lib/fields.d.ts +9 -0
- package/dist/components/FilterInput/lib/fields.js +6 -1
- package/dist/components/FilterInput/lib/index.d.ts +1 -1
- package/dist/components/FilterInput/lib/index.js +2 -2
- package/dist/components/FilterInput/lib/menuFilterText.js +2 -1
- package/dist/components/FilterInput/types.d.ts +6 -0
- package/dist/components/InputGroup/InputGroup.d.ts +6 -1
- package/dist/components/InputGroup/InputGroup.js +19 -3
- package/dist/components/InputGroup/index.d.ts +1 -1
- package/dist/components/Selection/Selection.d.ts +18 -0
- package/dist/components/Selection/Selection.js +80 -0
- package/dist/components/Selection/SelectionAll.d.ts +6 -0
- package/dist/components/Selection/SelectionAll.js +20 -0
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBar.d.ts +20 -0
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBar.js +42 -0
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBarSummary.d.ts +2 -0
- package/dist/components/Selection/SelectionBulkBar/SelectionBulkBarSummary.js +54 -0
- package/dist/components/Selection/SelectionBulkBar/index.d.ts +1 -0
- package/dist/components/Selection/SelectionBulkBar/index.js +2 -0
- package/dist/components/Selection/SelectionContext.d.ts +14 -0
- package/dist/components/Selection/SelectionContext.js +3 -0
- package/dist/components/Selection/SelectionItem.d.ts +10 -0
- package/dist/components/Selection/SelectionItem.js +41 -0
- package/dist/components/Selection/classes.d.ts +4 -0
- package/dist/components/Selection/classes.js +15 -0
- package/dist/components/Selection/index.d.ts +4 -0
- package/dist/components/Selection/index.js +5 -0
- package/dist/components/Selection/useSelectionContext.d.ts +2 -0
- package/dist/components/Selection/useSelectionContext.js +8 -0
- package/dist/components/Selection/useSelectionState.d.ts +23 -0
- package/dist/components/Selection/useSelectionState.js +99 -0
- package/dist/components/SimpleCharts/BarList/BarList.d.ts +16 -0
- package/dist/components/SimpleCharts/BarList/BarList.figma.d.ts +1 -0
- package/dist/components/SimpleCharts/BarList/BarList.figma.js +74 -0
- package/dist/components/SimpleCharts/BarList/BarList.js +38 -0
- package/dist/components/SimpleCharts/BarList/BarListBar.d.ts +14 -0
- package/dist/components/SimpleCharts/BarList/BarListBar.js +29 -0
- package/dist/components/SimpleCharts/BarList/BarListContext.d.ts +12 -0
- package/dist/components/SimpleCharts/BarList/BarListContext.js +4 -0
- package/dist/components/SimpleCharts/BarList/BarListItem.d.ts +12 -0
- package/dist/components/SimpleCharts/BarList/BarListItem.js +66 -0
- package/dist/components/SimpleCharts/BarList/BarListLabel.d.ts +5 -0
- package/dist/components/SimpleCharts/BarList/BarListLabel.js +16 -0
- package/dist/components/SimpleCharts/BarList/BarListPercent.d.ts +15 -0
- package/dist/components/SimpleCharts/BarList/BarListPercent.js +34 -0
- package/dist/components/SimpleCharts/BarList/BarListSkeleton.d.ts +8 -0
- package/dist/components/SimpleCharts/BarList/BarListSkeleton.js +36 -0
- package/dist/components/SimpleCharts/BarList/BarListValue.d.ts +5 -0
- package/dist/components/SimpleCharts/BarList/BarListValue.js +16 -0
- package/dist/components/SimpleCharts/BarList/classes.d.ts +30 -0
- package/dist/components/SimpleCharts/BarList/classes.js +67 -0
- package/dist/components/SimpleCharts/BarList/index.d.ts +7 -0
- package/dist/components/SimpleCharts/BarList/index.js +8 -0
- package/dist/components/SimpleCharts/Chart/Chart.d.ts +6 -0
- package/dist/components/SimpleCharts/Chart/Chart.figma.d.ts +1 -0
- package/dist/components/SimpleCharts/Chart/Chart.figma.js +41 -0
- package/dist/components/SimpleCharts/Chart/Chart.js +17 -0
- package/dist/components/SimpleCharts/Chart/ChartActions.d.ts +10 -0
- package/dist/components/SimpleCharts/Chart/ChartActions.js +18 -0
- package/dist/components/SimpleCharts/Chart/ChartEmpty.d.ts +5 -0
- package/dist/components/SimpleCharts/Chart/ChartEmpty.js +22 -0
- package/dist/components/SimpleCharts/Chart/ChartHeader.d.ts +5 -0
- package/dist/components/SimpleCharts/Chart/ChartHeader.js +16 -0
- package/dist/components/SimpleCharts/Chart/ChartTitle.d.ts +5 -0
- package/dist/components/SimpleCharts/Chart/ChartTitle.js +23 -0
- package/dist/components/SimpleCharts/Chart/classes.d.ts +6 -0
- package/dist/components/SimpleCharts/Chart/classes.js +16 -0
- package/dist/components/SimpleCharts/Chart/index.d.ts +5 -0
- package/dist/components/SimpleCharts/Chart/index.js +6 -0
- package/dist/components/SimpleCharts/index.d.ts +2 -0
- package/dist/components/SimpleCharts/index.js +3 -0
- package/dist/components/SimpleCharts/types.d.ts +9 -0
- package/dist/components/TemporalCore/TemporalClear.js +8 -6
- package/dist/components/TemporalCore/TemporalSegment.js +28 -17
- package/dist/components/TemporalCore/TemporalSegmentGroup.js +26 -11
- package/dist/components/TemporalCore/TimeDropdown.js +1 -1
- package/dist/components/TemporalCore/index.d.ts +2 -0
- package/dist/components/TemporalCore/index.js +2 -1
- package/dist/components/TemporalCore/props.d.ts +42 -0
- package/dist/components/TemporalCore/props.js +0 -0
- package/dist/components/TemporalCore/utils.d.ts +8 -0
- package/dist/components/TemporalCore/utils.js +6 -1
- package/dist/components/TimeInput/TimeInput.d.ts +30 -17
- package/dist/components/TimeInput/TimeInput.js +49 -30
- package/dist/components/TimeInput/index.d.ts +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +4 -1
- package/dist/metadata/components.json +8164 -3590
- package/package.json +3 -2
- package/dist/components/DateInput/DateInputInternal.d.ts +0 -7
- package/dist/components/DateInput/types.d.ts +0 -22
- package/dist/components/DateRangeInput/DateRangeClear.d.ts +0 -2
- package/dist/components/DateRangeInput/DateRangeClear.js +0 -16
- package/dist/components/DateRangeInput/DateRangeEnd.d.ts +0 -2
- package/dist/components/DateRangeInput/DateRangeEnd.js +0 -30
- package/dist/components/DateRangeInput/DateRangeSegment.d.ts +0 -7
- package/dist/components/DateRangeInput/DateRangeSegment.js +0 -11
- package/dist/components/DateRangeInput/DateRangeStart.d.ts +0 -2
- package/dist/components/DateRangeInput/DateRangeStart.js +0 -30
- /package/dist/components/{DateInput → SimpleCharts}/types.js +0 -0
|
@@ -6,7 +6,7 @@ const CalendarContent = /*#__PURE__*/ forwardRef(({ children, className }, ref)=
|
|
|
6
6
|
children: /*#__PURE__*/ jsx(DatePicker.Positioner, {
|
|
7
7
|
children: /*#__PURE__*/ jsx(DatePicker.Content, {
|
|
8
8
|
ref: ref,
|
|
9
|
-
className: cn('flex bg-bg-surface-
|
|
9
|
+
className: cn('flex bg-bg-surface-2 rounded-12 shadow-md', 'border border-border-primary-light', 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95', 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95', className),
|
|
10
10
|
children: children
|
|
11
11
|
})
|
|
12
12
|
})
|
|
@@ -16,7 +16,7 @@ const CalendarGrid = ({ showArrows = true, showJumpToToday = false, monthOffset
|
|
|
16
16
|
const targetMonth = visibleRange.start.month;
|
|
17
17
|
return /*#__PURE__*/ jsxs(DatePicker.View, {
|
|
18
18
|
view: "day",
|
|
19
|
-
className: "flex flex-col
|
|
19
|
+
className: "flex flex-col",
|
|
20
20
|
children: [
|
|
21
21
|
/*#__PURE__*/ jsx(CalendarHeader, {
|
|
22
22
|
showArrows: showArrows,
|
|
@@ -59,7 +59,7 @@ const CalendarGrid = ({ showArrows = true, showJumpToToday = false, monthOffset
|
|
|
59
59
|
children: /*#__PURE__*/ jsx("div", {
|
|
60
60
|
className: cn('flex items-center justify-center relative', 'w-40 h-40 p-2'),
|
|
61
61
|
children: /*#__PURE__*/ jsx("span", {
|
|
62
|
-
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'text-text-secondary', (cellState.inRange || cellState.inHoveredRange) && 'bg-states-primary-pressed', cellState.selected && 'bg-bg-fill-brand text-text-primary-alt'),
|
|
62
|
+
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'text-text-secondary', (cellState.inRange || cellState.inHoveredRange) && 'bg-states-primary-pressed', cellState.selected && 'bg-bg-fill-brand text-text-primary-alt font-medium'),
|
|
63
63
|
children: day.day
|
|
64
64
|
})
|
|
65
65
|
})
|
|
@@ -77,11 +77,11 @@ const CalendarGrid = ({ showArrows = true, showJumpToToday = false, monthOffset
|
|
|
77
77
|
className: cn('flex items-center justify-center relative', 'w-40 h-40 p-2'),
|
|
78
78
|
children: [
|
|
79
79
|
/*#__PURE__*/ jsx("span", {
|
|
80
|
-
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'text-text-primary', (cellState.inRange || cellState.inHoveredRange) && 'bg-states-primary-pressed', cellState.selected && 'bg-bg-fill-brand text-text-primary-alt'),
|
|
80
|
+
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'text-text-primary', (cellState.inRange || cellState.inHoveredRange) && 'bg-states-primary-pressed', cellState.selected && 'bg-bg-fill-brand text-text-primary-alt font-medium'),
|
|
81
81
|
children: day.day
|
|
82
82
|
}),
|
|
83
83
|
isToday && /*#__PURE__*/ jsx("span", {
|
|
84
|
-
className: cn('absolute bottom-
|
|
84
|
+
className: cn('absolute bottom-7 left-1/2 -translate-x-1/2 w-4 h-4 rounded-full', 'bg-bg-fill-brand', cellState.selected && 'bg-text-primary-alt')
|
|
85
85
|
})
|
|
86
86
|
]
|
|
87
87
|
})
|
|
@@ -94,11 +94,11 @@ const CalendarGrid = ({ showArrows = true, showJumpToToday = false, monthOffset
|
|
|
94
94
|
className: cn('flex items-center justify-center relative', 'w-40 h-40 p-2', 'cursor-pointer select-none', 'outline-none'),
|
|
95
95
|
children: [
|
|
96
96
|
/*#__PURE__*/ jsx("span", {
|
|
97
|
-
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'transition-colors', '[[data-selected]_&]:bg-bg-fill-brand [[data-selected]_&]:text-text-primary-alt', '[[data-in-range]_&]:bg-states-primary-pressed', '[[data-outside-range]_&]:text-text-secondary', '[[data-disabled]_&]:cursor-not-allowed [[data-disabled]_&]:line-through [[data-disabled]_&]:text-text-secondary', 'not-[[data-selected]_&]:not-[[data-disabled]_&]:hover:bg-states-primary-hover', 'not-[[data-selected]_&]:not-[[data-disabled]_&]:active:bg-states-primary-pressed', '[:focus-visible_&]:ring-3 [:focus-visible_&]:ring-focus-primary', '[[data-selected]:focus-visible_&]:ring-focus-brand'),
|
|
97
|
+
className: cn('flex items-center justify-center', 'w-36 h-36 rounded-8', 'font-mono text-sm leading-sm', 'transition-colors', '[[data-selected]_&]:bg-bg-fill-brand [[data-selected]_&]:text-text-primary-alt [[data-selected]_&]:font-medium', '[[data-in-range]_&]:bg-states-primary-pressed', '[[data-outside-range]_&]:text-text-secondary', '[[data-disabled]_&]:cursor-not-allowed [[data-disabled]_&]:line-through [[data-disabled]_&]:text-text-secondary', 'not-[[data-selected]_&]:not-[[data-disabled]_&]:hover:bg-states-primary-hover', 'not-[[data-selected]_&]:not-[[data-disabled]_&]:active:bg-states-primary-pressed', '[:focus-visible_&]:ring-3 [:focus-visible_&]:ring-focus-primary', '[[data-selected]:focus-visible_&]:ring-focus-brand'),
|
|
98
98
|
children: day.day
|
|
99
99
|
}),
|
|
100
100
|
isToday && /*#__PURE__*/ jsx("span", {
|
|
101
|
-
className: cn('absolute bottom-
|
|
101
|
+
className: cn('absolute bottom-7 left-1/2 -translate-x-1/2 w-4 h-4 rounded-full', 'bg-bg-fill-brand', '[[data-selected]_&]:bg-text-primary-alt')
|
|
102
102
|
})
|
|
103
103
|
]
|
|
104
104
|
})
|
|
@@ -7,7 +7,7 @@ const CalendarGrids = /*#__PURE__*/ forwardRef(({ className }, ref)=>{
|
|
|
7
7
|
const { isRange } = useCalendarContext();
|
|
8
8
|
return /*#__PURE__*/ jsxs("div", {
|
|
9
9
|
ref: ref,
|
|
10
|
-
className: cn('flex px-12 pb-
|
|
10
|
+
className: cn('flex px-12 pb-8 first:pt-12', isRange && 'gap-12', className),
|
|
11
11
|
children: [
|
|
12
12
|
/*#__PURE__*/ jsx(CalendarGrid, {
|
|
13
13
|
showArrows: !isRange,
|
|
@@ -63,7 +63,7 @@ const CalendarHeader = ({ showArrows = true, showJumpToToday = false, visibleRan
|
|
|
63
63
|
api.setFocusedValue(todayDate);
|
|
64
64
|
},
|
|
65
65
|
children: /*#__PURE__*/ jsx(JumpToTodayIcon, {
|
|
66
|
-
size: "
|
|
66
|
+
size: "md"
|
|
67
67
|
})
|
|
68
68
|
})
|
|
69
69
|
}),
|
|
@@ -94,7 +94,7 @@ const CalendarHeader = ({ showArrows = true, showJumpToToday = false, visibleRan
|
|
|
94
94
|
size: "small",
|
|
95
95
|
"aria-label": "Previous month",
|
|
96
96
|
children: /*#__PURE__*/ jsx(ArrowLeft, {
|
|
97
|
-
size: "
|
|
97
|
+
size: "md"
|
|
98
98
|
})
|
|
99
99
|
})
|
|
100
100
|
})
|
|
@@ -116,7 +116,7 @@ const CalendarHeader = ({ showArrows = true, showJumpToToday = false, visibleRan
|
|
|
116
116
|
size: "small",
|
|
117
117
|
"aria-label": "Next month",
|
|
118
118
|
children: /*#__PURE__*/ jsx(ArrowRight, {
|
|
119
|
-
size: "
|
|
119
|
+
size: "md"
|
|
120
120
|
})
|
|
121
121
|
})
|
|
122
122
|
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { DatePicker } from "@ark-ui/react";
|
|
4
|
-
import { ArrowRight } from "../../icons/index.js";
|
|
5
4
|
import { cn } from "../../utils/cn.js";
|
|
6
5
|
import { DateInput } from "../DateInput/index.js";
|
|
7
6
|
import { useCalendarContext } from "./CalendarContext.js";
|
|
@@ -30,7 +29,7 @@ const SingleDateInputInner = ({ api, readonly })=>{
|
|
|
30
29
|
children: /*#__PURE__*/ jsx(DateInput, {
|
|
31
30
|
value: inputValue,
|
|
32
31
|
onChange: handleChange,
|
|
33
|
-
|
|
32
|
+
readOnly: readonly,
|
|
34
33
|
granularity: "day"
|
|
35
34
|
})
|
|
36
35
|
});
|
|
@@ -79,20 +78,18 @@ const RangeDateInputInner = ({ api, readonly })=>{
|
|
|
79
78
|
/*#__PURE__*/ jsx(DateInput, {
|
|
80
79
|
value: startValue,
|
|
81
80
|
onChange: handleStartChange,
|
|
82
|
-
|
|
81
|
+
readOnly: readonly,
|
|
83
82
|
granularity: "day"
|
|
84
83
|
}),
|
|
85
|
-
/*#__PURE__*/ jsx("
|
|
86
|
-
className: "flex items-center justify-center shrink-0 basis-20",
|
|
84
|
+
/*#__PURE__*/ jsx("span", {
|
|
85
|
+
className: "flex items-center justify-center shrink-0 basis-20 font-sans text-sm leading-sm text-text-secondary",
|
|
87
86
|
"aria-hidden": "true",
|
|
88
|
-
children:
|
|
89
|
-
size: "md"
|
|
90
|
-
})
|
|
87
|
+
children: "→"
|
|
91
88
|
}),
|
|
92
89
|
/*#__PURE__*/ jsx(DateInput, {
|
|
93
90
|
value: endValue,
|
|
94
91
|
onChange: handleEndChange,
|
|
95
|
-
|
|
92
|
+
readOnly: readonly,
|
|
96
93
|
granularity: "day"
|
|
97
94
|
})
|
|
98
95
|
]
|
|
@@ -9,21 +9,26 @@ const CalendarKeyboardHints = /*#__PURE__*/ forwardRef(({ className }, ref)=>/*#
|
|
|
9
9
|
/*#__PURE__*/ jsxs("div", {
|
|
10
10
|
className: "flex items-center gap-4",
|
|
11
11
|
children: [
|
|
12
|
-
/*#__PURE__*/
|
|
13
|
-
|
|
14
|
-
children:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13
|
+
className: "flex items-center gap-2",
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsx(Kbd, {
|
|
16
|
+
size: "small",
|
|
17
|
+
children: "←"
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx(Kbd, {
|
|
20
|
+
size: "small",
|
|
21
|
+
children: "↑"
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsx(Kbd, {
|
|
24
|
+
size: "small",
|
|
25
|
+
children: "↓"
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsx(Kbd, {
|
|
28
|
+
size: "small",
|
|
29
|
+
children: "→"
|
|
30
|
+
})
|
|
31
|
+
]
|
|
27
32
|
}),
|
|
28
33
|
/*#__PURE__*/ jsx("span", {
|
|
29
34
|
className: "font-sans font-medium text-xs text-text-secondary",
|
|
@@ -49,7 +54,7 @@ const CalendarKeyboardHints = /*#__PURE__*/ forwardRef(({ className }, ref)=>/*#
|
|
|
49
54
|
children: [
|
|
50
55
|
/*#__PURE__*/ jsx(Kbd, {
|
|
51
56
|
size: "small",
|
|
52
|
-
children: "
|
|
57
|
+
children: "ESC"
|
|
53
58
|
}),
|
|
54
59
|
/*#__PURE__*/ jsx("span", {
|
|
55
60
|
className: "font-sans font-medium text-xs text-text-secondary",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type DateOrder } from './context';
|
|
3
|
+
export interface DateFormatProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Order in which date segments render across every DS temporal input and
|
|
6
|
+
* the calendar. Set once at the app root.
|
|
7
|
+
*/
|
|
8
|
+
order: DateOrder;
|
|
9
|
+
/**
|
|
10
|
+
* Hour cycle applied to every DS temporal input with time segments and
|
|
11
|
+
* every time dropdown. `12` (AM/PM) or `24`. When omitted, the browser
|
|
12
|
+
* locale decides. Can be overridden per-input via the `hourCycle` prop.
|
|
13
|
+
*/
|
|
14
|
+
hourCycle?: 12 | 24;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Application-level provider for temporal display format.
|
|
19
|
+
*
|
|
20
|
+
* Mount once near the root — DateInput, DateRangeInput, TimeInput, and
|
|
21
|
+
* Calendar all pick up the chosen `order` and `hourCycle` via
|
|
22
|
+
* `useDateFormat`. If no provider is mounted, DS defaults to `day-first`
|
|
23
|
+
* order and locale-driven hour cycle.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <DateFormatProvider order='month-first' hourCycle={24}>
|
|
27
|
+
* <App />
|
|
28
|
+
* </DateFormatProvider>
|
|
29
|
+
*/
|
|
30
|
+
export declare const DateFormatProvider: FC<DateFormatProviderProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { DateFormatContext } from "./context.js";
|
|
4
|
+
const DateFormatProvider = ({ order, hourCycle, children })=>{
|
|
5
|
+
const value = useMemo(()=>({
|
|
6
|
+
order,
|
|
7
|
+
hourCycle
|
|
8
|
+
}), [
|
|
9
|
+
order,
|
|
10
|
+
hourCycle
|
|
11
|
+
]);
|
|
12
|
+
return /*#__PURE__*/ jsx(DateFormatContext.Provider, {
|
|
13
|
+
value: value,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
DateFormatProvider.displayName = 'DateFormatProvider';
|
|
18
|
+
export { DateFormatProvider };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order in which date segments are rendered by temporal inputs and the
|
|
3
|
+
* calendar.
|
|
4
|
+
*
|
|
5
|
+
* - `day-first` — "24 Apr, 2026" (segments: DD MMM YYYY)
|
|
6
|
+
* - `month-first` — "Apr 24, 2026" (segments: MMM DD YYYY)
|
|
7
|
+
*
|
|
8
|
+
* Year stays last in both; time segments, when present, are appended after
|
|
9
|
+
* the date with a leading space.
|
|
10
|
+
*/
|
|
11
|
+
export type DateOrder = 'day-first' | 'month-first';
|
|
12
|
+
export interface DateFormatContextValue {
|
|
13
|
+
order: DateOrder;
|
|
14
|
+
/**
|
|
15
|
+
* App-wide hour cycle — `12` (AM/PM) or `24`. When `undefined`, the
|
|
16
|
+
* browser locale decides (react-aria's default).
|
|
17
|
+
*
|
|
18
|
+
* Individual inputs can still override with an `hourCycle` prop for
|
|
19
|
+
* per-component exceptions. Precedence: prop > context > locale.
|
|
20
|
+
*/
|
|
21
|
+
hourCycle?: 12 | 24;
|
|
22
|
+
}
|
|
23
|
+
export declare const DateFormatContext: import("react").Context<DateFormatContextValue | undefined>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DateFormatContextValue } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Read the active date-segment order and hour cycle.
|
|
4
|
+
*
|
|
5
|
+
* Does **not** throw when called outside `DateFormatProvider` — formats are
|
|
6
|
+
* an optional app-level concern, so the hook falls back to `day-first`
|
|
7
|
+
* order and locale-driven hour cycle (`hourCycle: undefined`). This keeps
|
|
8
|
+
* every DS temporal input working out of the box in apps that haven't
|
|
9
|
+
* mounted the provider.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useDateFormat: () => DateFormatContextValue;
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { type FC, type Ref } from 'react';
|
|
2
|
+
import { type DateValue } from '@react-aria/datepicker';
|
|
3
|
+
import { type TemporalGranularity, type TemporalInputCommonProps, type TemporalInputTimeProps } from '../TemporalCore';
|
|
4
|
+
/**
|
|
5
|
+
* Subset of `@react-aria/datepicker`'s `AriaDateFieldProps` surfaced by DateInput.
|
|
6
|
+
*
|
|
7
|
+
* Declared explicitly (not via `Omit<AriaDateFieldProps, ...>`) so the DS public
|
|
8
|
+
* type doesn't track React-Aria's evolution — props are added here intentionally.
|
|
9
|
+
*/
|
|
10
|
+
interface DateInputAriaSubset {
|
|
11
|
+
value?: DateValue | null;
|
|
12
|
+
defaultValue?: DateValue | null;
|
|
13
|
+
onChange?: (value: DateValue | null) => void;
|
|
14
|
+
minValue?: DateValue;
|
|
15
|
+
maxValue?: DateValue;
|
|
16
|
+
placeholderValue?: DateValue;
|
|
17
|
+
name?: string;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
/** Marks the field as required in assistive tech and HTML form validation. */
|
|
20
|
+
isRequired?: boolean;
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
}
|
|
23
|
+
type DateOnlyGranularity = {
|
|
24
|
+
granularity?: 'day';
|
|
25
|
+
showTimeDropdown?: never;
|
|
26
|
+
timeStep?: never;
|
|
12
27
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* - 'second': Date with hours, minutes, and seconds
|
|
20
|
-
*/
|
|
21
|
-
granularity?: "day" | "hour" | "minute" | "second";
|
|
22
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
type DateTimeGranularity = {
|
|
29
|
+
granularity: Exclude<TemporalGranularity, 'day'>;
|
|
30
|
+
} & TemporalInputTimeProps;
|
|
31
|
+
export type DateInputProps = TemporalInputCommonProps & DateInputAriaSubset & (DateOnlyGranularity | DateTimeGranularity);
|
|
32
|
+
export declare const DateInput: FC<DateInputProps>;
|
|
33
|
+
export {};
|
|
@@ -1,54 +1,72 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from "react";
|
|
3
3
|
import { createCalendar } from "@internationalized/date";
|
|
4
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
4
5
|
import { useDateField } from "@react-aria/datepicker";
|
|
5
6
|
import { useLocale } from "@react-aria/i18n";
|
|
6
7
|
import { useDateFieldState } from "@react-stately/datepicker";
|
|
8
|
+
import { Calendar } from "../../icons/index.js";
|
|
7
9
|
import { cn } from "../../utils/cn.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
10
|
+
import { TestIdProvider } from "../../utils/testId.js";
|
|
11
|
+
import { useDateFormat } from "../DateFormatProvider/index.js";
|
|
12
|
+
import { getDefaultTemporalPlaceholder } from "../TemporalCore/index.js";
|
|
13
|
+
import { DateInputInternal } from "./internal/index.js";
|
|
14
|
+
const DateInput = (props)=>{
|
|
15
|
+
const { 'data-testid': testId, showIcon = true, value: controlledValue, defaultValue, onChange, error = false, disabled = false, readOnly = false, isRequired, granularity = 'day', showTimeDropdown, timeStep = 30, placeholder, size = 'default', minValue, maxValue, placeholderValue, name, autoFocus, ref, ...wrapperProps } = props;
|
|
16
|
+
const resolvedPlaceholder = placeholder ?? getDefaultTemporalPlaceholder({
|
|
17
|
+
granularity
|
|
18
|
+
});
|
|
19
|
+
const { hourCycle: resolvedHourCycle } = useDateFormat();
|
|
11
20
|
const { locale } = useLocale();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const { value, onChange: handleChange } = useTemporalField({
|
|
21
|
+
const internalRef = useRef(null);
|
|
22
|
+
const state = useDateFieldState({
|
|
15
23
|
value: controlledValue,
|
|
16
24
|
defaultValue,
|
|
17
|
-
onChange
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
onChange: handleChange,
|
|
25
|
+
onChange,
|
|
26
|
+
minValue,
|
|
27
|
+
maxValue,
|
|
28
|
+
placeholderValue,
|
|
29
|
+
isRequired,
|
|
23
30
|
locale,
|
|
24
31
|
isDisabled: disabled,
|
|
25
32
|
isInvalid: error,
|
|
33
|
+
isReadOnly: readOnly,
|
|
26
34
|
granularity,
|
|
27
|
-
hourCycle,
|
|
35
|
+
hourCycle: resolvedHourCycle,
|
|
28
36
|
createCalendar: createCalendar,
|
|
29
37
|
shouldForceLeadingZeros: true
|
|
30
38
|
});
|
|
31
39
|
const { fieldProps } = useDateField({
|
|
32
|
-
|
|
40
|
+
name,
|
|
41
|
+
autoFocus,
|
|
33
42
|
isDisabled: disabled,
|
|
34
|
-
isInvalid: error
|
|
35
|
-
|
|
43
|
+
isInvalid: error,
|
|
44
|
+
isReadOnly: readOnly,
|
|
45
|
+
isRequired
|
|
46
|
+
}, state, internalRef);
|
|
36
47
|
return /*#__PURE__*/ jsx("div", {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
...wrapperProps,
|
|
49
|
+
"data-slot": "date-input",
|
|
50
|
+
"data-testid": testId,
|
|
51
|
+
className: cn('min-w-256 flex-1', wrapperProps.className),
|
|
52
|
+
children: /*#__PURE__*/ jsx(TestIdProvider, {
|
|
53
|
+
value: testId,
|
|
54
|
+
children: /*#__PURE__*/ jsx(DateInputInternal, {
|
|
55
|
+
...fieldProps,
|
|
56
|
+
icon: showIcon ? Calendar : void 0,
|
|
57
|
+
ref: composeRefs(internalRef, ref),
|
|
58
|
+
state: state,
|
|
59
|
+
error: error,
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
readOnly: readOnly,
|
|
62
|
+
placeholder: resolvedPlaceholder,
|
|
63
|
+
showTimeDropdown: showTimeDropdown,
|
|
64
|
+
timeStep: timeStep,
|
|
65
|
+
hourCycle: resolvedHourCycle,
|
|
66
|
+
size: size
|
|
67
|
+
})
|
|
50
68
|
})
|
|
51
69
|
});
|
|
52
|
-
}
|
|
70
|
+
};
|
|
53
71
|
DateInput.displayName = 'DateInput';
|
|
54
72
|
export { DateInput };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FC, type Ref } from 'react';
|
|
2
|
+
import type { DateFieldState, TimeFieldState } from '@react-stately/datepicker';
|
|
3
|
+
import type { GroupDOMAttributes } from '@react-types/shared';
|
|
4
|
+
import type { SvgIconProps } from '../../../icons';
|
|
5
|
+
import { type TemporalInputSize, type TemporalInputTimeProps } from '../../TemporalCore';
|
|
6
|
+
/**
|
|
7
|
+
* Internal props — intentionally narrow. `TemporalInputCommonProps` is not
|
|
8
|
+
* extended here because it pulls in `HTMLAttributes<HTMLDivElement>`, whose
|
|
9
|
+
* `onAbort` handler collides with the one in `@react-types/shared`'s
|
|
10
|
+
* `GroupDOMAttributes`. The outer `DateInput` / `TimeInput` wrappers own the
|
|
11
|
+
* HTML-attribute surface; this internal only consumes the specific concerns
|
|
12
|
+
* it actually renders.
|
|
13
|
+
*/
|
|
14
|
+
interface DateInputInternalProps extends GroupDOMAttributes, TemporalInputTimeProps {
|
|
15
|
+
state: DateFieldState | TimeFieldState;
|
|
16
|
+
icon?: FC<SvgIconProps>;
|
|
17
|
+
ref?: Ref<HTMLDivElement>;
|
|
18
|
+
error?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
size?: TemporalInputSize;
|
|
23
|
+
/**
|
|
24
|
+
* Resolved hour cycle. The public `DateInput` / `TimeInput` wrappers read
|
|
25
|
+
* this from `DateFormatProvider` and pass it down — it isn't a public
|
|
26
|
+
* prop on those components.
|
|
27
|
+
*/
|
|
28
|
+
hourCycle?: 12 | 24;
|
|
29
|
+
}
|
|
30
|
+
export declare const DateInputInternal: FC<DateInputInternalProps>;
|
|
31
|
+
export {};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
3
|
import { CalendarDateTime, getLocalTimeZone, now } from "@internationalized/date";
|
|
4
|
-
import { cn } from "
|
|
5
|
-
import { InputGroup, InputGroupAddon } from "
|
|
6
|
-
import { TemporalClear, TemporalPlaceholder, TemporalSegmentGroup, TimeDropdown, useTimeDropdownKeyCapture } from "
|
|
7
|
-
|
|
4
|
+
import { cn } from "../../../utils/cn.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon } from "../../InputGroup/index.js";
|
|
6
|
+
import { TemporalClear, TemporalPlaceholder, TemporalSegmentGroup, TimeDropdown, useTimeDropdownKeyCapture } from "../../TemporalCore/index.js";
|
|
7
|
+
function anchorTimeToToday(timeValue) {
|
|
8
|
+
const t = now(getLocalTimeZone());
|
|
9
|
+
return new CalendarDateTime(t.year, t.month, t.day, timeValue.hour, timeValue.minute, 0);
|
|
10
|
+
}
|
|
11
|
+
const DateInputInternal = ({ state, icon: IconComponent, error, disabled, readOnly, placeholder, showTimeDropdown, timeStep, hourCycle, size, ref, ...props })=>{
|
|
8
12
|
const dropdownRef = useRef(null);
|
|
9
13
|
const [isFocused, setIsFocused] = useState(false);
|
|
10
14
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
11
15
|
const hasValue = state.segments.some((seg)=>seg.isEditable && !seg.isPlaceholder);
|
|
12
|
-
const showPlaceholder = placeholder && !hasValue && !isFocused;
|
|
16
|
+
const showPlaceholder = !!placeholder && !hasValue && !isFocused;
|
|
13
17
|
const hasTimeSegments = state.segments.some((seg)=>'hour' === seg.type || 'minute' === seg.type);
|
|
14
18
|
const hasDateSegments = state.segments.some((seg)=>'year' === seg.type || 'month' === seg.type || 'day' === seg.type);
|
|
15
19
|
const handleClear = ()=>{
|
|
@@ -24,23 +28,20 @@ const DateInputInternal = /*#__PURE__*/ forwardRef(({ state, icon: IconComponent
|
|
|
24
28
|
setIsDropdownOpen(false);
|
|
25
29
|
};
|
|
26
30
|
const handleTimeSelect = useCallback((timeValue)=>{
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
31
|
+
if (hasDateSegments) {
|
|
32
|
+
const dateState = state;
|
|
33
|
+
const current = dateState.value;
|
|
34
|
+
const next = current && 'hour' in current ? current.set({
|
|
29
35
|
hour: timeValue.hour,
|
|
30
36
|
minute: timeValue.minute,
|
|
31
37
|
second: 0,
|
|
32
38
|
millisecond: 0
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const today = now(getLocalTimeZone());
|
|
37
|
-
const newValue = new CalendarDateTime(today.year, today.month, today.day, timeValue.hour, timeValue.minute, 0);
|
|
38
|
-
state.setValue(newValue);
|
|
39
|
-
} else {
|
|
40
|
-
const todayDate = now(getLocalTimeZone());
|
|
41
|
-
const newValue = new CalendarDateTime(todayDate.year, todayDate.month, todayDate.day, timeValue.hour, timeValue.minute, 0);
|
|
42
|
-
state.setValue(newValue);
|
|
39
|
+
}) : anchorTimeToToday(timeValue);
|
|
40
|
+
dateState.setValue(next);
|
|
41
|
+
return;
|
|
43
42
|
}
|
|
43
|
+
const timeState = state;
|
|
44
|
+
timeState.setValue(anchorTimeToToday(timeValue));
|
|
44
45
|
}, [
|
|
45
46
|
state,
|
|
46
47
|
hasDateSegments
|
|
@@ -51,28 +52,32 @@ const DateInputInternal = /*#__PURE__*/ forwardRef(({ state, icon: IconComponent
|
|
|
51
52
|
dropdownRef,
|
|
52
53
|
onOpen: ()=>setIsDropdownOpen(true)
|
|
53
54
|
});
|
|
54
|
-
const currentTimeValue = state.value && hasTimeSegments ? state.value : null;
|
|
55
|
+
const currentTimeValue = null !== state.value && hasTimeSegments ? state.value : null;
|
|
55
56
|
return /*#__PURE__*/ jsxs(InputGroup, {
|
|
57
|
+
size: size,
|
|
56
58
|
children: [
|
|
57
59
|
IconComponent && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
58
60
|
children: /*#__PURE__*/ jsx(IconComponent, {})
|
|
59
61
|
}),
|
|
60
62
|
/*#__PURE__*/ jsxs("div", {
|
|
61
|
-
className: cn('relative flex-1', !IconComponent && 'pl-12'),
|
|
63
|
+
className: cn('relative flex-1 h-full', !IconComponent && 'pl-12'),
|
|
62
64
|
onKeyDownCapture: handleKeyDownCapture,
|
|
63
65
|
children: [
|
|
64
|
-
showPlaceholder && /*#__PURE__*/ jsx(TemporalPlaceholder, {
|
|
65
|
-
text: placeholder
|
|
66
|
+
showPlaceholder && placeholder && /*#__PURE__*/ jsx(TemporalPlaceholder, {
|
|
67
|
+
text: placeholder,
|
|
68
|
+
className: cn(!IconComponent && 'pl-12')
|
|
66
69
|
}),
|
|
67
70
|
/*#__PURE__*/ jsx(TemporalSegmentGroup, {
|
|
68
71
|
...props,
|
|
69
72
|
ref: ref,
|
|
70
73
|
"data-slot": "input",
|
|
71
|
-
className: cn('h-
|
|
74
|
+
className: cn('h-full', showPlaceholder && 'opacity-0', readOnly && 'cursor-not-allowed'),
|
|
72
75
|
"aria-invalid": error || void 0,
|
|
73
76
|
"aria-disabled": disabled || void 0,
|
|
77
|
+
"data-readonly": readOnly || void 0,
|
|
74
78
|
state: state,
|
|
75
79
|
disabled: disabled,
|
|
80
|
+
readOnly: readOnly,
|
|
76
81
|
onFocus: handleFocus,
|
|
77
82
|
onBlur: handleBlur
|
|
78
83
|
}),
|
|
@@ -87,7 +92,7 @@ const DateInputInternal = /*#__PURE__*/ forwardRef(({ state, icon: IconComponent
|
|
|
87
92
|
})
|
|
88
93
|
]
|
|
89
94
|
}),
|
|
90
|
-
hasValue && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
95
|
+
hasValue && !readOnly && /*#__PURE__*/ jsx(InputGroupAddon, {
|
|
91
96
|
align: "inline-end",
|
|
92
97
|
children: /*#__PURE__*/ jsx(TemporalClear, {
|
|
93
98
|
onClick: handleClear,
|
|
@@ -96,5 +101,6 @@ const DateInputInternal = /*#__PURE__*/ forwardRef(({ state, icon: IconComponent
|
|
|
96
101
|
})
|
|
97
102
|
]
|
|
98
103
|
});
|
|
99
|
-
}
|
|
104
|
+
};
|
|
105
|
+
DateInputInternal.displayName = 'DateInputInternal';
|
|
100
106
|
export { DateInputInternal };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DateInputInternal } from './DateInputInternal';
|