@new-ui/foundations 0.3.1 → 0.3.3

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 CHANGED
@@ -1,9 +1,11 @@
1
1
  # New UI Foundations
2
2
 
3
3
  #### What is New UI?
4
+
4
5
  New UI is a modern, semantic UI framework for building beautiful, accessible websites and apps. It gives you all the core design foundations you need—colors, typography, spacing and sizing, reset, grid and layouts, and layering and elevations. It's designed to grow with you, from your first launch to millions of users. Thoughtfully made for makers, small teams, and anyone who cares about great design.
5
6
 
6
7
  #### Install
8
+
7
9
  To set up the project, open your terminal and run the following command:
8
10
 
9
11
  ```
@@ -13,236 +15,156 @@ npm i -D @new-ui/foundations
13
15
  <strong>Note:</strong> This command installs all New UI foundation packages, which include reset, colors, effects, spacings, and typography. If you need to install only specific packages, refer to the foundations documentation for instructions.
14
16
 
15
17
  #### Import
18
+
16
19
  Import the New UI foundations by adding the following line at the top of your SCSS file:
17
20
 
18
21
  ```scss
19
- @use '@new-ui/foundations'; // Use `@import` for CSS
22
+ @use '@new-ui/foundations'; // Use `@import` for CSS
20
23
  ```
21
24
 
22
25
  #### Set the theme
26
+
23
27
  Set the theme by adding the `data-new-ui-theme` attribute to your HTML wrapper element, for example:
24
28
 
25
29
  ```html
