hlmnhkl-ui 0.22.0 → 0.23.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
@@ -66,7 +66,7 @@ Every copied file starts with one line naming hlmnhkl/ui and the MIT licence, so
66
66
 
67
67
  ## Pro
68
68
 
69
- 54 more components (such as Calendar, Chart, KanbanBoard, Combobox and Route), page blocks, full templates and brand themes are coming as hlmnhkl/ui Pro. You can see them on the [docs site](https://ui.hlmnhkl.my).
69
+ 71 more components (such as DataGrid, Calendar, Chart, KanbanBoard and Combobox), page blocks, full templates and brand themes are coming as hlmnhkl/ui Pro. You can see them on the [docs site](https://ui.hlmnhkl.my).
70
70
 
71
71
  ## Licence
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hlmnhkl-ui",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "React components in a monochrome style. Copy them into your app with npx hlmnhkl-ui add <name>.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://ui.hlmnhkl.my",
@@ -48,6 +48,9 @@ export function useFocusTrap(
48
48
  const first = initialFocus?.current ?? list.find((el) => !el.hasAttribute('data-skip-initial-focus')) ?? list[0] ?? root
49
49
  first.focus({ preventScroll: true })
50
50
 
51
+ // Safari's plain Tab skips buttons, so it can jump from the middle of the layer to the page behind,
52
+ // or off the page. A Tab that lands outside goes back to the end it wrapped past.
53
+ let check = 0
51
54
  const onKey = (e: KeyboardEvent) => {
52
55
  if (e.key !== 'Tab') return
53
56
  const items = focusables(root)
@@ -65,10 +68,19 @@ export function useFocusTrap(
65
68
  } else if (!e.shiftKey && current === lastEl) {
66
69
  e.preventDefault()
67
70
  firstEl.focus()
71
+ } else {
72
+ const back = e.shiftKey
73
+ clearTimeout(check)
74
+ check = window.setTimeout(() => {
75
+ if (root.contains(document.activeElement)) return
76
+ const now = focusables(root)
77
+ now[back ? now.length - 1 : 0]?.focus({ preventScroll: true })
78
+ })
68
79
  }
69
80
  }
70
81
  root.addEventListener('keydown', onKey)
71
82
  return () => {
83
+ clearTimeout(check)
72
84
  root.removeEventListener('keydown', onKey)
73
85
  // Give focus back only if it is still in the layer, so a click elsewhere keeps its own focus.
74
86
  const now = document.activeElement
package/src/tokens.css CHANGED
@@ -215,21 +215,21 @@
215
215
 
216
216
  @media (prefers-color-scheme: dark) {
217
217
  :root:not([data-theme="light"]) {
218
- --hl-color-bg: #161616;
219
- --hl-color-surface: #1e1e1e;
220
- --hl-color-surface-sunken: #121212;
221
- --hl-color-surface-hover: #262626;
222
- --hl-color-surface-active: #2e2e2e;
223
- --hl-color-surface-raised: #2c2c2c;
218
+ --hl-color-bg: #0a0a0a;
219
+ --hl-color-surface: #111111;
220
+ --hl-color-surface-sunken: #070707;
221
+ --hl-color-surface-hover: #1a1a1a;
222
+ --hl-color-surface-active: #222222;
223
+ --hl-color-surface-raised: #1c1c1c;
224
224
  --hl-color-overlay: rgb(0 0 0 / 0.6);
225
225
  --hl-color-fg: #ececec;
226
226
  --hl-color-fg-muted: #ababab;
227
227
  --hl-color-fg-subtle: #949494;
228
228
  --hl-color-fg-disabled: #5a5a5a;
229
- --hl-color-border: #2e2e2e;
229
+ --hl-color-border: #262626;
230
230
  --hl-color-border-strong: #707070;
231
231
  --hl-color-inverse: #ececec;
232
- --hl-color-inverse-fg: #161616;
232
+ --hl-color-inverse-fg: #0a0a0a;
233
233
  --hl-color-inverse-hover: var(--hl-gray-300);
234
234
  --hl-color-shimmer: rgb(255 255 255 / 0.06);
235
235
  --hl-color-success: #4cc97a;
@@ -250,24 +250,24 @@
250
250
  }
251
251
  }
252
252
 
253
- /* Dark theme (forced). Never pure black: a dark grey page, raised surfaces a step lighter, and a soft
254
- white for text, so it does not glare. */
253
+ /* Dark theme (forced). Near black, never pure black: raised surfaces a step lighter, and a soft white
254
+ for text, so it does not glare. */
255
255
  [data-theme="dark"] {
256
- --hl-color-bg: #161616;
257
- --hl-color-surface: #1e1e1e;
258
- --hl-color-surface-sunken: #121212;
259
- --hl-color-surface-hover: #262626;
260
- --hl-color-surface-active: #2e2e2e;
261
- --hl-color-surface-raised: #2c2c2c;
256
+ --hl-color-bg: #0a0a0a;
257
+ --hl-color-surface: #111111;
258
+ --hl-color-surface-sunken: #070707;
259
+ --hl-color-surface-hover: #1a1a1a;
260
+ --hl-color-surface-active: #222222;
261
+ --hl-color-surface-raised: #1c1c1c;
262
262
  --hl-color-overlay: rgb(0 0 0 / 0.6);
263
263
  --hl-color-fg: #ececec;
264
264
  --hl-color-fg-muted: #ababab;
265
265
  --hl-color-fg-subtle: #949494;
266
266
  --hl-color-fg-disabled: #5a5a5a;
267
- --hl-color-border: #2e2e2e;
267
+ --hl-color-border: #262626;
268
268
  --hl-color-border-strong: #707070;
269
269
  --hl-color-inverse: #ececec;
270
- --hl-color-inverse-fg: #161616;
270
+ --hl-color-inverse-fg: #0a0a0a;
271
271
  --hl-color-inverse-hover: var(--hl-gray-300);
272
272
  --hl-color-shimmer: rgb(255 255 255 / 0.06);
273
273
  --hl-color-success: #4cc97a;