@cahyo-dimas/freeday 3.18.0 → 3.19.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/CHANGELOG.md CHANGED
@@ -9,6 +9,67 @@ 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.19.1] - 2026-11-09
13
+
14
+ Hanya dokumen dan uji. Tidak ada perubahan pada CSS, enhancer, atau pembungkus.
15
+
16
+ ### Docs
17
+
18
+ - **Jumlah pembungkus tidak lagi ditulis dengan kata** (`#117`, §27). "Eleven" dan "thirteen" dipakai
19
+ untuk himpunan yang sama di 18 tempat dalam lima berkas, enam di antaranya di blok tempel
20
+ `agent-onboarding.md`. Agen yang menuruti "the eleven" dapat menyimpulkan dua komponen tidak punya
21
+ pembungkus. Kini tiap kalimat menunjuk ke daftar namanya, yang sudah dijaga uji.
22
+ `FdyTableFooter` disebut sebagai bagian dari `FdyTable`.
23
+ - **`timepicker` keluar dari daftar "no wrapper"** (`#117`). `FdyTimepicker` ada di ketiga stack, dan
24
+ paragraf yang sama melarang menulis markup mentahnya. Yang tidak punya pembungkus adalah
25
+ `datetimepicker`.
26
+ - **`FdyChart` perlu enhancer di Vue dan React** (`#117`). Blok tempel mengatakan pembungkus bertipe
27
+ tidak perlu `import '@cahyo-dimas/freeday'`. `FdyChart` melukis lewat `window.FreedayChart`, jadi
28
+ tanpa impor itu grafiknya tidak tergambar. Dicatat di blok tempel dan di `COMPONENTS.md`.
29
+
30
+ ### Catatan
31
+
32
+ - Proyek yang menyalin blok `agent-onboarding.md` perlu menggantinya seluruhnya.
33
+ - Uji baru di `test/docs.test.mjs`: kata bilangan untuk pembungkus ditolak di tujuh dokumen, dan
34
+ nama di daftar "no wrapper" tidak boleh punya pembungkus.
35
+
36
+ ## [3.19.0] - 2026-11-09
37
+
38
+ **`FdyAutocomplete` kini berlaku seperti input.** Keduanya ketahuan saat tiga isian `<input list>`
39
+ dipindahkan ke komponen ini (`CATATAN-FREEDAY.md` §25): `maxlength` dan pesan per-kolom hilang tanpa
40
+ suara, dan isian yang punya nilai bawaan membuka daftar berisi satu saran.
41
+
42
+ ### Changed
43
+ - **Atribut yang tidak dikenal `FdyAutocomplete` mendarat di `<input>`-nya** (`#115`), di ketiga
44
+ stack: `maxlength`, `inputmode`, `name`, `data-fdy-msg-required`, dan listener. Sebelumnya atribut
45
+ itu jatuh ke `div` pembungkus di Vue, dan hilang di React serta Blazor. `class` dan `style` tetap
46
+ di akar. **Di Vue ini perubahan perilaku:** atribut seperti `data-testid` yang dulu ada di akar kini
47
+ ada di input. Yang menjadi kontrak combobox (`role`, `type`, `autocomplete`, ARIA) tetap milik
48
+ komponen. React menerima atribut input lewat tipenya; Blazor lewat `AdditionalAttributes`.
49
+ - **Daftar autocomplete terbuka utuh, dan hanya ketikan yang menyaringnya** (`#115`), di Vue, React,
50
+ dan enhancer yang dipakai Blazor serta jalur mentah. Nilai yang sudah ada di isian bukan kueri.
51
+ Penyaringan dilupakan saat daftar ditutup, jadi tombol panah juga membukanya utuh; di enhancer
52
+ sebelumnya tombol panah membuka opsi sisa saringan terakhir.
53
+
54
+ ### Fixed
55
+ - **Pesan per-kontrol `FdyAutocomplete` kini sampai ke aturan form** (`#115`), sebab aturan itu
56
+ membacanya dari input.
57
+
58
+ ### Docs
59
+ - **`.fdy-title-page` di dalam `.fdy-app` adalah `<h2>`** (`#116`, §26). `COMPONENTS.md` sudah
60
+ menyebutnya, tetapi `USAGE.md` dan `docs/agent-onboarding.md` masih berbunyi `<h1>` saja. Blok
61
+ onboarding berubah di butir 4, jadi salinannya di proyek konsumen perlu diganti saat naik versi.
62
+ - **`title` di `FdyAppShell` adalah nama halaman yang sedang dibuka**, bukan nama produk. Ia
63
+ dirender sebagai `<h1>` dokumen; nama produk tempatnya di merek sidebar (`brand`, Blazor
64
+ `BrandContent`).
65
+
66
+ ### Catatan
67
+ - **§26 tidak mengganti `<h1>` shell menjadi `<p>`.** Contoh kit selalu mengisi `title` dengan nama
68
+ halaman, jadi `<h1>`-nya memang benar. Yang keliru adalah mengisinya dengan merek.
69
+ - **§25b tidak diambil.** Premisnya, bahwa string kit lain dapat disetel sekali di `<form>`, hanya
70
+ berlaku untuk pesan validasi. Autocomplete juga dapat dipakai di luar form, dan bawaan Inggris yang
71
+ sama ada di `FdyCfl` serta `FdyTable`. Kalau dibutuhkan, bentuknya teks bawaan untuk seluruh kit.
72
+
12
73
  ## [3.18.0] - 2026-11-07
13
74
 
14
75
  **Setiap kontrol bernilai kini dapat dijadikan wajib, di ketiga stack.** 3.12.0 (`#096`) memberi
package/COMPONENTS.md CHANGED
@@ -38,7 +38,7 @@ live docs.
38
38
  any field being invalid.
39
39
  6. **Interactive components need their enhancer script.** Static ones (button, card, badge, table,
40
40
  alert, breadcrumb, timeline, accordion, tree-without-cascade…) are CSS-only.
41
- 7. **On Vue, React or Blazor, thirteen components have a typed wrapper. Use it.** `FdyCombo` ·
41
+ 7. **On Vue, React or Blazor, these components have a typed wrapper. Use it.** `FdyCombo` ·
42
42
  `FdyDatepicker` · `FdyMonthpicker` · `FdyDateRange` · `FdyTimepicker` · `FdyAutocomplete` ·
43
43
  `FdyCascade` · `FdyCfl` ·
44
44
  `FdyChart` · `FdyTable` · `FdyModal` · `FdyDrawer` · `FdyAppShell`, from `@cahyo-dimas/freeday/vue`, `/react`, or the
@@ -156,7 +156,7 @@ which is why React's list is longer while offering the same thing.
156
156
  | `navOpen?` | `boolean` | Whether the nav is visible. Optional because the default is the **viewport's**, and a caller cannot state that in one initial value. Vue binds `v-model:navOpen`. |
157
157
  | `onNavOpenChange?` | `(open: boolean) => void` | React. Visibility changed: the toggle, Escape, the backdrop, or a followed nav item. Vue emits `update:navOpen`. |
158
158
  | `navMode?` | `'push' \| 'overlay'` | How a **visible** nav sits on a **wide** viewport: `push` (default) is the column that displaces the content, `overlay` floats it over the page with a backdrop. Below the nav breakpoint it is ignored — the nav is off-canvas there by definition, so there is nothing to choose. Blazor takes the enum `FdyNavMode`. |
159
- | `title?` | `string` (Vue) · `ReactNode` | Topbar title. |
159
+ | `title?` | `string` (Vue) · `ReactNode` | Topbar title, rendered as the document's `<h1>`: the name of the **current page**, not the product. The product's name goes in the sidebar brand (Vue slot `brand`, React `brand`, Blazor `BrandContent`), and the page's own `.fdy-title-page` steps down to `<h2>`. |
160
160
  | `toggleLabel?` | `string` | Accessible name for the nav toggle button. |
161
161
  | `toggleIcon?` | `ReactNode` | React. Replaces the default hamburger; Vue uses the slot of that name. |
162
162
  | `skip?` | `ReactNode` | React. Skip link, rendered first in the tab order. |
@@ -317,7 +317,7 @@ carry the doctrine in markup.
317
317
  <header class="fdy-page__header">
318
318
  <div class="fdy-page__heading">
319
319
  <p class="fdy-eyebrow">Sales</p>
320
- <h1 class="fdy-title-page">Invoices</h1>
320
+ <h1 class="fdy-title-page">Invoices</h1><!-- <h2> inside .fdy-app: the topbar title is the <h1> -->
321
321
  <p class="fdy-page__desc">Every invoice issued this period.</p>
322
322
  </div>
323
323
  <div class="fdy-page__actions"><button class="fdy-btn">New invoice</button></div>
@@ -861,7 +861,14 @@ Blazor carries all of these. The states live on the input natively, and
861
861
  render. A `readonly` input no longer opens its suggestion list, which it used to do over a field
862
862
  nobody could edit.
863
863
 
864
- Editable combobox that filters as you type. Needs `freeday-autocomplete.js`.
864
+ **Anything the table does not name lands on the `<input>`** — `maxlength` (`maxLength` in React),
865
+ `inputmode`, `name`, a per-control `data-fdy-msg-required`, an event listener. `class` and `style`
866
+ stay on the root, which is what sizes the control. What the combobox contract depends on (`role`,
867
+ `type`, `autocomplete`, the ARIA wiring) is set by the component and cannot be overridden.
868
+
869
+ Editable combobox: **the list opens whole, and typing narrows it.** A value already in the field (a
870
+ default, a saved record) is not a query, so opening shows every option; filtering starts on the first
871
+ keystroke and is forgotten when the list closes. Needs `freeday-autocomplete.js`.
865
872
 
866
873
  - `.fdy-autocomplete` · `__listbox` `__option` `__empty`
867
874
  - The `<input>` carries `role="combobox"`, `aria-expanded`, `aria-autocomplete="list"`,
@@ -1351,7 +1358,8 @@ blur/input. Needs `freeday-form.js`.
1351
1358
  invalid, so filling one end does not erase the message the other end still needs. The message override is per-control (`data-fdy-msg-required` on the root) wherever
1352
1359
  attributes reach the root — the raw path, and Vue, where an unknown attribute falls through. In
1353
1360
  React and Blazor they do not, so use the form-level `data-fdy-text-required`, which reads the
1354
- same in every stack.
1361
+ same in every stack. `FdyAutocomplete` is the exception: it is validated on its input, and
1362
+ forwards the attribute there in all three.
1355
1363
  - **`data-value` on a control's root is the live value**, not just the seed it used to be on the
1356
1364
  datepicker, timepicker and cascade (the combo always kept it current). That is what makes the
1357
1365
  rule above possible, and it is also the handle a test or a CSS empty-state rule can read.
@@ -1798,7 +1806,7 @@ rather than rendering zero: a widget that shows 0 for a request that failed read
1798
1806
  do", the opposite of what happened.
1799
1807
 
1800
1808
  ## Charts — `data-fdy-chart`
1801
- > **Typed wrapper: `<FdyChart>`**. data props in all three (`type` + `values` / `series`); it repaints on data change, so `FreedayChart.update(el)` is only for the raw path below.
1809
+ > **Typed wrapper: `<FdyChart>`**. data props in all three (`type` + `values` / `series`); it repaints on data change, so `FreedayChart.update(el)` is only for the raw path below. It paints through the enhancer: on Vue and React it needs `import '@cahyo-dimas/freeday'` once at app entry, the one typed wrapper that does. Without it the slot content stays and no chart is drawn.
1802
1810
 
