Add a default 256 maxlength value to all input fields

This commit is contained in:
Xavier Julian 2025-03-26 14:02:50 +01:00 committed by Xaviju
parent c1853a71a9
commit b1df0ac194
7 changed files with 22 additions and 3 deletions

View file

@ -10,6 +10,7 @@
[app.main.style :as stl])
(:require
[app.common.data :as d]
[app.main.constants :refer [max-input-length]]
[app.main.ui.ds.controls.shared.options-dropdown :refer [options-dropdown*]]
[app.main.ui.ds.foundations.assets.icon :refer [icon* icon-list] :as i]
[app.util.array :as array]
@ -60,6 +61,7 @@
[:id {:optional true} :string]
[:options [:vector schema:combobox-option]]
[:class {:optional true} :string]
[:max-length {:optional true} :int]
[:placeholder {:optional true} :string]
[:disabled {:optional true} :boolean]
[:default-selected {:optional true} :string]
@ -69,7 +71,7 @@
(mf/defc combobox*
{::mf/props :obj
::mf/schema schema:combobox}
[{:keys [id options class placeholder disabled has-error default-selected on-change] :rest props}]
[{:keys [id options class placeholder disabled has-error default-selected on-change max-length] :rest props}]
(let [open* (mf/use-state false)
open (deref open*)
@ -240,6 +242,7 @@
:aria-activedescendant focused
:class (stl/css :input)
:data-testid "combobox-input"
:maxlength (d/nilv max-length max-input-length)
:disabled disabled
:value selected
:on-change on-input-change