mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 11:59:34 +00:00
Strip out RadioTileGroup
This commit is contained in:
parent
480337f9af
commit
c37d7b3760
9 changed files with 10 additions and 123 deletions
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -17,7 +17,7 @@
|
|||
const dispatch = createEventDispatcher();
|
||||
const selectedValue = writable(selected);
|
||||
|
||||
setContext("RadioTileGroup", {
|
||||
setContext("TileGroup", {
|
||||
selectedValue,
|
||||
add: ({ checked, value }) => {
|
||||
if (checked) {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -107,7 +107,6 @@ export {
|
|||
SelectableTile,
|
||||
RadioTile,
|
||||
TileGroup,
|
||||
RadioTileGroup,
|
||||
SelectableTileGroup,
|
||||
} from "./Tile";
|
||||
export { TimePicker, TimePickerSelect } from "./TimePicker";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue