diff --git a/CHANGES.md b/CHANGES.md index 6ec5fb7c32..a0cfc69ca7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ - Fix title on shared button [Taiga #13730](https://tree.taiga.io/project/penpot/issue/13730) - Fix hover on layers [Taiga #13799](https://tree.taiga.io/project/penpot/issue/13799) - Fix highlight after name edition [Taiga #13783](https://tree.taiga.io/project/penpot/issue/13783) +- Fix id prop on switch component [Taiga #13534](https://tree.taiga.io/project/penpot/issue/13534) ## 2.14.2 diff --git a/frontend/src/app/main/ui/ds/controls/switch.cljs b/frontend/src/app/main/ui/ds/controls/switch.cljs index 8786c8809f..c673497008 100644 --- a/frontend/src/app/main/ui/ds/controls/switch.cljs +++ b/frontend/src/app/main/ui/ds/controls/switch.cljs @@ -16,7 +16,6 @@ (def ^:private schema:switch [:map - [:id {:optional true} :string] [:class {:optional true} :string] [:label {:optional true} [:maybe :string]] [:aria-label {:optional true} [:maybe :string]] @@ -26,10 +25,12 @@ (mf/defc switch* {::mf/schema schema:switch} - [{:keys [id class label aria-label default-checked on-change disabled] :rest props} ref] + [{:keys [class label aria-label default-checked on-change disabled] :rest props} ref] (let [checked* (mf/use-state default-checked) checked? (deref checked*) + id (mf/use-id) + disabled? (d/nilv disabled false) has-label? (not (str/blank? label)) diff --git a/frontend/src/app/main/ui/workspace/tokens/themes/create_modal.cljs b/frontend/src/app/main/ui/workspace/tokens/themes/create_modal.cljs index a9fa7e5998..32abd69298 100644 --- a/frontend/src/app/main/ui/workspace/tokens/themes/create_modal.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/themes/create_modal.cljs @@ -114,8 +114,7 @@ :class (stl/css :theme-row)} [:div {:class (stl/css :theme-switch-row)} - [:> switch* {:id name - :label name + [:> switch* {:label name :on-change on-switch-theme :default-checked selected?}]]