🐛 Add ellipsis in long labels for input fields

This commit is contained in:
alonso.torres 2021-11-03 12:36:12 +01:00 committed by Andrés Moya
parent 50d756b189
commit 503f0bee69
15 changed files with 100 additions and 29 deletions

View file

@ -15,8 +15,9 @@
- Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191). - Fix undo stacking when changing color from color-picker [Taiga #2191](https://tree.taiga.io/project/penpot/issue/2191).
- Fix pages dropdown in viewer [Taiga #2087](https://tree.taiga.io/project/penpot/issue/2087). - Fix pages dropdown in viewer [Taiga #2087](https://tree.taiga.io/project/penpot/issue/2087).
- Fix problem when exporting texts with gradients or opacity [Taiga #2200](https://tree.taiga.io/project/penpot/issue/2200). - Fix problem when exporting texts with gradients or opacity [Taiga #2200](https://tree.taiga.io/project/penpot/issue/2200).
- Fix problem with view mode comments [Taiga #226](https://tree.taiga.io/project/penpot/issue/2226). - Fix problem with view mode comments [Taiga #2226](https://tree.taiga.io/project/penpot/issue/2226).
- Disallow to create a component when already has one [Taiga #2237](https://tree.taiga.io/project/penpot/issue/2237). - Disallow to create a component when already has one [Taiga #2237](https://tree.taiga.io/project/penpot/issue/2237).
- Add ellipsis in long labels for input fields [Taiga #2224](https://tree.taiga.io/project/penpot/issue/2224)
### :arrow_up: Deps updates ### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -396,6 +396,11 @@ ul.slider-dots {
text-align: right; text-align: right;
top: 26%; top: 26%;
width: 18px; width: 18px;
pointer-events: none;
max-width: 4rem;
overflow: hidden;
text-overflow: ellipsis;
} }
.after { .after {

View file

@ -24,6 +24,7 @@
max-val-str (obj/get props "max") max-val-str (obj/get props "max")
wrap-value? (obj/get props "data-wrap") wrap-value? (obj/get props "data-wrap")
on-change (obj/get props "onChange") on-change (obj/get props "onChange")
title (obj/get props "title")
;; We need a ref pointing to the input dom element, but the user ;; We need a ref pointing to the input dom element, but the user
;; of this component may provide one (that is forwarded here). ;; of this component may provide one (that is forwarded here).
@ -144,6 +145,7 @@
(obj/set! "type" "text") (obj/set! "type" "text")
(obj/set! "ref" ref) (obj/set! "ref" ref)
(obj/set! "defaultValue" value-str) (obj/set! "defaultValue" value-str)
(obj/set! "title" title)
(obj/set! "onWheel" handle-mouse-wheel) (obj/set! "onWheel" handle-mouse-wheel)
(obj/set! "onKeyDown" handle-key-down) (obj/set! "onKeyDown" handle-key-down)
(obj/set! "onBlur" handle-blur))] (obj/set! "onBlur" handle-blur))]

View file

@ -79,6 +79,7 @@
[:div.element-set-content [:div.element-set-content
[:& color-row {:color color [:& color-row {:color color
:title (tr "workspace.options.fill")
:on-change on-change :on-change on-change
:on-detach on-detach}]]] :on-detach on-detach}]]]

View file

@ -130,7 +130,7 @@
:on-change handle-change-type}] :on-change handle-change-type}]
(if (= type :square) (if (= type :square)
[:div.input-element.pixels [:div.input-element.pixels {:title (tr "workspace.options.size")}
[:> numeric-input {:min 1 [:> numeric-input {:min 1
:no-validate true :no-validate true
:value (:size params) :value (:size params)
@ -214,6 +214,7 @@
:on-change (handle-change :params :margin)}]]) :on-change (handle-change :params :margin)}]])
[:& color-row {:color (:color params) [:& color-row {:color (:color params)
:title (tr "workspace.options.grid.params.color")
:disable-gradient true :disable-gradient true
:on-change handle-change-color :on-change handle-change-color
:on-detach handle-detach-color}] :on-detach handle-detach-color}]

View file

@ -270,11 +270,12 @@
(when (cti/has-delay interaction) (when (cti/has-delay interaction)
[:div.interactions-element [:div.interactions-element
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-delay")] [:span.element-set-subtitle.wide (tr "workspace.options.interaction-delay")]
[:div.input-element [:div.input-element {:title (tr "workspace.options.interaction-ms")}
[:> numeric-input {:ref ext-delay-ref [:> numeric-input {:ref ext-delay-ref
:on-click (select-text ext-delay-ref) :on-click (select-text ext-delay-ref)
:on-change change-delay :on-change change-delay
:value (:delay interaction)}] :value (:delay interaction)
:title (tr "workspace.options.interaction-ms")}]
[:span.after (tr "workspace.options.interaction-ms")]]]) [:span.after (tr "workspace.options.interaction-ms")]]])
; Action select ; Action select

