-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(HelpText): css alignments (#2438)
Part of #2295 --------- Co-authored-by: Tobias Barsnes <[email protected]>
- Loading branch information
1 parent
69e7988
commit 0e4faee
Showing
9 changed files
with
70 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@digdir/designsystemet-css": patch | ||
"@digdir/designsystemet-react": patch | ||
--- | ||
|
||
HelpText: | ||
- Use Popover API | ||
- Remove `portal` prop | ||
- Render icon with pseudo element and require aria-label |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,48 @@ | ||
.ds-helptext__button { | ||
--dsc-helptext-color: var(--ds-color-neutral-text-default); | ||
--dsc-helptext-icon-color: var(--ds-color-accent-base-default); | ||
--dsc-helptext-icon-width: var(--ds-sizing-7); | ||
--dsc-helptext-icon-height: var(--ds-sizing-7); | ||
.ds-helptext { | ||
--dsc-helptext-icon-size: 65%; | ||
--dsc-helptext-icon-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 8 14'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M4 11a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM4 0c2.2 0 4 1.66 4 3.7 0 .98-.42 1.9-1.17 2.6l-.6.54-.29.29c-.48.46-.87.93-.94 1.41V9.5H3v-.81c0-1.26.84-2.22 1.68-3L5.42 5C5.8 4.65 6 4.2 6 3.7 6 2.66 5.1 1.83 4 1.83c-1.06 0-1.92.75-2 1.7v.15H0C0 1.66 1.8 0 4 0Z' clip-rule='evenodd'/%3E%3C/svg%3E"); | ||
--dsc-helptext-size: var(--ds-sizing-7); | ||
|
||
background-color: transparent; | ||
border-radius: 50px; | ||
padding: 0 !important; | ||
cursor: pointer; | ||
display: flex; | ||
border: none; | ||
min-width: 0; | ||
min-height: 0; | ||
} | ||
@composes ds-focus from '../css/utilities.css'; | ||
|
||
@media print { | ||
.ds-helptext__button { | ||
display: none; | ||
border-radius: var(--ds-border-radius-full); | ||
border: 2px solid; | ||
height: var(--dsc-helptext-size); | ||
min-height: 0; | ||
min-width: 0; | ||
padding: 0; | ||
position: relative; | ||
width: var(--dsc-helptext-size); | ||
|
||
&::before { | ||
content: ''; | ||
border-radius: inherit; | ||
background: currentcolor; | ||
mask-composite: exclude; | ||
mask-image: var(--dsc-helptext-icon-url); | ||
mask-position: center; | ||
mask-repeat: no-repeat; | ||
mask-size: | ||
var(--dsc-helptext-icon-size) var(--dsc-helptext-icon-size), | ||
cover; | ||
scale: 1.1; /* Hide tiny half pixel rendeing bug */ | ||
width: 100%; | ||
height: 100%; | ||
} | ||
} | ||
|
||
.ds-helptext__icon--filled { | ||
display: none; | ||
} | ||
|
||
.ds-helptext__icon { | ||
color: var(--dsc-helptext-icon-color); | ||
width: var(--dsc-helptext-icon-width); | ||
height: var(--dsc-helptext-icon-height); | ||
} | ||
|
||
.ds-helptext__button:where(:hover, :focus, [data-state^='open']) > .ds-helptext__icon { | ||
display: none; | ||
} | ||
|
||
.ds-helptext__button:where(:hover, :focus, [data-state^='open']) > .ds-helptext__icon--filled { | ||
display: inline-block; | ||
} | ||
|
||
.ds-helptext__content { | ||
color: var(--dsc-helptext-color); | ||
width: fit-content; | ||
max-width: 700px; | ||
} | ||
&:has(+ :popover-open)::before { | ||
mask-image: var(--dsc-helptext-icon-url), linear-gradient(currentcolor, currentcolor); /* Cut icon out of currentcolor surface */ | ||
} | ||
|
||
.ds-helptext--sm .ds-helptext__icon { | ||
--dsc-helptext-icon-width: var(--ds-sizing-6); | ||
--dsc-helptext-icon-height: var(--ds-sizing-6); | ||
} | ||
&[data-size='sm'] { | ||
--dsc-helptext-size: var(--ds-sizing-6); | ||
} | ||
|
||
.ds-helptext--md .ds-helptext__icon { | ||
--dsc-helptext-icon-width: var(--ds-sizing-7); | ||
--dsc-helptext-icon-height: var(--ds-sizing-7); | ||
} | ||
&[data-size='lg'] { | ||
--dsc-helptext-size: var(--ds-sizing-8); | ||
} | ||
|
||
.ds-helptext--lg .ds-helptext__icon { | ||
--dsc-helptext-icon-width: var(--ds-sizing-8); | ||
--dsc-helptext-icon-height: var(--ds-sizing-8); | ||
@media print { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
packages/react/src/components/HelpText/HelpTextIcon.test.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.