mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
* feat(icons): inline carbon icons used by components * feat(icons): update svelte components to use inlined carbon icons * breaking(deps): remove carbon-icons-svelte * chore(deps-dev): install carbon-icons-svelte as a devDependency
54 lines
1.3 KiB
Svelte
54 lines
1.3 KiB
Svelte
<script>
|
|
let className = undefined;
|
|
export { className as class };
|
|
export let id = undefined;
|
|
export let tabindex = undefined;
|
|
export let focusable = false;
|
|
export let title = undefined;
|
|
export let style = undefined;
|
|
|
|
$: ariaLabel = $$props["aria-label"];
|
|
$: ariaLabelledBy = $$props["aria-labelledby"];
|
|
$: labelled = ariaLabel || ariaLabelledBy || title;
|
|
$: attributes = {
|
|
"aria-label": ariaLabel,
|
|
"aria-labelledby": ariaLabelledBy,
|
|
"aria-hidden": labelled ? undefined : true,
|
|
role: labelled ? "img" : undefined,
|
|
focusable: tabindex === "0" ? true : focusable,
|
|
tabindex,
|
|
};
|
|
</script>
|
|
|
|
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
|
<svg
|
|
data-carbon-icon="ErrorFilled20"
|
|
on:click
|
|
on:mouseover
|
|
on:mouseenter
|
|
on:mouseleave
|
|
on:keyup
|
|
on:keydown
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor"
|
|
width="20"
|
|
height="20"
|
|
class="{className}"
|
|
preserveAspectRatio="xMidYMid meet"
|
|
style="{style}"
|
|
id="{id}"
|
|
{...attributes}
|
|
>
|
|
<path
|
|
d="M10,1c-5,0-9,4-9,9s4,9,9,9s9-4,9-9S15,1,10,1z M13.5,14.5l-8-8l1-1l8,8L13.5,14.5z"
|
|
></path><path
|
|
d="M13.5,14.5l-8-8l1-1l8,8L13.5,14.5z"
|
|
data-icon-path="inner-path"
|
|
opacity="0"></path>
|
|
<slot>
|
|
{#if title}
|
|
<title>{title}</title>
|
|
{/if}
|
|
</slot>
|
|
</svg>
|