View file

@ -112,8 +112,7 @@
[:option {:value "color"} (tr "workspace.options.layer-options.blend-mode.color")] [:option {:value "color"} (tr "workspace.options.layer-options.blend-mode.color")]
[:option {:value "luminosity"} (tr "workspace.options.layer-options.blend-mode.luminosity")]] [:option {:value "luminosity"} (tr "workspace.options.layer-options.blend-mode.luminosity")]]
[:div.input-element [:div.input-element {:title (tr "workspace.options.opacity") :class "percentail"}
{:class "percentail"}
[:> numeric-input {:value (-> values :opacity opacity->string) [:> numeric-input {:value (-> values :opacity opacity->string)
:placeholder (tr "settings.multiple") :placeholder (tr "settings.multiple")
:on-click select-all :on-click select-all

View file

@ -165,7 +165,7 @@
(when (options :size) (when (options :size)
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.size")] [:span.element-set-subtitle (tr "workspace.options.size")]
[:div.input-element.width [:div.input-element.width {:title (tr "workspace.options.width")}
[:> numeric-input {:min 1 [:> numeric-input {:min 1
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -173,7 +173,7 @@
:on-change on-width-change :on-change on-width-change
:value (attr->string :width values)}]] :value (attr->string :width values)}]]
[:div.input-element.height [:div.input-element.height {:title (tr "workspace.options.height")}
[:> numeric-input {:min 1 [:> numeric-input {:min 1
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -193,13 +193,13 @@
(when (options :position) (when (options :position)
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.position")] [:span.element-set-subtitle (tr "workspace.options.position")]
[:div.input-element.Xaxis [:div.input-element.Xaxis {:title (tr "workspace.options.x")}
[:> numeric-input {:no-validate true [:> numeric-input {:no-validate true
:placeholder "--" :placeholder "--"
:on-click select-all :on-click select-all
:on-change on-pos-x-change :on-change on-pos-x-change
:value (attr->string :x values)}]] :value (attr->string :x values)}]]
[:div.input-element.Yaxis [:div.input-element.Yaxis {:title (tr "workspace.options.y")}
[:> numeric-input {:no-validate true [:> numeric-input {:no-validate true
:placeholder "--" :placeholder "--"
:on-click select-all :on-click select-all
@ -210,7 +210,7 @@
(when (options :rotation) (when (options :rotation)
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.rotation")] [:span.element-set-subtitle (tr "workspace.options.rotation")]
[:div.input-element.degrees [:div.input-element.degrees {:title (tr "workspace.options.rotation")}
[:> numeric-input [:> numeric-input
{:no-validate true {:no-validate true
:min 0 :min 0
@ -247,9 +247,8 @@
i/radius-4]] i/radius-4]]
(cond (cond
(= radius-mode :radius-1) (= radius-mode :radius-1)
[:div.input-element.mini [:div.input-element.mini {:title (tr "workspace.options.radius")}
[:> numeric-input [:> numeric-input
{:placeholder "--" {:placeholder "--"
:ref radius-input-ref :ref radius-input-ref
@ -259,7 +258,7 @@
:value (attr->string :rx values)}]] :value (attr->string :rx values)}]]
@radius-multi? @radius-multi?
[:div.input-element.mini [:div.input-element.mini {:title (tr "workspace.options.radius")}
[:input.input-text [:input.input-text
{:type "number" {:type "number"
:placeholder "--" :placeholder "--"
@ -269,28 +268,31 @@
(= radius-mode :radius-4) (= radius-mode :radius-4)
[:* [:*
[:div.input-element.mini [:div.input-element.mini {:title (tr "workspace.options.radius")}
[:> numeric-input [:> numeric-input
{:placeholder "--" {:placeholder "--"
:min 0 :min 0
:on-click select-all :on-click select-all
:on-change on-radius-r1-change :on-change on-radius-r1-change
:value (attr->string :r1 values)}]] :value (attr->string :r1 values)}]]
[:div.input-element.mini
[:div.input-element.mini {:title (tr "workspace.options.radius")}
[:> numeric-input [:> numeric-input
{:placeholder "--" {:placeholder "--"
:min 0 :min 0
:on-click select-all :on-click select-all
:on-change on-radius-r2-change :on-change on-radius-r2-change
:value (attr->string :r2 values)}]] :value (attr->string :r2 values)}]]
[:div.input-element.mini
[:div.input-element.mini {:title (tr "workspace.options.radius")}
[:> numeric-input [:> numeric-input
{:placeholder "--" {:placeholder "--"
:min 0 :min 0
:on-click select-all :on-click select-all
:on-change on-radius-r3-change :on-change on-radius-r3-change
:value (attr->string :r3 values)}]] :value (attr->string :r3 values)}]]
[:div.input-element.mini
[:div.input-element.mini {:title (tr "workspace.options.radius")}
[:> numeric-input [:> numeric-input
{:placeholder "--" {:placeholder "--"
:min 0 :min 0

View file

@ -146,7 +146,7 @@
[:option {:value ":inner-shadow"} (tr "workspace.options.shadow-options.inner-shadow")]]] [:option {:value ":inner-shadow"} (tr "workspace.options.shadow-options.inner-shadow")]]]
[:div.row-grid-2 [:div.row-grid-2
[:div.input-element [:div.input-element {:title (tr "workspace.options.shadow-options.offsetx")}
[:> numeric-input {:ref adv-offset-x-ref [:> numeric-input {:ref adv-offset-x-ref
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -155,7 +155,7 @@
:value (:offset-x value)}] :value (:offset-x value)}]
[:span.after (tr "workspace.options.shadow-options.offsetx")]] [:span.after (tr "workspace.options.shadow-options.offsetx")]]
[:div.input-element [:div.input-element {:title (tr "workspace.options.shadow-options.offsety")}
[:> numeric-input {:ref adv-offset-y-ref [:> numeric-input {:ref adv-offset-y-ref
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -165,7 +165,7 @@
[:span.after (tr "workspace.options.shadow-options.offsety")]]] [:span.after (tr "workspace.options.shadow-options.offsety")]]]
[:div.row-grid-2 [:div.row-grid-2
[:div.input-element [:div.input-element {:title (tr "workspace.options.shadow-options.blur")}
[:> numeric-input {:ref adv-blur-ref [:> numeric-input {:ref adv-blur-ref
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -175,7 +175,7 @@
:value (:blur value)}] :value (:blur value)}]
[:span.after (tr "workspace.options.shadow-options.blur")]] [:span.after (tr "workspace.options.shadow-options.blur")]]
[:div.input-element [:div.input-element {:title (tr "workspace.options.shadow-options.spread")}
[:> numeric-input {:ref adv-spread-ref [:> numeric-input {:ref adv-spread-ref
:no-validate true :no-validate true
:placeholder "--" :placeholder "--"
@ -190,6 +190,7 @@
;; Support for old format colors ;; Support for old format colors
{:color (:color value) :opacity (:opacity value)} {:color (:color value) :opacity (:opacity value)}
(:color value)) (:color value))
:title (tr "workspace.options.shadow-options.color")
:disable-gradient true :disable-gradient true
:on-change (update-color index) :on-change (update-color index)
:on-detach (detach-color index) :on-detach (detach-color index)

View file

@ -198,13 +198,15 @@
[:div.element-set-content [:div.element-set-content
;; Stroke Color ;; Stroke Color
[:& color-row {:color current-stroke-color [:& color-row {:color current-stroke-color
:title (tr "workspace.options.stroke-color")
:on-change handle-change-stroke-color :on-change handle-change-stroke-color
:on-detach handle-detach}] :on-detach handle-detach}]
;; Stroke Width, Alignment & Style ;; Stroke Width, Alignment & Style
[:div.row-flex [:div.row-flex
[:div.input-element [:div.input-element
{:class (dom/classnames :pixels (not= (:stroke-width values) :multiple))} {:class (dom/classnames :pixels (not= (:stroke-width values) :multiple))
:title (tr "workspace.options.stroke-width")}
[:input.input-text {:type "number" [:input.input-text {:type "number"
:min "0" :min "0"
:value (-> (:stroke-width values) width->string) :value (-> (:stroke-width values) width->string)

View file

@ -37,6 +37,7 @@
[:div.element-set-content [:div.element-set-content
[:& color-row {:disable-gradient true [:& color-row {:disable-gradient true
:disable-opacity true :disable-opacity true
:title (tr "workspace.options.canvas-background")
:color {:color (get options :background "#E8E9EA") :color {:color (get options :background "#E8E9EA")
:opacity 1} :opacity 1}
:on-change on-change :on-change on-change

View file

@ -61,7 +61,7 @@
(if (= v :multiple) nil v)) (if (= v :multiple) nil v))
(mf/defc color-row (mf/defc color-row
[{:keys [color disable-gradient disable-opacity on-change on-detach on-open on-close]}] [{:keys [color disable-gradient disable-opacity on-change on-detach on-open on-close title]}]
(let [current-file-id (mf/use-ctx ctx/current-file-id) (let [current-file-id (mf/use-ctx ctx/current-file-id)
file-colors (mf/deref refs/workspace-file-colors) file-colors (mf/deref refs/workspace-file-colors)
shared-libs (mf/deref refs/workspace-libraries) shared-libs (mf/deref refs/workspace-libraries)
@ -123,7 +123,7 @@
(when (not= prev-color color) (when (not= prev-color color)
(modal/update-props! :colorpicker {:data (parse-color color)})))) (modal/update-props! :colorpicker {:data (parse-color color)}))))
[:div.row-flex.color-data [:div.row-flex.color-data {:title title}
[:& cb/color-bullet {:color color [:& cb/color-bullet {:color color
:on-click handle-click-color}] :on-click handle-click-color}]

View file

@ -87,7 +87,7 @@
;; WIDTH & HEIGHT ;; WIDTH & HEIGHT
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.size")] [:span.element-set-subtitle (tr "workspace.options.size")]
[:div.input-element.pixels [:div.input-element.pixels {:title (tr "workspace.options.width")}
[:> numeric-input {:min 1 [:> numeric-input {:min 1
:on-click select-all :on-click select-all
:on-change on-width-change :on-change on-width-change
@ -95,7 +95,7 @@
(math/precision 2) (math/precision 2)
(d/coalesce-str "1"))}]] (d/coalesce-str "1"))}]]
[:div.input-element.pixels [:div.input-element.pixels {:title (tr "workspace.options.height")}
[:> numeric-input {:min 1 [:> numeric-input {:min 1
:on-click select-all :on-click select-all
:on-change on-height-change :on-change on-height-change
@ -112,14 +112,14 @@
;; POSITION ;; POSITION
[:div.row-flex [:div.row-flex
[:span.element-set-subtitle (tr "workspace.options.position")] [:span.element-set-subtitle (tr "workspace.options.position")]
[:div.input-element.pixels [:div.input-element.pixels {:title (tr "workspace.options.x")}
[:> numeric-input {:placeholder "x" [:> numeric-input {:placeholder "x"
:on-click select-all :on-click select-all
:on-change on-pos-x-change :on-change on-pos-x-change
:value (-> (:x shape) :value (-> (:x shape)
(math/precision 2) (math/precision 2)
(d/coalesce-str "0"))}]] (d/coalesce-str "0"))}]]
[:div.input-element.pixels [:div.input-element.pixels {:title (tr "workspace.options.y")}
[:> numeric-input {:placeholder "y" [:> numeric-input {:placeholder "y"
:on-click select-all :on-click select-all
:on-change on-pos-y-change :on-change on-pos-y-change

View file

@ -3204,3 +3204,31 @@ msgstr "Update"
msgid "workspace.viewport.click-to-close-path" msgid "workspace.viewport.click-to-close-path"
msgstr "Click to close the path" msgstr "Click to close the path"
msgid "workspace.options.grid.params.color"
msgstr "Color"
msgid "workspace.options.height"
msgstr "Height"
msgid "workspace.options.opacity"
msgstr "Opacity"
msgid "workspace.options.shadow-options.color"
msgstr "Shadow color"
msgid "workspace.options.stroke-color"
msgstr "Stroke color"
msgid "workspace.options.stroke-width"
msgstr "Stroke width"
msgid "workspace.options.width"
msgstr "Width"
msgid "workspace.options.x"
msgstr "X"
msgid "workspace.options.y"
msgstr "Y"

View file

@ -3201,3 +3201,30 @@ msgstr "Actualizar"
msgid "workspace.viewport.click-to-close-path" msgid "workspace.viewport.click-to-close-path"
msgstr "Pulsar para cerrar la ruta" msgstr "Pulsar para cerrar la ruta"
msgid "workspace.options.grid.params.color"
msgstr "Color"
msgid "workspace.options.height"
msgstr "Altura"
msgid "workspace.options.opacity"
msgstr "Opacidad"
msgid "workspace.options.shadow-options.color"
msgstr "Color de sombra"
msgid "workspace.options.stroke-color"
msgstr "Color del trazo"
msgid "workspace.options.stroke-width"
msgstr "Ancho del trazo"
msgid "workspace.options.width"
msgstr "Ancho"
msgid "workspace.options.x"
msgstr "X"
msgid "workspace.options.y"
msgstr "Y"