@luscii-healthtech/web-ui 28.11.2 → 28.12.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/Box/Box.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +11 -4
- package/dist/components/Card/HoverIndicator.d.ts +8 -0
- package/dist/index.development.js +147 -8
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/radius.utils.d.ts +13 -0
- package/dist/utils/shadow.utils.d.ts +19 -0
- package/dist/web-ui-tailwind.css +203 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export type Props<C extends React.ElementType> = React.ComponentPropsWithoutRef<
|
|
|
21
21
|
* Will set a border radius based on the standard sizes scale.
|
|
22
22
|
* Check {@link SIZES} for reference.
|
|
23
23
|
*/
|
|
24
|
-
borderRadius?:
|
|
24
|
+
borderRadius?: keyof typeof SIZES;
|
|
25
25
|
};
|
|
26
26
|
export declare const Box: <C extends React.ElementType = "div">(props: Props<C>) => React.JSX.Element;
|
|
27
27
|
export {};
|
|
@@ -32,7 +32,18 @@ type TitleAndMaybeActions = {
|
|
|
32
32
|
};
|
|
33
33
|
export type Props<C extends React.ElementType> = React.ComponentPropsWithoutRef<C> & {
|
|
34
34
|
as?: C;
|
|
35
|
+
border?: boolean;
|
|
36
|
+
borderRadius?: BoxProps<C>["borderRadius"];
|
|
35
37
|
children: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a box-shadow to the element based on the design system
|
|
40
|
+
*/
|
|
41
|
+
elevation?: BoxProps<C>["elevation"];
|
|
42
|
+
/**
|
|
43
|
+
* The elevation from the design system to apply when hovering over the card.
|
|
44
|
+
*/
|
|
45
|
+
elevationOnHover?: BoxProps<C>["elevation"];
|
|
46
|
+
indicatorOnHover?: boolean;
|
|
36
47
|
/**
|
|
37
48
|
* Whether or not to add the default padding to the card. Set this
|
|
38
49
|
* to `false` if you want to render something full width inside of the
|
|
@@ -42,10 +53,6 @@ export type Props<C extends React.ElementType> = React.ComponentPropsWithoutRef<
|
|
|
42
53
|
* @default true
|
|
43
54
|
*/
|
|
44
55
|
padding?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Adds a box-shadow to the element based on the design system
|
|
47
|
-
*/
|
|
48
|
-
elevation?: BoxProps<C>["elevation"];
|
|
49
56
|
} & TitleAndMaybeActions;
|
|
50
57
|
export declare function Card<C extends React.ElementType = "div">(props: Props<C>): React.JSX.Element;
|
|
51
58
|
export declare namespace Card {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type Props as BoxProps } from "../Box/Box";
|
|
3
|
+
type Props = {
|
|
4
|
+
borderRadius?: BoxProps<"div">["borderRadius"];
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const HoverIndicator: (props: Props) => React.JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -2075,6 +2075,121 @@ const CenteredHero = ({ title, text, image, buttons = [], background = "slate-50
|
|
|
2075
2075
|
);
|
|
2076
2076
|
};
|
|
2077
2077
|
|
|
2078
|
+
const ELEVATION = {
|
|
2079
|
+
surface: "none",
|
|
2080
|
+
base: "0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06)",
|
|
2081
|
+
small: "0px 1px 2px rgba(0, 0, 0, 0.05)",
|
|
2082
|
+
medium: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
2083
|
+
large: "0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",
|
|
2084
|
+
extraLarge: "0px 6px 10px rgba(0, 0, 0, 0.14), 0px 1px 18px rgba(0, 0, 0, 0.12), 0px 3px 5px rgba(0, 0, 0, 0.2)",
|
|
2085
|
+
drag: "0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
const createShadowClassName = (elevation, options) => {
|
|
2089
|
+
if (!elevation || !ELEVATION[elevation]) {
|
|
2090
|
+
return "";
|
|
2091
|
+
}
|
|
2092
|
+
const { modifier } = options || {};
|
|
2093
|
+
if (modifier === "hover") {
|
|
2094
|
+
return classNames__default.default({
|
|
2095
|
+
"hover:ui-shadow-base": elevation === "base",
|
|
2096
|
+
"hover:ui-shadow-small": elevation === "small",
|
|
2097
|
+
"hover:ui-shadow-medium": elevation === "medium",
|
|
2098
|
+
"hover:ui-shadow-large": elevation === "large",
|
|
2099
|
+
"hover:ui-shadow-surface": elevation === "surface",
|
|
2100
|
+
"hover:ui-shadow-extraLarge": elevation === "extraLarge",
|
|
2101
|
+
"hover:ui-shadow-drag": elevation === "drag"
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
if (modifier === "focus") {
|
|
2105
|
+
return classNames__default.default({
|
|
2106
|
+
"focus:ui-shadow-base": elevation === "base",
|
|
2107
|
+
"focus:ui-shadow-small": elevation === "small",
|
|
2108
|
+
"focus:ui-shadow-medium": elevation === "medium",
|
|
2109
|
+
"focus:ui-shadow-large": elevation === "large",
|
|
2110
|
+
"focus:ui-shadow-surface": elevation === "surface",
|
|
2111
|
+
"focus:ui-shadow-extraLarge": elevation === "extraLarge",
|
|
2112
|
+
"focus:ui-shadow-drag": elevation === "drag"
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
if (modifier === "active") {
|
|
2116
|
+
return classNames__default.default({
|
|
2117
|
+
"active:ui-shadow-base": elevation === "base",
|
|
2118
|
+
"active:ui-shadow-small": elevation === "small",
|
|
2119
|
+
"active:ui-shadow-medium": elevation === "medium",
|
|
2120
|
+
"active:ui-shadow-large": elevation === "large",
|
|
2121
|
+
"active:ui-shadow-surface": elevation === "surface",
|
|
2122
|
+
"active:ui-shadow-extraLarge": elevation === "extraLarge",
|
|
2123
|
+
"active:ui-shadow-drag": elevation === "drag"
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
return classNames__default.default({
|
|
2127
|
+
"ui-shadow-base": elevation === "base",
|
|
2128
|
+
"ui-shadow-small": elevation === "small",
|
|
2129
|
+
"ui-shadow-medium": elevation === "medium",
|
|
2130
|
+
"ui-shadow-large": elevation === "large",
|
|
2131
|
+
"ui-shadow-surface": elevation === "surface",
|
|
2132
|
+
"ui-shadow-extraLarge": elevation === "extraLarge",
|
|
2133
|
+
"ui-shadow-drag": elevation === "drag"
|
|
2134
|
+
});
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
const SIZES = {
|
|
2138
|
+
/**
|
|
2139
|
+
* Represents the tiny size of 4px.
|
|
2140
|
+
*/
|
|
2141
|
+
xxxxs: "4px",
|
|
2142
|
+
/**
|
|
2143
|
+
* Represents a very extra extra small size of 6px.
|
|
2144
|
+
*/
|
|
2145
|
+
xxxs: "6px",
|
|
2146
|
+
/**
|
|
2147
|
+
* Represents an extra extra small size of 8px.
|
|
2148
|
+
*/
|
|
2149
|
+
xxs: "8px",
|
|
2150
|
+
/**
|
|
2151
|
+
* Represents an extra small size of 10px.
|
|
2152
|
+
*/
|
|
2153
|
+
xs: "10px",
|
|
2154
|
+
/**
|
|
2155
|
+
* Represents a small size of 12px.
|
|
2156
|
+
*/
|
|
2157
|
+
s: "12px",
|
|
2158
|
+
/**
|
|
2159
|
+
* Represents a medium size of 16px.
|
|
2160
|
+
*/
|
|
2161
|
+
m: "16px",
|
|
2162
|
+
/**
|
|
2163
|
+
* Represents a large size of 24px.
|
|
2164
|
+
*/
|
|
2165
|
+
l: "24px",
|
|
2166
|
+
/**
|
|
2167
|
+
* Represents an extra large size of 32px.
|
|
2168
|
+
*/
|
|
2169
|
+
xl: "32px",
|
|
2170
|
+
/**
|
|
2171
|
+
* Represents an extra extra large size of 32px.
|
|
2172
|
+
*/
|
|
2173
|
+
xxl: "32px"
|
|
2174
|
+
};
|
|
2175
|
+
|
|
2176
|
+
const createRadiusClassName = (borderRadius) => {
|
|
2177
|
+
if (!borderRadius || !SIZES[borderRadius]) {
|
|
2178
|
+
return "";
|
|
2179
|
+
}
|
|
2180
|
+
return classNames__default.default({
|
|
2181
|
+
"ui-radius-xxxxs": borderRadius === "xxxxs",
|
|
2182
|
+
"ui-radius-xxxs": borderRadius === "xxxs",
|
|
2183
|
+
"ui-radius-xxs": borderRadius === "xxs",
|
|
2184
|
+
"ui-radius-xs": borderRadius === "xs",
|
|
2185
|
+
"ui-radius-s": borderRadius === "s",
|
|
2186
|
+
"ui-radius-m": borderRadius === "m",
|
|
2187
|
+
"ui-radius-l": borderRadius === "l",
|
|
2188
|
+
"ui-radius-xl": borderRadius === "xl",
|
|
2189
|
+
"ui-radius-xxl": borderRadius === "xxl"
|
|
2190
|
+
});
|
|
2191
|
+
};
|
|
2192
|
+
|
|
2078
2193
|
const spacingKeys = [
|
|
2079
2194
|
"p",
|
|
2080
2195
|
"pt",
|
|
@@ -2095,8 +2210,10 @@ const createSpacingClassNames = (keys, spacingProps) => {
|
|
|
2095
2210
|
return keys.filter((key) => spacingProps[key]).map((key) => `ui-${key}-${spacingProps[key]}`).join(" ");
|
|
2096
2211
|
};
|
|
2097
2212
|
const Box = (props) => {
|
|
2098
|
-
const { as: Element = "div", className, elevation, width } = props, attributes = __rest(props, ["as", "className", "elevation", "width"]);
|
|
2213
|
+
const { as: Element = "div", borderRadius, className, elevation, width } = props, attributes = __rest(props, ["as", "borderRadius", "className", "elevation", "width"]);
|
|
2099
2214
|
const spacingClasses = createSpacingClassNames(spacingKeys, props);
|
|
2215
|
+
const shadowClassName = createShadowClassName(elevation);
|
|
2216
|
+
const borderRadiusClassName = createRadiusClassName(borderRadius);
|
|
2100
2217
|
const attributesWithoutSpacingKeys = omit__default.default(attributes, spacingKeys);
|
|
2101
2218
|
return React__namespace.default.createElement(Element, Object.assign({ className: classNames__default.default(spacingClasses, {
|
|
2102
2219
|
"ui-bg-slate-100": props.backgroundColor === "base",
|
|
@@ -2104,11 +2221,9 @@ const Box = (props) => {
|
|
|
2104
2221
|
"ui-bg-red-50": props.backgroundColor === "red",
|
|
2105
2222
|
" ui-bg-green-50": props.backgroundColor === "green",
|
|
2106
2223
|
" ui-bg-amber-50": props.backgroundColor === "amber",
|
|
2107
|
-
[`ui-shadow-${elevation}`]: elevation,
|
|
2108
2224
|
[`ui-w-${width}`]: width && width !== "full",
|
|
2109
|
-
"ui-w-full": width === "full"
|
|
2110
|
-
|
|
2111
|
-
}, className) }, attributesWithoutSpacingKeys));
|
|
2225
|
+
"ui-w-full": width === "full"
|
|
2226
|
+
}, className, shadowClassName, borderRadiusClassName) }, attributesWithoutSpacingKeys));
|
|
2112
2227
|
};
|
|
2113
2228
|
|
|
2114
2229
|
const Stack = (props) => {
|
|
@@ -5783,14 +5898,38 @@ function TopBar(props) {
|
|
|
5783
5898
|
}
|
|
5784
5899
|
TopBar.Actions = Actions;
|
|
5785
5900
|
|
|
5786
|
-
|
|
5787
|
-
const {
|
|
5901
|
+
const HoverIndicator = (props) => {
|
|
5902
|
+
const { borderRadius = "xxs", children } = props;
|
|
5903
|
+
const boxClasses = classNames__default.default("ui-relative ui-border ui-border-l-[16px] ui-border-transparent ui-border-l-transparent hover:ui-border-l-primary", "before:ui-absolute before:ui-inset-[-1px] before:-ui-ml-[15px] before:ui-w-[16px] hover:before:ui-bg-primary", { [`before:ui-radius-l-${borderRadius}`]: borderRadius });
|
|
5788
5904
|
return React__namespace.default.createElement(
|
|
5789
5905
|
Box,
|
|
5790
|
-
|
|
5906
|
+
{ borderRadius, className: boxClasses },
|
|
5907
|
+
React__namespace.default.createElement(Box, { className: "-ui-ml-4" }, children)
|
|
5908
|
+
);
|
|
5909
|
+
};
|
|
5910
|
+
|
|
5911
|
+
function Card(props) {
|
|
5912
|
+
const { actions: __, as: Element = "div", border, borderRadius = "xxs", children, className, elevation, elevationOnHover, indicatorOnHover, padding = true, title: _ } = props, rest = __rest(props, ["actions", "as", "border", "borderRadius", "children", "className", "elevation", "elevationOnHover", "indicatorOnHover", "padding", "title"]);
|
|
5913
|
+
const cardContentClassName = classNames__default.default("ui-bg-white", {
|
|
5914
|
+
"ui-ml-[16px]": indicatorOnHover
|
|
5915
|
+
});
|
|
5916
|
+
const hoverShadowClassName = createShadowClassName(elevationOnHover, {
|
|
5917
|
+
modifier: "hover"
|
|
5918
|
+
});
|
|
5919
|
+
const CardContent = () => React__namespace.default.createElement(
|
|
5920
|
+
Box,
|
|
5921
|
+
{ className: cardContentClassName },
|
|
5791
5922
|
React__namespace.default.createElement(RenderTopBar, Object.assign({}, props)),
|
|
5792
5923
|
padding ? React__namespace.default.createElement(Padding, null, children) : children
|
|
5793
5924
|
);
|
|
5925
|
+
const classes = classNames__default.default("ui-overflow-hidden", "ui-bg-white", className, hoverShadowClassName, {
|
|
5926
|
+
"ui-border ui-border-slate-300 hover:ui-border-slate-400": border
|
|
5927
|
+
});
|
|
5928
|
+
return React__namespace.default.createElement(Box, Object.assign({ as: Element, elevation, borderRadius }, rest, { className: classes }), indicatorOnHover ? React__namespace.default.createElement(
|
|
5929
|
+
HoverIndicator,
|
|
5930
|
+
{ borderRadius },
|
|
5931
|
+
React__namespace.default.createElement(CardContent, null)
|
|
5932
|
+
) : React__namespace.default.createElement(CardContent, null));
|
|
5794
5933
|
}
|
|
5795
5934
|
Card.Title = (props) => React__namespace.default.createElement(Title, Object.assign({ type: "sm" }, props));
|
|
5796
5935
|
Card.TopBar = TopBar;
|