@trackunit/react-form-components 1.15.9 → 1.15.10-alpha-ae1ff73fc64.0
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 +45 -45
- package/index.esm.js +45 -45
- package/package.json +8 -8
- package/src/components/ActionButton/ActionButton.variants.d.ts +2 -2
- package/src/components/BaseInput/BaseInput.variants.d.ts +12 -12
- package/src/components/BaseSelect/BaseSelect.variants.d.ts +15 -15
- package/src/components/Checkbox/Checkbox.variants.d.ts +3 -3
- package/src/components/ColorField/ColorField.variants.d.ts +1 -1
- package/src/components/DropZone/DropZone.variants.d.ts +3 -3
- package/src/components/FormGroup/FormGroup.variants.d.ts +4 -4
- package/src/components/Label/Label.variants.d.ts +1 -1
- package/src/components/OptionCard/OptionCard.variants.d.ts +8 -8
- package/src/components/RadioGroup/RadioGroup.variants.d.ts +2 -2
- package/src/components/Schedule/Schedule.variants.d.ts +2 -2
- package/src/components/Search/Search.variants.d.ts +1 -1
- package/src/components/TextAreaField/TextArea/TextAreaBaseInput.variants.d.ts +1 -1
- package/src/components/TimeRange/TimeRange.variants.d.ts +1 -1
- package/src/components/ToggleSwitch/ToggleSwitch.variants.d.ts +4 -4
- package/src/components/UploadInput/UploadInput.variants.d.ts +1 -1
- package/src/shared-cva/BinaryControlItem.variants.d.ts +5 -5
package/index.cjs.js
CHANGED
|
@@ -279,7 +279,7 @@ const cvaInputSuffix = cssClassVarianceUtilities.cvaMerge(["flex", "justify-cent
|
|
|
279
279
|
* Renders the addon element if provided
|
|
280
280
|
*/
|
|
281
281
|
const AddonRenderer = ({ addon, "data-testid": dataTestId, className, fieldSize, position, }) => {
|
|
282
|
-
if (
|
|
282
|
+
if (addon === undefined || addon === null) {
|
|
283
283
|
return null;
|
|
284
284
|
}
|
|
285
285
|
return (jsxRuntime.jsx("div", { className: cvaInputAddon({ size: fieldSize, position, className }), "data-testid": dataTestId ? `${dataTestId}-addon${stringTs.titleCase(position)}` : null, children: addon }));
|
|
@@ -407,8 +407,8 @@ const PrefixRenderer = ({ prefix, type, "data-testid": dataTestId, disabled, ref
|
|
|
407
407
|
url: jsxRuntime.jsx(reactComponents.Icon, { name: "Link", size: "small" }),
|
|
408
408
|
};
|
|
409
409
|
// Decide what to show as prefix
|
|
410
|
-
const resolvedPrefix = prefix
|
|
411
|
-
if (
|
|
410
|
+
const resolvedPrefix = prefix ?? (type !== undefined && type !== "text" ? (defaultPrefixMap[type] ?? null) : null);
|
|
411
|
+
if (resolvedPrefix === null) {
|
|
412
412
|
return null;
|
|
413
413
|
}
|
|
414
414
|
return (jsxRuntime.jsx("div", { className: cvaInputPrefix({ disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: ref, children: resolvedPrefix }));
|
|
@@ -417,7 +417,7 @@ const PrefixRenderer = ({ prefix, type, "data-testid": dataTestId, disabled, ref
|
|
|
417
417
|
// Renders the suffix element or shows an icon if invalid/warning
|
|
418
418
|
const SuffixRenderer = ({ suffix, isInvalid, isWarning, "data-testid": dataTestId, disabled, }) => {
|
|
419
419
|
// If user provided suffix that's not identical to addonBefore, render it
|
|
420
|
-
if (suffix) {
|
|
420
|
+
if (suffix !== undefined && suffix !== null) {
|
|
421
421
|
return (jsxRuntime.jsx("div", { className: cvaInputSuffix({
|
|
422
422
|
disabled,
|
|
423
423
|
}), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix }));
|
|
@@ -1595,13 +1595,8 @@ autoComplete, // see https://github.com/JedWatson/react-select/issues/758
|
|
|
1595
1595
|
return (jsxRuntime.jsx(ReactSelect.components.ValueContainer, { ...selectValueContainer, className: cvaSelectValueContainer({ className: selectValueContainer.className }), getStyles: getNoStyles, innerProps: {
|
|
1596
1596
|
...selectValueContainer.innerProps,
|
|
1597
1597
|
ref: reactComponents.useMergeRefs([setValueContainerRef, selectValueContainer.innerProps?.ref]),
|
|
1598
|
-
}, children: selectValueContainer.isMulti ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getPlaceholderElement(selectValueContainer.children), currentWithCounter && !currentIsComplete ? (
|
|
1599
|
-
|
|
1600
|
-
// will be removed when the calculation is complete
|
|
1601
|
-
jsxRuntime.jsx(CounterTag, { className: "invisible" // Is invisible because we're only putting it here to measure the width
|
|
1602
|
-
, "data-testid": "fake-multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setFakeCounterRef, totalCount: currentTotalCount })) : null, getMultiValueComponents(selectValueContainer.children), currentWithCounter && currentIsComplete ? (
|
|
1603
|
-
// This is the actual tag that will be visible in the UI
|
|
1604
|
-
jsxRuntime.jsx(CounterTag, { "data-testid": dataTestId ? `${dataTestId}-multiselect-counter` : "multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setCounterRef, totalCount: currentTotalCount })) : null, getInputComponent(selectValueContainer.children)] })) : (selectValueContainer.children) }));
|
|
1598
|
+
}, children: selectValueContainer.isMulti ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getPlaceholderElement(selectValueContainer.children), currentWithCounter && !currentIsComplete ? (jsxRuntime.jsx(CounterTag, { className: "invisible" // Is invisible because we're only putting it here to measure the width
|
|
1599
|
+
, "data-testid": "fake-multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setFakeCounterRef, totalCount: currentTotalCount })) : null, getMultiValueComponents(selectValueContainer.children), currentWithCounter && currentIsComplete ? (jsxRuntime.jsx(CounterTag, { "data-testid": dataTestId ? `${dataTestId}-multiselect-counter` : "multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setCounterRef, totalCount: currentTotalCount })) : null, getInputComponent(selectValueContainer.children)] })) : (selectValueContainer.children) }));
|
|
1605
1600
|
},
|
|
1606
1601
|
IndicatorSeparator: () => null,
|
|
1607
1602
|
Input: selectInput => {
|
|
@@ -2087,7 +2082,7 @@ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon,
|
|
|
2087
2082
|
const color = isInvalid ? "danger" : isWarning ? "warning" : null;
|
|
2088
2083
|
return color ? jsxRuntime.jsx(reactComponents.Icon, { color: color, name: "ExclamationTriangle", size: "small" }) : null;
|
|
2089
2084
|
}, [isInvalid, isWarning]);
|
|
2090
|
-
return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsxRuntime.jsx("span", { children: "*" }) })) : null] }), tip ? (jsxRuntime.jsx("span", { className: "ml-1", children: jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" }) })) : null] })) : null, children, helpText || helpAddon ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxRuntime.jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsxRuntime.jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsxRuntime.jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
|
|
2085
|
+
return (jsxRuntime.jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label !== undefined && label !== null ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsxRuntime.jsx("span", { children: "*" }) })) : null] }), tip !== undefined && tip !== null ? (jsxRuntime.jsx("span", { className: "ml-1", children: jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" }) })) : null] })) : null, children, ((helpText !== undefined && helpText !== null) || (helpAddon !== undefined && helpAddon !== null)) ? (jsxRuntime.jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxRuntime.jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsxRuntime.jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon !== undefined && helpAddon !== null ? (jsxRuntime.jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
|
|
2091
2086
|
};
|
|
2092
2087
|
|
|
2093
2088
|
/**
|
|
@@ -2147,13 +2142,13 @@ const isNumber = (inputValue) => {
|
|
|
2147
2142
|
* Validates a url
|
|
2148
2143
|
*/
|
|
2149
2144
|
const validateColorCode = (colorCode, required) => {
|
|
2150
|
-
if (
|
|
2145
|
+
if ((colorCode === undefined || colorCode === "" || colorCode === 0) && !required) {
|
|
2151
2146
|
return undefined;
|
|
2152
2147
|
}
|
|
2153
|
-
if (
|
|
2148
|
+
if ((colorCode === undefined || colorCode === "" || colorCode === 0) && required) {
|
|
2154
2149
|
return "REQUIRED";
|
|
2155
2150
|
}
|
|
2156
|
-
if (colorCode && isString(colorCode) && isValidHEXColor(colorCode)) {
|
|
2151
|
+
if (colorCode !== undefined && colorCode !== "" && colorCode !== 0 && isString(colorCode) && isValidHEXColor(colorCode)) {
|
|
2157
2152
|
return undefined;
|
|
2158
2153
|
}
|
|
2159
2154
|
return "INVALID_HEX_CODE";
|
|
@@ -2339,7 +2334,7 @@ ColorField.displayName = "ColorField";
|
|
|
2339
2334
|
const DateField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, "data-testid": dataTestId, ref, ...rest }) => {
|
|
2340
2335
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
2341
2336
|
const htmlForId = id ? id : "dateField-" + sharedUtils.uuidv4();
|
|
2342
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(DateBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2337
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(DateBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2343
2338
|
};
|
|
2344
2339
|
DateField.displayName = "DateField";
|
|
2345
2340
|
|
|
@@ -2533,13 +2528,13 @@ const validateEmailAddress = (email) => {
|
|
|
2533
2528
|
* Validates a email id
|
|
2534
2529
|
*/
|
|
2535
2530
|
const validateEmailId = (emailId, required) => {
|
|
2536
|
-
if (
|
|
2531
|
+
if ((emailId === undefined || emailId === "" || emailId === 0) && !required) {
|
|
2537
2532
|
return undefined;
|
|
2538
2533
|
}
|
|
2539
|
-
if (
|
|
2534
|
+
if ((emailId === undefined || emailId === "" || emailId === 0) && required) {
|
|
2540
2535
|
return "REQUIRED";
|
|
2541
2536
|
}
|
|
2542
|
-
if (emailId && isString(emailId) && validateEmailAddress(emailId)) {
|
|
2537
|
+
if (emailId !== undefined && emailId !== "" && emailId !== 0 && isString(emailId) && validateEmailAddress(emailId)) {
|
|
2543
2538
|
return undefined;
|
|
2544
2539
|
}
|
|
2545
2540
|
return "INVALID_EMAIL";
|
|
@@ -2624,7 +2619,7 @@ const EmailField = ({ label, id, tip, helpText, errorMessage, helpAddon, classNa
|
|
|
2624
2619
|
const [innerValue, setInnerValue] = react.useState(() => {
|
|
2625
2620
|
return (value?.toString() || defaultValue?.toString()) ?? "";
|
|
2626
2621
|
});
|
|
2627
|
-
const [renderAsInvalid, setRenderAsInvalid] = react.useState(!!errorMessage || (value &&
|
|
2622
|
+
const [renderAsInvalid, setRenderAsInvalid] = react.useState(!!errorMessage || (typeof value === "string" && value !== "" && !validateEmailAddress(value)) || isInvalid);
|
|
2628
2623
|
const errorType = react.useMemo(() => validateEmailId(innerValue ?? "", rest.required), [rest.required, innerValue]);
|
|
2629
2624
|
const error = react.useMemo(() => (errorType ? t(`emailField.error.${errorType}`) : errorMessage), [errorType, errorMessage, t]);
|
|
2630
2625
|
const handleBlur = react.useCallback(event => {
|
|
@@ -2639,7 +2634,7 @@ const EmailField = ({ label, id, tip, helpText, errorMessage, helpAddon, classNa
|
|
|
2639
2634
|
onChange(event);
|
|
2640
2635
|
}
|
|
2641
2636
|
}, [onChange]);
|
|
2642
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(EmailBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2637
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(EmailBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2643
2638
|
};
|
|
2644
2639
|
EmailField.displayName = "EmailField";
|
|
2645
2640
|
|
|
@@ -2810,19 +2805,24 @@ const validateNumber = (number, required = false, min, max) => {
|
|
|
2810
2805
|
return undefined;
|
|
2811
2806
|
}
|
|
2812
2807
|
// if the value is a string eg:'test'
|
|
2813
|
-
if (number && !isNaN(+number) === false) {
|
|
2808
|
+
if (number !== "" && number !== 0 && !isNaN(+number) === false) {
|
|
2814
2809
|
return "INVALID_NUMBER";
|
|
2815
2810
|
}
|
|
2816
2811
|
// if the value is empty and not required
|
|
2817
|
-
if (
|
|
2812
|
+
if ((parsedNumber === 0 || Number.isNaN(parsedNumber)) &&
|
|
2813
|
+
!required &&
|
|
2814
|
+
(min === undefined || min === "" || min === 0) &&
|
|
2815
|
+
(max === undefined || max === "" || max === 0) &&
|
|
2816
|
+
number !== "" &&
|
|
2817
|
+
number !== 0) {
|
|
2818
2818
|
return undefined;
|
|
2819
2819
|
}
|
|
2820
2820
|
// if the value is empty and required
|
|
2821
|
-
if (required &&
|
|
2821
|
+
if (required && (number === "" || number === 0)) {
|
|
2822
2822
|
return "REQUIRED";
|
|
2823
2823
|
}
|
|
2824
2824
|
// if the value is not in between min and max
|
|
2825
|
-
if (minValue && maxValue && isNumberValid(parsedNumber) && !(parsedNumber >= minValue && parsedNumber <= maxValue)) {
|
|
2825
|
+
if (minValue !== undefined && maxValue !== undefined && isNumberValid(parsedNumber) && !(parsedNumber >= minValue && parsedNumber <= maxValue)) {
|
|
2826
2826
|
return "NOT_IN_BETWEEN";
|
|
2827
2827
|
}
|
|
2828
2828
|
// if the value is less than min
|
|
@@ -2933,7 +2933,7 @@ const NumberField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInva
|
|
|
2933
2933
|
onChange(event);
|
|
2934
2934
|
}
|
|
2935
2935
|
}, [onChange]);
|
|
2936
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(NumberBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2936
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(NumberBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2937
2937
|
};
|
|
2938
2938
|
NumberField.displayName = "NumberField";
|
|
2939
2939
|
|
|
@@ -3018,10 +3018,10 @@ const cvaTag = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
3018
3018
|
*/
|
|
3019
3019
|
const OptionCard = ({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, "data-testid": dataTestId, customImage, layout = "default", ref, tagProps, ...rest }) => {
|
|
3020
3020
|
const htmlForId = id ?? "option-card-" + sharedUtils.uuidv4();
|
|
3021
|
-
const subContent = react.useMemo(() => (jsxRuntime.jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardText({ type: "subheading", disabled }), type: "span", children: subheading })) : null, description ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardText({ type: "description", disabled }), type: "span", children: description })) : null] })), [subheading, description, contentClassName, disabled]);
|
|
3022
|
-
return (jsxRuntime.jsx(reactComponents.Tooltip, { disabled: layout !== "compact" || (
|
|
3021
|
+
const subContent = react.useMemo(() => (jsxRuntime.jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading !== undefined && subheading !== null ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardText({ type: "subheading", disabled }), type: "span", children: subheading })) : null, description !== undefined && description !== null ? (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardText({ type: "description", disabled }), type: "span", children: description })) : null] })), [subheading, description, contentClassName, disabled]);
|
|
3022
|
+
return (jsxRuntime.jsx(reactComponents.Tooltip, { disabled: layout !== "compact" || ((subheading === undefined || subheading === null) && (description === undefined || description === null)), label: subContent, mode: "light", placement: "top", children: jsxRuntime.jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsxRuntime.jsx("input", { className: cvaInput(), "data-testid": dataTestId ? `${dataTestId}-option-card` : undefined, disabled: disabled, id: htmlForId, ref: ref, type: "radio", value: value, ...rest }), jsxRuntime.jsxs("label", { className: cvaOptionCardLabel({ className, disabled, layout }), "data-testid": dataTestId ? `${dataTestId}-option-card-label` : undefined, htmlFor: htmlForId, children: [disabled && icon && !customImage
|
|
3023
3023
|
? react.cloneElement(icon, { className: cvaCustomImage({ disabled, className: icon.props.className }) })
|
|
3024
|
-
: null, disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (layout === "default" ? (jsxRuntime.jsx(reactComponents.Heading, { className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, variant: "secondary", children: heading })) : (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, type: "span", weight: "thick", children: heading }))) : null, layout === "default" && (subheading || description) ? subContent : null, tagProps ? jsxRuntime.jsx(reactComponents.Tag, { className: cvaTag({ className: tagProps.className, layout }), ...tagProps }) : null] })] }) }));
|
|
3024
|
+
: null, disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (layout === "default" ? (jsxRuntime.jsx(reactComponents.Heading, { className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, variant: "secondary", children: heading })) : (jsxRuntime.jsx(reactComponents.Text, { align: "center", className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, type: "span", weight: "thick", children: heading }))) : null, layout === "default" && ((subheading !== undefined && subheading !== null) || (description !== undefined && description !== null)) ? subContent : null, tagProps ? jsxRuntime.jsx(reactComponents.Tag, { className: cvaTag({ className: tagProps.className, layout }), ...tagProps }) : null] })] }) }));
|
|
3025
3025
|
};
|
|
3026
3026
|
OptionCard.displayName = "OptionCard";
|
|
3027
3027
|
|
|
@@ -3097,7 +3097,7 @@ const PasswordField = ({ id, label, tip, helpText, helpAddon, errorMessage, isIn
|
|
|
3097
3097
|
const handleChange = react.useCallback((event) => {
|
|
3098
3098
|
onChange?.(event);
|
|
3099
3099
|
}, [onChange]);
|
|
3100
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(PasswordBaseInput, { ...rest, "aria-labelledby": htmlFor + "-label", className: className, "data-testid": dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value }) }));
|
|
3100
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(PasswordBaseInput, { ...rest, "aria-labelledby": htmlFor + "-label", className: className, "data-testid": dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value }) }));
|
|
3101
3101
|
};
|
|
3102
3102
|
PasswordField.displayName = "PasswordField";
|
|
3103
3103
|
|
|
@@ -3233,7 +3233,7 @@ const PhoneField = ({ label, id, tip, helpText, isInvalid, errorMessage, value,
|
|
|
3233
3233
|
}
|
|
3234
3234
|
onBlur?.(event);
|
|
3235
3235
|
}, [errorMessage, onBlur, rest.required]);
|
|
3236
|
-
return (jsxRuntime.jsx(FormGroup, { className: className, "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(PhoneBaseInput, { "aria-labelledby": htmlForId + "-label", "data-testid": dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: handleBlur, ref: ref, value: value, ...rest }) }));
|
|
3236
|
+
return (jsxRuntime.jsx(FormGroup, { className: className, "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(PhoneBaseInput, { "aria-labelledby": htmlForId + "-label", "data-testid": dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: handleBlur, ref: ref, value: value, ...rest }) }));
|
|
3237
3237
|
};
|
|
3238
3238
|
PhoneField.displayName = "PhoneField";
|
|
3239
3239
|
|
|
@@ -3653,7 +3653,7 @@ const parseSchedule = (scheduleString) => {
|
|
|
3653
3653
|
const serializeSchedule = (weekSchedule) => {
|
|
3654
3654
|
return weekSchedule.schedule
|
|
3655
3655
|
.filter(({ range, day, isAllDay }) => {
|
|
3656
|
-
const hasRange = range.timeFrom && range.timeTo;
|
|
3656
|
+
const hasRange = Boolean(range.timeFrom) && Boolean(range.timeTo);
|
|
3657
3657
|
switch (weekSchedule.variant) {
|
|
3658
3658
|
case exports.ScheduleVariant.WEEKDAYS:
|
|
3659
3659
|
return day <= 5 && hasRange;
|
|
@@ -3989,7 +3989,7 @@ const TextLengthIndicator = ({ length, maxLength }) => {
|
|
|
3989
3989
|
* @returns {ReactElement} TextAreaField component
|
|
3990
3990
|
*/
|
|
3991
3991
|
const TextAreaField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, "data-testid": dataTestId, ref, ...rest }) => {
|
|
3992
|
-
const [valueLength, setValueLength] = react.useState(value ? `${value}`.length : 0);
|
|
3992
|
+
const [valueLength, setValueLength] = react.useState(value !== undefined ? `${value}`.length : 0);
|
|
3993
3993
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
3994
3994
|
const htmlForId = id ? id : "textAreaField-" + sharedUtils.uuidv4();
|
|
3995
3995
|
const handleChange = react.useCallback((event) => {
|
|
@@ -3998,7 +3998,7 @@ const TextAreaField = ({ id, label, tip, helpText, helpAddon, errorMessage, isIn
|
|
|
3998
3998
|
onChange(event);
|
|
3999
3999
|
}
|
|
4000
4000
|
}, [onChange]);
|
|
4001
|
-
return (jsxRuntime.jsx(FormGroup, { className: tailwindMerge.twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon
|
|
4001
|
+
return (jsxRuntime.jsx(FormGroup, { className: tailwindMerge.twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ??
|
|
4002
4002
|
(typeof maxLength === "number" && jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(TextAreaBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: "h-auto", "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4003
4003
|
};
|
|
4004
4004
|
TextAreaField.displayName = "TextAreaField";
|
|
@@ -4062,7 +4062,7 @@ TextAreaField.displayName = "TextAreaField";
|
|
|
4062
4062
|
* ```
|
|
4063
4063
|
*/
|
|
4064
4064
|
const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, "data-testid": dataTestId, isWarning, ref, ...rest }) => {
|
|
4065
|
-
const [valueLength, setValueLength] = react.useState(value ? `${value}`.length : 0);
|
|
4065
|
+
const [valueLength, setValueLength] = react.useState(value !== undefined ? `${value}`.length : 0);
|
|
4066
4066
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
4067
4067
|
const htmlFor = id ? id : "textField-" + sharedUtils.uuidv4();
|
|
4068
4068
|
const handleChange = react.useCallback((event) => {
|
|
@@ -4071,8 +4071,8 @@ const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvali
|
|
|
4071
4071
|
onChange(event);
|
|
4072
4072
|
}
|
|
4073
4073
|
}, [onChange]);
|
|
4074
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon
|
|
4075
|
-
(typeof maxLength === "number" && jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(TextBaseInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4074
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ??
|
|
4075
|
+
(typeof maxLength === "number" && jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(TextBaseInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4076
4076
|
};
|
|
4077
4077
|
TextField.displayName = "TextField";
|
|
4078
4078
|
|
|
@@ -4260,7 +4260,7 @@ const ToggleSwitch = ({ onChange, onClick, preventDefaultOnClick, className, "da
|
|
|
4260
4260
|
}, {}), [rest]);
|
|
4261
4261
|
const handleWrapperClick = (e) => {
|
|
4262
4262
|
// Prevents double-toggling when wrapped in a label or if preventDefaultOnClick is true
|
|
4263
|
-
const isFromLabel = e.target instanceof Element
|
|
4263
|
+
const isFromLabel = e.target instanceof Element ? e.target.closest("label") : null;
|
|
4264
4264
|
if (!isFromLabel && !preventDefaultOnClick && !disabled && !readOnly) {
|
|
4265
4265
|
localInputRef.current?.click();
|
|
4266
4266
|
}
|
|
@@ -4360,7 +4360,7 @@ const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-t
|
|
|
4360
4360
|
return (jsxRuntime.jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, ref: ref, tabIndex: -1, children: [jsxRuntime.jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsxRuntime.jsx("div", { className: cvaBinaryControlLabelTooltip(), children: jsxRuntime.jsx("span", { className: cvaLabel({
|
|
4361
4361
|
disabled: rest.disabled || rest.readOnly,
|
|
4362
4362
|
className: "select-none",
|
|
4363
|
-
}), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }) }, `${id}-label-tooltip`), suffix ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsxRuntime.jsx("div", { className: cvaBinaryControlDescriptionTooltip(), children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }) }, `${id}-description-tooltip`)) : null] }));
|
|
4363
|
+
}), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }) }, `${id}-label-tooltip`), suffix ? (jsxRuntime.jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description !== undefined ? (jsxRuntime.jsx(reactComponents.Tooltip, { "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsxRuntime.jsx("div", { className: cvaBinaryControlDescriptionTooltip(), children: jsxRuntime.jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }) }, `${id}-description-tooltip`)) : null] }));
|
|
4364
4364
|
};
|
|
4365
4365
|
ToggleSwitchOption.displayName = "ToggleSwitchOption";
|
|
4366
4366
|
|
|
@@ -4462,7 +4462,7 @@ UploadInput.displayName = "UploadInput";
|
|
|
4462
4462
|
const UploadField = ({ label, id, tip, helpText, errorMessage, isInvalid, className, value, "data-testid": dataTestId, ref, ...rest }) => {
|
|
4463
4463
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
4464
4464
|
const htmlForId = id ? id : "uploadField-" + sharedUtils.uuidv4();
|
|
4465
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4465
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4466
4466
|
};
|
|
4467
4467
|
UploadField.displayName = "UploadField";
|
|
4468
4468
|
|
|
@@ -4485,13 +4485,13 @@ const validateUrlAddress = (url) => {
|
|
|
4485
4485
|
* Validates a url
|
|
4486
4486
|
*/
|
|
4487
4487
|
const validateUrl = (url, required) => {
|
|
4488
|
-
if (
|
|
4488
|
+
if ((url === undefined || url === "" || url === 0) && !required) {
|
|
4489
4489
|
return undefined;
|
|
4490
4490
|
}
|
|
4491
|
-
if (
|
|
4491
|
+
if ((url === undefined || url === "" || url === 0) && required) {
|
|
4492
4492
|
return "REQUIRED";
|
|
4493
4493
|
}
|
|
4494
|
-
if (url && isString(url) && validateUrlAddress(url)) {
|
|
4494
|
+
if (url !== undefined && url !== "" && url !== 0 && isString(url) && validateUrlAddress(url)) {
|
|
4495
4495
|
return undefined;
|
|
4496
4496
|
}
|
|
4497
4497
|
return "INVALID_URL";
|
|
@@ -4563,7 +4563,7 @@ const UrlField = ({ label, id, tip, helpText, errorMessage, helpAddon, className
|
|
|
4563
4563
|
const [innerValue, setInnerValue] = react.useState(() => {
|
|
4564
4564
|
return (value?.toString() || defaultValue?.toString()) ?? "";
|
|
4565
4565
|
});
|
|
4566
|
-
const [renderAsInvalid, setRenderAsInvalid] = react.useState(!!errorMessage || (value &&
|
|
4566
|
+
const [renderAsInvalid, setRenderAsInvalid] = react.useState(!!errorMessage || (typeof value === "string" && value !== "" && !validateUrlAddress(value)) || isInvalid);
|
|
4567
4567
|
const errorType = react.useMemo(() => validateUrl(innerValue ?? "", rest.required), [rest.required, innerValue]);
|
|
4568
4568
|
const error = react.useMemo(() => (errorType ? t(`urlField.error.${errorType}`) : errorMessage), [errorType, errorMessage, t]);
|
|
4569
4569
|
const handleBlur = react.useCallback(event => {
|
|
@@ -4572,7 +4572,7 @@ const UrlField = ({ label, id, tip, helpText, errorMessage, helpAddon, className
|
|
|
4572
4572
|
setRenderAsInvalid(!!validateUrl(newValue, rest.required));
|
|
4573
4573
|
onBlur?.(event);
|
|
4574
4574
|
}, [onBlur, rest.required]);
|
|
4575
|
-
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? error : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsxRuntime.jsx(UrlBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, ref: ref, value: value
|
|
4575
|
+
return (jsxRuntime.jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? error : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsxRuntime.jsx(UrlBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, ref: ref, value: value ?? defaultValue, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4576
4576
|
};
|
|
4577
4577
|
UrlField.displayName = "UrlField";
|
|
4578
4578
|
|
package/index.esm.js
CHANGED
|
@@ -278,7 +278,7 @@ const cvaInputSuffix = cvaMerge(["flex", "justify-center", "items-center", "text
|
|
|
278
278
|
* Renders the addon element if provided
|
|
279
279
|
*/
|
|
280
280
|
const AddonRenderer = ({ addon, "data-testid": dataTestId, className, fieldSize, position, }) => {
|
|
281
|
-
if (
|
|
281
|
+
if (addon === undefined || addon === null) {
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
284
|
return (jsx("div", { className: cvaInputAddon({ size: fieldSize, position, className }), "data-testid": dataTestId ? `${dataTestId}-addon${titleCase(position)}` : null, children: addon }));
|
|
@@ -406,8 +406,8 @@ const PrefixRenderer = ({ prefix, type, "data-testid": dataTestId, disabled, ref
|
|
|
406
406
|
url: jsx(Icon, { name: "Link", size: "small" }),
|
|
407
407
|
};
|
|
408
408
|
// Decide what to show as prefix
|
|
409
|
-
const resolvedPrefix = prefix
|
|
410
|
-
if (
|
|
409
|
+
const resolvedPrefix = prefix ?? (type !== undefined && type !== "text" ? (defaultPrefixMap[type] ?? null) : null);
|
|
410
|
+
if (resolvedPrefix === null) {
|
|
411
411
|
return null;
|
|
412
412
|
}
|
|
413
413
|
return (jsx("div", { className: cvaInputPrefix({ disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : null, ref: ref, children: resolvedPrefix }));
|
|
@@ -416,7 +416,7 @@ const PrefixRenderer = ({ prefix, type, "data-testid": dataTestId, disabled, ref
|
|
|
416
416
|
// Renders the suffix element or shows an icon if invalid/warning
|
|
417
417
|
const SuffixRenderer = ({ suffix, isInvalid, isWarning, "data-testid": dataTestId, disabled, }) => {
|
|
418
418
|
// If user provided suffix that's not identical to addonBefore, render it
|
|
419
|
-
if (suffix) {
|
|
419
|
+
if (suffix !== undefined && suffix !== null) {
|
|
420
420
|
return (jsx("div", { className: cvaInputSuffix({
|
|
421
421
|
disabled,
|
|
422
422
|
}), "data-testid": dataTestId ? `${dataTestId}-suffix` : null, children: suffix }));
|
|
@@ -1594,13 +1594,8 @@ autoComplete, // see https://github.com/JedWatson/react-select/issues/758
|
|
|
1594
1594
|
return (jsx(components.ValueContainer, { ...selectValueContainer, className: cvaSelectValueContainer({ className: selectValueContainer.className }), getStyles: getNoStyles, innerProps: {
|
|
1595
1595
|
...selectValueContainer.innerProps,
|
|
1596
1596
|
ref: useMergeRefs([setValueContainerRef, selectValueContainer.innerProps?.ref]),
|
|
1597
|
-
}, children: selectValueContainer.isMulti ? (jsxs(Fragment, { children: [getPlaceholderElement(selectValueContainer.children), currentWithCounter && !currentIsComplete ? (
|
|
1598
|
-
|
|
1599
|
-
// will be removed when the calculation is complete
|
|
1600
|
-
jsx(CounterTag, { className: "invisible" // Is invisible because we're only putting it here to measure the width
|
|
1601
|
-
, "data-testid": "fake-multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setFakeCounterRef, totalCount: currentTotalCount })) : null, getMultiValueComponents(selectValueContainer.children), currentWithCounter && currentIsComplete ? (
|
|
1602
|
-
// This is the actual tag that will be visible in the UI
|
|
1603
|
-
jsx(CounterTag, { "data-testid": dataTestId ? `${dataTestId}-multiselect-counter` : "multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setCounterRef, totalCount: currentTotalCount })) : null, getInputComponent(selectValueContainer.children)] })) : (selectValueContainer.children) }));
|
|
1597
|
+
}, children: selectValueContainer.isMulti ? (jsxs(Fragment, { children: [getPlaceholderElement(selectValueContainer.children), currentWithCounter && !currentIsComplete ? (jsx(CounterTag, { className: "invisible" // Is invisible because we're only putting it here to measure the width
|
|
1598
|
+
, "data-testid": "fake-multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setFakeCounterRef, totalCount: currentTotalCount })) : null, getMultiValueComponents(selectValueContainer.children), currentWithCounter && currentIsComplete ? (jsx(CounterTag, { "data-testid": dataTestId ? `${dataTestId}-multiselect-counter` : "multiselect-counter", fieldSize: fieldSize, hiddenCount: currentTotalCount - currentVisibleCount, ref: setCounterRef, totalCount: currentTotalCount })) : null, getInputComponent(selectValueContainer.children)] })) : (selectValueContainer.children) }));
|
|
1604
1599
|
},
|
|
1605
1600
|
IndicatorSeparator: () => null,
|
|
1606
1601
|
Input: selectInput => {
|
|
@@ -2086,7 +2081,7 @@ const FormGroup = ({ isInvalid = false, isWarning = false, helpText, helpAddon,
|
|
|
2086
2081
|
const color = isInvalid ? "danger" : isWarning ? "warning" : null;
|
|
2087
2082
|
return color ? jsx(Icon, { color: color, name: "ExclamationTriangle", size: "small" }) : null;
|
|
2088
2083
|
}, [isInvalid, isWarning]);
|
|
2089
|
-
return (jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label ? (jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxs(Fragment, { children: [jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsx(Tooltip, { "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsx("span", { children: "*" }) })) : null] }), tip ? (jsx("span", { className: "ml-1", children: jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" }) })) : null] })) : null, children, helpText || helpAddon ? (jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon ? (jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
|
|
2084
|
+
return (jsxs("div", { className: cvaFormGroup({ className }), "data-testid": dataTestId, ref: ref, children: [label !== undefined && label !== null ? (jsxs("div", { className: cvaFormGroupContainerBefore(), children: [jsxs(Fragment, { children: [jsx(Label, { className: "component-formGroup-font", "data-testid": dataTestId ? `${dataTestId}-label` : undefined, htmlFor: htmlFor, id: htmlFor + "-label", children: label }), required ? (jsx(Tooltip, { "data-testid": "required-asterisk", label: t("field.required.asterisk.tooltip"), children: jsx("span", { children: "*" }) })) : null] }), tip !== undefined && tip !== null ? (jsx("span", { className: "ml-1", children: jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, label: tip, placement: "bottom" }) })) : null] })) : null, children, ((helpText !== undefined && helpText !== null) || (helpAddon !== undefined && helpAddon !== null)) ? (jsxs("div", { className: cvaFormGroupContainerAfter({ invalid: isInvalid, isWarning: isWarning }), children: [helpText ? (jsxs("div", { className: "flex gap-1", children: [validationStateIcon, jsx("span", { "data-testid": dataTestId ? `${dataTestId}-helpText` : undefined, children: helpText })] })) : undefined, helpAddon !== undefined && helpAddon !== null ? (jsx("span", { className: cvaHelpAddon(), "data-testid": dataTestId ? `${dataTestId}-helpAddon` : null, children: helpAddon })) : null] })) : null] }));
|
|
2090
2085
|
};
|
|
2091
2086
|
|
|
2092
2087
|
/**
|
|
@@ -2146,13 +2141,13 @@ const isNumber = (inputValue) => {
|
|
|
2146
2141
|
* Validates a url
|
|
2147
2142
|
*/
|
|
2148
2143
|
const validateColorCode = (colorCode, required) => {
|
|
2149
|
-
if (
|
|
2144
|
+
if ((colorCode === undefined || colorCode === "" || colorCode === 0) && !required) {
|
|
2150
2145
|
return undefined;
|
|
2151
2146
|
}
|
|
2152
|
-
if (
|
|
2147
|
+
if ((colorCode === undefined || colorCode === "" || colorCode === 0) && required) {
|
|
2153
2148
|
return "REQUIRED";
|
|
2154
2149
|
}
|
|
2155
|
-
if (colorCode && isString(colorCode) && isValidHEXColor(colorCode)) {
|
|
2150
|
+
if (colorCode !== undefined && colorCode !== "" && colorCode !== 0 && isString(colorCode) && isValidHEXColor(colorCode)) {
|
|
2156
2151
|
return undefined;
|
|
2157
2152
|
}
|
|
2158
2153
|
return "INVALID_HEX_CODE";
|
|
@@ -2338,7 +2333,7 @@ ColorField.displayName = "ColorField";
|
|
|
2338
2333
|
const DateField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, "data-testid": dataTestId, ref, ...rest }) => {
|
|
2339
2334
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
2340
2335
|
const htmlForId = id ? id : "dateField-" + uuidv4();
|
|
2341
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(DateBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2336
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(DateBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2342
2337
|
};
|
|
2343
2338
|
DateField.displayName = "DateField";
|
|
2344
2339
|
|
|
@@ -2532,13 +2527,13 @@ const validateEmailAddress = (email) => {
|
|
|
2532
2527
|
* Validates a email id
|
|
2533
2528
|
*/
|
|
2534
2529
|
const validateEmailId = (emailId, required) => {
|
|
2535
|
-
if (
|
|
2530
|
+
if ((emailId === undefined || emailId === "" || emailId === 0) && !required) {
|
|
2536
2531
|
return undefined;
|
|
2537
2532
|
}
|
|
2538
|
-
if (
|
|
2533
|
+
if ((emailId === undefined || emailId === "" || emailId === 0) && required) {
|
|
2539
2534
|
return "REQUIRED";
|
|
2540
2535
|
}
|
|
2541
|
-
if (emailId && isString(emailId) && validateEmailAddress(emailId)) {
|
|
2536
|
+
if (emailId !== undefined && emailId !== "" && emailId !== 0 && isString(emailId) && validateEmailAddress(emailId)) {
|
|
2542
2537
|
return undefined;
|
|
2543
2538
|
}
|
|
2544
2539
|
return "INVALID_EMAIL";
|
|
@@ -2623,7 +2618,7 @@ const EmailField = ({ label, id, tip, helpText, errorMessage, helpAddon, classNa
|
|
|
2623
2618
|
const [innerValue, setInnerValue] = useState(() => {
|
|
2624
2619
|
return (value?.toString() || defaultValue?.toString()) ?? "";
|
|
2625
2620
|
});
|
|
2626
|
-
const [renderAsInvalid, setRenderAsInvalid] = useState(!!errorMessage || (value &&
|
|
2621
|
+
const [renderAsInvalid, setRenderAsInvalid] = useState(!!errorMessage || (typeof value === "string" && value !== "" && !validateEmailAddress(value)) || isInvalid);
|
|
2627
2622
|
const errorType = useMemo(() => validateEmailId(innerValue ?? "", rest.required), [rest.required, innerValue]);
|
|
2628
2623
|
const error = useMemo(() => (errorType ? t(`emailField.error.${errorType}`) : errorMessage), [errorType, errorMessage, t]);
|
|
2629
2624
|
const handleBlur = useCallback(event => {
|
|
@@ -2638,7 +2633,7 @@ const EmailField = ({ label, id, tip, helpText, errorMessage, helpAddon, classNa
|
|
|
2638
2633
|
onChange(event);
|
|
2639
2634
|
}
|
|
2640
2635
|
}, [onChange]);
|
|
2641
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(EmailBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2636
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(EmailBaseInput, { "aria-labelledby": htmlForId + "-label", defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2642
2637
|
};
|
|
2643
2638
|
EmailField.displayName = "EmailField";
|
|
2644
2639
|
|
|
@@ -2809,19 +2804,24 @@ const validateNumber = (number, required = false, min, max) => {
|
|
|
2809
2804
|
return undefined;
|
|
2810
2805
|
}
|
|
2811
2806
|
// if the value is a string eg:'test'
|
|
2812
|
-
if (number && !isNaN(+number) === false) {
|
|
2807
|
+
if (number !== "" && number !== 0 && !isNaN(+number) === false) {
|
|
2813
2808
|
return "INVALID_NUMBER";
|
|
2814
2809
|
}
|
|
2815
2810
|
// if the value is empty and not required
|
|
2816
|
-
if (
|
|
2811
|
+
if ((parsedNumber === 0 || Number.isNaN(parsedNumber)) &&
|
|
2812
|
+
!required &&
|
|
2813
|
+
(min === undefined || min === "" || min === 0) &&
|
|
2814
|
+
(max === undefined || max === "" || max === 0) &&
|
|
2815
|
+
number !== "" &&
|
|
2816
|
+
number !== 0) {
|
|
2817
2817
|
return undefined;
|
|
2818
2818
|
}
|
|
2819
2819
|
// if the value is empty and required
|
|
2820
|
-
if (required &&
|
|
2820
|
+
if (required && (number === "" || number === 0)) {
|
|
2821
2821
|
return "REQUIRED";
|
|
2822
2822
|
}
|
|
2823
2823
|
// if the value is not in between min and max
|
|
2824
|
-
if (minValue && maxValue && isNumberValid(parsedNumber) && !(parsedNumber >= minValue && parsedNumber <= maxValue)) {
|
|
2824
|
+
if (minValue !== undefined && maxValue !== undefined && isNumberValid(parsedNumber) && !(parsedNumber >= minValue && parsedNumber <= maxValue)) {
|
|
2825
2825
|
return "NOT_IN_BETWEEN";
|
|
2826
2826
|
}
|
|
2827
2827
|
// if the value is less than min
|
|
@@ -2932,7 +2932,7 @@ const NumberField = ({ label, id, tip, helpText, errorMessage, helpAddon, isInva
|
|
|
2932
2932
|
onChange(event);
|
|
2933
2933
|
}
|
|
2934
2934
|
}, [onChange]);
|
|
2935
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(NumberBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2935
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(NumberBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, onBlur: handleBlur, onChange: handleChange, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
2936
2936
|
};
|
|
2937
2937
|
NumberField.displayName = "NumberField";
|
|
2938
2938
|
|
|
@@ -3017,10 +3017,10 @@ const cvaTag = cvaMerge([], {
|
|
|
3017
3017
|
*/
|
|
3018
3018
|
const OptionCard = ({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, "data-testid": dataTestId, customImage, layout = "default", ref, tagProps, ...rest }) => {
|
|
3019
3019
|
const htmlForId = id ?? "option-card-" + uuidv4();
|
|
3020
|
-
const subContent = useMemo(() => (jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading ? (jsx(Text, { align: "center", className: cvaOptionCardText({ type: "subheading", disabled }), type: "span", children: subheading })) : null, description ? (jsx(Text, { align: "center", className: cvaOptionCardText({ type: "description", disabled }), type: "span", children: description })) : null] })), [subheading, description, contentClassName, disabled]);
|
|
3021
|
-
return (jsx(Tooltip, { disabled: layout !== "compact" || (
|
|
3020
|
+
const subContent = useMemo(() => (jsxs("div", { className: cvaOptionCardContent({ className: contentClassName }), children: [subheading !== undefined && subheading !== null ? (jsx(Text, { align: "center", className: cvaOptionCardText({ type: "subheading", disabled }), type: "span", children: subheading })) : null, description !== undefined && description !== null ? (jsx(Text, { align: "center", className: cvaOptionCardText({ type: "description", disabled }), type: "span", children: description })) : null] })), [subheading, description, contentClassName, disabled]);
|
|
3021
|
+
return (jsx(Tooltip, { disabled: layout !== "compact" || ((subheading === undefined || subheading === null) && (description === undefined || description === null)), label: subContent, mode: "light", placement: "top", children: jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsx("input", { className: cvaInput(), "data-testid": dataTestId ? `${dataTestId}-option-card` : undefined, disabled: disabled, id: htmlForId, ref: ref, type: "radio", value: value, ...rest }), jsxs("label", { className: cvaOptionCardLabel({ className, disabled, layout }), "data-testid": dataTestId ? `${dataTestId}-option-card-label` : undefined, htmlFor: htmlForId, children: [disabled && icon && !customImage
|
|
3022
3022
|
? cloneElement(icon, { className: cvaCustomImage({ disabled, className: icon.props.className }) })
|
|
3023
|
-
: null, disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (layout === "default" ? (jsx(Heading, { className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, variant: "secondary", children: heading })) : (jsx(Text, { align: "center", className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, type: "span", weight: "thick", children: heading }))) : null, layout === "default" && (subheading || description) ? subContent : null, tagProps ? jsx(Tag, { className: cvaTag({ className: tagProps.className, layout }), ...tagProps }) : null] })] }) }));
|
|
3023
|
+
: null, disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, !disabled && !customImage && icon, !disabled && customImage ? jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }) : null, heading ? (layout === "default" ? (jsx(Heading, { className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, variant: "secondary", children: heading })) : (jsx(Text, { align: "center", className: cvaOptionCardTitle({ disabled, layout }), subtle: disabled, type: "span", weight: "thick", children: heading }))) : null, layout === "default" && ((subheading !== undefined && subheading !== null) || (description !== undefined && description !== null)) ? subContent : null, tagProps ? jsx(Tag, { className: cvaTag({ className: tagProps.className, layout }), ...tagProps }) : null] })] }) }));
|
|
3024
3024
|
};
|
|
3025
3025
|
OptionCard.displayName = "OptionCard";
|
|
3026
3026
|
|
|
@@ -3096,7 +3096,7 @@ const PasswordField = ({ id, label, tip, helpText, helpAddon, errorMessage, isIn
|
|
|
3096
3096
|
const handleChange = useCallback((event) => {
|
|
3097
3097
|
onChange?.(event);
|
|
3098
3098
|
}, [onChange]);
|
|
3099
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(PasswordBaseInput, { ...rest, "aria-labelledby": htmlFor + "-label", className: className, "data-testid": dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value }) }));
|
|
3099
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(PasswordBaseInput, { ...rest, "aria-labelledby": htmlFor + "-label", className: className, "data-testid": dataTestId, disabled: rest.readOnly, id: htmlFor, isInvalid: renderAsInvalid, maxLength: maxLength, onChange: handleChange, ref: ref, value: value }) }));
|
|
3100
3100
|
};
|
|
3101
3101
|
PasswordField.displayName = "PasswordField";
|
|
3102
3102
|
|
|
@@ -3232,7 +3232,7 @@ const PhoneField = ({ label, id, tip, helpText, isInvalid, errorMessage, value,
|
|
|
3232
3232
|
}
|
|
3233
3233
|
onBlur?.(event);
|
|
3234
3234
|
}, [errorMessage, onBlur, rest.required]);
|
|
3235
|
-
return (jsx(FormGroup, { className: className, "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(PhoneBaseInput, { "aria-labelledby": htmlForId + "-label", "data-testid": dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: handleBlur, ref: ref, value: value, ...rest }) }));
|
|
3235
|
+
return (jsx(FormGroup, { className: className, "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: (renderAsInvalid && error) || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(PhoneBaseInput, { "aria-labelledby": htmlForId + "-label", "data-testid": dataTestId, defaultValue: defaultValue, id: htmlForId, isInvalid: renderAsInvalid, name: name, onBlur: handleBlur, ref: ref, value: value, ...rest }) }));
|
|
3236
3236
|
};
|
|
3237
3237
|
PhoneField.displayName = "PhoneField";
|
|
3238
3238
|
|
|
@@ -3652,7 +3652,7 @@ const parseSchedule = (scheduleString) => {
|
|
|
3652
3652
|
const serializeSchedule = (weekSchedule) => {
|
|
3653
3653
|
return weekSchedule.schedule
|
|
3654
3654
|
.filter(({ range, day, isAllDay }) => {
|
|
3655
|
-
const hasRange = range.timeFrom && range.timeTo;
|
|
3655
|
+
const hasRange = Boolean(range.timeFrom) && Boolean(range.timeTo);
|
|
3656
3656
|
switch (weekSchedule.variant) {
|
|
3657
3657
|
case ScheduleVariant.WEEKDAYS:
|
|
3658
3658
|
return day <= 5 && hasRange;
|
|
@@ -3988,7 +3988,7 @@ const TextLengthIndicator = ({ length, maxLength }) => {
|
|
|
3988
3988
|
* @returns {ReactElement} TextAreaField component
|
|
3989
3989
|
*/
|
|
3990
3990
|
const TextAreaField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, "data-testid": dataTestId, ref, ...rest }) => {
|
|
3991
|
-
const [valueLength, setValueLength] = useState(value ? `${value}`.length : 0);
|
|
3991
|
+
const [valueLength, setValueLength] = useState(value !== undefined ? `${value}`.length : 0);
|
|
3992
3992
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
3993
3993
|
const htmlForId = id ? id : "textAreaField-" + uuidv4();
|
|
3994
3994
|
const handleChange = useCallback((event) => {
|
|
@@ -3997,7 +3997,7 @@ const TextAreaField = ({ id, label, tip, helpText, helpAddon, errorMessage, isIn
|
|
|
3997
3997
|
onChange(event);
|
|
3998
3998
|
}
|
|
3999
3999
|
}, [onChange]);
|
|
4000
|
-
return (jsx(FormGroup, { className: twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon
|
|
4000
|
+
return (jsx(FormGroup, { className: twMerge(className, "grid", "grid-rows-[auto_1fr_auto]"), "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ??
|
|
4001
4001
|
(typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(TextAreaBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, maxLength: maxLength, ref: ref, value: value, ...rest, className: "h-auto", "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4002
4002
|
};
|
|
4003
4003
|
TextAreaField.displayName = "TextAreaField";
|
|
@@ -4061,7 +4061,7 @@ TextAreaField.displayName = "TextAreaField";
|
|
|
4061
4061
|
* ```
|
|
4062
4062
|
*/
|
|
4063
4063
|
const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, "data-testid": dataTestId, isWarning, ref, ...rest }) => {
|
|
4064
|
-
const [valueLength, setValueLength] = useState(value ? `${value}`.length : 0);
|
|
4064
|
+
const [valueLength, setValueLength] = useState(value !== undefined ? `${value}`.length : 0);
|
|
4065
4065
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
4066
4066
|
const htmlFor = id ? id : "textField-" + uuidv4();
|
|
4067
4067
|
const handleChange = useCallback((event) => {
|
|
@@ -4070,8 +4070,8 @@ const TextField = ({ id, label, tip, helpText, helpAddon, errorMessage, isInvali
|
|
|
4070
4070
|
onChange(event);
|
|
4071
4071
|
}
|
|
4072
4072
|
}, [onChange]);
|
|
4073
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon
|
|
4074
|
-
(typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(TextBaseInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4073
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon ??
|
|
4074
|
+
(typeof maxLength === "number" && jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength })), helpText: (renderAsInvalid && errorMessage) || helpText, htmlFor: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(TextBaseInput, { "aria-labelledby": htmlFor + "-label", id: htmlFor, isInvalid: renderAsInvalid, isWarning: isWarning, maxLength: maxLength, ref: ref, value: value, ...rest, className: className, "data-testid": dataTestId, onChange: handleChange }) }));
|
|
4075
4075
|
};
|
|
4076
4076
|
TextField.displayName = "TextField";
|
|
4077
4077
|
|
|
@@ -4259,7 +4259,7 @@ const ToggleSwitch = ({ onChange, onClick, preventDefaultOnClick, className, "da
|
|
|
4259
4259
|
}, {}), [rest]);
|
|
4260
4260
|
const handleWrapperClick = (e) => {
|
|
4261
4261
|
// Prevents double-toggling when wrapped in a label or if preventDefaultOnClick is true
|
|
4262
|
-
const isFromLabel = e.target instanceof Element
|
|
4262
|
+
const isFromLabel = e.target instanceof Element ? e.target.closest("label") : null;
|
|
4263
4263
|
if (!isFromLabel && !preventDefaultOnClick && !disabled && !readOnly) {
|
|
4264
4264
|
localInputRef.current?.click();
|
|
4265
4265
|
}
|
|
@@ -4359,7 +4359,7 @@ const ToggleSwitchOption = ({ label, className, description, suffix, id, "data-t
|
|
|
4359
4359
|
return (jsxs("label", { className: cvaBinaryControlWrapper({ className }), "data-testid": dataTestId, htmlFor: `${id}-toggle-switch`, ref: ref, tabIndex: -1, children: [jsx(ToggleSwitch, { "data-testid": `${dataTestId}-switcher`, id: `${id}-toggle-switch`, ...rest }), jsx(Tooltip, { "data-testid": `${dataTestId}-label-tooltip`, disabled: !isLabelTruncated, label: label, placement: "top", children: jsx("div", { className: cvaBinaryControlLabelTooltip(), children: jsx("span", { className: cvaLabel({
|
|
4360
4360
|
disabled: rest.disabled || rest.readOnly,
|
|
4361
4361
|
className: "select-none",
|
|
4362
|
-
}), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }) }, `${id}-label-tooltip`), suffix ? (jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description ? (jsx(Tooltip, { "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsx("div", { className: cvaBinaryControlDescriptionTooltip(), children: jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }) }, `${id}-description-tooltip`)) : null] }));
|
|
4362
|
+
}), "data-testid": `${dataTestId}-label`, ref: labelRef, children: label }) }) }, `${id}-label-tooltip`), suffix ? (jsx("div", { className: cvaBinaryControlSuffixContainer(), "data-testid": `${dataTestId}-suffix-container`, children: suffix })) : null, description !== undefined ? (jsx(Tooltip, { "data-testid": `${dataTestId}-description-tooltip`, disabled: !isDescriptionTruncated, label: description, placement: "top", children: jsx("div", { className: cvaBinaryControlDescriptionTooltip(), children: jsx("span", { className: cvaBinaryControlDescription({ disabled: rest.disabled || rest.readOnly }), "data-testid": `${dataTestId}-description`, id: `${id}-description`, ref: descriptionRef, children: description }) }) }, `${id}-description-tooltip`)) : null] }));
|
|
4363
4363
|
};
|
|
4364
4364
|
ToggleSwitchOption.displayName = "ToggleSwitchOption";
|
|
4365
4365
|
|
|
@@ -4461,7 +4461,7 @@ UploadInput.displayName = "UploadInput";
|
|
|
4461
4461
|
const UploadField = ({ label, id, tip, helpText, errorMessage, isInvalid, className, value, "data-testid": dataTestId, ref, ...rest }) => {
|
|
4462
4462
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
4463
4463
|
const htmlForId = id ? id : "uploadField-" + uuidv4();
|
|
4464
|
-
return (jsx(FormGroup, { "data-testid": `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4464
|
+
return (jsx(FormGroup, { "data-testid": `${dataTestId}-FormGroup`, helpText: errorMessage || helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(UploadInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, ref: ref, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4465
4465
|
};
|
|
4466
4466
|
UploadField.displayName = "UploadField";
|
|
4467
4467
|
|
|
@@ -4484,13 +4484,13 @@ const validateUrlAddress = (url) => {
|
|
|
4484
4484
|
* Validates a url
|
|
4485
4485
|
*/
|
|
4486
4486
|
const validateUrl = (url, required) => {
|
|
4487
|
-
if (
|
|
4487
|
+
if ((url === undefined || url === "" || url === 0) && !required) {
|
|
4488
4488
|
return undefined;
|
|
4489
4489
|
}
|
|
4490
|
-
if (
|
|
4490
|
+
if ((url === undefined || url === "" || url === 0) && required) {
|
|
4491
4491
|
return "REQUIRED";
|
|
4492
4492
|
}
|
|
4493
|
-
if (url && isString(url) && validateUrlAddress(url)) {
|
|
4493
|
+
if (url !== undefined && url !== "" && url !== 0 && isString(url) && validateUrlAddress(url)) {
|
|
4494
4494
|
return undefined;
|
|
4495
4495
|
}
|
|
4496
4496
|
return "INVALID_URL";
|
|
@@ -4562,7 +4562,7 @@ const UrlField = ({ label, id, tip, helpText, errorMessage, helpAddon, className
|
|
|
4562
4562
|
const [innerValue, setInnerValue] = useState(() => {
|
|
4563
4563
|
return (value?.toString() || defaultValue?.toString()) ?? "";
|
|
4564
4564
|
});
|
|
4565
|
-
const [renderAsInvalid, setRenderAsInvalid] = useState(!!errorMessage || (value &&
|
|
4565
|
+
const [renderAsInvalid, setRenderAsInvalid] = useState(!!errorMessage || (typeof value === "string" && value !== "" && !validateUrlAddress(value)) || isInvalid);
|
|
4566
4566
|
const errorType = useMemo(() => validateUrl(innerValue ?? "", rest.required), [rest.required, innerValue]);
|
|
4567
4567
|
const error = useMemo(() => (errorType ? t(`urlField.error.${errorType}`) : errorMessage), [errorType, errorMessage, t]);
|
|
4568
4568
|
const handleBlur = useCallback(event => {
|
|
@@ -4571,7 +4571,7 @@ const UrlField = ({ label, id, tip, helpText, errorMessage, helpAddon, className
|
|
|
4571
4571
|
setRenderAsInvalid(!!validateUrl(newValue, rest.required));
|
|
4572
4572
|
onBlur?.(event);
|
|
4573
4573
|
}, [onBlur, rest.required]);
|
|
4574
|
-
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? error : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(rest.disabled || rest.readOnly) : false, tip: tip, children: jsx(UrlBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, ref: ref, value: value
|
|
4574
|
+
return (jsx(FormGroup, { "data-testid": dataTestId ? `${dataTestId}-FormGroup` : undefined, helpAddon: helpAddon, helpText: renderAsInvalid ? error : helpText, htmlFor: htmlForId, isInvalid: renderAsInvalid, label: label, required: rest.required ? !(Boolean(rest.disabled) || Boolean(rest.readOnly)) : false, tip: tip, children: jsx(UrlBaseInput, { "aria-labelledby": htmlForId + "-label", id: htmlForId, isInvalid: renderAsInvalid, onBlur: handleBlur, ref: ref, value: value ?? defaultValue, ...rest, className: className, "data-testid": dataTestId }) }));
|
|
4575
4575
|
};
|
|
4576
4576
|
UrlField.displayName = "UrlField";
|
|
4577
4577
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.10-alpha-ae1ff73fc64.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react": "19.0.0",
|
|
11
11
|
"react-select": "^5.10.2",
|
|
12
|
-
"@trackunit/date-and-time-utils": "1.11.
|
|
12
|
+
"@trackunit/date-and-time-utils": "1.11.70-alpha-ae1ff73fc64.0",
|
|
13
13
|
"usehooks-ts": "^3.1.0",
|
|
14
14
|
"libphonenumber-js": "^1.12.22",
|
|
15
15
|
"zod": "^3.23.8",
|
|
16
16
|
"react-hook-form": "7.62.0",
|
|
17
17
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "1.11.
|
|
19
|
-
"@trackunit/react-components": "1.18.
|
|
20
|
-
"@trackunit/ui-icons": "1.11.
|
|
21
|
-
"@trackunit/shared-utils": "1.13.
|
|
22
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
23
|
-
"@trackunit/i18n-library-translation": "1.12.
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "1.11.69-alpha-ae1ff73fc64.0",
|
|
19
|
+
"@trackunit/react-components": "1.18.10-alpha-ae1ff73fc64.0",
|
|
20
|
+
"@trackunit/ui-icons": "1.11.67-alpha-ae1ff73fc64.0",
|
|
21
|
+
"@trackunit/shared-utils": "1.13.69-alpha-ae1ff73fc64.0",
|
|
22
|
+
"@trackunit/ui-design-tokens": "1.11.68-alpha-ae1ff73fc64.0",
|
|
23
|
+
"@trackunit/i18n-library-translation": "1.12.60-alpha-ae1ff73fc64.0",
|
|
24
24
|
"string-ts": "^2.0.0",
|
|
25
25
|
"es-toolkit": "^1.39.10"
|
|
26
26
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const cvaActionButton: (props?: ({
|
|
2
2
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
3
|
-
} & import("class-variance-authority/
|
|
3
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
4
|
export declare const cvaActionContainer: (props?: ({
|
|
5
5
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export declare const cvaInputBase: (props?: import("class-variance-authority/
|
|
2
|
-
export declare const cvaInputBaseDisabled: (props?: import("class-variance-authority/
|
|
3
|
-
export declare const cvaInputBaseInvalid: (props?: import("class-variance-authority/
|
|
4
|
-
export declare const cvaInputBaseReadOnly: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaInputBase: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaInputBaseDisabled: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaInputBaseInvalid: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaInputBaseReadOnly: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
5
|
export declare const cvaInputBaseSize: (props?: ({
|
|
6
6
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
7
7
|
defaultVariants?: "size" | null | undefined;
|
|
8
|
-
} & import("class-variance-authority/
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
export declare const cvaInput: (props?: ({
|
|
10
10
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
11
11
|
disabled?: boolean | null | undefined;
|
|
12
12
|
readOnly?: boolean | null | undefined;
|
|
13
13
|
invalid?: boolean | null | undefined;
|
|
14
14
|
isWarning?: boolean | null | undefined;
|
|
15
|
-
} & import("class-variance-authority/
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
16
|
/**
|
|
17
17
|
* Used for placing items in the grid, using a grid z-stack trick.
|
|
18
18
|
* The span position is used for the input field, which spans the entire grid.
|
|
@@ -20,21 +20,21 @@ export declare const cvaInput: (props?: ({
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const cvaInputItemPlacementManager: (props?: ({
|
|
22
22
|
position?: "before" | "after" | "span" | null | undefined;
|
|
23
|
-
} & import("class-variance-authority/
|
|
24
|
-
export declare const cvaAccessoriesContainer: (props?: import("class-variance-authority/
|
|
23
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
|
+
export declare const cvaAccessoriesContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
25
25
|
/**
|
|
26
26
|
* Text size and color is handled by cvaInput
|
|
27
27
|
*/
|
|
28
28
|
export declare const cvaInputElement: (props?: ({
|
|
29
29
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
30
|
-
} & import("class-variance-authority/
|
|
30
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
31
31
|
export declare const cvaInputAddon: (props?: ({
|
|
32
32
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
33
33
|
position?: "before" | "after" | null | undefined;
|
|
34
|
-
} & import("class-variance-authority/
|
|
34
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
35
35
|
export declare const cvaInputPrefix: (props?: ({
|
|
36
36
|
disabled?: boolean | null | undefined;
|
|
37
|
-
} & import("class-variance-authority/
|
|
37
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
38
38
|
export declare const cvaInputSuffix: (props?: ({
|
|
39
39
|
disabled?: boolean | null | undefined;
|
|
40
|
-
} & import("class-variance-authority/
|
|
40
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -9,25 +9,25 @@ export declare const cvaSelectContainer: (props?: ({
|
|
|
9
9
|
focused?: boolean | null | undefined;
|
|
10
10
|
readOnly?: boolean | null | undefined;
|
|
11
11
|
defaultVariants?: "fieldSize" | "disabled" | "invalid" | "focused" | "readOnly" | null | undefined;
|
|
12
|
-
} & import("class-variance-authority/
|
|
13
|
-
export declare const cvaSelectControl: (props?: import("class-variance-authority/
|
|
14
|
-
export declare const cvaSelectLoadingMessage: (props?: import("class-variance-authority/
|
|
15
|
-
export declare const cvaSelectNoOptionsMessage: (props?: import("class-variance-authority/
|
|
16
|
-
export declare const cvaSelectDropdownIconContainer: (props?: import("class-variance-authority/
|
|
17
|
-
export declare const cvaSelectPrefixSuffix: (props?: import("class-variance-authority/
|
|
18
|
-
export declare const cvaSelectClearIndicator: (props?: import("class-variance-authority/
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
export declare const cvaSelectControl: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
14
|
+
export declare const cvaSelectLoadingMessage: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
|
+
export declare const cvaSelectNoOptionsMessage: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
16
|
+
export declare const cvaSelectDropdownIconContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
17
|
+
export declare const cvaSelectPrefixSuffix: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
18
|
+
export declare const cvaSelectClearIndicator: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
19
19
|
export declare const cvaSelectDropdownIndicator: (props?: ({
|
|
20
20
|
menuIsOpen?: boolean | null | undefined;
|
|
21
|
-
} & import("class-variance-authority/
|
|
22
|
-
export declare const cvaSelectValueContainer: (props?: import("class-variance-authority/
|
|
23
|
-
export declare const cvaSelectSingleValue: (props?: import("class-variance-authority/
|
|
21
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
|
+
export declare const cvaSelectValueContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
23
|
+
export declare const cvaSelectSingleValue: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
24
24
|
export declare const cvaSelectMenu: (props?: ({
|
|
25
25
|
placement?: "bottom" | "top" | null | undefined;
|
|
26
|
-
} & import("class-variance-authority/
|
|
27
|
-
export declare const cvaSelectMenuList: (props?: import("class-variance-authority/
|
|
28
|
-
export declare const cvaSelectPlaceholder: (props?: import("class-variance-authority/
|
|
29
|
-
export declare const cvaSelectIndicatorsContainer: (props?: import("class-variance-authority/
|
|
26
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
+
export declare const cvaSelectMenuList: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
28
|
+
export declare const cvaSelectPlaceholder: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
29
|
+
export declare const cvaSelectIndicatorsContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
30
30
|
export declare const cvaSelectMultiValue: (props?: ({
|
|
31
31
|
hidden?: boolean | null | undefined;
|
|
32
32
|
invisible?: boolean | null | undefined;
|
|
33
|
-
} & import("class-variance-authority/
|
|
33
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -6,9 +6,9 @@ export declare const cvaCheckbox: (props?: ({
|
|
|
6
6
|
invalid?: boolean | null | undefined;
|
|
7
7
|
state?: "selected" | "deselected" | "indeterminate" | null | undefined;
|
|
8
8
|
disabled?: boolean | null | undefined;
|
|
9
|
-
} & import("class-variance-authority/
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Icon overlay container - positioned on top of the input, receives no pointer events
|
|
12
12
|
*/
|
|
13
|
-
export declare const cvaCheckboxIconOverlay: (props?: import("class-variance-authority/
|
|
14
|
-
export declare const cvaCheckboxIcon: (props?: import("class-variance-authority/
|
|
13
|
+
export declare const cvaCheckboxIconOverlay: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
14
|
+
export declare const cvaCheckboxIcon: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -4,8 +4,8 @@ export declare const cvaDropZone: (props?: ({
|
|
|
4
4
|
dragActive?: boolean | null | undefined;
|
|
5
5
|
dropComplete?: boolean | null | undefined;
|
|
6
6
|
invalid?: boolean | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/
|
|
8
|
-
export declare const cvaDropZoneLabel: (props?: import("class-variance-authority/
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export declare const cvaDropZoneLabel: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
9
|
export declare const cvaDropZoneIconBackground: (props?: ({
|
|
10
10
|
invalid?: boolean | null | undefined;
|
|
11
|
-
} & import("class-variance-authority/
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const cvaFormGroup: (props?: import("class-variance-authority/
|
|
2
|
-
export declare const cvaFormGroupContainerBefore: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaFormGroup: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaFormGroupContainerBefore: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
3
|
export declare const cvaFormGroupContainerAfter: (props?: ({
|
|
4
4
|
invalid?: boolean | null | undefined;
|
|
5
5
|
isWarning?: boolean | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/
|
|
7
|
-
export declare const cvaHelpAddon: (props?: import("class-variance-authority/
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const cvaHelpAddon: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -2,4 +2,4 @@ export declare const cvaLabel: (props?: ({
|
|
|
2
2
|
invalid?: boolean | null | undefined;
|
|
3
3
|
disabled?: boolean | null | undefined;
|
|
4
4
|
truncate?: boolean | null | undefined;
|
|
5
|
-
} & import("class-variance-authority/
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
export declare const cvaOptionCardLabel: (props?: ({
|
|
2
2
|
disabled?: boolean | null | undefined;
|
|
3
3
|
layout?: "default" | "compact" | null | undefined;
|
|
4
|
-
} & import("class-variance-authority/
|
|
5
|
-
export declare const cvaOptionCardContent: (props?: import("class-variance-authority/
|
|
6
|
-
export declare const cvaOptionCardContainer: (props?: import("class-variance-authority/
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const cvaOptionCardContent: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const cvaOptionCardContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
7
|
export declare const cvaOptionCardTitle: (props?: ({
|
|
8
8
|
layout?: "default" | "compact" | null | undefined;
|
|
9
9
|
disabled?: boolean | null | undefined;
|
|
10
|
-
} & import("class-variance-authority/
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
export declare const cvaOptionCardText: (props?: ({
|
|
12
12
|
type?: "subheading" | "description" | null | undefined;
|
|
13
13
|
disabled?: boolean | null | undefined;
|
|
14
|
-
} & import("class-variance-authority/
|
|
15
|
-
export declare const cvaInput: (props?: import("class-variance-authority/
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
export declare const cvaInput: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
16
16
|
export declare const cvaCustomImage: (props?: ({
|
|
17
17
|
disabled?: boolean | null | undefined;
|
|
18
|
-
} & import("class-variance-authority/
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
export declare const cvaTag: (props?: ({
|
|
20
20
|
layout?: "default" | "compact" | null | undefined;
|
|
21
|
-
} & import("class-variance-authority/
|
|
21
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const cvaInputGroup: (props?: ({
|
|
2
2
|
layout?: "inline" | null | undefined;
|
|
3
|
-
} & import("class-variance-authority/
|
|
3
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
4
4
|
export declare const cvaRadioItem: (props?: ({
|
|
5
5
|
checked?: boolean | null | undefined;
|
|
6
6
|
invalid?: boolean | null | undefined;
|
|
7
7
|
disabled?: boolean | null | undefined;
|
|
8
|
-
} & import("class-variance-authority/
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const cvaScheduleItem: (props?: import("class-variance-authority/
|
|
2
|
-
export declare const cvaScheduleItemText: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaScheduleItem: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaScheduleItemText: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const cvaSearch: (props?: ({
|
|
2
2
|
border?: boolean | null | undefined;
|
|
3
3
|
widenOnFocus?: boolean | null | undefined;
|
|
4
|
-
} & import("class-variance-authority/
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -2,4 +2,4 @@ export declare const cvaTextAreaBaseInput: (props?: ({
|
|
|
2
2
|
disabled?: boolean | null | undefined;
|
|
3
3
|
invalid?: boolean | null | undefined;
|
|
4
4
|
resize?: "both" | "vertical" | "horizontal" | "none" | null | undefined;
|
|
5
|
-
} & import("class-variance-authority/
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const cvaTimeRange: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaTimeRange: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const cvaToggleSwitchWrapper: (props?: import("class-variance-authority/
|
|
2
|
-
export declare const cvaToggleSwitchInput: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaToggleSwitchWrapper: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaToggleSwitchInput: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
3
|
export declare const cvaToggleSwitchTrack: (props?: ({
|
|
4
4
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
6
|
toggled?: boolean | null | undefined;
|
|
7
7
|
focused?: boolean | "auto" | null | undefined;
|
|
8
|
-
} & import("class-variance-authority/
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
export declare const cvaToggleSwitchThumb: (props?: ({
|
|
10
10
|
toggled?: boolean | null | undefined;
|
|
11
11
|
size?: "small" | "medium" | "large" | null | undefined;
|
|
12
|
-
} & import("class-variance-authority/
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const cvaUploadInputField: (props?: import("class-variance-authority/
|
|
1
|
+
export declare const cvaUploadInputField: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared CVA for binary control items: Checkbox, RadioItem, ToggleSwitchOption
|
|
3
3
|
*/
|
|
4
|
-
export declare const cvaBinaryControlWrapper: (props?: import("class-variance-authority/
|
|
5
|
-
export declare const cvaBinaryControlLabelTooltip: (props?: import("class-variance-authority/
|
|
6
|
-
export declare const cvaBinaryControlDescriptionTooltip: (props?: import("class-variance-authority/
|
|
4
|
+
export declare const cvaBinaryControlWrapper: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
|
+
export declare const cvaBinaryControlLabelTooltip: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const cvaBinaryControlDescriptionTooltip: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
7
|
export declare const cvaBinaryControlDescription: (props?: ({
|
|
8
8
|
disabled?: boolean | null | undefined;
|
|
9
|
-
} & import("class-variance-authority/
|
|
10
|
-
export declare const cvaBinaryControlSuffixContainer: (props?: import("class-variance-authority/
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const cvaBinaryControlSuffixContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|