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.
Files changed (250) hide show
  1. package/README.md +1 -7
  2. package/package.json +6 -7
  3. package/src/CodeSnippet/CodeSnippet.svelte +2 -1
  4. package/{types → src}/CodeSnippet/CodeSnippet.svelte.d.ts +8 -1
  5. package/src/ComboBox/ComboBox.svelte +4 -4
  6. package/{types → src}/ComboBox/ComboBox.svelte.d.ts +6 -2
  7. package/src/ComposedModal/ComposedModal.svelte +1 -1
  8. package/{types → src}/ComposedModal/ComposedModal.svelte.d.ts +3 -1
  9. package/{types → src}/ComposedModal/ModalFooter.svelte.d.ts +5 -1
  10. package/src/DataTable/DataTable.svelte +76 -59
  11. package/{types → src}/DataTable/DataTable.svelte.d.ts +18 -7
  12. package/src/DataTable/data-table-utils.d.ts +20 -0
  13. package/src/DataTable/data-table-utils.js +13 -4
  14. package/src/Dropdown/Dropdown.svelte +3 -3
  15. package/{types → src}/Dropdown/Dropdown.svelte.d.ts +6 -2
  16. package/src/FormGroup/FormGroup.svelte +1 -1
  17. package/{types → src}/Grid/Column.svelte.d.ts +4 -1
  18. package/{types → src}/LocalStorage/LocalStorage.svelte.d.ts +4 -1
  19. package/src/Modal/Modal.svelte +1 -1
  20. package/{types → src}/Modal/Modal.svelte.d.ts +6 -2
  21. package/src/MultiSelect/MultiSelect.svelte +2 -2
  22. package/{types → src}/MultiSelect/MultiSelect.svelte.d.ts +2 -1
  23. package/{types → src}/Notification/InlineNotification.svelte.d.ts +3 -1
  24. package/{types → src}/Notification/NotificationQueue.svelte.d.ts +2 -1
  25. package/{types → src}/Notification/ToastNotification.svelte.d.ts +3 -1
  26. package/src/NumberInput/NumberInput.svelte +80 -10
  27. package/src/OverflowMenu/OverflowMenu.svelte +1 -1
  28. package/{types → src}/OverflowMenu/OverflowMenu.svelte.d.ts +4 -1
  29. package/{types → src}/Pagination/Pagination.svelte.d.ts +14 -4
  30. package/{types → src}/PaginationNav/PaginationNav.svelte.d.ts +9 -3
  31. package/{types → src}/Popover/Popover.svelte.d.ts +5 -1
  32. package/{types → src}/RecursiveList/RecursiveList.svelte.d.ts +8 -4
  33. package/src/Select/Select.svelte +20 -4
  34. package/src/Slider/Slider.svelte +3 -3
  35. package/src/Tabs/Tabs.svelte +1 -1
  36. package/{types → src}/Theme/Theme.svelte.d.ts +5 -1
  37. package/src/Toggle/Toggle.svelte +1 -1
  38. package/src/Toggle/ToggleSkeleton.svelte +1 -1
  39. package/src/TreeView/TreeView.svelte +67 -3
  40. package/{types → src}/TreeView/TreeView.svelte.d.ts +10 -4
  41. package/src/TreeView/TreeViewNode.svelte +9 -4
  42. package/src/TreeView/TreeViewNodeList.svelte +5 -5
  43. package/src/UIShell/Header.svelte +1 -1
  44. package/src/DataTable/DataTableTypes.d.ts +0 -18
  45. package/types/Breakpoint/breakpointObserver.d.ts +0 -28
  46. package/types/Breakpoint/breakpoints.d.ts +0 -11
  47. package/types/Breakpoint/index.d.ts +0 -4
  48. package/types/DataTable/DataTableTypes.d.ts +0 -18
  49. package/types/DataTable/data-table-utils.d.ts +0 -54
  50. package/types/RadioButton/RadioButtonRegistry.d.ts +0 -25
  51. package/types/TreeView/index.d.ts +0 -1
  52. package/types/Truncate/truncate.d.ts +0 -12
  53. package/types/utils/filterTreeNodes.d.ts +0 -64
  54. package/types/utils/toHierarchy.d.ts +0 -21
  55. package/types/utils/virtualize.d.ts +0 -39
  56. /package/{types → src}/Accordion/Accordion.svelte.d.ts +0 -0
  57. /package/{types → src}/Accordion/AccordionItem.svelte.d.ts +0 -0
  58. /package/{types → src}/Accordion/AccordionSkeleton.svelte.d.ts +0 -0
  59. /package/{types → src}/AspectRatio/AspectRatio.svelte.d.ts +0 -0
  60. /package/{types → src}/Breadcrumb/Breadcrumb.svelte.d.ts +0 -0
  61. /package/{types → src}/Breadcrumb/BreadcrumbItem.svelte.d.ts +0 -0
  62. /package/{types → src}/Breadcrumb/BreadcrumbSkeleton.svelte.d.ts +0 -0
  63. /package/{types → src}/Breakpoint/Breakpoint.svelte.d.ts +0 -0
  64. /package/{types → src}/Button/Button.svelte.d.ts +0 -0
  65. /package/{types → src}/Button/ButtonSet.svelte.d.ts +0 -0
  66. /package/{types → src}/Button/ButtonSkeleton.svelte.d.ts +0 -0
  67. /package/{types → src}/Checkbox/Checkbox.svelte.d.ts +0 -0
  68. /package/{types → src}/Checkbox/CheckboxSkeleton.svelte.d.ts +0 -0
  69. /package/{types → src}/Checkbox/InlineCheckbox.svelte.d.ts +0 -0
  70. /package/{types → src}/CodeSnippet/CodeSnippetSkeleton.svelte.d.ts +0 -0
  71. /package/{types → src}/ComposedModal/ModalBody.svelte.d.ts +0 -0
  72. /package/{types → src}/ComposedModal/ModalHeader.svelte.d.ts +0 -0
  73. /package/{types → src}/ContainedList/ContainedList.svelte.d.ts +0 -0
  74. /package/{types → src}/ContainedList/ContainedListItem.svelte.d.ts +0 -0
  75. /package/{types → src}/ContentSwitcher/ContentSwitcher.svelte.d.ts +0 -0
  76. /package/{types → src}/ContentSwitcher/Switch.svelte.d.ts +0 -0
  77. /package/{types → src}/ContextMenu/ContextMenu.svelte.d.ts +0 -0
  78. /package/{types → src}/ContextMenu/ContextMenuDivider.svelte.d.ts +0 -0
  79. /package/{types → src}/ContextMenu/ContextMenuGroup.svelte.d.ts +0 -0
  80. /package/{types → src}/ContextMenu/ContextMenuOption.svelte.d.ts +0 -0
  81. /package/{types → src}/ContextMenu/ContextMenuRadioGroup.svelte.d.ts +0 -0
  82. /package/{types → src}/CopyButton/CopyButton.svelte.d.ts +0 -0
  83. /package/{types → src}/DataTable/DataTableSkeleton.svelte.d.ts +0 -0
  84. /package/{types → src}/DataTable/Table.svelte.d.ts +0 -0
  85. /package/{types → src}/DataTable/TableBody.svelte.d.ts +0 -0
  86. /package/{types → src}/DataTable/TableCell.svelte.d.ts +0 -0
  87. /package/{types → src}/DataTable/TableContainer.svelte.d.ts +0 -0
  88. /package/{types → src}/DataTable/TableHead.svelte.d.ts +0 -0
  89. /package/{types → src}/DataTable/TableHeader.svelte.d.ts +0 -0
  90. /package/{types → src}/DataTable/TableRow.svelte.d.ts +0 -0
  91. /package/{types → src}/DataTable/Toolbar.svelte.d.ts +0 -0
  92. /package/{types → src}/DataTable/ToolbarBatchActions.svelte.d.ts +0 -0
  93. /package/{types → src}/DataTable/ToolbarContent.svelte.d.ts +0 -0
  94. /package/{types → src}/DataTable/ToolbarMenu.svelte.d.ts +0 -0
  95. /package/{types → src}/DataTable/ToolbarMenuItem.svelte.d.ts +0 -0
  96. /package/{types → src}/DataTable/ToolbarSearch.svelte.d.ts +0 -0
  97. /package/{types → src}/DatePicker/DatePicker.svelte.d.ts +0 -0
  98. /package/{types → src}/DatePicker/DatePickerInput.svelte.d.ts +0 -0
  99. /package/{types → src}/DatePicker/DatePickerSkeleton.svelte.d.ts +0 -0
  100. /package/{types → src}/Dropdown/DropdownSkeleton.svelte.d.ts +0 -0
  101. /package/{types → src}/FileUploader/FileUploader.svelte.d.ts +0 -0
  102. /package/{types → src}/FileUploader/FileUploaderButton.svelte.d.ts +0 -0
  103. /package/{types → src}/FileUploader/FileUploaderDropContainer.svelte.d.ts +0 -0
  104. /package/{types → src}/FileUploader/FileUploaderItem.svelte.d.ts +0 -0
  105. /package/{types → src}/FileUploader/FileUploaderSkeleton.svelte.d.ts +0 -0
  106. /package/{types → src}/FileUploader/Filename.svelte.d.ts +0 -0
  107. /package/{types → src}/FluidForm/FluidForm.svelte.d.ts +0 -0
  108. /package/{types → src}/Form/Form.svelte.d.ts +0 -0
  109. /package/{types → src}/FormGroup/FormGroup.svelte.d.ts +0 -0
  110. /package/{types → src}/FormItem/FormItem.svelte.d.ts +0 -0
  111. /package/{types → src}/FormLabel/FormLabel.svelte.d.ts +0 -0
  112. /package/{types → src}/Grid/Grid.svelte.d.ts +0 -0
  113. /package/{types → src}/Grid/Row.svelte.d.ts +0 -0
  114. /package/{types → src}/Heading/Heading.svelte.d.ts +0 -0
  115. /package/{types → src}/Heading/Section.svelte.d.ts +0 -0
  116. /package/{types → src}/ImageLoader/ImageLoader.svelte.d.ts +0 -0
  117. /package/{types → src}/InlineLoading/InlineLoading.svelte.d.ts +0 -0
  118. /package/{types → src}/Link/Link.svelte.d.ts +0 -0
  119. /package/{types → src}/Link/OutboundLink.svelte.d.ts +0 -0
  120. /package/{types → src}/ListBox/ListBox.svelte.d.ts +0 -0
  121. /package/{types → src}/ListBox/ListBoxField.svelte.d.ts +0 -0
  122. /package/{types → src}/ListBox/ListBoxMenu.svelte.d.ts +0 -0
  123. /package/{types → src}/ListBox/ListBoxMenuIcon.svelte.d.ts +0 -0
  124. /package/{types → src}/ListBox/ListBoxMenuItem.svelte.d.ts +0 -0
  125. /package/{types → src}/ListBox/ListBoxSelection.svelte.d.ts +0 -0
  126. /package/{types → src}/ListItem/ListItem.svelte.d.ts +0 -0
  127. /package/{types → src}/Loading/Loading.svelte.d.ts +0 -0
  128. /package/{types → src}/Notification/NotificationActionButton.svelte.d.ts +0 -0
  129. /package/{types → src}/Notification/NotificationButton.svelte.d.ts +0 -0
  130. /package/{types → src}/Notification/NotificationIcon.svelte.d.ts +0 -0
  131. /package/{types → src}/NumberInput/NumberInput.svelte.d.ts +0 -0
  132. /package/{types → src}/NumberInput/NumberInputSkeleton.svelte.d.ts +0 -0
  133. /package/{types → src}/OrderedList/OrderedList.svelte.d.ts +0 -0
  134. /package/{types → src}/OverflowMenu/OverflowMenuItem.svelte.d.ts +0 -0
  135. /package/{types → src}/Pagination/PaginationSkeleton.svelte.d.ts +0 -0
  136. /package/{types → src}/PaginationNav/PaginationItem.svelte.d.ts +0 -0
  137. /package/{types → src}/PaginationNav/PaginationOverflow.svelte.d.ts +0 -0
  138. /package/{types → src}/Portal/Portal.svelte.d.ts +0 -0
  139. /package/{types → src}/ProgressBar/ProgressBar.svelte.d.ts +0 -0
  140. /package/{types → src}/ProgressIndicator/ProgressIndicator.svelte.d.ts +0 -0
  141. /package/{types → src}/ProgressIndicator/ProgressIndicatorSkeleton.svelte.d.ts +0 -0
  142. /package/{types → src}/ProgressIndicator/ProgressStep.svelte.d.ts +0 -0
  143. /package/{types → src}/RadioButton/RadioButton.svelte.d.ts +0 -0
  144. /package/{types → src}/RadioButton/RadioButtonSkeleton.svelte.d.ts +0 -0
  145. /package/{types → src}/RadioButtonGroup/RadioButtonGroup.svelte.d.ts +0 -0
  146. /package/{types → src}/RecursiveList/RecursiveListItem.svelte.d.ts +0 -0
  147. /package/{types → src}/Search/Search.svelte.d.ts +0 -0
  148. /package/{types → src}/Search/SearchSkeleton.svelte.d.ts +0 -0
  149. /package/{types → src}/Select/Select.svelte.d.ts +0 -0
  150. /package/{types → src}/Select/SelectItem.svelte.d.ts +0 -0
  151. /package/{types → src}/Select/SelectItemGroup.svelte.d.ts +0 -0
  152. /package/{types → src}/Select/SelectSkeleton.svelte.d.ts +0 -0
  153. /package/{types → src}/SkeletonPlaceholder/SkeletonPlaceholder.svelte.d.ts +0 -0
  154. /package/{types → src}/SkeletonText/SkeletonText.svelte.d.ts +0 -0
  155. /package/{types → src}/Slider/Slider.svelte.d.ts +0 -0
  156. /package/{types → src}/Slider/SliderSkeleton.svelte.d.ts +0 -0
  157. /package/{types → src}/Stack/Stack.svelte.d.ts +0 -0
  158. /package/{types → src}/StructuredList/StructuredList.svelte.d.ts +0 -0
  159. /package/{types → src}/StructuredList/StructuredListBody.svelte.d.ts +0 -0
  160. /package/{types → src}/StructuredList/StructuredListCell.svelte.d.ts +0 -0
  161. /package/{types → src}/StructuredList/StructuredListHead.svelte.d.ts +0 -0
  162. /package/{types → src}/StructuredList/StructuredListInput.svelte.d.ts +0 -0
  163. /package/{types → src}/StructuredList/StructuredListRow.svelte.d.ts +0 -0
  164. /package/{types → src}/StructuredList/StructuredListSkeleton.svelte.d.ts +0 -0
  165. /package/{types → src}/Tabs/Tab.svelte.d.ts +0 -0
  166. /package/{types → src}/Tabs/TabContent.svelte.d.ts +0 -0
  167. /package/{types → src}/Tabs/Tabs.svelte.d.ts +0 -0
  168. /package/{types → src}/Tabs/TabsSkeleton.svelte.d.ts +0 -0
  169. /package/{types → src}/Tag/Tag.svelte.d.ts +0 -0
  170. /package/{types → src}/Tag/TagSkeleton.svelte.d.ts +0 -0
  171. /package/{types → src}/TextArea/TextArea.svelte.d.ts +0 -0
  172. /package/{types → src}/TextArea/TextAreaSkeleton.svelte.d.ts +0 -0
  173. /package/{types → src}/TextInput/PasswordInput.svelte.d.ts +0 -0
  174. /package/{types → src}/TextInput/TextInput.svelte.d.ts +0 -0
  175. /package/{types → src}/TextInput/TextInputSkeleton.svelte.d.ts +0 -0
  176. /package/{types → src}/Tile/ClickableTile.svelte.d.ts +0 -0
  177. /package/{types → src}/Tile/ExpandableTile.svelte.d.ts +0 -0
  178. /package/{types → src}/Tile/RadioTile.svelte.d.ts +0 -0
  179. /package/{types → src}/Tile/SelectableTile.svelte.d.ts +0 -0
  180. /package/{types → src}/Tile/SelectableTileGroup.svelte.d.ts +0 -0
  181. /package/{types → src}/Tile/Tile.svelte.d.ts +0 -0
  182. /package/{types → src}/Tile/TileGroup.svelte.d.ts +0 -0
  183. /package/{types → src}/TimePicker/TimePicker.svelte.d.ts +0 -0
  184. /package/{types → src}/TimePicker/TimePickerSelect.svelte.d.ts +0 -0
  185. /package/{types → src}/Toggle/Toggle.svelte.d.ts +0 -0
  186. /package/{types → src}/Toggle/ToggleSkeleton.svelte.d.ts +0 -0
  187. /package/{types → src}/Tooltip/Tooltip.svelte.d.ts +0 -0
  188. /package/{types → src}/Tooltip/TooltipFooter.svelte.d.ts +0 -0
  189. /package/{types → src}/TooltipDefinition/TooltipDefinition.svelte.d.ts +0 -0
  190. /package/{types → src}/TooltipIcon/TooltipIcon.svelte.d.ts +0 -0
  191. /package/{types → src}/TreeView/TreeViewNode.svelte.d.ts +0 -0
  192. /package/{types → src}/TreeView/TreeViewNodeList.svelte.d.ts +0 -0
  193. /package/{types → src}/Truncate/Truncate.svelte.d.ts +0 -0
  194. /package/{types → src}/UIShell/Content.svelte.d.ts +0 -0
  195. /package/{types → src}/UIShell/HamburgerMenu.svelte.d.ts +0 -0
  196. /package/{types → src}/UIShell/Header.svelte.d.ts +0 -0
  197. /package/{types → src}/UIShell/HeaderAction.svelte.d.ts +0 -0
  198. /package/{types → src}/UIShell/HeaderActionLink.svelte.d.ts +0 -0
  199. /package/{types → src}/UIShell/HeaderGlobalAction.svelte.d.ts +0 -0
  200. /package/{types → src}/UIShell/HeaderNav.svelte.d.ts +0 -0
  201. /package/{types → src}/UIShell/HeaderNavItem.svelte.d.ts +0 -0
  202. /package/{types → src}/UIShell/HeaderNavMenu.svelte.d.ts +0 -0
  203. /package/{types → src}/UIShell/HeaderPanelDivider.svelte.d.ts +0 -0
  204. /package/{types → src}/UIShell/HeaderPanelLink.svelte.d.ts +0 -0
  205. /package/{types → src}/UIShell/HeaderPanelLinks.svelte.d.ts +0 -0
  206. /package/{types → src}/UIShell/HeaderSearch.svelte.d.ts +0 -0
  207. /package/{types → src}/UIShell/HeaderUtilities.svelte.d.ts +0 -0
  208. /package/{types → src}/UIShell/SideNav.svelte.d.ts +0 -0
  209. /package/{types → src}/UIShell/SideNavDivider.svelte.d.ts +0 -0
  210. /package/{types → src}/UIShell/SideNavItems.svelte.d.ts +0 -0
  211. /package/{types → src}/UIShell/SideNavLink.svelte.d.ts +0 -0
  212. /package/{types → src}/UIShell/SideNavMenu.svelte.d.ts +0 -0
  213. /package/{types → src}/UIShell/SideNavMenuItem.svelte.d.ts +0 -0
  214. /package/{types → src}/UIShell/SkipToContent.svelte.d.ts +0 -0
  215. /package/{types → src}/UnorderedList/UnorderedList.svelte.d.ts +0 -0
  216. /package/{types → src}/icons/Add.svelte.d.ts +0 -0
  217. /package/{types → src}/icons/ArrowUp.svelte.d.ts +0 -0
  218. /package/{types → src}/icons/ArrowsVertical.svelte.d.ts +0 -0
  219. /package/{types → src}/icons/Calendar.svelte.d.ts +0 -0
  220. /package/{types → src}/icons/CaretDown.svelte.d.ts +0 -0
  221. /package/{types → src}/icons/CaretLeft.svelte.d.ts +0 -0
  222. /package/{types → src}/icons/CaretRight.svelte.d.ts +0 -0
  223. /package/{types → src}/icons/Checkmark.svelte.d.ts +0 -0
  224. /package/{types → src}/icons/CheckmarkFilled.svelte.d.ts +0 -0
  225. /package/{types → src}/icons/CheckmarkOutline.svelte.d.ts +0 -0
  226. /package/{types → src}/icons/ChevronDown.svelte.d.ts +0 -0
  227. /package/{types → src}/icons/ChevronRight.svelte.d.ts +0 -0
  228. /package/{types → src}/icons/CircleDash.svelte.d.ts +0 -0
  229. /package/{types → src}/icons/Close.svelte.d.ts +0 -0
  230. /package/{types → src}/icons/Copy.svelte.d.ts +0 -0
  231. /package/{types → src}/icons/EditOff.svelte.d.ts +0 -0
  232. /package/{types → src}/icons/ErrorFilled.svelte.d.ts +0 -0
  233. /package/{types → src}/icons/IconSearch.svelte.d.ts +0 -0
  234. /package/{types → src}/icons/Incomplete.svelte.d.ts +0 -0
  235. /package/{types → src}/icons/Information.svelte.d.ts +0 -0
  236. /package/{types → src}/icons/InformationFilled.svelte.d.ts +0 -0
  237. /package/{types → src}/icons/InformationSquareFilled.svelte.d.ts +0 -0
  238. /package/{types → src}/icons/Launch.svelte.d.ts +0 -0
  239. /package/{types → src}/icons/Menu.svelte.d.ts +0 -0
  240. /package/{types → src}/icons/OverflowMenuHorizontal.svelte.d.ts +0 -0
  241. /package/{types → src}/icons/OverflowMenuVertical.svelte.d.ts +0 -0
  242. /package/{types → src}/icons/Settings.svelte.d.ts +0 -0
  243. /package/{types → src}/icons/Subtract.svelte.d.ts +0 -0
  244. /package/{types → src}/icons/Switcher.svelte.d.ts +0 -0
  245. /package/{types → src}/icons/View.svelte.d.ts +0 -0
  246. /package/{types → src}/icons/ViewOff.svelte.d.ts +0 -0
  247. /package/{types → src}/icons/Warning.svelte.d.ts +0 -0
  248. /package/{types → src}/icons/WarningAltFilled.svelte.d.ts +0 -0
  249. /package/{types → src}/icons/WarningFilled.svelte.d.ts +0 -0
  250. /package/{types → src}/index.d.ts +0 -0
