diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index a48dd4f3..a9e89fed 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 148 components exported from carbon-components-svelte 0.19.0 +> 152 components exported from carbon-components-svelte 0.19.0 - Accordion - [Accordion](#accordion) @@ -41,6 +41,10 @@ - [TableHead](#tablehead) - [TableHeader](#tableheader) - [TableRow](#tablerow) + - [Toolbar](#toolbar) + - [ToolbarBatchActions](#toolbarbatchactions) + - [ToolbarContent](#toolbarcontent) + - [ToolbarSearch](#toolbarsearch) - [DataTableSkeleton](#datatableskeleton) - DatePicker - [DatePicker](#datepicker) @@ -205,7 +209,7 @@ import { Accordion } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -239,7 +243,8 @@ import { AccordionItem } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"title"**: `
...
` ### Forwarded events @@ -306,7 +311,7 @@ import { AspectRatio } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -335,7 +340,7 @@ import { Breadcrumb } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -367,7 +372,7 @@ import { BreadcrumbItem } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -443,7 +448,7 @@ import { Button } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -474,7 +479,7 @@ import { ButtonSet } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -608,7 +613,7 @@ import { ClickableTile } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -655,7 +660,7 @@ import { CodeSnippet } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -740,7 +745,7 @@ type ColumnBreakpoint = ColumnSize | ColumnSizeDescriptor; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -831,7 +836,7 @@ import { ComposedModal } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -865,7 +870,7 @@ import { Content } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -895,7 +900,7 @@ import { ContentSwitcher } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -928,7 +933,7 @@ import { Copy } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -980,25 +985,30 @@ import { DataTable } from "carbon-components-svelte"; ### Props -| Prop name | Type | Default value | Description | -| :------------- | :----------------------------------------------------------------------------------------------- | :------------ | :--------------------------------------------------------------------------------------------------- | -| headers | {key: string; value: string; display?: (item) => string; sort?: (a, b) => number}[] | `[]` | Specify the data table headers. | -| rows | Object[] | `[]` | Specify the rows the data table should render. keys defined in `headers` are used for the row ids. | -| size | "compact" | "short" | "tall" | -- | Set the size of the data table. | -| title | string | `""` | Specify the title of the data table. | -| description | string | `""` | Specify the description of the data table. | -| zebra | boolean | `false` | Set to `true` to use zebra styles. | -| sortable | boolean | `false` | Set to `true` for the sortable variant. | -| expandable | boolean | `false` | Set to `true` for the expandable variant. Automatically set to `true` if `batchExpansion` is `true`. | -| batchExpansion | boolean | `false` | Set to `true` to enable batch expansion. | -| expandedRowIds | string[] | `[]` | Specify the row ids to be expanded. | -| stickyHeader | boolean | `false` | Set to `true` to enable a sticky header. | +| Prop name | Type | Default value | Description | +| :------------- | :----------------------------------------------------------------------------------------------- | :------------ | :--------------------------------------------------------------------------------------------------------------- | +| headers | {key: string; value: string; display?: (item) => string; sort?: (a, b) => number}[] | `[]` | Specify the data table headers. | +| rows | Object[] | `[]` | Specify the rows the data table should render. keys defined in `headers` are used for the row ids. | +| size | "compact" | "short" | "tall" | -- | Set the size of the data table. | +| title | string | `""` | Specify the title of the data table. | +| description | string | `""` | Specify the description of the data table. | +| zebra | boolean | `false` | Set to `true` to use zebra styles. | +| sortable | boolean | `false` | Set to `true` for the sortable variant. | +| expandable | boolean | `false` | Set to `true` for the expandable variant. Automatically set to `true` if `batchExpansion` is `true`. | +| batchExpansion | boolean | `false` | Set to `true` to enable batch expansion. | +| expandedRowIds | string[] | `[]` | Specify the row ids to be expanded. | +| radio | boolean | `false` | Set to `true` for the radio selection variant. | +| selectable | boolean | `false` | Set to `true` for the selectable variant. Automatically set to `true` if `radio` or `batchSelection` are `true`. | +| batchSelection | boolean | `false` | Set to `true` to enable batch selection. | +| selectedRowIds | string[] | `[]` | Specify the row ids to be selected. | +| stickyHeader | boolean | `false` | Set to `true` to enable a sticky header. | ### Slots -- `...` -- `...` -- `...` +- **default**: `
...
` +- **"cell-header"**: `
...
` +- **"cell"**: `
...
` +- **"expanded-row"**: `
...
` ### Forwarded events @@ -1010,6 +1020,8 @@ No forwarded events. - `on:click` - `on:click:header` - `on:click:row` +- `on:mouseenter:row` +- `on:mouseleave:row` - `on:click:row--expand` - `on:click:cell` @@ -1077,7 +1089,7 @@ import { DatePicker } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1279,8 +1291,8 @@ import { ExpandableTile } from "carbon-components-svelte"; ### Slots -- `...` -- `...` +- **"above"**: `
...
` +- **"below"**: `
...
` ### Forwarded events @@ -1538,7 +1550,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1564,7 +1576,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1599,7 +1611,7 @@ import { FormGroup } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1628,7 +1640,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1659,7 +1671,7 @@ import { FormLabel } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1696,7 +1708,7 @@ import { Grid } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1730,7 +1742,9 @@ import { Header } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"skip-to-content"**: `
...
` +- **"platform"**: `
...
` ### Forwarded events @@ -1761,7 +1775,8 @@ import { HeaderAction } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"text"**: `
...
` ### Forwarded events @@ -1852,7 +1867,7 @@ import { HeaderGlobalAction } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1880,7 +1895,7 @@ import { HeaderNav } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1949,7 +1964,7 @@ import { HeaderNavMenu } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -1982,7 +1997,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2011,7 +2026,7 @@ import { HeaderPanelLink } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2037,7 +2052,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2063,7 +2078,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2196,7 +2211,8 @@ import { InlineNotification } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"actions"**: `
...
` ### Forwarded events @@ -2231,7 +2247,7 @@ import { Link } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2268,7 +2284,7 @@ import { ListBox } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2309,7 +2325,7 @@ type ListBoxFieldTranslationId = "close" | "open"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2343,7 +2359,7 @@ import { ListBoxMenu } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2408,7 +2424,7 @@ import { ListBoxMenuItem } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2474,7 +2490,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2555,7 +2571,9 @@ import { Modal } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"label"**: `
...
` +- **"heading"**: `
...
` ### Forwarded events @@ -2591,7 +2609,7 @@ import { ModalBody } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2624,7 +2642,7 @@ import { ModalFooter } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2658,7 +2676,7 @@ import { ModalHeader } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2750,7 +2768,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2848,7 +2866,7 @@ import { NotificationTextDetails } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -2902,7 +2920,7 @@ type NumberInputTranslationId = "increment" | "decrement"; ### Slots -- `...` +- **"label"**: `
...
` ### Forwarded events @@ -2965,7 +2983,7 @@ import { OrderedList } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3004,7 +3022,8 @@ import { OverflowMenu } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"menu"**: `
...
` ### Forwarded events @@ -3044,7 +3063,7 @@ import { OverflowMenuItem } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3236,7 +3255,7 @@ import { ProgressIndicator } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3306,7 +3325,7 @@ import { ProgressStep } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3378,7 +3397,7 @@ import { RadioButtonGroup } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3444,7 +3463,7 @@ import { RadioTile } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3482,7 +3501,7 @@ import { Row } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3533,6 +3552,8 @@ No slots. - `on:mouseleave` - `on:change` - `on:input` +- `on:focus` +- `on:blur` ### Dispatched events @@ -3601,7 +3622,7 @@ import { Select } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3661,7 +3682,7 @@ import { SelectItemGroup } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3728,7 +3749,7 @@ import { SelectableTile } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3762,7 +3783,7 @@ import { SideNav } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3788,7 +3809,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3851,7 +3872,7 @@ import { SideNavMenu } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -3974,7 +3995,7 @@ import { SkipToContent } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4082,7 +4103,7 @@ import { StructuredList } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4111,7 +4132,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4143,7 +4164,7 @@ import { StructuredListCell } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4172,7 +4193,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4238,7 +4259,7 @@ import { StructuredListRow } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4306,7 +4327,7 @@ import { Switch } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4343,7 +4364,7 @@ import { Tab } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4373,7 +4394,7 @@ import { TabContent } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4406,7 +4427,7 @@ import { Table } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4432,7 +4453,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4458,7 +4479,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4491,7 +4512,7 @@ import { TableContainer } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4517,7 +4538,7 @@ No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4550,7 +4571,7 @@ import { TableHeader } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4575,13 +4596,11 @@ import { TableRow } from "carbon-components-svelte"; ### Props -| Prop name | Type | Default value | Description | -| :--------- | :------------------- | :------------ | :------------------------------- | -| isSelected | boolean | `false` | Set to `true` to select the row. | +No exported props. ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4615,7 +4634,8 @@ import { Tabs } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"content"**: `
...
` ### Forwarded events @@ -4680,7 +4700,7 @@ import { Tag } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4903,7 +4923,7 @@ import { Tile } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4936,7 +4956,7 @@ import { TileGroup } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -4977,7 +4997,7 @@ import { TimePicker } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -5019,7 +5039,7 @@ import { TimePickerSelect } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -5059,7 +5079,7 @@ import { ToastNotification } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -5220,6 +5240,123 @@ No dispatched events. --- +## Toolbar + +### Import path + +```js +import { Toolbar } from "carbon-components-svelte"; +``` + +### Props + +| Prop name | Type | Default value | Description | +| :-------- | :--------------------------------- | :------------ | :------------------------ | +| size | "sm" | "default" | `"default"` | Specify the toolbar size. | + +### Slots + +- **default**: `
...
` + +### Forwarded events + +No forwarded events. + +### Dispatched events + +No dispatched events. + +--- + +## ToolbarBatchActions + +### Import path + +```js +import { ToolbarBatchActions } from "carbon-components-svelte"; +``` + +### Props + +| Prop name | Type | Default value | Description | +| :------------------ | :--------------------------------------------- | :------------ | :-------------------------------------- | +| formatTotalSelected | (totalSelected: number) => string | -- | Override the total items selected text. | + +### Slots + +- **default**: `
...
` + +### Forwarded events + +No forwarded events. + +### Dispatched events + +No dispatched events. + +--- + +## ToolbarContent + +### Import path + +```js +import { ToolbarContent } from "carbon-components-svelte"; +``` + +### Props + +No exported props. + +### Slots + +- **default**: `
...
` + +### Forwarded events + +No forwarded events. + +### Dispatched events + +No dispatched events. + +--- + +## ToolbarSearch + +### Import path + +```js +import { ToolbarSearch } from "carbon-components-svelte"; +``` + +### Props + +| Prop name | Type | Default value | Description | +| :--------- | :---------------------------------------- | :------------ | :--------------------------------------------- | +| value | string | `""` | Specify the value of the search input. | +| expanded | boolean | `false` | Set to `true` to expand the search bar. | +| persistent | boolean | `false` | Set to `true` to keep the search bar expanded. | +| tabindex | string | `"0"` | Specify the tabindex. | +| ref | null | HTMLInputElement | `null` | Obtain a reference to the input HTML element. | + +### Slots + +No slots. + +### Forwarded events + +- `on:change` +- `on:input` +- `on:focus` +- `on:blur` + +### Dispatched events + +No dispatched events. + +--- + ## Tooltip ### Import path @@ -5248,7 +5385,9 @@ import { Tooltip } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"triggerText"**: `
...
` +- **"icon"**: `
...
` ### Forwarded events @@ -5280,7 +5419,8 @@ import { TooltipDefinition } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` +- **"tooltip"**: `
...
` ### Forwarded events @@ -5316,7 +5456,7 @@ import { TooltipIcon } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events @@ -5348,7 +5488,7 @@ import { UnorderedList } from "carbon-components-svelte"; ### Slots -- `...` +- **default**: `
...
` ### Forwarded events diff --git a/docs/src/PUBLIC_API.json b/docs/src/PUBLIC_API.json index 39897457..69ad6c2a 100644 --- a/docs/src/PUBLIC_API.json +++ b/docs/src/PUBLIC_API.json @@ -2596,6 +2596,42 @@ "description": "Specify the row ids to be expanded" } ], + [ + "radio", + { + "kind": "let", + "value": "false", + "type": "boolean", + "description": "Set to `true` for the radio selection variant" + } + ], + [ + "selectable", + { + "kind": "let", + "value": "false", + "type": "boolean", + "description": "Set to `true` for the selectable variant\nAutomatically set to `true` if `radio` or `batchSelection` are `true`" + } + ], + [ + "batchSelection", + { + "kind": "let", + "value": "false", + "type": "boolean", + "description": "Set to `true` to enable batch selection" + } + ], + [ + "selectedRowIds", + { + "kind": "let", + "value": "[]", + "type": "string[]", + "description": "Specify the row ids to be selected" + } + ], [ "stickyHeader", { @@ -2607,19 +2643,28 @@ ] ], "slots": [ + [ + "default", + { + "attributes": [], + "children": [], + "default": true, + "default_value": "" + } + ], [ "cell-header", { "attributes": [ { - "start": 5608, - "end": 5626, + "start": 7497, + "end": 7515, "type": "Attribute", "name": "name", "value": [ { - "start": 5614, - "end": 5625, + "start": 7503, + "end": 7514, "type": "Text", "raw": "cell-header", "data": "cell-header" @@ -2627,26 +2672,26 @@ ] }, { - "start": 5627, - "end": 5644, + "start": 7516, + "end": 7533, "type": "Attribute", "name": "header", "value": [ { - "start": 5635, - "end": 5643, + "start": 7524, + "end": 7532, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 5636, - "end": 5642, + "start": 7525, + "end": 7531, "loc": { "start": { - "line": 198, + "line": 263, "column": 46 }, "end": { - "line": 198, + "line": 263, "column": 52 } }, @@ -2658,34 +2703,34 @@ ], "children": [ { - "start": 5645, - "end": 5659, + "start": 7534, + "end": 7548, "type": "MustacheTag", "expression": { "type": "MemberExpression", - "start": 5646, - "end": 5658, + "start": 7535, + "end": 7547, "loc": { "start": { - "line": 198, + "line": 263, "column": 56 }, "end": { - "line": 198, + "line": 263, "column": 68 } }, "object": { "type": "Identifier", - "start": 5646, - "end": 5652, + "start": 7535, + "end": 7541, "loc": { "start": { - "line": 198, + "line": 263, "column": 56 }, "end": { - "line": 198, + "line": 263, "column": 62 } }, @@ -2693,15 +2738,15 @@ }, "property": { "type": "Identifier", - "start": 5653, - "end": 5658, + "start": 7542, + "end": 7547, "loc": { "start": { - "line": 198, + "line": 263, "column": 63 }, "end": { - "line": 198, + "line": 263, "column": 68 } }, @@ -2721,14 +2766,14 @@ { "attributes": [ { - "start": 7363, - "end": 7374, + "start": 10544, + "end": 10555, "type": "Attribute", "name": "name", "value": [ { - "start": 7369, - "end": 7373, + "start": 10550, + "end": 10554, "type": "Text", "raw": "cell", "data": "cell" @@ -2736,26 +2781,26 @@ ] }, { - "start": 7375, - "end": 7386, + "start": 10556, + "end": 10567, "type": "Attribute", "name": "row", "value": [ { - "start": 7380, - "end": 7385, + "start": 10561, + "end": 10566, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 7381, - "end": 7384, + "start": 10562, + "end": 10565, "loc": { "start": { - "line": 244, + "line": 344, "column": 38 }, "end": { - "line": 244, + "line": 344, "column": 41 } }, @@ -2765,26 +2810,26 @@ ] }, { - "start": 7387, - "end": 7400, + "start": 10568, + "end": 10581, "type": "Attribute", "name": "cell", "value": [ { - "start": 7393, - "end": 7399, + "start": 10574, + "end": 10580, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 7394, - "end": 7398, + "start": 10575, + "end": 10579, "loc": { "start": { - "line": 244, + "line": 344, "column": 51 }, "end": { - "line": 244, + "line": 344, "column": 55 } }, @@ -2796,69 +2841,69 @@ ], "children": [ { - "start": 7401, - "end": 7418, + "start": 10582, + "end": 10599, "type": "Text", "raw": "\n ", "data": "\n " }, { - "start": 7418, - "end": 7484, + "start": 10599, + "end": 10665, "type": "MustacheTag", "expression": { "type": "ConditionalExpression", - "start": 7419, - "end": 7483, + "start": 10600, + "end": 10664, "loc": { "start": { - "line": 245, + "line": 345, "column": 17 }, "end": { - "line": 245, + "line": 345, "column": 81 } }, "test": { "type": "MemberExpression", - "start": 7419, - "end": 7437, + "start": 10600, + "end": 10618, "loc": { "start": { - "line": 245, + "line": 345, "column": 17 }, "end": { - "line": 245, + "line": 345, "column": 35 } }, "object": { "type": "MemberExpression", - "start": 7419, - "end": 7429, + "start": 10600, + "end": 10610, "loc": { "start": { - "line": 245, + "line": 345, "column": 17 }, "end": { - "line": 245, + "line": 345, "column": 27 } }, "object": { "type": "Identifier", - "start": 7419, - "end": 7426, + "start": 10600, + "end": 10607, "loc": { "start": { - "line": 245, + "line": 345, "column": 17 }, "end": { - "line": 245, + "line": 345, "column": 24 } }, @@ -2866,15 +2911,15 @@ }, "property": { "type": "Identifier", - "start": 7427, - "end": 7428, + "start": 10608, + "end": 10609, "loc": { "start": { - "line": 245, + "line": 345, "column": 25 }, "end": { - "line": 245, + "line": 345, "column": 26 } }, @@ -2885,15 +2930,15 @@ }, "property": { "type": "Identifier", - "start": 7430, - "end": 7437, + "start": 10611, + "end": 10618, "loc": { "start": { - "line": 245, + "line": 345, "column": 28 }, "end": { - "line": 245, + "line": 345, "column": 35 } }, @@ -2904,57 +2949,57 @@ }, "consequent": { "type": "CallExpression", - "start": 7440, - "end": 7470, + "start": 10621, + "end": 10651, "loc": { "start": { - "line": 245, + "line": 345, "column": 38 }, "end": { - "line": 245, + "line": 345, "column": 68 } }, "callee": { "type": "MemberExpression", - "start": 7440, - "end": 7458, + "start": 10621, + "end": 10639, "loc": { "start": { - "line": 245, + "line": 345, "column": 38 }, "end": { - "line": 245, + "line": 345, "column": 56 } }, "object": { "type": "MemberExpression", - "start": 7440, - "end": 7450, + "start": 10621, + "end": 10631, "loc": { "start": { - "line": 245, + "line": 345, "column": 38 }, "end": { - "line": 245, + "line": 345, "column": 48 } }, "object": { "type": "Identifier", - "start": 7440, - "end": 7447, + "start": 10621, + "end": 10628, "loc": { "start": { - "line": 245, + "line": 345, "column": 38 }, "end": { - "line": 245, + "line": 345, "column": 45 } }, @@ -2962,15 +3007,15 @@ }, "property": { "type": "Identifier", - "start": 7448, - "end": 7449, + "start": 10629, + "end": 10630, "loc": { "start": { - "line": 245, + "line": 345, "column": 46 }, "end": { - "line": 245, + "line": 345, "column": 47 } }, @@ -2981,15 +3026,15 @@ }, "property": { "type": "Identifier", - "start": 7451, - "end": 7458, + "start": 10632, + "end": 10639, "loc": { "start": { - "line": 245, + "line": 345, "column": 49 }, "end": { - "line": 245, + "line": 345, "column": 56 } }, @@ -3001,29 +3046,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 7459, - "end": 7469, + "start": 10640, + "end": 10650, "loc": { "start": { - "line": 245, + "line": 345, "column": 57 }, "end": { - "line": 245, + "line": 345, "column": 67 } }, "object": { "type": "Identifier", - "start": 7459, - "end": 7463, + "start": 10640, + "end": 10644, "loc": { "start": { - "line": 245, + "line": 345, "column": 57 }, "end": { - "line": 245, + "line": 345, "column": 61 } }, @@ -3031,15 +3076,15 @@ }, "property": { "type": "Identifier", - "start": 7464, - "end": 7469, + "start": 10645, + "end": 10650, "loc": { "start": { - "line": 245, + "line": 345, "column": 62 }, "end": { - "line": 245, + "line": 345, "column": 67 } }, @@ -3053,29 +3098,29 @@ }, "alternate": { "type": "MemberExpression", - "start": 7473, - "end": 7483, + "start": 10654, + "end": 10664, "loc": { "start": { - "line": 245, + "line": 345, "column": 71 }, "end": { - "line": 245, + "line": 345, "column": 81 } }, "object": { "type": "Identifier", - "start": 7473, - "end": 7477, + "start": 10654, + "end": 10658, "loc": { "start": { - "line": 245, + "line": 345, "column": 71 }, "end": { - "line": 245, + "line": 345, "column": 75 } }, @@ -3083,15 +3128,15 @@ }, "property": { "type": "Identifier", - "start": 7478, - "end": 7483, + "start": 10659, + "end": 10664, "loc": { "start": { - "line": 245, + "line": 345, "column": 76 }, "end": { - "line": 245, + "line": 345, "column": 81 } }, @@ -3103,8 +3148,8 @@ } }, { - "start": 7484, - "end": 7499, + "start": 10665, + "end": 10680, "type": "Text", "raw": "\n ", "data": "\n " @@ -3119,14 +3164,14 @@ { "attributes": [ { - "start": 8035, - "end": 8054, + "start": 11216, + "end": 11235, "type": "Attribute", "name": "name", "value": [ { - "start": 8041, - "end": 8053, + "start": 11222, + "end": 11234, "type": "Text", "raw": "expanded-row", "data": "expanded-row" @@ -3134,26 +3179,26 @@ ] }, { - "start": 8055, - "end": 8066, + "start": 11236, + "end": 11247, "type": "Attribute", "name": "row", "value": [ { - "start": 8060, - "end": 8065, + "start": 11241, + "end": 11246, "type": "MustacheTag", "expression": { "type": "Identifier", - "start": 8061, - "end": 8064, + "start": 11242, + "end": 11245, "loc": { "start": { - "line": 264, + "line": 364, "column": 48 }, "end": { - "line": 264, + "line": 364, "column": 51 } }, @@ -3195,6 +3240,18 @@ "detail": "row" } ], + [ + "mouseenter:row", + { + "detail": "row" + } + ], + [ + "mouseleave:row", + { + "detail": "row" + } + ], [ "click:row--expand", { @@ -10853,8 +10910,8 @@ [ "click", { - "start": 3375, - "end": 3383, + "start": 3445, + "end": 3453, "type": "EventHandler", "name": "click", "modifiers": [], @@ -10864,8 +10921,8 @@ [ "mouseover", { - "start": 2281, - "end": 2293, + "start": 2277, + "end": 2289, "type": "EventHandler", "name": "mouseover", "modifiers": [], @@ -10875,8 +10932,8 @@ [ "mouseenter", { - "start": 2298, - "end": 2311, + "start": 2294, + "end": 2307, "type": "EventHandler", "name": "mouseenter", "modifiers": [], @@ -10886,8 +10943,8 @@ [ "mouseleave", { - "start": 2316, - "end": 2329, + "start": 2312, + "end": 2325, "type": "EventHandler", "name": "mouseleave", "modifiers": [], @@ -10897,8 +10954,8 @@ [ "change", { - "start": 3068, - "end": 3077, + "start": 3109, + "end": 3118, "type": "EventHandler", "name": "change", "modifiers": [], @@ -10908,13 +10965,35 @@ [ "input", { - "start": 3084, - "end": 3092, + "start": 3125, + "end": 3133, "type": "EventHandler", "name": "input", "modifiers": [], "expression": null } + ], + [ + "focus", + { + "start": 3215, + "end": 3223, + "type": "EventHandler", + "name": "focus", + "modifiers": [], + "expression": null + } + ], + [ + "blur", + { + "start": 3230, + "end": 3237, + "type": "EventHandler", + "name": "blur", + "modifiers": [], + "expression": null + } ] ], "dispatched_events": [] @@ -13330,17 +13409,7 @@ }, "TableRow": { "moduleName": "TableRow", - "props": [ - [ - "isSelected", - { - "kind": "let", - "value": "false", - "type": "boolean", - "description": "Set to `true` to select the row" - } - ] - ], + "props": [], "slots": [ [ "default", @@ -13356,8 +13425,8 @@ [ "click", { - "start": 257, - "end": 265, + "start": 25, + "end": 33, "type": "EventHandler", "name": "click", "modifiers": [], @@ -13367,8 +13436,8 @@ [ "mouseover", { - "start": 268, - "end": 280, + "start": 36, + "end": 48, "type": "EventHandler", "name": "mouseover", "modifiers": [], @@ -13378,8 +13447,8 @@ [ "mouseenter", { - "start": 283, - "end": 296, + "start": 51, + "end": 64, "type": "EventHandler", "name": "mouseenter", "modifiers": [], @@ -13389,8 +13458,8 @@ [ "mouseleave", { - "start": 299, - "end": 312, + "start": 67, + "end": 80, "type": "EventHandler", "name": "mouseleave", "modifiers": [], @@ -15446,6 +15515,174 @@ ], "dispatched_events": [] }, + "Toolbar": { + "moduleName": "Toolbar", + "props": [ + [ + "size", + { + "kind": "let", + "value": "\"default\"", + "type": "\"sm\" | \"default\"", + "description": "Specify the toolbar size" + } + ] + ], + "slots": [ + [ + "default", + { + "attributes": [], + "children": [], + "default": true, + "default_value": "" + } + ] + ], + "forwarded_events": [], + "dispatched_events": [] + }, + "ToolbarBatchActions": { + "moduleName": "ToolbarBatchActions", + "props": [ + [ + "formatTotalSelected", + { + "kind": "let", + "type": "(totalSelected: number) => string", + "description": "Override the total items selected text" + } + ] + ], + "slots": [ + [ + "default", + { + "attributes": [], + "children": [], + "default": true, + "default_value": "" + } + ] + ], + "forwarded_events": [], + "dispatched_events": [] + }, + "ToolbarContent": { + "moduleName": "ToolbarContent", + "props": [], + "slots": [ + [ + "default", + { + "attributes": [], + "children": [], + "default": true, + "default_value": "" + } + ] + ], + "forwarded_events": [], + "dispatched_events": [] + }, + "ToolbarSearch": { + "moduleName": "ToolbarSearch", + "props": [ + [ + "value", + { + "kind": "let", + "value": "\"\"", + "type": "string", + "description": "Specify the value of the search input" + } + ], + [ + "expanded", + { + "kind": "let", + "value": "false", + "type": "boolean", + "description": "Set to `true` to expand the search bar" + } + ], + [ + "persistent", + { + "kind": "let", + "value": "false", + "type": "boolean", + "description": "Set to `true` to keep the search bar expanded" + } + ], + [ + "tabindex", + { + "kind": "let", + "value": "\"0\"", + "type": "string", + "description": "Specify the tabindex" + } + ], + [ + "ref", + { + "kind": "let", + "value": "null", + "type": "null | HTMLInputElement", + "description": "Obtain a reference to the input HTML element" + } + ] + ], + "slots": [], + "forwarded_events": [ + [ + "change", + { + "start": 1316, + "end": 1325, + "type": "EventHandler", + "name": "change", + "modifiers": [], + "expression": null + } + ], + [ + "input", + { + "start": 1330, + "end": 1338, + "type": "EventHandler", + "name": "input", + "modifiers": [], + "expression": null + } + ], + [ + "focus", + { + "start": 1343, + "end": 1351, + "type": "EventHandler", + "name": "focus", + "modifiers": [], + "expression": null + } + ], + [ + "blur", + { + "start": 1356, + "end": 1363, + "type": "EventHandler", + "name": "blur", + "modifiers": [], + "expression": null + } + ] + ], + "dispatched_events": [] + }, "Tooltip": { "moduleName": "Tooltip", "props": [ diff --git a/docs/src/components/ComponentApi.svelte b/docs/src/components/ComponentApi.svelte index 62cee32a..da2daf26 100644 --- a/docs/src/components/ComponentApi.svelte +++ b/docs/src/components/ComponentApi.svelte @@ -120,7 +120,9 @@ -{:else}No props.{/if} +{:else} +

No props.

+{/if}

Slots

{#if component.slots.length > 0} diff --git a/docs/src/pages/components/DataTable.svx b/docs/src/pages/components/DataTable.svx index 2ad5f107..a4870c6a 100644 --- a/docs/src/pages/components/DataTable.svx +++ b/docs/src/pages/components/DataTable.svx @@ -1,5 +1,9 @@ +--- +components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarBatchActions"] +--- + @@ -188,6 +192,130 @@ The slot name for the table header cells is `"cell-header"`. ]}" /> +### With toolbar + + + + + + + + + + +### With toolbar (small size) + + + + + + + + + + ### Zebra stripes + +### Selectable + + + +### Initial selected rows + + + +### Selectable with batch actions + + + +### Selectable (radio) + + + ### Expandable + import { DataTable } from "carbon-components-svelte"; + + const headers = [ + { key: "name", value: "Name" }, + { key: "port", value: "Port" }, + { key: "rule", value: "Rule" }, + ]; + + const rows = [ + { id: "a", name: "Load Balancer 3", port: 3000, rule: "Round robin" }, + { id: "b", name: "Load Balancer 1", port: 443, rule: "Round robin" }, + { id: "c", name: "Load Balancer 2", port: 80, rule: "DNS delegation" }, + { id: "d", name: "Load Balancer 6", port: 3000, rule: "Round robin" }, + { id: "e", name: "Load Balancer 4", port: 443, rule: "Round robin" }, + { id: "f", name: "Load Balancer 5", port: 80, rule: "DNS delegation" }, + ]; + + let selectedRowIds = [rows[0].id, rows[1].id]; + + $: console.log("selectedRowIds", selectedRowIds); + + + diff --git a/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbar.svelte b/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbar.svelte new file mode 100644 index 00000000..3824f668 --- /dev/null +++ b/docs/src/pages/framed/DataTable/DataTableBatchSelectionToolbar.svelte @@ -0,0 +1,42 @@ + + + + + + + + + + + + + diff --git a/docs/src/pages/framed/DataTable/RadioSelectableDataTable.svelte b/docs/src/pages/framed/DataTable/RadioSelectableDataTable.svelte new file mode 100644 index 00000000..c78460f3 --- /dev/null +++ b/docs/src/pages/framed/DataTable/RadioSelectableDataTable.svelte @@ -0,0 +1,24 @@ + + + diff --git a/docs/src/pages/framed/DataTable/SelectableDataTable.svelte b/docs/src/pages/framed/DataTable/SelectableDataTable.svelte new file mode 100644 index 00000000..18af903a --- /dev/null +++ b/docs/src/pages/framed/DataTable/SelectableDataTable.svelte @@ -0,0 +1,24 @@ + + + diff --git a/scripts/rollup/generate-index.js b/scripts/rollup/generate-index.js index b6e20490..6ffbb264 100644 --- a/scripts/rollup/generate-index.js +++ b/scripts/rollup/generate-index.js @@ -77,13 +77,15 @@ export function generateIndex(components, groups, pkg) { if (slots.size > 0) { if (slots.get("default")) { - code += "- `...`\n"; - } else { - slots.forEach((slot, name) => { - if (slot.default) return; - code += `- \`...\`\n`; - }); + code += "- **default**: `
...
`\n"; } + + slots.forEach((slot, name) => { + if (slot.default) return; + code += `- **"${name}"**: \`
`let:${attr.name}`) + .join(" ")}>...
\`\n`; + }); } else { code += "No slots.\n\n"; } diff --git a/src/Checkbox/InlineCheckbox.svelte b/src/Checkbox/InlineCheckbox.svelte new file mode 100644 index 00000000..0c1ba5f7 --- /dev/null +++ b/src/Checkbox/InlineCheckbox.svelte @@ -0,0 +1,43 @@ + + + + diff --git a/src/Checkbox/index.js b/src/Checkbox/index.js index fd615337..aaaf1455 100644 --- a/src/Checkbox/index.js +++ b/src/Checkbox/index.js @@ -1,2 +1,3 @@ export { default as Checkbox } from "./Checkbox.svelte"; export { default as CheckboxSkeleton } from "./Checkbox.Skeleton.svelte"; +export { default as InlineCheckbox } from "./InlineCheckbox.svelte"; diff --git a/src/DataTable/DataTable.svelte b/src/DataTable/DataTable.svelte index 02815b9a..7be98550 100644 --- a/src/DataTable/DataTable.svelte +++ b/src/DataTable/DataTable.svelte @@ -61,6 +61,31 @@ */ export let expandedRowIds = []; + /** + * Set to `true` for the radio selection variant + * @type {boolean} [radio=false] + */ + export let radio = false; + + /** + * Set to `true` for the selectable variant + * Automatically set to `true` if `radio` or `batchSelection` are `true` + * @type {boolean} [selectable=false] + */ + export let selectable = false; + + /** + * Set to `true` to enable batch selection + * @type {boolean} [batchSelection=false] + */ + export let batchSelection = false; + + /** + * Specify the row ids to be selected + * @type {string[]} [selectedRowIds=[]] + */ + export let selectedRowIds = []; + /** * Set to `true` to enable a sticky header * @type {boolean} [stickyHeader=false] @@ -70,6 +95,8 @@ import { createEventDispatcher, setContext } from "svelte"; import { writable, derived } from "svelte/store"; import ChevronRight16 from "carbon-icons-svelte/lib/ChevronRight16"; + import { InlineCheckbox } from "../Checkbox"; + import { RadioButton } from "../RadioButton"; import Table from "./Table.svelte"; import TableBody from "./TableBody.svelte"; import TableCell from "./TableCell.svelte"; @@ -84,6 +111,7 @@ descending: "none", }; const dispatch = createEventDispatcher(); + const batchSelectedIds = writable(false); const tableSortable = writable(sortable); const sortHeader = writable({ id: null, @@ -101,6 +129,10 @@ setContext("DataTable", { sortHeader, tableSortable, + batchSelectedIds, + resetSelectedRowIds: () => { + selectedRowIds = []; + }, add: (id) => { headerItems.update((_) => [..._, id]); }, @@ -113,7 +145,13 @@ (a, id) => ({ ...a, [id]: true }), {} ); + + let selectAll = false; + $: batchSelectedIds.set(selectedRowIds); + $: indeterminate = + selectedRowIds.length > 0 && selectedRowIds.length < rows.length; $: if (batchExpansion) expandable = true; + $: if (radio || batchSelection) selectable = true; $: tableSortable.set(sortable); $: headerKeys = headers.map(({ key }) => key); $: rows = rows.map((row) => ({ @@ -149,6 +187,7 @@ + {/if} + {#if selectable && !batchSelection} + + {/if} + {#if batchSelection && !radio} + + {/if} {#each headers as header, i (header.key)} {#if expandable} {/if} + {#if selectable} + + {/if} {#each row.cells as cell, j (cell.key)} + diff --git a/src/DataTable/Toolbar.svelte b/src/DataTable/Toolbar.svelte new file mode 100644 index 00000000..59144786 --- /dev/null +++ b/src/DataTable/Toolbar.svelte @@ -0,0 +1,19 @@ + + +
+
+ +
+
diff --git a/src/DataTable/ToolbarBatchActions.svelte b/src/DataTable/ToolbarBatchActions.svelte new file mode 100644 index 00000000..0ac2b648 --- /dev/null +++ b/src/DataTable/ToolbarBatchActions.svelte @@ -0,0 +1,44 @@ + + +
+
+

+ {formatTotalSelected(batchSelectedIds.length)} +

+
+
+ + +
+
diff --git a/src/DataTable/ToolbarContent.svelte b/src/DataTable/ToolbarContent.svelte new file mode 100644 index 00000000..4045772e --- /dev/null +++ b/src/DataTable/ToolbarContent.svelte @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/DataTable/ToolbarSearch.svelte b/src/DataTable/ToolbarSearch.svelte new file mode 100644 index 00000000..1f5f094c --- /dev/null +++ b/src/DataTable/ToolbarSearch.svelte @@ -0,0 +1,67 @@ + + +
+ +
diff --git a/src/DataTable/index.js b/src/DataTable/index.js index 30ac61d7..83573a0d 100644 --- a/src/DataTable/index.js +++ b/src/DataTable/index.js @@ -6,3 +6,7 @@ export { default as TableContainer } from "./TableContainer.svelte"; export { default as TableHead } from "./TableHead.svelte"; export { default as TableHeader } from "./TableHeader.svelte"; export { default as TableRow } from "./TableRow.svelte"; +export { default as Toolbar } from "./Toolbar.svelte"; +export { default as ToolbarContent } from "./ToolbarContent.svelte"; +export { default as ToolbarSearch } from "./ToolbarSearch.svelte"; +export { default as ToolbarBatchActions } from "./ToolbarBatchActions.svelte"; diff --git a/src/Search/Search.svelte b/src/Search/Search.svelte index 54c110b6..b235927f 100644 --- a/src/Search/Search.svelte +++ b/src/Search/Search.svelte @@ -32,7 +32,7 @@ /** * Specify the value of the search input - * @type {string} [value="text"] + * @type {string} [value=""] */ export let value = ""; @@ -124,11 +124,14 @@ placeholder="{placeholder}" type="{type}" value="{value}" + aria-hidden="{$$props['aria-hidden']}" on:change on:input on:input="{({ target }) => { value = target.value; }}" + on:focus + on:blur />
+ + + {#if radio} + + {:else} + + {/if} +