@newtonschool/grauity 1.3.1 → 2.0.0-beta.0
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 +73 -53
- package/dist/index.d.ts +1767 -156
- package/dist/index.d.ts.map +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/MonthlyCalendar.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/MonthlyCalendar.styles.d.ts +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/MonthlyCalendar.styles.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/MonthlyCalendarGridItem.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/OverflowEventsList.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/OverflowIndicator.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/types.d.ts +0 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/types.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/MonthlyCalendar/utils.d.ts.map +1 -1
- package/dist/ui/elements/Calendar/types.d.ts +0 -1
- package/dist/ui/elements/Calendar/types.d.ts.map +1 -1
- package/dist/ui/elements/Chip/Chip.d.ts.map +1 -1
- package/dist/ui/elements/Chip/Chip.styles.d.ts +0 -1
- package/dist/ui/elements/Chip/Chip.styles.d.ts.map +1 -1
- package/dist/ui/elements/Chip/types.d.ts +0 -23
- package/dist/ui/elements/Chip/types.d.ts.map +1 -1
- package/dist/ui/elements/PopOver/PopOver.d.ts.map +1 -1
- package/dist/ui/elements/PopOver/types.d.ts +0 -9
- package/dist/ui/elements/PopOver/types.d.ts.map +1 -1
- package/dist/ui/elements/Table/Table.d.ts +1 -1
- package/dist/ui/elements/Table/Table.d.ts.map +1 -1
- package/dist/ui/elements/Table/Table.styles.d.ts.map +1 -1
- package/dist/ui/elements/Table/types.d.ts +7 -0
- package/dist/ui/elements/Table/types.d.ts.map +1 -1
- package/dist/ui/elements/Tooltip/types.d.ts +3 -3
- package/dist/ui/elements/Tooltip/types.d.ts.map +1 -1
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/themes/GlobalStyle.d.ts +7 -1
- package/dist/ui/themes/GlobalStyle.d.ts.map +1 -1
- package/dist/ui/themes/ThemeProvider.d.ts +878 -24
- package/dist/ui/themes/ThemeProvider.d.ts.map +1 -1
- package/dist/ui/themes/darkThemeConstants.d.ts +440 -13
- package/dist/ui/themes/darkThemeConstants.d.ts.map +1 -1
- package/dist/ui/themes/lightThemeConstants.d.ts +440 -13
- package/dist/ui/themes/lightThemeConstants.d.ts.map +1 -1
- package/dist/ui/themes/types.d.ts +11 -0
- package/dist/ui/themes/types.d.ts.map +1 -0
- package/dist/ui/themes/utils.d.ts +20 -0
- package/dist/ui/themes/utils.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/Header.d.ts +0 -5
- package/dist/ui/elements/Calendar/UnifiedCalendar/Header.d.ts.map +0 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/UnifiedCalendar.d.ts +0 -6
- package/dist/ui/elements/Calendar/UnifiedCalendar/UnifiedCalendar.d.ts.map +0 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/UnifiedCalendar.styles.d.ts +0 -6
- package/dist/ui/elements/Calendar/UnifiedCalendar/UnifiedCalendar.styles.d.ts.map +0 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/index.d.ts +0 -3
- package/dist/ui/elements/Calendar/UnifiedCalendar/index.d.ts.map +0 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/types.d.ts +0 -84
- package/dist/ui/elements/Calendar/UnifiedCalendar/types.d.ts.map +0 -1
- package/dist/ui/elements/Calendar/UnifiedCalendar/utils.d.ts +0 -3
- package/dist/ui/elements/Calendar/UnifiedCalendar/utils.d.ts.map +0 -1
- package/dist/ui/elements/Tabs/Tabs.d.ts +0 -5
- package/dist/ui/elements/Tabs/Tabs.d.ts.map +0 -1
- package/dist/ui/elements/Tabs/Tabs.styles.d.ts +0 -5
- package/dist/ui/elements/Tabs/Tabs.styles.d.ts.map +0 -1
- package/dist/ui/elements/Tabs/index.d.ts +0 -3
- package/dist/ui/elements/Tabs/index.d.ts.map +0 -1
- package/dist/ui/elements/Tabs/types.d.ts +0 -49
- package/dist/ui/elements/Tabs/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Inspired by the natural laws that guide the cosmos, **gra.UI.ty** (pronounced "g
|
|
|
26
26
|
|
|
27
27
|
### Philosophy
|
|
28
28
|
|
|
29
|
-
Like
|
|
29
|
+
Like the gravitational force itself, the principles of great design are universal, omnipresent, yet often unobserved. With gra.UI.ty, we aim to tap into these fundamental elements to craft UI components that not only look stunning but feel inherently right.
|
|
30
30
|
|
|
31
31
|
### Component Naming Convention
|
|
32
32
|
|
|
@@ -37,77 +37,64 @@ For example, `NSButton`, `NSTable`, `NSInput`
|
|
|
37
37
|
|
|
38
38
|
gra.UI.ty is also affectionately known as **grauity**, **graUIty** or simply as **gravity**
|
|
39
39
|
|
|
40
|
-
## Key Features
|
|
41
|
-
|
|
42
|
-
- **Comprehensive Component Set:** From buttons and dialogs to complex data grids and sliders, gra.UI.ty has everything you need. (Coming soon!)
|
|
43
|
-
- **Semantic and Mindful Components:** Our components are more than just divs. Each one is thoughtfully designed with semantic HTML for better accessibility and SEO. We aim to ensure that each component has a clear and meaningful structure.
|
|
44
|
-
- **Modular and Extensible:** Integrate seamlessly with your projects, adding only what you need without bloating your codebase.
|
|
45
|
-
- **Theming and Customization:** Easily adapt the components to match your brand or project’s aesthetic. (Coming soon!)
|
|
46
|
-
- **Accessibility First:** Built with accessibility in mind, ensuring that your applications are usable by everyone. (We'll get there...)
|
|
47
|
-
|
|
48
40
|
## Setup gra.UI.ty to make it your own!
|
|
49
41
|
|
|
50
42
|
### Developing Components
|
|
51
43
|
|
|
52
|
-
To
|
|
44
|
+
To start your development journey in grauity, follow these steps:
|
|
53
45
|
|
|
54
46
|
```bash
|
|
55
|
-
# Install all packages
|
|
56
|
-
|
|
47
|
+
# Install all packages in grauity
|
|
48
|
+
npm install
|
|
57
49
|
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
# Update submodules (mainly iconland, the submodule for icons)
|
|
51
|
+
git submodule init
|
|
52
|
+
git submodule update --recursive
|
|
61
53
|
|
|
62
|
-
# Build icons when running for first time
|
|
63
|
-
|
|
54
|
+
# Build icons (required when running for first time)
|
|
55
|
+
npm run build-icons
|
|
64
56
|
|
|
65
|
-
#
|
|
66
|
-
|
|
57
|
+
# Run grauity Storybook
|
|
58
|
+
npm run storybook
|
|
67
59
|
# Then head to localhost:6006
|
|
68
60
|
|
|
69
|
-
# To build
|
|
70
|
-
|
|
61
|
+
# To build grauity Storybook docs, run this command in grauity
|
|
62
|
+
npm run build-storybook
|
|
71
63
|
```
|
|
72
64
|
|
|
73
|
-
### Integrating locally with
|
|
65
|
+
### Integrating locally with your app for side-by-side development & testing
|
|
74
66
|
|
|
75
|
-
To integrate grauity locally with
|
|
67
|
+
To integrate grauity locally with your app, follow these steps:
|
|
76
68
|
|
|
77
69
|
```bash
|
|
78
|
-
#
|
|
70
|
+
# Install all packages in grauity
|
|
79
71
|
grauity$: npm install
|
|
80
72
|
|
|
81
|
-
#
|
|
73
|
+
# Build grauity
|
|
82
74
|
grauity$: npm run build
|
|
83
75
|
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
# This is assuming `grauity` and `newton-web` share same parent folder
|
|
76
|
+
# Install local version of grauity
|
|
77
|
+
your-app$: npm install ../grauity
|
|
87
78
|
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# Finally, run newton-web
|
|
92
|
-
newton-web$: npm run dev
|
|
79
|
+
# Link react, react-dom from grauity to your-app:
|
|
80
|
+
your-app$: npm link ../gruity/node_modules/react ../gruity/node_modules/react-dom --legacy-peer-deps
|
|
93
81
|
```
|
|
94
82
|
|
|
95
83
|
After you have made changes in grauity, build it.
|
|
96
|
-
|
|
97
84
|
```bash
|
|
98
85
|
grauity$: npm run build
|
|
99
86
|
```
|
|
100
87
|
|
|
101
88
|
If changes are not showing up even after rebuilding, you may
|
|
102
|
-
have to delete `
|
|
103
|
-
and install
|
|
104
|
-
|
|
89
|
+
have to delete `your-app/node_modules/@newtonschool/grauity` folder
|
|
90
|
+
and install `grauity` again:
|
|
105
91
|
```bash
|
|
106
|
-
|
|
107
|
-
|
|
92
|
+
grauity$: npm run build
|
|
93
|
+
|
|
94
|
+
your-app$: npm install ../grauity
|
|
108
95
|
```
|
|
109
96
|
|
|
110
|
-
Then simply import components you want from `@newtonschool/grauity` in `
|
|
97
|
+
Then simply import components you want from `@newtonschool/grauity` in `your-app` like so:
|
|
111
98
|
|
|
112
99
|
```js
|
|
113
100
|
import { NSButton, BUTTON_VARIANTS_ENUM } from '@newtonschool/grauity';
|
|
@@ -130,37 +117,70 @@ export const MyComponent = () => (
|
|
|
130
117
|
);
|
|
131
118
|
```
|
|
132
119
|
|
|
133
|
-
## How to's
|
|
134
120
|
|
|
135
|
-
|
|
121
|
+
# How to's
|
|
136
122
|
|
|
137
|
-
|
|
123
|
+
## Add new icons from `.svg` files
|
|
138
124
|
|
|
139
|
-
###
|
|
125
|
+
### 1. Update the iconland submodule in grauity
|
|
140
126
|
|
|
141
127
|
```bash
|
|
142
128
|
grauity$: git submodule update --remote --merge
|
|
143
129
|
```
|
|
144
130
|
|
|
145
|
-
|
|
131
|
+
### 2. Add your `.svg` files
|
|
146
132
|
|
|
147
|
-
|
|
148
|
-
grauity$: npm run build-icons:generate
|
|
149
|
-
```
|
|
133
|
+
To add a new font icon, add your `.svg` files for the new icon in the [./iconland/seeds/](iconland/seeds) directory in the [iconland](./iconland) submodule.
|
|
150
134
|
|
|
151
|
-
|
|
135
|
+
|
|
136
|
+
#### 3. Optimize & Generate new font files
|
|
152
137
|
|
|
153
138
|
```bash
|
|
154
139
|
grauity$: npm run build-icons:optimize
|
|
140
|
+
grauity$: npm run build-icons:generate
|
|
155
141
|
```
|
|
156
|
-
|
|
157
|
-
#### 3. Build font icons from optimised icons
|
|
158
|
-
|
|
142
|
+
*Alternatively*, run the command
|
|
159
143
|
```bash
|
|
160
144
|
grauity$: npm run build-icons
|
|
161
145
|
```
|
|
162
146
|
|
|
163
|
-
|
|
147
|
+
Font files will be created in [ui/fonts](ui/fonts) folder.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Use theming in your React app
|
|
151
|
+
|
|
152
|
+
Without theming, only foundational (theme agnostic) CSS variables (found here: [constantGlobalStyle](ui/themes/GlobalStyle.ts)) will be provided.
|
|
153
|
+
|
|
154
|
+
To enable theming, wrap your components with `GrauityThemeProvider`:
|
|
155
|
+
```js
|
|
156
|
+
import { GrauityThemeProvider } from '@newtonschool/grauity';
|
|
157
|
+
|
|
158
|
+
const App = ({ children, ...props }) => {
|
|
159
|
+
return (
|
|
160
|
+
<GrauityThemeProvider>
|
|
161
|
+
{children}
|
|
162
|
+
</GrauityThemeProvider>
|
|
163
|
+
)
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export default App;
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
Theming can be controlled by providing different class names to your root/local DOM elements, like the body element.
|
|
171
|
+
|
|
172
|
+
- Add class `grauity-theme-light` to use the light theme
|
|
173
|
+
- Add class `grauity-theme-dark` to use the dark theme
|
|
174
|
+
|
|
175
|
+
Now, you will be provided with the foundational as well as themed CSS variables, whose
|
|
176
|
+
value will change depending on the theme applied.
|
|
177
|
+
|
|
178
|
+
These themed CSS variables can be found here:
|
|
179
|
+
- [Dark theme color mapping](./ui/themes/darkThemeConstants.ts)
|
|
180
|
+
- [Light theme color mapping](./ui/themes/lightThemeConstants.ts)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
## Use icons in your React app
|
|
164
184
|
|
|
165
185
|
To use grauity icons, add the following import in `global-styles.scss` or any root-level CSS/SCSS file. Make sure CSS/SCSS loaders are setup properly in your app.
|
|
166
186
|
|