chore: use truncate mixins

This commit is contained in:
Enrico Sacchetti 2024-01-04 22:49:40 -05:00
commit 0aa38ec81a
5 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
# Component Index
> 164 components exported from carbon-components-svelte@0.82.7.
> 165 components exported from carbon-components-svelte@0.82.7.
## Components

View file

@ -1,5 +1,5 @@
{
"total": 164,
"total": 165,
"components": [
{
"moduleName": "Accordion",

View file

@ -4,7 +4,7 @@
import Preview from "../../components/Preview.svelte";
</script>
This utility component wraps the `.bx--text-truncate--*` CSS selectors from [carbon-components](https://github.com/carbon-design-system/carbon/blob/master/packages/components/src/globals/scss/_helper-classes.scss#L11) for single-line text truncation.
This utility component wraps the `.bx--text-truncate-*` Sass mixins from [@carbon/styles](https://github.com/carbon-design-system/carbon/blob/main/packages/styles/scss/utilities/_text-truncate.scss) for single-line text truncation.
## Default

View file

@ -4,8 +4,8 @@
</script>
<p
class:bx--text-truncate--end="{clamp === 'end'}"
class:bx--text-truncate--front="{clamp === 'front'}"
class:bx--text-truncate-end="{clamp === 'end'}"
class:bx--text-truncate-front="{clamp === 'front'}"
{...$$restProps}
>
<slot />

View file

@ -7,7 +7,7 @@
* <h1 use:truncate={{ clamp: "front" }}>...</h1>
*/
export function truncate(node, options = {}) {
const prefix = "bx--text-truncate--";
const prefix = "bx--text-truncate-";
function toggleClass(front = false) {
const classes = [...node.classList]