mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
commit
ac4d5f96a9
17 changed files with 154 additions and 16 deletions
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
<!-- ## Unreleased -->
|
<!-- ## Unreleased -->
|
||||||
|
|
||||||
|
## [0.23.1](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.23.1) - 2020-11-22
|
||||||
|
|
||||||
|
**Fixes**
|
||||||
|
|
||||||
|
- Fix `selected` prop reactivity in RadioButtonGroup so that it can be programmatically updated ([PR #407](https://github.com/IBM/carbon-components-svelte/pull/407), [issue #406](https://github.com/IBM/carbon-components-svelte/issues/406))
|
||||||
|
- Allow click propagation in ListBox so that list box menus can close correctly; this fixes behavior in the ComboBox, Dropdown, and MultiSelect components ([PR #405](https://github.com/IBM/carbon-components-svelte/pull/405), [issue #388](https://github.com/IBM/carbon-components-svelte/issues/388))
|
||||||
|
|
||||||
|
**Documentation**
|
||||||
|
|
||||||
|
- Add [programmatic RadioButton example](https://carbon-svelte.vercel.app/components/RadioButton#programmatic-usage)
|
||||||
|
- Add [multiple ComboBox example](https://carbon-svelte.vercel.app/components/ComboBox#multiple-combo-boxes)
|
||||||
|
- Add [multiple Dropdown example](https://carbon-svelte.vercel.app/components/Dropdown#multiple-dropdowns)
|
||||||
|
- Add [multiple MultiSelect example](https://carbon-svelte.vercel.app/components/MultiSelect#multiple-multi-select-dropdowns)
|
||||||
|
- Add [ExpandableAccordion recipe](https://carbon-svelte.vercel.app/recipes/ExpandableAccordion#expandable-accordion)
|
||||||
|
|
||||||
## [0.23.0](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.23.0) - 2020-11-20
|
## [0.23.0](https://github.com/IBM/carbon-components-svelte/releases/tag/v0.23.0) - 2020-11-20
|
||||||
|
|
||||||
**Features**
|
**Features**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Component Index
|
# Component Index
|
||||||
|
|
||||||
> 154 components exported from carbon-components-svelte@0.23.0.
|
> 154 components exported from carbon-components-svelte@0.23.1.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style global>
|
<style global>
|
||||||
|
.body-short-01 {
|
||||||
|
font-size: var(--cds-body-short-01-font-size);
|
||||||
|
font-weight: var(--cds-body-short-01-font-weight);
|
||||||
|
letter-spacing: var(--cds-body-short-01-letter-spacing);
|
||||||
|
line-height: var(--cds-body-short-01-line-height);
|
||||||
|
}
|
||||||
|
|
||||||
.bx--col > h1 {
|
.bx--col > h1 {
|
||||||
font-size: var(--cds-display-01-font-size);
|
font-size: var(--cds-display-01-font-size);
|
||||||
font-weight: var(--cds-display-01-font-weight);
|
font-weight: var(--cds-display-01-font-weight);
|
||||||
|
|
|
@ -10,6 +10,8 @@ components: ["Accordion", "AccordionItem", "AccordionSkeleton"]
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a toggleable accordion component.
|
||||||
|
|
||||||
### Default
|
### Default
|
||||||
|
|
||||||
<Accordion>
|
<Accordion>
|
||||||
|
|
|
@ -10,7 +10,7 @@ components: ["Breadcrumb", "BreadcrumbItem"]
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for building a reusable breadcrumbs component.
|
See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for a reusable breadcrumbs component.
|
||||||
|
|
||||||
### Default
|
### Default
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { CodeSnippet, InlineNotification } from "carbon-components-svelte";
|
import { CodeSnippet, InlineNotification, Link } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
|
||||||
let code = `// helpers.js
|
let code = `// helpers.js
|
||||||
|
@ -27,7 +27,9 @@ let comment = `
|
||||||
`
|
`
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<InlineNotification svx-ignore title="Note:" subtitle="By design, the copy button does not copy text to the clipboard. You will need to write your own logic." kind="info" hideCloseButton />
|
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
|
||||||
|
<div class="body-short-01">By design, the copy button does not copy text to the clipboard. You will need to write your own logic. Refer to the <Link href="/recipes/CopyableCodeSnippet">CopyableCodeSnippet recipe</Link> for an example.</div>
|
||||||
|
</InlineNotification>
|
||||||
|
|
||||||
### Default (single-line)
|
### Default (single-line)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
components: ["ComposedModal", "ModalHeader", "ModalBody", "ModalFooter", "Checkbox"]
|
components: ["ComposedModal", "ModalHeader", "ModalBody", "ModalFooter"]
|
||||||
---
|
---
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
import { CopyButton, InlineNotification } from "carbon-components-svelte";
|
import { CopyButton, InlineNotification, Link } from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<InlineNotification svx-ignore title="Note:" subtitle="By design, the copy button does not copy text to the clipboard. You will need to write your own logic." kind="info" hideCloseButton />
|
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
|
||||||
|
<div class="body-short-01">By design, the copy button does not copy text to the clipboard. You will need to write your own logic. Refer to the <Link href="/recipes/CopyableCodeSnippet">CopyableCodeSnippet recipe</Link> for an example.</div>
|
||||||
|
</InlineNotification>
|
||||||
|
|
||||||
### Default
|
### Default
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,12 @@ components: ["RadioButtonGroup", "RadioButton", "RadioButtonSkeleton"]
|
||||||
</RadioButtonGroup>
|
</RadioButtonGroup>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
### Programmatic usage
|
||||||
|
|
||||||
|
Bind the selected value using the `selected` prop.
|
||||||
|
|
||||||
|
<FileSource src="/framed/RadioButton/ProgrammaticRadioButton" />
|
||||||
|
|
||||||
### Label text aligned left
|
### Label text aligned left
|
||||||
|
|
||||||
<FormGroup legendText="Storage tier (disk)">
|
<FormGroup legendText="Storage tier (disk)">
|
||||||
|
|
|
@ -7,9 +7,9 @@ components: ["ToggleSmall", "ToggleSmallSkeleton"]
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<InlineNotification svx-ignore title="Deprecation warning" kind="warning" hideCloseButton>
|
<InlineNotification svx-ignore title="Deprecation warning:" kind="warning" hideCloseButton>
|
||||||
<div>
|
<div>
|
||||||
This component will be removed in version 1.0.0. Use the <Link href="/components/Toggle#small-size">Toggle small variant</Link> instead.
|
This component will be removed in the next major release. Use the <Link href="/components/Toggle#small-size">Toggle small variant</Link> instead.
|
||||||
</div>
|
</div>
|
||||||
</InlineNotification>
|
</InlineNotification>
|
||||||
|
|
||||||
|
|
43
docs/src/pages/framed/Accordion/ExpandableAccordion.svelte
Normal file
43
docs/src/pages/framed/Accordion/ExpandableAccordion.svelte
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<script>
|
||||||
|
export let items = [
|
||||||
|
{
|
||||||
|
title: "Natural Language Classifier",
|
||||||
|
description:
|
||||||
|
"Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Natural Language Understanding",
|
||||||
|
description:
|
||||||
|
"Analyze text to extract meta-data from content such as concepts, entities, emotion, relations, sentiment and more.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Language Translator",
|
||||||
|
description:
|
||||||
|
"Translate text, documents, and websites from one language to another. Create industry or region-specific translations via the service's customization capability.",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
import { Accordion, AccordionItem, Button } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
let open = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
kind="ghost"
|
||||||
|
size="field"
|
||||||
|
on:click="{() => {
|
||||||
|
open = !open;
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
{open ? 'Collapse' : 'Expand'}
|
||||||
|
all
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Accordion>
|
||||||
|
{#each items as item}
|
||||||
|
<AccordionItem open="{open}">
|
||||||
|
<h5 slot="title">{item.title}</h5>
|
||||||
|
<p>{item.description}</p>
|
||||||
|
</AccordionItem>
|
||||||
|
{/each}
|
||||||
|
</Accordion>
|
|
@ -5,4 +5,4 @@
|
||||||
import copy from "clipboard-copy";
|
import copy from "clipboard-copy";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CodeSnippet on:click="{() => copy(code)}">{code}</CodeSnippet>
|
<CodeSnippet on:click="{() => copy(code)}" code="{code}" />
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
ButtonSet,
|
||||||
|
Button,
|
||||||
|
FormGroup,
|
||||||
|
RadioButtonGroup,
|
||||||
|
RadioButton,
|
||||||
|
} from "carbon-components-svelte";
|
||||||
|
|
||||||
|
let plan = "standard";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<FormGroup legendText="Storage tier (disk)">
|
||||||
|
<RadioButtonGroup bind:selected="{plan}">
|
||||||
|
<RadioButton labelText="Free (1 GB)" value="free" />
|
||||||
|
<RadioButton labelText="Standard (10 GB)" value="standard" />
|
||||||
|
<RadioButton labelText="Pro (128 GB)" value="pro" />
|
||||||
|
</RadioButtonGroup>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<ButtonSet>
|
||||||
|
{#each ['free', 'standard', 'pro'] as value}
|
||||||
|
<Button
|
||||||
|
on:click="{() => {
|
||||||
|
plan = value;
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
Select "{value}"
|
||||||
|
</Button>
|
||||||
|
{/each}
|
||||||
|
</ButtonSet>
|
||||||
|
|
||||||
|
<div style="margin: var(--cds-layout-01) 0">
|
||||||
|
Selected plan:
|
||||||
|
<strong>{plan}</strong>
|
||||||
|
</div>
|
|
@ -6,10 +6,12 @@ layout: recipe
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
The [CodeSnippet](/components/CodeSnippet) and [CopyButton](/components/CopyButton) do not include logic to copy the supplied `code` text.
|
The [CodeSnippet](/components/CodeSnippet) and [CopyButton](/components/CopyButton) components do not include logic to copy the supplied `code` text.
|
||||||
|
|
||||||
|
You can use a third party open source module like [clipboard-copy](https://www.npmjs.com/package/clipboard-copy) that is compatible with modern web browsers.
|
||||||
|
|
||||||
## clipboard-copy
|
## clipboard-copy
|
||||||
|
|
||||||
This example uses [clipboard-copy](https://www.npmjs.com/package/clipboard-copy), a lightweight module designed for the web.
|
This documentation website uses [clipboard-copy](https://www.npmjs.com/package/clipboard-copy).
|
||||||
|
|
||||||
<FileSource src="/framed/CopyableCodeSnippet/CopyableCodeSnippet" />
|
<FileSource src="/framed/CopyableCodeSnippet/CopyableCodeSnippet" />
|
||||||
|
|
13
docs/src/pages/recipes/ExpandableAccordion.svx
Normal file
13
docs/src/pages/recipes/ExpandableAccordion.svx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
layout: recipe
|
||||||
|
---
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Preview from "../../components/Preview.svelte";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
## Expandable accordion
|
||||||
|
|
||||||
|
This example expands and collapses all accordion items.
|
||||||
|
|
||||||
|
<FileSource src="/framed/Accordion/ExpandableAccordion" />
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "carbon-components-svelte",
|
"name": "carbon-components-svelte",
|
||||||
"version": "0.23.0",
|
"version": "0.23.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": "IBM",
|
"author": "IBM",
|
||||||
"description": "Svelte implementation of the Carbon Design System",
|
"description": "Svelte implementation of the Carbon Design System",
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
export let id = undefined;
|
export let id = undefined;
|
||||||
|
|
||||||
import { createEventDispatcher, setContext } from "svelte";
|
import { beforeUpdate, createEventDispatcher, onMount, setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
@ -40,11 +40,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: (value) => {
|
update: (value) => {
|
||||||
selectedValue.set(value);
|
selected = value;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$: selected = $selectedValue;
|
onMount(() => {
|
||||||
|
$selectedValue = selected
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeUpdate(() => {
|
||||||
|
$selectedValue = selected
|
||||||
|
})
|
||||||
|
|
||||||
|
$: $selectedValue, (() => {
|
||||||
|
selected = $selectedValue
|
||||||
|
})
|
||||||
$: dispatch("change", $selectedValue);
|
$: dispatch("change", $selectedValue);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue