@povio/ui 2.2.12 → 2.3.0-rc.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/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
- package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +10 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +88 -9
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +10 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +94 -7
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +11 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +94 -9
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +76 -7
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +78 -61
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +11 -4
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +31 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +1 -0
- package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +81 -7
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +146 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +235 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +82 -7
- package/dist/components/inputs/Input/shared/InputContent.js +7 -6
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/InputItem.d.ts +16 -21
- package/dist/components/inputs/Inputs/InputItem.js +6 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +106 -25
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +102 -7
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +33 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +36 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +42 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +115 -5
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +4 -2
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +11 -3
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +27 -4
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +13 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +27 -4
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +77 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +200 -0
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +8 -3
- package/dist/components/inputs/Toggle/Toggle.js +6 -1
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +3 -4
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +13 -1
- package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
- package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
- package/dist/components/inputs/shared/input.cva.d.ts +10 -0
- package/dist/components/inputs/shared/input.cva.js +19 -1
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +13 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +47 -0
- package/dist/config/router.context.d.ts +3 -4
- package/dist/config/router.context.js +1 -3
- package/dist/config/uiConfig.context.d.ts +15 -3
- package/dist/config/uiConfig.context.js +16 -3
- package/dist/config/uiStyle.context.d.ts +27 -4
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +3 -0
- package/dist/hooks/useFilters.js +27 -23
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +27 -14
- package/dist/hooks/usePagination.js +8 -4
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +56 -0
- package/dist/hooks/useSorting.js +7 -4
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -3
- package/dist/tw-ui-plugin.js +2 -0
- package/dist/utils/date-time.utils.d.ts +31 -10
- package/dist/utils/date-time.utils.js +123 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/routing.utils.d.ts +1 -0
- package/dist/utils/routing.utils.js +14 -0
- package/package.json +2 -2
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
|
|
2
|
-
import { DateTimeIcon } from "../../../../assets/icons/DateTime.js";
|
|
3
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
4
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
5
|
-
import {
|
|
3
|
+
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
6
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
7
|
-
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
8
5
|
import { DateField } from "./DateField.js";
|
|
6
|
+
import { datePickerInputContentRow } from "./datePickerInput.cva.js";
|
|
7
|
+
import { getDatePickerTodayIcon } from "./datePickerTodayIcon.js";
|
|
9
8
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
10
9
|
import { InputClear } from "../../shared/InputClear.js";
|
|
11
10
|
import { inputBase, inputSize } from "../../shared/input.cva.js";
|
|
@@ -16,11 +15,13 @@ import { Button } from "react-aria-components";
|
|
|
16
15
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
17
16
|
import { getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
18
17
|
//#region src/components/inputs/DateTime/shared/DatePickerInput.tsx
|
|
19
|
-
var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, dateGranularity = "day", timeZone,
|
|
18
|
+
var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize = "none", todayIconPlacement = "content", isDirty, isRequired, disableManualEntry, autoFixYear = false, placeholder, className, onOpenDropdown, dateGranularity = "day", timeZone, isTimeOptional = false, format, ...props }) => {
|
|
19
|
+
const uiConfig = UIConfig.useConfig();
|
|
20
20
|
let effectiveTimeZone = getLocalTimeZone();
|
|
21
21
|
if (timeZone) effectiveTimeZone = timeZone;
|
|
22
22
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
23
23
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
24
|
+
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
24
25
|
const [canClear, setCanClear] = useState(false);
|
|
25
26
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
26
27
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -43,6 +44,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
43
44
|
if (endFieldProps) endFieldProps.onChange?.(null);
|
|
44
45
|
setCanClear(false);
|
|
45
46
|
fieldProps.onBlur?.(null);
|
|
47
|
+
endFieldProps?.onBlur?.(null);
|
|
46
48
|
},
|
|
47
49
|
getContainer: () => containerRef.current
|
|
48
50
|
}));
|
|
@@ -53,7 +55,10 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
53
55
|
dateFieldRef.current?.clearField();
|
|
54
56
|
fieldProps.onChange?.(null);
|
|
55
57
|
endDateFieldRef.current?.clearField();
|
|
58
|
+
endFieldProps?.onChange?.(null);
|
|
56
59
|
setCanClear(false);
|
|
60
|
+
fieldProps.onBlur?.(null);
|
|
61
|
+
endFieldProps?.onBlur?.(null);
|
|
57
62
|
};
|
|
58
63
|
const onToday = () => {
|
|
59
64
|
if (isDateTime) {
|
|
@@ -64,19 +69,32 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
64
69
|
fieldProps.onChange?.(today(effectiveTimeZone));
|
|
65
70
|
if (endFieldProps) endFieldProps.onChange?.(today(effectiveTimeZone));
|
|
66
71
|
}
|
|
72
|
+
fieldProps.onBlur?.(null);
|
|
73
|
+
endFieldProps?.onBlur?.(null);
|
|
67
74
|
};
|
|
68
75
|
const hidePlaceholder = as === "floating" && !fieldProps.value && !isFocused;
|
|
76
|
+
const todayIconComponent = getDatePickerTodayIcon(todayIcon);
|
|
77
|
+
const todayIconButton = todayIconComponent ? /* @__PURE__ */ jsx(InlineIconButton, {
|
|
78
|
+
label: "",
|
|
79
|
+
icon: todayIconComponent,
|
|
80
|
+
size: todayIconButtonSize,
|
|
81
|
+
onPress: onToday,
|
|
82
|
+
className: "relative z-1 !border-none"
|
|
83
|
+
}) : null;
|
|
84
|
+
const shouldRenderTodayIconWithFieldLabel = todayIconPlacement === "fieldLabel";
|
|
85
|
+
const pickerIcon = isDateTime ? uiConfig.dateInput.dateTimeIcon : uiConfig.dateInput.calendarIcon;
|
|
69
86
|
return /* @__PURE__ */ jsxs("div", {
|
|
70
87
|
ref: containerRef,
|
|
71
|
-
className: clsx(inputBaseCva({
|
|
88
|
+
className: clsx("group/date-picker-content relative flex min-w-input-width-min-width items-center justify-between gap-2", inputBaseCva({
|
|
72
89
|
variant,
|
|
73
90
|
as,
|
|
74
91
|
...props
|
|
75
|
-
}),
|
|
92
|
+
}), className),
|
|
76
93
|
"data-rac": "",
|
|
77
94
|
"data-datetime-input": "",
|
|
78
95
|
"data-hovered": isHovered || void 0,
|
|
79
96
|
"data-disabled": isDisabled || void 0,
|
|
97
|
+
"data-is-disabled": isDisabled || void 0,
|
|
80
98
|
"data-invalid": isInvalid || void 0,
|
|
81
99
|
"data-is-empty": fieldProps.value === null || void 0,
|
|
82
100
|
"data-focus-within": isFocused || void 0,
|
|
@@ -84,65 +102,64 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
84
102
|
"data-has-selection": fieldProps.value !== null || void 0,
|
|
85
103
|
"data-is-dirty": isDirty || void 0,
|
|
86
104
|
"data-is-required": isRequired || void 0,
|
|
105
|
+
"data-is-filled": fieldProps.value !== null || void 0,
|
|
87
106
|
...groupProps,
|
|
88
107
|
...focusWithinProps,
|
|
89
108
|
...hoverProps,
|
|
90
109
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
91
|
-
className: clsx(inputSizeCva({
|
|
110
|
+
className: clsx("flex w-full items-center gap-input-gap-input-text-to-elements pr-0!", inputSizeCva({
|
|
92
111
|
size,
|
|
93
112
|
as
|
|
94
|
-
})
|
|
95
|
-
children: [
|
|
96
|
-
as,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
]
|
|
145
|
-
})]
|
|
113
|
+
})),
|
|
114
|
+
children: [
|
|
115
|
+
as && ["filter", "floating"].includes(as) && headerProps && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
116
|
+
as,
|
|
117
|
+
...headerProps
|
|
118
|
+
}),
|
|
119
|
+
shouldRenderTodayIconWithFieldLabel && todayIconButton,
|
|
120
|
+
/* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: datePickerInputContentRowCva({ size }),
|
|
122
|
+
children: [
|
|
123
|
+
disableManualEntry && /* @__PURE__ */ jsx(Button, {
|
|
124
|
+
onPress: onOpenDropdown,
|
|
125
|
+
className: "absolute inset-0 z-0",
|
|
126
|
+
isDisabled
|
|
127
|
+
}),
|
|
128
|
+
!shouldRenderTodayIconWithFieldLabel && todayIconButton,
|
|
129
|
+
disableManualEntry && placeholder && !fieldProps.value ? /* @__PURE__ */ jsx(Typography, {
|
|
130
|
+
size: "label-1",
|
|
131
|
+
className: "text-text-default-3",
|
|
132
|
+
children: placeholder
|
|
133
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DateField, {
|
|
134
|
+
ref: dateFieldRef,
|
|
135
|
+
...fieldProps,
|
|
136
|
+
isDisabled,
|
|
137
|
+
isInvalid,
|
|
138
|
+
onClearChange,
|
|
139
|
+
hidePlaceholder,
|
|
140
|
+
disableManualEntry,
|
|
141
|
+
dateGranularity,
|
|
142
|
+
isTimeOptional,
|
|
143
|
+
format,
|
|
144
|
+
timeZone: effectiveTimeZone
|
|
145
|
+
}), endFieldProps && /* @__PURE__ */ jsxs(Fragment, { children: [!((as === "floating" || as === "filter") && hidePlaceholder) && /* @__PURE__ */ jsx("span", {
|
|
146
|
+
className: clsx("pointer-events-none select-none", isDisabled && "text-interactive-text-secondary-disabled"),
|
|
147
|
+
children: "–"
|
|
148
|
+
}), /* @__PURE__ */ jsx(DateField, {
|
|
149
|
+
ref: endDateFieldRef,
|
|
150
|
+
...endFieldProps,
|
|
151
|
+
isDisabled,
|
|
152
|
+
isInvalid,
|
|
153
|
+
onClearChange,
|
|
154
|
+
hidePlaceholder,
|
|
155
|
+
disableManualEntry,
|
|
156
|
+
isTimeOptional,
|
|
157
|
+
format,
|
|
158
|
+
timeZone: effectiveTimeZone
|
|
159
|
+
})] })] })
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
146
163
|
}), /* @__PURE__ */ jsxs("div", {
|
|
147
164
|
className: clsx(inputSizeCva({
|
|
148
165
|
size,
|
|
@@ -155,7 +172,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
155
172
|
label: "",
|
|
156
173
|
color: "secondary",
|
|
157
174
|
...buttonProps,
|
|
158
|
-
icon:
|
|
175
|
+
icon: pickerIcon,
|
|
159
176
|
isDisabled,
|
|
160
177
|
className: "border-0!"
|
|
161
178
|
})]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DateFieldState, DateSegment } from '@react-stately/datepicker';
|
|
2
|
+
import { HTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
3
|
interface DateSegmentProps {
|
|
3
4
|
state: DateFieldState;
|
|
4
5
|
segment: DateSegment;
|
|
@@ -8,4 +9,17 @@ interface DateSegmentProps {
|
|
|
8
9
|
}
|
|
9
10
|
export declare const getPlaceholder: (segment: DateSegment) => string | null;
|
|
10
11
|
export declare const DateSegmentItem: ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }: DateSegmentProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
interface DateSegmentItemViewProps {
|
|
13
|
+
ref?: Ref<HTMLDivElement>;
|
|
14
|
+
segmentProps?: HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
type?: DateSegment["type"];
|
|
16
|
+
text: ReactNode;
|
|
17
|
+
placeholder?: ReactNode;
|
|
18
|
+
isPlaceholder?: boolean;
|
|
19
|
+
isInputEmpty?: boolean;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
timePickerOnly?: boolean;
|
|
22
|
+
hidePlaceholder?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const DateSegmentItemView: ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder, }: DateSegmentItemViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
25
|
export {};
|
|
@@ -15,17 +15,30 @@ var getPlaceholder = (segment) => {
|
|
|
15
15
|
var DateSegmentItem = ({ segment, state, isDisabled, timePickerOnly, hidePlaceholder }) => {
|
|
16
16
|
const ref = useRef(null);
|
|
17
17
|
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
18
|
-
|
|
18
|
+
return /* @__PURE__ */ jsx(DateSegmentItemView, {
|
|
19
|
+
ref,
|
|
20
|
+
segmentProps,
|
|
21
|
+
type: segment.type,
|
|
22
|
+
text: segment.text,
|
|
23
|
+
placeholder: getPlaceholder(segment),
|
|
24
|
+
isPlaceholder: segment.isPlaceholder,
|
|
25
|
+
isInputEmpty: !state.value,
|
|
26
|
+
isDisabled,
|
|
27
|
+
timePickerOnly,
|
|
28
|
+
hidePlaceholder
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var DateSegmentItemView = ({ ref, segmentProps, type, text, placeholder, isPlaceholder, isInputEmpty, isDisabled, timePickerOnly, hidePlaceholder }) => {
|
|
19
32
|
return /* @__PURE__ */ jsx("div", {
|
|
20
33
|
...segmentProps,
|
|
21
34
|
ref,
|
|
22
|
-
className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", ["hour", "dayPeriod"].includes(
|
|
23
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
className: clsx("box-content rounded-input-rounding-default", isDisabled && "text-interactive-text-secondary-disabled", !isDisabled && isInputEmpty && "text-text-default-3 group-focus-within:text-text-default-1", !isDisabled && !isInputEmpty && "text-text-default-1", "focus-within:outline-1 focus-within:outline-interactive-contained-primary-idle focus-within:outline-offset-1", type && ["hour", "dayPeriod"].includes(type) && !timePickerOnly && "ml-1", hidePlaceholder && "opacity-0"),
|
|
36
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [isPlaceholder && /* @__PURE__ */ jsx("span", {
|
|
24
37
|
"aria-hidden": "true",
|
|
25
38
|
className: "pointer-events-none",
|
|
26
|
-
children:
|
|
27
|
-
}),
|
|
39
|
+
children: placeholder
|
|
40
|
+
}), isPlaceholder ? "" : text] })
|
|
28
41
|
});
|
|
29
42
|
};
|
|
30
43
|
//#endregion
|
|
31
|
-
export { DateSegmentItem, getPlaceholder };
|
|
44
|
+
export { DateSegmentItem, DateSegmentItemView, getPlaceholder };
|
|
@@ -9,6 +9,7 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
9
9
|
state: TimeFieldState;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
isDirty?: boolean;
|
|
12
|
+
isRequired?: boolean;
|
|
12
13
|
isInvalid?: boolean;
|
|
13
14
|
disableDropdown?: boolean;
|
|
14
15
|
headerProps?: FormFieldHeaderProps;
|
|
@@ -18,5 +19,5 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
18
19
|
className?: string;
|
|
19
20
|
onPress: () => void;
|
|
20
21
|
}
|
|
21
|
-
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClockIcon } from "../../../../assets/icons/Clock.js";
|
|
2
1
|
import { UIStyle } from "../../../../config/uiStyle.context.js";
|
|
3
2
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
|
+
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
4
|
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
5
5
|
import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
|
|
6
6
|
import { InputClear } from "../../shared/InputClear.js";
|
|
@@ -12,7 +12,8 @@ import { useState } from "react";
|
|
|
12
12
|
import { Button } from "react-aria-components";
|
|
13
13
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
14
14
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
15
|
-
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
15
|
+
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
16
|
+
const uiConfig = UIConfig.useConfig();
|
|
16
17
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
18
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
19
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -32,12 +33,15 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInva
|
|
|
32
33
|
"data-datetime-input": "",
|
|
33
34
|
"data-hovered": isHovered || void 0,
|
|
34
35
|
"data-disabled": isDisabled || void 0,
|
|
36
|
+
"data-is-disabled": isDisabled || void 0,
|
|
35
37
|
"data-invalid": isInvalid || void 0,
|
|
36
38
|
"data-is-empty": state.value === null || void 0,
|
|
37
39
|
"data-focus-within": isFocused || void 0,
|
|
38
40
|
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
39
41
|
"data-has-selection": state.value !== null || void 0,
|
|
40
42
|
"data-is-dirty": isDirty || void 0,
|
|
43
|
+
"data-is-required": isRequired || void 0,
|
|
44
|
+
"data-is-filled": state.value !== null || void 0,
|
|
41
45
|
...fieldProps,
|
|
42
46
|
...focusWithinProps,
|
|
43
47
|
...hoverProps,
|
|
@@ -72,13 +76,16 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInva
|
|
|
72
76
|
as
|
|
73
77
|
}), "flex items-center gap-input-gap-trailing-elements py-0! pl-0!"),
|
|
74
78
|
children: [isClearable && /* @__PURE__ */ jsx(InputClear, {
|
|
75
|
-
onClear: () =>
|
|
79
|
+
onClear: () => {
|
|
80
|
+
state.setValue(null);
|
|
81
|
+
fieldProps.onBlur?.(null);
|
|
82
|
+
},
|
|
76
83
|
show: canClear
|
|
77
84
|
}), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(InlineIconButton, {
|
|
78
85
|
label: "",
|
|
79
86
|
color: "secondary",
|
|
80
87
|
onPress,
|
|
81
|
-
icon:
|
|
88
|
+
icon: uiConfig.dateInput.timeIcon,
|
|
82
89
|
isDisabled,
|
|
83
90
|
className: "border-0!"
|
|
84
91
|
})]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IconButtonProps } from '../../../buttons/IconButton/IconButton';
|
|
2
|
+
export type DatePickerTodayIcon = boolean | IconButtonProps["icon"];
|
|
3
|
+
export type DatePickerTodayIconButtonSize = IconButtonProps["size"];
|
|
4
|
+
export type DatePickerTodayIconPlacement = "content" | "fieldLabel";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { InputSizeProps } from '../../shared/input.cva';
|
|
3
|
+
export declare const datePickerInputContentRow: (props?: ({
|
|
4
|
+
size?: "small" | "default" | "extra-small" | "large" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface DatePickerInputContentRowProps extends VariantProps<typeof datePickerInputContentRow>, InputSizeProps {
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/inputs/DateTime/shared/datePickerInput.cva.ts
|
|
3
|
+
var datePickerInputContentRow = cva("flex items-center gap-input-gap-input-text-to-elements", {
|
|
4
|
+
variants: { size: {
|
|
5
|
+
"extra-small": "",
|
|
6
|
+
small: "",
|
|
7
|
+
default: "",
|
|
8
|
+
large: ""
|
|
9
|
+
} },
|
|
10
|
+
defaultVariants: { size: "default" }
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { datePickerInputContentRow };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC, ReactElement, SVGProps } from 'react';
|
|
2
|
+
import { DatePickerTodayIcon, DatePickerTodayIconButtonSize } from './datePicker.types';
|
|
3
|
+
type TodayIconComponent = FC<SVGProps<SVGSVGElement>> | ReactElement;
|
|
4
|
+
export declare const getDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined) => TodayIconComponent | null;
|
|
5
|
+
export declare const renderDatePickerTodayIcon: (todayIcon: DatePickerTodayIcon | undefined, size?: DatePickerTodayIconButtonSize, className?: string) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconButton.js";
|
|
2
|
+
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/DateTime/shared/datePickerTodayIcon.tsx
|
|
5
|
+
var getDatePickerTodayIcon = (todayIcon) => {
|
|
6
|
+
if (!todayIcon) return null;
|
|
7
|
+
return todayIcon === true ? TodayIcon : todayIcon;
|
|
8
|
+
};
|
|
9
|
+
var renderDatePickerTodayIcon = (todayIcon, size = "none", className) => {
|
|
10
|
+
const icon = getDatePickerTodayIcon(todayIcon);
|
|
11
|
+
if (!icon) return;
|
|
12
|
+
return /* @__PURE__ */ jsx(InlineIconButton, {
|
|
13
|
+
label: "",
|
|
14
|
+
icon,
|
|
15
|
+
size,
|
|
16
|
+
staticRender: true,
|
|
17
|
+
className: className ?? "relative z-1 !border-none"
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getDatePickerTodayIcon, renderDatePickerTodayIcon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { DateValue, TimeValue } from 'react-aria';
|
|
3
|
+
interface StaticSegmentProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
hidePlaceholder?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface StaticCalendarDateSegmentsProps extends StaticSegmentProps {
|
|
8
|
+
value?: CalendarDate | null;
|
|
9
|
+
locale: string;
|
|
10
|
+
shouldForceLeadingZeros?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface StaticCalendarDateTimeSegmentsProps extends StaticSegmentProps {
|
|
13
|
+
value?: DateValue | null;
|
|
14
|
+
locale: string;
|
|
15
|
+
shouldForceLeadingZeros?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface StaticDateRangeSegmentsProps extends StaticSegmentProps {
|
|
18
|
+
start?: CalendarDate | null;
|
|
19
|
+
end?: CalendarDate | null;
|
|
20
|
+
locale: string;
|
|
21
|
+
shouldForceLeadingZeros?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface StaticTimeSegmentsProps extends StaticSegmentProps {
|
|
24
|
+
value?: TimeValue | null;
|
|
25
|
+
locale: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const getStaticCalendarDateSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const getStaticCalendarDateTimeSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticCalendarDateTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const getStaticDateRangeSegments: ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, }: StaticDateRangeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const getStaticTimeSegments: ({ value, locale, isDisabled, hidePlaceholder }: StaticTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DateSegmentItemView } from "./DateSegmentItem.js";
|
|
2
|
+
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/inputs/DateTime/shared/staticDateTimeSegments.tsx
|
|
5
|
+
var getStaticCalendarDateSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
6
|
+
const hasValue = !!value;
|
|
7
|
+
return renderStaticSegments(value ? DateTimeUtils.formatCalendarDateLocalized(value, locale, { shouldForceLeadingZeros }) : DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros }), {
|
|
8
|
+
isPlaceholder: !hasValue,
|
|
9
|
+
isInputEmpty: !hasValue,
|
|
10
|
+
isDisabled,
|
|
11
|
+
hidePlaceholder
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var getStaticCalendarDateTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
15
|
+
const hasValue = !!(value && "hour" in value);
|
|
16
|
+
return renderStaticSegments(hasValue ? DateTimeUtils.formatCalendarDateTimeLocalized(value, locale, { shouldForceLeadingZeros }) : DateTimeUtils.getDateTimePlaceholder(locale, { shouldForceLeadingZeros }), {
|
|
17
|
+
isPlaceholder: !hasValue,
|
|
18
|
+
isInputEmpty: !hasValue,
|
|
19
|
+
isDisabled,
|
|
20
|
+
hidePlaceholder
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder }) => {
|
|
24
|
+
const defaultPlaceholder = DateTimeUtils.getDatePlaceholder(locale, { shouldForceLeadingZeros });
|
|
25
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
renderStaticSegments(start ? DateTimeUtils.formatCalendarDateLocalized(start, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
|
|
27
|
+
isPlaceholder: !start,
|
|
28
|
+
isInputEmpty: !start,
|
|
29
|
+
isDisabled,
|
|
30
|
+
hidePlaceholder: hidePlaceholder && !start
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: isDisabled ? "pointer-events-none select-none text-interactive-text-secondary-disabled" : "pointer-events-none select-none",
|
|
34
|
+
children: "–"
|
|
35
|
+
}),
|
|
36
|
+
renderStaticSegments(end ? DateTimeUtils.formatCalendarDateLocalized(end, locale, { shouldForceLeadingZeros }) : defaultPlaceholder, {
|
|
37
|
+
isPlaceholder: !end,
|
|
38
|
+
isInputEmpty: !end,
|
|
39
|
+
isDisabled,
|
|
40
|
+
hidePlaceholder: hidePlaceholder && !end
|
|
41
|
+
})
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
var getStaticTimeSegments = ({ value, locale, isDisabled, hidePlaceholder }) => {
|
|
45
|
+
const hasValue = !!value;
|
|
46
|
+
return renderStaticSegments(value ? DateTimeUtils.formatTimeLocalized(value, locale) : DateTimeUtils.getTimePlaceholder(locale), {
|
|
47
|
+
isPlaceholder: !hasValue,
|
|
48
|
+
isInputEmpty: !hasValue,
|
|
49
|
+
isDisabled,
|
|
50
|
+
hidePlaceholder,
|
|
51
|
+
timePickerOnly: true
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var renderStaticSegments = (value, options) => {
|
|
55
|
+
return /* @__PURE__ */ jsx("div", {
|
|
56
|
+
className: "flex",
|
|
57
|
+
children: tokenizeStaticSegmentText(value).map((token, index) => /* @__PURE__ */ jsx(DateSegmentItemView, {
|
|
58
|
+
type: token.type,
|
|
59
|
+
text: getStaticSegmentText(token),
|
|
60
|
+
placeholder: getStaticSegmentText(token),
|
|
61
|
+
isPlaceholder: options.isPlaceholder && token.type !== "literal",
|
|
62
|
+
isInputEmpty: options.isInputEmpty,
|
|
63
|
+
isDisabled: options.isDisabled,
|
|
64
|
+
timePickerOnly: options.timePickerOnly,
|
|
65
|
+
hidePlaceholder: options.hidePlaceholder
|
|
66
|
+
}, index))
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
var tokenizeStaticSegmentText = (value) => {
|
|
70
|
+
return (value.match(/(\p{Letter}+|\p{Number}+|[^\p{Letter}\p{Number}]+)/gu) ?? [value]).map((text) => ({
|
|
71
|
+
text,
|
|
72
|
+
type: /^[^\p{Letter}\p{Number}]+$/u.test(text) ? "literal" : "day"
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
75
|
+
var getStaticSegmentText = (token) => {
|
|
76
|
+
if (token.type !== "literal") return token.text;
|
|
77
|
+
return token.text.replaceAll(" ", "\xA0");
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { getStaticCalendarDateSegments, getStaticCalendarDateTimeSegments, getStaticDateRangeSegments, getStaticTimeSegments };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -128,6 +128,7 @@ var FileUploadBase = (props) => {
|
|
|
128
128
|
...rest,
|
|
129
129
|
"data-rac": "",
|
|
130
130
|
"data-disabled": isDisabled || void 0,
|
|
131
|
+
"data-is-disabled": isDisabled || void 0,
|
|
131
132
|
"data-invalid": !!error || void 0,
|
|
132
133
|
"data-multiple": allowsMultiple || void 0,
|
|
133
134
|
"data-has-files": uploadState.length > 0 || void 0,
|
|
@@ -21,6 +21,7 @@ var InputUploadContent = (props) => {
|
|
|
21
21
|
children: /* @__PURE__ */ jsxs("div", {
|
|
22
22
|
"data-rac": "",
|
|
23
23
|
"data-disabled": isDisabled || void 0,
|
|
24
|
+
"data-is-disabled": isDisabled || void 0,
|
|
24
25
|
"data-invalid": !!error || void 0,
|
|
25
26
|
className: inputUploadButton({
|
|
26
27
|
variant,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, Ref } from 'react';
|
|
1
|
+
import { FocusEventHandler, MouseEventHandler, PropsWithChildren, Ref } from 'react';
|
|
2
2
|
import { FormFieldErrorProps } from './FormFieldError';
|
|
3
3
|
import { FormFieldHeaderProps } from './FormFieldHeader';
|
|
4
4
|
import { TextInputProps } from '../Input/TextInput/TextInput';
|
|
@@ -13,8 +13,8 @@ interface FormFieldComponentProps extends PropsWithChildren<FormFieldProps> {
|
|
|
13
13
|
labelProps?: FormFieldHeaderProps["labelProps"];
|
|
14
14
|
as?: TextInputProps["as"];
|
|
15
15
|
tabIndex?: number;
|
|
16
|
-
onMouseEnter?:
|
|
17
|
-
onFocusCapture?:
|
|
16
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
17
|
+
onFocusCapture?: FocusEventHandler<HTMLDivElement>;
|
|
18
18
|
}
|
|
19
19
|
export declare const FormField: ({ ref, as, label, tooltipText, helperText, isRequired, rightContent, isDisabled, error, hideLabel, headerClassName, errorClassName, children, className, labelProps, isHeaderHidden, tabIndex, onMouseEnter, onFocusCapture, }: FormFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMAttributes } from '@react-types/shared';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { LabelHTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
export interface FormFieldHeaderProps {
|
|
4
4
|
label: string;
|
|
5
5
|
tooltipText?: string;
|
|
@@ -9,6 +9,6 @@ export interface FormFieldHeaderProps {
|
|
|
9
9
|
isHeaderHidden?: boolean;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
className?: string;
|
|
12
|
-
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
12
|
+
labelProps?: DOMAttributes<HTMLLabelElement> & LabelHTMLAttributes<HTMLLabelElement>;
|
|
13
13
|
}
|
|
14
14
|
export declare const FormFieldHeader: ({ label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, isDisabled, className, labelProps, }: FormFieldHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { InfoIcon } from "../../../assets/icons/Info.js";
|
|
2
|
+
import { UIStyle } from "../../../config/uiStyle.context.js";
|
|
2
3
|
import { Typography } from "../../text/Typography/Typography.js";
|
|
3
4
|
import { Tooltip as Tooltip$1 } from "../../overlays/Tooltip/Tooltip.js";
|
|
4
5
|
import { FormFieldLabel } from "./FormFieldLabel.js";
|
|
6
|
+
import { formFieldHeader } from "./formFieldHeader.cva.js";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
import { clsx } from "clsx";
|
|
7
9
|
import { Focusable } from "react-aria-components";
|
|
8
10
|
//#region src/components/inputs/FormField/FormFieldHeader.tsx
|
|
9
11
|
var FormFieldHeader = ({ label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, isDisabled, className, labelProps }) => {
|
|
10
12
|
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
-
className: clsx(
|
|
13
|
+
className: clsx(UIStyle.useCva("formField.headerCva", formFieldHeader)({ visible: !isHeaderHidden }), className),
|
|
12
14
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
13
15
|
className: "flex items-start justify-between",
|
|
14
16
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMAttributes } from '@react-types/shared';
|
|
2
|
-
import { RefCallback } from 'react';
|
|
2
|
+
import { LabelHTMLAttributes, RefCallback } from 'react';
|
|
3
3
|
import { InputSizeProps } from '../shared/input.cva';
|
|
4
4
|
import { LabelBaseProps } from '../shared/label.cva';
|
|
5
5
|
export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
@@ -7,7 +7,7 @@ export interface FormFieldLabelProps extends LabelBaseProps, InputSizeProps {
|
|
|
7
7
|
isRequired?: boolean;
|
|
8
8
|
isDisabled?: boolean;
|
|
9
9
|
ref?: RefCallback<HTMLOrSVGElement>;
|
|
10
|
-
labelProps?: DOMAttributes<HTMLLabelElement>;
|
|
10
|
+
labelProps?: DOMAttributes<HTMLLabelElement> & LabelHTMLAttributes<HTMLLabelElement>;
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const FormFieldLabel: ({ ref, as, label, isRequired, isDisabled, labelProps, className, }: FormFieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const formFieldHeader: (props?: ({
|
|
3
|
+
visible?: boolean | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export interface FormFieldHeaderVariantProps extends VariantProps<typeof formFieldHeader> {
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
//#region src/components/inputs/FormField/formFieldHeader.cva.ts
|
|
3
|
+
var formFieldHeader = cva("", {
|
|
4
|
+
variants: { visible: {
|
|
5
|
+
true: "mb-1",
|
|
6
|
+
false: "sr-only"
|
|
7
|
+
} },
|
|
8
|
+
defaultVariants: { visible: true }
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { formFieldHeader };
|