mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
chore: use truncate mixins
This commit is contained in:
parent
b63a076059
commit
0aa38ec81a
5 changed files with 7 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Component Index
|
# Component Index
|
||||||
|
|
||||||
> 164 components exported from carbon-components-svelte@0.82.7.
|
> 165 components exported from carbon-components-svelte@0.82.7.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"total": 164,
|
"total": 165,
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"moduleName": "Accordion",
|
"moduleName": "Accordion",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</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
|
## Default
|
||||||
|
|
||||||
|
@ -31,4 +31,4 @@ The `truncate` action can be used on plain HTML elements.
|
||||||
</h4>
|
</h4>
|
||||||
<h4 use:truncate={{ clamp: "front" }}>
|
<h4 use:truncate={{ clamp: "front" }}>
|
||||||
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
|
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
|
||||||
</h4>
|
</h4>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p
|
<p
|
||||||
class:bx--text-truncate--end="{clamp === 'end'}"
|
class:bx--text-truncate-end="{clamp === 'end'}"
|
||||||
class:bx--text-truncate--front="{clamp === 'front'}"
|
class:bx--text-truncate-front="{clamp === 'front'}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* <h1 use:truncate={{ clamp: "front" }}>...</h1>
|
* <h1 use:truncate={{ clamp: "front" }}>...</h1>
|
||||||
*/
|
*/
|
||||||
export function truncate(node, options = {}) {
|
export function truncate(node, options = {}) {
|
||||||
const prefix = "bx--text-truncate--";
|
const prefix = "bx--text-truncate-";
|
||||||
|
|
||||||
function toggleClass(front = false) {
|
function toggleClass(front = false) {
|
||||||
const classes = [...node.classList]
|
const classes = [...node.classList]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue