mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 14:42:56 +00:00
WIP
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
|
||||
(defn- validate-token-with [token validators]
|
||||
(if-let [error (some (fn [validate] (validate token)) validators)]
|
||||
(rx/throw {:errors [error]})
|
||||
(rx/throw {:errors [error] :pepito "kakota"})
|
||||
(rx/of token)))
|
||||
|
||||
(def ^:private default-validators
|
||||
@@ -151,7 +151,10 @@
|
||||
;; Simple validation of the editing token
|
||||
(rx/mapcat #(validate-token-with % validators))
|
||||
;; Resolving token via StyleDictionary
|
||||
(rx/mapcat #(validate-resolve-token % prev-token tokens)))))
|
||||
(rx/mapcat #(validate-resolve-token % prev-token tokens))
|
||||
(rx/catch (fn [e] (if (contains? e :errors)
|
||||
{:errors (:errors e)}
|
||||
(rx/throw e)))))))
|
||||
|
||||
(defn- check-coll-self-reference
|
||||
"Invalidate a collection of `token-vals` for a self-refernce against `token-name`.,"
|
||||
@@ -626,6 +629,7 @@
|
||||
:type token-type
|
||||
:on-blur on-update-value
|
||||
:on-change on-update-value
|
||||
:on-external-update-value on-external-update-value
|
||||
:token-resolve-result token-resolve-result}]))]
|
||||
[:div {:class (stl/css :input-row)}
|
||||
[:> input* {:label (tr "workspace.tokens.token-description")
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
(mf/defc input-token*
|
||||
{::mf/forward-ref true
|
||||
::mf/schema schema::input-token}
|
||||
[{:keys [class label token-resolve-result tokens empty-to-end type] :rest props} ref]
|
||||
[{:keys [class label token-resolve-result tokens empty-to-end type on-external-update-value] :rest props} ref]
|
||||
(let [error (not (nil? (:errors token-resolve-result)))
|
||||
id (mf/use-id)
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
sorted-tokens)
|
||||
no-sets? (nil? sorted-tokens)]
|
||||
(generate-dropdown-options options no-sets?))))
|
||||
|
||||
|
||||
update-input
|
||||
(mf/use-fn
|
||||
(mf/deps ref)
|
||||
@@ -231,7 +231,8 @@
|
||||
option (get-option options id)
|
||||
name (get option :name)
|
||||
new-value (str "{" name "}")]
|
||||
(update-input new-value))))
|
||||
(on-external-update-value new-value)
|
||||
(reset! is-open* false))))
|
||||
|
||||
open-dropdown
|
||||
(mf/use-fn
|
||||
@@ -251,7 +252,7 @@
|
||||
:ref open-dropdown-ref
|
||||
:on-click open-dropdown}]))
|
||||
:ref ref})]
|
||||
|
||||
|
||||
(mf/with-effect [dropdown-options]
|
||||
(mf/set-ref-val! options-ref dropdown-options))
|
||||
[:*
|
||||
|
||||
Reference in New Issue
Block a user