@trackunit/react-form-components 1.13.13 → 1.14.5
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/index.cjs.js +7 -5
- package/index.esm.js +7 -5
- package/package.json +7 -7
package/index.cjs.js
CHANGED
|
@@ -137,7 +137,7 @@ const cvaInput$1 = cssClassVarianceUtilities.cvaMerge([
|
|
|
137
137
|
// ! The layout of the grid is critical to the functioning of the cvaInputItemPlacementManager 👇
|
|
138
138
|
// The min restriction of the middle column (--spacing-20) is
|
|
139
139
|
// effectively the minimum width available for the text input
|
|
140
|
-
"grid-cols-[min-
|
|
140
|
+
"grid-cols-[min-content_minmax(var(--spacing-20),1fr)_min-content]",
|
|
141
141
|
"grid-rows-1",
|
|
142
142
|
cvaInputBase(),
|
|
143
143
|
"focus-within:outline-native",
|
|
@@ -2230,7 +2230,7 @@ const ColorField = react.forwardRef(({ label, id, tip, helpText, errorMessage, h
|
|
|
2230
2230
|
isWarning,
|
|
2231
2231
|
className,
|
|
2232
2232
|
}), "data-testid": dataTestId ? `${dataTestId}-container` : undefined, style: style, children: [jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label", className: cvaInputColorField({ readOnly: renderAsReadonly }), "data-testid": dataTestId, defaultValue: defaultValue, disabled: renderAsDisabled, id: htmlForId, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, ref: innerRef, type: "color", value: innerValue }), jsxRuntime.jsx("input", { "aria-labelledby": htmlForId + "-label-text", className: cvaInputElement({
|
|
2233
|
-
className: tailwindMerge.twMerge("
|
|
2233
|
+
className: tailwindMerge.twMerge("focus-visible:outline-hidden px-1", inputClassName),
|
|
2234
2234
|
}), "data-testid": dataTestId ? `${dataTestId}-textField` : undefined, disabled: renderAsDisabled, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, type: "text", value: innerValue, ...inputProps }), jsxRuntime.jsx(GenericActionsRenderer, { disabled: renderAsDisabled || renderAsReadonly, fieldSize: fieldSize, genericAction: "edit", innerRef: innerRef, tooltipLabel: t("colorField.tooltip") })] }) }));
|
|
2235
2235
|
});
|
|
2236
2236
|
ColorField.displayName = "ColorField";
|
|
@@ -3401,7 +3401,7 @@ const cvaScheduleItem = cssClassVarianceUtilities.cvaMerge([
|
|
|
3401
3401
|
"grid",
|
|
3402
3402
|
"pb-4",
|
|
3403
3403
|
"gap-2",
|
|
3404
|
-
"grid-cols-[
|
|
3404
|
+
"grid-cols-[60px_200px_60px_2fr]",
|
|
3405
3405
|
"max-sm:grid-cols-1",
|
|
3406
3406
|
]);
|
|
3407
3407
|
const cvaScheduleItemText = cssClassVarianceUtilities.cvaMerge(["flex", "font-bold", "self-center"]);
|
|
@@ -3445,7 +3445,7 @@ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, in
|
|
|
3445
3445
|
onChange(newSchedule);
|
|
3446
3446
|
};
|
|
3447
3447
|
return (jsxRuntime.jsx("div", { className: className, "data-testid": dataTestId, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
|
|
3448
|
-
return (jsxRuntime.jsxs("div", { className: cvaScheduleItem(), children: [jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsxRuntime.jsx(reactComponents.Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsxRuntime.jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsxRuntime.jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxRuntime.jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[
|
|
3448
|
+
return (jsxRuntime.jsxs("div", { className: cvaScheduleItem(), children: [jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsxRuntime.jsx(reactComponents.Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsxRuntime.jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(reactComponents.Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsxRuntime.jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxRuntime.jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[100px_200px_60px_250px_250px] sm:gap-2", children: [jsxRuntime.jsx(Checkbox, { checked: isActive, "data-testid": `${dataTestId}-${key}-checkbox`, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(reactComponents.Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsxRuntime.jsx(Checkbox, { checked: isAllDay ? isActive : undefined, "data-testid": `${dataTestId}-${key}-allday-checkbox`, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsxRuntime.jsx(TimeRange, { "data-testid": `${dataTestId}-${key}-range`, disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: isAllDay ? undefined : range })] })] }, key + label));
|
|
3449
3449
|
}) }));
|
|
3450
3450
|
};
|
|
3451
3451
|
|
|
@@ -4082,7 +4082,9 @@ const ToggleSwitch = react.forwardRef(({ onChange, onClick, preventDefaultOnClic
|
|
|
4082
4082
|
const handleKeyPress = e => {
|
|
4083
4083
|
if (e.code === "Enter") {
|
|
4084
4084
|
e.preventDefault();
|
|
4085
|
-
!readOnly
|
|
4085
|
+
if (!readOnly) {
|
|
4086
|
+
inputRef.current?.click();
|
|
4087
|
+
}
|
|
4086
4088
|
}
|
|
4087
4089
|
// Space key is already supported natively by the input element
|
|
4088
4090
|
};
|
package/index.esm.js
CHANGED
|
@@ -136,7 +136,7 @@ const cvaInput$1 = cvaMerge([
|
|
|
136
136
|
// ! The layout of the grid is critical to the functioning of the cvaInputItemPlacementManager 👇
|
|
137
137
|
// The min restriction of the middle column (--spacing-20) is
|
|
138
138
|
// effectively the minimum width available for the text input
|
|
139
|
-
"grid-cols-[min-
|
|
139
|
+
"grid-cols-[min-content_minmax(var(--spacing-20),1fr)_min-content]",
|
|
140
140
|
"grid-rows-1",
|
|
141
141
|
cvaInputBase(),
|
|
142
142
|
"focus-within:outline-native",
|
|
@@ -2229,7 +2229,7 @@ const ColorField = forwardRef(({ label, id, tip, helpText, errorMessage, helpAdd
|
|
|
2229
2229
|
isWarning,
|
|
2230
2230
|
className,
|
|
2231
2231
|
}), "data-testid": dataTestId ? `${dataTestId}-container` : undefined, style: style, children: [jsx("input", { "aria-labelledby": htmlForId + "-label", className: cvaInputColorField({ readOnly: renderAsReadonly }), "data-testid": dataTestId, defaultValue: defaultValue, disabled: renderAsDisabled, id: htmlForId, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, ref: innerRef, type: "color", value: innerValue }), jsx("input", { "aria-labelledby": htmlForId + "-label-text", className: cvaInputElement({
|
|
2232
|
-
className: twMerge("
|
|
2232
|
+
className: twMerge("focus-visible:outline-hidden px-1", inputClassName),
|
|
2233
2233
|
}), "data-testid": dataTestId ? `${dataTestId}-textField` : undefined, disabled: renderAsDisabled, onBlur: handleBlur, onChange: handleInputChange, readOnly: renderAsReadonly, type: "text", value: innerValue, ...inputProps }), jsx(GenericActionsRenderer, { disabled: renderAsDisabled || renderAsReadonly, fieldSize: fieldSize, genericAction: "edit", innerRef: innerRef, tooltipLabel: t("colorField.tooltip") })] }) }));
|
|
2234
2234
|
});
|
|
2235
2235
|
ColorField.displayName = "ColorField";
|
|
@@ -3400,7 +3400,7 @@ const cvaScheduleItem = cvaMerge([
|
|
|
3400
3400
|
"grid",
|
|
3401
3401
|
"pb-4",
|
|
3402
3402
|
"gap-2",
|
|
3403
|
-
"grid-cols-[
|
|
3403
|
+
"grid-cols-[60px_200px_60px_2fr]",
|
|
3404
3404
|
"max-sm:grid-cols-1",
|
|
3405
3405
|
]);
|
|
3406
3406
|
const cvaScheduleItemText = cvaMerge(["flex", "font-bold", "self-center"]);
|
|
@@ -3444,7 +3444,7 @@ const Schedule = ({ className, "data-testid": dataTestId, schedule, onChange, in
|
|
|
3444
3444
|
onChange(newSchedule);
|
|
3445
3445
|
};
|
|
3446
3446
|
return (jsx("div", { className: className, "data-testid": dataTestId, children: schedule.map(({ label, range, isActive, key, checkboxLabel, isAllDay }, index) => {
|
|
3447
|
-
return (jsxs("div", { className: cvaScheduleItem(), children: [jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsx(Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[
|
|
3447
|
+
return (jsxs("div", { className: cvaScheduleItem(), children: [jsxs("div", { className: "grid grid-cols-2 gap-4 sm:hidden", children: [jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.day") }), jsx(Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.active") }), jsx(Checkbox, { checked: isActive, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsx(Text, { className: "font-medium text-neutral-500", children: t("schedule.label.allDay") }), jsx(Checkbox, { checked: isAllDay ? isActive : undefined, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsx(TimeRange, { disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: range })] }), jsxs("div", { className: "max-sm:hidden sm:grid sm:grid-cols-[100px_200px_60px_250px_250px] sm:gap-2", children: [jsx(Checkbox, { checked: isActive, "data-testid": `${dataTestId}-${key}-checkbox`, label: checkboxLabel, onChange: (event) => onActiveChange(Boolean(event.currentTarget.checked), index) }), jsx(Text, { className: cvaScheduleItemText(), size: "medium", subtle: !isActive, children: label }), jsx(Checkbox, { checked: isAllDay ? isActive : undefined, "data-testid": `${dataTestId}-${key}-allday-checkbox`, disabled: !isActive, onChange: (event) => onAllDayChange(Boolean(event.currentTarget.checked), index) }), jsx(TimeRange, { "data-testid": `${dataTestId}-${key}-range`, disabled: !isActive || isAllDay, isInvalid: !!invalidKeys.find((invalidKey) => invalidKey === key), onChange: (newRange) => onRangeChange(newRange, index), range: isAllDay ? undefined : range })] })] }, key + label));
|
|
3448
3448
|
}) }));
|
|
3449
3449
|
};
|
|
3450
3450
|
|
|
@@ -4081,7 +4081,9 @@ const ToggleSwitch = forwardRef(({ onChange, onClick, preventDefaultOnClick, cla
|
|
|
4081
4081
|
const handleKeyPress = e => {
|
|
4082
4082
|
if (e.code === "Enter") {
|
|
4083
4083
|
e.preventDefault();
|
|
4084
|
-
!readOnly
|
|
4084
|
+
if (!readOnly) {
|
|
4085
|
+
inputRef.current?.click();
|
|
4086
|
+
}
|
|
4085
4087
|
}
|
|
4086
4088
|
// Space key is already supported natively by the input element
|
|
4087
4089
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"zod": "^3.23.8",
|
|
15
15
|
"react-hook-form": "7.62.0",
|
|
16
16
|
"tailwind-merge": "^2.0.0",
|
|
17
|
-
"@trackunit/css-class-variance-utilities": "1.11.
|
|
18
|
-
"@trackunit/react-components": "1.
|
|
19
|
-
"@trackunit/ui-icons": "1.11.
|
|
20
|
-
"@trackunit/shared-utils": "1.13.
|
|
21
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
22
|
-
"@trackunit/i18n-library-translation": "1.12.
|
|
17
|
+
"@trackunit/css-class-variance-utilities": "1.11.32",
|
|
18
|
+
"@trackunit/react-components": "1.17.3",
|
|
19
|
+
"@trackunit/ui-icons": "1.11.31",
|
|
20
|
+
"@trackunit/shared-utils": "1.13.32",
|
|
21
|
+
"@trackunit/ui-design-tokens": "1.11.32",
|
|
22
|
+
"@trackunit/i18n-library-translation": "1.12.16",
|
|
23
23
|
"string-ts": "^2.0.0",
|
|
24
24
|
"@js-temporal/polyfill": "^0.5.1",
|
|
25
25
|
"es-toolkit": "^1.39.10",
|