@luscii-healthtech/web-ui 38.4.0 → 38.4.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type HTMLProps } from "react";
|
|
2
2
|
import "./Title.scss";
|
|
3
3
|
import { type TextColor } from "../Text/Text";
|
|
4
4
|
export type TitleStyle = "xs" | "sm" | "base" | "lg" | "xl" | "2xl";
|
|
@@ -14,6 +14,13 @@ type SharedProps = {
|
|
|
14
14
|
color?: TextColor;
|
|
15
15
|
className?: string;
|
|
16
16
|
ref?: React.ForwardedRef<HTMLHeadingElement>;
|
|
17
|
+
/**
|
|
18
|
+
* Sets the "level" of the Section Heading element.
|
|
19
|
+
* @example <Title level="2">title</Title> // <h2>title</h2>
|
|
20
|
+
*
|
|
21
|
+
* When used any level based on the "variant" prop will be ignored.
|
|
22
|
+
*/
|
|
23
|
+
level?: "1" | "2" | "3" | "4" | "5" | "6";
|
|
17
24
|
};
|
|
18
25
|
type WithChildrenProp = React.PropsWithChildren<SharedProps> & {
|
|
19
26
|
/**
|
|
@@ -28,6 +35,6 @@ type WithTextProp = SharedProps & {
|
|
|
28
35
|
text: string;
|
|
29
36
|
children?: never;
|
|
30
37
|
};
|
|
31
|
-
export type TitleProps = WithChildrenProp | WithTextProp
|
|
38
|
+
export type TitleProps = (WithChildrenProp | WithTextProp) & HTMLProps<HTMLHeadingElement>;
|
|
32
39
|
export declare const Title: (props: TitleProps) => React.JSX.Element;
|
|
33
40
|
export {};
|
|
@@ -1559,7 +1559,7 @@ var css_248z$g = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FI
|
|
|
1559
1559
|
styleInject(css_248z$g);
|
|
1560
1560
|
|
|
1561
1561
|
const Title = (props) => {
|
|
1562
|
-
const { variant: variantFromProps = "base", type, className, text, children, color, ref } = props;
|
|
1562
|
+
const { variant: variantFromProps = "base", type, className, text, children, color, level, ref } = props, rest = __rest(props, ["variant", "type", "className", "text", "children", "color", "level", "ref"]);
|
|
1563
1563
|
const variant = type ? type : variantFromProps;
|
|
1564
1564
|
const isSmallTitle = variant === "xs" || variant === "sm";
|
|
1565
1565
|
const containerClassName = classNames__default.default("ui-font-bold ui-leading-inherit ui-antialiased", allowedColors[color !== null && color !== void 0 ? color : "base"], {
|
|
@@ -1595,7 +1595,10 @@ const Title = (props) => {
|
|
|
1595
1595
|
ContainerElement = "h4";
|
|
1596
1596
|
break;
|
|
1597
1597
|
}
|
|
1598
|
-
|
|
1598
|
+
if (level) {
|
|
1599
|
+
ContainerElement = `h${level}`;
|
|
1600
|
+
}
|
|
1601
|
+
return React__namespace.default.createElement(ContainerElement, Object.assign({ className: containerClassName, ref }, rest), text !== null && text !== void 0 ? text : children);
|
|
1599
1602
|
};
|
|
1600
1603
|
|
|
1601
1604
|
const AccordionItem = ({ id, title, content, isCollapsedByDefault = false, onClosed, onOpened }) => {
|