Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: SelectableTileGroup #439

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9af756b
Add padding prop to Grid component
ispyinternet Nov 27, 2020
06ecbe7
Fix file name
ispyinternet Nov 27, 2020
585341d
Build lib
ispyinternet Nov 27, 2020
47f6292
Merge master
ispyinternet Nov 27, 2020
f17b35d
Typo
ispyinternet Nov 27, 2020
3c59a6c
Move DataTableSkelton 3119restProps to container
ispyinternet Nov 27, 2020
36987b2
Merge branch 'master' of github.com:IBM/carbon-components-svelte
ispyinternet Nov 27, 2020
626fd99
Merge branch 'master' of github.com:IBM/carbon-components-svelte
ispyinternet Nov 30, 2020
fe5c571
WIP: SelectableTileGroup
ispyinternet Nov 30, 2020
184c3d9
Some fixes
ispyinternet Nov 30, 2020
5f5293a
Some fixes
ispyinternet Nov 30, 2020
94f5965
Some fixes
ispyinternet Nov 30, 2020
d874180
Some fixes
ispyinternet Nov 30, 2020
a249b61
Some fixes
ispyinternet Nov 30, 2020
b5ec601
Some fixes
ispyinternet Nov 30, 2020
060b53b
Some fixes
ispyinternet Nov 30, 2020
1d1fe47
Some fixes
ispyinternet Nov 30, 2020
98cee82
Some fixes
ispyinternet Nov 30, 2020
4c3ea78
Some fixes
ispyinternet Nov 30, 2020
5b9bc98
Some fixes
ispyinternet Nov 30, 2020
5ef181d
Remove light prop from SelectableTileGroup
ispyinternet Nov 30, 2020
746ce92
implement change requests
ispyinternet Dec 1, 2020
10da838
add build
ispyinternet Dec 1, 2020
480337f
implement change requests
ispyinternet Dec 1, 2020
c37d7b3
Strip out RadioTileGroup
ispyinternet Dec 1, 2020
b83d6ad
update fix required for both branches of the if statement! - may as w…
ispyinternet Dec 1, 2020
ed9d109
Fix failing RadioTile test
ispyinternet Dec 1, 2020
80f49f6
Prepare for pull request
ispyinternet Dec 1, 2020
4665e28
chore: delete RadioTileGroup.d.ts
metonym Dec 1, 2020
de1c2d0
Fix binding bug
ispyinternet Dec 1, 2020
17a77b6
Merge remote-tracking branch 'origin/master'
ispyinternet Dec 1, 2020
ce8e0b2
Merge remote-tracking branch 'ispyinternet/master'
ispyinternet Dec 1, 2020
ef76f2c
Revert RadioTile tabindex
ispyinternet Dec 1, 2020
9db8f9d
Support fieldset disabled
ispyinternet Dec 1, 2020
95bfb72
Support fieldset disabled
ispyinternet Dec 1, 2020
21f75af
Merge branch 'master' of github.com:ispyinternet/carbon-components-sv…
ispyinternet Dec 1, 2020
5a11a49
Move tabindex to input element
ispyinternet Dec 1, 2020
b380393
docs(selectable-tile): add use cases
metonym Dec 6, 2020
03b7be1
chore: reset selected value in controlled example
metonym Dec 6, 2020
5a4328e
try to fix reactivity
ispyinternet Dec 10, 2020
70d50f7
try to fix reactivity
ispyinternet Dec 10, 2020
677f6b5
try to fix reactivity
ispyinternet Dec 10, 2020
37dd97e
try to fix reactivity
ispyinternet Dec 10, 2020
fe84e9a
try to fix reactivity
ispyinternet Dec 10, 2020
3b1efdd
try to fix reactivity
ispyinternet Dec 10, 2020
b5d641d
try to fix reactivity
ispyinternet Dec 10, 2020
4d82e78
try to fix reactivity
ispyinternet Dec 10, 2020
1c0f7e7
try to fix reactivity
ispyinternet Dec 10, 2020
7cd0df9
try to fix reactivity
ispyinternet Dec 10, 2020
52240c6
try to fix reactivity
ispyinternet Dec 10, 2020
e6fdda5
try to fix reactivity
ispyinternet Dec 10, 2020
8431b58
try to fix reactivity
ispyinternet Dec 10, 2020
172f54e
try to fix reactivity
ispyinternet Dec 10, 2020
7b3144f
try to fix reactivity
ispyinternet Dec 10, 2020
ac99f8f
try to fix reactivity
ispyinternet Dec 10, 2020
cbdf10d
try to fix reactivity
ispyinternet Dec 10, 2020
7373aa3
try to fix reactivity
ispyinternet Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Component Index

> 155 components exported from [email protected].
> 156 components exported from [email protected].

## Components

