4545 /** @param {HTMLInputElement} element */
4646 function focus (element ) {
4747 element .focus ();
48+ element .select ();
4849 }
4950< / script>
5051
5152{#if editing}
5253 <!-- svelte- ignore a11y_no_noninteractive_element_interactions -->
53- < form onsubmit= {(e ) => { e .preventDefault (); submit (); }} onkeydown= {e => keydown (e)}>
54+ < form class = " ipe-form " onsubmit= {(e ) => { e .preventDefault (); submit (); }} onkeydown= {e => keydown (e)}>
5455 < input
55- class = " form-control"
56+ class = " form-control ipe-input "
5657 bind: value= {value}
5758 {required}
5859 maxlength= {maxLength}
6465{: else }
6566 <!-- svelte- ignore a11y_click_events_have_key_events -->
6667 <!-- svelte- ignore a11y_no_static_element_interactions -->
67- < div style= " width: fit-content; min-width: 30%;" class = " clickable ellipsis" onclick= {() => edit ()}>
68+ < div
69+ class = " ipe-display"
70+ title= " Click to edit"
71+ onclick= {() => edit ()}
72+ >
6873 {#if !! value? .trim ()}
69- < span> {value}< / span>
74+ < span class = " ipe-text " > {value}< / span>
7075 {: else }
71- < span class = " text-secondary fw-light " > {placeholder}< / span>
76+ < span class = " ipe-text ipe-placeholder " > {placeholder}< / span>
7277 {/ if }
78+ < i class = " mdi mdi-pencil-outline ipe-pencil" aria- hidden= " true" >< / i>
7379 < / div>
74- {/ if }
80+ {/ if }
81+
82+ < style>
83+ /* Display affordance — text reads as static copy, but a soft tinted
84+ pill, dashed underline, and fade-in pencil glyph signal that the
85+ value is editable on hover. */
86+ .ipe - display {
87+ display: inline- flex;
88+ align- items: center;
89+ gap: 0 .375rem ;
90+ width: fit- content;
91+ min- width: 30 % ;
92+ max- width: 100 % ;
93+ padding: 0 .125rem 0 .5rem ;
94+ border: 1px solid transparent;
95+ border- radius: 0 .375rem ;
96+ cursor: text;
97+ transition:
98+ background- color 0 .15s ease,
99+ border- color 0 .15s ease,
100+ color 0 .15s ease;
101+ }
102+
103+ .ipe - text {
104+ flex: 0 1 auto;
105+ min- width: 0 ;
106+ overflow: hidden;
107+ text- overflow: ellipsis;
108+ white- space: nowrap;
109+ border- bottom: 1px dashed transparent;
110+ transition: border- color 0 .15s ease;
111+ }
112+
113+ .ipe - placeholder {
114+ color: var (-- color- secondary);
115+ font- weight: 300 ;
116+ font- style: italic;
117+ }
118+
119+ .ipe - display: hover {
120+ background- color: color- mix (in srgb, var (-- color- primary) 8 % , transparent);
121+ border- color: color- mix (in srgb, var (-- color- primary) 22 % , transparent);
122+ }
123+ .ipe - display: hover .ipe - text {
124+ border- bottom- color: color- mix (in srgb, var (-- color- primary) 55 % , transparent);
125+ }
126+
127+ /* Pencil hint — invisible by default, fades in on hover so it does
128+ not steal space or attention while idle. */
129+ .ipe - pencil {
130+ flex- shrink: 0 ;
131+ font- size: 0 .875rem ;
132+ line- height: 1 ;
133+ color: var (-- color- primary);
134+ opacity: 0 ;
135+ transform: translateX (- 2px );
136+ transition: opacity 0 .15s ease, transform 0 .15s ease;
137+ }
138+ .ipe - display: hover .ipe - pencil {
139+ opacity: 0.8 ;
140+ transform: translateX (0 );
141+ }
142+
143+ /* Editing input — overrides Bootstrap's flat .form-control so it
144+ blends with the surrounding text and shows a primary-tinted focus
145+ ring instead of the default blue one. */
146+ .ipe - form {
147+ margin: 0 ;
148+ width: 100 % ;
149+ }
150+ .ipe - input .form - control {
151+ width: 100 % ;
152+ padding: 0 .25rem 0 .5rem ;
153+ font: inherit;
154+ color: inherit;
155+ background- color: rgb (255 255 255 );
156+ border: 1px solid color- mix (in srgb, var (-- color- primary) 35 % , transparent);
157+ border- radius: 0 .375rem ;
158+ box- shadow: 0 1px 2px rgb (0 0 0 / 0.04 );
159+ transition: border- color 0 .15s ease, box- shadow 0 .15s ease;
160+ }
161+ .ipe - input .form - control: focus {
162+ border- color: var (-- color- primary);
163+ outline: 0 ;
164+ box- shadow: 0 0 0 3px color- mix (in srgb, var (-- color- primary) 22 % , transparent);
165+ }
166+
167+ /* Dark mode — bump tint strength and swap the input surface so the
168+ component remains legible on darker panels. */
169+ : global (.dark ) .ipe - display: hover {
170+ background- color: color- mix (in srgb, var (-- color- primary) 18 % , transparent);
171+ border- color: color- mix (in srgb, var (-- color- primary) 32 % , transparent);
172+ }
173+ : global (.dark ) .ipe - input .form - control {
174+ background- color: rgb (17 24 39 );
175+ color: rgb (229 231 235 );
176+ border- color: color- mix (in srgb, var (-- color- primary) 45 % , transparent);
177+ }
178+ < / style>
0 commit comments