@mw-kit/mw-ui 1.8.16 → 1.8.18
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 +33 -46
- package/bin/mw-ui-copy-fonts.mjs +53 -0
- package/dist/assets/fonts/index.d.ts +51 -14
- package/dist/assets/fonts/lato-italic-100-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-100-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-300-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-300-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-400-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-400-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-700-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-700-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-900-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-italic-900-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-100-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-100-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-300-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-300-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-400-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-400-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-700-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-700-latin.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-900-latin-ext.woff2 +0 -0
- package/dist/assets/fonts/lato-normal-900-latin.woff2 +0 -0
- package/dist/assets/helpers.d.ts +1 -1
- package/dist/index.d.mts +15 -8
- package/dist/index.js +679 -365
- package/dist/index.mjs +879 -559
- package/dist/theme/constants.d.ts +1 -3
- package/dist/theme/index.d.ts +4 -4
- package/dist/theme/interfaces.d.ts +3 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,46 +1,33 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
35
|
-
|
|
36
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
-
|
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
39
|
-
|
|
40
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
41
|
-
|
|
42
|
-
## Learn More
|
|
43
|
-
|
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
-
|
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
1
|
+
# @mw-kit/mw-ui
|
|
2
|
+
|
|
3
|
+
## Assets (fonts)
|
|
4
|
+
|
|
5
|
+
This library expects fonts to be served by the host app. Copy the package fonts
|
|
6
|
+
to a public folder and provide a base URL to the ThemeProvider. The copy command
|
|
7
|
+
must be executed explicitly by the app.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
1. Run the copy command in your app (example):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"scripts": {
|
|
16
|
+
"prestart": "mw-ui-copy-fonts --dest public/mw-ui/fonts",
|
|
17
|
+
"prebuild": "mw-ui-copy-fonts --dest public/mw-ui/fonts"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This copies from `node_modules/@mw-kit/mw-ui/dist/assets/fonts` to your public
|
|
23
|
+
folder. 2. Configure the ThemeProvider with the base URL:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { ThemeProvider } from '@mw-kit/mw-ui'
|
|
27
|
+
|
|
28
|
+
export const App = () => (
|
|
29
|
+
<ThemeProvider assetBaseUrl='/assets/mw-ui'>{/* app */}</ThemeProvider>
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The library will resolve fonts from `assetBaseUrl`.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cp, mkdir, readdir, stat } from 'node:fs/promises'
|
|
3
|
+
import { dirname, join, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
const args = process.argv.slice(2)
|
|
7
|
+
const destFlagIndex = args.findIndex((arg) => arg === '--dest' || arg === '-d')
|
|
8
|
+
const destArg = destFlagIndex >= 0 ? args[destFlagIndex + 1] : args[0]
|
|
9
|
+
|
|
10
|
+
if (!destArg) {
|
|
11
|
+
console.error('Usage: mw-ui-copy-fonts --dest <path>')
|
|
12
|
+
process.exit(1)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url))
|
|
16
|
+
const packageRoot = resolve(scriptDir, '..')
|
|
17
|
+
const sourceDir = resolve(packageRoot, 'dist', 'assets', 'fonts')
|
|
18
|
+
const destDir = resolve(process.cwd(), destArg)
|
|
19
|
+
|
|
20
|
+
const ensureDir = async (path) => {
|
|
21
|
+
await mkdir(path, { recursive: true })
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const copyFonts = async () => {
|
|
25
|
+
const sourceStat = await stat(sourceDir).catch(() => null)
|
|
26
|
+
if (!sourceStat || !sourceStat.isDirectory()) {
|
|
27
|
+
console.error(
|
|
28
|
+
`Fonts not found at ${sourceDir}. Run the library build before copying.`,
|
|
29
|
+
)
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await ensureDir(destDir)
|
|
34
|
+
const entries = await readdir(sourceDir, { withFileTypes: true })
|
|
35
|
+
|
|
36
|
+
const fontExtensions = new Set(['.woff2', '.woff', '.ttf', '.otf'])
|
|
37
|
+
|
|
38
|
+
await Promise.all(
|
|
39
|
+
entries.map(async (entry) => {
|
|
40
|
+
if (!entry.isFile()) return
|
|
41
|
+
const ext = entry.name.slice(entry.name.lastIndexOf('.'))
|
|
42
|
+
if (!fontExtensions.has(ext)) return
|
|
43
|
+
const from = join(sourceDir, entry.name)
|
|
44
|
+
const to = join(destDir, entry.name)
|
|
45
|
+
await cp(from, to)
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
copyFonts().catch((error) => {
|
|
51
|
+
console.error(error)
|
|
52
|
+
process.exit(1)
|
|
53
|
+
})
|
|
@@ -1,14 +1,51 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export declare const assets: {
|
|
2
|
+
readonly Allura: {
|
|
3
|
+
readonly alluraLatinExt: string;
|
|
4
|
+
readonly alluraLatin: string;
|
|
5
|
+
readonly alluraVietnamese: string;
|
|
6
|
+
};
|
|
7
|
+
readonly GreatVibes: {
|
|
8
|
+
readonly greatVibesCyrillicExt: string;
|
|
9
|
+
readonly greatVibesCyrillic: string;
|
|
10
|
+
readonly greatVibesGreekExt: string;
|
|
11
|
+
readonly greatVibesLatinExt: string;
|
|
12
|
+
readonly greatVibesLatin: string;
|
|
13
|
+
readonly greatVibesVietnamese: string;
|
|
14
|
+
};
|
|
15
|
+
readonly Pacifico: {
|
|
16
|
+
readonly pacificoCyrillicExt: string;
|
|
17
|
+
readonly pacificoCyrillic: string;
|
|
18
|
+
readonly pacificoLatinExt: string;
|
|
19
|
+
readonly pacificoLatin: string;
|
|
20
|
+
readonly pacificoVietnamese: string;
|
|
21
|
+
};
|
|
22
|
+
readonly Lato: {
|
|
23
|
+
readonly latoItalic100LatinExt: string;
|
|
24
|
+
readonly latoItalic100Latin: string;
|
|
25
|
+
readonly latoItalic300LatinExt: string;
|
|
26
|
+
readonly latoItalic300Latin: string;
|
|
27
|
+
readonly latoItalic400LatinExt: string;
|
|
28
|
+
readonly latoItalic400Latin: string;
|
|
29
|
+
readonly latoItalic700LatinExt: string;
|
|
30
|
+
readonly latoItalic700Latin: string;
|
|
31
|
+
readonly latoItalic900LatinExt: string;
|
|
32
|
+
readonly latoItalic900Latin: string;
|
|
33
|
+
readonly latoNormal100LatinExt: string;
|
|
34
|
+
readonly latoNormal100Latin: string;
|
|
35
|
+
readonly latoNormal300LatinExt: string;
|
|
36
|
+
readonly latoNormal300Latin: string;
|
|
37
|
+
readonly latoNormal400LatinExt: string;
|
|
38
|
+
readonly latoNormal400Latin: string;
|
|
39
|
+
readonly latoNormal700LatinExt: string;
|
|
40
|
+
readonly latoNormal700Latin: string;
|
|
41
|
+
readonly latoNormal900LatinExt: string;
|
|
42
|
+
readonly latoNormal900Latin: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
declare const fonts: {
|
|
46
|
+
readonly Allura: "Allura";
|
|
47
|
+
readonly GreatVibes: "Great Vibes";
|
|
48
|
+
readonly Pacifico: "Pacifico";
|
|
49
|
+
readonly Lato: "\"Lato\", sans-serif";
|
|
50
|
+
};
|
|
51
|
+
export default fonts;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/assets/helpers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const assetUrl: (asset: string) => string;
|
|
1
|
+
export declare const assetUrl: (asset: string, assetBaseUrl: string) => string;
|
|
2
2
|
export declare const ensureFontLoaded: (fontFamily: string, fontSize?: number, text?: string) => Promise<boolean>;
|
package/dist/index.d.mts
CHANGED
|
@@ -71,9 +71,10 @@ declare const theme$1: {
|
|
|
71
71
|
type ColorOptions = keyof typeof colors;
|
|
72
72
|
type OpacitiyOptions = keyof typeof opacities;
|
|
73
73
|
type SpacingOptions = keyof typeof spacings;
|
|
74
|
+
type FontOptions = keyof typeof fonts;
|
|
74
75
|
type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
75
76
|
interface Typography {
|
|
76
|
-
fontFamily:
|
|
77
|
+
fontFamily: FontOptions;
|
|
77
78
|
fontWeight: FontWeight;
|
|
78
79
|
fontSize: string;
|
|
79
80
|
}
|
|
@@ -93,8 +94,16 @@ interface ThemeInterface {
|
|
|
93
94
|
spacings: typeof spacings;
|
|
94
95
|
typographies: typeof typographies;
|
|
95
96
|
components: typeof theme$1;
|
|
97
|
+
assetUrl: (asset: string) => string;
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
declare const fonts: {
|
|
101
|
+
readonly Allura: "Allura";
|
|
102
|
+
readonly GreatVibes: "Great Vibes";
|
|
103
|
+
readonly Pacifico: "Pacifico";
|
|
104
|
+
readonly Lato: "\"Lato\", sans-serif";
|
|
105
|
+
};
|
|
106
|
+
|
|
98
107
|
declare const colors: {
|
|
99
108
|
readonly black: "#000000";
|
|
100
109
|
readonly blue: "#3455AB";
|
|
@@ -162,9 +171,7 @@ declare const spacings: {
|
|
|
162
171
|
readonly s5: "28px";
|
|
163
172
|
readonly s6: "35px";
|
|
164
173
|
};
|
|
165
|
-
|
|
166
|
-
readonly lato: "\"Lato\", sans-serif";
|
|
167
|
-
};
|
|
174
|
+
|
|
168
175
|
declare const typographies: Typographies;
|
|
169
176
|
|
|
170
177
|
type Position = 'top right' | 'top left' | 'bottom right' | 'bottom left' | 'right top' | 'right bottom' | 'left top' | 'left bottom';
|
|
@@ -1573,9 +1580,9 @@ interface ZoomProps {
|
|
|
1573
1580
|
|
|
1574
1581
|
declare const Zoom: (props: ZoomProps) => react_jsx_runtime.JSX.Element;
|
|
1575
1582
|
|
|
1576
|
-
declare const theme: ThemeInterface
|
|
1577
|
-
declare const ThemeProvider: (props: {
|
|
1578
|
-
|
|
1579
|
-
}) => react_jsx_runtime.JSX.Element;
|
|
1583
|
+
declare const theme: Omit<ThemeInterface, 'assetUrl' | 'useFont'>;
|
|
1584
|
+
declare const ThemeProvider: (props: React.PropsWithChildren<{
|
|
1585
|
+
assetBaseUrl: string;
|
|
1586
|
+
}>) => react_jsx_runtime.JSX.Element;
|
|
1580
1587
|
|
|
1581
1588
|
export { AbsoluteContainer as MwAbsoluteContainer, AppliedFilters as MwAppliedFilters, Button as MwButton, Calendar as MwCalendar, Card as MwCard, EllipsisContainer as MwEllipsisContainer, Filters as MwFilters, Form as MwForm, Grid as MwGrid, Icon as MwIcon, Indicator as MwIndicator, Input as MwInput, Link as MwLink, Loader as MwLoader, Menu as MwMenu, Modal as MwModal, Placeholder as MwPlaceholder, ProgressBar as MwProgressBar, ScrollContainer as MwScrollContainer, SignatureInput as MwSignature, Tabs as MwTabs, TextArea as MwTextArea, Toast as MwToast, Transition as MwTransition, Zoom as MwZoom, ThemeProvider, theme, useTransition as useMwTransition };
|