@cahyo-dimas/freeday 3.21.0 → 3.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/CHANGELOG.md CHANGED
@@ -9,6 +9,114 @@ benar. Perubahan seperti itu ditulis di bawah `### Changed: BREAKING (types)`
9
9
  lama → tipe baru, dan cara menyempitkannya — bukan di bawah `### Added`, betapapun aditifnya dari
10
10
  sisi kit.
11
11
 
12
+ ## [3.23.0] - 2026-11-26
13
+
14
+ **Empat catatan dari app ronda (`CATATAN-FREEDAY.md` §29 sampai §31, dan satu temuan di §26).**
15
+ Formulir di komponen anak kini tervalidasi, tautan teks punya nama di daftar kelas, tab bisa berganti
16
+ menjadi pemilih di wadah sempit, dan layar rujukan tidak lagi kehilangan `<h1>`-nya di HP.
17
+
18
+ ### Added
19
+ - **`.fdy-tabs--picker-narrow` dan `.fdy-tabs__picker`** (`#121`, §31). Saat lebar tab itu sendiri
20
+ 40rem atau kurang, satu combo berisi bagian yang sama menggantikan daftar tab. Ini container query,
21
+ jadi tab di laci 20rem pada desktop ikut berganti; di bawah Safari 16 aturan yang sama berlaku
22
+ menurut lebar viewport. Di jalur mentah `freeday-tabs.js` membangun pemilihnya, menamainya dengan
23
+ label tablist (atau `data-fdy-text-picker`, bawaan `Section`), dan menyinkronkan keduanya. Di Vue,
24
+ React dan Blazor pemilihnya `FdyCombo` yang diikat ke state yang sama, di dalam
25
+ `.fdy-tabs__picker` sebelum daftar. Daftar hanya disembunyikan bila ada pemilih di depannya, jadi
26
+ kelas ini tanpa pemilih tidak mengubah apa pun.
27
+ - **`.fdy-link` dan `.fdy-link--muted`** (`#120`, §30). `<a>` polos sudah lama dilukis sebagai tautan
28
+ oleh `base.css`, tetapi tidak ada kelas di `COMPONENTS.md` yang mengatakannya, dan daftar kelas itu
29
+ tertutup. `--muted` untuk kolom nama yang masing-masing membuka catatannya sendiri: tinta teks
30
+ dengan garis bawah redup, primary saat hover. Keduanya mempertahankan garis bawah saat diam, supaya
31
+ tautan tidak dikenali dari warna saja. Aturan tautan lawan tombol ditulis di sebelahnya.
32
+
33
+ ### Changed
34
+ - **`useFreeday` menjangkau DOM yang dipasang komponen anak belakangan** (`#119`, §29), di Vue dan
35
+ React. Formulir `data-fdy-validate` yang dirender anak di balik `v-if` atau kondisinya sendiri tidak
36
+ pernah terhidrasi: `onUpdated` dan efek React milik komponen yang berubah, yaitu anak, bukan
37
+ pemanggil `useFreeday`. Isian wajib yang kosong lolos terkirim. Kini `useFreeday` mengamati
38
+ subtree-nya dan menghidrasi ulang di microtask yang sama, sebelum layar dilukis. `takeRecords()`
39
+ membuang mutasi yang dibuat enhancer sendiri, jadi satu hidrasi tidak menjadwalkan hidrasi
40
+ berikutnya.
41
+
42
+ ### Fixed
43
+ - **`docs/reference-screen.html` punya `<h1>` di setiap lebar** (`#122`, temuan di §26). Judul topbar
44
+ memakai `fdy-hide-below-md`, yang `display:none`, jadi di bawah 960px layar yang disalin setiap app
45
+ baru tidak punya `<h1>` sama sekali. Judulnya sudah terpotong rapi di topbar sempit; diukur muat di
46
+ 320, 375 dan 412px tanpa gulir samping. `COMPONENTS.md` kini mengatakan bahwa utilitas `hide-below`
47
+ juga mengeluarkan isinya dari pohon aksesibilitas, dan bahwa judul yang tidak boleh terlihat memakai
48
+ `.fdy-visually-hidden`.
49
+
50
+ ### Catatan
51
+ - **§31 tidak menjadi pembungkus bertipe `FdyTabs`.** Usulannya menyebut kunci, ARIA dan sinkronisasi
52
+ sebagai milik kit. Di jalur mentah memang demikian. Di stack bertipe, tab yang statenya dipegang
53
+ framework sudah sinkron lewat nilai yang sama, dan ARIA pemilihnya milik `FdyCombo`. Navigasi
54
+ papan ketik daftar tab tetap ditulis app sampai ada pemakai kedua yang membutuhkan pembungkusnya.
55
+ - Diuji di `browser/child-hydration.mjs` (Vue dan React: formulir anak tervalidasi, dan pengamat
56
+ diam sesudah halaman tenang), `browser/tabs-picker.mjs` (tiga kasus, masing-masing terbukti merah
57
+ oleh mutasi), uji kembar container query lawan cadangannya di `test/baseline.test.mjs`, dan
58
+ penjaga `<h1>` tersembunyi di `test/docs.test.mjs`. Keempatnya merah pada kode lama.
59
+ - **Harness peramban: bundle uji kini mendarat lewat rename** (`browser/harness.mjs`). Setiap berkas
60
+ spesifikasi berjalan di prosesnya sendiri dan memanggil `buildEntries()`, dan esbuild menulis dengan
61
+ mengosongkan berkas dulu. Terukur di laptop: 27 dari 90.477 pembacaan selama pembangunan ulang
62
+ serentak mendapati berkas 0 byte, dan halaman yang memuat skrip kosong tidak pernah terpasang. Di CI
63
+ itu muncul sebagai `cfl-narrow` yang gagal dua kali pada tag ini sementara commit yang sama lulus
64
+ di `main`. Sesudahnya 0 dari 102.634. Hanya alat uji; tidak ada yang terkirim di paket.
65
+
66
+ ## [3.22.0] - 2026-11-24
67
+
68
+ **Sebuah app yang dipakai di HP punya tombol berukuran ibu jari, isian primary yang lebih dalam, dan
69
+ bilah aksi yang menempel di atas navigasi bawah.** Tanpa atribut baru, setiap token tetap bernilai
70
+ sama dengan 3.21.0 di terang, gelap, `soft`, `glass`, di bawah semua palet dan netral, selain satu
71
+ token baru, `--primary-700-rgb`, di setiap blok palet (tak ada yang membacanya tanpa
72
+ `data-primary-fill="deep"`). `test/token-snapshot.test.mjs` menjaganya.
73
+
74
+ ### Added
75
+ - **`data-density="touch"`.** Menyetel `--control-h` ke `2.75rem` (44px) dan tidak mengubah yang lain.
76
+ Di dalam region `compact` ia mempertahankan spasi compact.
77
+ - **`data-primary-fill="deep"`.** Isian primary memakai shade 700; hover, active, dan strong memakai 800;
78
+ `--color-primary-rgb` dan cincin fokus memakai 700; label memakai `onDeep`. Hanya tema terang; tema
79
+ gelap tidak berubah. `onDeep` bernilai putih di 18 palet (terukur: terendah lime 4,99:1, di ketiga
80
+ netral slate, grey, dan stone). Setiap blok palet kini juga membawa `--primary-700-rgb`. Region bersarang mengulang `data-theme` dan `data-primary` di elemen yang sama. Wrapper
81
+ polos memakai nilai terang `deep` di semua tema, jadi di bawah tema gelap (milik leluhur atau OS)
82
+ isian dan tinta strong-nya salah.
83
+ - **`.fdy-actionbar`** (`src/components/actionbar.css`, hanya CSS): aksi yang menempel di atas navigasi
84
+ bawah dan tidak pernah menutup baris terakhir. Boleh berada di dalam satu wrapper halaman seperti
85
+ `.fdy-page` yang menjadi anak terakhir `main`. Di HP (720px ke bawah) bar selebar layar, seperti
86
+ navigasi bawah. Bersamanya token `--fdy-bottomnav-h`.
87
+ - **`USAGE.md` §8 Mobile**: HP adalah layout sendiri, bukan desktop yang diperkecil.
88
+
89
+ ### Fixed
90
+ - **Tinta label palet di bawah pengaturan gelap OS.** Tujuh palet bertinta gelap (orange, amber, lime,
91
+ green, emerald, teal, cyan) menampilkan label putih di isian 500 selama OS gelap, bahkan dengan
92
+ `data-theme="dark"`. Terukur sebelum perbaikan: orange 2,80, amber 2,15, lime 1,98, green 2,28,
93
+ emerald 2,54, teal 2,49, cyan 2,43 :1. Sebabnya: aturan dasar `:root:not([data-theme="light"])` (0,2,0)
94
+ mengalahkan blok palet (0,1,0), dan `buildPrimariesCss` hanya menulis kembaran gelap bila `onDark`
95
+ berbeda dari `on`. Gerbang kontras tidak pernah memodelkan cakupan gelap OS. Kini ada kembaran
96
+ gelap, dan tes kontras serta tes browser menjaganya.
97
+
98
+ ### Changed
99
+ - **Tinggi navigasi bawah kini dinyatakan.** `--fdy-bottomnav-h` dideklarasikan di
100
+ `.fdy-app--has-bottomnav` dan navigasi mengambil tingginya dari sana. Tingginya dulu 61,39px karena
101
+ isi satu item (ikon, label) 0,39px lebih tinggi dari 44px; kini tepat 61px. Dengan font app yang lebih
102
+ tinggi, label meluap ke padding bawah dan tidak lagi menambah tinggi bilah.
103
+ - **`.fdy-actionbar` sebagai anak terakhir `.fdy-app__main`** meniadakan padding bawah main dengan margin
104
+ negatif per konteks, sehingga di akhir halaman ia bersandar rata pada navigasi atau tepi viewport.
105
+ - **Docs.** `USAGE.md` §0 kini menyebut "di luar jaminan kit" sebagai ganti "terkunci". Daftar
106
+ `data-density` di README, `docs/getting-started.md`, dan `docs/agent-onboarding.md` memuat `touch`.
107
+
108
+ ### Upgrade
109
+ - Ganti `--control-h: 2.75rem` yang disetel tangan dengan `data-density="touch"`.
110
+ - Ganti primary yang lebih dalam yang disetel tangan (`--color-primary: var(--primary-700)` dan
111
+ kawan-kawannya) dengan `data-primary-fill="deep"`.
112
+ - Penyetelan `--color-on-primary` bertinta gelap di bawah `[data-theme='dark']` baru boleh dihapus
113
+ setelah region gelap itu membawa `data-primary` di sebelah `data-theme` (`USAGE.md` §5b). Perbaikan
114
+ kit hanya berlaku di scope yang menaruh keduanya pada elemen yang sama; region gelap bersarang yang
115
+ mewarisi palet dari `<html>` masih butuh aturan itu.
116
+ - `--color-on-primary` yang disetel tangan di bawah `:root[data-primary=…]` kini kalah dari
117
+ `:root:not([data-theme="light"])[data-primary=…]` saat OS gelap. Hapus override itu dan pakai
118
+ `data-primary-fill="deep"` dalam perubahan yang sama.
119
+
12
120
  ## [3.21.0] - 2026-11-20
