mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor(components): remove exported "props"
Closes #17 - Forward events - Adds style prop, removes exported props
This commit is contained in:
parent
94a11920bd
commit
1286b9901d
31 changed files with 120 additions and 105 deletions
|
@ -27,7 +27,6 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#each skeletonItems as item}
|
{#each skeletonItems as item}
|
||||||
<li class={cx('--accordion__item')}>
|
<li class={cx('--accordion__item')}>
|
||||||
<span class={cx('--accordion__heading')}>
|
<span class={cx('--accordion__heading')}>
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
export let style = undefined;
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
const _class = cx('--accordion', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul on:click on:mouseover on:mouseenter on:mouseleave {style} class={cx('--accordion', className)}>
|
<ul on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<li
|
<li
|
||||||
{style}
|
|
||||||
class={_class}
|
class={_class}
|
||||||
on:animationend
|
on:animationend
|
||||||
on:animationend={() => {
|
on:animationend={() => {
|
||||||
animation = undefined;
|
animation = undefined;
|
||||||
}}>
|
}}
|
||||||
|
{style}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class={cx('--accordion__heading')}
|
class={cx('--accordion__heading')}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<script>
|
<script>
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--breadcrumb', '--skeleton', className);
|
const _class = cx('--breadcrumb', '--skeleton', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...props} class={_class}>
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
{#each [0, 1, 2] as item, i (item)}
|
{#each [0, 1, 2] as item, i (item)}
|
||||||
<div class={cx('--breadcrumb-item')}>
|
<div class={cx('--breadcrumb-item')}>
|
||||||
<span class={cx('--link')}> </span>
|
<span class={cx('--link')}> </span>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let noTrailingSlash = false;
|
export let noTrailingSlash = false;
|
||||||
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
@ -9,7 +10,14 @@
|
||||||
const _class = cx('--breadcrumb', noTrailingSlash && '--breadcrumb--no-trailing-slash');
|
const _class = cx('--breadcrumb', noTrailingSlash && '--breadcrumb--no-trailing-slash');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class={className} aria-label={ariaLabel}>
|
<nav
|
||||||
|
on:click
|
||||||
|
on:mouseover
|
||||||
|
on:mouseenter
|
||||||
|
on:mouseleave
|
||||||
|
aria-label={ariaLabel}
|
||||||
|
class={className}
|
||||||
|
{style}>
|
||||||
<ol class={_class}>
|
<ol class={_class}>
|
||||||
<slot />
|
<slot />
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let href = undefined;
|
export let href = undefined;
|
||||||
export let isCurrentPage = false;
|
export let isCurrentPage = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
import Link from '../Link';
|
import Link from '../Link';
|
||||||
|
|
||||||
const ariaCurrent = $$props['aria-current'];
|
const ariaCurrent = $$props['aria-current'];
|
||||||
|
const _class = cx(
|
||||||
$: _class = cx(
|
|
||||||
'--breadcrumb-item',
|
'--breadcrumb-item',
|
||||||
isCurrentPage && ariaCurrent !== 'page' && '--breadcrumb-item--current',
|
isCurrentPage && ariaCurrent !== 'page' && '--breadcrumb-item--current',
|
||||||
className
|
className
|
||||||
|
@ -18,13 +17,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if href}
|
{#if href}
|
||||||
<li class={_class} {...props}>
|
<li on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<Link {href} aria-current={ariaCurrent}>
|
<Link {href} aria-current={ariaCurrent}>
|
||||||
<slot />
|
<slot />
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
{:else}
|
{:else}
|
||||||
<li class={_class} {...props}>
|
<li on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot props={{ 'aria-current': ariaCurrent, class: cx('--link') }} />
|
<slot props={{ 'aria-current': ariaCurrent, class: cx('--link') }} />
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let small = false;
|
export let small = false;
|
||||||
export let href = undefined;
|
export let href = undefined;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if href}
|
{#if href}
|
||||||
<a {...props} class={_class} {href} role="button">{''}</a>
|
<a role="button" on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style} {href}>
|
||||||
|
{''}
|
||||||
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
<div {...props} class={_class} />
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
export let hasIconOnly = false;
|
export let hasIconOnly = false;
|
||||||
export let tooltipPosition = undefined;
|
export let tooltipPosition = undefined;
|
||||||
export let tooltipAlignment = undefined;
|
export let tooltipAlignment = undefined;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@
|
||||||
className
|
className
|
||||||
);
|
);
|
||||||
const buttonProps = {
|
const buttonProps = {
|
||||||
...props,
|
role: 'button',
|
||||||
|
type: href && !disabled ? undefined : type,
|
||||||
tabindex,
|
tabindex,
|
||||||
class: _class,
|
class: _class,
|
||||||
disabled,
|
disabled,
|
||||||
type: href && !disabled ? undefined : type,
|
href,
|
||||||
role: 'button',
|
style
|
||||||
href
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let type = 'single';
|
export let type = 'single';
|
||||||
export let feedback = undefined;
|
export let feedback = undefined;
|
||||||
|
export let feedbackTimeout = undefined;
|
||||||
export let copyButtonDescription = undefined;
|
export let copyButtonDescription = undefined;
|
||||||
export let copyLabel = undefined;
|
export let copyLabel = undefined;
|
||||||
export let showMoreText = 'Show more';
|
export let showMoreText = 'Show more';
|
||||||
export let showLessText = 'Show less';
|
export let showLessText = 'Show less';
|
||||||
export let light = false;
|
export let light = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
|
import ChevronDown16 from 'carbon-icons-svelte/lib/ChevronDown16';
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
@ -18,38 +19,41 @@
|
||||||
|
|
||||||
const id = Math.random();
|
const id = Math.random();
|
||||||
let codeRef = undefined;
|
let codeRef = undefined;
|
||||||
let expandedCode = false;
|
let expanded = false;
|
||||||
let showMoreLessBtn = false;
|
let showMoreLess = false;
|
||||||
|
|
||||||
|
$: expandText = expanded ? showLessText : showMoreText;
|
||||||
$: if (codeRef) {
|
$: if (codeRef) {
|
||||||
const { height } = codeRef.getBoundingClientRect();
|
showMoreLess = type === 'multi' && codeRef.getBoundingClientRect().height > 255;
|
||||||
showMoreLessBtn = type === 'multi' && height > 255;
|
|
||||||
}
|
}
|
||||||
$: _class = cx(
|
$: _class = cx(
|
||||||
'--snippet',
|
'--snippet',
|
||||||
type && `--snippet--${type}`,
|
type && `--snippet--${type}`,
|
||||||
type === 'inline' && '--btn--copy',
|
type === 'inline' && '--btn--copy',
|
||||||
expandedCode && '--snippet--expand',
|
expanded && '--snippet--expand',
|
||||||
light && '--snippet--light',
|
light && '--snippet--light',
|
||||||
className
|
className
|
||||||
);
|
);
|
||||||
$: expandCodeBtnText = expandedCode ? showLessText : showMoreText;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type === 'inline'}
|
{#if type === 'inline'}
|
||||||
<Copy
|
<Copy
|
||||||
on:click
|
aria-label={$$props['aria-label'] || copyLabel}
|
||||||
aria-label={copyLabel || $$props['aria-label']}
|
|
||||||
aria-describedby={id}
|
aria-describedby={id}
|
||||||
|
on:click
|
||||||
|
on:mouseover
|
||||||
|
on:mouseenter
|
||||||
|
on:mouseleave
|
||||||
class={_class}
|
class={_class}
|
||||||
{feedback}
|
{feedback}
|
||||||
{props}>
|
{feedbackTimeout}
|
||||||
|
{style}>
|
||||||
<code {id}>
|
<code {id}>
|
||||||
<slot />
|
<slot />
|
||||||
</code>
|
</code>
|
||||||
</Copy>
|
</Copy>
|
||||||
{:else}
|
{:else}
|
||||||
<div {...props} class={_class}>
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<div
|
<div
|
||||||
role="textbox"
|
role="textbox"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
@ -65,18 +69,19 @@
|
||||||
on:click
|
on:click
|
||||||
class={cx('--snippet-button')}
|
class={cx('--snippet-button')}
|
||||||
{feedback}
|
{feedback}
|
||||||
|
{feedbackTimeout}
|
||||||
iconDescription={copyButtonDescription} />
|
iconDescription={copyButtonDescription} />
|
||||||
{#if showMoreLessBtn}
|
{#if showMoreLess}
|
||||||
<Button
|
<Button
|
||||||
kind="ghost"
|
kind="ghost"
|
||||||
size="small"
|
size="small"
|
||||||
class={cx('--snippet-btn--expand')}
|
class={cx('--snippet-btn--expand')}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
expandedCode = !expandedCode;
|
expanded = !expanded;
|
||||||
}}>
|
}}>
|
||||||
<span class={cx('--snippet-btn--text')}>{expandCodeBtnText}</span>
|
<span class={cx('--snippet-btn--text')}>{expandText}</span>
|
||||||
<ChevronDown16
|
<ChevronDown16
|
||||||
aria-label={expandCodeBtnText}
|
aria-label={expandText}
|
||||||
class={cx('--icon-chevron--down', '--snippet__icon')} />
|
class={cx('--icon-chevron--down', '--snippet__icon')} />
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let feedback = 'Copied!';
|
export let feedback = 'Copied!';
|
||||||
export let feedbackTimeout = 2000;
|
export let feedbackTimeout = 2000;
|
||||||
|
export let style = undefined;
|
||||||
|
|
||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
@ -32,7 +33,8 @@
|
||||||
}}
|
}}
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave>
|
on:mouseleave
|
||||||
|
{style}>
|
||||||
<slot />
|
<slot />
|
||||||
<div class={_class} data-feedback={feedback} />
|
<div class={_class} data-feedback={feedback} />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
export let iconDescription = 'Copy to clipboard';
|
export let iconDescription = 'Copy to clipboard';
|
||||||
export let feedback = 'Copied!';
|
export let feedback = 'Copied!';
|
||||||
export let feedbackTimeout = 2000;
|
export let feedbackTimeout = 2000;
|
||||||
|
export let style = undefined;
|
||||||
|
|
||||||
import { onDestroy } from 'svelte';
|
import { onDestroy } from 'svelte';
|
||||||
import Copy16 from 'carbon-icons-svelte/lib/Copy16';
|
import Copy16 from 'carbon-icons-svelte/lib/Copy16';
|
||||||
|
@ -49,7 +50,8 @@
|
||||||
if (animationName === 'hide-feedback') {
|
if (animationName === 'hide-feedback') {
|
||||||
animation = undefined;
|
animation = undefined;
|
||||||
}
|
}
|
||||||
}}>
|
}}
|
||||||
|
{style}>
|
||||||
<span class={cx('--assistive-text', '--copy-btn__feedback')}>{feedback}</span>
|
<span class={cx('--assistive-text', '--copy-btn__feedback')}>{feedback}</span>
|
||||||
<Copy16 class={cx('--snippet__icon')} />
|
<Copy16 class={cx('--snippet__icon')} />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
const _class = cx('--form', className);
|
const _class = cx('--form', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class={_class} {style}>
|
<form on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -13,7 +13,14 @@
|
||||||
const _legendClass = cx('--label', className);
|
const _legendClass = cx('--label', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset data-invalid={invalid ? '' : undefined} class={_class} {style}>
|
<fieldset
|
||||||
|
data-invalid={invalid ? '' : undefined}
|
||||||
|
on:click
|
||||||
|
on:mouseover
|
||||||
|
on:mouseenter
|
||||||
|
on:mouseleave
|
||||||
|
class={_class}
|
||||||
|
{style}>
|
||||||
<legend class={_legendClass}>{legendText}</legend>
|
<legend class={_legendClass}>{legendText}</legend>
|
||||||
<slot />
|
<slot />
|
||||||
{#if message}
|
{#if message}
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
const _class = cx('--form-item', className);
|
const _class = cx('--form-item', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={_class} {style}>
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
const _class = cx('--form-item', className);
|
const _class = cx('--form-item', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label for={id} class={_class} {style}>
|
<label on:click on:mouseover on:mouseenter on:mouseleave for={id} class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -36,16 +36,9 @@
|
||||||
$: disabled = isSubmitting || success;
|
$: disabled = isSubmitting || success;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.wrapper {
|
|
||||||
display: flex;
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<Layout>
|
<Layout>
|
||||||
{#if story === 'ux-example'}
|
{#if story === 'ux-example'}
|
||||||
<div class="wrapper">
|
<div style="display: flex; width: 300px">
|
||||||
<Button kind="secondary" {disabled}>Cancel</Button>
|
<Button kind="secondary" {disabled}>Cancel</Button>
|
||||||
{#if disabled}
|
{#if disabled}
|
||||||
<InlineLoading
|
<InlineLoading
|
||||||
|
|
|
@ -3,28 +3,21 @@ import Component from './InlineLoading.Story.svelte';
|
||||||
|
|
||||||
export default { title: 'InlineLoading', decorators: [withKnobs] };
|
export default { title: 'InlineLoading', decorators: [withKnobs] };
|
||||||
|
|
||||||
|
const loadingStatus = ['inactive', 'active', 'finished', 'error'];
|
||||||
|
|
||||||
export const Default = () => ({
|
export const Default = () => ({
|
||||||
Component,
|
Component,
|
||||||
props: {
|
props: {
|
||||||
status: select(
|
status: select('Loading status (status)', loadingStatus, 'active'),
|
||||||
'Loading status (status)',
|
|
||||||
['inactive', 'active', 'finished', 'error'],
|
|
||||||
'active'
|
|
||||||
),
|
|
||||||
iconDescription: text('Icon description (iconDescription)', 'Active loading indicator'),
|
iconDescription: text('Icon description (iconDescription)', 'Active loading indicator'),
|
||||||
description: text('Loading progress description (description)', 'Loading data...'),
|
description: text('Loading progress description (description)', 'Loading data...'),
|
||||||
successDelay: number(
|
successDelay: number(
|
||||||
'The duration for successful state before `onSuccess` fires (successDelay)',
|
'The duration for successful state before `on:success` fires (successDelay)',
|
||||||
1500
|
1500
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UxExample = () => ({
|
export const UxExample = () => ({ Component, props: { story: 'ux-example' } });
|
||||||
Component,
|
|
||||||
props: { story: 'ux-example' }
|
|
||||||
});
|
|
||||||
|
|
||||||
UxExample.story = {
|
UxExample.story = { name: 'UX Example' };
|
||||||
name: 'UX Example'
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let success = false; // TODO: deprecate
|
export let status = 'active';
|
||||||
export let status = success ? 'finished' : 'active';
|
|
||||||
export let description = undefined;
|
export let description = undefined;
|
||||||
export let iconDescription = undefined;
|
export let iconDescription = undefined;
|
||||||
export let successDelay = 1500;
|
export let successDelay = 1500;
|
||||||
|
@ -33,13 +32,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
aria-live={$$props['aria-live'] || 'assertive'}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave
|
on:mouseleave
|
||||||
{style}
|
|
||||||
class={_class}
|
class={_class}
|
||||||
aria-live={$$props['aria-live'] || 'assertive'}>
|
{style}>
|
||||||
<div class={cx('--inline-loading__animation')}>
|
<div class={cx('--inline-loading__animation')}>
|
||||||
{#if status === 'error'}
|
{#if status === 'error'}
|
||||||
<Error20 class={cx('--inline-loading--error')} />
|
<Error20 class={cx('--inline-loading--error')} />
|
||||||
|
|
|
@ -18,24 +18,24 @@
|
||||||
|
|
||||||
{#if disabled}
|
{#if disabled}
|
||||||
<p
|
<p
|
||||||
|
aria-current={$$props['aria-current']}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave
|
on:mouseleave
|
||||||
{style}
|
class={_class}
|
||||||
aria-current={$$props['aria-current']}
|
{style}>
|
||||||
class={_class}>
|
|
||||||
<slot />
|
<slot />
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<a
|
||||||
|
aria-current={$$props['aria-current']}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave
|
on:mouseleave
|
||||||
{style}
|
|
||||||
aria-current={$$props['aria-current']}
|
|
||||||
class={_class}
|
class={_class}
|
||||||
|
{style}
|
||||||
{href}>
|
{href}>
|
||||||
<slot />
|
<slot />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--list__item', className);
|
const _class = cx('--list__item', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<li {...props} class={_class}>
|
<li on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
export let withOverlay = true;
|
export let withOverlay = true;
|
||||||
export let small = false;
|
export let small = false;
|
||||||
export let description = 'Active loading indicator';
|
export let description = 'Active loading indicator';
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
{#if withOverlay}
|
{#if withOverlay}
|
||||||
<div class={_overlayClass}>
|
<div class={_overlayClass}>
|
||||||
<div
|
<div
|
||||||
{...props}
|
|
||||||
aria-atomic="true"
|
aria-atomic="true"
|
||||||
aria-labelledby={loadingId}
|
aria-labelledby={loadingId}
|
||||||
aria-live={active ? 'assertive' : 'off'}
|
aria-live={active ? 'assertive' : 'off'}
|
||||||
class={_class}>
|
class={_class}
|
||||||
|
{style}>
|
||||||
<label id={loadingId} class={cx('--visually-hidden')}>{description}</label>
|
<label id={loadingId} class={cx('--visually-hidden')}>{description}</label>
|
||||||
<svg class={cx('--loading__svg')} viewBox="-75 -75 150 150">
|
<svg class={cx('--loading__svg')} viewBox="-75 -75 150 150">
|
||||||
<title>{description}</title>
|
<title>{description}</title>
|
||||||
|
@ -40,11 +40,11 @@
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div
|
||||||
{...props}
|
|
||||||
aria-atomic="true"
|
aria-atomic="true"
|
||||||
aria-labelledby={loadingId}
|
aria-labelledby={loadingId}
|
||||||
aria-live={active ? 'assertive' : 'off'}
|
aria-live={active ? 'assertive' : 'off'}
|
||||||
class={_class}>
|
class={_class}
|
||||||
|
{style}>
|
||||||
<label id={loadingId} class={cx('--visually-hidden')}>{description}</label>
|
<label id={loadingId} class={cx('--visually-hidden')}>{description}</label>
|
||||||
<svg class={cx('--loading__svg')} viewBox="-75 -75 150 150">
|
<svg class={cx('--loading__svg')} viewBox="-75 -75 150 150">
|
||||||
<title>{description}</title>
|
<title>{description}</title>
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let nested = false;
|
export let nested = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--list--ordered', nested && '--list--nested', className);
|
const _class = cx('--list--ordered', nested && '--list--nested', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ol {...props} class={_class}>
|
<ol on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let small = false;
|
export let small = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--skeleton', !small && '--search--xl', small && '--search--sm', className);
|
const _class = cx('--skeleton', !small && '--search--xl', small && '--search--sm', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...props} class={_class}>
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<span class={cx('--label')} />
|
<span class={cx('--label')} />
|
||||||
<div class={cx('--search-input')} />
|
<div class={cx('--search-input')} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
export let size = small ? 'sm' : 'xl';
|
export let size = small ? 'sm' : 'xl';
|
||||||
export let light = false;
|
export let light = false;
|
||||||
export let id = Math.random();
|
export let id = Math.random();
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import Search16 from 'carbon-icons-svelte/lib/Search16';
|
import Search16 from 'carbon-icons-svelte/lib/Search16';
|
||||||
|
@ -33,27 +33,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: hasContent = value !== '';
|
$: _clearClass = cx('--search-close', value === '' && '--search-close--hidden');
|
||||||
$: _clearClass = cx('--search-close', !hasContent && '--search-close--hidden');
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={_class}>
|
<div class={_class} {style}>
|
||||||
<Search16 class={cx('--search-magnifier')} />
|
<Search16 class={cx('--search-magnifier')} />
|
||||||
<label for={id} class={cx('--label')}>{labelText}</label>
|
<label for={id} class={cx('--label')}>{labelText}</label>
|
||||||
<input
|
<input
|
||||||
{...props}
|
|
||||||
bind:this={inputRef}
|
bind:this={inputRef}
|
||||||
role="searchbox"
|
role="searchbox"
|
||||||
class={cx('--search-input')}
|
class={cx('--search-input')}
|
||||||
placeholder={placeHolderText}
|
placeholder={placeHolderText}
|
||||||
{type}
|
|
||||||
{id}
|
|
||||||
{value}
|
|
||||||
on:change
|
on:change
|
||||||
on:input
|
on:input
|
||||||
on:input={event => {
|
on:input={event => {
|
||||||
value = event.target.value;
|
value = event.target.value;
|
||||||
}} />
|
}}
|
||||||
|
{type}
|
||||||
|
{id}
|
||||||
|
{value} />
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class={_clearClass}
|
class={_clearClass}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave
|
on:mouseleave
|
||||||
{style}
|
|
||||||
class={_class}
|
class={_class}
|
||||||
style={`width: ${width};`} />
|
style={`width: ${width};`}
|
||||||
|
{style} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
|
let className = undefined;
|
||||||
|
export { className as class };
|
||||||
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
|
const _class = cx('--tag', '--skeleton', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class={cx('--tag', '--skeleton')} />
|
<span on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style} />
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
export let filter = false;
|
export let filter = false;
|
||||||
export let title = 'Clear filter';
|
export let title = 'Clear filter';
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import Close16 from 'carbon-icons-svelte/lib/Close16';
|
import Close16 from 'carbon-icons-svelte/lib/Close16';
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
@ -22,19 +22,19 @@
|
||||||
|
|
||||||
{#if filter}
|
{#if filter}
|
||||||
<span
|
<span
|
||||||
{...props}
|
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
on:mouseenter
|
on:mouseenter
|
||||||
on:mouseleave
|
on:mouseleave
|
||||||
class={_class}
|
class={_class}
|
||||||
{title}>
|
{title}
|
||||||
|
{style}>
|
||||||
<slot>{TYPES[type]}</slot>
|
<slot>{TYPES[type]}</slot>
|
||||||
<Close16 aria-label={title} />
|
<Close16 aria-label={title} />
|
||||||
</span>
|
</span>
|
||||||
{:else}
|
{:else}
|
||||||
<span {...props} on:click on:mouseover on:mouseenter on:mouseleave class={_class}>
|
<span on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot>{TYPES[type]}</slot>
|
<slot>{TYPES[type]}</slot>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let hideLabel = false;
|
export let hideLabel = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--form-item', className);
|
const _class = cx('--form-item', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div {...props} class={_class}>
|
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
{#if !hideLabel}
|
{#if !hideLabel}
|
||||||
<span class={cx('--label', '--skeleton')} />
|
<span class={cx('--label', '--skeleton')} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
export let helperText = '';
|
export let helperText = '';
|
||||||
export let hideLabel = false;
|
export let hideLabel = false;
|
||||||
export let light = false;
|
export let light = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import WarningFilled16 from 'carbon-icons-svelte/lib/WarningFilled16';
|
import WarningFilled16 from 'carbon-icons-svelte/lib/WarningFilled16';
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={cx('--form-item')}>
|
<div on:mouseover on:mouseenter on:mouseleave class={cx('--form-item')} {style}>
|
||||||
{#if labelText && !hideLabel}
|
{#if labelText && !hideLabel}
|
||||||
<label for={id} class={_labelClass}>{labelText}</label>
|
<label for={id} class={_labelClass}>{labelText}</label>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -47,7 +47,6 @@
|
||||||
<WarningFilled16 class={cx('--text-area__invalid-icon')} />
|
<WarningFilled16 class={cx('--text-area__invalid-icon')} />
|
||||||
{/if}
|
{/if}
|
||||||
<textarea
|
<textarea
|
||||||
{...props}
|
|
||||||
on:click={event => {
|
on:click={event => {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
dispatch('click', event);
|
dispatch('click', event);
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
class={_textInputClass}
|
class={_textInputClass}
|
||||||
on:click
|
on:click
|
||||||
on:change
|
on:change
|
||||||
|
on:input
|
||||||
on:input={event => {
|
on:input={event => {
|
||||||
value = event.target.value;
|
value = event.target.value;
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
let className = undefined;
|
let className = undefined;
|
||||||
export { className as class };
|
export { className as class };
|
||||||
export let nested = false;
|
export let nested = false;
|
||||||
export let props = {};
|
export let style = undefined;
|
||||||
|
|
||||||
import { cx } from '../../lib';
|
import { cx } from '../../lib';
|
||||||
|
|
||||||
const _class = cx('--list--unordered', nested && '--list--nested', className);
|
const _class = cx('--list--unordered', nested && '--list--nested', className);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul {...props} class={_class}>
|
<ul on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
|
||||||
<slot />
|
<slot />
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue