@grucloud/bau-ui 0.301.0 → 0.302.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.
Files changed (58) hide show
  1. package/accordion/accordion.js +36 -63
  2. package/alert/alert.js +14 -24
  3. package/alertStack/README.md +89 -0
  4. package/alertStack/alertStack.js +98 -28
  5. package/animate/animate.js +2 -0
  6. package/autocomplete/autocomplete.js +130 -164
  7. package/avatar/avatar.js +20 -25
  8. package/breadcrumbs/breadcrumbs.js +34 -30
  9. package/button/button.js +27 -41
  10. package/buttonGroup/buttonGroup.js +20 -27
  11. package/calendar/calendar.js +6 -12
  12. package/carousel/carousel.js +64 -47
  13. package/checkbox/checkbox.js +10 -13
  14. package/chip/chip.js +9 -0
  15. package/collapsible/collapsible.js +73 -47
  16. package/collapsible/index.d.ts +12 -1
  17. package/constants.d.ts +1 -0
  18. package/constants.js +4 -0
  19. package/divider/divider.js +1 -0
  20. package/drawer/drawer.js +48 -1
  21. package/drillDownMenu/drillDownMenu.js +90 -67
  22. package/dropdownMenu/dropdownMenu.js +29 -122
  23. package/fileInput/fileInput.js +4 -0
  24. package/globalStyle/globalStyle.js +75 -30
  25. package/input/input.js +35 -44
  26. package/inputSearch/inputSearch.js +26 -31
  27. package/lazy/lazy.js +8 -5
  28. package/linearProgress/linearProgress.js +12 -24
  29. package/list/list.js +2 -1
  30. package/loadingButton/loadingButton.js +29 -22
  31. package/modal/modal.js +38 -41
  32. package/multiSelect/multiSelect.js +84 -171
  33. package/package.json +13 -5
  34. package/paginationNavigation/paginationNavigation.js +8 -13
  35. package/popover/popover.js +5 -2
  36. package/radioButton/radioButton.js +10 -23
  37. package/radioButtonGroup/radioButtonGroup.js +15 -24
  38. package/resizable/resizable.js +74 -70
  39. package/select/select.js +84 -160
  40. package/selectNative/selectNative.js +2 -0
  41. package/slider/slider.js +6 -12
  42. package/spinner/spinner.js +37 -53
  43. package/stepper/stepper.js +23 -35
  44. package/switch/switch.js +28 -45
  45. package/tableOfContent/tableOfContent.js +55 -84
  46. package/tablePagination/tablePagination.js +39 -69
  47. package/tabs/tabs.js +95 -59
  48. package/textareaAutosize/textareaAutosize.js +13 -16
  49. package/themeSwitch/themeSwitch.js +27 -41
  50. package/toggle/index.d.ts +8 -1
  51. package/toggle/toggle.js +17 -9
  52. package/toggleGroup/toggleGroup.js +23 -28
  53. package/tooltip/tooltip.js +79 -94
  54. package/treeView/treeView.js +57 -25
  55. package/utils/control.js +20 -0
  56. package/utils/popupList.js +137 -0
  57. package/utils/urlChange.js +32 -0
  58. package/vite.config.js +48 -0
@@ -29,43 +29,18 @@ const findSubTree = (initialPathname) => (tree) => {
29
29
  if (!tree.children) {
30
30
  return;
31
31
  }
32
- for (let index = 0; index < tree.children.length; index++) {
33
- const result = findSubTree(initialPathname)(tree.children[index]);
32
+ for (const child of tree.children) {
33
+ const result = findSubTree(initialPathname)(child);
34
34
  if (result) {
35
35
  return result;
36
36
  }
37
37
  }
38
38
  };
39
39
 
40
- const createStyles = ({ keyframes }) => {
41
- return {
42
- hideToLeft: keyframes`
43
- from {
44
- transform: translateX(0%);
45
- opacity: 1;
46
- }
47
- to {
48
- transform: translateX(-100%);
49
- opacity: 0;
50
- }
51
- `,
52
- hideToRight: keyframes`
53
- from {
54
- transform: translateX(0%);
55
- opacity: 1;
56
- }
57
- to {
58
- transform: translateX(100%);
59
- opacity: 0;
60
- }
61
- `,
62
- };
63
- };
64
-
65
40
  export default function (context, options = {}) {
66
- const { bau, css, window, config } = context;
41
+ const { bau, css, keyframes, window, config } = context;
67
42
  const { base = "", hashBased = false } = options;
68
- const baseUrl = `${config.base}${base}`;
43
+ const baseUrl = `${config?.base ?? ""}${base}`;
69
44
  const backHref = (currentTree) =>
70
45
  currentTree.parentTree.data?.href ??
71
46
  currentTree.parentTree.children[0].data.href;
@@ -82,6 +57,7 @@ export default function (context, options = {}) {
82
57
  flex-grow: 0;
83
58
  `,
84
59
  "data-buttonback": true,
60
+ "aria-label": "Back",
85
61
  },
86
62
  "\u2190"
87
63
  ),
@@ -106,12 +82,14 @@ export default function (context, options = {}) {
106
82
  data: { name, href },
107
83
  children = [],
108
84
  },
85
+ isCurrent,
109
86
  }) =>
110
87
  Button(
111
88
  {
112
89
  size,
113
90
  href: `${baseUrl}${href}`,
114
91
  "data-ischild": !children.length,
92
+ "aria-current": () => (isCurrent() ? "page" : "false"),
115
93
  },
116
94
  name
117
95
  );
@@ -136,7 +114,38 @@ export default function (context, options = {}) {
136
114
  }
137
115
  `,
138
116
  });
139
- const { hideToLeft, hideToRight } = createStyles(context);
117
+ const hideToLeft = keyframes`
118
+ from {
119
+ transform: translateX(0%);
120
+ opacity: 1;
121
+ }
122
+ to {
123
+ transform: translateX(-100%);
124
+ opacity: 0;
125
+ }
126
+ `;
127
+ const hideToRight = keyframes`
128
+ from {
129
+ transform: translateX(0%);
130
+ opacity: 1;
131
+ }
132
+ to {
133
+ transform: translateX(100%);
134
+ opacity: 0;
135
+ }
136
+ `;
137
+ // By direction, 1 to a child, -1 back: the menu that hides, the one that
138
+ // shows. None for 0, a leaf.
139
+ const animations = {
140
+ 1: [
141
+ `${hideToLeft} ${animationDuration}`,
142
+ `${hideToRight} ${animationDuration} reverse`,
143
+ ],
144
+ [-1]: [
145
+ `${hideToRight} ${animationDuration}`,
146
+ `${hideToLeft} ${animationDuration} reverse`,
147
+ ],
148
+ };
140
149
 
141
150
  const className = css`
142
151
  font-weight: var(--font-weight-semibold);
@@ -182,17 +191,20 @@ export default function (context, options = {}) {
182
191
  }) =>
183
192
  List(
184
193
  { class: [variant, color, size] },
185
- children.map((subTree) =>
186
- li(
194
+ children.map((subTree) => {
195
+ // The page shown
196
+ const isCurrent = () =>
197
+ isActive({ pathname: pathnameState.val, subTree });
198
+ return li(
187
199
  {
188
200
  class: () => [
189
201
  subTree.children && "has-children",
190
- isActive({ pathname: pathnameState.val, subTree }) && "active",
202
+ isCurrent() && "active",
191
203
  ],
192
204
  },
193
- renderMenuItem({ variant, color, size, subTree })
194
- )
195
- )
205
+ renderMenuItem({ variant, color, size, subTree, isCurrent })
206
+ );
207
+ })
196
208
  );
197
209
 
198
210
  const Menu = ({ variant, color, size, currentTree, pathnameState }) => {
@@ -255,9 +267,10 @@ export default function (context, options = {}) {
255
267
  const nodeNameState = bau.state(JSON.stringify(_currentTree.data));
256
268
 
257
269
  let _direction;
258
- window.document.addEventListener("click", (event) => {
270
+ // A link of the menu, or of the page, shows the menu of its page
271
+ const onclickDocument = (navEl) => (event) => {
259
272
  const { target } = event;
260
- const anchor = target.closest("a");
273
+ const anchor = target.closest?.("a");
261
274
  if (!anchor) return;
262
275
  const href = anchor.getAttribute("href");
263
276
  if (
@@ -266,50 +279,54 @@ export default function (context, options = {}) {
266
279
  !href.startsWith("#") &&
267
280
  !href.startsWith("?")
268
281
  ) {
282
+ const previousTree = _currentTree;
283
+ const previousNodeName = nodeNameState.val;
269
284
  _currentTree = findInitialTree({
270
285
  tree,
271
286
  pathname: pathFromHref(event),
272
287
  });
273
288
  nodeNameState.val = JSON.stringify(_currentTree.data);
274
289
  pathnameState.val = pathFromHref({ target });
290
+ // Another menu is shown
291
+ if (
292
+ nodeNameState.val != previousNodeName &&
293
+ navEl.contains(window.document.activeElement)
294
+ ) {
295
+ focusAfterRender({ navEl, previousTree });
296
+ }
275
297
  }
276
- });
298
+ };
299
+
300
+ // The link that had the focus is gone with its menu: the focus goes to
301
+ // the item left when going back, else to the first item
302
+ const focusAfterRender = ({ navEl, previousTree }) =>
303
+ window.requestAnimationFrame(() => {
304
+ const menuEl = navEl.querySelector(".drillDownMenu:not([cloned])");
305
+ const links = [...menuEl.querySelectorAll("li a[href]")];
306
+ const previousHref = `${baseUrl}${previousTree.data?.href}`;
307
+ const linkEl =
308
+ (_direction == -1 &&
309
+ links.find((link) => link.getAttribute("href") == previousHref)) ||
310
+ links[0] ||
311
+ menuEl.querySelector("a[href]");
312
+ linkEl?.focus();
313
+ });
277
314
 
315
+ let documentListener;
316
+ // The direction of the link clicked: back, to a child, or a leaf
278
317
  const onclick = (event) => {
279
318
  const { buttonback, ischild } = event.target.dataset;
280
319
  if (buttonback == "true") {
281
320
  _direction = -1;
282
- } else if (ischild == "false") {
283
- _direction = 1;
284
- } else if (ischild == "true") {
285
- _direction = 0;
286
- }
287
- };
288
-
289
- const animationHide = (direction) => {
290
- switch (direction) {
291
- case 1:
292
- return `${hideToLeft} ${animationDuration}`;
293
- case -1:
294
- return `${hideToRight} ${animationDuration}`;
295
- default:
296
- return "";
297
- }
298
- };
299
-
300
- const animationShow = (direction) => {
301
- switch (direction) {
302
- case 1:
303
- return `${hideToRight} ${animationDuration} reverse`;
304
- case -1:
305
- return `${hideToLeft} ${animationDuration} reverse`;
306
- default:
307
- return "";
321
+ } else if (ischild != undefined) {
322
+ _direction = ischild == "true" ? 0 : 1;
308
323
  }
309
324
  };
310
325
 
311
326
  return nav(
312
327
  {
328
+ "aria-label": "Menu",
329
+ ...otherProps,
313
330
  class: [
314
331
  className,
315
332
  variant,
@@ -319,11 +336,17 @@ export default function (context, options = {}) {
319
336
  otherProps.class,
320
337
  ],
321
338
  onclick,
339
+ bauMounted: ({ element }) => {
340
+ documentListener = onclickDocument(element);
341
+ window.document.addEventListener("click", documentListener);
342
+ },
343
+ bauUnmounted: () =>
344
+ window.document.removeEventListener("click", documentListener),
322
345
  },
323
346
  Animate(
324
347
  {
325
- animationHide: () => animationHide(_direction),
326
- animationShow: () => animationShow(_direction),
348
+ animationHide: () => animations[_direction]?.[0] ?? "",
349
+ animationShow: () => animations[_direction]?.[1] ?? "",
327
350
  },
328
351
  bau.bind({
329
352
  deps: [nodeNameState],
@@ -1,124 +1,32 @@
1
- import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
- import popover from "../popover/popover.js";
3
- import button from "../button/button.js";
4
- import list from "../list/list.js";
5
-
6
- import { Colors } from "../constants.js";
7
-
8
- const colorsToCss = () =>
9
- Colors.map(
10
- (color) =>
11
- `
12
- `
13
- ).join("\n");
1
+ import popupList from "../utils/popupList.js";
14
2
 
15
3
  export default function (context, componentOptions = {}) {
16
- const { bau, css } = context;
17
- const { div, li } = bau.tags;
18
- const Button = button(context);
19
- const Popover = popover(context);
20
- const List = list(context);
21
-
22
- const className = css`
23
- ${colorsToCss()}
24
- `;
25
-
26
- return function DropdownMenu(...args) {
27
- let [
28
- {
29
- size = componentOptions.size ?? "md",
30
- variant = componentOptions.variant ?? "outline",
31
- color = componentOptions.color ?? "neutral",
32
- label,
33
- ListItem,
34
- items,
35
- ...props
36
- },
37
- children,
38
- ] = toPropsAndChildren(args);
39
-
40
- const itemIndexActive = bau.state(0);
41
-
42
- const dialogOpen = () => {
43
- popoverEl.openDialog();
44
- popoverEl.focus();
45
- };
46
-
47
- const dialogClose = () => {
48
- popoverEl.closeDialog();
49
- };
50
-
51
- const toggleDialog = () => {
52
- popoverEl.open ? dialogClose() : dialogOpen();
53
- };
54
-
55
- const onclickButton = (event) => {
56
- toggleDialog();
57
- event.preventDefault();
58
- };
59
-
60
- const onclickItem =
61
- ({ item, index }) =>
62
- (event) => {
63
- itemIndexActive.val = index;
64
- dialogClose();
65
- event.preventDefault();
66
- };
67
-
68
- const onkeydown = (event) => {
69
- event.preventDefault();
70
- switch (event.key) {
71
- case "Escape":
72
- dialogClose();
73
- break;
74
- case "ArrowDown":
75
- if (itemIndexActive.val < options.length - 1) {
76
- itemIndexActive.val++;
77
- } else {
78
- itemIndexActive.val = 0;
79
- }
80
- break;
81
- case "ArrowUp":
82
- if (itemIndexActive.val <= 0) {
83
- itemIndexActive.val = options.length - 1;
84
- } else {
85
- itemIndexActive.val--;
86
- }
87
- break;
88
- case "Enter":
89
- toggleDialog();
90
- break;
91
- }
92
- };
93
-
94
- const Content = () =>
95
- List(
96
- { tabindex: "0", class: [color, variant] },
97
- items.map((item, index) =>
98
- li(
99
- {
100
- class: () => [itemIndexActive.val == index && "active"],
101
- onclick: onclickItem({ item, index }),
102
- },
103
- ListItem(item)
104
- )
105
- )
106
- );
107
-
108
- const buttonEl = Button(
109
- {
110
- type: "button",
111
- onclick: onclickButton,
112
- color,
113
- variant,
114
- size,
115
- },
116
- label
117
- );
118
-
119
- const popoverEl = Popover({
120
- triggerEl: buttonEl,
121
- contentEl: Content(),
4
+ const { bau } = context;
5
+ const { div } = bau.tags;
6
+ const PopupList = popupList(context);
7
+
8
+ return function DropdownMenu({
9
+ size = componentOptions.size ?? "md",
10
+ variant = componentOptions.variant ?? "outline",
11
+ color = componentOptions.color ?? "neutral",
12
+ label,
13
+ ListItem,
14
+ items,
15
+ ...props
16
+ }) {
17
+ const { buttonEl, popoverEl, onkeydown, close } = PopupList({
18
+ role: "menu",
19
+ label,
20
+ items,
21
+ Item: ListItem,
22
+ itemProps: () => ({ role: "menuitem" }),
23
+ // The item runs, the menu closes
24
+ onClickItem: () => close(),
25
+ activeOnOpen: () => 0,
26
+ buttonChildren: label,
27
+ color,
28
+ variant,
29
+ size,
122
30
  });
123
31
 
124
32
  return div(
@@ -128,9 +36,8 @@ export default function (context, componentOptions = {}) {
128
36
  "dropdownMenu",
129
37
  color,
130
38
  size,
131
- className,
132
- componentOptions?.class,
133
- props?.class,
39
+ componentOptions.class,
40
+ props.class,
134
41
  ],
135
42
  onkeydown,
136
43
  },
@@ -28,6 +28,10 @@ export default function (context, options = {}) {
28
28
  filter: brightness(var(--brightness-hover));
29
29
  }
30
30
  }
31
+ & label:has(input:focus-visible) {
32
+ outline: 2px solid var(--color-primary);
33
+ outline-offset: 2px;
34
+ }
31
35
  `,
32
36
  disabled: css`
33
37
  & label {
@@ -1,11 +1,12 @@
1
+ // Zinc grays, a near-black ink, calm colors deep enough for a white text
1
2
  const ColorPaletteDefault = [
2
- ["neutral", { h: "0", s: "0%", l: "10%" }],
3
- ["primary", { h: "230", s: "70%", l: "30%" }],
4
- ["secondary", { h: "338", s: "70%", l: "50%" }],
5
- ["success", { h: "120", s: "70%", l: "25%" }],
6
- ["info", { h: "194", s: "70%", l: "30%" }],
7
- ["warning", { h: "43", s: "70%", l: "25%" }],
8
- ["danger", { h: "358", s: "70%", l: "30%" }],
3
+ ["neutral", { h: "240", s: "6%", l: "10%" }],
4
+ ["primary", { h: "221", s: "83%", l: "53%" }],
5
+ ["secondary", { h: "262", s: "83%", l: "58%" }],
6
+ ["success", { h: "142", s: "72%", l: "29%" }],
7
+ ["info", { h: "201", s: "96%", l: "32%" }],
8
+ ["warning", { h: "26", s: "90%", l: "37%" }],
9
+ ["danger", { h: "0", s: "72%", l: "51%" }],
9
10
  ];
10
11
 
11
12
  const SHADES_LIGHT = [
@@ -27,7 +28,7 @@ const variantToCss = () =>
27
28
  ([color]) =>
28
29
  `
29
30
  .outline.${color} {
30
- border: 1px solid var(--color-emphasis-600);
31
+ border: 1px solid var(--color-border);
31
32
  color: var(--font-color-base)
32
33
  }
33
34
  .soft.${color} {
@@ -39,9 +40,31 @@ const variantToCss = () =>
39
40
  `
40
41
  ).join("\n");
41
42
 
43
+ // The color of an element, from its class: --accent and its shades
44
+ const accentToCss = (colorPalette) =>
45
+ colorPalette
46
+ .map(
47
+ ([color]) =>
48
+ `
49
+ .${color} {
50
+ --accent: var(--color-${color});
51
+ --accent-text: var(--color-${color}-text);
52
+ /* The edge of a field: gray for neutral, else the color */
53
+ --accent-border: ${
54
+ color == "neutral" ? "var(--color-border)" : `var(--color-${color}-text)`
55
+ };
56
+ --accent-light: var(--color-${color}-light);
57
+ --accent-lightest: var(--color-${color}-lightest);
58
+ }
59
+ `
60
+ )
61
+ .join("\n");
62
+
42
63
  const darkColors = () =>
43
- ColorPaletteDefault.map(([color]) => [
64
+ ColorPaletteDefault.flatMap(([color]) => [
44
65
  `--color-${color}-s: var(--color-${color}-dark-s);`,
66
+ // Light enough to be read on the dark background
67
+ `--color-${color}-text: hsl(var(--color-${color}-h), var(--color-${color}-s), 70%);`,
45
68
  ]).join("\n");
46
69
 
47
70
  const indexToColor = (index) => {
@@ -53,7 +76,7 @@ const buildGrays = () =>
53
76
  .fill("")
54
77
  .map(
55
78
  (v, index) =>
56
- `--color-gray-${index * 100}: hsl(0, 0%, ${indexToColor(index)}%);`
79
+ `--color-gray-${index * 100}: hsl(240, 5%, ${indexToColor(index)}%);`
57
80
  )
58
81
  .join("\n");
59
82
 
@@ -73,6 +96,8 @@ const buildColor = ([color, { h, s, l }]) =>
73
96
  `--color-${color}-h: ${h};`,
74
97
  `--color-${color}-l: ${l};`,
75
98
  `--color-${color}-base-s: ${s};`,
99
+ // A text of the color, on the background
100
+ `--color-${color}-text: var(--color-${color});`,
76
101
  `--color-${color}-s: var(--color-${color}-base-s);`,
77
102
  `--color-${color}-dark-s: calc(${s} - 25%);`,
78
103
  `--color-${color}-hsl: var(--color-${color}-h), var(--color-${color}-s), var(--color-${color}-l);`,
@@ -111,19 +136,27 @@ export default function globalStyle(
111
136
  ${buildGrays()}
112
137
  ${buildEmphasis({})}
113
138
  ${variantToCss()}
114
- --color-content: hsl(0, 0%, 10%);
115
- --color-content-inverse: hsl(0, 0%, 95%);
116
- --color-content-secondary: hsl(0, 0%, 40%);
139
+ ${accentToCss(colorPalette)}
140
+ --color-content: hsl(240, 10%, 4%);
141
+ --color-content-inverse: hsl(0, 0%, 98%);
142
+ --color-content-secondary: hsl(240, 4%, 46%);
143
+ /* The edge of the fields, 3:1 at least on the background */
144
+ --color-border: hsl(240, 5%, 58%);
145
+ /* The edge of a card or a button, its text tells it */
146
+ --color-border-subtle: hsl(240, 6%, 90%);
147
+ --color-hover: hsl(240, 5%, 96%);
148
+ --color-focus: var(--color-content);
117
149
  --background-color: var(--color-white);
118
150
  --global-border-width: 1px;
119
- --global-radius: 0.2rem;
151
+ --global-radius: 0.375rem;
120
152
  --font-color: var(--color-content);
121
153
  --font-color-base: var(--color-content);
122
154
  --font-color-disabled: var(--color-emphasis-600);
123
155
  --font-color-inverse: var(--color-content-inverse);
124
156
  --font-color-secondary: var(--color-content-secondary);
125
- --font-color-inverse-secondary: hsl(0, 0%, 75%);
126
- --font-family: system-ui, -apple-system, Helvetica, Arial, sans-serif;
157
+ --font-color-inverse-secondary: hsl(0, 0%, 85%);
158
+ --font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
159
+ "Helvetica Neue", Arial, sans-serif;
127
160
  --font-family-monospace: Consolas, monospace;
128
161
  --font-weight-light: 300;
129
162
  --font-weight-normal: 400;
@@ -134,17 +167,17 @@ export default function globalStyle(
134
167
  --spacing-horizontal: var(--global-spacing);
135
168
  --transition-fast: 200ms;
136
169
  --transition-slow: 400ms;
137
- --shadow-s: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
138
- --shadow-m: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
139
- 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
140
- --shadow-lg: 0 2px 4px -1px rgba(0, 0, 0, 0.2),
141
- 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
170
+ /* Barely there */
171
+ --shadow-s: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
172
+ --shadow-m: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
173
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
174
+ 0 4px 6px -4px rgba(0, 0, 0, 0.1);
142
175
  --font-size-base: 100%;
143
176
  --line-height-base: 1.65;
144
177
  --link-color: var(--color-primary);
145
- --brightness-hover-always: 120%;
146
- --brightness-active-always: 130%;
147
- --brightness-hover: 80%;
178
+ --brightness-hover-always: 110%;
179
+ --brightness-active-always: 120%;
180
+ --brightness-hover: 95%;
148
181
  --brightness-hover-reverse: 140%;
149
182
  --brightness-active: 90%;
150
183
  .plain {
@@ -173,20 +206,32 @@ export default function globalStyle(
173
206
  font: var(--font-size-base) / var(--line-height-base) var(--font-family);
174
207
  background-color: var(--background-color);
175
208
  }
209
+ /* One focus ring for the keyboard, around the element */
210
+ :focus-visible {
211
+ outline: 2px solid var(--color-focus);
212
+ outline-offset: 2px;
213
+ }
176
214
  html:has(dialog[open]) {
177
215
  overflow: hidden;
178
216
  }
179
217
  html[data-theme="dark"] {
180
218
  ${darkColors()}
181
219
  --color-scheme: dark;
182
- --background-color: #121212;
220
+ --background-color: hsl(240, 10%, 4%);
221
+ --color-border: hsl(240, 5%, 42%);
222
+ --color-border-subtle: hsl(240, 4%, 18%);
223
+ --color-hover: hsl(240, 4%, 14%);
224
+ /* A neutral fill seen on the dark background */
225
+ --color-neutral-l: 26%;
226
+ /* The primary color, light enough to be read on the dark background */
227
+ --link-color: hsl(var(--color-primary-h), var(--color-primary-s), 70%);
183
228
  --hover-overlay: rgba(255, 255, 255, 0.05);
184
- --color-content: #e3e3e3;
185
- --color-content-secondary: rgba(255, 255, 255, 0.5);
186
- --brightness-hover-always: 130%;
229
+ --color-content: hsl(0, 0%, 98%);
230
+ --color-content-secondary: hsl(240, 5%, 65%);
231
+ --brightness-hover-always: 115%;
187
232
  --brightness-active-always: 120%;
188
- --brightness-active: 180%;
189
- --brightness-hover: 150%;
233
+ --brightness-active: 140%;
234
+ --brightness-hover: 125%;
190
235
  --brightness-hover-reverse: 70% ${buildEmphasis({ dark: true })};
191
236
  }
192
237
  `;