@dexma/ui-components 8.0.41 → 8.0.43
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/README.md +36 -1
- package/dist/lib/components/Typography/Typography.d.ts +17 -0
- package/dist/lib/components/Typography/index.d.ts +1 -0
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/index.d.ts +18 -0
- package/dist/lib/styles/Typography/StyledTypography.d.ts +10 -0
- package/dist/lib/utils/theme.d.ts +1 -0
- package/dist/ui-components.es.js +10394 -10334
- package/dist/ui-components.umd.js +363 -351
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,42 @@ import { Theme, Button } from '@dexma/ui-components';
|
|
|
49
49
|
</Theme>;
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
You can find all the configuration in the theme file [theme.
|
|
52
|
+
You can find all the configuration in the theme file [theme.ts](https://github.com/dexma/ui-components/blob/master/src/lib/utils/theme.ts)
|
|
53
|
+
|
|
54
|
+
## Typography
|
|
55
|
+
|
|
56
|
+
The platform font is **Montserrat**, self-hosted by this package — there is no Google Fonts (or any
|
|
57
|
+
other CDN) request at runtime.
|
|
58
|
+
|
|
59
|
+
Every app **must register the font faces once, at its entry point** (one line per webpack/Vite entry):
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import '@dexma/ui-components/fonts.css';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Without this import the UI silently renders the fallback system stack — everything works, but nothing
|
|
66
|
+
is Montserrat. `GlobalStyle` applies the font; `fonts.css` provides it. You need both.
|
|
67
|
+
|
|
68
|
+
The shipped subsets are `latin`, `latin-ext` (pl_PL) and `cyrillic` (bg_BG), each behind a
|
|
69
|
+
`unicode-range` so browsers only download what the locale needs. `zh_CN` is not covered by Montserrat
|
|
70
|
+
and intentionally falls through to the system CJK faces in the stack.
|
|
71
|
+
|
|
72
|
+
Never write the font stack as a literal in an app. Where a style genuinely cannot inherit the page
|
|
73
|
+
font (shadow-DOM `::part()` rules, canvas/SVG text, server-rendered images), use the exported token:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { typography } from '@dexma/ui-components';
|
|
77
|
+
|
|
78
|
+
const Styled = styled.div`
|
|
79
|
+
font-family: ${typography.fontFamily};
|
|
80
|
+
`;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The binaries come from `@fontsource-variable/montserrat` (SIL OFL 1.1) at build time via
|
|
84
|
+
`scripts/buildFontConfig.mjs` — that script's header documents the full checklist for changing the
|
|
85
|
+
platform font. Repositories that cannot consume this npm package (dexcell, grader-demo, is3frontend,
|
|
86
|
+
anomaly-detection-dash-ui, detect-reports-generator) must self-host the **same version** of the font
|
|
87
|
+
as this package's `@fontsource-variable/montserrat` devDependency, so rendering stays consistent.
|
|
53
88
|
|
|
54
89
|
## Installation
|
|
55
90
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { TypographyVariant, TypographyWeight } from '../../styles/Typography/StyledTypography';
|
|
3
|
+
export type TypographyProps = {
|
|
4
|
+
/** `h1`–`h6` use the heading scale; `small`–`xlarge` use the paragraph scale. */
|
|
5
|
+
variant?: TypographyVariant;
|
|
6
|
+
weight?: TypographyWeight;
|
|
7
|
+
color?: string;
|
|
8
|
+
/** Rendered element. Set this for semantics — `variant` only controls type styles. */
|
|
9
|
+
as?: ElementType;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
} & HTMLAttributes<HTMLElement>;
|
|
12
|
+
/**
|
|
13
|
+
* The text primitive for new screens: sizes and weights always come from the theme tokens.
|
|
14
|
+
* Use this instead of an ad-hoc `styled.span` with font-size/font-weight literals.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Typography: ({ variant, weight, color, as, children, ...props }: TypographyProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default Typography;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Typography';
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { GlobalStyle, IsolatedGlobalStyle, UIComponentsStyle } from './utils/global';
|
|
2
2
|
import { color as colors } from './utils/theme';
|
|
3
3
|
export * from './components';
|
|
4
|
+
/**
|
|
5
|
+
* Typography tokens, exposed the same way `colors` is.
|
|
6
|
+
*
|
|
7
|
+
* Most UI inherits the family from `GlobalStyle` — reach for this only where inheritance cannot
|
|
8
|
+
* apply (shadow-DOM `::part()` styles, canvas/SVG text, server-rendered images). Never redeclare
|
|
9
|
+
* the stack as a literal in an app; this export is its single source of truth.
|
|
10
|
+
*/
|
|
11
|
+
export declare const typography: {
|
|
12
|
+
fontFamily: string;
|
|
13
|
+
fontSize: string;
|
|
14
|
+
fontWeight: {
|
|
15
|
+
light: number;
|
|
16
|
+
normal: number;
|
|
17
|
+
medium: number;
|
|
18
|
+
semiBold: number;
|
|
19
|
+
bold: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
4
22
|
export { GlobalStyle, IsolatedGlobalStyle, UIComponentsStyle, colors };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Theme } from '../../utils/theme';
|
|
2
|
+
export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
3
|
+
export type TypographyWeight = 'light' | 'normal' | 'medium' | 'semiBold' | 'bold';
|
|
4
|
+
declare const StyledTypography: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
5
|
+
$variant: TypographyVariant;
|
|
6
|
+
$weight: TypographyWeight;
|
|
7
|
+
$color: string;
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}>> & string;
|
|
10
|
+
export { StyledTypography };
|
|
@@ -90,6 +90,7 @@ export declare const fontColor: string;
|
|
|
90
90
|
export declare const fontColorActive: string;
|
|
91
91
|
export declare const fontWeightLight = 300;
|
|
92
92
|
export declare const fontWeightNormal = 400;
|
|
93
|
+
export declare const fontWeightMedium = 500;
|
|
93
94
|
export declare const fontWeightSemiBold = 600;
|
|
94
95
|
export declare const fontWeightBold = 700;
|
|
95
96
|
/**
|