mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
test: remove old files
This commit is contained in:
parent
d45409c7f3
commit
95f6c97a57
4 changed files with 0 additions and 91 deletions
|
@ -1,8 +0,0 @@
|
|||
<script lang="ts">
|
||||
export let copy = (text: string) => text;
|
||||
export let code = "npm i carbon-component-svelte";
|
||||
|
||||
import { CodeSnippet } from "carbon-components-svelte";
|
||||
</script>
|
||||
|
||||
<CodeSnippet on:click={() => copy(code)}>{code}</CodeSnippet>
|
|
@ -1,10 +0,0 @@
|
|||
<script lang="ts">
|
||||
import { CodeSnippet } from "carbon-components-svelte";
|
||||
|
||||
let toggled = false;
|
||||
|
||||
$: length = toggled ? 20 : 10;
|
||||
$: code = Array.from({ length }, (_, i) => i + 1).join("\n");
|
||||
</script>
|
||||
|
||||
<CodeSnippet type="multi" {code} />
|
|
@ -1,19 +0,0 @@
|
|||
<script lang="ts">
|
||||
import { ComboBox } from "carbon-components-svelte";
|
||||
|
||||
function shouldFilterItem(item: { text: string }, value?: any) {
|
||||
if (!value) return true;
|
||||
return item.text.toLowerCase().includes(value.toLowerCase());
|
||||
}
|
||||
</script>
|
||||
|
||||
<ComboBox
|
||||
titleText="Contact"
|
||||
placeholder="Select contact method"
|
||||
items={[
|
||||
{ id: "0", text: "Slack" },
|
||||
{ id: "1", text: "Email" },
|
||||
{ id: "2", text: "Fax" },
|
||||
]}
|
||||
{shouldFilterItem}
|
||||
/>
|
|
@ -1,54 +0,0 @@
|
|||
<script lang="ts">
|
||||
import { Button, ButtonSet, InlineLoading } from "carbon-components-svelte";
|
||||
import { onDestroy } from "svelte";
|
||||
|
||||
type State = "dormant" | "active" | "finished" | "inactive";
|
||||
|
||||
const descriptionMap = {
|
||||
active: "Submitting...",
|
||||
finished: "Success",
|
||||
inactive: "Cancelling...",
|
||||
dormant: "Submit",
|
||||
} as const satisfies Record<State, string>;
|
||||
|
||||
const stateMap = {
|
||||
active: "finished",
|
||||
inactive: "dormant",
|
||||
finished: "dormant",
|
||||
dormant: "inactive",
|
||||
} as const satisfies Record<State, State>;
|
||||
|
||||
let timeout: NodeJS.Timeout | undefined = undefined;
|
||||
let state: State = "dormant";
|
||||
|
||||
function reset(incomingState?: State) {
|
||||
if (typeof timeout === "number") {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
if (incomingState) {
|
||||
timeout = setTimeout(() => {
|
||||
state = incomingState;
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy(reset);
|
||||
|
||||
$: reset(stateMap[state]);
|
||||
</script>
|
||||
|
||||
<ButtonSet>
|
||||
<Button
|
||||
kind="ghost"
|
||||
disabled={state === "dormant" || state === "finished"}
|
||||
on:click={() => (state = "inactive")}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
{#if state !== "dormant"}
|
||||
<InlineLoading status={state} description={descriptionMap[state]} />
|
||||
{:else}
|
||||
<Button on:click={() => (state = "active")}>Submit</Button>
|
||||
{/if}
|
||||
</ButtonSet>
|
Loading…
Add table
Add a link
Reference in a new issue