Skip to content

Commit 8533005

Browse files
committed
Reverted back to before prettier
Better floating label handling organized validation for better scss Updated copyright for 2025
1 parent 5677e11 commit 8533005

File tree

6 files changed

+201
-241
lines changed

6 files changed

+201
-241
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ package-lock.json
3636
docs/js/DialogManager.js
3737
docs/modal.html
3838

39-
/.yohn
39+
/.yohn
40+
_docs/

scss/components/_group.scss

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,58 @@
208208
}
209209
}
210210
}
211+
212+
@if map.get($modules, "forms/floating") {
213+
#{$parent-selector} [role="group"] > section[role="form"] {
214+
flex: 1;
215+
216+
> *,
217+
> input:not([type="checkbox"], [type="radio"]),
218+
> select,
219+
> label,
220+
> legend,
221+
> details {
222+
// need to check this for details > summary
223+
&:focus {
224+
z-index: 4;
225+
}
226+
}
227+
228+
> input:not([type="checkbox"], [type="radio"]),
229+
> select {
230+
&:focus {
231+
z-index: 10;
232+
}
233+
+ label {
234+
z-index: 10;
235+
// label was positioned above placeholder..
236+
margin-top: 5px;
237+
}
238+
}
239+
240+
&:not(:first-child) {
241+
> *,
242+
> input:not([type="checkbox"], [type="radio"]),
243+
> select,
244+
> label,
245+
> legend,
246+
> details > summary {
247+
margin-left: 0;
248+
border-top-left-radius: 0;
249+
border-bottom-left-radius: 0;
250+
}
251+
}
252+
253+
&:not(:last-child) {
254+
> *,
255+
> input:not([type="checkbox"], [type="radio"]),
256+
> select,
257+
> label,
258+
> legend,
259+
> details > summary {
260+
border-top-right-radius: 0;
261+
border-bottom-right-radius: 0;
262+
}
263+
}
264+
}
265+
}

scss/forms/_basics.scss

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// 2. Correct the color inheritance from `fieldset` elements in IE
4343
// 3. Remove the padding so developers are not caught out when they zero out
4444
// `fieldset` elements in all browsers
45-
#{$parent-selector} legend {
45+
#{$parent-selector} *:not([role="group"]) legend {
4646
max-width: 100%; // 1
4747
padding: 0; // 3
4848
color: inherit; // 2
@@ -138,15 +138,15 @@
138138
}
139139

140140
// Label & legend
141-
#{$parent-selector} label,
142-
#{$parent-selector} fieldset legend {
141+
#{$parent-selector} *:not([role="group"]) > label,
142+
#{$parent-selector} fieldset:not([role="group"]) > legend {
143143
display: block;
144144
margin-bottom: calc(var(#{$css-var-prefix}spacing) * 0.375);
145145
color: var(#{$css-var-prefix}color);
146146
font-weight: var(#{$css-var-prefix}form-label-font-weight, var(#{$css-var-prefix}font-weight));
147147
}
148148

149-
#{$parent-selector} fieldset legend {
149+
#{$parent-selector} fieldset:not([role="group"]) > legend {
150150
margin-bottom: calc(var(#{$css-var-prefix}spacing) * 0.5);
151151
}
152152

@@ -245,21 +245,22 @@
245245

246246
// Disabled
247247
#{$parent-selector} input:not([type="submit"], [type="button"], [type="reset"])[disabled],
248-
#{$parent-selector} [role="group"] > label,
249-
#{$parent-selector} [role="group"] > legend,
250248
#{$parent-selector} select[disabled],
251249
#{$parent-selector} textarea[disabled],
252250
#{$parent-selector} label[aria-disabled="true"],
251+
#{$parent-selector} [role="group"] > label[aria-disabled="true"],
252+
#{$parent-selector} [role="group"] > legend[aria-disabled="true"],
253253
#{$parent-selector}
254254
:where(fieldset[disabled])
255255
:is(input:not([type="submit"], [type="button"], [type="reset"]), select, textarea) {
256256
opacity: var(#{$css-var-prefix}form-element-disabled-opacity);
257257
pointer-events: none;
258258
}
259259

260-
#{$parent-selector} label[aria-disabled="true"] input[disabled],
261-
#{$parent-selector} [role="group"] > label,
262-
#{$parent-selector} [role="group"] > legend {
260+
#{$parent-selector} label[aria-disabled="true"] input[disabled] {
261+
//},
262+
//#{$parent-selector} [role="group"] > label,
263+
//#{$parent-selector} [role="group"] > legend {
263264
opacity: 1;
264265
}
265266

scss/forms/_floating.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
transition: 0.3s ease;
3434
}
3535

36-
// Used this before I tried: >select:has(option:checked:not([disabled]))~label
36+
// Used this before I tried: >select:has(option:checked:not([disabled]))+label
3737
//> select + label {
3838
// position: absolute;
3939
// top: -5%;
@@ -49,13 +49,14 @@
4949
> textarea:not(:placeholder-shown) + label,
5050
> textarea:focus + label,
5151
> select:focus + label,
52-
> select:has(option:checked:not([disabled])) ~ label {
52+
> select:has(option:checked:not([disabled])) + label {
5353
top: -5%;
54-
padding: calc(var(--pico-spacing) * 0.25) calc(var(--pico-spacing) * 0.5);
55-
transform: translateY(-50%) scale(0.85);
56-
color: var(--pico-form-element-active-border-color);
57-
font-size: calc(var(--pico-font-size) * 0.85);
58-
line-height: 1.25;
54+
padding: calc(var(#{$css-var-prefix}spacing) * 0.15)
55+
calc(var(#{$css-var-prefix}spacing) * 0.5);
56+
transform: translateY(-55%) scale(0.8);
57+
color: var(#{$css-var-prefix}form-element-active-border-color);
58+
font-size: var(#{$css-var-prefix}font-size);
59+
line-height: 1.15;
5960
transition: all $transition-fast;
6061
}
6162

0 commit comments

Comments
 (0)