-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77d1149
commit 3cd6df4
Showing
5 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/lib/themes/carbon/FilterComponents/BooleanFilter.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script lang="ts"> | ||
import RadioButtonGroup from 'carbon-components-svelte/src/RadioButtonGroup/RadioButtonGroup.svelte'; | ||
import Button from 'carbon-components-svelte/src/Button/Button.svelte'; | ||
import CheckboxChecked from 'carbon-icons-svelte/lib/CheckboxChecked.svelte'; | ||
import Checkbox from 'carbon-icons-svelte/lib/Checkbox.svelte'; | ||
import CheckboxIndeterminate from 'carbon-icons-svelte/lib/CheckboxIndeterminate.svelte'; | ||
import type { TextFilter } from '$lib/Filter'; | ||
import { _ } from 'svelte-i18n'; | ||
export let filter: TextFilter; | ||
let value: boolean | null = null; | ||
$: inputValue = value === true ? 1 : value === false ? 0 : ''; | ||
</script> | ||
|
||
<input type="hidden" name={filter.field} value={inputValue} /> | ||
|
||
<RadioButtonGroup | ||
name={filter.field} | ||
legendText={$_(filter.label ?? filter.field)} | ||
labelPosition="right" | ||
> | ||
<Button | ||
value={true} | ||
disabled={value === true} | ||
on:click={() => (value = true)} | ||
size="small" | ||
kind="secondary" | ||
> | ||
<CheckboxChecked size={24} style="color: #0a0;text-align: center" /> | ||
</Button> | ||
<Button | ||
value={false} | ||
disabled={value === false} | ||
on:click={() => (value = false)} | ||
size="small" | ||
kind="secondary" | ||
> | ||
<Checkbox size={24} style="color: #a00;" /> | ||
</Button> | ||
<Button | ||
labelText="null" | ||
value={null} | ||
disabled={value === null} | ||
on:click={() => (value = null)} | ||
size="small" | ||
kind="secondary" | ||
> | ||
<CheckboxIndeterminate /> | ||
</Button> | ||
</RadioButtonGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters