mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
chore: lift components folder
This commit is contained in:
parent
76df51674d
commit
2200b29b92
301 changed files with 57 additions and 76 deletions
5
src/Loading/Loading.Story.svelte
Normal file
5
src/Loading/Loading.Story.svelte
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
import Loading from "./Loading.svelte";
|
||||
</script>
|
||||
|
||||
<Loading {...$$props} />
|
14
src/Loading/Loading.stories.js
Normal file
14
src/Loading/Loading.stories.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { withKnobs, boolean, text } from "@storybook/addon-knobs";
|
||||
import Component from "./Loading.Story.svelte";
|
||||
|
||||
export default { title: "Loading", decorators: [withKnobs] };
|
||||
|
||||
export const Default = () => ({
|
||||
Component,
|
||||
props: {
|
||||
active: boolean("Active (active)", true),
|
||||
withOverlay: boolean("With overlay (withOverlay)", false),
|
||||
small: boolean("Small (small)", false),
|
||||
description: text("Description (description)", "Active loading indicator"),
|
||||
},
|
||||
});
|
67
src/Loading/Loading.svelte
Normal file
67
src/Loading/Loading.svelte
Normal file
|
@ -0,0 +1,67 @@
|
|||
<script>
|
||||
export let small = false;
|
||||
export let active = true;
|
||||
export let withOverlay = true;
|
||||
export let description = "Active loading indicator";
|
||||
export let id = "ccs-" + Math.random().toString(36);
|
||||
|
||||
$: spinnerRadius = small ? "26.8125" : "37.5";
|
||||
</script>
|
||||
|
||||
{#if withOverlay}
|
||||
<div
|
||||
class:bx--loading-overlay={true}
|
||||
class:bx--loading-overlay--stop={!active}
|
||||
{...$$restProps}>
|
||||
<div
|
||||
aria-atomic="true"
|
||||
aria-labelledby={id}
|
||||
aria-live={active ? 'assertive' : 'off'}
|
||||
class:bx--loading={true}
|
||||
class:bx--loading--small={small}
|
||||
class:bx--loading--stop={!active}>
|
||||
<label class:bx--visually-hidden={true} {id}>{description}</label>
|
||||
<svg class:bx--loading__svg={true} viewBox="-75 -75 150 150">
|
||||
<title>{description}</title>
|
||||
{#if small}
|
||||
<circle
|
||||
class:bx--loading__background={true}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={spinnerRadius} />
|
||||
{/if}
|
||||
<circle
|
||||
class:bx--loading__stroke={true}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={spinnerRadius} />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
aria-atomic="true"
|
||||
aria-labelledby={id}
|
||||
aria-live={active ? 'assertive' : 'off'}
|
||||
class:bx--loading={true}
|
||||
class:bx--loading--small={small}
|
||||
class:bx--loading--stop={!active}
|
||||
{...$$restProps}>
|
||||
<label class:bx--visually-hidden={true} {id}>{description}</label>
|
||||
<svg class:bx--loading__svg={true} viewBox="-75 -75 150 150">
|
||||
<title>{description}</title>
|
||||
{#if small}
|
||||
<circle
|
||||
class:bx--loading__background={true}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={spinnerRadius} />
|
||||
{/if}
|
||||
<circle
|
||||
class:bx--loading__stroke={true}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r={spinnerRadius} />
|
||||
</svg>
|
||||
</div>
|
||||
{/if}
|
1
src/Loading/index.js
Normal file
1
src/Loading/index.js
Normal file
|
@ -0,0 +1 @@
|
|||
export { default as Loading } from "./Loading.svelte";
|
Loading…
Add table
Add a link
Reference in a new issue