♻️ Remove mf/props obj from DS components

This commit is contained in:
Eva Marco 2025-05-23 12:57:02 +02:00
parent b561ad033c
commit 603e41bbfd
28 changed files with 25 additions and 55 deletions

View file

@ -22,8 +22,7 @@
[:maybe [:enum "primary" "secondary" "ghost" "destructive"]]]]) [:maybe [:enum "primary" "secondary" "ghost" "destructive"]]]])
(mf/defc button* (mf/defc button*
{::mf/props :obj {::mf/schema schema:button}
::mf/schema schema:button}
[{:keys [variant icon children class on-ref] :rest props}] [{:keys [variant icon children class on-ref] :rest props}]
(let [variant (or variant "primary") (let [variant (or variant "primary")
class (dm/str class " " (stl/css-case :button true class (dm/str class " " (stl/css-case :button true

View file

@ -24,8 +24,7 @@
[:maybe [:enum "primary" "secondary" "ghost" "destructive" "action"]]]]) [:maybe [:enum "primary" "secondary" "ghost" "destructive" "action"]]]])
(mf/defc icon-button* (mf/defc icon-button*
{::mf/props :obj {::mf/schema schema:icon-button}
::mf/schema schema:icon-button}
[{:keys [class icon icon-class variant aria-label children tooltip-id] :rest props}] [{:keys [class icon icon-class variant aria-label children tooltip-id] :rest props}]
(let [variant (or variant "primary") (let [variant (or variant "primary")
class (dm/str class " " (stl/css-case :icon-button true class (dm/str class " " (stl/css-case :icon-button true

View file

@ -62,8 +62,7 @@
[:has-error {:optional true} :boolean]]) [:has-error {:optional true} :boolean]])
(mf/defc combobox* (mf/defc combobox*
{::mf/props :obj {::mf/schema schema:combobox}
::mf/schema schema:combobox}
[{:keys [id options class placeholder disabled has-error default-selected max-length on-change] :rest props}] [{:keys [id options class placeholder disabled has-error default-selected max-length on-change] :rest props}]
(let [is-open* (mf/use-state false) (let [is-open* (mf/use-state false)
is-open (deref is-open*) is-open (deref is-open*)

View file

@ -33,8 +33,7 @@
[:hint-type {:optional true} [:maybe [:enum "hint" "error" "warning"]]]]) [:hint-type {:optional true} [:maybe [:enum "hint" "error" "warning"]]]])
(mf/defc input* (mf/defc input*
{::mf/props :obj {::mf/forward-ref true
::mf/forward-ref true
::mf/schema schema:input} ::mf/schema schema:input}
[{:keys [id class label is-optional type max-length variant hint-message hint-type] :rest props} ref] [{:keys [id class label is-optional type max-length variant hint-message hint-type] :rest props} ref]
(let [id (or id (mf/use-id)) (let [id (or id (mf/use-id))

View file

@ -69,8 +69,7 @@
[:on-change {:optional true} fn?]]) [:on-change {:optional true} fn?]])
(mf/defc select* (mf/defc select*
{::mf/props :obj {::mf/schema schema:select}
::mf/schema schema:select}
[{:keys [options class disabled default-selected on-change] :rest props}] [{:keys [options class disabled default-selected on-change] :rest props}]
(let [open* (mf/use-state false) (let [open* (mf/use-state false)
open (deref open*) open (deref open*)

View file

@ -13,8 +13,7 @@
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(mf/defc option* (mf/defc option*
{::mf/props :obj {::mf/private true}
::mf/private true}
[{:keys [id label icon aria-label on-click selected set-ref focused] :rest props}] [{:keys [id label icon aria-label on-click selected set-ref focused] :rest props}]
[:> :li {:value id [:> :li {:value id

View file

@ -19,8 +19,7 @@
[:class {:optional true} :string]]) [:class {:optional true} :string]])
(mf/defc hint-message* (mf/defc hint-message*
{::mf/props :obj {::mf/schema schema::hint-message}
::mf/schema schema::hint-message}
[{:keys [id class message type] :rest props}] [{:keys [id class message type] :rest props}]
(let [type (d/nilv type :hint)] (let [type (d/nilv type :hint)]
[:> "div" {:class (dm/str class " " (stl/css-case [:> "div" {:class (dm/str class " " (stl/css-case

View file

@ -30,8 +30,7 @@
[:slot-end {:optional true} [:maybe some?]]]) [:slot-end {:optional true} [:maybe some?]]])
(mf/defc input-field* (mf/defc input-field*
{::mf/props :obj {::mf/forward-ref true
::mf/forward-ref true
::mf/schema schema:input-field} ::mf/schema schema:input-field}
[{:keys [id icon has-hint hint-type class type max-length variant slot-start slot-end] :rest props} ref] [{:keys [id icon has-hint hint-type class type max-length variant slot-start slot-end] :rest props} ref]
(let [input-ref (mf/use-ref) (let [input-ref (mf/use-ref)

View file

@ -17,8 +17,7 @@
[:class {:optional true} :string]]) [:class {:optional true} :string]])
(mf/defc label* (mf/defc label*
{::mf/props :obj {::mf/schema schema::label}
::mf/schema schema::label}
[{:keys [class for is-optional children] :rest props}] [{:keys [class for is-optional children] :rest props}]
(let [is-optional (or is-optional false) (let [is-optional (or is-optional false)
props (mf/spread-props props {:class (dm/str class " " (stl/css :label)) props (mf/spread-props props {:class (dm/str class " " (stl/css :label))

View file

@ -300,8 +300,7 @@
[:maybe [:enum "s" "m"]]]]) [:maybe [:enum "s" "m"]]]])
(mf/defc icon* (mf/defc icon*
{::mf/props :obj {::mf/schema schema:icon}
::mf/schema schema:icon}
[{:keys [icon-id size class] :rest props}] [{:keys [icon-id size class] :rest props}]
(let [class (dm/str (or class "") " " (stl/css :icon)) (let [class (dm/str (or class "") " " (stl/css :icon))
props (mf/spread-props props {:class class :width icon-size-m :height icon-size-m}) props (mf/spread-props props {:class class :width icon-size-m :height icon-size-m})

View file

@ -33,7 +33,6 @@
(def raw-svg-list "A collection of all raw SVG assets" (collect-raw-svgs)) (def raw-svg-list "A collection of all raw SVG assets" (collect-raw-svgs))
(mf/defc raw-svg* (mf/defc raw-svg*
{::mf/props :obj}
[{:keys [id] :rest props}] [{:keys [id] :rest props}]
(assert (contains? raw-svg-list id) "invalid raw svg id") (assert (contains? raw-svg-list id) "invalid raw svg id")
[:> "svg" props [:> "svg" props

View file

@ -26,8 +26,7 @@
[:typography [:and :string [:fn #(valid-typography? (dm/str %))]]]]) [:typography [:and :string [:fn #(valid-typography? (dm/str %))]]]])
(mf/defc heading* (mf/defc heading*
{::mf/props :obj {::mf/schema schema:heading}
::mf/schema schema:heading}
[{:keys [level typography class children] :rest props}] [{:keys [level typography class children] :rest props}]
(let [level (or level "1") (let [level (or level "1")

View file

@ -22,8 +22,7 @@
[:typography [:and :string [:fn #(valid-typography? (dm/str %))]]]]) [:typography [:and :string [:fn #(valid-typography? (dm/str %))]]]])
(mf/defc text* (mf/defc text*
{::mf/props :obj {::mf/schema schema:text}
::mf/schema schema:text}
[{:keys [as typography children class] :rest props}] [{:keys [as typography children class] :rest props}]
(let [as (if (or (empty? as) (nil? as)) "p" as) (let [as (if (or (empty? as) (nil? as)) "p" as)

View file

@ -18,8 +18,7 @@
[:icon-id [:and :string [:fn #(contains? token-status-list %)]]]]) [:icon-id [:and :string [:fn #(contains? token-status-list %)]]]])
(mf/defc token-status-icon* (mf/defc token-status-icon*
{::mf/props :obj {::mf/schema schema:token-status-icon}
::mf/schema schema:token-status-icon}
[{:keys [icon-id class] :rest props}] [{:keys [icon-id class] :rest props}]
(let [class (dm/str (or class "") " " (stl/css :token-icon)) (let [class (dm/str (or class "") " " (stl/css :token-icon))
props (mf/spread-props props {:class class :width "14px" :height "14px"}) props (mf/spread-props props {:class class :width "14px" :height "14px"})

View file

@ -17,8 +17,7 @@
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(mf/defc tab* (mf/defc tab*
{::mf/props :obj {::mf/private true}
::mf/private true}
[{:keys [selected icon label aria-label id on-ref] :rest props}] [{:keys [selected icon label aria-label id on-ref] :rest props}]
(let [class (stl/css-case :tab true (let [class (stl/css-case :tab true
:selected selected) :selected selected)

View file

@ -23,8 +23,7 @@
(mf/defc context-notification* (mf/defc context-notification*
"Persistent notifications, they do not disappear. "Persistent notifications, they do not disappear.
These are contextual messages in specific areas of the tool, usually in modals and Dashboard area, and are mainly informative." These are contextual messages in specific areas of the tool, usually in modals and Dashboard area, and are mainly informative."
{::mf/props :obj {::mf/schema schema:context-notification}
::mf/schema schema:context-notification}
[{:keys [class type appearance level is-html children] :rest props}] [{:keys [class type appearance level is-html children] :rest props}]
(let [class (dm/str class " " (stl/css-case :contextual-notification true (let [class (dm/str class " " (stl/css-case :contextual-notification true
:contain-html is-html :contain-html is-html

View file

@ -34,8 +34,7 @@
[:on-toggle-detail {:optional true} [:maybe fn?]]]) [:on-toggle-detail {:optional true} [:maybe fn?]]])
(mf/defc notification-pill* (mf/defc notification-pill*
{::mf/props :obj {::mf/schema schema:notification-pill}
::mf/schema schema:notification-pill}
[{:keys [level type is-html appearance detail children show-detail on-toggle-detail]}] [{:keys [level type is-html appearance detail children show-detail on-toggle-detail]}]
(let [class (stl/css-case :appearance-neutral (= appearance :neutral) (let [class (stl/css-case :appearance-neutral (= appearance :neutral)
:appearance-ghost (= appearance :ghost) :appearance-ghost (= appearance :ghost)

View file

@ -26,8 +26,7 @@
[:on-toggle-detail {:optional true} [:maybe fn?]]]) [:on-toggle-detail {:optional true} [:maybe fn?]]])
(mf/defc toast* (mf/defc toast*
{::mf/props :obj {::mf/schema schema:toast}
::mf/schema schema:toast}
[{:keys [class level appearance type is-html children detail show-detail on-close on-toggle-detail] :rest props}] [{:keys [class level appearance type is-html children detail show-detail on-close on-toggle-detail] :rest props}]
(let [class (dm/str class " " (stl/css :toast)) (let [class (dm/str class " " (stl/css :toast))
level (if (string? level) level (if (string? level)

View file

@ -29,8 +29,7 @@
[:snapshots [:vector [:fn valid-date?]]]]) [:snapshots [:vector [:fn valid-date?]]]])
(mf/defc autosaved-milestone* (mf/defc autosaved-milestone*
{::mf/props :obj {::mf/schema schema:milestone}
::mf/schema schema:milestone}
[{:keys [class active versionToggled label autosavedMessage snapshots [{:keys [class active versionToggled label autosavedMessage snapshots
onClickSnapshotMenu onToggleExpandSnapshots] :rest props}] onClickSnapshotMenu onToggleExpandSnapshots] :rest props}]
(let [class (d/append-class class (stl/css-case :milestone true :is-selected active)) (let [class (d/append-class class (stl/css-case :milestone true :is-selected active))

View file

@ -24,8 +24,7 @@
[:maybe [:enum "S" "M" "L"]]]]) [:maybe [:enum "S" "M" "L"]]]])
(mf/defc avatar* (mf/defc avatar*
{::mf/props :obj {::mf/schema schema:avatar}
::mf/schema schema:avatar}
[{:keys [tag class name color url selected variant] :rest props}] [{:keys [tag class name color url selected variant] :rest props}]
(let [variant (or variant "S") (let [variant (or variant "S")

View file

@ -19,8 +19,7 @@
[:title :string]]) [:title :string]])
(mf/defc cta* (mf/defc cta*
{::mf/props :obj {::mf/schema schema:cta}
::mf/schema schema:cta}
[{:keys [class title children] :rest props}] [{:keys [class title children] :rest props}]
(let [class (d/append-class class (stl/css :cta)) (let [class (d/append-class class (stl/css :cta))

View file

@ -22,8 +22,7 @@
[:type {:optional true} [:maybe [:enum 1 2]]]]) [:type {:optional true} [:maybe [:enum 1 2]]]])
(mf/defc empty-placeholder* (mf/defc empty-placeholder*
{::mf/props :obj {::mf/schema schema:empty-placeholder}
::mf/schema schema:empty-placeholder}
[{:keys [class title subtitle type children] :rest props}] [{:keys [class title subtitle type children] :rest props}]
(let [class (dm/str class " " (stl/css :empty-placeholder)) (let [class (dm/str class " " (stl/css :empty-placeholder))

View file

@ -20,8 +20,7 @@
[:on-blur {:optional true} fn?]]) [:on-blur {:optional true} fn?]])
(mf/defc input-with-meta* (mf/defc input-with-meta*
{::mf/props :obj {::mf/schema schema:input-with-meta}
::mf/schema schema:input-with-meta}
[{:keys [value meta on-blur] :rest props}] [{:keys [value meta on-blur] :rest props}]
(let [editing* (mf/use-state false) (let [editing* (mf/use-state false)
editing? (deref editing*) editing? (deref editing*)

View file

@ -38,8 +38,7 @@
[:onKeyDownInput {:optional true} [:maybe [:fn fn?]]]]) [:onKeyDownInput {:optional true} [:maybe [:fn fn?]]]])
(mf/defc user-milestone* (mf/defc user-milestone*
{::mf/props :obj {::mf/schema schema:milestone}
::mf/schema schema:milestone}
[{:keys [class active editing user label date [{:keys [class active editing user label date
onOpenMenu onFocusInput onBlurInput onKeyDownInput] :rest props}] onOpenMenu onFocusInput onBlurInput onKeyDownInput] :rest props}]
(let [class (d/append-class class (stl/css-case :milestone true :is-selected active)) (let [class (d/append-class class (stl/css-case :milestone true :is-selected active))

View file

@ -12,7 +12,6 @@
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(mf/defc story-grid* (mf/defc story-grid*
{::mf/props :obj}
[{:keys [children size style] :rest other}] [{:keys [children size style] :rest other}]
(let [class (stl/css :story-grid) (let [class (stl/css :story-grid)
size (or size 16) size (or size 16)
@ -22,21 +21,18 @@
[:> "article" props children])) [:> "article" props children]))
(mf/defc story-grid-cell* (mf/defc story-grid-cell*
{::mf/props :obj}
[{:keys [children] :rest other}] [{:keys [children] :rest other}]
(let [class (stl/css :story-grid-cell) (let [class (stl/css :story-grid-cell)
props (mf/spread-props other {:class class})] props (mf/spread-props other {:class class})]
[:> "article" props children])) [:> "article" props children]))
(mf/defc story-header* (mf/defc story-header*
{::mf/props :obj}
[{:keys [children] :rest other}] [{:keys [children] :rest other}]
(let [class (stl/css :story-header) (let [class (stl/css :story-header)
props (mf/spread-props other {:class class})] props (mf/spread-props other {:class class})]
[:> "header" props children])) [:> "header" props children]))
(mf/defc story-grid-row* (mf/defc story-grid-row*
{::mf/props :obj}
[{:keys [children] :rest other}] [{:keys [children] :rest other}]
(let [class (stl/css :story-grid-row) (let [class (stl/css :story-grid-row)
props (mf/spread-props other {:class class})] props (mf/spread-props other {:class class})]

View file

@ -116,8 +116,7 @@
[:maybe [:enum "top" "bottom" "left" "right" "top-right" "bottom-right" "bottom-left" "top-left"]]]]) [:maybe [:enum "top" "bottom" "left" "right" "top-right" "bottom-right" "bottom-left" "top-left"]]]])
(mf/defc tooltip* (mf/defc tooltip*
{::mf/props :obj {::mf/schema schema:tooltip}
::mf/schema schema:tooltip}
[{:keys [class id children tooltip-content placement offset delay] :rest props}] [{:keys [class id children tooltip-content placement offset delay] :rest props}]
(let [placement* (mf/use-state #(d/nilv placement "top")) (let [placement* (mf/use-state #(d/nilv placement "top"))
placement (deref placement*) placement (deref placement*)

View file

@ -28,8 +28,7 @@
[:typography {:optional true} :string]]) [:typography {:optional true} :string]])
(mf/defc date* (mf/defc date*
{::mf/props :obj {::mf/schema schema:date}
::mf/schema schema:date}
[{:keys [class date selected typography] :rest props}] [{:keys [class date selected typography] :rest props}]
(let [class (d/append-class class (stl/css-case :date true :is-selected selected)) (let [class (d/append-class class (stl/css-case :date true :is-selected selected))
date (cond-> date (not (dt/datetime? date)) dt/datetime) date (cond-> date (not (dt/datetime? date)) dt/datetime)