Expand Down Expand Up @@ -105,6 +105,7 @@
- [`SelectItemGroup`](#selectitemgroup)
- [`SelectSkeleton`](#selectskeleton)
- [`SelectableTile`](#selectabletile)
- [`SelectableTileGroup`](#selectabletilegroup)
- [`SideNav`](#sidenav)
- [`SideNavItems`](#sidenavitems)
- [`SideNavLink`](#sidenavlink)
Expand Down Expand Up @@ -2904,8 +2905,8 @@ None.
| Prop name | Kind | Reactive | Type | Default value | Description |
| :-------------- | :--------------- | :------- | :---------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------- |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLInputElement</code> | <code>null</code> | Obtain a reference to the input HTML element |
| light | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant |
| selected | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to select the tile |
| light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant |
| title | <code>let</code> | No | <code>string</code> | <code>"title"</code> | Specify the title of the selectable tile |
| value | <code>let</code> | No | <code>string</code> | <code>"value"</code> | Specify the value of the selectable tile |
| tabindex | <code>let</code> | No | <code>string</code> | <code>"0"</code> | Specify the tabindex |
Expand All @@ -2923,11 +2924,35 @@ None.

| Event name | Type | Detail |
| :--------- | :-------- | :----- |
| change | forwarded | -- |
| keydown | forwarded | -- |
| click | forwarded | -- |
| mouseover | forwarded | -- |
| mouseenter | forwarded | -- |
| mouseleave | forwarded | -- |
| keydown | forwarded | -- |

## `SelectableTileGroup`

### Props

| Prop name | Kind | Reactive | Type | Default value | Description |
| :------------- | :--------------- | :------- | :------------------- | ------------------ | -------------------------------------------------------------- |
| selectedValues | <code>let</code> | Yes | <code>any[]</code> | <code>[]</code> | Specify the selected tile's |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the tile group |
| legend | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the legend text |
| light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant throughout the group |

### Slots

| Slot name | Default | Props | Fallback |
| :-------- | :------ | :---- | :------- |
| -- | Yes | -- | -- |

### Events

| Event name | Type | Detail |
| :--------- | :--------- | :----- |
| select | dispatched | -- |

## `SideNav`

Expand Down
59 changes: 55 additions & 4 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"total": 155,
"total": 156,
"components": [
{
"moduleName": "SkeletonText",
Expand Down Expand Up @@ -8534,7 +8534,7 @@
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
"reactive": true
},
{
"name": "title",
Expand Down Expand Up @@ -8609,11 +8609,12 @@
],
"slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
"events": [
{ "type": "forwarded", "name": "change", "element": "input" },
{ "type": "forwarded", "name": "keydown", "element": "input" },
{ "type": "forwarded", "name": "click", "element": "label" },
{ "type": "forwarded", "name": "mouseover", "element": "label" },
{ "type": "forwarded", "name": "mouseenter", "element": "label" },
{ "type": "forwarded", "name": "mouseleave", "element": "label" },
{ "type": "forwarded", "name": "keydown", "element": "label" }
{ "type": "forwarded", "name": "mouseleave", "element": "label" }
],
"typedefs": [],
"rest_props": { "type": "Element", "name": "label" }
Expand Down Expand Up @@ -8744,6 +8745,56 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "fieldset" }
},
{
"moduleName": "SelectableTileGroup",
"filePath": "/src/Tile/SelectableTileGroup.svelte",
"props": [
{
"name": "selectedValues",
"kind": "let",
"description": "Specify the selected tile's",
"type": "any[]",
"value": "[]",
"isFunction": false,
"constant": false,
"reactive": true
},
{
"name": "disabled",
"kind": "let",
"description": "Set to `true` to disable the tile group",
"type": "boolean",
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
},
{
"name": "legend",
"kind": "let",
"description": "Specify the legend text",
"type": "string",
"value": "\"\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{
"name": "light",
"kind": "let",
"description": "Set to `true` to enable the light variant throughout the group",
"type": "boolean",
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
}
],
"slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
"events": [{ "type": "dispatched", "name": "select" }],
"typedefs": [],
"rest_props": { "type": "Element", "name": "fieldset" }
},
{
"moduleName": "TimePicker",
"filePath": "/src/TimePicker/TimePicker.svelte",
Expand Down
9 changes: 5 additions & 4 deletions docs/src/pages/components/RadioTile.svx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ components: ["TileGroup", "RadioTile"]
import Preview from "../../components/Preview.svelte";
</script>


### Default

<TileGroup legend="Service pricing tiers">
Expand All @@ -24,13 +25,13 @@ components: ["TileGroup", "RadioTile"]
### Light variant

<TileGroup legend="Service pricing tiers">
<RadioTile value="0" checked>
<RadioTile light value="0" checked>
ispyinternet marked this conversation as resolved.
Show resolved Hide resolved
Lite plan
</RadioTile>
<RadioTile value="1">
<RadioTile light value="1">
Standard plan
</RadioTile>
<RadioTile value="2">
<RadioTile light value="2">
Plus plan
</RadioTile>
</TileGroup>
</TileGroup>
38 changes: 19 additions & 19 deletions docs/src/pages/components/SelectableTile.svx
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
---
components: ["SelectableTile"]
components: ["SelectableTile", "SelectableTileGroup"]
---

<script>
import { SelectableTile } from "carbon-components-svelte";
import { SelectableTile, SelectableTileGroup } from "carbon-components-svelte";
import Preview from "../../components/Preview.svelte";
</script>

### Multi-selectable tiles
### Default

<div role="group" aria-label="selectable tiles">
<SelectableTile selected>
Multi-select Tile
<SelectableTileGroup legend="Select the options you require">
<SelectableTile title="Option 1" value="option1" selected>
Option 1
</SelectableTile>
<SelectableTile selected>
Multi-select Tile
<SelectableTile title="Option 2" value="2" selected>
Option 2
</SelectableTile>
<SelectableTile>
Multi-select Tile
<SelectableTile light title="Option 3" value="3">
Option 3 (light variant)
</SelectableTile>
</div>
</SelectableTileGroup>

### Light variant

<div role="group" aria-label="selectable tiles">
<SelectableTile light selected>
Multi-select Tile
<SelectableTileGroup light legend="Select the options you require">
<SelectableTile title="Option 1" value="1" selected>
Option 1
</SelectableTile>
<SelectableTile light selected>
Multi-select Tile
<SelectableTile title="Option 2" value="2" selected>
Option 2
</SelectableTile>
<SelectableTile light>
Multi-select Tile
<SelectableTile title="Option 3" value="3">
Option 3
</SelectableTile>
</div>
</SelectableTileGroup>
116 changes: 116 additions & 0 deletions docs/src/pages/framed/SelectableTile/SelectableTileReactive.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<script>
import {
SelectableTileGroup,
SelectableTile,
Button,
} from "carbon-components-svelte";

let selectedValues = ["1"];
let selectedValues2 = [];
let selectedValues3 = ["1", "3"];
let selectedValues3_control = [
{ value: "1", selected: true },
{ value: "2", selected: false },
{ value: "3", selected: false },
];
</script>

<SelectableTileGroup
bind:selectedValues
legend="Select the options you require"
>
<SelectableTile title="Option 1" value="1">Option 1</SelectableTile>
<SelectableTile title="Option 2" value="2">Option 2</SelectableTile>
<SelectableTile title="Option 3" value="3">
Option 3 (light variant)
</SelectableTile>
</SelectableTileGroup>

<div>
{selectedValues.join(', ')}

<Button
on:click="{() => {
selectedValues = [];
}}"
>
Reset selectedValues
</Button>
</div>

<SelectableTileGroup
bind:selectedValues="{selectedValues2}"
legend="Select the options you require"
>
<SelectableTile title="Option 1" value="1">Option 1</SelectableTile>
<SelectableTile title="Option 2" value="2" selected>Option 2</SelectableTile>
<SelectableTile title="Option 3" selected value="3">
Option 3 (light variant)
</SelectableTile>
</SelectableTileGroup>

<div>
{selectedValues2.join(', ')}

<Button
on:click="{() => {
selectedValues2 = [];
}}"
>
Reset selectedValues2
</Button>
</div>

<SelectableTileGroup
bind:selectedValues="{selectedValues3}"
legend="Select the options you require"
>
{#each selectedValues3_control as item}
<SelectableTile value="{item.value}" selected="{item.selected}">
{item.value}
</SelectableTile>
{/each}
</SelectableTileGroup>

<div>
{selectedValues3.join(', ')}

<Button
on:click="{() => {
selectedValues3_control = selectedValues3_control.map((item) => {
return { ...item, selected: false };
});
}}"
>
Reset selectedValues3
</Button>
</div>

<h2>#key fix</h2>

<SelectableTileGroup
bind:selectedValues="{selectedValues3}"
legend="Select the options you require"
>
{#key selectedValues3_control}
{#each selectedValues3_control as item}
<SelectableTile value="{item.value}" selected="{item.selected}">
{item.value}
</SelectableTile>
{/each}
{/key}
</SelectableTileGroup>

<div>
{selectedValues3.join(', ')}

<Button
on:click="{() => {
selectedValues3_control = selectedValues3_control.map((item) => {
return { ...item, selected: false };
});
}}"
>
Reset selectedValues3
</Button>
</div>
2 changes: 1 addition & 1 deletion src/DataTableSkeleton/DataTableSkeleton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
class:bx--data-table--short="{size === 'short'}"
class:bx--data-table--tall="{size === 'tall'}"
class:bx--data-table--zebra="{zebra}"
{...$$restProps}
on:click
on:mouseover
on:mouseenter
on:mouseleave
{...$$restProps}
>
<thead>
<tr>
Expand Down
Loading