Skip to content

Commit

Permalink
Merge pull request #197 from BouyguesTelecom/fix-style
Browse files Browse the repository at this point in the history
checkbox style + a11y checkbox/radio
  • Loading branch information
PaulNaszalyi authored Dec 4, 2024
2 parents 8b8996b + b9277a7 commit 3b73386
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 14 deletions.
3 changes: 1 addition & 2 deletions packages/react/components/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ const Checkbox = ({
}, [checked, readonly])

return (
<div className={hashClass(styled, clsx('checkbox', className))} tabIndex={0}>
<div className={hashClass(styled, clsx('checkbox', className))}>
<input
aria-checked={checked}
type='checkbox'
readOnly={readonly}
id={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ const CheckboxTile = ({
}, [checked, readonly])

return (
<div className={hashClass(styled, clsx('checkbox-tile', horizontal && is('horizontal'), className))} tabIndex={0}>
<div className={hashClass(styled, clsx('checkbox-tile', horizontal && is('horizontal'), className))}>
<input
aria-checked={checked}
type='checkbox'
readOnly={readonly}
id={id}
Expand Down
3 changes: 1 addition & 2 deletions packages/react/components/radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ const Radio = ({
}, [checked, readonly])

return (
<div className={hashClass(styled, clsx('radio', className))} tabIndex={0}>
<div className={hashClass(styled, clsx('radio', className))}>
<input
aria-checked={checked}
type='radio'
readOnly={readonly}
id={id}
Expand Down
3 changes: 1 addition & 2 deletions packages/react/components/radio/tiles/tile/RadioTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ const RadioTile = ({
}, [checked, readonly])

return (
<div className={hashClass(styled, clsx('radio-tile', horizontal && is('horizontal'), className))} tabIndex={0}>
<div className={hashClass(styled, clsx('radio-tile', horizontal && is('horizontal'), className))}>
<input
aria-checked={checked}
type='radio'
readOnly={readonly}
id={id}
Expand Down
10 changes: 8 additions & 2 deletions packages/styles/framework/src/components/_autolayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ body:not(.is-tight) {
.card:not(:last-child) {
margin-bottom: 24px;
}
.columns:not(:last-child) {
margin-bottom: 24px;
}
.box:not(:last-child) {
margin-bottom: 24px;
}
*:has(+.divider):not(:last-child) {
*:has(+ .divider):not(:last-child) {
margin-bottom: 24px;
}
.divider:not(:last-child) {
Expand Down Expand Up @@ -156,10 +159,13 @@ body:not(.is-tight) {
.card:not(:last-child) {
margin-bottom: 16px;
}
.columns:not(:last-child) {
margin-bottom: 16px;
}
.box:not(:last-child) {
margin-bottom: 16px;
}
*:has(+.divider):not(:last-child) {
*:has(+ .divider):not(:last-child) {
margin-bottom: 16px;
}
.divider:not(:last-child) {
Expand Down
5 changes: 5 additions & 0 deletions packages/styles/framework/src/elements/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ $button-border-width: 2px !default;
}
}

&.is-ghost:hover {
background-color: var(--color-main-fade);
filter: none !important;
}

&[disabled],
&[aria-disabled=true] {
background-color: getColorValue('main-fade') !important;
Expand Down
7 changes: 6 additions & 1 deletion packages/styles/framework/src/elements/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
}

input {
display: none;
opacity: 0;
position: absolute;
outline: none;

&:focus-visible ~ label:before{
outline: 2px solid;
}
&:disabled ~ label,
&:disabled:checked ~ label {
cursor: not-allowed;
Expand Down
2 changes: 1 addition & 1 deletion packages/styles/framework/src/theming/buttons_partial.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $button-colors: (
'accent':['conversion', 'accent', 'background'],
'primary': ['primary', 'main', 'background'],
'secondary': ['secondary', 'main-fade', 'main'],
'ghost': ['ghost', 'background', 'main'],
'ghost': ['ghost', 'transparent', 'main']
) !default;

%buttons-states {
Expand Down
1 change: 1 addition & 0 deletions packages/styles/framework/src/utilities/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $suffix: '';
*/
$colors: (
'background': [#fff, 'white', 'main'],
'transparent': ['transparent', 'transparent', 'transparent'],
'main':[ #3d5d7e, 'main', 'white'],
'main-fade':[ #eff2f8, 'main-fade', 'white'],
'accent':[ #da641b,'accent', 'white'],
Expand Down
10 changes: 9 additions & 1 deletion packages/styles/framework/src/utilities/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@
}

input {
display: none;
opacity: 0;
position: absolute;
outline: none;

&:checked ~ label.#{$type}-label {
border-color: getColor('main');
Expand All @@ -422,6 +424,9 @@
background-color: getColor('main');
}
}
&:focus-visible ~ label.#{$type}-label:before {
outline: 1px solid;
}

&:disabled,
&:disabled:checked {
Expand Down Expand Up @@ -495,6 +500,9 @@
@include disabledRules;
}
}
&:has(input:focus-visible) label.#{$type}-label{
outline: 1px solid;
}

&:first-child {
margin-left: 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/styles/scripts/autolayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ const { THREE, FOUR, FIVE, TWO, ONE, SEVEN, ZERO, SIX } = SpacerSize
* */
export const DEFAULT_SPACING_MATRIX: DefaultSpacingMatrix = [
[INSERT_SPACE_BETWEEN, '.accordions', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.buttons', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.card', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.columns', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.box', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '*:has(+.divider)', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '*:has(+ .divider)', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.divider', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.table', 'default', FIVE, FOUR],
[INSERT_SPACE_BETWEEN, '.list', 'default', FIVE, FOUR],
Expand Down

0 comments on commit 3b73386

Please sign in to comment.