@@ -156,8 +156,12 @@ export default class Modal extends SvelteComponentTyped<
156
156
  close: CustomEvent<{
157
157
  trigger: "escape-key" | "outside-click" | "close-button";
158
158
  }>;
159
- transitionend: CustomEvent<{ open: boolean }>;
160
- "click:button--secondary": CustomEvent<{ text: string }>;
159
+ transitionend: CustomEvent<{
160
+ open: boolean;
161
+ }>;
162
+ "click:button--secondary": CustomEvent<{
163
+ text: string;
164
+ }>;
161
165
  keydown: WindowEventMap["keydown"];
162
166
  click: WindowEventMap["click"];
163
167
  mouseover: WindowEventMap["mouseover"];
@@ -27,7 +27,7 @@
27
27
  * Override the display of a multiselect item.
28
28
  * @type {(item: Item) => any}
29
29
  */
30
- export let itemToString = (item) => item.text || item.id;
30
+ export let itemToString = (item) => item.text ?? item.id;
31
31
 
32
32
  /**
33
33
  * Override the item name, title, labelText, or value passed to the user-selectable checkbox input as well as the hidden inputs.
@@ -384,7 +384,7 @@
384
384
  $: menuId = `menu-${id}`;
385
385
  $: comboId = `combo-${id}`;
386
386
  $: inline = type === "inline";
387
- $: ariaLabel = $$props["aria-label"] || "Choose an item";
387
+ $: ariaLabel = $$props["aria-label"] ?? "Choose an item";
388
388
  $: if (
389
389
  selectedIds &&
390
390
  (selectionFeedback === "top" ||
@@ -6,7 +6,8 @@ export type MultiSelectItemText = string;
6
6
  export type MultiSelectItem<Id = any> = {
7
7
  id: Id;
8
8
  text: MultiSelectItemText;
9
- /** Whether the item is disabled */ disabled?: boolean;
9
+ /** Whether the item is disabled */
10
+ disabled?: boolean;
10
11
  };
11
12
 
12
13
  export type MultiSelectContext = {
@@ -86,7 +86,9 @@ export type InlineNotificationProps = Omit<$RestProps, keyof $Props> & $Props;
86
86
  export default class InlineNotification extends SvelteComponentTyped<
87
87
  InlineNotificationProps,
88
88
  {
89
- close: CustomEvent<{ timeout: boolean }>;
89
+ close: CustomEvent<{
90
+ timeout: boolean;
91
+ }>;
90
92
  click: WindowEventMap["click"];
91
93
  mouseover: WindowEventMap["mouseover"];
92
94
  mouseenter: WindowEventMap["mouseenter"];
@@ -1,7 +1,8 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
 
3
3
  export type NotificationData = {
4
- /** Optional id for deduplication */ id?: string;
4
+ /** Optional id for deduplication */
5
+ id?: string;
5
6
  kind?:
6
7
  | "error"
7
8
  | "info"
@@ -99,7 +99,9 @@ export type ToastNotificationProps = Omit<$RestProps, keyof $Props> & $Props;
99
99
  export default class ToastNotification extends SvelteComponentTyped<
100
100
  ToastNotificationProps,
101
101
  {
102
- close: CustomEvent<{ timeout: boolean }>;
102
+ close: CustomEvent<{
103
+ timeout: boolean;
104
+ }>;
103
105
  click: WindowEventMap["click"];
104
106
  mouseover: WindowEventMap["mouseover"];
105
107
  mouseenter: WindowEventMap["mouseenter"];
@@ -122,6 +122,11 @@
122
122
 
123
123
  const dispatch = createEventDispatcher();
124
124
 
125
+ /** Regex to match period/dot characters globally */
126
+ const RE_DOT = /\./g;
127
+ /** Regex to match comma and Arabic decimal separator (٫) globally */
128
+ const RE_COMMA = /[,\u066B]/g;
129
+
125
130
  function updateValue(isIncrementing) {
126
131
  if (allowDecimal) {
127
132
  // When allowEmpty is false and value is null, use default value
@@ -175,19 +180,28 @@
175
180
  $: decrementLabel = translateWithId("decrement");
176
181
  $: hasError = invalid && invalidText && !readonly;
177
182
  $: errorId = `error-${id}`;
183
+ $: warnId = `warn-${id}`;
184
+ $: helperId = `helper-${id}`;
178
185
  $: ariaLabel =
179
186
  $$props["aria-label"] ||
180
187
  "Numeric input field with increment and decrement buttons";
181
188
 
182
189
  let inputValue = value?.toString() ?? "";
190
+ let prevValue = value;
183
191
 
184
192
  // Only use inputValue tracking in allowDecimal mode
185
193
  $: if (allowDecimal) {
194
+ const valueChanged = value !== prevValue;
195
+ prevValue = value;
196
+
186
197
  if (value != null) {
187
198
  const valueStr = value.toString();
188
- // Only update inputValue if it's not the same numeric value
189
- // This allows "1.0" to stay as "1.0" while value is 1
190
- if (parse(inputValue) !== value) {
199
+ const parsedInput = parse(inputValue);
200
+ // Sync inputValue to value when:
201
+ // - The numeric values differ AND input is valid (preserves "1.0" formatting)
202
+ // - OR value changed programmatically (force sync even if input is temporarily invalid)
203
+ // This allows "1.5." to stay visible while user corrects their typo.
204
+ if ((parsedInput !== value && parsedInput !== null) || valueChanged) {
191
205
  inputValue = valueStr;
192
206
  }
193
207
  } else if (value == null && inputValue !== "") {
@@ -195,9 +209,37 @@
195
209
  }
196
210
  }
197
211
 
198
- function parse(raw) {
212
+ /**
213
+ * Simple normalization: treat comma/٫ as decimal separator.
214
+ * Used during typing to avoid mid-keystroke value jumps.
215
+ */
216
+ function normalize(raw) {
217
+ return raw.replace(RE_COMMA, ".");
218
+ }
219
+
220
+ /**
221
+ * Locale-aware normalization for completed input (on blur).
222
+ * When both period and comma/٫ are present, the last separator
223
+ * is the decimal mark; earlier ones are thousands separators.
224
+ * e.g., "1.000,5" → 1000.5, "1,000.5" → 1000.5
225
+ */
226
+ function normalizeLocale(raw) {
227
+ const lastComma = Math.max(raw.lastIndexOf(","), raw.lastIndexOf("\u066B"));
228
+ const lastDot = raw.lastIndexOf(".");
229
+
230
+ if (lastComma !== -1 && lastDot !== -1) {
231
+ if (lastComma > lastDot) {
232
+ return raw.replace(RE_DOT, "").replace(RE_COMMA, ".");
233
+ }
234
+ return raw.replace(RE_COMMA, "");
235
+ }
236
+
237
+ return normalize(raw);
238
+ }
239
+
240
+ function parse(raw, locale = false) {
199
241
  if (raw === "" || raw === "-") return null;
200
- const num = Number(raw);
242
+ const num = Number(locale ? normalizeLocale(raw) : normalize(raw));
201
243
  return Number.isNaN(num) ? null : num;
202
244
  }
203
245
 
@@ -209,7 +251,12 @@
209
251
  function onInput({ target }) {
210
252
  if (allowDecimal) {
211
253
  inputValue = target.value;
212
- value = parse(target.value);
254
+ const parsed = parse(target.value);
255
+ // Preserve last valid value when input is invalid (e.g., "1.5." with two decimals).
256
+ // This provides better UX by letting users see and correct typos without losing data.
257
+ if (parsed !== null || target.value === "" || target.value === "-") {
258
+ value = parsed;
259
+ }
213
260
  } else {
214
261
  value = parse(target.value);
215
262
  }
@@ -218,7 +265,7 @@
218
265
  }
219
266
 
220
267
  function onChange({ target }) {
221
- let parsedValue = parse(target.value);
268
+ let parsedValue = parse(target.value, allowDecimal);
222
269
 
223
270
  // If allowEmpty is false and value would be null, use default value
224
271
  // This prevents the input from staying empty when allowEmpty is false
@@ -232,6 +279,16 @@
232
279
  ref.value = parsedValue.toString();
233
280
  value = parsedValue;
234
281
  }
282
+ } else if (
283
+ allowDecimal &&
284
+ parsedValue === null &&
285
+ target.value !== "" &&
286
+ value !== null
287
+ ) {
288
+ // In allowDecimal mode, normalize invalid input (e.g., "1.5.") back to
289
+ // the last valid value on blur. This provides a clean UX where typos
290
+ // are corrected when the user leaves the field.
291
+ inputValue = value.toString();
235
292
  } else {
236
293
  value = parsedValue;
237
294
  }
@@ -291,7 +348,13 @@
291
348
  value={inputValue}
292
349
  type="text"
293
350
  inputmode="decimal"
294
- aria-describedby={errorId}
351
+ aria-describedby={hasError
352
+ ? errorId
353
+ : warn
354
+ ? warnId
355
+ : helperText
356
+ ? helperId
357
+ : undefined}
295
358
  data-invalid={hasError || undefined}
296
359
  aria-invalid={hasError || undefined}
297
360
  aria-label={labelText ? undefined : ariaLabel}
@@ -314,7 +377,13 @@
314
377
  bind:this={ref}
315
378
  type="number"
316
379
  pattern="[0-9]*"
317
- aria-describedby={errorId}
380
+ aria-describedby={hasError
381
+ ? errorId
382
+ : warn
383
+ ? warnId
384
+ : helperText
385
+ ? helperId
386
+ : undefined}
318
387
  data-invalid={hasError || undefined}
319
388
  aria-invalid={hasError || undefined}
320
389
  aria-label={labelText ? undefined : ariaLabel}
@@ -386,6 +455,7 @@
386
455
  </div>
387
456
  {#if !hasError && !warn && helperText}
388
457
  <div
458
+ id={helperId}
389
459
  class:bx--form__helper-text={true}
390
460
  class:bx--form__helper-text--disabled={disabled}
391
461
  >
@@ -398,7 +468,7 @@
398
468
  </div>
399
469
  {/if}
400
470
  {#if !hasError && warn}
401
- <div id={errorId} class:bx--form-requirement={true}>{warnText}</div>
471
+ <div id={warnId} class:bx--form-requirement={true}>{warnText}</div>
402
472
  {/if}
403
473
  </div>
404
474
  </div>
@@ -191,7 +191,7 @@
191
191
  });
192
192
 
193
193
  $: menuId = `menu-${id}`;
194
- $: ariaLabel = $$props["aria-label"] || "menu";
194
+ $: ariaLabel = $$props["aria-label"] ?? "menu";
195
195
  $: if ($items[$currentIndex]) {
196
196
  focusedId.set($items[$currentIndex].id);
197
197
  }
@@ -118,7 +118,10 @@ export type OverflowMenuProps = Omit<$RestProps, keyof $Props> & $Props;
118
118
  export default class OverflowMenu extends SvelteComponentTyped<
119
119
  OverflowMenuProps,
120
120
  {
121
- close: CustomEvent<{ index?: number; text?: string }>;
121
+ close: CustomEvent<{
122
+ index?: number;
123
+ text?: string;
124
+ }>;
122
125
  click: WindowEventMap["click"];
123
126
  mouseover: WindowEventMap["mouseover"];
124
127
  mouseenter: WindowEventMap["mouseenter"];
@@ -116,13 +116,23 @@ export default class Pagination extends SvelteComponentTyped<
116
116
  PaginationProps,
117
117
  {
118
118
  /** Dispatched when the user changes the page or page size through any interaction. */
119
- change: CustomEvent<{ page?: number; pageSize?: number }>;
119
+ change: CustomEvent<{
120
+ page?: number;
121
+ pageSize?: number;
122
+ }>;
120
123
  /** Dispatched when the user clicks the previous page button. */
121
- "click:button--previous": CustomEvent<{ page: number }>;
124
+ "click:button--previous": CustomEvent<{
125
+ page: number;
126
+ }>;
122
127
  /** Dispatched when the user clicks the next page button. */
123
- "click:button--next": CustomEvent<{ page: number }>;
128
+ "click:button--next": CustomEvent<{
129
+ page: number;
130
+ }>;
124
131
  /** Dispatched reactively whenever the page or page size changes. */
125
- update: CustomEvent<{ pageSize: number; page: number }>;
132
+ update: CustomEvent<{
133
+ pageSize: number;
134
+ page: number;
135
+ }>;
126
136
  },
127
137
  Record<string, never>
128
138
  > {}
@@ -55,9 +55,15 @@ export default class PaginationNav extends SvelteComponentTyped<
55
55
  PaginationNavProps,
56
56
  {
57
57
  /** Fires after every user interaction */
58
- change: CustomEvent<{ page: number }>;
59
- "click:button--previous": CustomEvent<{ page: number }>;
60
- "click:button--next": CustomEvent<{ page: number }>;
58
+ change: CustomEvent<{
59
+ page: number;
60
+ }>;
61
+ "click:button--previous": CustomEvent<{
62
+ page: number;
63
+ }>;
64
+ "click:button--next": CustomEvent<{
65
+ page: number;
66
+ }>;
61
67
  },
62
68
  Record<string, never>
63
69
  > {}
@@ -67,6 +67,10 @@ export type PopoverProps = Omit<$RestProps, keyof $Props> & $Props;
67
67
 
68
68
  export default class Popover extends SvelteComponentTyped<
69
69
  PopoverProps,
70
- { "click:outside": CustomEvent<{ target: HTMLElement }> },
70
+ {
71
+ "click:outside": CustomEvent<{
72
+ target: HTMLElement;
73
+ }>;
74
+ },
71
75
  { default: Record<string, never> }
72
76
  > {}
@@ -2,10 +2,14 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { SvelteHTMLElements } from "svelte/elements";
3
3
 
4
4
  export type RecursiveListNode = {
5
- /** Node text content */ text?: string;
6
- /** Node link URL */ href?: string;
7
- /** Node HTML content */ html?: string;
8
- /** Child nodes */ nodes?: RecursiveListNode[];
5
+ /** Node text content */
6
+ text?: string;
7
+ /** Node link URL */
8
+ href?: string;
9
+ /** Node HTML content */
10
+ html?: string;
11
+ /** Child nodes */
12
+ nodes?: RecursiveListNode[];
9
13
  };
10
14
 
11
15
  type $RestProps = SvelteHTMLElements["ul"] & SvelteHTMLElements["ol"];
@@ -129,6 +129,8 @@
129
129
  });
130
130
 
131
131
  $: errorId = `error-${id}`;
132
+ $: warnId = `warn-${id}`;
133
+ $: helperId = `helper-${id}`;
132
134
  $: selectedValue.set(selected ?? $defaultValue);
133
135
  </script>
134
136
 
@@ -161,7 +163,13 @@
161
163
  >
162
164
  <select
163
165
  bind:this={ref}
164
- aria-describedby={invalid ? errorId : undefined}
166
+ aria-describedby={invalid
167
+ ? errorId
168
+ : warn
169
+ ? warnId
170
+ : helperText
171
+ ? helperId
172
+ : undefined}
165
173
  aria-invalid={invalid || undefined}
166
174
  disabled={disabled || undefined}
167
175
  required={required || undefined}
@@ -192,6 +200,7 @@
192
200
  </div>
193
201
  {#if !invalid && !warn && helperText}
194
202
  <div
203
+ id={helperId}
195
204
  class:bx--form__helper-text={true}
196
205
  class:bx--form__helper-text--disabled={disabled}
197
206
  >
@@ -208,7 +217,13 @@
208
217
  bind:this={ref}
209
218
  {id}
210
219
  {name}
211
- aria-describedby={invalid ? errorId : undefined}
220
+ aria-describedby={invalid
221
+ ? errorId
222
+ : warn
223
+ ? warnId
224
+ : helperText
225
+ ? helperId
226
+ : undefined}
212
227
  disabled={disabled || undefined}
213
228
  required={required || undefined}
214
229
  aria-invalid={invalid || undefined}
@@ -234,8 +249,9 @@
234
249
  />
235
250
  {/if}
236
251
  </div>
237
- {#if !invalid && helperText}
252
+ {#if !invalid && !warn && helperText}
238
253
  <div
254
+ id={helperId}
239
255
  class:bx--form__helper-text={true}
240
256
  class:bx--form__helper-text--disabled={disabled}
241
257
  >
@@ -248,7 +264,7 @@
248
264
  </div>
249
265
  {/if}
250
266
  {#if !invalid && warn}
251
- <div id={errorId} class:bx--form-requirement={true}>
267
+ <div id={warnId} class:bx--form-requirement={true}>
252
268
  {warnText}
253
269
  </div>
254
270
  {/if}
@@ -196,7 +196,7 @@
196
196
  class:bx--slider-container--readonly={readonly}
197
197
  style:width={fullWidth && "100%"}
198
198
  >
199
- <span class:bx--slider__range-label={true}>{minLabel || min}</span>
199
+ <span class:bx--slider__range-label={true}>{minLabel ?? min}</span>
200
200
  <div
201
201
  bind:this={ref}
202
202
  role="presentation"
@@ -247,7 +247,7 @@
247
247
  style:transform="translate(0, -50%) scaleX({left / 100})"
248
248
  ></div>
249
249
  </div>
250
- <span class:bx--slider__range-label={true}>{maxLabel || max}</span>
250
+ <span class:bx--slider__range-label={true}>{maxLabel ?? max}</span>
251
251
  <div class:bx--slider-text-input-wrapper={true}>
252
252
  {#if invalid}
253
253
  <WarningFilled class="bx--slider__invalid-icon" />
@@ -267,7 +267,7 @@
267
267
  class:bx--slider-text-input--warn={warn}
268
268
  {value}
269
269
  aria-labelledby={$$props["aria-label"] ? undefined : labelId}
270
- aria-label={$$props["aria-label"] || "Slider number input"}
270
+ aria-label={$$props["aria-label"] ?? "Slider number input"}
271
271
  {disabled}
272
272
  {readonly}
273
273
  {required}
@@ -241,7 +241,7 @@
241
241
  role="listbox"
242
242
  tabindex="0"
243
243
  class:bx--tabs-trigger={true}
244
- aria-label={$$props["aria-label"] || "listbox"}
244
+ aria-label={$$props["aria-label"] ?? "listbox"}
245
245
  on:click={() => {
246
246
  dropdownHidden = !dropdownHidden;
247
247
  }}
@@ -57,6 +57,10 @@ export type ThemeProps = {
57
57
 
58
58
  export default class Theme extends SvelteComponentTyped<
59
59
  ThemeProps,
60
- { update: CustomEvent<{ theme: CarbonTheme }> },
60
+ {
61
+ update: CustomEvent<{
62
+ theme: CarbonTheme;
63
+ }>;
64
+ },
61
65
  { default: { theme: CarbonTheme } }
62
66
  > {}
@@ -82,7 +82,7 @@
82
82
  {name}
83
83
  />
84
84
  <label
85
- aria-label={labelText ? undefined : $$props["aria-label"] || "Toggle"}
85
+ aria-label={labelText ? undefined : $$props["aria-label"] ?? "Toggle"}
86
86
  for={id}
87
87
  class:bx--toggle-input__label={true}
88
88
  >
@@ -32,7 +32,7 @@
32
32
  <label
33
33
  aria-label={labelText
34
34
  ? undefined
35
- : $$props["aria-label"] || "Toggle is loading"}
35
+ : $$props["aria-label"] ?? "Toggle is loading"}
36
36
  for={id}
37
37
  class:bx--toggle__label={true}
38
38
  class:bx--skeleton={true}
@@ -312,6 +312,10 @@
312
312
  const selectedNodeIds = writable(selectedIds);
313
313
  /** @type {import("svelte/store").Writable<ReadonlyArray<Node["id"]>>} */
314
314
  const expandedNodeIds = writable(expandedIds);
315
+ /** @type {import("svelte/store").Writable<Set<Node["id"]>>} */
316
+ const selectedIdsSetStore = writable(new Set(selectedIds));
317
+ /** @type {import("svelte/store").Writable<Set<Node["id"]>>} */
318
+ const expandedIdsSetStore = writable(new Set(expandedIds));
315
319
 
316
320
  /** @type {HTMLElement | null} */
317
321
  let ref = null;
@@ -329,6 +333,25 @@
329
333
  let expandedIdsSet = new Set(expandedIds);
330
334
  /** @type {ReadonlyArray<Node["id"]>} */
331
335
  let lastExpandedIdsRef = expandedIds;
336
+ /** @type {Node["id"]} */
337
+ let lastActiveIdPushed = activeId;
338
+ /** @type {ReadonlyArray<Node["id"]>} */
339
+ let lastSelectedIdsPushed = selectedIds;
340
+ /** @type {ReadonlyArray<Node["id"]>} */
341
+ let lastExpandedIdsPushed = expandedIds;
342
+
343
+ /**
344
+ * @param {ReadonlyArray<Node["id"]>} a
345
+ * @param {ReadonlyArray<Node["id"]>} b
346
+ * @returns {boolean}
347
+ */
348
+ function arrayIdsEqual(a, b) {
349
+ if (a.length !== b.length) return false;
350
+ for (let i = 0; i < a.length; i++) {
351
+ if (a[i] !== b[i]) return false;
352
+ }
353
+ return true;
354
+ }
332
355
 
333
356
  /** @type {(node: Node) => void} */
334
357
  const clickNode = (node) => {
@@ -369,6 +392,8 @@
369
392
  activeNodeId,
370
393
  selectedNodeIds,
371
394
  expandedNodeIds,
395
+ selectedIdsSetStore,
396
+ expandedIdsSetStore,
372
397
  clickNode,
373
398
  selectNode,
374
399
  expandNode,
@@ -414,14 +439,53 @@
414
439
  $: flattenedNodes = cachedFlattenedNodes ?? [];
415
440
  $: nodeIds = cachedNodeIds ?? [];
416
441
 
442
+ let prevActiveIdForAutoCollapse = activeId;
443
+
417
444
  $: {
418
445
  if (expandedIds !== lastExpandedIdsRef) {
419
446
  expandedIdsSet = new Set(expandedIds);
420
447
  lastExpandedIdsRef = expandedIds;
421
448
  }
422
- activeNodeId.set(activeId);
423
- selectedNodeIds.set(selectedIds);
424
- expandedNodeIds.set(expandedIds);
449
+
450
+ // `autoCollapse` should also be triggered when activeId changes programmatically.
451
+ if (autoCollapse && activeId !== prevActiveIdForAutoCollapse) {
452
+ prevActiveIdForAutoCollapse = activeId;
453
+
454
+ for (const child of nodes) {
455
+ const path = findNodeById(child, activeId);
456
+ if (path) {
457
+ const ancestorIds = path.slice(0, -1).map((n) => n.id);
458
+
459
+ // For each ancestor, collapse its siblings.
460
+ for (const ancestorId of ancestorIds) {
461
+ const siblingIds = findSiblingIds(nodes, ancestorId);
462
+ for (const siblingId of siblingIds) {
463
+ expandedIdsSet.delete(siblingId);
464
+ }
465
+ expandedIdsSet.add(ancestorId);
466
+ }
467
+
468
+ expandedIds = Array.from(expandedIdsSet);
469
+ lastExpandedIdsRef = expandedIds;
470
+ break;
471
+ }
472
+ }
473
+ }
474
+
475
+ if (activeId !== lastActiveIdPushed) {
476
+ lastActiveIdPushed = activeId;
477
+ activeNodeId.set(activeId);
478
+ }
479
+ if (!arrayIdsEqual(selectedIds, lastSelectedIdsPushed)) {
480
+ lastSelectedIdsPushed = selectedIds;
481
+ selectedIdsSetStore.set(new Set(selectedIds));
482
+ selectedNodeIds.set(selectedIds);
483
+ }
484
+ if (!arrayIdsEqual(expandedIds, lastExpandedIdsPushed)) {
485
+ lastExpandedIdsPushed = expandedIds;
486
+ expandedIdsSetStore.set(expandedIdsSet);
487
+ expandedNodeIds.set(expandedIds);
488
+ }
425
489
  }
426
490
 
427
491
  $: if (ref && (nodes !== cachedNodes || !treeWalker)) {
@@ -5,20 +5,26 @@ export type TreeNode<Id = string | number> = {
5
5
  id: Id;
6
6
  text: any;
7
7
  icon?: any;
8
- /** Whether the node is disabled */ disabled?: boolean;
8
+ /** Whether the node is disabled */
9
+ disabled?: boolean;
9
10
  nodes?: TreeNode<Id>[];
10
11
  };
11
12
 
12
13
  export type ShowNodeOptions = {
13
- /** Whether to expand the node and its ancestors (default: true) */ expand?: boolean;
14
- /** Whether to select the node (default: true) */ select?: boolean;
15
- /** Whether to focus the node (default: true) */ focus?: boolean;
14
+ /** Whether to expand the node and its ancestors (default: true) */
15
+ expand?: boolean;
16
+ /** Whether to select the node (default: true) */
17
+ select?: boolean;
18
+ /** Whether to focus the node (default: true) */
19
+ focus?: boolean;
16
20
  };
17
21
 
18
22
  export type TreeViewContext<Node extends TreeNode<any> = TreeNode<any>> = {
19
23
  activeNodeId: import("svelte/store").Writable<Node["id"]>;
20
24
  selectedNodeIds: import("svelte/store").Writable<ReadonlyArray<Node["id"]>>;
21
25
  expandedNodeIds: import("svelte/store").Writable<ReadonlyArray<Node["id"]>>;
26
+ selectedIdsSetStore: import("svelte/store").Writable<Set<Node["id"]>>;
27
+ expandedIdsSetStore: import("svelte/store").Writable<Set<Node["id"]>>;
22
28
  clickNode: (node: Node) => void;
23
29
  selectNode: (node: Node) => void;
24
30
  expandNode: (node: Node, expanded: boolean) => void;
@@ -79,20 +79,25 @@
79
79
  let refLabel = null;
80
80
  let prevActiveId = undefined;
81
81
 
82
- const { activeNodeId, selectedNodeIds, clickNode, selectNode, focusNode } =
83
- getContext("TreeView");
82
+ const {
83
+ activeNodeId,
84
+ selectedIdsSetStore,
85
+ clickNode,
86
+ selectNode,
87
+ focusNode,
88
+ } = getContext("TreeView");
84
89
  const offset = () =>
85
90
  computeTreeLeafDepth(refLabel) + (leaf && icon ? 2 : 2.5);
86
91
 
87
92
  afterUpdate(() => {
88
93
  if (id === $activeNodeId && prevActiveId !== $activeNodeId) {
89
- if (!$selectedNodeIds.includes(id)) selectNode(node);
94
+ if (!$selectedIdsSetStore.has(id)) selectNode(node);
90
95
  }
91
96
 
92
97
  prevActiveId = $activeNodeId;
93
98
  });
94
99
 
95
- $: selected = $selectedNodeIds.includes(id);
100
+ $: selected = $selectedIdsSetStore.has(id);
96
101
  // Merge all props (including custom properties) with computed properties
97
102
  // Explicitly include disabled to ensure it's always present (has default value)
98
103
  $: node = {