mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 11:59:34 +00:00
chore: remove Truncate since it does not exist in Carbon v11
This commit is contained in:
parent
2df821512f
commit
9c680c5f20
12 changed files with 3 additions and 172 deletions
|
@ -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>
|
|
@ -1,2 +0,0 @@
|
|||
export { default as Truncate } from "./Truncate.svelte";
|
||||
export { truncate } from "./truncate";
|
12
src/Truncate/truncate.d.ts
vendored
12
src/Truncate/truncate.d.ts
vendored
|
@ -1,12 +0,0 @@
|
|||
interface TruncateOptions {
|
||||
clamp?: "end" | "front";
|
||||
}
|
||||
|
||||
export function TruncateAction(
|
||||
node: HTMLElement,
|
||||
options?: TruncateOptions
|
||||
): {
|
||||
update: (options?: TruncateOptions) => void;
|
||||
};
|
||||
|
||||
export default TruncateAction;
|
|
@ -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;
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue