@luscii-healthtech/web-ui 20.6.0 → 20.7.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/dist/components/ButtonV2/ButtonProps.type.d.ts +5 -0
- package/dist/index.development.js +71 -57
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/web-ui-tailwind.css +89 -4
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +2 -1
|
@@ -6,6 +6,11 @@ import { TextColor, TextHoverColor } from "../Text/Text";
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export interface BaseButtonProps extends React.ComponentPropsWithRef<"button"> {
|
|
9
|
+
size?: "medium" | "large";
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `children` instead.
|
|
13
|
+
*/
|
|
9
14
|
text?: string;
|
|
10
15
|
icon?: React.FunctionComponent<IconProps> | IconKey;
|
|
11
16
|
isDisabled?: boolean;
|
|
@@ -1063,7 +1063,7 @@ toast.info = (message) => {
|
|
|
1063
1063
|
});
|
|
1064
1064
|
};
|
|
1065
1065
|
|
|
1066
|
-
var css_248z$k = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FILE IN FUTURE CHANGES. WE SHOULD BE\n * USING TAILWIND CLASSES DIRECTLY IN OUR COMPONENTS.\n */\n.title-avenir {\n font-family: \"AvenirNextLTPro-Bold\", \"Roboto\", sans-serif;\n}\n\n.title-inter {\n font-family: \"Inter\", \"Roboto\", \"Helvetica\", sans-serif;\n}";
|
|
1066
|
+
var css_248z$k = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FILE IN FUTURE CHANGES. WE SHOULD BE\n * USING TAILWIND CLASSES DIRECTLY IN OUR COMPONENTS.\n */\n/** Load Avenir fonts for titles */\n@font-face {\n font-family: \"AvenirNextLTPro-Regular\";\n src: url(\"../../../public/fonts/avenir/3A0AF8_1_0.eot\");\n src: url(\"../../../public/fonts/avenir/3A0AF8_1_0.eot\") format(\"embedded-opentype\"), url(\"../../../public/fonts/avenir/3A0AF8_1_0.woff2\") format(\"woff2\"), url(\"../../../public/fonts/avenir/3A0AF8_1_0.woff\") format(\"woff\"), url(\"../../../public/fonts/avenir/3A0AF8_1_0.ttf\") format(\"truetype\");\n}\n@font-face {\n font-family: \"AvenirNextLTPro-Bold\";\n src: url(\"../../../public/fonts/avenir/3A0AF8_0_0.eot\");\n src: url(\"../../../public/fonts/avenir/3A0AF8_0_0.eot\") format(\"embedded-opentype\"), url(\"../../../public/fonts/avenir/3A0AF8_0_0.woff2\") format(\"woff2\"), url(\"../../../public/fonts/avenir/3A0AF8_0_0.woff\") format(\"woff\"), url(\"../../../public/fonts/avenir/3A0AF8_0_0.ttf\") format(\"truetype\");\n}\n.title-avenir {\n font-family: \"AvenirNextLTPro-Bold\", \"Roboto\", sans-serif;\n}\n\n.title-inter {\n font-family: \"Inter\", \"Roboto\", \"Helvetica\", sans-serif;\n}";
|
|
1067
1067
|
styleInject(css_248z$k);
|
|
1068
1068
|
|
|
1069
1069
|
const Title = (props) => {
|
|
@@ -1147,7 +1147,7 @@ const Accordion = ({ dataTestId, isCollapsedByDefault = false, items, className,
|
|
|
1147
1147
|
);
|
|
1148
1148
|
};
|
|
1149
1149
|
|
|
1150
|
-
var css_248z$j = ".list-skeleton .skeleton-box {\n display: inline-block;\n height: 1em;\n position: relative;\n overflow: hidden;\n background-color: #cbd5e1;\n border-radius: 3px;\n}\n.list-skeleton .skeleton-box::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0));\n animation: shimmer 800ms infinite;\n content: \"\";\n}\n.list-skeleton .skeleton-box.is-circle {\n border-radius: 50%;\n}\n.list-skeleton .skeleton-box.is-button
|
|
1150
|
+
var css_248z$j = ".list-skeleton .skeleton-box {\n display: inline-block;\n height: 1em;\n position: relative;\n overflow: hidden;\n background-color: #cbd5e1;\n border-radius: 3px;\n}\n.list-skeleton .skeleton-box::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0));\n animation: shimmer 800ms infinite;\n content: \"\";\n}\n.list-skeleton .skeleton-box.is-circle {\n border-radius: 50%;\n}\n.list-skeleton .skeleton-box.is-button::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(90deg, rgba(221, 221, 221, 0) 0, rgba(221, 221, 221, 0.2) 20%, rgba(221, 221, 221, 0.5) 60%, rgba(221, 221, 221, 0));\n animation: shimmer 800ms infinite;\n content: \"\";\n}\n@keyframes shimmer {\n 100% {\n transform: translateX(100%);\n }\n}";
|
|
1151
1151
|
styleInject(css_248z$j);
|
|
1152
1152
|
|
|
1153
1153
|
const ListItemSkeleton = () => {
|
|
@@ -1176,7 +1176,7 @@ const ListSkeleton = ({ items, dataTestId = "list-skeleton" }) => {
|
|
|
1176
1176
|
"div",
|
|
1177
1177
|
{ className: "ui-flex ui-flex-row ui-items-center ui-px-4 ui-py-2" },
|
|
1178
1178
|
React__namespace.default.createElement("div", { className: "skeleton-box", style: { width: `${160}px`, height: `${14}px` } }),
|
|
1179
|
-
React__namespace.default.createElement("div", { className: "skeleton-box is-button ui-ml-auto", style: { width: `${110}px`, height: `${
|
|
1179
|
+
React__namespace.default.createElement("div", { className: "skeleton-box is-button ui-ml-auto ui-bg-slate-200 ui-radius-xxs", style: { width: `${110}px`, height: `${36}px` } })
|
|
1180
1180
|
),
|
|
1181
1181
|
skeletonItems
|
|
1182
1182
|
);
|
|
@@ -1622,32 +1622,46 @@ const Spinner = (props) => {
|
|
|
1622
1622
|
|
|
1623
1623
|
const ButtonV2 = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
1624
1624
|
var _b, _c;
|
|
1625
|
-
var { onClick, text, textColor, textHoverColor, icon, isDisabled, isPending, className, title, dataTestId, type = "button" } = _a, otherAttributes = __rest(_a, ["onClick", "text", "textColor", "textHoverColor", "icon", "isDisabled", "isPending", "className", "title", "dataTestId", "type"]);
|
|
1625
|
+
var { children, size = "medium", onClick, text, textColor, textHoverColor, icon, isDisabled, isPending, className, title, dataTestId, type = "button" } = _a, otherAttributes = __rest(_a, ["children", "size", "onClick", "text", "textColor", "textHoverColor", "icon", "isDisabled", "isPending", "className", "title", "dataTestId", "type"]);
|
|
1626
1626
|
const generatedId = React__namespace.default.useId();
|
|
1627
1627
|
const buttonId = (_b = otherAttributes.id) !== null && _b !== void 0 ? _b : generatedId;
|
|
1628
1628
|
const buttonTooltipId = `button-tooltip-id-${buttonId}`;
|
|
1629
|
+
const content = children !== null && children !== void 0 ? children : text;
|
|
1630
|
+
const isInteractive = !isDisabled && !isPending;
|
|
1631
|
+
const hasContentAndIcon = content && icon;
|
|
1629
1632
|
function handleClick(event) {
|
|
1630
1633
|
event.stopPropagation();
|
|
1631
1634
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
1632
1635
|
}
|
|
1633
|
-
if (!
|
|
1634
|
-
console.error("
|
|
1636
|
+
if (!content && !icon) {
|
|
1637
|
+
console.error("Content (`text` or `children` prop) or an icon is required to use this component, please make sure to pass at least one of them as a prop.");
|
|
1635
1638
|
return React__namespace.default.createElement("span", null, "Invalid props passed to this component.");
|
|
1636
1639
|
}
|
|
1637
1640
|
const buttonClassName = classNames__default.default([
|
|
1638
|
-
"ui-
|
|
1641
|
+
"[transition:transform_150ms,box-shadow_150ms,color_150ms,background-color_150ms,border-color_150ms,background-position_300ms] ui-ease-out",
|
|
1639
1642
|
"ui-border",
|
|
1640
|
-
"ui-
|
|
1641
|
-
"ui-
|
|
1642
|
-
"ui-leading-none",
|
|
1643
|
-
"ui-cursor-pointer",
|
|
1644
|
-
"focus:ui-outline-primary",
|
|
1643
|
+
"ui-radius-xxs",
|
|
1644
|
+
"ui-outline-offset-4 focus:ui-outline-primary",
|
|
1645
1645
|
"ui-group",
|
|
1646
|
-
"ui-
|
|
1646
|
+
"ui-relative",
|
|
1647
|
+
"ui-inline-flex ui-flex-row ui-items-center ui-justify-center ui-gap-xxs ui-flex-shrink-0",
|
|
1648
|
+
"ui-shadow-sm"
|
|
1647
1649
|
], {
|
|
1648
1650
|
"ui-opacity-50": isDisabled,
|
|
1649
|
-
"ui-
|
|
1650
|
-
"ui-
|
|
1651
|
+
"ui-cursor-not-allowed": isPending !== null && isPending !== void 0 ? isPending : isDisabled,
|
|
1652
|
+
"active:ui-shadow-none active:ui-scale-[0.98]": isInteractive,
|
|
1653
|
+
/**
|
|
1654
|
+
* Specific paddings for each combination of text and/or icon.
|
|
1655
|
+
*/
|
|
1656
|
+
"ui-pl-m ui-pr-l": hasContentAndIcon,
|
|
1657
|
+
/**
|
|
1658
|
+
* Deducting 1px from the padding to account for the border.
|
|
1659
|
+
*/
|
|
1660
|
+
"ui-px-[calc(theme('spacing.m')-1px)]": true,
|
|
1661
|
+
"ui-py-[calc(theme('spacing.xxs')-1px)]": size === "medium",
|
|
1662
|
+
"ui-py-[calc(theme('spacing.s')-1px)]": size === "large",
|
|
1663
|
+
"ui-py-[calc(theme('spacing.xxxs')-1px)]": hasContentAndIcon && size === "medium",
|
|
1664
|
+
"ui-py-[calc(theme('spacing.xs')-1px)]": hasContentAndIcon && size === "large"
|
|
1651
1665
|
}, className);
|
|
1652
1666
|
const textColorClass = allowedColors[textColor !== null && textColor !== void 0 ? textColor : "base"];
|
|
1653
1667
|
const tooltipAttrs = title ? {
|
|
@@ -1656,37 +1670,37 @@ const ButtonV2 = React__namespace.default.forwardRef((_a, innerRef) => {
|
|
|
1656
1670
|
} : {};
|
|
1657
1671
|
const buttonComponent = React__namespace.default.createElement(
|
|
1658
1672
|
"button",
|
|
1659
|
-
Object.assign({ ref: innerRef }, otherAttributes, { className: buttonClassName, type, onClick: handleClick, disabled: isDisabled, "aria-disabled": isDisabled, "data-test-id": (_c = dataTestId !== null && dataTestId !== void 0 ? dataTestId : otherAttributes["data-test-id"]) !== null && _c !== void 0 ? _c : otherAttributes.id }),
|
|
1660
|
-
React__namespace.default.createElement(
|
|
1673
|
+
Object.assign({ ref: innerRef }, otherAttributes, { className: buttonClassName, type, onClick: handleClick, disabled: isDisabled !== null && isDisabled !== void 0 ? isDisabled : isPending, "aria-disabled": isDisabled, "aria-busy": isPending, "data-test-id": (_c = dataTestId !== null && dataTestId !== void 0 ? dataTestId : otherAttributes["data-test-id"]) !== null && _c !== void 0 ? _c : otherAttributes.id }, tooltipAttrs),
|
|
1674
|
+
icon && React__namespace.default.createElement(IconComponentOrKey, { name: icon, className: classNames__default.default(
|
|
1675
|
+
"ui-flex-shrink-0",
|
|
1676
|
+
/**
|
|
1677
|
+
* Text on a medium button is 2px smaller than the icon. So to
|
|
1678
|
+
* make sure the icon can grow beyond the text, we need to
|
|
1679
|
+
* allow the icon to grow beyond the text. This essentially
|
|
1680
|
+
* vertically centers the icon.
|
|
1681
|
+
*/
|
|
1682
|
+
"-ui-m-[2px]",
|
|
1683
|
+
{
|
|
1684
|
+
"ui-invisible": isPending
|
|
1685
|
+
}
|
|
1686
|
+
) }),
|
|
1687
|
+
isPending && React__namespace.default.createElement(
|
|
1661
1688
|
"span",
|
|
1662
|
-
|
|
1663
|
-
"ui-
|
|
1664
|
-
//
|
|
1665
|
-
{
|
|
1666
|
-
|
|
1667
|
-
"
|
|
1689
|
+
{
|
|
1690
|
+
className: "ui-opacity-100",
|
|
1691
|
+
// IE11 center translate fix
|
|
1692
|
+
style: {
|
|
1693
|
+
position: "absolute",
|
|
1694
|
+
left: "50%",
|
|
1695
|
+
top: "50%",
|
|
1696
|
+
transform: "translate(-50%, -50%)"
|
|
1668
1697
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
// IE11 center translate fix
|
|
1676
|
-
style: {
|
|
1677
|
-
position: "absolute",
|
|
1678
|
-
left: "50%",
|
|
1679
|
-
top: "50%",
|
|
1680
|
-
transform: "translate(-50%, -50%)"
|
|
1681
|
-
}
|
|
1682
|
-
},
|
|
1683
|
-
React__namespace.default.createElement(Spinner, { className: textColorClass })
|
|
1684
|
-
),
|
|
1685
|
-
text && React__namespace.default.createElement(Text, { className: classNames__default.default({
|
|
1686
|
-
"ui-invisible": isPending,
|
|
1687
|
-
"ui-ml-1": icon
|
|
1688
|
-
}), text, color: textColor, hoverColor: textHoverColor, hoverInGroup: true })
|
|
1689
|
-
)
|
|
1698
|
+
},
|
|
1699
|
+
React__namespace.default.createElement(Spinner, { className: textColorClass })
|
|
1700
|
+
),
|
|
1701
|
+
content && React__namespace.default.createElement(Text, { variant: "strong", className: classNames__default.default({
|
|
1702
|
+
"ui-invisible": isPending
|
|
1703
|
+
}), color: textColor, hoverColor: textHoverColor, hoverInGroup: true }, content)
|
|
1690
1704
|
);
|
|
1691
1705
|
if (title) {
|
|
1692
1706
|
return React__namespace.default.createElement(
|
|
@@ -1703,11 +1717,10 @@ const SecondaryButton = React__namespace.default.forwardRef((props, innerRef) =>
|
|
|
1703
1717
|
return React__namespace.default.createElement(ButtonV2, Object.assign({ ref: innerRef }, props, { className: classNames__default.default([
|
|
1704
1718
|
"ui-text-primary",
|
|
1705
1719
|
"ui-bg-white",
|
|
1706
|
-
"ui-border-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
"ui-shadow-sm"
|
|
1720
|
+
"ui-border-neutral-interactive",
|
|
1721
|
+
{
|
|
1722
|
+
"hover:ui-border-neutral-interactive--hover hover:ui-bg-primary-background": !props.isDisabled
|
|
1723
|
+
}
|
|
1711
1724
|
], props.className), textColor: "blue-800", textHoverColor: "blue-900" }));
|
|
1712
1725
|
});
|
|
1713
1726
|
|
|
@@ -1845,10 +1858,10 @@ AccordionList.Actions = AccordionListActions;
|
|
|
1845
1858
|
const TertiaryButton = (props) => {
|
|
1846
1859
|
return React__namespace.default.createElement(ButtonV2, Object.assign({}, props, { className: classNames__default.default([
|
|
1847
1860
|
"ui-text-primary",
|
|
1848
|
-
"ui-bg-transparent",
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1861
|
+
"ui-border-transparent ui-bg-transparent !ui-shadow-none",
|
|
1862
|
+
{
|
|
1863
|
+
"hover:ui-bg-primary-background hover:ui-text-primary-dark": !props.isDisabled
|
|
1864
|
+
}
|
|
1852
1865
|
], props.className), textColor: "blue-800", textHoverColor: "blue-900" }));
|
|
1853
1866
|
};
|
|
1854
1867
|
|
|
@@ -1864,10 +1877,11 @@ const ModalHeader = (props) => {
|
|
|
1864
1877
|
const PrimaryButton = (props) => {
|
|
1865
1878
|
return React__namespace.default.createElement(ButtonV2, Object.assign({}, props, { className: classNames__default.default([
|
|
1866
1879
|
"ui-text-white",
|
|
1867
|
-
"ui-bg-
|
|
1868
|
-
"ui-
|
|
1869
|
-
|
|
1870
|
-
|
|
1880
|
+
"ui-bg-gradient-to-r",
|
|
1881
|
+
"ui-gradient-blue",
|
|
1882
|
+
{
|
|
1883
|
+
"hover:ui-gradient-blue--hover": !props.isDisabled && !props.isPending
|
|
1884
|
+
}
|
|
1871
1885
|
], props.className), textColor: "white" }));
|
|
1872
1886
|
};
|
|
1873
1887
|
|