@terrahq/design-system 0.2.0 → 0.3.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 CHANGED
@@ -14,7 +14,7 @@ Terra CSS classes for building demos and prototypes outside our regular ecosyste
14
14
  <link rel="stylesheet" href="https://unpkg.com/@terrahq/design-system@latest/dist/style.css">
15
15
  ```
16
16
 
17
- Pin a version instead of `latest` if the page must never change: `@terrahq/design-system@0.1.0`.
17
+ Pin a version instead of `latest` if the page must never change: `@terrahq/design-system@0.3.0`.
18
18
 
19
19
  **From npm:**
20
20
 
@@ -28,28 +28,115 @@ import '@terrahq/design-system' // resolves to dist/style.css
28
28
 
29
29
  ## Use it
30
30
 
31
+ A white card with a 1px border, an outlined pill and a title at weight 500:
32
+
31
33
  ```html
32
- <article class="f--background-b f--radius-c f--shadow-a u--p-4 u--display-flex u--flex-direction-column u--gap-2">
33
- <span class="f--background-d f--color-a f--font-f u--px-2 f--radius-full">new</span>
34
- <h3 class="f--font-c u--font-bold">Project Atlas</h3>
34
+ <article class="f--background-b f--radius-c u--border-a u--p-4 u--display-flex u--flex-direction-column u--gap-2">
35
+ <span class="f--font-f u--font-medium u--px-2 f--radius-full u--border-f" style="align-self:flex-start">new</span>
36
+ <h3 class="f--font-c u--font-medium">project atlas</h3>
35
37
  <p class="f--font-e">Built only with classes.</p>
36
38
  </article>