13
121
 
14
122
  **Sebuah app memutuskan tampilannya sendiri.** Sebelum rilis ini kit hanya menawarkan palet primary,
package/COMPONENTS.md CHANGED
@@ -52,7 +52,12 @@ live docs.
52
52
  never enhanced logs one `console.warn` naming it, with the element attached. The usual cause is
53
53
  a `useFreeday()` ref on a wrapper that does not contain it. `freeday-unhydrated.js` does this,
54
54
  and it ships in the root import.
55
- **A `useFreeday(ref)` whose ref is still null at mount says so too.** That is a ref left off the
55
+ **`useFreeday` also reaches DOM a child component mounts later**, such as a form a child renders
56
+ behind its own `v-if` or condition. It watches its subtree for added elements and rehydrates in
57
+ the same microtask, before the browser paints, so one call in a page component covers the dialogs
58
+ and panels its children open. Before 3.23.0 it ran only when the calling component itself
59
+ re-rendered, and a child's form went unvalidated without a sound.
60
+ **A `useFreeday(ref)` whose ref is still null at mount says so too.** That is a ref left off the
56
61
  template, or one on an element behind `v-if` / a condition, and the call falls back to the whole
57
62
  document: everything works, wider than asked, and other markup on the page can come to rely on
58
63
  that scan unnoticed. It logs one `console.warn` per component. Put the ref on an element that is
