Skip to content

Commit

Permalink
feat(ffe-form): support on colored background in some basic components
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Hellstrand committed Jun 28, 2024
1 parent 87f9f03 commit 1662029
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
15 changes: 12 additions & 3 deletions packages/ffe-form/less/checkbox.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
grid-column-gap: var(--ffe-spacing-xs);
align-items: center;
cursor: pointer;
transition: width @ffe-transition-duration @ffe-ease;
transition: width var(--ffe-transition-duration) var(--ffe-ease);
font-family: var(--ffe-g-font);
font-variant-numeric: tabular-nums;
text-align: left;
Expand Down Expand Up @@ -37,7 +37,7 @@
content: '';
grid-column: 1/2;
grid-row: 1/2;
transition: all @ffe-transition-duration @ffe-ease;
transition: all var(--ffe-transition-duration) var(--ffe-ease);
}

&::before {
Expand Down Expand Up @@ -95,7 +95,8 @@
}

&:focus-visible + .ffe-checkbox::before {
box-shadow: 0 0 0 3px var(--ffe-v-input-bg-color),
box-shadow:
0 0 0 3px var(--ffe-v-input-bg-color),
0 0 0 5px var(--ffe-v-checkbox-focus-outline-color);
}

Expand All @@ -108,3 +109,11 @@
--square-color: var(--ffe-g-error-color);
}
}

.ffe-form-label--on-colored-bg {
color: var(--ffe-v-text-on-colored-bg-color);
}

.ffe-checkbox--on-colored-bg .ffe-checkbox__content {
color: var(--ffe-v-text-on-colored-bg-color);
}
8 changes: 6 additions & 2 deletions packages/ffe-form/less/field-message.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.ffe-field-message {
font-family: var(--ffe-g-font);
color: var(--ffe-v-input-color);
margin: @ffe-spacing-2xs 0 @ffe-spacing-xs;
margin: var(--ffe-spacing-2xs) 0 var(--ffe-spacing-xs);
display: grid;
grid-template-columns: auto 1fr;
grid-column-gap: @ffe-spacing-2xs;
grid-column-gap: var(--ffe-spacing-2xs);
font-size: var(--ffe-fontsize-body-text);
overflow-wrap: anywhere;

Expand Down Expand Up @@ -41,3 +41,7 @@
color: var(--ffe-v-error-message-icon-fill);
}
}

.ffe-field-message--on-colored-bg {
color: var(--ffe-v-text-on-colored-bg-color);
}
6 changes: 5 additions & 1 deletion packages/ffe-form/less/form-label.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.ffe-form-label {
overflow-wrap: anywhere;
padding-bottom: @ffe-spacing-xs;
padding-bottom: var(--ffe-spacing-xs);
display: inline-block;
position: relative;
font-family: var(--ffe-g-font);
Expand All @@ -24,3 +24,7 @@
max-width: calc(100% - 42px);
}
}

.ffe-form-label--on-colored-bg {
color: var(--ffe-v-text-on-colored-bg-color);
}
6 changes: 6 additions & 0 deletions packages/ffe-form/less/input-group.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@
}
}
}

.ffe-input-group--on-colored-bg {
.ffe-input-group__description {
color: var(--ffe-farge-hvit);
}
}
11 changes: 8 additions & 3 deletions packages/ffe-form/less/radio-button.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
position: relative;
color: var(--ffe-g-text-color);
cursor: pointer;
transition: width @ffe-transition-duration @ffe-ease-in-out-back;
transition: width var(--ffe-transition-duration) var(--ffe-ease-in-out-back);
text-align: left;
padding-left: 0;
padding-top: 1px;
Expand Down Expand Up @@ -64,7 +64,7 @@
left: 0;
grid-column: 1/2;
grid-row: 1/2;
transition: all @ffe-transition-duration @ffe-ease;
transition: all var(--ffe-transition-duration) var(--ffe-ease);
place-self: center;
}

Expand Down Expand Up @@ -107,7 +107,8 @@
&:focus-visible + .ffe-radio-button::after {
--background-color: var(--ffe-farge-hvit);

box-shadow: 0 0 0 3px var(--background-color),
box-shadow:
0 0 0 3px var(--background-color),
0 0 0 5px var(--ffe-g-primary-color);

.native & {
Expand All @@ -130,3 +131,7 @@
grid-column: 2/3;
grid-row: 1/-1;
}

.ffe-radio-button--on-colored-bg .ffe-radio-input__content {
color: var(--ffe-v-text-on-colored-bg-color);
}
1 change: 1 addition & 0 deletions packages/ffe-form/less/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
--ffe-v-success-message-icon-fill: var(--ffe-farge-hvit);
--ffe-v-error-message-icon-color: var(--ffe-g-error-color);
--ffe-v-error-message-icon-fill: var(--ffe-farge-hvit);
--ffe-v-text-on-colored-bg-color: var(--ffe-farge-hvit);
--ffe-v-checkbox-color: var(--ffe-g-border-color);
--ffe-v-checkbox-selected-color: var(--ffe-g-primary-color);
--ffe-v-checkbox-marker-color: var(--ffe-g-primary-color);
Expand Down
15 changes: 10 additions & 5 deletions packages/ffe-form/less/tooltip.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
cursor: help;
height: 1.5625rem;
aspect-ratio: 1;
margin: 0 0 @ffe-spacing-2xs @ffe-spacing-sm;
margin: 0 0 var(--ffe-spacing-2xs) var(--ffe-spacing-sm);
padding: 0;
transition: border-color @ffe-transition-duration @ffe-ease;
transition: border-color var(--ffe-transition-duration) var(--ffe-ease);
display: inline-grid;
place-items: center;
font-family: sans-serif;
Expand All @@ -29,7 +29,8 @@
}

&:focus {
box-shadow: 0 0 0 3px var(--ffe-v-input-bg-color),
box-shadow:
0 0 0 3px var(--ffe-v-input-bg-color),
0 0 0 5px var(--ffe-v-checkbox-focus-outline-color);
outline: none;
}
Expand All @@ -46,15 +47,19 @@
height: 0;
overflow: hidden;
visibility: hidden;
transition: height @ffe-transition-duration @ffe-ease;
transition: height var(--ffe-transition-duration) var(--ffe-ease);
overflow-wrap: anywhere;
}

&--open &__text {
margin-bottom: @ffe-spacing-xs;
margin-bottom: var(--ffe-spacing-xs);
padding-bottom: 0;
height: auto;
overflow: visible;
visibility: visible;
}
}

.ffe-tooltip--on-colored-bg .ffe-small-text {
color: var(--ffe-v-text-on-colored-bg-color);
}

0 comments on commit 1662029

Please sign in to comment.