@spesia/ui 1.0.1-21

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.
Files changed (28) hide show
  1. package/README.md +155 -0
  2. package/dist/colors.scss +82 -0
  3. package/dist/fonts/Montserrat/Montserrat-Italic-VariableFont_wght.ttf +0 -0
  4. package/dist/fonts/Montserrat/Montserrat-VariableFont_wght.ttf +0 -0
  5. package/dist/fonts/Montserrat/static/Montserrat-Black.ttf +0 -0
  6. package/dist/fonts/Montserrat/static/Montserrat-BlackItalic.ttf +0 -0
  7. package/dist/fonts/Montserrat/static/Montserrat-Bold.ttf +0 -0
  8. package/dist/fonts/Montserrat/static/Montserrat-BoldItalic.ttf +0 -0
  9. package/dist/fonts/Montserrat/static/Montserrat-ExtraBold.ttf +0 -0
  10. package/dist/fonts/Montserrat/static/Montserrat-ExtraBoldItalic.ttf +0 -0
  11. package/dist/fonts/Montserrat/static/Montserrat-ExtraLight.ttf +0 -0
  12. package/dist/fonts/Montserrat/static/Montserrat-ExtraLightItalic.ttf +0 -0
  13. package/dist/fonts/Montserrat/static/Montserrat-Italic.ttf +0 -0
  14. package/dist/fonts/Montserrat/static/Montserrat-Light.ttf +0 -0
  15. package/dist/fonts/Montserrat/static/Montserrat-LightItalic.ttf +0 -0
  16. package/dist/fonts/Montserrat/static/Montserrat-Medium.ttf +0 -0
  17. package/dist/fonts/Montserrat/static/Montserrat-MediumItalic.ttf +0 -0
  18. package/dist/fonts/Montserrat/static/Montserrat-Regular.ttf +0 -0
  19. package/dist/fonts/Montserrat/static/Montserrat-SemiBold.ttf +0 -0
  20. package/dist/fonts/Montserrat/static/Montserrat-SemiBoldItalic.ttf +0 -0
  21. package/dist/fonts/Montserrat/static/Montserrat-Thin.ttf +0 -0
  22. package/dist/fonts/Montserrat/static/Montserrat-ThinItalic.ttf +0 -0
  23. package/dist/fonts.scss +31 -0
  24. package/dist/index.cjs +97 -0
  25. package/dist/index.d.ts +361 -0
  26. package/dist/index.js +3991 -0
  27. package/dist/logo.svg +27 -0
  28. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # Spesia UI kit
