@dexma/ui-components 8.0.40 → 8.0.42
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/fonts/LICENSE +93 -0
- package/dist/fonts/montserrat-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/montserrat-latin-wght-normal.woff2 +0 -0
- package/dist/fonts.css +29 -0
- package/dist/lib/components/ConfigProvider/ConfigProvider.d.ts +16 -0
- package/dist/lib/components/ConfigProvider/index.d.ts +1 -0
- 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 +2 -1
- 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 +8 -2
- package/dist/ui-components.es.js +11844 -11773
- package/dist/ui-components.umd.js +492 -481
- package/package.json +8 -5
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,93 @@
|
|
|
1
|
+
Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat) Montserrat-Italic[wght].ttf: Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/fonts.css
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* montserrat-latin-wght-normal */
|
|
2
|
+
@font-face {
|
|
3
|
+
font-family: 'Montserrat';
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
font-weight: 100 900;
|
|
7
|
+
src: url(./fonts/montserrat-latin-wght-normal.woff2) format('woff2-variations');
|
|
8
|
+
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* montserrat-latin-ext-wght-normal */
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: 'Montserrat';
|
|
14
|
+
font-style: normal;
|
|
15
|
+
font-display: swap;
|
|
16
|
+
font-weight: 100 900;
|
|
17
|
+
src: url(./fonts/montserrat-latin-ext-wght-normal.woff2) format('woff2-variations');
|
|
18
|
+
unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* montserrat-cyrillic-wght-normal */
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: 'Montserrat';
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-display: swap;
|
|
26
|
+
font-weight: 100 900;
|
|
27
|
+
src: url(./fonts/montserrat-cyrillic-wght-normal.woff2) format('woff2-variations');
|
|
28
|
+
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { ConfigProvider as ConfigProviderAntd } from 'antd';
|
|
3
|
+
export type ConfigProviderProps = ComponentProps<typeof ConfigProviderAntd>;
|
|
4
|
+
/**
|
|
5
|
+
* antd's ConfigProvider with the platform type stack injected.
|
|
6
|
+
*
|
|
7
|
+
* antd emits its own `font-family` on `.ant-*` class roots from `token.fontFamily` (default: a
|
|
8
|
+
* system stack), so antd-backed components do not inherit the family from `body`. Without this,
|
|
9
|
+
* every Table / Select / DatePicker would keep the old font while the rest of the app renders
|
|
10
|
+
* Montserrat. antd merges tokens into nested providers, so mounting this once at an app root also
|
|
11
|
+
* covers the per-component providers inside the library.
|
|
12
|
+
*
|
|
13
|
+
* A caller-supplied `theme.token.fontFamily` still wins.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConfigProvider: ({ theme, children, ...props }: ConfigProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default ConfigProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConfigProvider';
|
|
@@ -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';
|
|
@@ -36,6 +36,7 @@ export * from './Table';
|
|
|
36
36
|
export * from './Theme';
|
|
37
37
|
export * from './Toaster';
|
|
38
38
|
export * from './Tooltip';
|
|
39
|
+
export * from './Typography';
|
|
39
40
|
export * from './Switch';
|
|
40
41
|
export * from './SwitchPeriodComparative';
|
|
41
42
|
export * from './Select';
|
|
@@ -44,6 +45,6 @@ export * from './Tree';
|
|
|
44
45
|
export * from './Upload';
|
|
45
46
|
export * from './TreeSelect';
|
|
46
47
|
export * from './Breadcrumb';
|
|
47
|
-
export
|
|
48
|
+
export * from './ConfigProvider';
|
|
48
49
|
export { DataIdProvider } from './DataId/DataIdProvider';
|
|
49
50
|
export { withDataId } from './DataId/withDataId';
|
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,10 +90,16 @@ 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
|
-
|
|
96
|
+
/**
|
|
97
|
+
* The single definition of the platform type stack — never redeclare it in an app.
|
|
98
|
+
* Montserrat is self-hosted by this package; consumers register the faces with
|
|
99
|
+
* `import '@dexma/ui-components/fonts.css'`. The CJK entries matter: Montserrat has no
|
|
100
|
+
* CJK glyphs, so zh_CN falls through to a proper system face instead of the generic default.
|
|
101
|
+
*/
|
|
102
|
+
export declare const fontFamily = "\"Montserrat\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", \"PingFang SC\", \"Hiragino Sans GB\", \"Microsoft YaHei\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"";
|
|
97
103
|
export declare const pxToRem: (px: number) => number;
|
|
98
104
|
export declare const iconSize = "1rem";
|
|
99
105
|
export declare const iconColor: string;
|