@graphprotocol/gds-css 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/gds-css",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Tailwind preset and design tokens for The Graph Design System",
5
5
  "author": "Edge & Node and contributors",
6
6
  "license": "MIT",
@@ -35,11 +35,11 @@
35
35
  "cssesc": "^3.0.0",
36
36
  "ts-extras": "^0.16.0",
37
37
  "@graphprotocol/gds-utils": "0.1.0",
38
- "@graphprotocol/tailwindcss-animate": "0.1.0"
38
+ "@graphprotocol/tailwindcss-animate": "0.1.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/cssesc": "^3.0.2",
42
- "@types/node": "^24.10.2"
42
+ "@types/node": "^24.10.4"
43
43
  },
44
44
  "scripts": {
45
45
  "generate:design-tokens": "tsx scripts/generate-design-tokens.ts",
package/styles/global.css CHANGED
@@ -58,21 +58,22 @@
58
58
  * Better defaults for outlines.
59
59
  * - `outline-0` makes them work like borders, which are reset similarly in Preflight
60
60
  * (https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/preflight.css#L15)
61
- * - `outline-offset-1` and `outline-(--border-color-focus)` are in case a `transition` is used on an element with a focus indicator.
62
- * Because `transition` includes `outline-color`, only applying `outline-(--border-color-focus)` on focus-visible would result in
63
- * an unexpected color transition (from `auto` to `focus`) when the indicator appears. And if a consumer actually wants to transition
64
- * the focus indicator's color (with e.g. `outline transition not-focus-visible:outline-transparent`), only applying `outline-offset-1`
65
- * on `:focus-visible` would make the outline "jump" when it appears or disappears, since the default offset is 0.
61
+ * - `outline-offset-1` and `outline-focus` are in case a `transition` is used on an element with a focus indicator.
62
+ * Because `transition` includes `outline-color`, only applying `outline-focus` on `:focus-visible` would result in
63
+ * an unexpected color transition (from `auto` to `focus`) when the indicator appears. And if a consumer actually
64
+ * wants to transition the focus indicator's color (e.g. `outline transition not-focus-visible:outline-transparent`),
65
+ * only applying `outline-offset-1` on `:focus-visible` would make the outline "jump" when it appears or disappears,
66
+ * since the default offset is 0.
66
67
  */
67
- @apply outline-0 outline-offset-1 outline-(--border-color-focus);
68
+ @apply outline-0 outline-offset-1 outline-focus;
68
69
  /**
69
70
  * Default focus indicator.
70
- * Technically, we shouldn't have to repeat the `outline-offset-1 outline-(--border-color-focus)` from above, but Firefox has a bug
71
- * where resetting the `outline-style` and/or `outline-width` (maybe just when done in a state like `:focus-visible`) also resets
72
- * the `outline-color`, so better be safe than sorry. TODO: Investigate more and report the bug.
71
+ * Technically, we shouldn't have to repeat the `outline-offset-1 outline-focus` from above, but Firefox has a bug
72
+ * where resetting the `outline-style` and/or `outline-width` (maybe just when done in a state like `:focus-visible`)
73
+ * also resets the `outline-color`, so better be safe than sorry. TODO: Investigate and report the bug.
73
74
  */
74
75
  &:focus-visible {
75
- @apply outline outline-offset-1 outline-(--border-color-focus);
76
+ @apply outline outline-offset-1 outline-focus;
76
77
  }
77
78
  /* Prevent accidental animations (e.g. `text-20 sm:text-24 duration-200`) */
78
79
  @apply transition-none;
@@ -201,3 +202,19 @@
201
202
  inherits: false;
202
203
  initial-value: 0;
203
204
  }
205
+
206
+ /**
207
+ * Restrict the transition of particular properties (e.g. `width`) to specific state changes, e.g. when toggling between
208
+ * idle and hover, but not when a prop changes. See how it's used in the `Search` component, and the CSS proposal that
209
+ * would make this hacky workaround obsolete: https://github.com/w3c/csswg-drafts/issues/13224.
210
+ */
211
+ @keyframes width-1 {
212
+ 100% {
213
+ width: revert-layer;
214
+ }
215
+ }
216
+ @keyframes width-2 {
217
+ 100% {
218
+ width: revert-layer;
219
+ }
220
+ }
package/styles/theme.css CHANGED
@@ -167,6 +167,8 @@
167
167
 
168
168
  /* Border colors */
169
169
  --border-color-focus: var(--color-brand-500);
170
+ --outline-color-focus: var(--color-brand-500);
171
+
170
172
  --border-color-subtle: light-dark(var(--color-foam-300), var(--color-space-1500));
171
173
  --border-color-muted: light-dark(var(--color-foam-400), var(--color-space-1400));
172
174
  --border-color-default: light-dark(var(--color-foam-500), var(--color-space-1300));