@@ -429,6 +434,12 @@ One role per level of hierarchy. Never re-use a card title for a page title.
429
434
  | `.fdy-text-success` · `.fdy-text-warning` · `.fdy-text-danger` | any | Inline text that carries **state** — a sentence, not a status. Use when a badge is wrong (it is prose) and an alert is wrong (it is one line inside a row): "Amount changed from X to Y", "No approver assigned". **Do not stack two colour roles** (`.fdy-help.fdy-text-warning`): both are single classes, so the one that happens to come later in the stylesheet wins — put the state class on its own element, and use `.fdy-help--error` for help text. |
430
435
  | `.fdy-icon` | `<svg>` or a wrapper | Icon box: `1em` square, `flex:none`, so the glyph tracks the text beside it at every scale. The kit ships no paths — bring your own, use the box. |
431
436
  | `.fdy-mono` | any | Tabular/monospace data (codes, amounts, ids). |
437
+ | `.fdy-link` · `.fdy-link--muted` | `<a>` (a router's link component renders one) | A text link, in a sentence or a table cell. A bare `<a>` already looks like `.fdy-link`; the class sets the underline the same way in every browser. `--muted` is for a column of names that each open their own record (accounts in a balance sheet, each linking to its ledger): text ink with a muted underline, primary on hover. Both keep the underline at rest, so a link is never told apart by colour alone. |
438
+
439
+ **A link goes somewhere; a button does something.** If activating it changes the URL, or would make
440
+ sense opened in a new tab, it is an `<a>` with `.fdy-link`, or a whole row as
441
+ `<a class="fdy-list__row">`. If it saves, deletes, opens a dialog or toggles a state, it is a
442
+ `<button>`, and `.fdy-btn--text` is the one that looks like text.
432
443
 
433
444
  ## Utilities
434
445
  `.fdy-hidden` · `.fdy-visually-hidden` (screen-reader-only) · `.fdy-list-reset` (strip native
@@ -440,7 +451,10 @@ The browser's own `display:none` for `[hidden]` loses to any class that sets `di
440
451
  layer restates it with `!important`. `hidden="until-found"` is left to the browser, which keeps it
441
452
  findable with find-in-page.
442
453
 
443
- Responsive display: `.fdy-hide-below-sm|md|lg` · `.fdy-hide-above-sm|md|lg`.
454
+ Responsive display: `.fdy-hide-below-sm|md|lg` · `.fdy-hide-above-sm|md|lg`. These are `display:none`, so
455
+ what they hide leaves the accessibility tree as well. Never put one on a heading: a page whose `<h1>`
456
+ is hidden below a width has no `<h1>` there. A title that must not be painted takes
457
+ `.fdy-visually-hidden`, which a screen reader still reads.
444
458
  Breakpoints (min-width): `sm` 600 · `md` 960 · `lg` 1280 · `xl` 1920, importable as
445
459
  `import { breakpoints } from '@cahyo-dimas/freeday/breakpoints'`.
446
460
 
@@ -529,7 +543,7 @@ without a reload.
529
543
  inks, the chart grid, and the `noir` palette): `slate` (the default, and what you get with no
530
544
  attribute), `grey` (no hue) and `stone` (warm). Each shade keeps the lightness of the slate shade
531
545
  with the same number, and every option is contrast-gated in both themes and under all 18 palettes.
532
- Set it on `<html>`; on a region, only together with `data-theme`, because on a bare wrapper it half-applies (`USAGE.md` §5b).
546
+ Set it on `<html>`; on a region, only together with `data-theme`, because a bare wrapper takes the ink but not the surfaces (`USAGE.md` §5b).
533
547
 
534
548
  ```html
535
549
  <html data-neutral="stone" data-primary="noir">
@@ -563,10 +577,23 @@ and `violet` shift one step lighter in dark, because at their mid shade neither
563
577
  reaches 4.5:1. `noir` is not a hue at all — it re-points the alias ramp at the neutral ramp, so
564
578
  "primary" becomes near-black in light and near-white in dark.
565
579
 
580
+ **Deep fill: `data-primary-fill="deep"`.** For a white label on a darker fill, in the light theme
581
+ only. The fill, hover, active and strong ink move one shade down the palette's ramp (fill 700,
582
+ hover/active/strong 800, focus ring 700), and the label becomes the palette's measured `onDeep` ink,
583
+ which is white for all 18 palettes (lowest: lime, 4.99:1). The soft wash does not change, and the
584
+ dark theme keeps its normal values. Set it beside `data-primary`, on `<html>` or on a region, and on
585
+ a region only together with `data-theme` and `data-primary` on the same element. A bare wrapper
586
+ applies deep's light values in every theme, so under any dark theme (an ancestor's or the OS's) its fill
587
+ and strong ink are wrong. Noir is the odd one: its deep fill (neutral-800) is lighter than its standard
588
+ fill (neutral-900).
589
+
566
590
  Density: `data-density="compact"` works on `<html>` **or any wrapper**, because the selector is a bare
567
591
  `[data-density="compact"]` over inheriting custom properties, so one screen can be dense while the
568
592
  rest of the app is not. `data-density="comfortable"` is a real rule too, so the reverse also works:
569
593
  a compact root with one region opted back out (shared chrome that must match a sibling product).
594
+ `data-density="touch"` is the third value: 2.75rem (44px) controls, for an app used standing up or on
595
+ the move. It sets only the control height, so a touch region inside a compact one keeps compact
596
+ spacing; put `touch` on a comfortable ancestor to avoid that. `comfortable` resets it too.
570
597
 
571
598
  ---
572
599
 
@@ -2138,6 +2165,10 @@ and a row nobody can scroll to is a row nobody knows is there.
2138
2165
  glyph means. Long labels ellipsis rather than wrap, so the bar keeps one height.
2139
2166
  - Bottom padding includes `env(safe-area-inset-bottom)`, so labels do not sit under the home
2140
2167
  indicator on a notched phone.
2168
+ - **`--fdy-bottomnav-h`** is the bar's stated height (a 44px item, the vertical padding and the top
2169
+ hairline), declared on `.fdy-app--has-bottomnav`. The bar is drawn at that height, and
2170
+ `.fdy-actionbar` reads it to rest on top of the bar. The trade-off: a taller app font overflows
2171
+ into the bar's padding instead of making the bar taller.
2141
2172
 
2142
2173
  ```html
2143
2174
  <nav class="fdy-bottomnav" aria-label="Main">
@@ -2152,6 +2183,36 @@ and a row nobody can scroll to is a row nobody knows is there.
2152
2183
  </nav>
2153
2184
  ```
2154
2185
 
2186
+ ## Action bar — `.fdy-actionbar`
2187
+ One to three actions pinned to the bottom of the screen, where a thumb reaches them on a phone: the
2188
+ sign-in button, approve and reject on a document, save at the end of a long form. Put it as the last
2189
+ child of the page content (`.fdy-app__main`), or of one page wrapper such as `.fdy-page` inside it. The
2190
+ wrapper must be the last in-flow content of main and have no bottom padding, border or margin of its own;
2191
+ the fixed bottom nav and closed dialogs may follow it. A bar inside a modal or drawer is not offset.
2192
+ Nested deeper than one wrapper (inside a form, say), the bar still rests on the nav while scrolling but stops short of it at the end of the page. An in-flow block after the wrapper is overlapped at the end of the page.
2193
+ It holds `.fdy-btn` elements. They share the width, and
2194
+ the primary action goes last, nearest the thumb.
2195
+
2196
+ - It is `position: sticky`, so it keeps its place in the flow and never covers the last row above it.
2197
+ - In a shell with `.fdy-app--has-bottomnav`, below 720px it rests on top of the bottom nav, using
2198
+ `--fdy-bottomnav-h` (declared on that shell). Elsewhere it clears the home indicator with
2199
+ `env(safe-area-inset-bottom)`.
2200
+ - Below 720px it runs edge to edge, like the bottom nav, by cancelling main's side padding. The
2201
+ wrapper rule holds here too: a wrapper between main and the bar adds no side padding, border or
2202
+ margin. The bar's own side padding clears a landscape notch.
2203
+ - No ARIA of its own: it is a row of buttons, and each keeps its own name.
2204
+ - CSS only. Vue, React and Blazor use the same markup.
2205
+
2206
+ ```html
2207
+ <main class="fdy-app__main">
2208
+ <!-- the screen -->
2209
+ <div class="fdy-actionbar">
2210
+ <button class="fdy-btn fdy-btn--ghost" type="button">Reject</button>
2211
+ <button class="fdy-btn" type="button">Approve</button>
2212
+ </div>
2213
+ </main>
2214
+ ```
2215
+
2155
2216
  ## Nav (menu) — `.fdy-nav`
2156
2217
  Navigation links, **vertical by default** (the app shell sidebar), horizontal with `--horizontal`. Items are `<a class="fdy-nav__item">` with
2157
2218
  `__icon` / `__label` / `__badge`; the current one gets `aria-current="page"`.
@@ -2287,6 +2348,40 @@ settings screen whose sections are a list, not a strip.
2287
2348
  is why the axis is read from the attribute and never from the painted layout.
2288
2349
  - Measured in `browser/tabs-vertical.mjs`, which also holds the line that a strip with no
2289
2350
  `aria-orientation` behaves and paints exactly as it did before the variant existed.
2351
+ - **A picker in a narrow container: `.fdy-tabs--picker-narrow`**, opt-in, on the strip or the
2352
+ vertical variant. When the tabs' own width is 40rem or less, a `.fdy-tabs__picker` (a wrapper
2353
+ holding one combo of the same sections) replaces the list. It is a container query, so tabs in a
2354
+ 20rem drawer on a desktop switch too. Below Safari 16 the same rule applies by viewport width, which
2355
+ covers phones and leaves a narrow drawer on a wide screen with its list.
2356
+ - **Raw path:** add the class. `freeday-tabs.js` builds the picker first in the root, names it
2357
+ after the tablist's `aria-labelledby` or `aria-label` (else `data-fdy-text-picker`, default
2358
+ `Section`), and keeps tab and picker in step both ways. It needs `freeday-select.js`, which
2359
+ `dist/freeday.js` carries.
2360
+ - **Vue, React, Blazor:** tabs whose state lives in your framework render the picker themselves:
2361
+ a `FdyCombo` bound to the same value as the tabs, inside `<div class="fdy-tabs__picker">`, placed
2362
+ **before** `.fdy-tabs__list`.
2363
+ - The list is hidden only when a picker precedes it, so the class on tabs with no picker changes
2364
+ nothing, and no width can leave a screen without a way between its sections.
2365
+ - Use it when the labels are long or there are more than about four tabs. A strip of three short
2366
+ labels fits a phone as it is.
2367
+
2368
+ ```html
2369
+ <div class="fdy-tabs fdy-tabs--vertical fdy-tabs--picker-narrow" data-fdy-tabs>
2370
+ <div class="fdy-tabs__list" role="tablist" aria-label="Settings sections">…</div>
2371
+ <div class="fdy-tabs__panel" role="tabpanel" …>…</div>
2372
+ </div>
2373
+
2374
+ <!-- Vue: the picker is yours, bound to the state the tabs already read. One label names both:
2375
+ FdyCombo takes ariaLabelledby, and an aria-label on it would land on its root, not its button. -->
2376
+ <span id="sections" class="fdy-visually-hidden">Settings sections</span>
2377
+ <div class="fdy-tabs fdy-tabs--vertical fdy-tabs--picker-narrow">
2378
+ <div class="fdy-tabs__picker">
2379
+ <FdyCombo v-model="tab" :options="sections" aria-labelledby="sections" />
2380
+ </div>
2381
+ <div class="fdy-tabs__list" role="tablist" aria-orientation="vertical" aria-labelledby="sections">…</div>
2382
+ …
2383
+ </div>
2384
+ ```
2290
2385
 
2291
2386
  ---
2292
2387
 
package/README.id.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **Lebih banyak _free day_ buat dev. UI kit-nya sudah siap pakai.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v3.21.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.21.0)
8
+ [![Release](https://img.shields.io/badge/release-v3.23.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.23.0)
9
9
 
10
10
  UI KIT yang token-driven & framework-agnostic. Satu sumber kebenaran untuk warna, tipografi,
11
11
  spasi, dan komponen. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
@@ -147,7 +147,7 @@ container-nya, bukan scroll sendiri.
147
147
  - `data-theme="light|dark"` me-redefinisi token semantic (bind ke state tema app-mu).
148
148
  Berlaku di **ancestor mana pun**, tak harus root: `<section data-theme="dark">` membalik region itu
149
149
  dan semua komponen di dalamnya ikut (lihat [`USAGE.md`](USAGE.md) §5b).
150
- - `data-density="comfortable|compact"` mengatur tinggi kontrol (`--control-h`) untuk layar padat data.
150
+ - `data-density="comfortable|compact|touch"` mengatur tinggi kontrol (`--control-h`): `compact` untuk layar padat data, `touch` (44px) untuk app yang dipakai di HP.
151
151
  Ini auto-apply hanya ke kontrol bawaan Freeday (button, input, combo, dst); komponen
152
152
  custom/hand-built harus baca `--control-h` sendiri (mis. `height: var(--control-h)`) supaya ikut
153
153
  menyusut/melebar saat `data-density` berubah.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **More free days for devs. The UI kit is ready to use.**
6
6
 
7
7
  [![Live docs](https://img.shields.io/badge/docs-live-2050d8?style=flat-square)](https://cahyo-dimas.github.io/freeday-ui-kit/)
8
- [![Release](https://img.shields.io/badge/release-v3.21.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.21.0)
8
+ [![Release](https://img.shields.io/badge/release-v3.23.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.23.0)
9
9
 
10
10
  A token-driven, framework-agnostic UI kit. One source of truth for color, typography,
11
11
  spacing, and components. Blueprint: `docs/superpowers/specs/2026-07-21-freeday-ui-kit-design.md`.
@@ -149,7 +149,7 @@ of scrolling.
149
149
  - `data-theme="light|dark"` redefines the semantic tokens (bind it to your app's theme state).
150
150
  Works on **any ancestor**, not just the root: `<section data-theme="dark">` inverts that region
151
151
  and every component inside it follows (see [`USAGE.md`](USAGE.md) §5b).
152
- - `data-density="comfortable|compact"` sets control height (`--control-h`) for data-dense screens.
152
+ - `data-density="comfortable|compact|touch"` sets control height (`--control-h`): `compact` for data-dense screens, `touch` (44px) for apps used on a phone.
153
153
  This auto-applies only to Freeday's built-in controls (button, input, combo, etc.);
154
154
  custom/hand-built components must read `--control-h` themselves (e.g. `height: var(--control-h)`)
155
155
  to shrink or grow when `data-density` changes.
package/USAGE.md CHANGED
@@ -29,12 +29,14 @@ The look lives in two places: the `data-*` attributes on `<html>`, and one file,
29
29
  | Motion: `--dur-*`, `--ease-*` | `app.identity.css` |
30
30
  | One component, locally: `--fdy-<component>-<property>` | your own CSS |
31
31
 
32
- Everything else stays with the kit. Colour reaches an app only through the attributes, because
33
- the attributes are what the contrast gate tests, so your CSS carries no `--color-*`, `--tone-*` or
34
- `--chart-*`. Spacing (`--space-*`) and control size (`--control-*`) carry density. The type size
35
- scale (`--text-*`, `--leading-*`) sets control heights and table density, so a screen that wants
36
- big type uses `var(--text-xl)` and up in its own content. `--radius-full`, `--bw` and the focus
37
- ring are accessibility contracts.
32
+ Everything else is outside the kit's guarantee. You may override it, and some apps need to, but the
33
+ contrast gate and the kit's own tests no longer cover what you change: check the contrast yourself
34
+ and write down why in `DESIGN.md`. Take a sanctioned route first when one exists. Colour reaches an
35
+ app through the attributes, including `data-primary-fill="deep"` for a white label on a darker fill.
36
+ Control size has `data-density="touch"` for 44px targets. Spacing (`--space-*`) carries density, and
37
+ the type size scale (`--text-*`, `--leading-*`) sets control heights and table density, so a screen
38
+ that wants big type uses `var(--text-xl)` and up in its own content. `--radius-full`, `--bw` and the
39
+ focus ring are accessibility contracts, and no reason in `DESIGN.md` makes overriding them safe.
38
40
 
39
41
  `app.identity.css` is the one file where literal values belong, and only as values of the tokens
40
42
  in the table. Shadows need four blocks in this order, because the kit sets dark shadows in three
@@ -237,14 +239,18 @@ restating colours per element.
237
239
  The **system** default (`@media (prefers-color-scheme: dark)`) stays root-scoped on purpose: that
238
240
  rule is about the document, and un-rooting it would re-darken the children of a light island.
239
241
 
240
- `data-primary` and `data-neutral` follow the same selectors, with one difference. They re-point
242
+ `data-primary`, `data-neutral` and `data-primary-fill="deep"` follow the same selectors, with one difference. They re-point
241
243
  an alias ramp, and the semantic tokens resolve that ramp where they are declared: on `<html>`, or
242
244
  on an element that carries `data-theme`. So put them on `<html>`. To re-brand or re-tint a single
243
- region, put the axis on that region together with `data-theme`. Never put either axis on a bare
244
- wrapper: it half-applies. A palette moves the label ink (`--color-on-primary`) but not the fill, so
245
+ region, put the axis on that region together with `data-theme`. Never put any of them on a bare
246
+ wrapper. A palette moves the label ink (`--color-on-primary`) but not the fill, so
245
247
  orange, amber, lime, green, emerald, teal and cyan leave dark ink on the azure fill (2.87:1 for orange); a neutral moves
246
- the tone inks, borders, stripe and danger border but not the surfaces. An inverted island inside an app
247
- with a non-default look must repeat `data-primary` and `data-neutral` beside its `data-theme`.
248
+ the tone inks, borders, stripe and danger border but not the surfaces. A bare `deep` wrapper applies
249
+ its light values in every theme, so under any dark theme (an ancestor's or the OS's) its fill and
250
+ strong ink are wrong: on teal, the 800 strong ink measures about 2.5:1 on the dark surface.
251
+ An inverted island inside an app with a non-default look must repeat `data-primary`, `data-neutral`
252
+ and `data-primary-fill` beside its `data-theme`; a deep island that leaves out `data-primary` inherits
253
+ the page palette's ink, and teal gets white on its 500 fill.
248
254
  Otherwise the island keeps the app's fill but takes the default label ink, and white labels on
249
255
  those fills drop to between 2:1 and 3.8:1 (lime 1.98:1 and orange 2.80:1 in a dark island).
250
256
 
@@ -267,6 +273,14 @@ downhill; without that rule a compact root left every subtree compact and a `com
267
273
  changed nothing. Do not restate the five values by hand: that copy goes stale the moment the kit
268
274
  retunes a step.
269
275
 
276
+ **`touch` is for apps used on the move.** `data-density="touch"` sets the control height to 2.75rem
277
+ (44px), the smallest target a thumb or a gloved finger hits reliably. It changes only the control
278
+ height, so spacing stays whatever the surrounding density gives. Use it for a whole app used standing
279
+ up (a guard's phone, a warehouse scanner) or for one shell of a mixed app, and avoid `.fdy-btn--sm`
280
+ there: it is 36px under `touch`. A `touch` region nested inside a compact one keeps compact spacing;
281
+ to get touch with comfortable spacing there, put `touch` on a comfortable ancestor (or nest
282
+ `comfortable` first). `comfortable` resets `touch` the way it resets `compact`.
283
+
270
284
  ## 6b. Navigation: one component, two orientations, and never a tab role
271
285
 
272
286
  A navigation link is an `<a class="fdy-nav__item">` marked **`aria-current="page"`**. That does not
@@ -358,4 +372,26 @@ Three habits make every app look like the same template, so avoid them:
358
372
  - **A sidebar for a handful of destinations.** An app with only a few places to go reads better
359
373
  with `.fdy-nav.fdy-nav--horizontal` in the app bar (§6b), and gets the width back.
360
374
 
375
+ ## 8. Mobile: the phone is its own layout
376
+
377
+ A phone gets its own layout. Most of these rules already live in COMPONENTS.md; they are collected
378
+ here because apps miss them.
379
+
380
+ - **Navigation.** A bottom nav (`.fdy-bottomnav`) carries three to five destinations, chosen by role.
381
+ Everything else goes behind an account or "More" item. Labels are required.
382
+ - **Lists, not tables.** Below `md`, a table becomes a `.fdy-list` (COMPONENTS.md, List). A row is
383
+ one tap target that opens its detail. Row actions move into a `.fdy-menu` behind a "..." button or
384
+ onto the detail screen; a column of stacked buttons makes one row as tall as the screen.
385
+ - **The primary action stays in reach.** Put it in `.fdy-actionbar`, which stays on screen as
386
+ the page scrolls. A `.fdy-fab--extended` works too, but the app positions it (above `--fdy-bottomnav-h`
387
+ when there is a bottom nav); the kit does not.
388
+ - **One frame.** The page header is not wrapped in a card on a phone, because the screen already is
389
+ the frame.
390
+ - **Drop the views a phone cannot use.** A list/box/grid switch shows only list (and box, if it
391
+ reads) below `md`.
392
+ - **Say where the user is.** A multi-tenant app (several sites, clusters or companies) shows the
393
+ current one as a chip in the topbar, with the switch beside it.
394
+ - **Size targets for the way the app is held.** An app used standing up or on the move sets
395
+ `data-density="touch"` (§6), per app or per shell.
396
+
361
397
  ---
@@ -47,8 +47,19 @@ var EMPTY_REF = 'Freeday: useFreeday(ref) got a ref that is still null after the
47
47
  + 'element that is not rendered yet (a condition). Put the ref on an element that is always rendered, or '
48
48
  + 'call useFreeday() with no argument if the whole document is what you mean.';
49
49
 
50
+ /* True when a batch of mutation records added at least one element. Text edits and removals cannot
51
+ bring a new enhancer hook into the tree, so they do not cost a scan. */
52
+ function addedElement(records) {
53
+ for (var i = 0; i < records.length; i++) {
54
+ var nodes = records[i].addedNodes;
55
+ for (var j = 0; j < nodes.length; j++) if (nodes[j].nodeType === 1) return true;
56
+ }
57
+ return false;
58
+ }
59
+
50
60
  export function useFreeday(rootRef) {
51
61
  var checked = useRef(false);
62
+ var observerRef = useRef(null);
52
63
  var rehydrate = useCallback(function () {
53
64
  var el = rootRef && rootRef.current ? rootRef.current : undefined;
54
65
  var apis = freedayApis();
@@ -62,6 +73,26 @@ export function useFreeday(rootRef) {
62
73
  if (rootRef && !rootRef.current) console.warn(EMPTY_REF);
63
74
  }
64
75
  rehydrate();
76
+ if (observerRef.current) observerRef.current.takeRecords();
65
77
  });
78
+ /* DOM a CHILD component commits later is hydrated too. The effect above runs when THIS component
79
+ commits, and a child that renders a form behind its own state never makes the parent commit, so
80
+ the form's `data-fdy-validate` silently did nothing (CATATAN-FREEDAY §29). The observer rehydrates
81
+ in its callback, a microtask, so the widget is enhanced before the browser paints it raw, and
82
+ takeRecords() drops what the enhancers just built, so one rehydrate never schedules the next. */
83
+ useEffect(function () {
84
+ var target = rootRef && rootRef.current ? rootRef.current : document.body;
85
+ var observer = new MutationObserver(function (records) {
86
+ if (!addedElement(records)) return;
87
+ rehydrate();
88
+ observer.takeRecords();
89
+ });
90
+ observerRef.current = observer;
91
+ observer.observe(target, { childList: true, subtree: true });
92
+ return function () {
93
+ observer.disconnect();
94
+ observerRef.current = null;
95
+ };
96
+ }, [rehydrate]);
66
97
  return { rehydrate: rehydrate };
67
98
  }
@@ -21,11 +21,16 @@
21
21
  * mount. Pass no argument, useFreeday(), when the whole document is what you mean; and put the ref
22
22
  * on an element that is always rendered, not one behind v-if.
23
23
  *
24
+ * DOM a CHILD component mounts later is hydrated too. Vue calls onUpdated on the component whose
25
+ * render changed, so a form behind a v-if in a child never reached the parent's hook, and its
26
+ * `data-fdy-validate` silently did nothing (CATATAN-FREEDAY §29). A MutationObserver on the subtree
27
+ * closes that: any element added under it triggers one rehydrate.
28
+ *
24
29
  * Events come straight through as native bubbling CustomEvents, bind them with
25
30
  * plain v-on (e.g. @fdy-cascade-change) and read event.detail. See index.d.ts
26
31
  * for the detail types.
27
32
  */
28
- import { onMounted, onUpdated, nextTick } from 'vue';
33
+ import { onBeforeUnmount, onMounted, onUpdated, nextTick } from 'vue';
29
34
 
30
35
  // Discover Freeday enhancer namespaces once (all registered by the time an app
31
36
  // mounts, since `import 'freeday'` runs first). Each exposes initAll(el?).
@@ -47,17 +52,43 @@ var EMPTY_REF = 'Freeday: useFreeday(ref) got a ref that is still null after mou
47
52
  + 'that is not rendered yet (v-if). Put the ref on an element that is always rendered, or call useFreeday() '
48
53
  + 'with no argument if the whole document is what you mean.';
49
54
 
55
+ /* True when a batch of mutation records added at least one element. Text edits and removals cannot
56
+ bring a new enhancer hook into the tree, so they do not cost a scan. */
57
+ function addedElement(records) {
58
+ for (var i = 0; i < records.length; i++) {
59
+ var nodes = records[i].addedNodes;
60
+ for (var j = 0; j < nodes.length; j++) if (nodes[j].nodeType === 1) return true;
61
+ }
62
+ return false;
63
+ }
64
+
50
65
  export function useFreeday(rootRef) {
51
66
  var apis = null;
67
+ var observer = null;
52
68
  function rehydrate() {
53
69
  if (!apis) apis = freedayApis();
54
70
  var el = rootRef && 'value' in rootRef ? (rootRef.value || undefined) : undefined;
55
71
  for (var i = 0; i < apis.length; i++) apis[i].initAll(el);
72
+ /* Whatever the enhancers just built is in the observer's queue now. Dropping it here is what
73
+ keeps one rehydrate from scheduling the next: initAll is synchronous, so every record it
74
+ caused is already queued when it returns. */
75
+ if (observer) observer.takeRecords();
56
76
  }
57
77
  onMounted(function () {
58
78
  if (rootRef && 'value' in rootRef && !rootRef.value) console.warn(EMPTY_REF);
59
79
  rehydrate();
80
+ /* In the callback itself rather than a frame later: the callback is a microtask, so a child's
81
+ widget is enhanced before the browser paints it raw. */
82
+ var target = rootRef && 'value' in rootRef && rootRef.value ? rootRef.value : document.body;
83
+ observer = new MutationObserver(function (records) {
84
+ if (addedElement(records)) rehydrate();
85
+ });
86
+ observer.observe(target, { childList: true, subtree: true });
60
87
  });
61
88
  onUpdated(function () { nextTick(rehydrate); });
89
+ onBeforeUnmount(function () {
90
+ if (observer) observer.disconnect();
91
+ observer = null;
92
+ });
62
93
  return { rehydrate: rehydrate };
63
94
  }
@@ -10,10 +10,73 @@
10
10
  * other pair is left entirely alone rather than bound as a second axis: Left and Right over a
11
11
  * column of tabs belong to whatever else is on the page, and a widget that preventDefaults a key
12
12
  * it has no meaning for has taken it from the page silently. Home/End answer on both.
13
+ *
14
+ * `.fdy-tabs--picker-narrow` on the root: this builds a `.fdy-tabs__picker` holding one combo of
15
+ * the same tabs, first in the root, and keeps the two in step both ways. tabs.css shows it instead
16
+ * of the list in a container of 40rem or less. It needs freeday-select.js (FreedayCombo), which
17
+ * dist/freeday.js carries; without it the list simply stays. A picker the author wrote is left alone.
13
18
  */
14
19
  (function () {
15
20
  'use strict';
16
21
 
22
+ /* The picker's accessible name when the tablist has none of its own to lend it. */
23
+ var TEXT = {
24
+ picker: 'Section'
25
+ };
26
+ function textOf(root, key) {
27
+ var kebab = key.replace(/[A-Z]/g, function (c) { return '-' + c.toLowerCase(); });
28
+ var custom = root.getAttribute('data-fdy-text-' + kebab);
29
+ return custom != null && custom !== '' ? custom : TEXT[key];
30
+ }
31
+ var uidSeq = 0;
32
+ function uid(p) { uidSeq += 1; return p + '-' + uidSeq; }
33
+
34
+ /* The combo freeday-select.js reads, built from the tabs themselves: one option per tab, its value
35
+ the tab's id. Named by the tablist's own label when it has one, so the two read as one control. */
36
+ function buildPicker(root, list, tabs) {
37
+ var wrap = document.createElement('div');
38
+ wrap.className = 'fdy-tabs__picker';
39
+ var combo = document.createElement('div');
40
+ combo.className = 'fdy-combo';
41
+ combo.setAttribute('data-fdy-combo', '');
42
+ var button = document.createElement('button');
43
+ button.type = 'button';
44
+ button.className = 'fdy-combo__button';
45
+ button.setAttribute('role', 'combobox');
46
+ button.setAttribute('aria-haspopup', 'listbox');
47
+ button.setAttribute('aria-expanded', 'false');
48
+ var value = document.createElement('span');
49
+ value.className = 'fdy-combo__value';
50
+ value.id = uid('fdy-tabs-picker-value');
51
+ button.appendChild(value);
52
+ var labelledby = list ? list.getAttribute('aria-labelledby') : null;
53
+ var label = list ? list.getAttribute('aria-label') : null;
54
+ if (labelledby) button.setAttribute('aria-labelledby', labelledby + ' ' + value.id);
55
+ else button.setAttribute('aria-label', label || textOf(root, 'picker'));
56
+ var listbox = document.createElement('ul');
57
+ listbox.className = 'fdy-combo__listbox';
58
+ listbox.setAttribute('role', 'listbox');
59
+ listbox.hidden = true;
60
+ tabs.forEach(function (tab) {
61
+ if (!tab.id) tab.id = uid('fdy-tab');
62
+ var opt = document.createElement('li');
63
+ opt.className = 'fdy-combo__option';
64
+ opt.setAttribute('role', 'option');
65
+ opt.setAttribute('data-value', tab.id);
66
+ opt.setAttribute('aria-selected', 'false');
67
+ var check = document.createElement('span');
68
+ check.className = 'fdy-combo__check';
69
+ opt.appendChild(check);
70
+ opt.appendChild(document.createTextNode((tab.textContent || '').replace(/\s+/g, ' ').trim()));
71
+ listbox.appendChild(opt);
72
+ });
73
+ combo.appendChild(button);
74
+ combo.appendChild(listbox);
75
+ wrap.appendChild(combo);
76
+ root.insertBefore(wrap, root.firstChild);
77
+ return combo;
78
+ }
79
+
17
80
  function initTabs(root) {
18
81
  if (root.dataset.fdyTabsReady === '1') return;
19
82
  if (root.closest('[data-fdy-ignore]')) return;
@@ -31,6 +94,17 @@
31
94
  list.setAttribute('aria-orientation', 'vertical');
32
95
  }
33
96
  var vertical = list !== null && list.getAttribute('aria-orientation') === 'vertical';
97
+ var picker = null;
98
+ if (root.classList.contains('fdy-tabs--picker-narrow') && window.FreedayCombo
99
+ && root.querySelector(':scope > .fdy-tabs__picker') === null) {
100
+ picker = buildPicker(root, list, tabs);
101
+ window.FreedayCombo.init(picker);
102
+ picker.addEventListener('fdy-change', function (e) {
103
+ var id = e.detail && e.detail.value;
104
+ var tab = tabs.filter(function (t) { return t.id === id; })[0];
105
+ if (tab) select(tab, false);
106
+ });
107
+ }
34
108
  var NEXT_KEY = vertical ? 'ArrowDown' : 'ArrowRight';
35
109
  var PREV_KEY = vertical ? 'ArrowUp' : 'ArrowLeft';
36
110
 
@@ -46,6 +120,8 @@
46
120
  var panel = panelFor(t);
47
121
  if (panel) panel.hidden = !on;
48
122
  });
123
+ /* Silent: setValue raises no fdy-change, so the picker cannot echo a pick back here. */
124
+ if (picker) window.FreedayCombo.setValue(picker, tab.id);
49
125
  if (focus) tab.focus();
50
126
  }
51
127