diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 978d7c27..3f3cda22 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 164 components exported from carbon-components-svelte@0.82.7. +> 163 components exported from carbon-components-svelte@0.82.7. ## Components @@ -166,7 +166,6 @@ - [`TooltipFooter`](#tooltipfooter) - [`TooltipIcon`](#tooltipicon) - [`TreeView`](#treeview) -- [`Truncate`](#truncate) - [`UnorderedList`](#unorderedlist) --- @@ -4690,24 +4689,6 @@ export interface TreeNode { | focus | dispatched | TreeNode & { expanded: boolean; leaf: boolean; } | | keydown | forwarded | -- | -## `Truncate` - -### Props - -| Prop name | Required | Kind | Reactive | Type | Default value | Description | -| :-------- | :------- | :--------------- | :------- | --------------------------------- | ------------------ | ----------- | -| clamp | No | let | No | "end" | "front" | "end" | -- | - -### Slots - -| Slot name | Default | Props | Fallback | -| :-------- | :------ | :---- | :------- | -| -- | Yes | -- | -- | - -### Events - -None. - ## `UnorderedList` ### Props diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index cac8c759..b59a8d8f 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1,5 +1,5 @@ { - "total": 164, + "total": 163, "components": [ { "moduleName": "Accordion", @@ -14625,28 +14625,6 @@ ], "rest_props": { "type": "Element", "name": "ul" } }, - { - "moduleName": "Truncate", - "filePath": "src/Truncate/Truncate.svelte", - "props": [ - { - "name": "clamp", - "kind": "let", - "type": "\"end\" | \"front\"", - "value": "\"end\"", - "isFunction": false, - "isFunctionDeclaration": false, - "isRequired": false, - "constant": false, - "reactive": false - } - ], - "moduleExports": [], - "slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }], - "events": [], - "typedefs": [], - "rest_props": { "type": "Element", "name": "p" } - }, { "moduleName": "UnorderedList", "filePath": "src/UnorderedList/UnorderedList.svelte", diff --git a/docs/src/pages/components/Truncate.svx b/docs/src/pages/components/Truncate.svx deleted file mode 100644 index efa56aeb..00000000 --- a/docs/src/pages/components/Truncate.svx +++ /dev/null @@ -1,34 +0,0 @@ - - - -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. - -## Default - -By default, text will be clamped at the end of the line. Text is wrapped with a paragraph (`p`) element. Use the [truncate action](#usetruncate) to truncate text in other elements. - - - Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. - - -## Clamp front - -Set `clamp` to `"front"` to clamp the text from the front. - - - Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. - - -## use:truncate - -The `truncate` action can be used on plain HTML elements. - -

- 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. -

\ No newline at end of file diff --git a/src/Truncate/Truncate.svelte b/src/Truncate/Truncate.svelte deleted file mode 100644 index 465d66d8..00000000 --- a/src/Truncate/Truncate.svelte +++ /dev/null @@ -1,12 +0,0 @@ - - -

- -

diff --git a/src/Truncate/index.js b/src/Truncate/index.js deleted file mode 100644 index 803c92f2..00000000 --- a/src/Truncate/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as Truncate } from "./Truncate.svelte"; -export { truncate } from "./truncate"; diff --git a/src/Truncate/truncate.d.ts b/src/Truncate/truncate.d.ts deleted file mode 100644 index 35557fc0..00000000 --- a/src/Truncate/truncate.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -interface TruncateOptions { - clamp?: "end" | "front"; -} - -export function TruncateAction( - node: HTMLElement, - options?: TruncateOptions -): { - update: (options?: TruncateOptions) => void; -}; - -export default TruncateAction; diff --git a/src/Truncate/truncate.js b/src/Truncate/truncate.js deleted file mode 100644 index 42723c09..00000000 --- a/src/Truncate/truncate.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Svelte action that applies single-line text truncation to an element - * @typedef {{ clamp?: "end" | "front" }} TruncateOptions - * @type {(node: HTMLElement, options?: TruncateOptions) => { update: (options?: TruncateOptions) => void; }} - * @example - *

...

- *

...

- */ -export function truncate(node, options = {}) { - const prefix = "bx--text-truncate--"; - - function toggleClass(front = false) { - const classes = [...node.classList] - .filter((name) => !name.startsWith(prefix)) - .join(" "); - - node.className = `${classes} ${prefix}${front ? "front" : "end"}`; - } - - toggleClass(options.clamp === "front"); - - return { - update(options) { - toggleClass(options.clamp === "front"); - }, - }; -} - -export default truncate; diff --git a/src/index.js b/src/index.js index b5e5ae6e..fc289bf6 100644 --- a/src/index.js +++ b/src/index.js @@ -127,8 +127,6 @@ export { Tooltip, TooltipFooter } from "./Tooltip"; export { TooltipDefinition } from "./TooltipDefinition"; export { TooltipIcon } from "./TooltipIcon"; export { TreeView } from "./TreeView"; -export { Truncate } from "./Truncate"; -export { default as truncate } from "./Truncate/truncate"; export { Header, HeaderAction, diff --git a/tests/Truncate.test.svelte b/tests/Truncate.test.svelte deleted file mode 100644 index 4e8adc65..00000000 --- a/tests/Truncate.test.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - - - 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. - - -

- 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. -

diff --git a/thumbnails/truncate.svg b/thumbnails/truncate.svg index f1ac3dd7..1d939f05 100644 --- a/thumbnails/truncate.svg +++ b/thumbnails/truncate.svg @@ -2,7 +2,7 @@ truncate - + diff --git a/types/Truncate/Truncate.svelte.d.ts b/types/Truncate/Truncate.svelte.d.ts deleted file mode 100644 index d7231742..00000000 --- a/types/Truncate/Truncate.svelte.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { SvelteComponentTyped } from "svelte"; -import type { SvelteHTMLElements } from "svelte/elements"; - -type RestProps = SvelteHTMLElements["p"]; - -export interface TruncateProps extends RestProps { - /** - * @default "end" - */ - clamp?: "end" | "front"; - - [key: `data-${string}`]: any; -} - -export default class Truncate extends SvelteComponentTyped< - TruncateProps, - Record, - { default: {} } -> {} diff --git a/types/Truncate/truncate.d.ts b/types/Truncate/truncate.d.ts deleted file mode 100644 index 35557fc0..00000000 --- a/types/Truncate/truncate.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -interface TruncateOptions { - clamp?: "end" | "front"; -} - -export function TruncateAction( - node: HTMLElement, - options?: TruncateOptions -): { - update: (options?: TruncateOptions) => void; -}; - -export default TruncateAction; diff --git a/types/index.d.ts b/types/index.d.ts index 267d4531..360753c1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -142,8 +142,6 @@ export { default as TooltipFooter } from "./Tooltip/TooltipFooter.svelte"; export { default as TooltipDefinition } from "./TooltipDefinition/TooltipDefinition.svelte"; export { default as TooltipIcon } from "./TooltipIcon/TooltipIcon.svelte"; export { default as TreeView } from "./TreeView/TreeView.svelte"; -export { default as Truncate } from "./Truncate/Truncate.svelte"; -export { default as truncate } from "./Truncate/truncate"; export { default as Header } from "./UIShell/Header.svelte"; export { default as HeaderAction } from "./UIShell/HeaderAction.svelte"; export { default as HeaderActionLink } from "./UIShell/HeaderActionLink.svelte";