26
- <html data-new-ui-theme="light">
30
+ <html data-new-ui-theme="light"></html>
27
31
  ```
28
32
 
29
- Available themes | Value
30
- :--- |:---
31
- Light (Default) | `light`
32
- Light warm | `light--warm`
33
- Light cold | `light--cold`
34
- Dark (Default) | `dark`
35
- Dark warm | `dark--warm`
36
- Dark cold | `dark--cold`
33
+ | Available themes | Value |
34
+ | :--------------- | :------------ |
35
+ | Light (Default) | `light` |
36
+ | Light warm | `light--warm` |
37
+ | Light cold | `light--cold` |
38
+ | Dark (Default) | `dark` |
39
+ | Dark warm | `dark--warm` |
40
+ | Dark cold | `dark--cold` |
37
41
 
42
+ #### Utility classes, naming convention
38
43
 
39
- #### Usage guide
40
44
  - All classes associated with the New UI are prefixed with a global namespace followed by a hyphen: `nu-`
41
45
  - In addition to a global namespace, we added prefixes to each class to make it more apparent what job that class is doing using BEM syntax.
42
- - `c-` for UI components.
43
- - `l-` for layout-related styles.
44
- - `u-` for utilities.
45
- - `is-` and `has-` for state-based classes.
46
- - `js-` for targeting JavaScript-specific functionality.
46
+ - `c-` for UI components.
47
+ - `l-` for layout-related styles.
48
+ - `u-` for utilities.
49
+ - `is-` and `has-` for state-based classes.
50
+ - `js-` for targeting JavaScript-specific functionality.
47
51
 
48
52
  ---
49
53
 
50
- ### Design Tokens & Primitives
54
+ ### Design tokens
51
55
 
52
56
  #### Colors
53
57
 
54
- Background | Role
55
- :--- | :---
56
- **`--background`** | Default app background
57
- **`--background-secondary`** | Secondary app background
58
- **`--background-hover`** | Background hover
59
- **`--background-selected`** | UI element background
60
- **`--background-selected-hover`** | UI element background hovered
61
- **`--background-high-contrast`** | High contrast background
62
-
63
- Border | Role
64
- :--- | :---
65
- **`--border-muted`** | Muted strokes and separators
66
- **`--border`** | Default strokes and separators
67
- **`--border-strong`** | Strong strokes and separators
68
- **`--border-inked`** | Inked strokes and separators
69
- **`--border-inverse`** | Inverse strokes and separators
70
- **`--border-focus`** | Focus outline
71
-
72
- Button | Role
73
- :--- | :---
74
- **`--button`** | Primary button background
75
- **`--button-hover`** | Primary button hover
76
- **`--button-active`** | Primary button active
77
- **`--button-disabled`** | Disabled button background
78
-
79
- Icon | Role
80
- :--- | :---
81
- **`--icon-primary`** | Primary icons
82
- **`--icon-secondary`** | Secondary icons
83
- **`--icon-disabled`** | Disabled icons
84
- **`--icon-on-color`** | Icon on interactive colors
85
- **`--icon-inked`** | Inked icons
86
-
87
- Link | Role
88
- :--- | :---
89
- **`--link`** | Primary link
90
- **`--link-hover`** | Hover state for primary link
91
- **`--link-subtle`** | Secondary link
92
- **`--link-visited`** | Link visited
93
-
94
- Support | Role
95
- :--- | :---
96
- **`--support-error`** | Error
97
- **`--support-warning`** | Warning
98
- **`--support-success`** | Success
99
- **`--support-info`** | Information
100
-
101
- Text | Role
102
- :--- | :---
103
- **`--text-primary`** | Primary body copy
104
- **`--text-secondary`** | Secondary text color
105
- **`--text-secondary-alt`** | Secondary text color alt
106
- **`--text-placeholder`** | Placeholder text color
107
- **`--text-on-color`** | Text on interactive color
108
- **`--text-error`** | Error message
109
- **`--text-success`** | Success message
110
- **`--text-inked`** | Inked text
58
+ | Background | Role |
59
+ | :-------------------------------- | :---------------------------- |
60
+ | **`--background`** | Default app background |
61
+ | **`--background-secondary`** | Secondary app background |
62
+ | **`--background-hover`** | Background hover |
63
+ | **`--background-selected`** | UI element background |
64
+ | **`--background-selected-hover`** | UI element background hovered |
65
+ | **`--background-high-contrast`** | High contrast background |
66
+
67
+ | Border | Role |
68
+ | :--------------------- | :----------------------------- |
69
+ | **`--border-muted`** | Muted strokes and separators |
70
+ | **`--border`** | Default strokes and separators |
71
+ | **`--border-strong`** | Strong strokes and separators |
72
+ | **`--border-inked`** | Inked strokes and separators |
73
+ | **`--border-inverse`** | Inverse strokes and separators |
74
+ | **`--border-focus`** | Focus outline |
75
+
76
+ | Button | Role |
77
+ | :---------------------- | :------------------------- |
78
+ | **`--button`** | Primary button background |
79
+ | **`--button-hover`** | Primary button hover |
80
+ | **`--button-active`** | Primary button active |
81
+ | **`--button-disabled`** | Disabled button background |
82
+
83
+ | Link | Role |
84
+ | :------------------- | :--------------------------- |
85
+ | **`--link`** | Primary link |
86
+ | **`--link-hover`** | Hover state for primary link |
87
+ | **`--link-subtle`** | Secondary link |
88
+ | **`--link-visited`** | Link visited |
89
+
90
+ | Support | Role |
91
+ | :---------------------- | :---------- |
92
+ | **`--support-error`** | Error |
93
+ | **`--support-warning`** | Warning |
94
+ | **`--support-success`** | Success |
95
+ | **`--support-info`** | Information |
96
+
97
+ | Content | Role |
98
+ | :---------------------------- | :------------------------ |
99
+ | **`--content-primary`** | Primary body copy |
100
+ | **`--content-secondary`** | Secondary text color |
101
+ | **`--content-secondary-alt`** | Secondary text color alt |
102
+ | **`--content-placeholder`** | Placeholder text color |
103
+ | **`--content-on-color`** | Text on interactive color |
104
+ | **`--content-error`** | Error message |
105
+ | **`--content-success`** | Success message |
106
+ | **`--content-inked`** | Inked text |
111
107
 
112
108
  #### Effects
113
109
 
114
- Shadows | Role
115
- :--- | :---
116
- **`--dialog-strong`** | Modals, sidebar overlays, toasts
117
- **`--dialog`** | Dropdown, tooltip, popover
118
- **`--content`** | Content area, buttons, controls, cards, pills
119
- **`--canvas`** | Background
120
- **`--keyboard-key`** | Keyboard key component
121
-
122
- Focus | Role
123
- :--- | :---
124
- **`--focus-default`** | Default focus
125
- **`--focus-accent`** | Accent focus
126
- **`--focus-inverse`** | Focus inverse
127
-
128
- Borders | Role
129
- :--- | :---
130
- **`--border-width-01`** | Default border width
131
- **`--border-width-02`** | Used for the selection and focus order
110
+ | Shadows | Role |
111
+ | :-------------------- | :-------------------------------------------- |
112
+ | **`--dialog-strong`** | Modals, sidebar overlays, toasts |
113
+ | **`--dialog`** | Dropdown, tooltip, popover |
114
+ | **`--content`** | Content area, buttons, controls, cards, pills |
115
+ | **`--canvas`** | Background |
116
+ | **`--keyboard-key`** | Keyboard key component |
117
+
118
+ | Focus | Role |
119
+ | :-------------------- | :------------ |
120
+ | **`--focus-default`** | Default focus |
121
+ | **`--focus-accent`** | Accent focus |
122
+ | **`--focus-inverse`** | Focus inverse |
132
123
 
133
124
  #### Spacings
134
125
 
135
- Token | Size (px/rem)
136
- :--- | :---
137
- **`--spacing-00`** | 0 / 0
138
- **`--spacing-01`** | 2 / 0.125
139
- **`--spacing-02`** | 4 / 0.25
140
- **`--spacing-03`** | 6 / 0.375
141
- **`--spacing-04`** | 8 / 0.5
142
- **`--spacing-05`** | 12 / 0.75
143
- **`--spacing-06`** | 16 / 1
144
- **`--spacing-07`** | 20 / 1.25
145
- **`--spacing-08`** | 24 / 1.5
146
- **`--spacing-09`** | 32 / 2
147
- **`--spacing-10`** | 40 / 2.5
148
- **`--spacing-11`** | 48 / 3
149
- **`--spacing-12`** | 56 / 3.5
150
- **`--spacing-13`** | 64 / 4
151
- **`--spacing-14`** | 72 / 4.5
152
- **`--spacing-15`** | 80 / 5
153
- **`--spacing-16`** | 96 / 6
154
- **`--spacing-17`** | 120 / 7.5
155
- **`--spacing-18`** | 160 / 10
126
+ | Token | Source | Size (px/rem) |
127
+ | :------------------- | :------------- | :------------ |
128
+ | **`--spacing-zero`** | `--spacing-00` | 0 / 0 |
129
+ | **`--spacing-xs`** | `--spacing-02` | 4 / 0.25 |
130
+ | **`--spacing-s`** | `--spacing-04` | 8 / 0.5 |
131
+ | **`--spacing-m`** | `--spacing-05` | 12 / 0.75 |
132
+ | **`--spacing-l`** | `--spacing-06` | 16 / 1 |
133
+ | **`--spacing-xl`** | `--spacing-08` | 24 / 1.5 |
134
+ | **`--spacing-xxl`** | `--spacing-09` | 32 / 2 |
135
+ | **`--spacing-xxxl`** | `--spacing-11` | 48 / 3 |
136
+
137
+ #### Sizing
138
+
139
+ | Token | Source | Size (px/rem) |
140
+ | :---------------------------- | :------------- | :------------ |
141
+ | **`--size-xs`** | `--spacing-06` | 16 / 1 |
142
+ | **`--size-s`** | `--spacing-08` | 24 / 1.5 |
143
+ | **`--size-m`** | `--spacing-09` | 32 / 2 |
144
+ | **`--controls-size-default`** | `--spacing-09` | 32 / 2 |
145
+ | **`--controls-size-small`** | `--spacing-08` | 24 / 1.5 |
156
146
 
157
147
  #### Typography
158
148
 
159
- Heading (Desktop) | Heading (Mobile) | Role
160
- :--- | :--- | :---
161
- **`--desktop-heading-01`** | **`--mobile-heading-01`** | Heading 01
162
- **`--desktop-heading-02`** | **`--mobile-heading-02`** | Heading 02
163
- **`--desktop-heading-03`** | **`--mobile-heading-03`** | Heading 03
164
- **`--desktop-heading-04`** | **`--mobile-heading-04`** | Heading 04
165
- **`--desktop-heading-05`** | **`--mobile-heading-05`** | Heading 05
166
- **`--desktop-heading-06`** | **`--mobile-heading-06`** | Heading 06
167
-
168
- Body (Desktop) | Body (Mobile) | Role
169
- :--- | :--- | :---
170
- **`--desktop-body-xl`** | **`--mobile-body-xl`** | Body large
171
- **`--desktop-body`** | **`--mobile-body`** | Body copy
172
- **`--desktop-body-sm`** | **`--mobile-body-sm`** | Body small
173
-
174
- Utility (Desktop) | Utility (Mobile) | Role
175
- :--- | :--- | :---
176
- **`--desktop-caption`** | **`--mobile-caption`** | Caption
177
- **`--desktop-helper-text`** | **`--mobile-helper-text`** | Helper text
178
- **`--desktop-code`** | **`--mobile-code`** | Code
149
+ | Heading (Desktop) | Heading (Mobile) | Role |
150
+ | :------------------------- | :------------------------ | :--------- |
151
+ | **`--desktop-heading-01`** | **`--mobile-heading-01`** | Heading 01 |
152
+ | **`--desktop-heading-02`** | **`--mobile-heading-02`** | Heading 02 |
153
+ | **`--desktop-heading-03`** | **`--mobile-heading-03`** | Heading 03 |
154
+ | **`--desktop-heading-04`** | **`--mobile-heading-04`** | Heading 04 |
155
+ | **`--desktop-heading-05`** | **`--mobile-heading-05`** | Heading 05 |
156
+ | **`--desktop-heading-06`** | **`--mobile-heading-06`** | Heading 06 |
157
+
158
+ | Body (Desktop) | Body (Mobile) | Role |
159
+ | :---------------------- | :--------------------- | :--------- |
160
+ | **`--desktop-body-xl`** | **`--mobile-body-xl`** | Body large |
161
+ | **`--desktop-body`** | **`--mobile-body`** | Body copy |
162
+ | **`--desktop-body-sm`** | **`--mobile-body-sm`** | Body small |
163
+
164
+ | Utility (Desktop) | Utility (Mobile) | Role |
165
+ | :-------------------------- | :------------------------- | :---------- |
166
+ | **`--desktop-caption`** | **`--mobile-caption`** | Caption |
167
+ | **`--desktop-helper-text`** | **`--mobile-helper-text`** | Helper text |
168
+ | **`--desktop-code`** | **`--mobile-code`** | Code |
179
169
 
180
170
  > Note: To set line height, simply add the prefix `--lh` to the font size variables. For instance, `--desktop-body-xl` becomes `--lh-desktop-body-xl`.
181
-
182
- ---
183
-
184
- ### The new reset
185
-
186
- A thoughtful SCSS, CSS reset that preserves browser defaults while giving you complete design control. New UI reset eliminates cross-browser inconsistencies without being overly opinionated, allowing you to build upon a clean foundation.
187
-
188
- ```scss
189
- // https://cdn.jsdelivr.net/npm/@new-ui/reset@latest/dist/index.css
190
-
191
- *, *::before, *::after {
192
- box-sizing: border-box;
193
- }
194
-
195
- html {
196
- -moz-text-size-adjust: none;
197
- -webkit-text-size-adjust: none;
198
- text-size-adjust: none;
199
- vertical-align: baseline;
200
- }
201
-
202
- body, h1, h2, h3, h4, p,
203
- figure, blockquote, dl, dd {
204
- margin: 0;
205
- padding: 0;
206
- margin-block-end: 0;
207
- }
208
-
209
- ul[role='list'],
210
- ol[role='list'] {
211
- list-style: none;
212
- }
213
-
214
- body {
215
- min-height: 100vh;
216
- line-height: 1.5;
217
- }
218
-
219
- h1, h2,
220
- h3, h4 {
221
- text-wrap: balance;
222
- }
223
-
224
- a:not([class]) {
225
- text-decoration-skip-ink: auto;
226
- }
227
-
228
- img,
229
- picture {
230
- max-width: 100%;
231
- display: block;
232
- }
233
-
234
- input, textarea, button, select {
235
- font-family: inherit;
236
- font-size: inherit;
237
- margin: 0;
238
- }
239
-
240
- table {
241
- border-collapse: collapse;
242
- border-spacing: 0;
243
- }
244
-
245
- :target {
246
- scroll-margin-block: 5ex;
247
- }
248
- ```