Strip out RadioTileGroup

This commit is contained in:
Richard O'flynn 2020-12-01 00:40:10 +00:00
commit c37d7b3760
9 changed files with 10 additions and 123 deletions

View file

@ -29,7 +29,7 @@
import { getContext } from "svelte";
import CheckmarkFilled16 from "carbon-icons-svelte/lib/CheckmarkFilled16";
const { add, update, selectedValue } = getContext("RadioTileGroup");
const { add, update, selectedValue } = getContext("TileGroup");
add({ value, checked });

View file

@ -1,43 +0,0 @@
<script>
/**
* Specify the selected tile value
* @type {any}
*/
export let selectedValue = undefined;
/** Set to `true` to disable the tile group */
export let disabled = false;
/** Specify the legend text */
export let legend = "";
import { createEventDispatcher, setContext } from "svelte";
import { writable } from "svelte/store";
const dispatch = createEventDispatcher();
const _selectedValue = writable(selectedValue);
setContext("RadioTileGroup", {
selectedValue: _selectedValue,
add: ({ checked, value }) => {
if (checked) {
_selectedValue.set(value);
}
},
update: (value) => {
_selectedValue.set(value);
},
});
$: selectedValue = $_selectedValue;
$: dispatch("select", $_selectedValue);
</script>
<fieldset disabled="{disabled}" class:bx--tile-group="{true}" {...$$restProps}>
{#if legend}
<legend class:bx--label="{true}">{legend}</legend>
{/if}
<div>
<slot />
</div>
</fieldset>

View file

@ -17,7 +17,7 @@
const dispatch = createEventDispatcher();
const selectedValue = writable(selected);
setContext("RadioTileGroup", {
setContext("TileGroup", {
selectedValue,
add: ({ checked, value }) => {
if (checked) {

View file

@ -4,5 +4,4 @@ export { default as ExpandableTile } from "./ExpandableTile.svelte";
export { default as SelectableTile } from "./SelectableTile.svelte";
export { default as RadioTile } from "./RadioTile.svelte";
export { default as TileGroup } from "./TileGroup.svelte";
export { default as RadioTileGroup } from "./RadioTileGroup.svelte";
export { default as SelectableTileGroup } from "./SelectableTileGroup.svelte";

View file

@ -107,7 +107,6 @@ export {
SelectableTile,
RadioTile,
TileGroup,
RadioTileGroup,
SelectableTileGroup,
} from "./Tile";
export { TimePicker, TimePickerSelect } from "./TimePicker";