@trackunit/react-components 0.1.66 → 0.1.68
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 +141 -114
- package/index.css +23 -24
- package/index.js +141 -115
- package/package.json +3 -2
- package/src/components/FormGroup/FormGroup.d.ts +2 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +1 -1
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +2 -2
- package/src/components/Popover/Popover.d.ts +69 -34
- package/src/components/Popover/PopoverContent.d.ts +7 -0
- package/src/components/Popover/PopoverTrigger.d.ts +12 -0
- package/src/components/Popover/PopoverTypes.d.ts +33 -0
- package/src/components/Popover/index.d.ts +3 -2
- package/src/components/Popover/usePopover.d.ts +56 -0
- package/src/components/Sidebar/Sidebar.d.ts +2 -0
- package/src/components/Popover/PopoverList.d.ts +0 -12
- package/src/components/Popover/PopoverListItem.d.ts +0 -30
package/index.cjs
CHANGED
|
@@ -7,9 +7,9 @@ var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var uiIcons = require('@trackunit/ui-icons');
|
|
9
9
|
var reactUse = require('react-use');
|
|
10
|
+
var uuid = require('uuid');
|
|
10
11
|
var dateFns = require('date-fns');
|
|
11
12
|
var react = require('@floating-ui/react');
|
|
12
|
-
var reactRouterDom = require('react-router-dom');
|
|
13
13
|
var reactDayPicker = require('react-day-picker');
|
|
14
14
|
var locale = require('date-fns/locale');
|
|
15
15
|
var reactBrowserHooks = require('react-browser-hooks');
|
|
@@ -19,6 +19,7 @@ var ReactAsyncCreatableSelect = require('react-select/async-creatable');
|
|
|
19
19
|
var ReactCreatableSelect = require('react-select/creatable');
|
|
20
20
|
var ReactAsyncSelect = require('react-select/async');
|
|
21
21
|
var libphonenumberJs = require('libphonenumber-js');
|
|
22
|
+
var reactRouterDom = require('react-router-dom');
|
|
22
23
|
var reactHelmetAsync = require('react-helmet-async');
|
|
23
24
|
var uiDesignTokens = require('@trackunit/ui-design-tokens');
|
|
24
25
|
|
|
@@ -392,7 +393,7 @@ const CustomIcon = tailwindStyledComponents.twx(Icon) `
|
|
|
392
393
|
* @returns {JSX.Element} Text component
|
|
393
394
|
*/
|
|
394
395
|
const Text$1 = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, className, dataTestId, }) => {
|
|
395
|
-
return (jsxRuntime.jsx(StyledText$
|
|
396
|
+
return (jsxRuntime.jsx(StyledText$3, Object.assign({ "$as": type, className: className, "$align": align, "$inverted": inverted, "$subtle": subtle, "$italicize": italicize, "$uppercase": uppercase, "$size": size, "$weight": weight, "$underline": underline, "data-testid": dataTestId }, { children: children })));
|
|
396
397
|
};
|
|
397
398
|
const getTextSize = () => ({ $size }) => {
|
|
398
399
|
const sizes = {
|
|
@@ -423,7 +424,7 @@ const getTextAlignment = () => ({ $align }) => {
|
|
|
423
424
|
};
|
|
424
425
|
return alignments[$align];
|
|
425
426
|
};
|
|
426
|
-
const StyledText$
|
|
427
|
+
const StyledText$3 = tailwindStyledComponents.tw.text `
|
|
427
428
|
tu-text
|
|
428
429
|
${getFontColor$1()}
|
|
429
430
|
${p => (p.$italicize ? tailwindStyledComponents.tws `tu-text--italic` : "")}
|
|
@@ -522,7 +523,7 @@ const Badge = (_a) => {
|
|
|
522
523
|
return null;
|
|
523
524
|
}
|
|
524
525
|
const displayedCount = count && max ? (count > max ? `${max}+` : count) : count;
|
|
525
|
-
return (jsxRuntime.jsx(StyledText$
|
|
526
|
+
return (jsxRuntime.jsx(StyledText$2, Object.assign({ className: className, "$color": color, "$subtle": subtle, "$count": count, "data-testid": dataTestId, "$as": "span" }, { children: displayedCount })));
|
|
526
527
|
};
|
|
527
528
|
const getBadgeModifierClass = () => ({ $color, $subtle }) => {
|
|
528
529
|
const colorClasses = {
|
|
@@ -531,7 +532,7 @@ const getBadgeModifierClass = () => ({ $color, $subtle }) => {
|
|
|
531
532
|
};
|
|
532
533
|
return colorClasses[$color];
|
|
533
534
|
};
|
|
534
|
-
const StyledText$
|
|
535
|
+
const StyledText$2 = tailwindStyledComponents.tw.text `
|
|
535
536
|
tu-badge
|
|
536
537
|
${({ $count }) => ($count === null || $count === undefined) && tailwindStyledComponents.tws `tu-badge--square`}
|
|
537
538
|
${getBadgeModifierClass()}
|
|
@@ -825,7 +826,7 @@ const CheckboxWrapper = tailwindStyledComponents.tw.span `
|
|
|
825
826
|
? tailwindStyledComponents.tws `tu-checkbox--selected`
|
|
826
827
|
: tailwindStyledComponents.tws `tu-checkbox--deselected`;
|
|
827
828
|
}}
|
|
828
|
-
|
|
829
|
+
|
|
829
830
|
${({ $isInvalid }) => $isInvalid && tailwindStyledComponents.tws `tu-checkbox--invalid`}
|
|
830
831
|
`;
|
|
831
832
|
|
|
@@ -907,17 +908,28 @@ const DateInput = React.forwardRef((_a, ref) => {
|
|
|
907
908
|
});
|
|
908
909
|
|
|
909
910
|
/**
|
|
910
|
-
*
|
|
911
|
-
*
|
|
911
|
+
* The hook that powers the Popover component.
|
|
912
|
+
* It should not be used directly, but rather through the Popover component.
|
|
913
|
+
*
|
|
914
|
+
* @param {PopoverProps} options The options for the popover
|
|
915
|
+
* @returns {ReturnType<usePopover>} The data for the popover
|
|
912
916
|
*/
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
|
|
917
|
+
const usePopover = (_a) => {
|
|
918
|
+
var { initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = { click: true, hover: false }, onOpenStateChange: setControlledIsOpen } = _a, restOptions = __rest(_a, ["initialOpen", "placement", "isModal", "isOpen", "activation", "onOpenStateChange"]);
|
|
919
|
+
const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(initialOpen);
|
|
920
|
+
const [labelId, setLabelId] = React.useState();
|
|
921
|
+
const [descriptionId, setDescriptionId] = React.useState();
|
|
922
|
+
const isOpen = controlledIsOpen !== null && controlledIsOpen !== void 0 ? controlledIsOpen : uncontrolledIsOpen;
|
|
923
|
+
const setIsOpen = setControlledIsOpen !== null && setControlledIsOpen !== void 0 ? setControlledIsOpen : setUncontrolledIsOpen;
|
|
924
|
+
const popoverData = react.useFloating({
|
|
925
|
+
placement,
|
|
926
|
+
open: isOpen,
|
|
927
|
+
onOpenChange: setIsOpen,
|
|
928
|
+
whileElementsMounted: react.autoUpdate,
|
|
918
929
|
middleware: [
|
|
919
930
|
react.offset(8),
|
|
920
931
|
react.flip({ fallbackPlacements: ["top", "bottom", "right", "left"] }),
|
|
932
|
+
react.shift(),
|
|
921
933
|
react.size({
|
|
922
934
|
apply({ availableWidth, availableHeight, elements }) {
|
|
923
935
|
Object.assign(elements.floating.style, {
|
|
@@ -926,83 +938,68 @@ const Popover = ({ children, render, placement, activation = { click: true, hove
|
|
|
926
938
|
});
|
|
927
939
|
},
|
|
928
940
|
}),
|
|
929
|
-
react.shift(),
|
|
930
941
|
],
|
|
931
|
-
placement,
|
|
932
|
-
whileElementsMounted: react.autoUpdate,
|
|
933
942
|
});
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
943
|
+
const popoverContext = popoverData.context;
|
|
944
|
+
const clickInteraction = react.useClick(popoverContext, { enabled: activation.click, ignoreMouse: activation.hover });
|
|
945
|
+
const dismissInteraction = react.useDismiss(popoverContext);
|
|
946
|
+
const hoverInteraction = react.useHover(popoverContext, { enabled: activation.hover });
|
|
947
|
+
const roleInteraction = react.useRole(popoverContext);
|
|
948
|
+
const combinedInteractions = react.useInteractions([
|
|
949
|
+
clickInteraction,
|
|
950
|
+
hoverInteraction,
|
|
951
|
+
dismissInteraction,
|
|
952
|
+
roleInteraction,
|
|
939
953
|
]);
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
display: "flex",
|
|
948
|
-
} }, getFloatingProps(), { children: render({
|
|
949
|
-
close: () => {
|
|
950
|
-
setOpen(false);
|
|
951
|
-
},
|
|
952
|
-
}) })) }))) }))] }));
|
|
953
|
-
};
|
|
954
|
-
// Utility to merge refs — Heavily inspired by https://github.com/gregberge/react-merge-refs
|
|
955
|
-
function mergeRefs(refs) {
|
|
956
|
-
return value => {
|
|
957
|
-
refs.forEach(ref => {
|
|
958
|
-
if (typeof ref === "function") {
|
|
959
|
-
ref(value);
|
|
960
|
-
}
|
|
961
|
-
else if (ref !== null) {
|
|
962
|
-
ref.current = value;
|
|
963
|
-
}
|
|
964
|
-
});
|
|
965
|
-
};
|
|
966
|
-
}
|
|
954
|
+
return React.useMemo(() => (Object.assign(Object.assign(Object.assign({ isOpen,
|
|
955
|
+
setIsOpen }, combinedInteractions), popoverData), { isModal,
|
|
956
|
+
labelId,
|
|
957
|
+
descriptionId,
|
|
958
|
+
setLabelId,
|
|
959
|
+
setDescriptionId, customProps: restOptions })), [isOpen, setIsOpen, combinedInteractions, popoverData, isModal, labelId, descriptionId, restOptions]);
|
|
960
|
+
};
|
|
967
961
|
|
|
962
|
+
const PopoverContext = React.createContext(null);
|
|
968
963
|
/**
|
|
969
|
-
*
|
|
964
|
+
* A hook to get the popover context.
|
|
965
|
+
* It should only be used by the Popover components.
|
|
970
966
|
*
|
|
971
|
-
* @
|
|
972
|
-
* @returns {JSX.Element} PopoverList component
|
|
967
|
+
* @returns {ContextType} The popover context
|
|
973
968
|
*/
|
|
974
|
-
const
|
|
975
|
-
|
|
969
|
+
const usePopoverContext = () => {
|
|
970
|
+
const context = React.useContext(PopoverContext);
|
|
971
|
+
if (context === null) {
|
|
972
|
+
throw new Error("Popover components must be wrapped in <Popover />");
|
|
973
|
+
}
|
|
974
|
+
return context;
|
|
976
975
|
};
|
|
977
|
-
const List = tailwindStyledComponents.tw.ul `
|
|
978
|
-
tu-popover-list
|
|
979
|
-
`;
|
|
980
|
-
const StyledCardBody = tailwindStyledComponents.twx(CardBody) `
|
|
981
|
-
tu-popover-list-body
|
|
982
|
-
`;
|
|
983
|
-
|
|
984
976
|
/**
|
|
985
|
-
* The
|
|
977
|
+
* The popover component.
|
|
978
|
+
* - This component should wrap all the popover components.
|
|
979
|
+
* - It returns a context that is used by the popover components.
|
|
980
|
+
* - The context is used to share the state of the popover, such as the open state and the reference element.
|
|
981
|
+
*
|
|
982
|
+
* To open the popover, use the `<PopoverTrigger />` component.
|
|
986
983
|
*
|
|
987
|
-
*
|
|
988
|
-
*
|
|
984
|
+
* To render the content of the popover, use the `<PopoverContent />` component.
|
|
985
|
+
*
|
|
986
|
+
*
|
|
987
|
+
* @param {PopoverProps} props The props for the popover
|
|
988
|
+
* @returns {JSX.Element} A Popover Context Provider contining the children
|
|
989
989
|
*/
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
};
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
const PopoverLink = tailwindStyledComponents.twx(reactRouterDom.Link) `
|
|
1004
|
-
tu-popover-list-item__anchor
|
|
1005
|
-
`;
|
|
990
|
+
const Popover = (_a) => {
|
|
991
|
+
var { children, isModal = false } = _a, restOptions = __rest(_a, ["children", "isModal"]);
|
|
992
|
+
const popover = usePopover(Object.assign({ isModal }, restOptions));
|
|
993
|
+
return jsxRuntime.jsx(PopoverContext.Provider, Object.assign({ value: popover }, { children: children }));
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
const PopoverContent = React__default["default"].forwardRef(function PopoverContent(_a, propRef) {
|
|
997
|
+
var _b, _c, _d, _e;
|
|
998
|
+
var { className, dataTestId, children } = _a, props = __rest(_a, ["className", "dataTestId", "children"]);
|
|
999
|
+
const _f = usePopoverContext(), { context: floatingContext, customProps } = _f, context = __rest(_f, ["context", "customProps"]);
|
|
1000
|
+
const ref = react.useMergeRefs([context.refs.setFloating, propRef]);
|
|
1001
|
+
return (jsxRuntime.jsx(react.FloatingPortal, Object.assign({ id: "tu-floating-ui" }, { children: context.isOpen && (jsxRuntime.jsx(react.FloatingFocusManager, Object.assign({ guards: false, context: floatingContext, modal: context.isModal, order: ["reference", "content"] }, { children: jsxRuntime.jsx("div", Object.assign({ ref: ref, className: `tu-popover-container animate-fade-in-fast ${(_b = className !== null && className !== void 0 ? className : customProps.className) !== null && _b !== void 0 ? _b : ""}`, "data-testid": (_c = dataTestId !== null && dataTestId !== void 0 ? dataTestId : customProps.dataTestId) !== null && _c !== void 0 ? _c : "popover-content", style: Object.assign({ position: context.strategy, top: (_d = context.y) !== null && _d !== void 0 ? _d : 0, left: (_e = context.x) !== null && _e !== void 0 ? _e : 0, width: "max-content" }, props.style), "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId }, context.getFloatingProps(props), { children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children })) }))) })));
|
|
1002
|
+
});
|
|
1006
1003
|
|
|
1007
1004
|
/**
|
|
1008
1005
|
* The PopoverTitle component.
|
|
@@ -1021,6 +1018,20 @@ const StyledText$1 = tailwindStyledComponents.twx(Text$1) `
|
|
|
1021
1018
|
tu-popover-title-text
|
|
1022
1019
|
`;
|
|
1023
1020
|
|
|
1021
|
+
const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
1022
|
+
var { children, renderButton } = _a, props = __rest(_a, ["children", "renderButton"]);
|
|
1023
|
+
const context = usePopoverContext();
|
|
1024
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1025
|
+
const childrenRef = children.ref;
|
|
1026
|
+
const ref = react.useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
1027
|
+
if (!renderButton && React.isValidElement(children)) {
|
|
1028
|
+
return React.cloneElement(children, context.getReferenceProps(Object.assign(Object.assign(Object.assign({ ref }, props), children.props), { "data-state": context.isOpen ? "open" : "closed" })));
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
return (jsxRuntime.jsx(Button, Object.assign({ ref: ref, type: "button", "data-state": context.isOpen ? "open" : "closed" }, context.getReferenceProps(props), { children: children })));
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1024
1035
|
/**
|
|
1025
1036
|
* The Tooltip component is used to show helpful tips or contextual information to the users.
|
|
1026
1037
|
*
|
|
@@ -1035,7 +1046,7 @@ const Tooltip = (_a) => {
|
|
|
1035
1046
|
}
|
|
1036
1047
|
return (jsxRuntime.jsx(TooltipContainer, Object.assign({ dataTestId: dataTestId }, rest, { children: wrappedChildren })));
|
|
1037
1048
|
};
|
|
1038
|
-
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.
|
|
1049
|
+
const TooltipContainer = ({ label, placement = "bottom", mode = "dark", contentTextType = "p", children, dataTestId, }) => (jsxRuntime.jsxs(StyledPopover, Object.assign({ className: "tu-tooltip__container", placement: placement, activation: { hover: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "" }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: children }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Content, Object.assign({ "$mode": mode }, { children: jsxRuntime.jsx(Text$1, Object.assign({ inverted: mode === "dark", type: contentTextType }, { children: label })) })) })] })));
|
|
1039
1050
|
const Flex$1 = tailwindStyledComponents.tw.div `
|
|
1040
1051
|
inline-flex
|
|
1041
1052
|
`;
|
|
@@ -1069,13 +1080,13 @@ const TipContainer = tailwindStyledComponents.tw.text `
|
|
|
1069
1080
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
1070
1081
|
* @returns {JSX.Element} FormGroup component
|
|
1071
1082
|
*/
|
|
1072
|
-
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, children, disabled = false, }) => {
|
|
1073
|
-
return (jsxRuntime.jsxs(FormGroupRoot, Object.assign({ className: className, "data-testid": dataTestId, "$disabled": disabled }, { children: [jsxRuntime.jsxs(ContainerBefore, { children: [jsxRuntime.jsx(FormGroupLabel, Object.assign({ dataTestId: dataTestId && `${dataTestId}-label
|
|
1083
|
+
const FormGroup = ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, disabled = false, }) => {
|
|
1084
|
+
return (jsxRuntime.jsxs(FormGroupRoot, Object.assign({ className: className, "data-testid": dataTestId, "$disabled": disabled }, { children: [jsxRuntime.jsxs(ContainerBefore, { children: [jsxRuntime.jsx(FormGroupLabel, Object.assign({ dataTestId: dataTestId && `${dataTestId}-label`, htmlFor: htmlFor, id: htmlFor + "-label" }, { children: label })), tip && jsxRuntime.jsx(Tip, Object.assign({ dataTestId: dataTestId && `${dataTestId}-tip` }, { children: tip }))] }), children, jsxRuntime.jsxs(ContainerAfter, Object.assign({ "$isInvalid": isInvalid }, { children: [helpText && jsxRuntime.jsx("span", Object.assign({ "data-testid": dataTestId && `${dataTestId}-helpText` }, { children: helpText })), helpAddon && jsxRuntime.jsx(HelpAddon, Object.assign({ "data-testid": dataTestId && `${dataTestId}-helpAddon` }, { children: helpAddon }))] }))] })));
|
|
1074
1085
|
};
|
|
1075
|
-
const FormGroupRoot = tailwindStyledComponents.tw.
|
|
1086
|
+
const FormGroupRoot = tailwindStyledComponents.tw.div `
|
|
1076
1087
|
tu-form-group
|
|
1077
1088
|
${({ $disabled }) => {
|
|
1078
|
-
return $disabled ? "pointer-events-none
|
|
1089
|
+
return $disabled ? "pointer-events-none" : null;
|
|
1079
1090
|
}}
|
|
1080
1091
|
`;
|
|
1081
1092
|
const ContainerBefore = tailwindStyledComponents.tw.div `
|
|
@@ -1089,7 +1100,7 @@ const ContainerAfter = tailwindStyledComponents.tw.div `
|
|
|
1089
1100
|
${({ $isInvalid }) => ($isInvalid ? tailwindStyledComponents.tws `tu-form-group__container-after--invalid` : null)}
|
|
1090
1101
|
`;
|
|
1091
1102
|
const HelpAddon = tailwindStyledComponents.tw.span `
|
|
1092
|
-
tu-form-group__help-addon
|
|
1103
|
+
tu-form-group__help-addon
|
|
1093
1104
|
`;
|
|
1094
1105
|
|
|
1095
1106
|
/**
|
|
@@ -1100,9 +1111,10 @@ const HelpAddon = tailwindStyledComponents.tw.span `
|
|
|
1100
1111
|
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
1101
1112
|
*/
|
|
1102
1113
|
const DateField = React.forwardRef((_a, ref) => {
|
|
1103
|
-
var { label, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
|
|
1114
|
+
var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
|
|
1104
1115
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
1105
|
-
|
|
1116
|
+
const htmlForId = id ? id : "dateField-" + uuid.v4();
|
|
1117
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(DateInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, defaultValue: defaultValue, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1106
1118
|
});
|
|
1107
1119
|
|
|
1108
1120
|
const localeLookup = {
|
|
@@ -1155,7 +1167,7 @@ const DayPicker = ({ onDaySelect, disabledDays, selectedDays, language, classNam
|
|
|
1155
1167
|
* @returns {JSX.Element} DayPickerPopover component
|
|
1156
1168
|
*/
|
|
1157
1169
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
1158
|
-
return (jsxRuntime.
|
|
1170
|
+
return (jsxRuntime.jsxs(Popover, Object.assign({ placement: placement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(Button, Object.assign({ color: color, size: size, className: className, prefix: jsxRuntime.jsx(Icon, { name: "CalendarIcon", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker" }, { children: buttonContent })) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Card, { children: jsxRuntime.jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) }) })] })));
|
|
1159
1171
|
};
|
|
1160
1172
|
|
|
1161
1173
|
/**
|
|
@@ -1316,15 +1328,16 @@ const EmailInput = React__namespace.forwardRef((_a, ref) => {
|
|
|
1316
1328
|
*
|
|
1317
1329
|
*/
|
|
1318
1330
|
const EmailField = React.forwardRef((_a, ref) => {
|
|
1319
|
-
var { label, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
1331
|
+
var { label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
1320
1332
|
const [value, setValue] = React.useState(defaultValue);
|
|
1333
|
+
const htmlForId = id ? id : "emailField-" + uuid.v4();
|
|
1321
1334
|
// Type guard to check if value is a string
|
|
1322
1335
|
function isString(inputValue) {
|
|
1323
1336
|
return typeof inputValue === "string";
|
|
1324
1337
|
}
|
|
1325
1338
|
// Check the regular expression only if value is a string
|
|
1326
1339
|
const renderAsInvalid = !!errorMessage || (isString(value) && !/^\S+@\S+\.\S+$/.test(value));
|
|
1327
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(EmailInput, Object.assign({ ref: ref, value: value, onChange: e => setValue(e.target.value), isInvalid: renderAsInvalid, disabled: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1340
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(EmailInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, value: value, onChange: e => setValue(e.target.value), isInvalid: renderAsInvalid, disabled: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1328
1341
|
});
|
|
1329
1342
|
|
|
1330
1343
|
/**
|
|
@@ -1439,7 +1452,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
|
|
|
1439
1452
|
return (jsxRuntime.jsxs(Container$4, Object.assign({}, containerProps, { onClick: e => {
|
|
1440
1453
|
e.stopPropagation();
|
|
1441
1454
|
onClick && onClick(e);
|
|
1442
|
-
}, "$selected": selected, "$focused": focused, tabIndex: 0, "$disabled": disabled }, { children: [prefix && (jsxRuntime.jsx(Prefix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-prefix` }, { children: prefix }))), children
|
|
1455
|
+
}, "$selected": selected, "$focused": focused, tabIndex: 0, "$disabled": disabled }, { children: [prefix && (jsxRuntime.jsx(Prefix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-prefix` }, { children: prefix }))), children && typeof children !== "string" ? (children) : (jsxRuntime.jsx(Label, Object.assign({ "data-testid": dataTestId && `${dataTestId}-label` }, { children: children !== null && children !== void 0 ? children : label }))), suffix && (jsxRuntime.jsx(Suffix, Object.assign({ "$selected": selected, "data-testid": dataTestId && `${dataTestId}-suffix` }, { children: suffix })))] })));
|
|
1443
1456
|
};
|
|
1444
1457
|
const Container$4 = tailwindStyledComponents.tw.div `
|
|
1445
1458
|
group tu-menu-item
|
|
@@ -1470,7 +1483,7 @@ const MenuList = (_a) => {
|
|
|
1470
1483
|
var { dataTestId, className, children, withStickyHeader = false, showDivider = false } = _a; __rest(_a, ["dataTestId", "className", "children", "withStickyHeader", "showDivider"]);
|
|
1471
1484
|
const childrenArr = React.Children.toArray(children);
|
|
1472
1485
|
const isLastItem = (index) => index === childrenArr.length - 1;
|
|
1473
|
-
return (jsxRuntime.jsx(Container$3, Object.assign({ "$withStickyHeader": withStickyHeader, "data-testid": dataTestId, className: className, tabIndex: 0 }, { children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsxRuntime.jsx(Divider, {})] }))) })));
|
|
1486
|
+
return (jsxRuntime.jsx(Container$3, Object.assign({ "$withStickyHeader": withStickyHeader, "data-testid": dataTestId, className: className, tabIndex: 0, role: "list" }, { children: React.Children.map(childrenArr, (menuItem, index) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [menuItem, showDivider && !isLastItem(index) && jsxRuntime.jsx(Divider, {})] }))) })));
|
|
1474
1487
|
};
|
|
1475
1488
|
const Container$3 = tailwindStyledComponents.tw.div `
|
|
1476
1489
|
tu-menu-list
|
|
@@ -1501,9 +1514,9 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1501
1514
|
reactBrowserHooks.useClickOutside(actionMenuRef, () => {
|
|
1502
1515
|
setActionMenuIsOpen(false);
|
|
1503
1516
|
});
|
|
1504
|
-
return (jsxRuntime.jsx(Root$4, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.
|
|
1505
|
-
|
|
1506
|
-
|
|
1517
|
+
return (jsxRuntime.jsx(Root$4, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name: dotsName }, iconProps)), onClick: () => {
|
|
1518
|
+
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1519
|
+
} })) }), jsxRuntime.jsx(PopoverContent, { children: children })] })) })));
|
|
1507
1520
|
};
|
|
1508
1521
|
const Root$4 = tailwindStyledComponents.tw.div `
|
|
1509
1522
|
tu-more-menu
|
|
@@ -1599,9 +1612,10 @@ const NumberInput = React.forwardRef((props, ref) => (jsxRuntime.jsx(BaseInput,
|
|
|
1599
1612
|
* _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
|
|
1600
1613
|
*/
|
|
1601
1614
|
const NumberField = React.forwardRef((_a, ref) => {
|
|
1602
|
-
var { label, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
|
|
1615
|
+
var { label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "maxLength", "className", "value", "dataTestId"]);
|
|
1603
1616
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
1604
|
-
|
|
1617
|
+
const htmlForId = id ? id : "numberField-" + uuid.v4();
|
|
1618
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(NumberInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
1605
1619
|
});
|
|
1606
1620
|
|
|
1607
1621
|
/**
|
|
@@ -2330,9 +2344,10 @@ const Container = tailwindStyledComponents.tw.div `
|
|
|
2330
2344
|
* @returns {JSX.Element} - The PhoneField component.
|
|
2331
2345
|
*/
|
|
2332
2346
|
const PhoneField = React.forwardRef((_a, ref) => {
|
|
2333
|
-
var { label, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "isInvalid", "errorMessage", "value", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
2347
|
+
var { label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "isInvalid", "errorMessage", "value", "helpAddon", "className", "defaultValue", "dataTestId"]);
|
|
2334
2348
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2335
|
-
|
|
2349
|
+
const htmlForId = id ? id : "phoneField-" + uuid.v4();
|
|
2350
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon, disabled: rest.disabled, className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(PhoneInput, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", value: value || defaultValue, isInvalid: renderAsInvalid }, rest)) })));
|
|
2336
2351
|
});
|
|
2337
2352
|
|
|
2338
2353
|
function useConfirmExit(confirmExit, when = true) {
|
|
@@ -2426,7 +2441,7 @@ ${({ $inline }) => ($inline ? tailwindStyledComponents.tws `tu-radiogroup--inlin
|
|
|
2426
2441
|
const RadioItem = ({ label, value, dataTestId, className, description }) => {
|
|
2427
2442
|
const groupCtx = React__namespace.useContext(RadioGroupContext);
|
|
2428
2443
|
const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
|
|
2429
|
-
return (jsxRuntime.jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}
|
|
2444
|
+
return (jsxRuntime.jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Wrapper` }, { children: [jsxRuntime.jsx(Input, { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, type: "radio", role: "radio", value: value, checked: isChecked, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid, onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange, "data-testid": dataTestId, "$checked": isChecked }), jsxRuntime.jsxs(LabelContainer$1, { children: [jsxRuntime.jsx(Label$2, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid }, { children: label })), description && (jsxRuntime.jsx(Description$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }, { children: description })))] })] })));
|
|
2430
2445
|
};
|
|
2431
2446
|
const InputWrapper = tailwindStyledComponents.tw.label `tu-radioitem__wrapper`;
|
|
2432
2447
|
const Input = tailwindStyledComponents.tw.input `
|
|
@@ -2586,9 +2601,17 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
2586
2601
|
circular: false,
|
|
2587
2602
|
variant: "transparent",
|
|
2588
2603
|
color: "secondary",
|
|
2589
|
-
}, menuPlacement: "bottom-end" }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId && `${dataTestId}-more-menu` }, { children: jsxRuntime.jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId && `${dataTestId}-menu-list` }, { children: React__default["default"].Children.map(children, child => {
|
|
2590
|
-
return itemOverflowMap[child.props.id]
|
|
2591
|
-
|
|
2604
|
+
}, menuPlacement: "bottom-end" }, moreMenuProps, { className: `${(moreMenuProps === null || moreMenuProps === void 0 ? void 0 : moreMenuProps.className) || ""} !p-0`, dataTestId: dataTestId && `${dataTestId}-more-menu` }, { children: close => (jsxRuntime.jsx(MenuList, Object.assign({}, menuListProps, { dataTestId: dataTestId && `${dataTestId}-menu-list` }, { children: React__default["default"].Children.map(children, child => {
|
|
2605
|
+
return itemOverflowMap[child.props.id]
|
|
2606
|
+
? React__default["default"].cloneElement(child, {
|
|
2607
|
+
onClick: () => {
|
|
2608
|
+
var _a, _b;
|
|
2609
|
+
(_b = (_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2610
|
+
close();
|
|
2611
|
+
},
|
|
2612
|
+
})
|
|
2613
|
+
: null;
|
|
2614
|
+
}) }))) }))) : null] })));
|
|
2592
2615
|
};
|
|
2593
2616
|
const Root$2 = tailwindStyledComponents.tw.div `
|
|
2594
2617
|
tu-sidebar
|
|
@@ -2613,7 +2636,7 @@ const ChildContainer = tailwindStyledComponents.tw.div `
|
|
|
2613
2636
|
*/
|
|
2614
2637
|
const TextArea = React__namespace.forwardRef((_a, ref) => {
|
|
2615
2638
|
var { id, name, value, rows, disabled, placeholder, readOnly, tabIndex, onChange, onFocus, onBlur, maxLength, resize = "vertical", defaultValue, className, required, dataTestId, isInvalid } = _a, rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "className", "required", "dataTestId", "isInvalid"]);
|
|
2616
|
-
return (jsxRuntime.jsx(StyledTextArea, Object.assign({ name: name, value: value, rows: rows, disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, onFocus: onFocus, onBlur: onBlur, maxLength: maxLength, "$resize": resize, "$invalid": isInvalid, ref: ref, defaultValue: defaultValue, required: required }, rest, { onChange: onChange, "data-testid": dataTestId })));
|
|
2639
|
+
return (jsxRuntime.jsx(StyledTextArea, Object.assign({ id: id, name: name, value: value, rows: rows, disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, onFocus: onFocus, onBlur: onBlur, maxLength: maxLength, "$resize": resize, "$invalid": isInvalid, ref: ref, defaultValue: defaultValue, required: required }, rest, { onChange: onChange, "data-testid": dataTestId })));
|
|
2617
2640
|
});
|
|
2618
2641
|
const StyledTextArea = tailwindStyledComponents.tw.textarea `
|
|
2619
2642
|
tu-textarea
|
|
@@ -2650,17 +2673,18 @@ const Root$1 = tailwindStyledComponents.tw.span `
|
|
|
2650
2673
|
`;
|
|
2651
2674
|
|
|
2652
2675
|
const TextAreaField = React__namespace.forwardRef((_a, ref) => {
|
|
2653
|
-
var { label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2676
|
+
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2654
2677
|
const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
|
|
2655
2678
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2679
|
+
const htmlForId = id ? id : "textAreaField-" + uuid.v4();
|
|
2656
2680
|
const handleChange = React__namespace.useCallback((event) => {
|
|
2657
2681
|
setValueLength(event.target.value.length);
|
|
2658
2682
|
if (onChange) {
|
|
2659
2683
|
onChange(event);
|
|
2660
2684
|
}
|
|
2661
2685
|
}, [onChange]);
|
|
2662
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon ||
|
|
2663
|
-
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(TextArea, Object.assign({ ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2686
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon ||
|
|
2687
|
+
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), className: className, dataTestId: dataTestId && `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(TextArea, Object.assign({ id: htmlForId, "aria-labelledby": htmlForId + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2664
2688
|
});
|
|
2665
2689
|
|
|
2666
2690
|
/**
|
|
@@ -2671,17 +2695,18 @@ const TextAreaField = React__namespace.forwardRef((_a, ref) => {
|
|
|
2671
2695
|
* _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
|
|
2672
2696
|
*/
|
|
2673
2697
|
const TextField = React__namespace.forwardRef((_a, ref) => {
|
|
2674
|
-
var { label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2698
|
+
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
2675
2699
|
const [valueLength, setValueLength] = React__namespace.useState(value ? `${value}`.length : 0);
|
|
2676
2700
|
const renderAsInvalid = isInvalid === undefined ? Boolean(errorMessage) : isInvalid;
|
|
2701
|
+
const htmlFor = id ? id : "textField-" + uuid.v4();
|
|
2677
2702
|
const handleChange = React__namespace.useCallback((event) => {
|
|
2678
2703
|
setValueLength(event.target.value.length);
|
|
2679
2704
|
if (onChange) {
|
|
2680
2705
|
onChange(event);
|
|
2681
2706
|
}
|
|
2682
2707
|
}, [onChange]);
|
|
2683
|
-
return (jsxRuntime.jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon ||
|
|
2684
|
-
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.readOnly }, { children: jsxRuntime.jsx(TextInput, Object.assign({ ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2708
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlFor, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: (renderAsInvalid && errorMessage) || helpText, helpAddon: helpAddon ||
|
|
2709
|
+
(maxLength !== null && maxLength !== undefined && (jsxRuntime.jsx(TextLengthIndicator, { length: valueLength, maxLength: maxLength }))), dataTestId: dataTestId && `${dataTestId}-FormGroup`, disabled: rest.readOnly }, { children: jsxRuntime.jsx(TextInput, Object.assign({ id: htmlFor, "aria-labelledby": htmlFor + "-label", ref: ref, maxLength: maxLength, value: value, isInvalid: renderAsInvalid }, rest, { className: className, onChange: handleChange, dataTestId: dataTestId })) })));
|
|
2685
2710
|
});
|
|
2686
2711
|
|
|
2687
2712
|
/**
|
|
@@ -2769,9 +2794,10 @@ tu-upload-input`;
|
|
|
2769
2794
|
* Upload fields enable the user to upload Files.
|
|
2770
2795
|
*/
|
|
2771
2796
|
const UploadField = React.forwardRef((_a, ref) => {
|
|
2772
|
-
var { label, tip, helpText, errorMessage, isInvalid, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "isInvalid", "className", "value", "dataTestId"]);
|
|
2797
|
+
var { label, id, tip, helpText, errorMessage, isInvalid, className, value, dataTestId } = _a, rest = __rest(_a, ["label", "id", "tip", "helpText", "errorMessage", "isInvalid", "className", "value", "dataTestId"]);
|
|
2773
2798
|
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2774
|
-
|
|
2799
|
+
const htmlForId = id ? id : "uploadField-" + uuid.v4();
|
|
2800
|
+
return (jsxRuntime.jsx(FormGroup, Object.assign({ htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, dataTestId: `${dataTestId}-FormGroup` }, { children: jsxRuntime.jsx(UploadInput, Object.assign({ ref: ref, id: htmlForId, "aria-labelledby": htmlForId + "-label", isInvalid: renderAsInvalid }, rest, { className: className, dataTestId: dataTestId })) })));
|
|
2775
2801
|
});
|
|
2776
2802
|
|
|
2777
2803
|
/**
|
|
@@ -3266,9 +3292,9 @@ exports.Pagination = Pagination;
|
|
|
3266
3292
|
exports.PhoneField = PhoneField;
|
|
3267
3293
|
exports.PhoneInput = PhoneInput;
|
|
3268
3294
|
exports.Popover = Popover;
|
|
3269
|
-
exports.
|
|
3270
|
-
exports.PopoverListItem = PopoverListItem;
|
|
3295
|
+
exports.PopoverContent = PopoverContent;
|
|
3271
3296
|
exports.PopoverTitle = PopoverTitle;
|
|
3297
|
+
exports.PopoverTrigger = PopoverTrigger;
|
|
3272
3298
|
exports.Prompt = Prompt;
|
|
3273
3299
|
exports.ROLE_CARD = ROLE_CARD;
|
|
3274
3300
|
exports.RadioGroup = RadioGroup;
|
|
@@ -3311,5 +3337,6 @@ exports.useDebounce = useDebounce;
|
|
|
3311
3337
|
exports.useDevicePixelRatio = useDevicePixelRatio;
|
|
3312
3338
|
exports.useLocalStorage = useLocalStorage;
|
|
3313
3339
|
exports.useModal = useModal;
|
|
3340
|
+
exports.usePopoverContext = usePopoverContext;
|
|
3314
3341
|
exports.usePrompt = usePrompt;
|
|
3315
3342
|
exports.useTimeout = useTimeout;
|
package/index.css
CHANGED
|
@@ -223,16 +223,15 @@
|
|
|
223
223
|
|
|
224
224
|
/* CSS related to the RadioGroup component */
|
|
225
225
|
.tu-radiogroup {
|
|
226
|
-
@apply flex
|
|
227
|
-
gap-2
|
|
228
|
-
|
|
229
|
-
flex-col
|
|
226
|
+
@apply flex
|
|
227
|
+
gap-2
|
|
228
|
+
flex-col
|
|
230
229
|
items-start;
|
|
231
230
|
|
|
232
231
|
&--inline {
|
|
233
|
-
@apply flex
|
|
234
|
-
gap-3
|
|
235
|
-
flex-row
|
|
232
|
+
@apply flex
|
|
233
|
+
gap-3
|
|
234
|
+
flex-row
|
|
236
235
|
items-center;
|
|
237
236
|
}
|
|
238
237
|
}
|
|
@@ -240,14 +239,14 @@
|
|
|
240
239
|
.tu-radioitem {
|
|
241
240
|
@apply w-4
|
|
242
241
|
h-4
|
|
243
|
-
appearance-none
|
|
244
|
-
rounded-3xl
|
|
245
|
-
bg-white
|
|
246
|
-
border-solid
|
|
247
|
-
border
|
|
248
|
-
border-slate-300
|
|
242
|
+
appearance-none
|
|
243
|
+
rounded-3xl
|
|
244
|
+
bg-white
|
|
245
|
+
border-solid
|
|
246
|
+
border
|
|
247
|
+
border-slate-300
|
|
249
248
|
shadow-sm
|
|
250
|
-
shrink-0
|
|
249
|
+
shrink-0
|
|
251
250
|
transition
|
|
252
251
|
box-border
|
|
253
252
|
hover:cursor-pointer
|
|
@@ -257,19 +256,19 @@
|
|
|
257
256
|
focus:ring-blue-700;
|
|
258
257
|
|
|
259
258
|
&__wrapper {
|
|
260
|
-
@apply flex
|
|
259
|
+
@apply flex
|
|
261
260
|
gap-2
|
|
262
261
|
items-center;
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
&--checked {
|
|
266
|
-
@apply border-solid
|
|
267
|
-
border-4
|
|
265
|
+
@apply border-solid
|
|
266
|
+
border-4
|
|
268
267
|
border-blue-600
|
|
269
268
|
bg-white
|
|
270
|
-
hover:bg-slate-100
|
|
269
|
+
hover:bg-slate-100
|
|
271
270
|
hover:cursor-pointer
|
|
272
|
-
outline-0
|
|
271
|
+
outline-0
|
|
273
272
|
active:bg-slate-200
|
|
274
273
|
active:ring-2
|
|
275
274
|
active:ring-offset-2
|
|
@@ -292,8 +291,8 @@
|
|
|
292
291
|
}
|
|
293
292
|
|
|
294
293
|
&--disabled {
|
|
295
|
-
@apply bg-slate-400
|
|
296
|
-
border-slate-300
|
|
294
|
+
@apply bg-slate-400
|
|
295
|
+
border-slate-300
|
|
297
296
|
cursor-not-allowed
|
|
298
297
|
group-hover:bg-slate-400
|
|
299
298
|
group-focus:bg-slate-400
|
|
@@ -316,12 +315,12 @@
|
|
|
316
315
|
}
|
|
317
316
|
|
|
318
317
|
&__description {
|
|
319
|
-
@apply text-sm
|
|
318
|
+
@apply text-sm
|
|
320
319
|
font-normal
|
|
321
|
-
text-slate-500
|
|
320
|
+
text-slate-500
|
|
322
321
|
text-left
|
|
323
322
|
whitespace-nowrap
|
|
324
|
-
text-ellipsis
|
|
323
|
+
text-ellipsis
|
|
325
324
|
overflow-hidden;
|
|
326
325
|
|
|
327
326
|
&--disabled {
|