chore: remove Truncate since it does not exist in Carbon v11

This commit is contained in:
Gregor Wassmann 2023-03-31 23:04:23 +02:00
commit 9c680c5f20
12 changed files with 3 additions and 172 deletions

View file

@ -1,12 +0,0 @@
<script>
/** @type {"end" | "front"}*/
export let clamp = "end";
</script>
<p
class:bx--text-truncate--end="{clamp === 'end'}"
class:bx--text-truncate--front="{clamp === 'front'}"
{...$$restProps}
>
<slot />
</p>

View file

@ -1,2 +0,0 @@
export { default as Truncate } from "./Truncate.svelte";
export { truncate } from "./truncate";

View file

@ -1,12 +0,0 @@
interface TruncateOptions {
clamp?: "end" | "front";
}
export function TruncateAction(
node: HTMLElement,
options?: TruncateOptions
): {
update: (options?: TruncateOptions) => void;
};
export default TruncateAction;

View file

@ -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
* <h1 use:truncate>...</h1>
* <h1 use:truncate={{ clamp: "front" }}>...</h1>
*/
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;

View file

@ -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,