@cahyo-dimas/freeday 3.18.0 → 3.19.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 +37 -0
- package/COMPONENTS.md +12 -4
- package/README.id.md +1 -1
- package/README.md +1 -1
- package/USAGE.md +1 -1
- package/adapters/blazor/FdyAutocomplete.razor +2 -2
- package/adapters/blazor/FdyAutocomplete.razor.cs +15 -0
- package/adapters/react/components/FdyAutocomplete.tsx +22 -8
- package/adapters/vue/components/FdyAutocomplete.vue +25 -3
- package/dist/freeday-autocomplete.js +14 -1
- package/dist/freeday.js +14 -1
- package/docs/agent-onboarding.md +2 -1
- package/docs/getting-started.md +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,43 @@ 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.0] - 2026-11-09
|
|
13
|
+
|
|
14
|
+
**`FdyAutocomplete` kini berlaku seperti input.** Keduanya ketahuan saat tiga isian `<input list>`
|
|
15
|
+
dipindahkan ke komponen ini (`CATATAN-FREEDAY.md` §25): `maxlength` dan pesan per-kolom hilang tanpa
|
|
16
|
+
suara, dan isian yang punya nilai bawaan membuka daftar berisi satu saran.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Atribut yang tidak dikenal `FdyAutocomplete` mendarat di `<input>`-nya** (`#115`), di ketiga
|
|
20
|
+
stack: `maxlength`, `inputmode`, `name`, `data-fdy-msg-required`, dan listener. Sebelumnya atribut
|
|
21
|
+
itu jatuh ke `div` pembungkus di Vue, dan hilang di React serta Blazor. `class` dan `style` tetap
|
|
22
|
+
di akar. **Di Vue ini perubahan perilaku:** atribut seperti `data-testid` yang dulu ada di akar kini
|
|
23
|
+
ada di input. Yang menjadi kontrak combobox (`role`, `type`, `autocomplete`, ARIA) tetap milik
|
|
24
|
+
komponen. React menerima atribut input lewat tipenya; Blazor lewat `AdditionalAttributes`.
|
|
25
|
+
- **Daftar autocomplete terbuka utuh, dan hanya ketikan yang menyaringnya** (`#115`), di Vue, React,
|
|
26
|
+
dan enhancer yang dipakai Blazor serta jalur mentah. Nilai yang sudah ada di isian bukan kueri.
|
|
27
|
+
Penyaringan dilupakan saat daftar ditutup, jadi tombol panah juga membukanya utuh; di enhancer
|
|
28
|
+
sebelumnya tombol panah membuka opsi sisa saringan terakhir.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- **Pesan per-kontrol `FdyAutocomplete` kini sampai ke aturan form** (`#115`), sebab aturan itu
|
|
32
|
+
membacanya dari input.
|
|
33
|
+
|
|
34
|
+
### Docs
|
|
35
|
+
- **`.fdy-title-page` di dalam `.fdy-app` adalah `<h2>`** (`#116`, §26). `COMPONENTS.md` sudah
|
|
36
|
+
menyebutnya, tetapi `USAGE.md` dan `docs/agent-onboarding.md` masih berbunyi `<h1>` saja. Blok
|
|
37
|
+
onboarding berubah di butir 4, jadi salinannya di proyek konsumen perlu diganti saat naik versi.
|
|
38
|
+
- **`title` di `FdyAppShell` adalah nama halaman yang sedang dibuka**, bukan nama produk. Ia
|
|
39
|
+
dirender sebagai `<h1>` dokumen; nama produk tempatnya di merek sidebar (`brand`, Blazor
|
|
40
|
+
`BrandContent`).
|
|
41
|
+
|
|
42
|
+
### Catatan
|
|
43
|
+
- **§26 tidak mengganti `<h1>` shell menjadi `<p>`.** Contoh kit selalu mengisi `title` dengan nama
|
|
44
|
+
halaman, jadi `<h1>`-nya memang benar. Yang keliru adalah mengisinya dengan merek.
|
|
45
|
+
- **§25b tidak diambil.** Premisnya, bahwa string kit lain dapat disetel sekali di `<form>`, hanya
|
|
46
|
+
berlaku untuk pesan validasi. Autocomplete juga dapat dipakai di luar form, dan bawaan Inggris yang
|
|
47
|
+
sama ada di `FdyCfl` serta `FdyTable`. Kalau dibutuhkan, bentuknya teks bawaan untuk seluruh kit.
|
|
48
|
+
|
|
12
49
|
## [3.18.0] - 2026-11-07
|
|
13
50
|
|
|
14
51
|
**Setiap kontrol bernilai kini dapat dijadikan wajib, di ketiga stack.** 3.12.0 (`#096`) memberi
|
package/COMPONENTS.md
CHANGED
|
@@ -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
|
-
|
|
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.
|
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
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.19.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`.
|
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
|
[](https://cahyo-dimas.github.io/freeday-ui-kit/)
|
|
8
|
-
[](https://github.com/cahyo-dimas/freeday-ui-kit/tree/v3.19.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`.
|
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="
|
|
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><input></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
|
-
|
|
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=
|
|
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 () {
|
|
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 () {
|
|
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) {
|
package/docs/agent-onboarding.md
CHANGED
|
@@ -68,7 +68,8 @@ wrapper, use the raw markup and hydrate it:
|
|
|
68
68
|
2. Components only touch semantic tokens (`--color-*`), never the primitive ramp (`--azure-600`).
|
|
69
69
|
3. `.fdy-btn` is already the primary action (there is no `--primary`). One per screen; everything
|
|
70
70
|
else is `--ghost` or `--text`.
|
|
71
|
-
4. Three title roles only: `.fdy-title-page` (one `<h1>`
|
|
71
|
+
4. Three title roles only: `.fdy-title-page` (one `<h1>`; `<h2>` inside `.fdy-app`, whose topbar title
|
|
72
|
+
is the `<h1>` and names the current page) / `.fdy-title-section` / `.fdy-title-card`.
|
|
72
73
|
Never reuse a card title as a page title.
|
|
73
74
|
5. Assemble from the frame down: `.fdy-app` → `.fdy-page` → `.fdy-page-section` → components.
|
|
74
75
|
6. Form errors: `aria-invalid="true"` + `aria-describedby` → a `.fdy-help.fdy-help--error`.
|
package/docs/getting-started.md
CHANGED
|
@@ -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.
|
|
201
|
+
Lands in `package.json` as `"@cahyo-dimas/freeday": "^3.19.0"` (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`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cahyo-dimas/freeday",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
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",
|