2
+
3
+ The Spesia UI kit is a Material UI theme that you can use in your React or NextJS applications, by passing it to a Material UI ThemeProvider.
4
+
5
+ The Material UI theme is based on the Spesia UI kit in Figma: https://www.figma.com/design/7jKUIGyakP6GevxGk4pc6s/Spesía-UI-Kit
6
+
7
+ ## Build status
8
+
9
+ [![UI Build and Push npm Package](https://github.com/Spesia/spesia/actions/workflows/sp-ui-build-push.yml/badge.svg)](https://github.com/Spesia/spesia/actions/workflows/sp-ui-build-push.yml)
10
+
11
+ [![Storybook build and push](https://github.com/Spesia/spesia/actions/workflows/sp-ui-storybook-build-push.yml/badge.svg)](https://github.com/Spesia/spesia/actions/workflows/sp-ui-storybook-build-push.yml)
12
+
13
+ ## Installation
14
+
15
+ ```
16
+ pnpm install @spesia/ui
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Create your own provider file, i.e. SpesiaThemeProvider in your app:
22
+
23
+ ```javascript
24
+ 'use client';
25
+
26
+ import { theme } from '@spesia/ui';
27
+ import { CssBaseline, ThemeProvider } from '@mui/material';
28
+ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'
29
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
30
+
31
+ import { ReactNode } from 'react';
32
+
33
+ type Props = {
34
+ children?: ReactNode;
35
+ };
36
+
37
+ export default function SpesiaThemeProvider ( { children }: Props ) {
38
+ return (
39
+ <ThemeProvider theme={ theme }>
40
+ <CssBaseline />
41
+ <LocalizationProvider dateAdapter={ AdapterDateFns }>{ children }</LocalizationProvider>
42
+ </ThemeProvider>
43
+ );
44
+ }
45
+ ```
46
+ and reference it in your main App.tsx file or providers file:
47
+
48
+ ```javascript
49
+ import SpesiaThemeProvider from '../path-to-provider';
50
+
51
+ ...
52
+
53
+ <App>
54
+ <SpesiaThemeProvider>
55
+ { ...rest of the application }
56
+ </SpesiaThemeProvider>
57
+ </App>
58
+ ```
59
+
60
+
61
+ ## Available components
62
+
63
+ These Material UI components have been themed so far:
64
+
65
+ * Alert
66
+ * Button
67
+ * Card
68
+ * Chip
69
+ * Dialog
70
+ * TextField
71
+ * Typography
72
+ * Tooltip
73
+
74
+ We also have custom components that you can import, example:
75
+
76
+ ```javascript
77
+ import { Logo } from '@spesia/ui';
78
+
79
+ ...
80
+ <App>
81
+ <Logo withText color="blue" height={ 150 } alt="Spesía logo" />
82
+ </App>
83
+ ```
84
+
85
+ ## Development
86
+
87
+ To run storybook in development mode, run:
88
+
89
+ ```
90
+ pnpm dev
91
+ ```
92
+
93
+ The storybook dev server should now be available on localhost:6006
94
+
95
+ ### Adding components
96
+
97
+ When creating a theme for a component, start with creating the style folder, under `styles/[componenentName]` folder. Then import the style in `styles/index.ts` and include it to the `components` list.
98
+
99
+ When that is building correct, create a folder under `stories/components/[ComponentName]` and create a file called `[ComponentName].stories.tsx` and create some stories to show-case the theme in Storybook.
100
+
101
+ ## Building
102
+
103
+ There are two build scripts:
104
+
105
+ 1) `pnpm build` > This builds the theme as a ui library so that it can be published as an npm registry.
106
+ 2) `pnpm storybook` > This builds a static storybook website for demonstration purposes.
107
+
108
+ ### Dockerfile
109
+
110
+ The repo includes a Dockerfile that containerizes the storybook build.
111
+
112
+ Use `docker build . -t spesia-ui-kit` to build it.
113
+
114
+ ## Spesia colors
115
+
116
+ ### Typescript/javascript
117
+ The @spesia/ui package also exports a `colors` file, in case you need to reference colors in the theme directly.
118
+
119
+ Example:
120
+
121
+ ```javascript
122
+ import { color } from '@spesia/ui';
123
+
124
+ const chartColor = colors.primary.blue[400];
125
+
126
+ ```
127
+
128
+ ### CSS
129
+
130
+ You can also import the colors in your scss file as scss variables:
131
+
132
+ ```css
133
+ @use '@spesia/ui/dist/colors.scss';
134
+
135
+ .MyContainer {
136
+ background: $gray100;
137
+ }
138
+ ```
139
+
140
+ Inspect the colors.scss file to see which variables are available.
141
+
142
+ ## Creating a release
143
+
144
+ A new version of @spesia/ui is published in github actions whenever we tag a release.
145
+
146
+ We are using git precommit hooks to update the version.
147
+
148
+ For each commit, whenever a change is detected in this package, the git hook will create a new `prerelease` version and commit the tag.
149
+
150
+ When you are ready to push your commits to remote, remember to push the tags as well:
151
+
152
+ ```
153
+ git push
154
+ git push --tags
155
+ ```
@@ -0,0 +1,82 @@
1
+ @use "sass:color";
2
+
3
+ // Primary colors
4
+
5
+ $blue50: #f3f7f8;
6
+ $blue100: #ecf2f4;
7
+ $blue200: #cfdfe3;
8
+ $blue400: #3d7e8f;
9
+ $blue500: #0d5e73;
10
+ $blue600: #0a4959;
11
+
12
+ $coral50: color.scale(#FFE6DC, $lightness: 10%);
13
+ $coral100: #FFE6DC;
14
+ $coral200: color.scale(#fea381, $lightness: 10%);
15
+ $coral400: #fea381;
16
+ $coral500: #fd7c4b;
17
+ $coarl600: #fa581a;
18
+
19
+ $cream: #f5ebe8;
20
+ $peach: #d7af9f;
21
+ $green: #587650;
22
+
23
+ // Semantic Colors - TODO: Get semantic colors from Tara
24
+
25
+ //warning
26
+
27
+ $semanticYellow50: rgba(255, 192, 46, 0.05);
28
+ $semanticYellow100: rgba(255, 192, 46, 0.1);
29
+ $semanticYellow200: rgba(255, 192, 26, 0.1);
30
+ $semanticYellow400: rgba(143, 108, 26, 0.8);
31
+ $semanticYellow500: rgba(143, 108, 26, 1);
32
+ $semanticYellow600: rgba(114, 86, 21, 1);
33
+
34
+ //danger
35
+
36
+ $semanticRed50: rgba(255,74,74,0.05);
37
+ $semanticRed100: rgba(255,74,74,0.1);
38
+ $semanticRed200: rgba(199,58,58,0.14);
39
+ $semanticRed400: rgba(199,58,58,0.8);
40
+ $semanticRed500: rgba(199,58,58,1);
41
+ $semanticRed600: rgba(159, 46, 46, 1);
42
+
43
+ //success
44
+
45
+ $semanticGreen50: rgba(24,128,56,0.05);
46
+ $semanticGreen100: rgba(24,128,56,0.1);
47
+ $semanticGreen200: rgba(24,128,56,0.14);
48
+ $semanticGreen400: rgba(24,128,56,0.8);
49
+ $semanticGreen500: rgba(24,128,56,1);
50
+ $semanticGreen600: rgba(19, 102, 45, 1);
51
+
52
+ //info
53
+
54
+ $semanticBlue50: rgba(26,116,168,0.08);
55
+ $semanticBlue100: rgba(26,116,168,0.1);
56
+ $semanticBlue200: rgba(26,116,168,0.2);
57
+ $semanticBlue400: rgba(70,143,186,0.8);
58
+ $semanticBlue500: rgba(26,116,168,1);
59
+ $semanticBlue600: rgba(21, 93, 134, 1);
60
+
61
+ $neutral50: #f5f5f5;
62
+ $neutral100: #e5e5e5;
63
+ $neutral200: #d6d6d6;
64
+ $neutral400: #737373;
65
+ $neutral500: color.scale(#737373, $lightness: -5%);
66
+ $neutral600: color.scale(#737373, $lightness: -10%);
67
+
68
+ // Text and background colors
69
+
70
+ $gray0: rgba(2,0,0,0.02);
71
+ $gray25: #fafafa;
72
+ $gray50: #f5f5f5;
73
+ $gray100: #e5e5e5;
74
+ $gray200: #d6d6d6;
75
+ $gray300: #a3a3a3;
76
+ $gray400: #737373;
77
+ $gray700: #424242;
78
+ $gray900: #141414;
79
+ $gray950: #0f0f0f;
80
+
81
+ $black: #141414;
82
+ $white: #fff;
@@ -0,0 +1,31 @@
1
+ @font-face {
2
+ font-family: 'Montserrat';
3
+ src: url('/fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
4
+ font-weight: normal;
5
+ font-style: normal;
6
+ }
7
+
8
+ @font-face {
9
+ font-family: 'Montserrat';
10
+ src: url('/fonts/Montserrat/Montserrat-Italic-VariableFont_wght.ttf') format('truetype');
11
+ font-weight: normal;
12
+ font-style: italic;
13
+ }
14
+
15
+ @font-face {
16
+ font-family: 'Montserrat Fallback';
17
+ src: local("Arial");
18
+ ascent-override: 85.79%;
19
+ descent-override: 22.25%;
20
+ line-gap-override: 0.00%;
21
+ size-adjust: 112.83%;
22
+ }
23
+
24
+ .montserrat-font {
25
+ font-family: 'Montserrat', 'Montserrat Fallback';
26
+ font-style: normal;
27
+ }
28
+
29
+ .montserrat-font-variable {
30
+ --font-spesia: 'Montserrat', 'Montserrat Fallback';
31
+ }