colibri-ui 0.8.86 → 0.8.87
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/Drawer/Drawer.js +9 -1
- package/Drawer/index.props.d.ts +2 -0
- package/Sheet/Sheet.js +9 -1
- package/Sheet/index.props.d.ts +2 -0
- package/Typography/Typography.module.css +1365 -0
- package/Typography/index.js +9 -2
- package/Typography/index.props.d.ts +10 -1
- package/esm/Drawer/Drawer.js +9 -1
- package/esm/Drawer/index.props.d.ts +2 -0
- package/esm/Sheet/Sheet.js +9 -1
- package/esm/Sheet/index.props.d.ts +2 -0
- package/esm/Typography/Typography.module.css +1365 -0
- package/esm/Typography/index.js +9 -2
- package/esm/Typography/index.props.d.ts +10 -1
- package/esm/index.d.ts +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/esm/Typography/index.js
CHANGED
|
@@ -3,6 +3,14 @@ import React from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import styles from './Typography.module.css';
|
|
5
5
|
|
|
6
|
+
const getSizeClassNames = size => {
|
|
7
|
+
if (!size) return [];
|
|
8
|
+
if (typeof size === "string") return [styles[`size_${size}`]];
|
|
9
|
+
return Object.entries(size).flatMap(([breakpoint, name]) => {
|
|
10
|
+
if (!name) return [];
|
|
11
|
+
return [styles[breakpoint === "base" ? `size_${name}` : `size_${breakpoint}_${name}`]];
|
|
12
|
+
});
|
|
13
|
+
};
|
|
6
14
|
const Typography = _a => {
|
|
7
15
|
var {
|
|
8
16
|
tag: Component = "span",
|
|
@@ -19,8 +27,7 @@ const Typography = _a => {
|
|
|
19
27
|
style: lines ? Object.assign(Object.assign({}, style), {
|
|
20
28
|
"--typography-lines": lines
|
|
21
29
|
}) : Object.assign({}, style),
|
|
22
|
-
className: clsx({
|
|
23
|
-
[styles[`size_${size}`]]: Boolean(size),
|
|
30
|
+
className: clsx(getSizeClassNames(size), {
|
|
24
31
|
[styles[`font-weight_${fontWeight}`]]: Boolean(fontWeight),
|
|
25
32
|
[styles[`variant_${variant}`]]: Boolean(variant),
|
|
26
33
|
[styles.clamp]: Boolean(lines)
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
+
import type { BreakpointName } from "../Theme";
|
|
2
3
|
export type TypographyVariant = "primary" | "secondary" | "tertiary" | "disabled" | "inverse" | "alert" | "success" | "warning" | "info";
|
|
3
4
|
export type TypographyFontWeight = "normal" | "regular" | "medium" | "semibold" | "bold";
|
|
4
5
|
export type TypographySize = "xs" | "s" | "m" | "l" | "text-xs" | "text-sm" | "text-md" | "text-lg" | "heading-sm" | "heading-md" | "heading-lg" | "heading-xl" | "display-sm" | "display-md" | "display-lg" | "display-xl" | "display-s" | "display-m" | "display-l" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
6
|
+
/**
|
|
7
|
+
* Size per breakpoint, mobile first: `base` applies to every width, each
|
|
8
|
+
* breakpoint from its width up (`BREAKPOINTS` in Theme).
|
|
9
|
+
*/
|
|
10
|
+
export type TypographyResponsiveSize = {
|
|
11
|
+
base?: TypographySize;
|
|
12
|
+
} & Partial<Record<BreakpointName, TypographySize>>;
|
|
5
13
|
export type TypographyTag = "span" | "label" | "legend" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "s";
|
|
6
14
|
export type TypographyProps = {
|
|
7
15
|
className?: string;
|
|
@@ -10,7 +18,8 @@ export type TypographyProps = {
|
|
|
10
18
|
id?: string;
|
|
11
19
|
tag?: TypographyTag;
|
|
12
20
|
variant?: TypographyVariant;
|
|
13
|
-
size
|
|
21
|
+
/** One size, or sizes per breakpoint: `{ base: "xs", sm: "m" }`. */
|
|
22
|
+
size?: TypographySize | TypographyResponsiveSize;
|
|
14
23
|
fontWeight?: TypographyFontWeight;
|
|
15
24
|
/** Limits the text to this many lines and ends the last one with an ellipsis. */
|
|
16
25
|
lines?: number;
|
package/esm/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export type { TimeSelectProps } from "./TimeSelect/index.props";
|
|
|
87
87
|
export { Tooltip } from "./Tooltip";
|
|
88
88
|
export type { TooltipProps } from "./Tooltip/index.props";
|
|
89
89
|
export { Typography } from "./Typography";
|
|
90
|
-
export type { TypographyProps } from "./Typography/index.props";
|
|
90
|
+
export type { TypographyProps, TypographyResponsiveSize, } from "./Typography/index.props";
|
|
91
91
|
export { useMediaSizes } from "./hooks/useMediaSizes";
|
|
92
92
|
export { useScrollLock } from "./hooks/useScrollLock";
|
|
93
93
|
export * from "./Icons";
|
package/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export type { TimeSelectProps } from "./TimeSelect/index.props";
|
|
|
87
87
|
export { Tooltip } from "./Tooltip";
|
|
88
88
|
export type { TooltipProps } from "./Tooltip/index.props";
|
|
89
89
|
export { Typography } from "./Typography";
|
|
90
|
-
export type { TypographyProps } from "./Typography/index.props";
|
|
90
|
+
export type { TypographyProps, TypographyResponsiveSize, } from "./Typography/index.props";
|
|
91
91
|
export { useMediaSizes } from "./hooks/useMediaSizes";
|
|
92
92
|
export { useScrollLock } from "./hooks/useScrollLock";
|
|
93
93
|
export * from "./Icons";
|