37
39
  ```
38
40
 
39
- ## Two layers
41
+ ## Three layers
40
42
 
41
43
  | Layer | What it is | Examples |
42
44
  |---|---|---|
43
- | `f--` **foundation** | Terra's design decisions. Several properties per class, responsive included. They don't change between versions. | `f--font-c`, `f--color-a`, `f--background-d`, `f--radius-c`, `f--shadow-a`, `f--row`, `f--col-6` |
45
+ | `f--` **foundation** | Terra's design decisions. Several properties per class, responsive included. They don't change between versions. | `f--font-c`, `f--color-a`, `f--background-b`, `f--radius-c`, `f--shadow-a`, `f--row`, `f--col-6` |
44
46
  | `u--` **utilities** | One property per class, with a variant per breakpoint. | `u--p-4`, `u--p-mobile-2`, `u--display-flex`, `u--border-a` |
47
+ | `c--` **components** | Ready-made pieces with several properties and states. Variants are letters; sizes, icon types and Terraform shapes are modifiers. | `c--btn-a`, `c--card-wrapper-a`, `c--icon-a--check` |
45
48
 
46
- If a foundation class already covers something, there is no utility for it. To tweak one detail of a foundation class, add a utility: `f--font-c u--font-bold`. Utilities load after foundation, so they win.
49
+ If a foundation class already covers something, there is no utility for it. To tweak one detail of a foundation class, add a utility: `f--font-c u--font-medium`. Utilities load after foundation, so they win.
47
50
 
48
51
  **Breakpoints** (`max-width`): `desktop` 1700 · `laptop` 1570 · `tabletl` 1300 · `tabletm` 1024 · `tablets` 810 · `mobile` 580. Utilities take the name in the middle: `u--p-mobile-2`.
49
52
 
50
- **Typography.** `f--font-a` to `f--font-f` use Uncut Sans, then `system-ui`. The package does **not** ship the font files; load Uncut Sans yourself or the browser falls back to `system-ui`.
53
+ **Typography.** `f--font-a` to `f--font-f` use Uncut Sans, then `system-ui`. The package does **not** ship the font files; load Uncut Sans yourself or the browser falls back to `system-ui`. Titles use weight 500: add `u--font-medium`.
54
+
55
+ ## Components
56
+
57
+ Components are named `c--name-variant--modifier`. They follow `terra.config.js` (palette, radius, time and easing) like everything else.
58
+
59
+ ```html
60
+ <!-- buttons: a primary, b secondary, c tertiary. Sizes: --small, --medium (default), --large -->
61
+ <button class="c--btn-a">save</button>
62
+ <button class="c--btn-b c--btn-b--small">cancel</button>
63
+
64
+ <!-- card: the wrapper is the box, put anything inside. Variant b has no padding, for an image at the edge -->
65
+ <article class="c--card-wrapper-a">
66
+ <span class="c--tag-a">new</span>
67
+ <h3 class="f--font-c u--font-medium">project atlas</h3>
68
+ <p class="f--font-e">Anything goes inside the wrapper.</p>
69
+ </article>
70
+ ```
71
+
72
+ | Component | Classes |
73
+ |---|---|
74
+ | Button | `c--btn-a`, `c--btn-b`, `c--btn-c` + `--small`, `--medium`, `--large` |
75
+ | Card | `c--card-wrapper-a`, `c--card-wrapper-b` |
76
+ | Tag | `c--tag-a` |
77
+ | Icon | `c--icon-a` + size (`--small` 16px, `--medium` 24px, `--large` 32px) + type (`--check`, `--arrow-right`…) |
78
+ | Terraform | `c--terraform-a` + size (`--small` 32px, `--medium` 64px, `--large` 128px) + shape (`--forma`, `--diana`…) |
79
+ | Terraform trio | `c--terraform-trio-a` around three terraforms |
80
+
81
+ **Icons and Terraforms** are CSS masks painted with the text color, so `f--color-*` tints them. Their types and shapes are in two extra files, so you only pay for what you use:
82
+
83
+ ```html
84
+ <link rel="stylesheet" href="https://unpkg.com/@terrahq/design-system@0.3.0/dist/style.css">
85
+ <link rel="stylesheet" href="https://unpkg.com/@terrahq/design-system@0.3.0/dist/icons.css">
86
+ <link rel="stylesheet" href="https://unpkg.com/@terrahq/design-system@0.3.0/dist/terraforms.css">
87
+ ```
88
+
89
+ ```js
90
+ import '@terrahq/design-system/icons.css'
91
+ import '@terrahq/design-system/terraforms.css'
92
+ ```
93
+
94
+ ```html
95
+ <i class="c--icon-a c--icon-a--large c--icon-a--search f--color-f"></i>
96
+ <i class="c--terraform-a c--terraform-a--forma f--color-d"></i>
97
+ ```
98
+
99
+ Icons: `arrow-right`, `arrow-left`, `check`, `close`, `plus`, `search`, `chevron-down`, `external`, `download`, `copy`, `mail`, `info`, `menu` (an initial set). Terraforms: `forma`, `diana`, `stanley`, `mistyk`, `melos`, `prismo`, `mendia`, `boba`, `ebb`, `gollum`, `punky`, `infinito`.
100
+
101
+ A Terraform is used **alone or in a trio**: three different shapes in three different colors. Never two, and never the same shape or color twice in a trio.
102
+
103
+ `c--` is also the prefix projects use for their own components. If a project defines its own `c--btn-a`, it will clash with this one.
104
+
105
+ ## Brand use
106
+
107
+ When you build something that carries the Terra brand:
108
+
109
+ - **Backgrounds** are only `a` (Noche), `b` (white) or `c` (Morning Haze): `f--background-a`, `-b`, `-c`.
110
+ - **Text** is only `a` or `b`: `f--color-a`, `f--color-b`. Never color text.
111
+ - **Accents** (`d` to `i`) are outlines and dots, not fills: `u--border-d` … `u--border-i`.
112
+ - **Shape.** Everything you click or tag is a capsule (`f--radius-full`); cards use `f--radius-c` with a 1px border and no shadow.
113
+
114
+ The package still ships a few default values that differ slightly from the brand (`b`, `e`, `f`, `g`, `h`, `i`). Until they are updated, set the brand palette in a `terra.config.js` (next section):
115
+
116
+ ```js
117
+ colors: {
118
+ a: '#0f0f0f', b: '#ffffff', c: '#f7f8f4',
119
+ d: '#7ce55e', e: '#189b5c', f: '#3d9dd8', g: '#ffb41d', h: '#f96e43', i: '#f78bd8',
120
+ },
121
+ ```
122
+
123
+ ## States and motion
124
+
125
+ State lives in the class name, with no colons. Hover only applies on devices that can hover, and states have no breakpoint variants.
126
+
127
+ ```html
128
+ <button class="u--transition-colors u--duration-a u--hover-background-a u--hover-color-b u--focus-ring u--active-scale-95 u--disabled-opacity-50 f--radius-full u--border-a u--px-3 u--py-1">
129
+ save
130
+ </button>
131
+ ```
51
132
 
52
- All classes are listed in the [class reference](docs/CLASSES.md).
133
+ | What | Classes |
134
+ |---|---|
135
+ | Hover | `u--hover-background-*`, `u--hover-color-*`, `u--hover-border-*` |
136
+ | Group | `u--group` on the parent, `u--group-hover-*` on its children |
137
+ | Focus, press, disabled | `u--focus-ring`, `u--active-scale-90\|95\|98`, `u--disabled-opacity-25\|50\|75` |
138
+ | Transitions | `u--transition-all\|colors\|opacity\|transform`, `u--duration-a\|b\|c` (0.1s, 0.3s, 0.6s), `u--ease-standard\|entrance\|exit-a\|b` |
139
+ | Animations | `u--animation-fade-in`, `fade-up`, `scale-in`, `slide-left`, `shake`, `shimmer`, `spin`, `pulse` (all respect `prefers-reduced-motion`) |
53
140
 
54
141
  ## Configure your own build
55
142
 
@@ -64,7 +151,7 @@ npx terra-ds build
64
151
  ```js
