carbon-components-svelte 0.99.0 → 0.99.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -7
- package/package.json +6 -7
- package/src/CodeSnippet/CodeSnippet.svelte +2 -1
- package/{types → src}/CodeSnippet/CodeSnippet.svelte.d.ts +8 -1
- package/src/ComboBox/ComboBox.svelte +4 -4
- package/{types → src}/ComboBox/ComboBox.svelte.d.ts +6 -2
- package/src/ComposedModal/ComposedModal.svelte +1 -1
- package/{types → src}/ComposedModal/ComposedModal.svelte.d.ts +3 -1
- package/{types → src}/ComposedModal/ModalFooter.svelte.d.ts +5 -1
- package/src/DataTable/DataTable.svelte +76 -59
- package/{types → src}/DataTable/DataTable.svelte.d.ts +18 -7
- package/src/DataTable/data-table-utils.d.ts +20 -0
- package/src/DataTable/data-table-utils.js +13 -4
- package/src/Dropdown/Dropdown.svelte +3 -3
- package/{types → src}/Dropdown/Dropdown.svelte.d.ts +6 -2
- package/src/FormGroup/FormGroup.svelte +1 -1
- package/{types → src}/Grid/Column.svelte.d.ts +4 -1
- package/{types → src}/LocalStorage/LocalStorage.svelte.d.ts +4 -1
- package/src/Modal/Modal.svelte +1 -1
- package/{types → src}/Modal/Modal.svelte.d.ts +6 -2
- package/src/MultiSelect/MultiSelect.svelte +2 -2
- package/{types → src}/MultiSelect/MultiSelect.svelte.d.ts +2 -1
- package/{types → src}/Notification/InlineNotification.svelte.d.ts +3 -1
- package/{types → src}/Notification/NotificationQueue.svelte.d.ts +2 -1
- package/{types → src}/Notification/ToastNotification.svelte.d.ts +3 -1
- package/src/NumberInput/NumberInput.svelte +80 -10
- package/src/OverflowMenu/OverflowMenu.svelte +1 -1
- package/{types → src}/OverflowMenu/OverflowMenu.svelte.d.ts +4 -1
- package/{types → src}/Pagination/Pagination.svelte.d.ts +14 -4
- package/{types → src}/PaginationNav/PaginationNav.svelte.d.ts +9 -3
- package/{types → src}/Popover/Popover.svelte.d.ts +5 -1
- package/{types → src}/RecursiveList/RecursiveList.svelte.d.ts +8 -4
- package/src/Select/Select.svelte +20 -4
- package/src/Slider/Slider.svelte +3 -3
- package/src/Tabs/Tabs.svelte +1 -1
- package/{types → src}/Theme/Theme.svelte.d.ts +5 -1
- package/src/Toggle/Toggle.svelte +1 -1
- package/src/Toggle/ToggleSkeleton.svelte +1 -1
- package/src/TreeView/TreeView.svelte +67 -3
- package/{types → src}/TreeView/TreeView.svelte.d.ts +10 -4
- package/src/TreeView/TreeViewNode.svelte +9 -4
- package/src/TreeView/TreeViewNodeList.svelte +5 -5
- package/src/UIShell/Header.svelte +1 -1
- package/src/DataTable/DataTableTypes.d.ts +0 -18
- package/types/Breakpoint/breakpointObserver.d.ts +0 -28
- package/types/Breakpoint/breakpoints.d.ts +0 -11
- package/types/Breakpoint/index.d.ts +0 -4
- package/types/DataTable/DataTableTypes.d.ts +0 -18
- package/types/DataTable/data-table-utils.d.ts +0 -54
- package/types/RadioButton/RadioButtonRegistry.d.ts +0 -25
- package/types/TreeView/index.d.ts +0 -1
- package/types/Truncate/truncate.d.ts +0 -12
- package/types/utils/filterTreeNodes.d.ts +0 -64
- package/types/utils/toHierarchy.d.ts +0 -21
- package/types/utils/virtualize.d.ts +0 -39
- /package/{types → src}/Accordion/Accordion.svelte.d.ts +0 -0
- /package/{types → src}/Accordion/AccordionItem.svelte.d.ts +0 -0
- /package/{types → src}/Accordion/AccordionSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/AspectRatio/AspectRatio.svelte.d.ts +0 -0
- /package/{types → src}/Breadcrumb/Breadcrumb.svelte.d.ts +0 -0
- /package/{types → src}/Breadcrumb/BreadcrumbItem.svelte.d.ts +0 -0
- /package/{types → src}/Breadcrumb/BreadcrumbSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Breakpoint/Breakpoint.svelte.d.ts +0 -0
- /package/{types → src}/Button/Button.svelte.d.ts +0 -0
- /package/{types → src}/Button/ButtonSet.svelte.d.ts +0 -0
- /package/{types → src}/Button/ButtonSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Checkbox/Checkbox.svelte.d.ts +0 -0
- /package/{types → src}/Checkbox/CheckboxSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Checkbox/InlineCheckbox.svelte.d.ts +0 -0
- /package/{types → src}/CodeSnippet/CodeSnippetSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/ComposedModal/ModalBody.svelte.d.ts +0 -0
- /package/{types → src}/ComposedModal/ModalHeader.svelte.d.ts +0 -0
- /package/{types → src}/ContainedList/ContainedList.svelte.d.ts +0 -0
- /package/{types → src}/ContainedList/ContainedListItem.svelte.d.ts +0 -0
- /package/{types → src}/ContentSwitcher/ContentSwitcher.svelte.d.ts +0 -0
- /package/{types → src}/ContentSwitcher/Switch.svelte.d.ts +0 -0
- /package/{types → src}/ContextMenu/ContextMenu.svelte.d.ts +0 -0
- /package/{types → src}/ContextMenu/ContextMenuDivider.svelte.d.ts +0 -0
- /package/{types → src}/ContextMenu/ContextMenuGroup.svelte.d.ts +0 -0
- /package/{types → src}/ContextMenu/ContextMenuOption.svelte.d.ts +0 -0
- /package/{types → src}/ContextMenu/ContextMenuRadioGroup.svelte.d.ts +0 -0
- /package/{types → src}/CopyButton/CopyButton.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/DataTableSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/Table.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableBody.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableCell.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableContainer.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableHead.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableHeader.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/TableRow.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/Toolbar.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/ToolbarBatchActions.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/ToolbarContent.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/ToolbarMenu.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/ToolbarMenuItem.svelte.d.ts +0 -0
- /package/{types → src}/DataTable/ToolbarSearch.svelte.d.ts +0 -0
- /package/{types → src}/DatePicker/DatePicker.svelte.d.ts +0 -0
- /package/{types → src}/DatePicker/DatePickerInput.svelte.d.ts +0 -0
- /package/{types → src}/DatePicker/DatePickerSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Dropdown/DropdownSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/FileUploader.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/FileUploaderButton.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/FileUploaderDropContainer.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/FileUploaderItem.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/FileUploaderSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/FileUploader/Filename.svelte.d.ts +0 -0
- /package/{types → src}/FluidForm/FluidForm.svelte.d.ts +0 -0
- /package/{types → src}/Form/Form.svelte.d.ts +0 -0
- /package/{types → src}/FormGroup/FormGroup.svelte.d.ts +0 -0
- /package/{types → src}/FormItem/FormItem.svelte.d.ts +0 -0
- /package/{types → src}/FormLabel/FormLabel.svelte.d.ts +0 -0
- /package/{types → src}/Grid/Grid.svelte.d.ts +0 -0
- /package/{types → src}/Grid/Row.svelte.d.ts +0 -0
- /package/{types → src}/Heading/Heading.svelte.d.ts +0 -0
- /package/{types → src}/Heading/Section.svelte.d.ts +0 -0
- /package/{types → src}/ImageLoader/ImageLoader.svelte.d.ts +0 -0
- /package/{types → src}/InlineLoading/InlineLoading.svelte.d.ts +0 -0
- /package/{types → src}/Link/Link.svelte.d.ts +0 -0
- /package/{types → src}/Link/OutboundLink.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBox.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBoxField.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBoxMenu.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBoxMenuIcon.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBoxMenuItem.svelte.d.ts +0 -0
- /package/{types → src}/ListBox/ListBoxSelection.svelte.d.ts +0 -0
- /package/{types → src}/ListItem/ListItem.svelte.d.ts +0 -0
- /package/{types → src}/Loading/Loading.svelte.d.ts +0 -0
- /package/{types → src}/Notification/NotificationActionButton.svelte.d.ts +0 -0
- /package/{types → src}/Notification/NotificationButton.svelte.d.ts +0 -0
- /package/{types → src}/Notification/NotificationIcon.svelte.d.ts +0 -0
- /package/{types → src}/NumberInput/NumberInput.svelte.d.ts +0 -0
- /package/{types → src}/NumberInput/NumberInputSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/OrderedList/OrderedList.svelte.d.ts +0 -0
- /package/{types → src}/OverflowMenu/OverflowMenuItem.svelte.d.ts +0 -0
- /package/{types → src}/Pagination/PaginationSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/PaginationNav/PaginationItem.svelte.d.ts +0 -0
- /package/{types → src}/PaginationNav/PaginationOverflow.svelte.d.ts +0 -0
- /package/{types → src}/Portal/Portal.svelte.d.ts +0 -0
- /package/{types → src}/ProgressBar/ProgressBar.svelte.d.ts +0 -0
- /package/{types → src}/ProgressIndicator/ProgressIndicator.svelte.d.ts +0 -0
- /package/{types → src}/ProgressIndicator/ProgressIndicatorSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/ProgressIndicator/ProgressStep.svelte.d.ts +0 -0
- /package/{types → src}/RadioButton/RadioButton.svelte.d.ts +0 -0
- /package/{types → src}/RadioButton/RadioButtonSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/RadioButtonGroup/RadioButtonGroup.svelte.d.ts +0 -0
- /package/{types → src}/RecursiveList/RecursiveListItem.svelte.d.ts +0 -0
- /package/{types → src}/Search/Search.svelte.d.ts +0 -0
- /package/{types → src}/Search/SearchSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Select/Select.svelte.d.ts +0 -0
- /package/{types → src}/Select/SelectItem.svelte.d.ts +0 -0
- /package/{types → src}/Select/SelectItemGroup.svelte.d.ts +0 -0
- /package/{types → src}/Select/SelectSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/SkeletonPlaceholder/SkeletonPlaceholder.svelte.d.ts +0 -0
- /package/{types → src}/SkeletonText/SkeletonText.svelte.d.ts +0 -0
- /package/{types → src}/Slider/Slider.svelte.d.ts +0 -0
- /package/{types → src}/Slider/SliderSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Stack/Stack.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredList.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListBody.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListCell.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListHead.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListInput.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListRow.svelte.d.ts +0 -0
- /package/{types → src}/StructuredList/StructuredListSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Tabs/Tab.svelte.d.ts +0 -0
- /package/{types → src}/Tabs/TabContent.svelte.d.ts +0 -0
- /package/{types → src}/Tabs/Tabs.svelte.d.ts +0 -0
- /package/{types → src}/Tabs/TabsSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Tag/Tag.svelte.d.ts +0 -0
- /package/{types → src}/Tag/TagSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/TextArea/TextArea.svelte.d.ts +0 -0
- /package/{types → src}/TextArea/TextAreaSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/TextInput/PasswordInput.svelte.d.ts +0 -0
- /package/{types → src}/TextInput/TextInput.svelte.d.ts +0 -0
- /package/{types → src}/TextInput/TextInputSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Tile/ClickableTile.svelte.d.ts +0 -0
- /package/{types → src}/Tile/ExpandableTile.svelte.d.ts +0 -0
- /package/{types → src}/Tile/RadioTile.svelte.d.ts +0 -0
- /package/{types → src}/Tile/SelectableTile.svelte.d.ts +0 -0
- /package/{types → src}/Tile/SelectableTileGroup.svelte.d.ts +0 -0
- /package/{types → src}/Tile/Tile.svelte.d.ts +0 -0
- /package/{types → src}/Tile/TileGroup.svelte.d.ts +0 -0
- /package/{types → src}/TimePicker/TimePicker.svelte.d.ts +0 -0
- /package/{types → src}/TimePicker/TimePickerSelect.svelte.d.ts +0 -0
- /package/{types → src}/Toggle/Toggle.svelte.d.ts +0 -0
- /package/{types → src}/Toggle/ToggleSkeleton.svelte.d.ts +0 -0
- /package/{types → src}/Tooltip/Tooltip.svelte.d.ts +0 -0
- /package/{types → src}/Tooltip/TooltipFooter.svelte.d.ts +0 -0
- /package/{types → src}/TooltipDefinition/TooltipDefinition.svelte.d.ts +0 -0
- /package/{types → src}/TooltipIcon/TooltipIcon.svelte.d.ts +0 -0
- /package/{types → src}/TreeView/TreeViewNode.svelte.d.ts +0 -0
- /package/{types → src}/TreeView/TreeViewNodeList.svelte.d.ts +0 -0
- /package/{types → src}/Truncate/Truncate.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/Content.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HamburgerMenu.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/Header.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderAction.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderActionLink.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderGlobalAction.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderNav.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderNavItem.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderNavMenu.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderPanelDivider.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderPanelLink.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderPanelLinks.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderSearch.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/HeaderUtilities.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNav.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNavDivider.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNavItems.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNavLink.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNavMenu.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SideNavMenuItem.svelte.d.ts +0 -0
- /package/{types → src}/UIShell/SkipToContent.svelte.d.ts +0 -0
- /package/{types → src}/UnorderedList/UnorderedList.svelte.d.ts +0 -0
- /package/{types → src}/icons/Add.svelte.d.ts +0 -0
- /package/{types → src}/icons/ArrowUp.svelte.d.ts +0 -0
- /package/{types → src}/icons/ArrowsVertical.svelte.d.ts +0 -0
- /package/{types → src}/icons/Calendar.svelte.d.ts +0 -0
- /package/{types → src}/icons/CaretDown.svelte.d.ts +0 -0
- /package/{types → src}/icons/CaretLeft.svelte.d.ts +0 -0
- /package/{types → src}/icons/CaretRight.svelte.d.ts +0 -0
- /package/{types → src}/icons/Checkmark.svelte.d.ts +0 -0
- /package/{types → src}/icons/CheckmarkFilled.svelte.d.ts +0 -0
- /package/{types → src}/icons/CheckmarkOutline.svelte.d.ts +0 -0
- /package/{types → src}/icons/ChevronDown.svelte.d.ts +0 -0
- /package/{types → src}/icons/ChevronRight.svelte.d.ts +0 -0
- /package/{types → src}/icons/CircleDash.svelte.d.ts +0 -0
- /package/{types → src}/icons/Close.svelte.d.ts +0 -0
- /package/{types → src}/icons/Copy.svelte.d.ts +0 -0
- /package/{types → src}/icons/EditOff.svelte.d.ts +0 -0
- /package/{types → src}/icons/ErrorFilled.svelte.d.ts +0 -0
- /package/{types → src}/icons/IconSearch.svelte.d.ts +0 -0
- /package/{types → src}/icons/Incomplete.svelte.d.ts +0 -0
- /package/{types → src}/icons/Information.svelte.d.ts +0 -0
- /package/{types → src}/icons/InformationFilled.svelte.d.ts +0 -0
- /package/{types → src}/icons/InformationSquareFilled.svelte.d.ts +0 -0
- /package/{types → src}/icons/Launch.svelte.d.ts +0 -0
- /package/{types → src}/icons/Menu.svelte.d.ts +0 -0
- /package/{types → src}/icons/OverflowMenuHorizontal.svelte.d.ts +0 -0
- /package/{types → src}/icons/OverflowMenuVertical.svelte.d.ts +0 -0
- /package/{types → src}/icons/Settings.svelte.d.ts +0 -0
- /package/{types → src}/icons/Subtract.svelte.d.ts +0 -0
- /package/{types → src}/icons/Switcher.svelte.d.ts +0 -0
- /package/{types → src}/icons/View.svelte.d.ts +0 -0
- /package/{types → src}/icons/ViewOff.svelte.d.ts +0 -0
- /package/{types → src}/icons/Warning.svelte.d.ts +0 -0
- /package/{types → src}/icons/WarningAltFilled.svelte.d.ts +0 -0
- /package/{types → src}/icons/WarningFilled.svelte.d.ts +0 -0
- /package/{types → src}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -20,12 +20,6 @@ The Carbon Svelte portfolio also includes:
|
|
|
20
20
|
|
|
21
21
|
## [Documentation](https://svelte.carbondesignsystem.com)
|
|
22
22
|
|
|
23
|
-
Other forms of documentation are auto-generated:
|
|
24
|
-
|
|
25
|
-
- **[TypeScript definitions](types)**: Component TypeScript definitions
|
|
26
|
-
- **[Component Index](COMPONENT_INDEX.md)**: Component API in Markdown format
|
|
27
|
-
- **[Component API](docs/src/COMPONENT_API.json)**: Component API in JSON format
|
|
28
|
-
|
|
29
23
|
## Installation
|
|
30
24
|
|
|
31
25
|
```sh
|
|
@@ -140,7 +134,7 @@ Import components from `carbon-components-svelte` in the `script` tag of your Sv
|
|
|
140
134
|
</Accordion>
|
|
141
135
|
```
|
|
142
136
|
|
|
143
|
-
**Refer to [
|
|
137
|
+
**Refer to the [documentation site](https://svelte.carbondesignsystem.com) for component API documentation.**
|
|
144
138
|
|
|
145
139
|
## Preprocessors & Plugins
|
|
146
140
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-components-svelte",
|
|
3
|
-
"version": "0.99.
|
|
3
|
+
"version": "0.99.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Svelte implementation of the Carbon Design System",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"svelte": "./src/index.js",
|
|
8
8
|
"main": "./src/index.js",
|
|
9
|
-
"types": "./
|
|
9
|
+
"types": "./src/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"types": "./
|
|
12
|
+
"types": "./src/index.d.ts",
|
|
13
13
|
"svelte": "./src/index.js"
|
|
14
14
|
},
|
|
15
15
|
"./css/*": "./css/*",
|
|
16
16
|
"./src/*.svelte": {
|
|
17
|
-
"types": "./
|
|
17
|
+
"types": "./src/*.svelte.d.ts",
|
|
18
18
|
"import": "./src/*.svelte"
|
|
19
19
|
},
|
|
20
20
|
"./src/*.js": {
|
|
21
|
-
"types": "./
|
|
21
|
+
"types": "./src/*.d.ts",
|
|
22
22
|
"import": "./src/*.js"
|
|
23
23
|
},
|
|
24
24
|
"./src/*": {
|
|
25
|
-
"types": "./
|
|
25
|
+
"types": "./src/*.d.ts",
|
|
26
26
|
"import": "./src/*.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
],
|
|
52
52
|
"files": [
|
|
53
53
|
"src",
|
|
54
|
-
"types",
|
|
55
54
|
"css",
|
|
56
55
|
"telemetry.yml"
|
|
57
56
|
],
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @event {null} expand
|
|
4
4
|
* @event {null} collapse
|
|
5
5
|
* @event {null} copy
|
|
6
|
+
* @restProps {button | span} Rest props are spread to the span (inline variant) or the copy button (single/multi).
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -246,7 +247,7 @@
|
|
|
246
247
|
<div
|
|
247
248
|
role={type === "single" ? "textbox" : undefined}
|
|
248
249
|
tabindex={type === "single" && !disabled ? "0" : undefined}
|
|
249
|
-
aria-label={$$restProps["aria-label"]
|
|
250
|
+
aria-label={$$restProps["aria-label"] ?? copyLabel ?? "code-snippet"}
|
|
250
251
|
class:bx--snippet-container={true}
|
|
251
252
|
style:width="100%"
|
|
252
253
|
style:min-height="{minHeight}px"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SvelteHTMLElements } from "svelte/elements";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
type $RestProps = SvelteHTMLElements["button"] & SvelteHTMLElements["span"];
|
|
5
|
+
|
|
6
|
+
type $Props = {
|
|
4
7
|
/**
|
|
5
8
|
* Set the type of code snippet.
|
|
6
9
|
* @default "single"
|
|
@@ -127,8 +130,12 @@ export type CodeSnippetProps = {
|
|
|
127
130
|
ref?: null | HTMLPreElement;
|
|
128
131
|
|
|
129
132
|
children?: (this: void) => void;
|
|
133
|
+
|
|
134
|
+
[key: `data-${string}`]: any;
|
|
130
135
|
};
|
|
131
136
|
|
|
137
|
+
export type CodeSnippetProps = Omit<$RestProps, keyof $Props> & $Props;
|
|
138
|
+
|
|
132
139
|
export default class CodeSnippet extends SvelteComponentTyped<
|
|
133
140
|
CodeSnippetProps,
|
|
134
141
|
{
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* Override the display of a combobox item.
|
|
25
25
|
* @type {(item: Item) => string}
|
|
26
26
|
*/
|
|
27
|
-
export let itemToString = (item) => item.text
|
|
27
|
+
export let itemToString = (item) => item.text ?? item.id;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Set the selected item by value id.
|
|
@@ -264,10 +264,10 @@
|
|
|
264
264
|
if (listRef && virtualConfig && highlightedIndex >= 0) {
|
|
265
265
|
const itemHeight = virtualConfig.itemHeight;
|
|
266
266
|
const containerHeight = virtualConfig.containerHeight;
|
|
267
|
-
const overscan = virtualConfig.overscan
|
|
267
|
+
const overscan = virtualConfig.overscan ?? 3;
|
|
268
268
|
|
|
269
269
|
// Calculate current visible range based on current scroll position
|
|
270
|
-
const currentScrollTop = listRef.scrollTop
|
|
270
|
+
const currentScrollTop = listRef.scrollTop ?? listScrollTop;
|
|
271
271
|
const visibleStartIndex = Math.max(
|
|
272
272
|
0,
|
|
273
273
|
Math.floor(currentScrollTop / itemHeight) - overscan,
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
selectedItem = undefined;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
$: ariaLabel = $$props["aria-label"]
|
|
417
|
+
$: ariaLabel = $$props["aria-label"] ?? "Choose an item";
|
|
418
418
|
$: menuId = `menu-${id}`;
|
|
419
419
|
$: comboId = `combo-${id}`;
|
|
420
420
|
$: highlightedId = items[highlightedIndex] ? items[highlightedIndex].id : 0;
|
|
@@ -4,7 +4,8 @@ import type { SvelteHTMLElements } from "svelte/elements";
|
|
|
4
4
|
export type ComboBoxItem<Id = any> = {
|
|
5
5
|
id: Id;
|
|
6
6
|
text: string;
|
|
7
|
-
/** Whether the item is disabled */
|
|
7
|
+
/** Whether the item is disabled */
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
type $RestProps = SvelteHTMLElements["input"];
|
|
@@ -222,7 +223,10 @@ export default class ComboBox<
|
|
|
222
223
|
> extends SvelteComponentTyped<
|
|
223
224
|
ComboBoxProps<Item>,
|
|
224
225
|
{
|
|
225
|
-
select: CustomEvent<{
|
|
226
|
+
select: CustomEvent<{
|
|
227
|
+
selectedId: Item["id"];
|
|
228
|
+
selectedItem: Item;
|
|
229
|
+
}>;
|
|
226
230
|
clear: CustomEvent<KeyboardEvent | MouseEvent>;
|
|
227
231
|
input: WindowEventMap["input"];
|
|
228
232
|
keydown: WindowEventMap["keydown"];
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
bind:this={innerModal}
|
|
228
228
|
role="dialog"
|
|
229
229
|
aria-modal="true"
|
|
230
|
-
aria-label={$$props["aria-label"]
|
|
230
|
+
aria-label={$$props["aria-label"] ?? $label ?? undefined}
|
|
231
231
|
class:bx--modal-container={true}
|
|
232
232
|
class:bx--modal-container--xs={size === "xs"}
|
|
233
233
|
class:bx--modal-container--sm={size === "sm"}
|
|
@@ -66,7 +66,9 @@ export default class ComposedModal extends SvelteComponentTyped<
|
|
|
66
66
|
close: CustomEvent<{
|
|
67
67
|
trigger: "escape-key" | "outside-click" | "close-button";
|
|
68
68
|
}>;
|
|
69
|
-
transitionend: CustomEvent<{
|
|
69
|
+
transitionend: CustomEvent<{
|
|
70
|
+
open: boolean;
|
|
71
|
+
}>;
|
|
70
72
|
keydown: WindowEventMap["keydown"];
|
|
71
73
|
click: WindowEventMap["click"];
|
|
72
74
|
mouseover: WindowEventMap["mouseover"];
|
|
@@ -62,6 +62,10 @@ export type ModalFooterProps = Omit<$RestProps, keyof $Props> & $Props;
|
|
|
62
62
|
|
|
63
63
|
export default class ModalFooter extends SvelteComponentTyped<
|
|
64
64
|
ModalFooterProps,
|
|
65
|
-
{
|
|
65
|
+
{
|
|
66
|
+
"click:button--secondary": CustomEvent<{
|
|
67
|
+
text: string;
|
|
68
|
+
}>;
|
|
69
|
+
},
|
|
66
70
|
{ default: Record<string, never> }
|
|
67
71
|
> {}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @generics {Row extends DataTableRow = DataTableRow} Row
|
|
4
4
|
* @template {DataTableRow} Row
|
|
5
|
-
* @typedef {import('./
|
|
5
|
+
* @typedef {import('./data-table-utils.d.ts').PropertyPath<Row>} DataTableKey<Row=DataTableRow>
|
|
6
6
|
* @typedef {any} DataTableValue
|
|
7
7
|
* @typedef {object} DataTableEmptyHeader<Row=DataTableRow>
|
|
8
8
|
* @property {DataTableKey<Row> | (string & {})} key
|
|
@@ -299,14 +299,23 @@
|
|
|
299
299
|
|
|
300
300
|
let refSelectAll = null;
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
let prevBatchSelected = [];
|
|
303
|
+
$: if (
|
|
304
|
+
prevBatchSelected.length !== selectedRowIds.length ||
|
|
305
|
+
selectedRowIds.some((id, i) => id !== prevBatchSelected[i])
|
|
306
|
+
) {
|
|
307
|
+
prevBatchSelected = selectedRowIds;
|
|
308
|
+
batchSelectedIds.set(selectedRowIds);
|
|
309
|
+
}
|
|
303
310
|
$: rowIds = $tableRows.map((row) => row.id);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
);
|
|
307
|
-
$:
|
|
308
|
-
|
|
309
|
-
|
|
311
|
+
|
|
312
|
+
// Use Sets for faster row lookups.
|
|
313
|
+
$: selectedRowIdsSet = new Set(selectedRowIds);
|
|
314
|
+
$: nonSelectableRowIdsSet = new Set(nonSelectableRowIds);
|
|
315
|
+
$: nonExpandableRowIdsSet = new Set(nonExpandableRowIds);
|
|
316
|
+
|
|
317
|
+
$: expandableRowIds = rowIds.filter((id) => !nonExpandableRowIdsSet.has(id));
|
|
318
|
+
$: selectableRowIds = rowIds.filter((id) => !nonSelectableRowIdsSet.has(id));
|
|
310
319
|
$: selectAll =
|
|
311
320
|
selectableRowIds.length > 0 &&
|
|
312
321
|
selectedRowIds.length === selectableRowIds.length;
|
|
@@ -318,37 +327,42 @@
|
|
|
318
327
|
expanded = expandedRowIds.length === expandableRowIds.length;
|
|
319
328
|
}
|
|
320
329
|
$: if (radio || batchSelection) selectable = true;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
330
|
+
|
|
331
|
+
let tableCellsByRowId = {};
|
|
332
|
+
let prevRows;
|
|
333
|
+
let prevHeaders;
|
|
334
|
+
$: if (rows !== prevRows || headers !== prevHeaders) {
|
|
335
|
+
tableCellsByRowId = rows.reduce((rowsAcc, row) => {
|
|
336
|
+
rowsAcc[row.id] = headers.map((header, index) => ({
|
|
337
|
+
key: header.key ?? `key-${index}`,
|
|
338
|
+
value: header.key ? resolvePath(row, header.key) : undefined,
|
|
339
|
+
display: header.display,
|
|
340
|
+
empty: header.empty,
|
|
341
|
+
columnMenu: header.columnMenu,
|
|
342
|
+
}));
|
|
343
|
+
return rowsAcc;
|
|
344
|
+
}, {});
|
|
345
|
+
prevRows = rows;
|
|
346
|
+
prevHeaders = headers;
|
|
347
|
+
}
|
|
348
|
+
|
|
331
349
|
$: $tableRows = rows;
|
|
332
|
-
$: sortedRows = [...$tableRows];
|
|
333
350
|
$: ascending = sortDirection === "ascending";
|
|
334
351
|
$: sorting = sortable && sortKey != null;
|
|
335
352
|
$: sortingHeader = headers.find((header) => header.key === sortKey);
|
|
336
|
-
$:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
}
|
|
353
|
+
$: sortedRows =
|
|
354
|
+
sorting && sortDirection !== "none"
|
|
355
|
+
? [...$tableRows].sort((a, b) => {
|
|
356
|
+
const itemA = resolvePath(a, sortKey);
|
|
357
|
+
const itemB = resolvePath(b, sortKey);
|
|
358
|
+
return compareValues(itemA, itemB, ascending, sortingHeader?.sort);
|
|
359
|
+
})
|
|
360
|
+
: $tableRows;
|
|
347
361
|
$: displayedRows = getDisplayedRows($tableRows, page, pageSize);
|
|
348
362
|
$: displayedSortedRows = getDisplayedRows(sortedRows, page, pageSize);
|
|
349
363
|
|
|
350
364
|
$: hasCustomHeaderWidth = headers.some(
|
|
351
|
-
(header) => header.width
|
|
365
|
+
(header) => header.width ?? header.minWidth,
|
|
352
366
|
);
|
|
353
367
|
</script>
|
|
354
368
|
|
|
@@ -489,12 +503,16 @@
|
|
|
489
503
|
</TableHead>
|
|
490
504
|
<TableBody>
|
|
491
505
|
{#each sorting ? displayedSortedRows : displayedRows as row, i (row.id)}
|
|
506
|
+
{@const isSelected = selectedRowIdsSet.has(row.id)}
|
|
507
|
+
{@const isExpanded = !!expandedRows[row.id]}
|
|
508
|
+
{@const isExpandable = !nonExpandableRowIdsSet.has(row.id)}
|
|
509
|
+
{@const isSelectable = !nonSelectableRowIdsSet.has(row.id)}
|
|
492
510
|
<TableRow
|
|
493
511
|
data-row={row.id}
|
|
494
512
|
data-parent-row={expandable ? true : undefined}
|
|
495
|
-
class="{
|
|
513
|
+
class="{isSelected
|
|
496
514
|
? 'bx--data-table--selected'
|
|
497
|
-
: ''} {
|
|
515
|
+
: ''} {isExpanded ? 'bx--expandable-row' : ''} {expandable
|
|
498
516
|
? 'bx--parent-row'
|
|
499
517
|
: ''} {expandable && parentRowId === row.id
|
|
500
518
|
? 'bx--expandable-row--hover'
|
|
@@ -527,29 +545,27 @@
|
|
|
527
545
|
<TableCell
|
|
528
546
|
class="bx--table-expand"
|
|
529
547
|
headers="expand"
|
|
530
|
-
data-previous-value={
|
|
531
|
-
expandedRows[row.id]
|
|
548
|
+
data-previous-value={isExpandable && isExpanded
|
|
532
549
|
? "collapsed"
|
|
533
550
|
: undefined}
|
|
534
551
|
>
|
|
535
|
-
{#if
|
|
552
|
+
{#if isExpandable}
|
|
536
553
|
<button
|
|
537
554
|
type="button"
|
|
538
555
|
class:bx--table-expand__button={true}
|
|
539
556
|
aria-controls={`expandable-row-${row.id}`}
|
|
540
|
-
aria-label={
|
|
557
|
+
aria-label={isExpanded
|
|
541
558
|
? "Collapse current row"
|
|
542
559
|
: "Expand current row"}
|
|
543
560
|
on:click|stopPropagation={() => {
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
: [...expandedRowIds, row.id];
|
|
561
|
+
const next = new Set(expandedRowIds);
|
|
562
|
+
if (isExpanded) next.delete(row.id);
|
|
563
|
+
else next.add(row.id);
|
|
564
|
+
expandedRowIds = [...next];
|
|
549
565
|
|
|
550
566
|
dispatch("click:row--expand", {
|
|
551
567
|
row,
|
|
552
|
-
expanded: !
|
|
568
|
+
expanded: !isExpanded,
|
|
553
569
|
});
|
|
554
570
|
}}
|
|
555
571
|
>
|
|
@@ -566,13 +582,13 @@
|
|
|
566
582
|
class:bx--table-column-checkbox={true}
|
|
567
583
|
class:bx--table-column-radio={radio}
|
|
568
584
|
>
|
|
569
|
-
{#if
|
|
585
|
+
{#if isSelectable}
|
|
570
586
|
{@const inputId = `${id}-${row.id}`}
|
|
571
587
|
{#if radio}
|
|
572
588
|
<RadioButton
|
|
573
589
|
id={inputId}
|
|
574
590
|
name={inputName}
|
|
575
|
-
checked={
|
|
591
|
+
checked={isSelected}
|
|
576
592
|
value={row.id}
|
|
577
593
|
on:change={() => {
|
|
578
594
|
selectedRowIds = [row.id];
|
|
@@ -583,16 +599,17 @@
|
|
|
583
599
|
<InlineCheckbox
|
|
584
600
|
id={inputId}
|
|
585
601
|
name={inputName}
|
|
586
|
-
checked={
|
|
602
|
+
checked={isSelected}
|
|
587
603
|
value={row.id}
|
|
588
604
|
on:change={() => {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
605
|
+
const next = new Set(selectedRowIds);
|
|
606
|
+
if (isSelected) {
|
|
607
|
+
next.delete(row.id);
|
|
608
|
+
selectedRowIds = [...next];
|
|
593
609
|
dispatch("click:row--select", { row, selected: false });
|
|
594
610
|
} else {
|
|
595
|
-
|
|
611
|
+
next.add(row.id);
|
|
612
|
+
selectedRowIds = [...next];
|
|
596
613
|
dispatch("click:row--select", { row, selected: true });
|
|
597
614
|
}
|
|
598
615
|
}}
|
|
@@ -610,8 +627,8 @@
|
|
|
610
627
|
{cell}
|
|
611
628
|
rowIndex={i}
|
|
612
629
|
cellIndex={j}
|
|
613
|
-
rowSelected={
|
|
614
|
-
rowExpanded={
|
|
630
|
+
rowSelected={isSelected}
|
|
631
|
+
rowExpanded={isExpanded}
|
|
615
632
|
>
|
|
616
633
|
{cell.display ? cell.display(cell.value, row) : cell.value}
|
|
617
634
|
</slot>
|
|
@@ -633,8 +650,8 @@
|
|
|
633
650
|
{cell}
|
|
634
651
|
rowIndex={i}
|
|
635
652
|
cellIndex={j}
|
|
636
|
-
rowSelected={
|
|
637
|
-
rowExpanded={
|
|
653
|
+
rowSelected={isSelected}
|
|
654
|
+
rowExpanded={isExpanded}
|
|
638
655
|
>
|
|
639
656
|
{cell.display ? cell.display(cell.value, row) : cell.value}
|
|
640
657
|
</slot>
|
|
@@ -649,15 +666,15 @@
|
|
|
649
666
|
data-child-row
|
|
650
667
|
class:bx--expandable-row={true}
|
|
651
668
|
on:mouseenter={() => {
|
|
652
|
-
if (
|
|
669
|
+
if (!isExpandable) return;
|
|
653
670
|
parentRowId = row.id;
|
|
654
671
|
}}
|
|
655
672
|
on:mouseleave={() => {
|
|
656
|
-
if (
|
|
673
|
+
if (!isExpandable) return;
|
|
657
674
|
parentRowId = null;
|
|
658
675
|
}}
|
|
659
676
|
>
|
|
660
|
-
{#if
|
|
677
|
+
{#if isExpanded && isExpandable}
|
|
661
678
|
<TableCell
|
|
662
679
|
colspan={selectable ? headers.length + 2 : headers.length + 1}
|
|
663
680
|
>
|
|
@@ -665,7 +682,7 @@
|
|
|
665
682
|
<slot
|
|
666
683
|
name="expanded-row"
|
|
667
684
|
{row}
|
|
668
|
-
rowSelected={
|
|
685
|
+
rowSelected={isSelected}
|
|
669
686
|
/>
|
|
670
687
|
</div>
|
|
671
688
|
</TableCell>
|
|
@@ -2,16 +2,18 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import type { SvelteHTMLElements } from "svelte/elements";
|
|
3
3
|
|
|
4
4
|
export type DataTableKey<Row = DataTableRow> =
|
|
5
|
-
import("./
|
|
5
|
+
import("./data-table-utils.d.ts").PropertyPath<Row>;
|
|
6
6
|
|
|
7
7
|
export type DataTableValue = any;
|
|
8
8
|
|
|
9
9
|
export type DataTableEmptyHeader<Row = DataTableRow> = {
|
|
10
10
|
key: DataTableKey<Row> | (string & {});
|
|
11
|
-
/** Whether the header is empty */
|
|
11
|
+
/** Whether the header is empty */
|
|
12
|
+
empty: boolean;
|
|
12
13
|
display?: (item: DataTableValue, row: Row) => DataTableValue;
|
|
13
14
|
sort?: false | ((a: DataTableValue, b: DataTableValue) => number);
|
|
14
|
-
/** Whether the column menu is enabled */
|
|
15
|
+
/** Whether the column menu is enabled */
|
|
16
|
+
columnMenu?: boolean;
|
|
15
17
|
width?: string;
|
|
16
18
|
minWidth?: string;
|
|
17
19
|
};
|
|
@@ -21,7 +23,8 @@ export type DataTableNonEmptyHeader<Row = DataTableRow> = {
|
|
|
21
23
|
value: DataTableValue;
|
|
22
24
|
display?: (item: DataTableValue, row: Row) => DataTableValue;
|
|
23
25
|
sort?: false | ((a: DataTableValue, b: DataTableValue) => number);
|
|
24
|
-
/** Whether the column menu is enabled */
|
|
26
|
+
/** Whether the column menu is enabled */
|
|
27
|
+
columnMenu?: boolean;
|
|
25
28
|
width?: string;
|
|
26
29
|
minWidth?: string;
|
|
27
30
|
};
|
|
@@ -261,7 +264,9 @@ export default class DataTable<
|
|
|
261
264
|
row?: Row;
|
|
262
265
|
cell?: DataTableCell<Row>;
|
|
263
266
|
}>;
|
|
264
|
-
"click:header--expand": CustomEvent<{
|
|
267
|
+
"click:header--expand": CustomEvent<{
|
|
268
|
+
expanded: boolean;
|
|
269
|
+
}>;
|
|
265
270
|
"click:header": CustomEvent<{
|
|
266
271
|
header: DataTableHeader<Row>;
|
|
267
272
|
sortDirection?: "ascending" | "descending" | "none";
|
|
@@ -279,8 +284,14 @@ export default class DataTable<
|
|
|
279
284
|
}>;
|
|
280
285
|
"mouseenter:row": CustomEvent<Row>;
|
|
281
286
|
"mouseleave:row": CustomEvent<Row>;
|
|
282
|
-
"click:row--expand": CustomEvent<{
|
|
283
|
-
|
|
287
|
+
"click:row--expand": CustomEvent<{
|
|
288
|
+
expanded: boolean;
|
|
289
|
+
row: Row;
|
|
290
|
+
}>;
|
|
291
|
+
"click:row--select": CustomEvent<{
|
|
292
|
+
selected: boolean;
|
|
293
|
+
row: Row;
|
|
294
|
+
}>;
|
|
284
295
|
"click:cell": CustomEvent<{
|
|
285
296
|
cell: DataTableCell<Row>;
|
|
286
297
|
target: EventTarget;
|
|
@@ -45,6 +45,7 @@ export function formatHeaderWidth<
|
|
|
45
45
|
/**
|
|
46
46
|
* Compares two values for sorting in a data table.
|
|
47
47
|
* Handles numbers, strings, null/undefined values, and custom sort functions.
|
|
48
|
+
* @returns {number} Negative if a < b (ascending) or a > b (descending), positive if a > b (ascending) or a < b (descending), 0 if equal
|
|
48
49
|
*/
|
|
49
50
|
export function compareValues<T = unknown>(
|
|
50
51
|
itemA: T,
|
|
@@ -52,3 +53,22 @@ export function compareValues<T = unknown>(
|
|
|
52
53
|
ascending: boolean,
|
|
53
54
|
customSort?: ((a: T, b: T) => number) | false | undefined,
|
|
54
55
|
): number;
|
|
56
|
+
|
|
57
|
+
type PathDepth = [never, 0, 1, 2, ...0[]];
|
|
58
|
+
|
|
59
|
+
type Join<K, P> = K extends string | number
|
|
60
|
+
? P extends string | number
|
|
61
|
+
? `${K}${"" extends P ? "" : "."}${P}`
|
|
62
|
+
: never
|
|
63
|
+
: never;
|
|
64
|
+
|
|
65
|
+
// For performance, the maximum traversal depth is 3.
|
|
66
|
+
export type PropertyPath<T, D extends number = 3> = [D] extends [never]
|
|
67
|
+
? never
|
|
68
|
+
: T extends object
|
|
69
|
+
? {
|
|
70
|
+
[K in keyof T]-?: K extends string | number
|
|
71
|
+
? `${K}` | Join<K, PropertyPath<T[K], PathDepth[D]>>
|
|
72
|
+
: never;
|
|
73
|
+
}[keyof T]
|
|
74
|
+
: "";
|
|
@@ -229,10 +229,19 @@ export function compareValues(itemA, itemB, ascending, customSort) {
|
|
|
229
229
|
} else if (!itemB && itemB !== 0) {
|
|
230
230
|
result = -1;
|
|
231
231
|
} else {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
result = String(itemA).localeCompare(
|
|
233
|
+
String(itemB),
|
|
234
|
+
// Use undefined to default to user's locale
|
|
235
|
+
undefined,
|
|
236
|
+
{
|
|
237
|
+
// Enable numeric sorting for strings that look like numbers
|
|
238
|
+
// E.g., "10" should come after "2"
|
|
239
|
+
numeric: true,
|
|
240
|
+
// Comparison is case- and accent-insensitive
|
|
241
|
+
// E.g., "apple" == "Apple", "café" == "cafe"
|
|
242
|
+
sensitivity: "base",
|
|
243
|
+
},
|
|
244
|
+
);
|
|
236
245
|
}
|
|
237
246
|
}
|
|
238
247
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* Override the display of a dropdown item.
|
|
24
24
|
* @type {(item: Item) => string}
|
|
25
25
|
*/
|
|
26
|
-
export let itemToString = (item) => item.text
|
|
26
|
+
export let itemToString = (item) => item.text ?? item.id;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Specify the selected item id.
|
|
@@ -217,10 +217,10 @@
|
|
|
217
217
|
if (listRef && virtualConfig && highlightedIndex >= 0) {
|
|
218
218
|
const itemHeight = virtualConfig.itemHeight;
|
|
219
219
|
const containerHeight = virtualConfig.containerHeight;
|
|
220
|
-
const overscan = virtualConfig.overscan
|
|
220
|
+
const overscan = virtualConfig.overscan ?? 3;
|
|
221
221
|
|
|
222
222
|
// Calculate current visible range based on current scroll position
|
|
223
|
-
const currentScrollTop = listRef.scrollTop
|
|
223
|
+
const currentScrollTop = listRef.scrollTop ?? listScrollTop;
|
|
224
224
|
const visibleStartIndex = Math.max(
|
|
225
225
|
0,
|
|
226
226
|
Math.floor(currentScrollTop / itemHeight) - overscan,
|
|
@@ -4,7 +4,8 @@ import type { SvelteHTMLElements } from "svelte/elements";
|
|
|
4
4
|
export type DropdownItem<Id = any> = {
|
|
5
5
|
id: Id;
|
|
6
6
|
text: string;
|
|
7
|
-
/** Whether the item is disabled */
|
|
7
|
+
/** Whether the item is disabled */
|
|
8
|
+
disabled?: boolean;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
type $RestProps = SvelteHTMLElements["div"];
|
|
@@ -185,7 +186,10 @@ export default class Dropdown<
|
|
|
185
186
|
> extends SvelteComponentTyped<
|
|
186
187
|
DropdownProps<Item>,
|
|
187
188
|
{
|
|
188
|
-
select: CustomEvent<{
|
|
189
|
+
select: CustomEvent<{
|
|
190
|
+
selectedId: Item["id"];
|
|
191
|
+
selectedItem: Item;
|
|
192
|
+
}>;
|
|
189
193
|
scroll: WindowEventMap["scroll"];
|
|
190
194
|
},
|
|
191
195
|
{ default: { item: Item; index: number } }
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
data-invalid={invalid || undefined}
|
|
25
25
|
class:bx--fieldset={true}
|
|
26
26
|
class:bx--fieldset--no-margin={noMargin}
|
|
27
|
-
aria-labelledby={$$restProps["aria-labelledby"]
|
|
27
|
+
aria-labelledby={$$restProps["aria-labelledby"] ?? legendId}
|
|
28
28
|
{...$$restProps}
|
|
29
29
|
on:click
|
|
30
30
|
on:mouseover
|
|
@@ -3,7 +3,10 @@ import type { SvelteHTMLElements } from "svelte/elements";
|
|
|
3
3
|
|
|
4
4
|
export type ColumnSize = boolean | number;
|
|
5
5
|
|
|
6
|
-
export type ColumnSizeDescriptor = {
|
|
6
|
+
export type ColumnSizeDescriptor = {
|
|
7
|
+
span?: ColumnSize;
|
|
8
|
+
offset: number;
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
export type ColumnBreakpoint = ColumnSize | ColumnSizeDescriptor;
|
|
9
12
|
|
|
@@ -19,7 +19,10 @@ export default class LocalStorage extends SvelteComponentTyped<
|
|
|
19
19
|
{
|
|
20
20
|
save: CustomEvent<null>;
|
|
21
21
|
/** Fires when the stored value changes, either from a bound value update or when localStorage is modified from another tab/window. */
|
|
22
|
-
update: CustomEvent<{
|
|
22
|
+
update: CustomEvent<{
|
|
23
|
+
prevValue: any;
|
|
24
|
+
value: any;
|
|
25
|
+
}>;
|
|
23
26
|
},
|
|
24
27
|
Record<string, never>
|
|
25
28
|
> {
|
package/src/Modal/Modal.svelte
CHANGED
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
$: modalHeadingId = `bx--modal-header__heading--modal-${id}`;
|
|
159
159
|
$: modalBodyId = `bx--modal-body--${id}`;
|
|
160
160
|
$: ariaLabel =
|
|
161
|
-
modalLabel
|
|
161
|
+
modalLabel ?? $$props["aria-label"] ?? modalAriaLabel ?? modalHeading;
|
|
162
162
|
</script>
|
|
163
163
|
|
|
164
164
|
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|