1803
1811
  ### Props — `<FdyChart>`
1804
1812
 
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.18.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.18.0)
8
+ [![Release](https://img.shields.io/badge/release-v3.19.1-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.19.1)
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`.
@@ -33,20 +33,20 @@ npm test # tes transformasi build + kontras WCAG (node:test)
33
33
 
34
34
  ### Pertama: pintu masuk mana yang kamu pakai?
35
35
 
36
- Sebagian besar Freeday itu markup + kelas `fdy-*` dan sama di mana pun. **Sebelas komponen
36
+ Sebagian besar Freeday itu markup + kelas `fdy-*` dan sama di mana pun. **Sebagian komponen
37
37
  interaktif juga punya wrapper typed.** Di stack berikut, pakai wrapper-nya, bukan markup mentah +
38
38
  enhancer:
39
39
 
40
- | Stack-mu | Impor kesebelasnya dari | Binding |
40
+ | Stack-mu | Impor wrapper-nya dari | Binding |
41
41
  |---|---|---|
42
42
  | **Vue 3** | `@cahyo-dimas/freeday/vue` | `v-model` |
43
43
  | **React 18/19** | `@cahyo-dimas/freeday/react` | `value` + `onChange` |
44
44
  | **Blazor (net8.0)** | RCL `Freeday.Blazor` | `@bind-Value` |
45
45
  | HTML statis · Svelte · template server-rendered | *(tanpa wrapper)* markup mentah + enhancer, di bawah | event `fdy-*` |
46
46
 
47
- Ketiga belasnya: `FdyCombo` · `FdyDatepicker` · `FdyMonthpicker` · `FdyDateRange` ·
47
+ Wrapper-nya: `FdyCombo` · `FdyDatepicker` · `FdyMonthpicker` · `FdyDateRange` ·
48
48
  `FdyTimepicker` · `FdyAutocomplete` · `FdyCascade` · `FdyCfl` · `FdyChart` · `FdyTable` · `FdyModal` · `FdyDrawer` ·
49
- `FdyAppShell`. Menulis markup mentah untuk ketiga belas ini di dalam Vue/React/Blazor *kelihatan* baik-baik saja pada mulanya, karena render
49
+ `FdyAppShell`. Menulis markup mentah untuk komponen-komponen ini di dalam Vue/React/Blazor *kelihatan* baik-baik saja pada mulanya, karena render
50
50
  pertamanya memang benar. Setelah itu ia rusak diam-diam: DOM yang di-render framework belakangan tak pernah ter-hydrate, dan state widget
51
51
  berakhir di DOM alih-alih di state framework-mu. Selebihnya (button, card, badge, alert, markup
52
52
  tabel, layout, dan komponen interaktif yang tak punya wrapper) sama persis di semua stack. Untuk
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.18.0-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.18.0)
8
+ [![Release](https://img.shields.io/badge/release-v3.19.1-0078d4?style=flat-square)](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.19.1)
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`.
@@ -33,18 +33,18 @@ npm test # build-transform tests + WCAG contrast (node:test)
33
33
 
34
34
  ### First: which entry point is yours?
35
35
 
36
- Most of Freeday is markup + `fdy-*` classes and is identical everywhere. **Eleven interactive
36
+ Most of Freeday is markup + `fdy-*` classes and is identical everywhere. **Some interactive
37
37
  components also ship a typed wrapper.** In those stacks, use the wrapper rather than raw markup +
38
38
  enhancer:
39
39
 
40
- | Your stack | Import the eleven from | Binding |
40
+ | Your stack | Import the wrappers from | Binding |
41
41
  |---|---|---|
42
42
  | **Vue 3** | `@cahyo-dimas/freeday/vue` | `v-model` |
43
43
  | **React 18/19** | `@cahyo-dimas/freeday/react` | `value` + `onChange` |
44
44
  | **Blazor (net8.0)** | `Freeday.Blazor` RCL | `@bind-Value` |
45
45
  | Static HTML · Svelte · server-rendered templates | *(no wrapper)* raw markup + enhancers, below | `fdy-*` events |
46
46
 
47
- The thirteen: `FdyCombo` · `FdyDatepicker` · `FdyMonthpicker` · `FdyDateRange` · `FdyTimepicker` ·
47
+ The wrappers: `FdyCombo` · `FdyDatepicker` · `FdyMonthpicker` · `FdyDateRange` · `FdyTimepicker` ·
48
48
  `FdyAutocomplete` · `FdyCascade` · `FdyCfl` · `FdyChart` · `FdyTable` · `FdyModal` · `FdyDrawer` · `FdyAppShell`.
49
49
  Hand-writing the raw
50
50
  markup for these inside Vue/React/Blazor *looks* fine at first, because the first render is correct.
package/USAGE.md CHANGED
@@ -18,7 +18,7 @@ the single biggest cause of "flat grey mush". Pick the role, not the size:
18
18
  | Role | Class | When |
19
19
  |---|---|---|
20
20
  | Eyebrow | `.fdy-eyebrow` | A small uppercase label above a page/section title. Optional. |
21
- | Page title | `.fdy-title-page` | One per screen. The `<h1>`. |
21
+ | Page title | `.fdy-title-page` | One per screen. The `<h1>` on a standalone page; `<h2>` inside `.fdy-app`, whose `.fdy-app__title` is already the `<h1>` and names the current page. |
22
22
  | Section title | `.fdy-title-section` | A region within the page (`<h2>`). |
23
23
  | Card / row title | `.fdy-title-card` (or `.fdy-card__title`) | A title inside a card or list row (`<h3>`). |
24
24
  | Body | *(default)* | Running text. |
@@ -5,8 +5,8 @@
5
5
  option list as the user types and, on pick, fills the input + emits fdy-autocomplete-select
6
6
  with the chosen text. Value is that text. The enhancer owns the input/listbox after
7
7
  hydration (ShouldRender => false); the initial value seeds the input. *@
8
- <div @ref="Root" data-fdy-autocomplete class="fdy-autocomplete">
9
- <input class="fdy-input" role="combobox" aria-expanded="false" aria-autocomplete="list"
8
+ <div @ref="Root" data-fdy-autocomplete class="@RootClass" style="@RootStyle">
9
+ <input @attributes="InputAttributes" class="fdy-input" role="combobox" aria-expanded="false" aria-autocomplete="list"
10
10
  aria-controls="@_listId" autocomplete="off" value="@Value"
11
11
  placeholder="@Placeholder" aria-label="@AriaLabel"
12
12
  id="@Id" aria-labelledby="@AriaLabelledby" aria-describedby="@Describedby"
@@ -49,6 +49,21 @@ public partial class FdyAutocomplete
49
49
  /// with the other states, so a field required only under a condition follows it (#114).</summary>
50
50
  [Parameter] public bool Required { get; set; }
51
51
 
52
+ /// <summary>Any other attribute (<c>maxlength</c>, <c>inputmode</c>, <c>name</c>, a per-control
53
+ /// <c>data-fdy-msg-required</c>) lands on the <c>&lt;input&gt;</c>; <c>class</c> and <c>style</c>
54
+ /// stay on the root, which is what sizes the control. The attributes the component sets itself
55
+ /// win, since they are written after these (#115).</summary>
56
+ [Parameter(CaptureUnmatchedValues = true)]
57
+ public IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }
58
+
59
+ private string RootClass => Unmatched("class") is { } extra ? $"fdy-autocomplete {extra}" : "fdy-autocomplete";
60
+ private string? RootStyle => Unmatched("style");
61
+ private IEnumerable<KeyValuePair<string, object>> InputAttributes =>
62
+ (AdditionalAttributes ?? new Dictionary<string, object>()).Where(a => a.Key is not ("class" or "style"));
63
+
64
+ private string? Unmatched(string name) =>
65
+ AdditionalAttributes is not null && AdditionalAttributes.TryGetValue(name, out object? value) ? value?.ToString() : null;
66
+
52
67
  protected override bool ShouldRender() => !Hydrated;
53
68
 
54
69
  protected override async Task OnParametersSetAsync()
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'react';
1
+ import type { InputHTMLAttributes, JSX } from 'react';
2
2
  import { useEffect, useId, useMemo, useRef, useState } from 'react';
3
3
  import { usePopover } from '../usePopover';
4
4
 
@@ -9,7 +9,12 @@ import { usePopover } from '../usePopover';
9
9
  // (case-insensitive substring on the trimmed query); pass server-filtered `options` and it
10
10
  // stays a no-op re-filter. `onSelect` fires only on commit (the enhancer's select event).
11
11
 
12
- export interface FdyAutocompleteProps {
12
+ /** What the component owns on its <input>, or redefines with another signature. */
13
+ type OwnedInputAttrs = 'value' | 'defaultValue' | 'onChange' | 'onSelect' | 'type' | 'role' | 'autoComplete' | 'list' | 'readOnly' | 'children' | 'dangerouslySetInnerHTML';
14
+
15
+ /** Any other input attribute (maxLength, inputMode, name, a per-control data-fdy-msg-required) lands
16
+ * on the <input>; className and style stay on the root, which is what sizes the control (#115). */
17
+ export interface FdyAutocompleteProps extends Omit<InputHTMLAttributes<HTMLInputElement>, OwnedInputAttrs> {
13
18
  value: string;
14
19
  onChange: (value: string) => void;
15
20
  options: ReadonlyArray<string>;
@@ -32,6 +37,12 @@ export interface FdyAutocompleteProps {
32
37
  }
33
38
 
34
39
  export function FdyAutocomplete(props: FdyAutocompleteProps): JSX.Element {
40
+ const {
41
+ value: _value, onChange: _onChange, options: _options, onSelect: _onSelect, emptyText: _emptyText,
42
+ placeholder: _placeholder, id: _id, ariaLabel: _ariaLabel, ariaLabelledby: _ariaLabelledby,
43
+ disabled: _disabled, readonly: _readonly, invalid: _invalid, required: _required,
44
+ describedby: _describedby, className, style, onFocus, ...inputAttrs
45
+ } = props;
35
46
  const baseId: string = useId();
36
47
  const inputId: string = props.id ?? `${baseId}-input`;
37
48
  const listboxId: string = `${baseId}-listbox`;
@@ -42,6 +53,8 @@ export function FdyAutocomplete(props: FdyAutocompleteProps): JSX.Element {
42
53
  const listboxRef = useRef<HTMLUListElement>(null);
43
54
  const [open, setOpen] = useState<boolean>(false);
44
55
  const [active, setActive] = useState<number>(-1);
56
+ /* Typed since this list opened. Until then the field's value is not a query (#115). */
57
+ const [typed, setTyped] = useState<boolean>(false);
45
58
 
46
59
  usePopover(listboxRef, inputRef, open);
47
60
  // Popover attr for React 18/19 JSX typing: set once on mount (same as FdyCombo).
@@ -54,15 +67,15 @@ export function FdyAutocomplete(props: FdyAutocompleteProps): JSX.Element {
54
67
  const isInvalid: boolean = props.invalid === true;
55
68
 
56
69
  const filtered: string[] = useMemo((): string[] => {
57
- const q: string = props.value.trim().toLowerCase();
70
+ const q: string = typed ? props.value.trim().toLowerCase() : '';
58
71
  return q === '' ? props.options.slice() : props.options.filter((o: string): boolean => o.toLowerCase().includes(q));
59
- }, [props.options, props.value]);
72
+ }, [props.options, props.value, typed]);
60
73
 
61
74
  const activeDescendant: string | undefined =
62
75
  open && active >= 0 && active < filtered.length ? optionId(active) : undefined;
63
76
 
64
77
  const openList = (): void => { if (!isDisabled && !isReadonly) setOpen(true); };
65
- const closeList = (): void => { setOpen(false); setActive(-1); };
78
+ const closeList = (): void => { setOpen(false); setActive(-1); setTyped(false); };
66
79
 
67
80
  const choose = (label: string): void => {
68
81
  props.onChange(label);
@@ -117,8 +130,9 @@ export function FdyAutocomplete(props: FdyAutocompleteProps): JSX.Element {
117
130
  }, [active, open]);
118
131
 
119
132
  return (
120
- <div ref={rootRef} className="fdy-autocomplete" onKeyDown={onKeyDown}>
133
+ <div ref={rootRef} className={className === undefined ? 'fdy-autocomplete' : `fdy-autocomplete ${className}`} style={style} onKeyDown={onKeyDown}>
121
134
  <input
135
+ {...inputAttrs}
122
136
  ref={inputRef}
123
137
  id={inputId}
124
138
  className={isInvalid ? 'fdy-input fdy-input--error' : 'fdy-input'}
@@ -138,8 +152,8 @@ export function FdyAutocomplete(props: FdyAutocompleteProps): JSX.Element {
138
152
  readOnly={isReadonly}
139
153
  required={props.required === true}
140
154
  value={props.value}
141
- onChange={(e: React.ChangeEvent<HTMLInputElement>): void => { props.onChange(e.target.value); setActive(-1); openList(); }}
142
- onFocus={openList}
155
+ onChange={(e: React.ChangeEvent<HTMLInputElement>): void => { props.onChange(e.target.value); setTyped(true); setActive(-1); openList(); }}
156
+ onFocus={(e: React.FocusEvent<HTMLInputElement>): void => { openList(); onFocus?.(e); }}
143
157
  />
144
158
  <ul
145
159
  ref={listboxRef}
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, nextTick, onBeforeUnmount, onMounted, ref, useId, watch, type ComputedRef, type Ref } from 'vue';
2
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, useAttrs, useId, watch, type ComputedRef, type Ref, type StyleValue } from 'vue';
3
3
  import { usePopover } from '../usePopover';
4
4
 
5
5
  // A controlled Vue port of freeday's autocomplete (src/freeday-autocomplete.js +
@@ -9,6 +9,23 @@ import { usePopover } from '../usePopover';
9
9
  // substring on the trimmed query); pass server-filtered `options` and it stays a no-op re-filter.
10
10
  // `select` is emitted only on commit (the enhancer's fdy-autocomplete-select event).
11
11
 
12
+ // Anything not declared below belongs on the <input> (maxlength, inputmode, name, a per-control
13
+ // data-fdy-msg-required), which is what an author of `<input>` expects; on the wrapper <div> it
14
+ // meant nothing and reported nothing (#115). class and style stay on the root, which is what sizes
15
+ // the control. Read at render, not in a computed: useAttrs() is not reactive.
16
+ defineOptions({ inheritAttrs: false });
17
+ const attrs: Record<string, unknown> = useAttrs();
18
+ function rootClass(): string | undefined {
19
+ return attrs.class as string | undefined;
20
+ }
21
+ function rootStyle(): StyleValue {
22
+ return attrs.style as StyleValue;
23
+ }
24
+ function inputAttrs(): Record<string, unknown> {
25
+ const { class: _class, style: _style, ...rest } = attrs;
26
+ return rest;
27
+ }
28
+
12
29
  const props = defineProps<{
13
30
  modelValue: string;
14
31
  options: ReadonlyArray<string>;
@@ -45,6 +62,8 @@ const inputEl: Ref<HTMLInputElement | null> = ref(null);
45
62
  const listboxEl: Ref<HTMLUListElement | null> = ref(null);
46
63
  const open: Ref<boolean> = ref(false);
47
64
  const active: Ref<number> = ref(-1);
65
+ /** Typed since this list opened. Until then the field's value is not a query (#115). */
66
+ const typed: Ref<boolean> = ref(false);
48
67
 
49
68
  // Render the listbox in the top layer so it escapes any ancestor overflow clip.
50
69
  usePopover(listboxEl, inputEl, open);
@@ -54,7 +73,7 @@ const isReadonly: ComputedRef<boolean> = computed((): boolean => props.readonly
54
73
  const isInvalid: ComputedRef<boolean> = computed((): boolean => props.invalid === true);
55
74
 
56
75
  const filtered: ComputedRef<string[]> = computed((): string[] => {
57
- const q: string = props.modelValue.trim().toLowerCase();
76
+ const q: string = typed.value ? props.modelValue.trim().toLowerCase() : '';
58
77
  return q === '' ? props.options.slice() : props.options.filter((o: string): boolean => o.toLowerCase().includes(q));
59
78
  });
60
79
 
@@ -68,6 +87,7 @@ function openList(): void {
68
87
  function closeList(): void {
69
88
  open.value = false;
70
89
  active.value = -1;
90
+ typed.value = false;
71
91
  }
72
92
  function choose(label: string): void {
73
93
  emit('update:modelValue', label);
@@ -78,6 +98,7 @@ function choose(label: string): void {
78
98
  function onInput(e: Event): void {
79
99
  const target: HTMLInputElement = e.target as HTMLInputElement;
80
100
  emit('update:modelValue', target.value);
101
+ typed.value = true;
81
102
  active.value = -1;
82
103
  openList();
83
104
  }
@@ -133,8 +154,9 @@ watch(active, async (i: number): Promise<void> => {
133
154
  </script>
134
155
 
135
156
  <template>
136
- <div ref="rootEl" class="fdy-autocomplete" @keydown="onKeydown">
157
+ <div ref="rootEl" class="fdy-autocomplete" :class="rootClass()" :style="rootStyle()" @keydown="onKeydown">
137
158
  <input
159
+ v-bind="inputAttrs()"
138
160
  :id="inputId"
139
161
  ref="inputEl"
140
162
  :class="isInvalid ? 'fdy-input fdy-input--error' : 'fdy-input'"
@@ -57,6 +57,7 @@
57
57
  input.removeAttribute('aria-activedescendant');
58
58
  active = -1;
59
59
  clearHighlight();
60
+ showAll();
60
61
  document.removeEventListener('click', onDocClick, true);
61
62
  }
62
63
  function onDocClick(e) { if (!root.contains(e.target)) close(); }
@@ -71,6 +72,14 @@
71
72
  vis[i].scrollIntoView({ block: 'nearest' });
72
73
  }
73
74
 
75
+ /* A list opens whole; only typing narrows it. A value that was already in the field (a default,
76
+ a saved record) is not a query, and filtering by it opened a one-item list that looked broken
77
+ (#115). Reset on close, so the arrow keys reopen it whole as well. */
78
+ function showAll() {
79
+ options.forEach(function (o) { o.hidden = false; });
80
+ if (emptyEl) emptyEl.hidden = options.length !== 0;
81
+ }
82
+
74
83
  function applyFilter() {
75
84
  var q = input.value.trim().toLowerCase();
76
85
  var shown = 0;
@@ -94,7 +103,11 @@
94
103
  }
95
104
 
96
105
  input.addEventListener('input', applyFilter);
97
- input.addEventListener('focus', function () { applyFilter(); });
106
+ input.addEventListener('focus', function () {
107
+ if (!listbox.hidden) return;
108
+ showAll();
109
+ open();
110
+ });
98
111
  input.addEventListener('keydown', function (e) {
99
112
  var vis = visible();
100
113
  switch (e.key) {
package/dist/freeday.js CHANGED
@@ -286,6 +286,7 @@
286
286
  input.removeAttribute('aria-activedescendant');
287
287
  active = -1;
288
288
  clearHighlight();
289
+ showAll();
289
290
  document.removeEventListener('click', onDocClick, true);
290
291
  }
291
292
  function onDocClick(e) { if (!root.contains(e.target)) close(); }
@@ -300,6 +301,14 @@
300
301
  vis[i].scrollIntoView({ block: 'nearest' });
301
302
  }
302
303
 
304
+ /* A list opens whole; only typing narrows it. A value that was already in the field (a default,
305
+ a saved record) is not a query, and filtering by it opened a one-item list that looked broken
306
+ (#115). Reset on close, so the arrow keys reopen it whole as well. */
307
+ function showAll() {
308
+ options.forEach(function (o) { o.hidden = false; });
309
+ if (emptyEl) emptyEl.hidden = options.length !== 0;
310
+ }
311
+
303
312
  function applyFilter() {
304
313
  var q = input.value.trim().toLowerCase();
305
314
  var shown = 0;
@@ -323,7 +332,11 @@
323
332
  }
324
333
 
325
334
  input.addEventListener('input', applyFilter);
326
- input.addEventListener('focus', function () { applyFilter(); });
335
+ input.addEventListener('focus', function () {
336
+ if (!listbox.hidden) return;
337
+ showAll();
338
+ open();
339
+ });
327
340
  input.addEventListener('keydown', function (e) {
328
341
  var vis = visible();
329
342
  switch (e.key) {
@@ -20,34 +20,35 @@ the **root of the consuming project**:
20
20
 
21
21
  All UI in this project is built from Freeday: a **token-driven CSS kit** (`fdy-*` classes on plain
22
22
  markup) with **typed components for Vue, React and Blazor** layered on top. Most of the kit is
23
- markup + classes; eleven interactive components also ship a typed wrapper, and in those three stacks
23
+ markup + classes; the interactive components listed below also ship a typed wrapper, and in those three stacks
24
24
  the wrapper is the correct way to use them.
25
25
 
26
26
  **0. First decide which entry point this project uses. This is not an optimisation. Get it wrong
27
27
  and the code looks correct and fails later.**
28
28
 
29
- | This project's stack | Import the eleven components from | Binding |
29
+ | This project's stack | Import the typed wrappers from | Binding |
30
30
  |---|---|---|
31
31
  | Vue 3 | `@cahyo-dimas/freeday/vue` | `v-model` |
32
32
  | React 18/19 | `@cahyo-dimas/freeday/react` | `value` + `onChange` |
33
33
  | Blazor (net8.0) | `@using Freeday.Blazor` (RCL) | `@bind-Value` |
34
34
  | Static HTML, Svelte, server-rendered templates… | no wrapper: raw markup + the enhancer script | `fdy-*` DOM events |
35
35
 
36
- The thirteen: **FdyCombo · FdyDatepicker · FdyMonthpicker · FdyDateRange · FdyTimepicker ·
36
+ The typed wrappers: **FdyCombo · FdyDatepicker · FdyMonthpicker · FdyDateRange · FdyTimepicker ·
37
37
  FdyAutocomplete · FdyCascade · FdyCfl · FdyChart · FdyTable · FdyModal · FdyDrawer · FdyAppShell**. In
38
- Vue/React/Blazor, **never hand-write the raw markup + enhancer for these thirteen.** The raw path *appears* to work: the enhancer auto-initialises
38
+ Vue/React/Blazor, **never hand-write the raw markup + enhancer for any of these.** The raw path *appears* to work: the enhancer auto-initialises
39
39
  once on `DOMContentLoaded` and the first render is correct. Then it fails quietly: DOM your framework
40
40
  renders later is never hydrated, and the widget's state lives in the DOM instead of in your
41
41
  framework's state.
42
42
 
43
43
  Everything else is the same in every stack: plain `fdy-*` markup (button, card, badge, alert,
44
44
  table markup, layout…). For the *other* interactive components (chips, stepper, input mask, file
45
- upload, tree, tabs, menu, rating, slider, form validation, carousel, timepicker) there is no
45
+ upload, tree, tabs, menu, rating, slider, form validation, carousel, datetimepicker) there is no
46
46
  wrapper, use the raw markup and hydrate it:
47
47
 
48
48
  - **Vue / React:** `useFreeday(rootRef)` from the same import path, plus `import '@cahyo-dimas/freeday'`
49
- once at app entry to register the enhancers. (The eleven typed components do **not** need this: they
50
- are native Vue/React implementations of the same markup, not wrappers over the enhancer.)
49
+ once at app entry to register the enhancers. (The typed wrappers do **not** need this: they
50
+ are native Vue/React implementations of the same markup, not wrappers over the enhancer. The one
51
+ exception is `FdyChart`, which paints through the enhancer and draws nothing without that import.)
51
52
  - **Blazor:** `FreedayBlazor.initAll` interop. (Here the typed components *are* thin wrappers over
52
53
  the enhancers, so the enhancer script is always required.)
53
54
 
@@ -68,14 +69,15 @@ wrapper, use the raw markup and hydrate it:
68
69
  2. Components only touch semantic tokens (`--color-*`), never the primitive ramp (`--azure-600`).
69
70
  3. `.fdy-btn` is already the primary action (there is no `--primary`). One per screen; everything
70
71
  else is `--ghost` or `--text`.
71
- 4. Three title roles only: `.fdy-title-page` (one `<h1>`) / `.fdy-title-section` / `.fdy-title-card`.
72
+ 4. Three title roles only: `.fdy-title-page` (one `<h1>`; `<h2>` inside `.fdy-app`, whose topbar title
73
+ is the `<h1>` and names the current page) / `.fdy-title-section` / `.fdy-title-card`.
72
74
  Never reuse a card title as a page title.
73
75
  5. Assemble from the frame down: `.fdy-app` → `.fdy-page` → `.fdy-page-section` → components.
74
76
  6. Form errors: `aria-invalid="true"` + `aria-describedby` → a `.fdy-help.fdy-help--error`.
75
77
  Icon-only buttons need `aria-label`. Status is never colour-only.
76
78
  7. Interactive components need their enhancer script loaded (see the table in COMPONENTS.md); in an
77
79
  SPA, re-hydrate dynamic DOM with `useFreeday` / `FreedayBlazor.initAll`. This applies to the
78
- components **without** a typed wrapper. For the eleven in step 0, use the wrapper instead.
80
+ components **without** a typed wrapper. For the ones listed in step 0, use the wrapper instead.
79
81
  8. Freeday owns components + tokens, **not layout**. Grids/stacks/one-off gaps come from our own
80
82
  layout layer. Build its theme on `var(--space-N)` so both systems stay in step.
81
83
  9. The enhancers render their own English UI strings (pager, filter dialog, validation). Never
@@ -102,7 +104,7 @@ Blazor). Then verify the agent can actually read those files. An agent that can'
102
104
  | `dist/freeday.media.css` | The breakpoints as `@custom-media` (`@cahyo-dimas/freeday/media`), so a responsive rule in your CSS states the kit's condition instead of a retyped literal. Needs PostCSS; carries no rules, and is **not** in the bundle. |
103
105
  | `src/components/*.css` | The authoritative source for every class, when a doc is ambiguous. |
104
106
  | `tokens/tokens.json` | Every token in W3C DTCG format, machine-readable. |
105
- | `adapters/vue` · `adapters/react` · `adapters/blazor` | Typed wrappers, 11 components each (plus `FdyTableFooter`). |
107
+ | `adapters/vue` · `adapters/react` · `adapters/blazor` | Typed wrappers: the same set in each, listed in step 0, plus `FdyTableFooter`, which is a part of `FdyTable`. |
106
108
 
107
109
  The live docs (with an interactive playground) are at
108
110
  <https://cahyo-dimas.github.io/freeday-ui-kit/>, and the repo (including three complete example
@@ -21,7 +21,7 @@ Freeday = **CSS** (semantic tokens + `fdy-*` classes) + **zero-dependency JS enh
21
21
  the enhancer owns the widget's DOM. You **listen for `fdy-*` events** (all bubbling
22
22
  `CustomEvent`s, data in `event.detail`) → store them in your framework state. Event/API contract
23
23
  table: [`integrations.md` §Event & API contract](integrations.md).
24
- **On Vue, React or Blazor this is not the path to take for thirteen of the components.** `FdyCombo`,
24
+ **On Vue, React or Blazor this is not the path to take for the components with a typed wrapper.** `FdyCombo`,
25
25
  `FdyDatepicker`, `FdyMonthpicker`, `FdyDateRange`, `FdyTimepicker`, `FdyAutocomplete`, `FdyCascade`, `FdyCfl`,
26
26
  `FdyChart`, `FdyTable`, `FdyModal`, `FdyDrawer`, `FdyAppShell` ship typed wrappers that own the state properly (Vue and
27
27
  React re-implement the interaction natively; Blazor wraps the enhancer over interop). Use them;
@@ -198,7 +198,7 @@ live docs also have a copy button per component.
198
198
  ```bash
199
199
  npm i @cahyo-dimas/freeday
200
200
  ```
201
- Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.18.0"` (public npm package). `dist/` is
201
+ Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.19.1"` (public npm package). `dist/` is
202
202
  committed and published → no build step; `npm ci` runs without auth.
203
203
 
204
204
  ### 2. Import the CSS + enhancers **once** in your entry (`src/main.ts`)
@@ -317,7 +317,7 @@ dev; `useFreeday` is idempotent, so it's safe.
317
317
  ### 5. Alternative: typed controlled components
318
318
  For fields you'd normally write as a native `<select>`/`<input type="date">`,
319
319
  `@cahyo-dimas/freeday/react` also exports typed **controlled** components with plain `value`/`onChange`,
320
- no manual event bubbling — the same eleven listed in §Core concepts #2, at parity with the Vue
320
+ no manual event bubbling — the same set listed in §Core concepts #2, at parity with the Vue
321
321
  `v-model` components above:
322
322
  ```tsx
323
323
  import { FdyCombo } from '@cahyo-dimas/freeday/react';
@@ -452,7 +452,7 @@ kit's CSS/enhancers), then bind:
452
452
  <FdyChart Type="donut" Values="_byCity" Labels="_cityLabels" AriaLabel="Revenue by city" />
453
453
  <FdyDrawer @bind-Open="_drawerOpen" Title="Detail" Side="right">…</FdyDrawer>
454
454
  ```
455
- Thirteen components at parity with the Vue/React adapters: **`FdyModal`** · **`FdyDrawer`** (`@bind-Open`,
455
+ The same components, at parity with the Vue/React adapters: **`FdyModal`** · **`FdyDrawer`** (`@bind-Open`,
456
456
  `Title`, `Size`/`Side`, `Dismissible`) · **`FdyCombo<TValue>`** · **`FdyDatepicker`** ·
457
457
  **`FdyMonthpicker`** (`@bind-Value` as `yyyy-MM`) · **`FdyTimepicker`** (`@bind-Value` as `HH:MM`) · **`FdyAutocomplete`** · **`FdyCascade`** · **`FdyDateRange`** (`@bind-From`/`@bind-To`) ·
458
458
  **`FdyCfl<TRow>`** (async `LoadPage`) · **`FdyChart`** · **`FdyTable<TRow>`** (client sort/filter/page,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cahyo-dimas/freeday",
3
- "version": "3.18.0",
3
+ "version": "3.19.1",
4
4
  "description": "Freeday: token-driven, framework-agnostic UI KIT (design source-of-truth).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -97,7 +97,7 @@
97
97
  "scripts": {
98
98
  "build": "node tokens/build.mjs",
99
99
  "test": "node --test",
100
- "test:browser": "node --test --test-concurrency=3 browser/color-mix.mjs browser/vanilla.mjs browser/adapter.mjs browser/layout.mjs browser/theme.mjs browser/state.mjs browser/root-init.mjs browser/upload-states.mjs browser/number.mjs browser/card-stretch.mjs browser/stretch-warn.mjs browser/hidden-attr.mjs browser/form-grid-rows.mjs browser/theme-pref.mjs browser/text-override.mjs browser/control-heights.mjs browser/field-width.mjs browser/cfl-multi.mjs browser/cfl-dialog-only.mjs browser/crowding.mjs browser/over-dialog.mjs browser/chart-scale.mjs browser/overlay-stack.mjs browser/chart-a11y.mjs browser/app-shell.mjs browser/bottom-nav.mjs browser/picker-states.mjs browser/tabs-strip.mjs browser/tabs-vertical.mjs browser/menu-align.mjs browser/cfl-narrow.mjs browser/form-reveal.mjs browser/confirm-search-copy.mjs browser/daterange-settled.mjs browser/display-parts.mjs browser/table-empty.mjs browser/table-footer-text.mjs browser/month-mode.mjs browser/monthpicker.mjs browser/page-columns.mjs browser/table-hover.mjs browser/typed-popover.mjs browser/filter-parity.mjs browser/filter-wrap.mjs browser/filter-stack.mjs browser/timepicker.mjs browser/form-kit-required.mjs browser/form-required-rest.mjs browser/picker-in-modal.mjs browser/harness-contract.mjs browser/app-owned.mjs browser/sortable.mjs browser/modal-phone.mjs browser/empty-ref.mjs browser/stack-standalone.mjs",
100
+ "test:browser": "node --test --test-concurrency=3 browser/color-mix.mjs browser/vanilla.mjs browser/adapter.mjs browser/layout.mjs browser/theme.mjs browser/state.mjs browser/root-init.mjs browser/upload-states.mjs browser/number.mjs browser/card-stretch.mjs browser/stretch-warn.mjs browser/hidden-attr.mjs browser/form-grid-rows.mjs browser/theme-pref.mjs browser/text-override.mjs browser/control-heights.mjs browser/field-width.mjs browser/cfl-multi.mjs browser/cfl-dialog-only.mjs browser/crowding.mjs browser/over-dialog.mjs browser/chart-scale.mjs browser/overlay-stack.mjs browser/chart-a11y.mjs browser/app-shell.mjs browser/bottom-nav.mjs browser/picker-states.mjs browser/tabs-strip.mjs browser/tabs-vertical.mjs browser/menu-align.mjs browser/cfl-narrow.mjs browser/form-reveal.mjs browser/confirm-search-copy.mjs browser/daterange-settled.mjs browser/display-parts.mjs browser/table-empty.mjs browser/table-footer-text.mjs browser/month-mode.mjs browser/monthpicker.mjs browser/page-columns.mjs browser/table-hover.mjs browser/typed-popover.mjs browser/filter-parity.mjs browser/filter-wrap.mjs browser/filter-stack.mjs browser/timepicker.mjs browser/form-kit-required.mjs browser/form-required-rest.mjs browser/autocomplete-open.mjs browser/picker-in-modal.mjs browser/harness-contract.mjs browser/app-owned.mjs browser/sortable.mjs browser/modal-phone.mjs browser/empty-ref.mjs browser/stack-standalone.mjs",
101
101
  "prepack": "node tokens/build.mjs",
102
102
  "version": "node tokens/build.mjs && git add dist",
103
103
  "typecheck:react": "tsc -p adapters/react/tsconfig.json --noEmit",