65
152
  // terra.config.js
66
153
  export default {
67
- colors: { a: '#0f0f0f', b: '#fefefe', j: '#ff00aa' }, // replaces the palette; "a" and "b" are required
154
+ colors: { a: '#0f0f0f', b: '#ffffff', j: '#ff00aa' }, // replaces the palette; "a" and "b" are required
68
155
  backgrounds: ['a', 'b', 'j'], // which colors get f--background-*
69
156
  spacing: [0, 1, 2, 4, 8], // replaces the u--p-*, u--m-*, u--gap-* steps (x 8px)
70
157
  font: "'Uncut Sans', system-ui, sans-serif", // font-family of f--font-*
@@ -73,23 +160,17 @@ export default {
73
160
  }
74
161
  ```
75
162
 
76
- Every key is optional. "Replaces" means what you don't list is not generated, which also makes the file smaller (about 77 kB with five spacing steps, against 108 kB by default). Breakpoints, grid and shadows are not configurable yet.
163
+ Every key is optional. "Replaces" means what you don't list is not generated, which also makes the file smaller (about 80 kB with this config, against 113 kB by default). Breakpoints, grid and shadows are not configurable yet.
77
164
 
78
- ## What's new in 0.2.0
165
+ ## What's new
79
166
 
80
- - **States:** `u--hover-background-*`, `u--hover-color-*`, `u--hover-border-*`, `u--focus-ring`, `u--active-scale-90|95|98`, `u--disabled-opacity-25|50|75`, and `u--group` with `u--group-hover-*` for children of a hovered parent. Hover only applies on devices that can hover. States have no breakpoint variants.
81
- - **Motion:** `u--transition-all|colors|opacity|transform`, `u--duration-a|b|c` (0.1s, 0.3s, 0.6s), `u--ease-standard|entrance|exit-a|b`, and the animations `u--animation-fade-in`, `fade-up`, `spin` and `pulse`, which respect `prefers-reduced-motion`.
82
- - Everything is additive: every 0.1.0 rule is unchanged.
167
+ **0.3.0** adds components (`c--btn-*`, `c--card-wrapper-*`, `c--tag-a`, `c--icon-a`, `c--terraform-a`, `c--terraform-trio-a`), the extra files `icons.css` and `terraforms.css`, `u--order-last`, `u--order-none` and `u--order-2` to `-12`, `u--text-decoration-*`, and the animations `scale-in`, `slide-left`, `shake` and `shimmer`. Everything is additive: every 0.2.1 rule is unchanged. The default CSS grows from 113 kB to 123 kB (15 kB gzipped).
83
168
 
84
- ## What's new in 0.1.0
169
+ **0.2.0** adds states (`u--hover-*`, `u--focus-ring`, `u--active-scale-*`, `u--disabled-opacity-*`, `u--group-hover-*`) and motion (`u--transition-*`, `u--duration-*`, `u--ease-*`, `u--animation-*`). Everything is additive: every 0.1.0 rule is unchanged.
85
170
 
86
- - **`terra-ds build`** and `terra.config.js` to configure palette, spacing, radius and font.
87
- - **New foundation classes:** `f--radius-*`, `f--shadow-*`.
88
- - **New utilities:** `u--border-*`, `u--px/py/mx/my`, `u--gap`, `u--row-gap`, `u--col-gap`, `u--mx-auto`, and spacing steps 6, 9 and 12.
89
- - **Changed default:** `f--font-*` now uses Uncut Sans (with `system-ui` as fallback) instead of Arial. Every other existing class is unchanged.
171
+ **0.1.0** added `terra-ds build` and `terra.config.js`, the `f--radius-*` and `f--shadow-*` foundations, `u--border-*`, `u--px/py/mx/my`, `u--gap`, `u--row-gap`, `u--col-gap`, `u--mx-auto`, and spacing steps 6, 9 and 12. The default `f--font-*` typeface changed from Arial to Uncut Sans.
90
172
 
91
173
  ## More
92
174
 
93
- - [Class reference](docs/CLASSES.md)
94
- - [How Terra works](TERRA.md): colors, type, shape, motion and voice
95
- - [Contributing](CONTRIBUTING.md)
175
+ - [Class reference](https://github.com/terra-hq/design-system/blob/HEAD/docs/CLASSES.md)
176
+ - [Contributing](https://github.com/terra-hq/design-system/blob/HEAD/CONTRIBUTING.md)
@@ -1 +1 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e["terra-design-system"]=n())})(this,function(){"use strict";return""});
1
+ (function(n){typeof define=="function"&&define.amd?define(n):n()})((function(){"use strict"}));
package/dist/icons.css ADDED
@@ -0,0 +1,13 @@
1
+ .c--icon-a--arrow-left{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M19%2012H5M11%206l-6%206%206%206%22%2F%3E%3C%2Fsvg%3E")}
2
+ .c--icon-a--arrow-right{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2012h14M13%206l6%206-6%206%22%2F%3E%3C%2Fsvg%3E")}
3
+ .c--icon-a--check{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2012.5l4.5%204.5L19%207%22%2F%3E%3C%2Fsvg%3E")}
4
+ .c--icon-a--chevron-down{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E")}
5
+ .c--icon-a--close{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%206l12%2012M18%206L6%2018%22%2F%3E%3C%2Fsvg%3E")}
6
+ .c--icon-a--copy{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%229%22%20y%3D%229%22%20width%3D%2210%22%20height%3D%2210%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M5%2015V6a1%201%200%200%201%201-1h9%22%2F%3E%3C%2Fsvg%3E")}
7
+ .c--icon-a--download{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%204v11M7%2011l5%205%205-5M5%2020h14%22%2F%3E%3C%2Fsvg%3E")}
8
+ .c--icon-a--external{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%205h5v5M19%205l-8%208M18%2014v4a1%201%200%200%201-1%201H6a1%201%200%200%201-1-1V7a1%201%200%200%201%201-1h4%22%2F%3E%3C%2Fsvg%3E")}
9
+ .c--icon-a--info{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22M12%2011v5M12%208h.01%22%2F%3E%3C%2Fsvg%3E")}
10
+ .c--icon-a--mail{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2214%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M3%207l9%206%209-6%22%2F%3E%3C%2Fsvg%3E")}
11
+ .c--icon-a--menu{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h16M4%2012h16M4%2017h16%22%2F%3E%3C%2Fsvg%3E")}
12
+ .c--icon-a--plus{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M12%205v14M5%2012h14%22%2F%3E%3C%2Fsvg%3E")}
13
+ .c--icon-a--search{--c-icon:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%226%22%2F%3E%3Cpath%20d%3D%22M16%2016l4%204%22%2F%3E%3C%2Fsvg%3E")}