carbon-components-svelte 0.109.0 → 0.110.1
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 +159 -43
- package/css/_code-snippet.scss +46 -0
- package/css/_combo-button.scss +50 -0
- package/css/_copy-button.scss +68 -0
- package/css/_datepicker.scss +70 -0
- package/css/_dialog.scss +47 -0
- package/css/_disclosure.scss +132 -0
- package/css/_icon-indicator.scss +130 -0
- package/css/_link.scss +57 -0
- package/css/_list-box-xs.scss +45 -0
- package/css/_menu-button.scss +30 -0
- package/css/_menu-xs.scss +17 -0
- package/css/_profile-menu.scss +238 -0
- package/css/_search-menu.scss +240 -0
- package/css/_shape-indicator.scss +130 -0
- package/css/_structured-list-input-focusable.scss +75 -0
- package/css/_tabs.scss +651 -136
- package/css/_tag-set.scss +65 -0
- package/css/_toggletip.scss +93 -0
- package/css/_tooltip.scss +10 -2
- package/css/_ui-shell-classic.scss +7 -0
- package/css/_ui-shell.scss +82 -0
- package/css/_user-avatar-group.scss +67 -0
- package/css/_user-avatar.scss +119 -0
- package/css/all.css +1 -1
- package/css/all.scss +18 -0
- package/css/g10.css +1 -1
- package/css/g10.scss +18 -0
- package/css/g100.css +1 -1
- package/css/g100.scss +18 -0
- package/css/g80.css +1 -1
- package/css/g80.scss +18 -0
- package/css/g90.css +1 -1
- package/css/g90.scss +18 -0
- package/css/white.css +1 -1
- package/css/white.scss +18 -0
- package/package.json +1 -1
- package/src/Accordion/AccordionItem.svelte.d.ts +9 -6
- package/src/AspectRatio/AspectRatio.svelte.d.ts +1 -10
- package/src/Box/Box.svelte.d.ts +2 -21
- package/src/Breadcrumb/BreadcrumbItem.svelte.d.ts +12 -5
- package/src/Breakpoint/Breakpoint.svelte.d.ts +13 -8
- package/src/Breakpoint/breakpointObserver.d.ts +10 -0
- package/src/Breakpoint/breakpointObserver.js +53 -44
- package/src/Breakpoint/hideAtBreakpoint.d.ts +24 -0
- package/src/Breakpoint/hideAtBreakpoint.js +46 -0
- package/src/Breakpoint/index.d.ts +1 -0
- package/src/Breakpoint/index.js +1 -0
- package/src/Button/Button.svelte +25 -22
- package/src/Button/Button.svelte.d.ts +21 -36
- package/src/Checkbox/Checkbox.svelte +18 -0
- package/src/Checkbox/Checkbox.svelte.d.ts +18 -2
- package/src/Checkbox/CheckboxGroup.svelte.d.ts +12 -11
- package/src/CodeSnippet/CodeSnippet.svelte +82 -17
- package/src/CodeSnippet/CodeSnippet.svelte.d.ts +20 -11
- package/src/ComboBox/ComboBox.svelte +89 -12
- package/src/ComboBox/ComboBox.svelte.d.ts +38 -49
- package/src/ComboBox/FluidComboBoxSkeleton.svelte.d.ts +1 -2
- package/src/ComboButton/ComboButton.svelte +196 -0
- package/src/ComboButton/ComboButton.svelte.d.ts +106 -0
- package/src/ComboButton/index.js +1 -0
- package/src/ComposedModal/ComposedModal.svelte +10 -1
- package/src/ComposedModal/ComposedModal.svelte.d.ts +5 -4
- package/src/ComposedModal/ModalFooter.svelte.d.ts +3 -7
- package/src/ComposedModal/ModalHeader.svelte +4 -1
- package/src/ContainedList/ContainedListItem.svelte.d.ts +4 -1
- package/src/ContentSwitcher/ContentSwitcher.svelte.d.ts +5 -5
- package/src/ContentSwitcher/Switch.svelte.d.ts +6 -7
- package/src/ContextMenu/ContextMenu.svelte.d.ts +2 -2
- package/src/ContextMenu/ContextMenuOption.svelte.d.ts +11 -15
- package/src/CopyButton/CopyButton.svelte +155 -16
- package/src/CopyButton/CopyButton.svelte.d.ts +33 -5
- package/src/CopyInput/CopyInput.svelte +14 -0
- package/src/CopyInput/CopyInput.svelte.d.ts +13 -2
- package/src/CopyInput/FluidCopyInputSkeleton.svelte.d.ts +1 -2
- package/src/DataTable/DataTable.svelte +16 -13
- package/src/DataTable/DataTable.svelte.d.ts +118 -164
- package/src/DataTable/DataTableSkeleton.svelte.d.ts +1 -3
- package/src/DataTable/TableHeader.svelte.d.ts +2 -7
- package/src/DataTable/ToolbarBatchActions.svelte.d.ts +5 -6
- package/src/DataTable/ToolbarMenuItem.svelte.d.ts +4 -1
- package/src/DataTable/ToolbarSearch.svelte.d.ts +7 -16
- package/src/DatePicker/DatePicker.svelte +7 -3
- package/src/DatePicker/DatePicker.svelte.d.ts +22 -15
- package/src/DatePicker/FluidDatePickerSkeleton.svelte.d.ts +1 -2
- package/src/DatePicker/createCalendar.d.ts +1 -1
- package/src/DatePicker/createCalendar.js +55 -4
- package/src/DatePicker/flatpickr-monthSelectPlugin.d.ts +11 -0
- package/src/Dialog/Dialog.svelte +73 -0
- package/src/Dialog/Dialog.svelte.d.ts +36 -0
- package/src/Dialog/index.js +1 -0
- package/src/Disclosure/Disclosure.svelte +84 -0
- package/src/Disclosure/Disclosure.svelte.d.ts +58 -0
- package/src/Disclosure/index.js +1 -0
- package/src/Dropdown/Dropdown.svelte +16 -2
- package/src/Dropdown/Dropdown.svelte.d.ts +28 -42
- package/src/Dropdown/FluidDropdownSkeleton.svelte.d.ts +1 -2
- package/src/FileUploader/FileUploader.svelte.d.ts +29 -32
- package/src/FileUploader/FileUploaderButton.svelte.d.ts +3 -9
- package/src/FileUploader/FileUploaderDropContainer.svelte.d.ts +5 -3
- package/src/FileUploader/FileUploaderItem.svelte.d.ts +2 -5
- package/src/FileUploader/Filename.svelte.d.ts +6 -8
- package/src/FluidForm/FluidForm.svelte.d.ts +3 -3
- package/src/Grid/Column.svelte.d.ts +19 -10
- package/src/Grid/Grid.svelte.d.ts +19 -10
- package/src/Grid/Row.svelte.d.ts +19 -10
- package/src/Heading/Section.svelte.d.ts +18 -18
- package/src/IconIndicator/IconIndicator.svelte +62 -0
- package/src/IconIndicator/IconIndicator.svelte.d.ts +36 -0
- package/src/IconIndicator/index.js +1 -0
- package/src/ImageLoader/ImageLoader.svelte.d.ts +14 -8
- package/src/Link/Link.svelte +10 -2
- package/src/Link/Link.svelte.d.ts +14 -5
- package/src/ListBox/ListBox.svelte +2 -1
- package/src/ListBox/ListBox.svelte.d.ts +5 -2
- package/src/ListBox/ListBoxField.svelte.d.ts +1 -1
- package/src/ListBox/ListBoxMenuIcon.svelte.d.ts +1 -1
- package/src/ListBox/ListBoxMenuItem.svelte +5 -2
- package/src/ListBox/ListBoxSelection.svelte +1 -0
- package/src/ListBox/ListBoxSelection.svelte.d.ts +1 -1
- package/src/ListBox/list-box-utils.d.ts +4 -2
- package/src/ListBox/list-box-utils.js +7 -5
- package/src/Loading/Loading.svelte.d.ts +1 -5
- package/src/LocalStorage/LocalStorage.svelte.d.ts +11 -11
- package/src/Menu/Menu.svelte +215 -0
- package/src/Menu/Menu.svelte.d.ts +131 -0
- package/src/Menu/MenuDivider.svelte +1 -0
- package/src/Menu/MenuDivider.svelte.d.ts +9 -0
- package/src/Menu/MenuItem.svelte +206 -0
- package/src/Menu/MenuItem.svelte.d.ts +61 -0
- package/src/Menu/index.js +3 -0
- package/src/MenuButton/MenuButton.svelte +142 -0
- package/src/MenuButton/MenuButton.svelte.d.ts +78 -0
- package/src/MenuButton/index.js +1 -0
- package/src/Modal/Modal.svelte.d.ts +7 -8
- package/src/MultiSelect/FluidMultiSelectSkeleton.svelte.d.ts +1 -2
- package/src/MultiSelect/MultiSelect.svelte +69 -31
- package/src/MultiSelect/MultiSelect.svelte.d.ts +27 -37
- package/src/Notification/InlineNotification.svelte.d.ts +3 -9
- package/src/Notification/NotificationButton.svelte.d.ts +3 -9
- package/src/Notification/NotificationIcon.svelte.d.ts +1 -7
- package/src/Notification/NotificationQueue.svelte.d.ts +1 -7
- package/src/Notification/ToastNotification.svelte.d.ts +3 -9
- package/src/NumberInput/FluidNumberInputSkeleton.svelte.d.ts +1 -2
- package/src/NumberInput/NumberInput.svelte.d.ts +21 -25
- package/src/OverflowMenu/OverflowMenu.svelte.d.ts +29 -40
- package/src/OverflowMenu/OverflowMenuItem.svelte.d.ts +20 -21
- package/src/Pagination/Pagination.svelte.d.ts +12 -12
- package/src/PaginationNav/PaginationNav.svelte.d.ts +6 -6
- package/src/PinCodeInput/FluidPinCodeInputSkeleton.svelte.d.ts +1 -2
- package/src/PinCodeInput/PinCodeInput.svelte.d.ts +8 -2
- package/src/Popover/Popover.svelte.d.ts +5 -17
- package/src/Portal/FloatingPortal.svelte +83 -1
- package/src/Portal/FloatingPortal.svelte.d.ts +17 -4
- package/src/Portal/PortalTooltip.svelte +1 -0
- package/src/Portal/iconTooltipPortalGaps.d.ts +14 -0
- package/src/Portal/iconTooltipPortalGaps.js +41 -0
- package/src/ProgressIndicator/ProgressIndicator.svelte.d.ts +15 -18
- package/src/ProgressIndicator/ProgressIndicatorSkeleton.svelte.d.ts +1 -2
- package/src/ProgressIndicator/ProgressStep.svelte.d.ts +3 -11
- package/src/RadioButton/RadioButton.svelte.d.ts +2 -5
- package/src/RadioButtonGroup/RadioButtonGroup.svelte.d.ts +19 -19
- package/src/RecursiveList/RecursiveList.svelte.d.ts +2 -6
- package/src/Search/Search.svelte.d.ts +1 -5
- package/src/SearchMenu/SearchMenu.svelte +462 -0
- package/src/SearchMenu/SearchMenu.svelte.d.ts +190 -0
- package/src/SearchMenu/SearchMenuGroup.svelte +72 -0
- package/src/SearchMenu/SearchMenuGroup.svelte.d.ts +43 -0
- package/src/SearchMenu/SearchMenuItem.svelte +205 -0
- package/src/SearchMenu/SearchMenuItem.svelte.d.ts +105 -0
- package/src/SearchMenu/SearchMenuSkeleton.svelte +31 -0
- package/src/SearchMenu/SearchMenuSkeleton.svelte.d.ts +33 -0
- package/src/SearchMenu/index.js +4 -0
- package/src/Select/Select.svelte +19 -1
- package/src/Select/Select.svelte.d.ts +8 -10
- package/src/Select/SelectItem.svelte +8 -2
- package/src/Select/SelectItem.svelte.d.ts +1 -3
- package/src/SessionStorage/SessionStorage.svelte.d.ts +11 -11
- package/src/ShapeIndicator/ShapeIndicator.svelte +57 -0
- package/src/ShapeIndicator/ShapeIndicator.svelte.d.ts +36 -0
- package/src/ShapeIndicator/ShapeIndicatorIncomplete.svelte +37 -0
- package/src/ShapeIndicator/ShapeIndicatorIncomplete.svelte.d.ts +26 -0
- package/src/ShapeIndicator/index.js +1 -0
- package/src/SkeletonIcon/SkeletonIcon.svelte.d.ts +1 -1
- package/src/Slider/RangeSlider.svelte.d.ts +14 -8
- package/src/Slider/Slider.svelte.d.ts +5 -5
- package/src/Stack/Stack.svelte.d.ts +2 -22
- package/src/StructuredList/StructuredList.svelte +13 -1
- package/src/StructuredList/StructuredList.svelte.d.ts +24 -17
- package/src/StructuredList/StructuredListBody.svelte +9 -1
- package/src/StructuredList/StructuredListCell.svelte +6 -1
- package/src/StructuredList/StructuredListHead.svelte +8 -1
- package/src/StructuredList/StructuredListInput.svelte +31 -15
- package/src/StructuredList/StructuredListInput.svelte.d.ts +8 -8
- package/src/StructuredList/StructuredListRow.svelte +20 -39
- package/src/StructuredList/StructuredListRow.svelte.d.ts +4 -2
- package/src/StructuredList/StructuredListSkeleton.svelte.d.ts +1 -2
- package/src/Tabs/Tab.svelte +1 -7
- package/src/Tabs/Tab.svelte.d.ts +10 -8
- package/src/Tabs/Tabs.svelte +117 -48
- package/src/Tabs/Tabs.svelte.d.ts +27 -40
- package/src/Tabs/TabsVertical.svelte +357 -0
- package/src/Tabs/TabsVertical.svelte.d.ts +69 -0
- package/src/Tabs/TabsVerticalSkeleton.svelte +27 -0
- package/src/Tabs/TabsVerticalSkeleton.svelte.d.ts +27 -0
- package/src/Tabs/index.js +2 -0
- package/src/Tag/SelectableTag.svelte.d.ts +6 -19
- package/src/Tag/Tag.svelte +82 -18
- package/src/Tag/Tag.svelte.d.ts +12 -20
- package/src/TagSet/TagSet.svelte +237 -0
- package/src/TagSet/TagSet.svelte.d.ts +117 -0
- package/src/TagSet/TagSetOverflow.svelte +69 -0
- package/src/TagSet/TagSetOverflow.svelte.d.ts +60 -0
- package/src/TagSet/index.js +1 -0
- package/src/Text/Text.svelte.d.ts +2 -44
- package/src/TextArea/FluidTextAreaSkeleton.svelte.d.ts +1 -2
- package/src/TextInput/FluidTextInputSkeleton.svelte.d.ts +1 -2
- package/src/TextInput/PasswordInputSkeleton.svelte.d.ts +1 -2
- package/src/Theme/Theme.svelte.d.ts +6 -15
- package/src/Tile/ExpandableTile.svelte.d.ts +4 -1
- package/src/Tile/RadioTile.svelte.d.ts +2 -8
- package/src/Tile/SelectableTile.svelte +9 -35
- package/src/Tile/SelectableTileGroup.svelte.d.ts +23 -17
- package/src/Tile/TileGroup.svelte.d.ts +15 -15
- package/src/TimePicker/FluidTimePickerSkeleton.svelte.d.ts +1 -2
- package/src/TimePicker/TimePicker.svelte.d.ts +4 -1
- package/src/TimePicker/TimePickerSelect.svelte.d.ts +4 -1
- package/src/Toggletip/Toggletip.svelte +294 -0
- package/src/Toggletip/Toggletip.svelte.d.ts +85 -0
- package/src/Toggletip/ToggletipFooter.svelte +3 -0
- package/src/Toggletip/ToggletipFooter.svelte.d.ts +18 -0
- package/src/Toggletip/index.js +2 -0
- package/src/Tooltip/Tooltip.svelte +13 -2
- package/src/Tooltip/Tooltip.svelte.d.ts +6 -3
- package/src/Tooltip/TooltipFooter.svelte +12 -4
- package/src/TooltipDefinition/TooltipDefinition.svelte.d.ts +4 -1
- package/src/TooltipIcon/TooltipIcon.svelte.d.ts +6 -7
- package/src/TreeView/TreeView.svelte +58 -3
- package/src/TreeView/TreeView.svelte.d.ts +94 -70
- package/src/TreeView/TreeViewNode.svelte.d.ts +24 -30
- package/src/TreeView/TreeViewNodeList.svelte +3 -0
- package/src/TreeView/TreeViewNodeList.svelte.d.ts +7 -18
- package/src/UIShell/HamburgerMenu.svelte.d.ts +1 -5
- package/src/UIShell/Header.svelte.d.ts +11 -12
- package/src/UIShell/HeaderAction.svelte +4 -3
- package/src/UIShell/HeaderAction.svelte.d.ts +14 -17
- package/src/UIShell/HeaderActionLink.svelte.d.ts +1 -5
- package/src/UIShell/HeaderGlobalAction.svelte.d.ts +1 -3
- package/src/UIShell/HeaderNavItem.svelte +17 -0
- package/src/UIShell/HeaderNavItem.svelte.d.ts +15 -5
- package/src/UIShell/HeaderNavMenu.svelte.d.ts +6 -3
- package/src/UIShell/HeaderSearch.svelte +272 -10
- package/src/UIShell/HeaderSearch.svelte.d.ts +106 -19
- package/src/UIShell/ProfileMenu.svelte +108 -0
- package/src/UIShell/ProfileMenu.svelte.d.ts +60 -0
- package/src/UIShell/ProfileMenuDetail.svelte +23 -0
- package/src/UIShell/ProfileMenuDetail.svelte.d.ts +22 -0
- package/src/UIShell/ProfileMenuDivider.svelte +1 -0
- package/src/UIShell/ProfileMenuDivider.svelte.d.ts +9 -0
- package/src/UIShell/ProfileMenuHeader.svelte +80 -0
- package/src/UIShell/ProfileMenuHeader.svelte.d.ts +54 -0
- package/src/UIShell/ProfileMenuItem.svelte +53 -0
- package/src/UIShell/ProfileMenuItem.svelte.d.ts +41 -0
- package/src/UIShell/ProfileMenuList.svelte +17 -0
- package/src/UIShell/ProfileMenuList.svelte.d.ts +25 -0
- package/src/UIShell/SideNavLink.svelte.d.ts +5 -6
- package/src/UIShell/SideNavMenu.svelte.d.ts +5 -6
- package/src/UIShell/index.js +6 -0
- package/src/UserAvatar/UserAvatar.svelte +262 -0
- package/src/UserAvatar/UserAvatar.svelte.d.ts +101 -0
- package/src/UserAvatar/index.js +1 -0
- package/src/UserAvatarGroup/UserAvatarGroup.svelte +200 -0
- package/src/UserAvatarGroup/UserAvatarGroup.svelte.d.ts +81 -0
- package/src/UserAvatarGroup/UserAvatarGroupOverflow.svelte +38 -0
- package/src/UserAvatarGroup/UserAvatarGroupOverflow.svelte.d.ts +29 -0
- package/src/UserAvatarGroup/index.js +1 -0
- package/src/icons/Add.svelte.d.ts +1 -5
- package/src/icons/ArrowUp.svelte.d.ts +1 -5
- package/src/icons/Calendar.svelte.d.ts +1 -5
- package/src/icons/Caution.svelte +29 -0
- package/src/icons/Caution.svelte.d.ts +22 -0
- package/src/icons/ChevronLeft.svelte +28 -0
- package/src/icons/ChevronLeft.svelte.d.ts +26 -0
- package/src/icons/CircleFill.svelte +28 -0
- package/src/icons/{Menu.svelte.d.ts → CircleFill.svelte.d.ts} +3 -3
- package/src/icons/CircleStroke.svelte +30 -0
- package/src/icons/CircleStroke.svelte.d.ts +26 -0
- package/src/icons/Close.svelte.d.ts +1 -5
- package/src/icons/Copy.svelte.d.ts +1 -5
- package/src/icons/Critical.svelte +29 -0
- package/src/icons/Critical.svelte.d.ts +22 -0
- package/src/icons/CriticalSeverity.svelte +28 -0
- package/src/icons/CriticalSeverity.svelte.d.ts +26 -0
- package/src/icons/DiamondFill.svelte +31 -0
- package/src/icons/DiamondFill.svelte.d.ts +26 -0
- package/src/icons/EditOff.svelte.d.ts +1 -5
- package/src/icons/InProgress.svelte +30 -0
- package/src/icons/InProgress.svelte.d.ts +26 -0
- package/src/icons/InformationSquareFilled.svelte.d.ts +1 -2
- package/src/icons/Launch.svelte.d.ts +1 -5
- package/src/icons/LowSeverity.svelte +29 -0
- package/src/icons/LowSeverity.svelte.d.ts +26 -0
- package/src/icons/OverflowMenuHorizontal.svelte.d.ts +1 -2
- package/src/icons/PendingFilled.svelte +35 -0
- package/src/icons/PendingFilled.svelte.d.ts +26 -0
- package/src/icons/Settings.svelte.d.ts +1 -5
- package/src/icons/Subtract.svelte.d.ts +1 -5
- package/src/icons/Switcher.svelte.d.ts +1 -5
- package/src/icons/UndefinedFilled.svelte +31 -0
- package/src/icons/UndefinedFilled.svelte.d.ts +26 -0
- package/src/icons/UnknownFilled.svelte +35 -0
- package/src/icons/UnknownFilled.svelte.d.ts +26 -0
- package/src/icons/User.svelte +33 -0
- package/src/icons/User.svelte.d.ts +22 -0
- package/src/icons/View.svelte.d.ts +1 -5
- package/src/icons/ViewOff.svelte.d.ts +1 -5
- package/src/icons/Warning.svelte.d.ts +1 -5
- package/src/icons/WarningAltInvertedFilled.svelte +38 -0
- package/src/icons/WarningAltInvertedFilled.svelte.d.ts +26 -0
- package/src/icons/WarningSquareFilled.svelte +35 -0
- package/src/icons/WarningSquareFilled.svelte.d.ts +26 -0
- package/src/index.d.ts +29 -5
- package/src/index.js +28 -0
- package/src/node_modules/.cache/sveld/parse-cache.json +1 -0
- package/src/utils/avatarColor.d.ts +19 -0
- package/src/utils/avatarColor.js +50 -0
- package/src/utils/dismiss.js +19 -2
- package/src/utils/floatingPosition.d.ts +2 -0
- package/src/utils/floatingPosition.js +15 -8
- package/src/utils/fuzzyMatch.d.ts +37 -0
- package/src/utils/fuzzyMatch.js +207 -0
- package/src/utils/scrollIntoViewWithinMenu.d.ts +15 -0
- package/src/utils/scrollIntoViewWithinMenu.js +31 -0
- package/src/utils/tagOverflow.d.ts +17 -0
- package/src/utils/tagOverflow.js +39 -0
package/README.md
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
<img src="https://img.shields.io/discord/689212587170201628?color=5865F2&style=for-the-badge" alt="Chat with us on Discord">
|
|
7
7
|
</a>
|
|
8
8
|
|
|
9
|
-
Carbon Components Svelte is a [Svelte](https://github.com/sveltejs/svelte) component library that implements the [Carbon Design System](https://
|
|
9
|
+
Carbon Components Svelte is a [Svelte](https://github.com/sveltejs/svelte) component library that implements the [Carbon Design System](https://www.carbondesignsystem.com/), an open source design system by IBM. Ship accessible, consistent, production-ready interfaces.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **70+ components**: from inputs to data tables
|
|
12
|
+
- **5 built-in themes**: two light, three dark
|
|
13
|
+
- **Fully typed TypeScript API**: props, events, and slots
|
|
14
|
+
- **WCAG 2.1 AA**: keyboard and screen-reader ready
|
|
12
15
|
|
|
13
16
|
The Carbon Svelte ecosystem also includes:
|
|
14
17
|
|
|
15
|
-
- **[Carbon Icons Svelte](https://github.com/carbon-design-system/carbon-icons-svelte)**: 2,
|
|
18
|
+
- **[Carbon Icons Svelte](https://github.com/carbon-design-system/carbon-icons-svelte)**: 2,700+ Carbon icons as Svelte components
|
|
16
19
|
- **[Carbon Pictograms Svelte](https://github.com/carbon-design-system/carbon-pictograms-svelte)**: 1,500+ Carbon pictograms as Svelte components
|
|
17
20
|
- **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 25+ charts, powered by d3
|
|
18
21
|
- **[Carbon Preprocess Svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte)**: Collection of Svelte preprocessors for Carbon
|
|
@@ -26,7 +29,7 @@ The Carbon Svelte ecosystem also includes:
|
|
|
26
29
|
npm i carbon-components-svelte
|
|
27
30
|
|
|
28
31
|
# pnpm
|
|
29
|
-
pnpm
|
|
32
|
+
pnpm add carbon-components-svelte
|
|
30
33
|
|
|
31
34
|
# Yarn
|
|
32
35
|
yarn add carbon-components-svelte
|
|
@@ -46,9 +49,9 @@ Before importing components, you will need to first apply Carbon component style
|
|
|
46
49
|
- **g80.css**: Gray 80 theme (dark)
|
|
47
50
|
- **g90.css**: Gray 90 theme (dark)
|
|
48
51
|
- **g100.css**: Gray 100 theme (dark)
|
|
49
|
-
- **all.css**: All themes (White, Gray 10, Gray 90, Gray 100) using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
|
|
52
|
+
- **all.css**: All five themes (White, Gray 10, Gray 80, Gray 90, Gray 100) using [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties)
|
|
50
53
|
|
|
51
|
-
Each StyleSheet is [generated](scripts/build-css.
|
|
54
|
+
Each StyleSheet is [generated](scripts/build-css.ts) from the flagship [carbon-components](https://github.com/carbon-design-system/carbon/tree/main/packages/carbon-components) library.
|
|
52
55
|
|
|
53
56
|
The compiled CSS is generated from the following `.scss` files:
|
|
54
57
|
|
|
@@ -59,6 +62,8 @@ The compiled CSS is generated from the following `.scss` files:
|
|
|
59
62
|
- [css/g100.scss](css/g100.scss)
|
|
60
63
|
- [css/all.scss](css/all.scss)
|
|
61
64
|
|
|
65
|
+
Import one theme once at the top-level entry point of your app, like `index.js` or `src/+layout.svelte`.
|
|
66
|
+
|
|
62
67
|
#### CSS StyleSheet
|
|
63
68
|
|
|
64
69
|
```js
|
|
@@ -89,7 +94,7 @@ Refer to the [official Carbon guide on SASS](https://github.com/carbon-design-sy
|
|
|
89
94
|
|
|
90
95
|
### Dynamic theming
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
To switch themes at runtime, import the combined "all.css" StyleSheet instead of a single theme. It bundles all five themes and toggles between them through a `theme` attribute on the HTML element.
|
|
93
98
|
|
|
94
99
|
```js
|
|
95
100
|
import "carbon-components-svelte/css/all.css";
|
|
@@ -106,7 +111,7 @@ Update the theme by setting the `theme` attribute on the `html` element. The def
|
|
|
106
111
|
</html>
|
|
107
112
|
```
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
Or programmatically switch between each of the five Carbon themes by setting the `theme` attribute on the HTML element.
|
|
110
115
|
|
|
111
116
|
```html
|
|
112
117
|
<script>
|
|
@@ -116,6 +121,8 @@ Programmatically switch between each of the five Carbon themes by setting the "t
|
|
|
116
121
|
</script>
|
|
117
122
|
```
|
|
118
123
|
|
|
124
|
+
Alternatively, use the [Theme component](https://svelte.carbondesignsystem.com/components/Theme) to manage the theme reactively.
|
|
125
|
+
|
|
119
126
|
### Importing components
|
|
120
127
|
|
|
121
128
|
Import components from `carbon-components-svelte` in the `script` tag of your Svelte file. Visit the [documentation site](https://svelte.carbondesignsystem.com) for examples.
|
|
@@ -137,7 +144,7 @@ Import components from `carbon-components-svelte` in the `script` tag of your Sv
|
|
|
137
144
|
|
|
138
145
|
## Preprocessors & Plugins
|
|
139
146
|
|
|
140
|
-
[carbon-preprocess-svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte) is a collection of Svelte preprocessors for Carbon.
|
|
147
|
+
[carbon-preprocess-svelte](https://github.com/carbon-design-system/carbon-preprocess-svelte) is a collection of Svelte preprocessors for Carbon. It trims build times and bundle size with two drop-in tools for faster HMR in development and leaner CSS when you ship.
|
|
141
148
|
|
|
142
149
|
> [!NOTE]
|
|
143
150
|
> Using `carbon-preprocess-svelte` is optional and not a prerequisite for this library. It should be installed as a development dependency.
|
|
@@ -147,7 +154,7 @@ Import components from `carbon-components-svelte` in the `script` tag of your Sv
|
|
|
147
154
|
npm i -D carbon-preprocess-svelte
|
|
148
155
|
|
|
149
156
|
# pnpm
|
|
150
|
-
pnpm
|
|
157
|
+
pnpm add -D carbon-preprocess-svelte
|
|
151
158
|
|
|
152
159
|
# Yarn
|
|
153
160
|
yarn add -D carbon-preprocess-svelte
|
|
@@ -179,39 +186,9 @@ The preprocessor optimizes imports from the following packages:
|
|
|
179
186
|
+ import Airplane from "carbon-pictograms-svelte/lib/Airplane.svelte";
|
|
180
187
|
```
|
|
181
188
|
|
|
182
|
-
#### Usage
|
|
183
|
-
|
|
184
|
-
See [examples](examples) for full configurations.
|
|
185
|
-
|
|
186
|
-
```js
|
|
187
|
-
// svelte.config.js
|
|
188
|
-
import { optimizeImports } from "carbon-preprocess-svelte";
|
|
189
|
-
|
|
190
|
-
export default {
|
|
191
|
-
preprocess: [optimizeImports()],
|
|
192
|
-
};
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Any other preprocessors that transpile code in the `script` block should be invoked before `optimizeImports`.
|
|
196
|
-
|
|
197
|
-
For example, `vitePreprocess` should precede `optimizeImports`.
|
|
198
|
-
|
|
199
|
-
```diff
|
|
200
|
-
// svelte.config.js
|
|
201
|
-
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
202
|
-
import { optimizeImports } from "carbon-preprocess-svelte";
|
|
203
|
-
|
|
204
|
-
export default {
|
|
205
|
-
preprocess: [
|
|
206
|
-
+ vitePreprocess(),
|
|
207
|
-
optimizeImports()
|
|
208
|
-
],
|
|
209
|
-
};
|
|
210
|
-
```
|
|
211
|
-
|
|
212
189
|
### `optimizeCss`
|
|
213
190
|
|
|
214
|
-
`optimizeCss` is a Vite plugin that removes unused Carbon styles at build time. The plugin is compatible with Rollup ([Vite](https://vitejs.dev/guide/api-plugin) extends the Rollup plugin API).
|
|
191
|
+
`optimizeCss` is a Vite plugin that removes unused Carbon styles at build time, often removing hundreds of kilobytes from production bundles. The plugin is compatible with Rollup ([Vite](https://vitejs.dev/guide/api-plugin) extends the Rollup plugin API).
|
|
215
192
|
|
|
216
193
|
`carbon-components-svelte@0.85.0` or greater is required.
|
|
217
194
|
|
|
@@ -230,9 +207,42 @@ dist/assets/index-Ceijs3eO.js 53.65 kB │ gzip: 15.88 kB
|
|
|
230
207
|
> [!NOTE]
|
|
231
208
|
> This is a plugin and not a Svelte preprocessor. It should be added to the list of `vite.plugins`. For Vite set-ups, this plugin is only run when building the app. For Rollup and Webpack, you should conditionally apply the plugin to only execute when building for production.
|
|
232
209
|
|
|
233
|
-
|
|
210
|
+
### Configure your bundler
|
|
211
|
+
|
|
212
|
+
Add `optimizeImports` to your Svelte preprocessor and `optimizeCss` to your bundler plugins. See [examples](examples) for full configurations.
|
|
234
213
|
|
|
235
|
-
|
|
214
|
+
**Vite**
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
// vite.config.js
|
|
218
|
+
import { svelte, vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
219
|
+
import { optimizeCss, optimizeImports } from "carbon-preprocess-svelte";
|
|
220
|
+
|
|
221
|
+
export default {
|
|
222
|
+
plugins: [
|
|
223
|
+
svelte({
|
|
224
|
+
preprocess: [vitePreprocess(), optimizeImports()],
|
|
225
|
+
}),
|
|
226
|
+
optimizeCss(),
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**SvelteKit**
|
|
232
|
+
|
|
233
|
+
```js
|
|
234
|
+
// svelte.config.js
|
|
235
|
+
import adapter from "@sveltejs/adapter-static";
|
|
236
|
+
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
237
|
+
import { optimizeImports } from "carbon-preprocess-svelte";
|
|
238
|
+
|
|
239
|
+
const config = {
|
|
240
|
+
preprocess: [vitePreprocess(), optimizeImports()],
|
|
241
|
+
kit: { adapter: adapter() },
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export default config;
|
|
245
|
+
```
|
|
236
246
|
|
|
237
247
|
```js
|
|
238
248
|
// vite.config.js
|
|
@@ -245,6 +255,112 @@ export default defineConfig({
|
|
|
245
255
|
});
|
|
246
256
|
```
|
|
247
257
|
|
|
258
|
+
**Rollup**
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
// rollup.config.js
|
|
262
|
+
import svelte from "rollup-plugin-svelte";
|
|
263
|
+
import { optimizeCss, optimizeImports } from "carbon-preprocess-svelte";
|
|
264
|
+
|
|
265
|
+
const production = !process.env.ROLLUP_WATCH;
|
|
266
|
+
|
|
267
|
+
export default {
|
|
268
|
+
plugins: [
|
|
269
|
+
svelte({
|
|
270
|
+
preprocess: [optimizeImports()],
|
|
271
|
+
}),
|
|
272
|
+
production && optimizeCss(),
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Webpack**
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
// webpack.config.mjs
|
|
281
|
+
import { OptimizeCssPlugin, optimizeImports } from "carbon-preprocess-svelte";
|
|
282
|
+
|
|
283
|
+
export default {
|
|
284
|
+
module: {
|
|
285
|
+
rules: [
|
|
286
|
+
{
|
|
287
|
+
test: /\.svelte$/,
|
|
288
|
+
use: {
|
|
289
|
+
loader: "svelte-loader",
|
|
290
|
+
options: {
|
|
291
|
+
preprocess: [optimizeImports()],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
plugins: [new OptimizeCssPlugin()],
|
|
298
|
+
};
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Icons and pictograms
|
|
302
|
+
|
|
303
|
+
The icon and pictogram sets ship as separate packages of individual Svelte components. Each is optional, so install only what you need.
|
|
304
|
+
|
|
305
|
+
### Icons
|
|
306
|
+
|
|
307
|
+
2,700+ icons designed for product UI, in four sizes (16, 20, 24, and 32 pixels), set with a single prop.
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
# npm
|
|
311
|
+
npm i carbon-icons-svelte
|
|
312
|
+
|
|
313
|
+
# pnpm
|
|
314
|
+
pnpm add carbon-icons-svelte
|
|
315
|
+
|
|
316
|
+
# Yarn
|
|
317
|
+
yarn add carbon-icons-svelte
|
|
318
|
+
|
|
319
|
+
# Bun
|
|
320
|
+
bun add carbon-icons-svelte
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
```svelte
|
|
324
|
+
<script>
|
|
325
|
+
import Add from "carbon-icons-svelte/lib/Add.svelte";
|
|
326
|
+
</script>
|
|
327
|
+
|
|
328
|
+
<Add size={24} />
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Pictograms
|
|
332
|
+
|
|
333
|
+
1,500+ illustrative pictograms for empty states, onboarding, hero sections, and feature callouts. Larger than icons, 64px by default.
|
|
334
|
+
|
|
335
|
+
```sh
|
|
336
|
+
# npm
|
|
337
|
+
npm i carbon-pictograms-svelte
|
|
338
|
+
|
|
339
|
+
# pnpm
|
|
340
|
+
pnpm add carbon-pictograms-svelte
|
|
341
|
+
|
|
342
|
+
# Yarn
|
|
343
|
+
yarn add carbon-pictograms-svelte
|
|
344
|
+
|
|
345
|
+
# Bun
|
|
346
|
+
bun add carbon-pictograms-svelte
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
```svelte
|
|
350
|
+
<script>
|
|
351
|
+
import Cloud from "carbon-pictograms-svelte/lib/Cloud.svelte";
|
|
352
|
+
</script>
|
|
353
|
+
|
|
354
|
+
<Cloud />
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Documentation for LLMs
|
|
358
|
+
|
|
359
|
+
Documentation is available in LLM-friendly plain text for use with coding assistants, plus a standalone Markdown document for every component. Append `.md` to any component's URL to read it.
|
|
360
|
+
|
|
361
|
+
- **[llms.txt](https://svelte.carbondesignsystem.com/llms.txt)**: a component index where each entry links to its per-component Markdown doc, sized for model context windows.
|
|
362
|
+
- **[llms-full.txt](https://svelte.carbondesignsystem.com/llms-full.txt)**: the full component documentation in a single plain-text file.
|
|
363
|
+
|
|
248
364
|
## Examples
|
|
249
365
|
|
|
250
366
|
- [examples/rollup](examples/rollup/)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@import "carbon-components/scss/globals/scss/vars";
|
|
2
|
+
|
|
3
|
+
/// Edge fade for code snippets (Carbon React v11 parity). v10 uses
|
|
4
|
+
/// `--overflow-indicator` gradient elements that this library's markup does not
|
|
5
|
+
/// render. v11 masks the scroll container instead, which is background-agnostic
|
|
6
|
+
/// and works across themes, the light variant, and skeleton state.
|
|
7
|
+
/// @access private
|
|
8
|
+
/// @group components
|
|
9
|
+
@mixin code-snippet-fade {
|
|
10
|
+
.#{$prefix}--snippet--single .#{$prefix}--snippet-container {
|
|
11
|
+
mask-image: linear-gradient(
|
|
12
|
+
90deg,
|
|
13
|
+
$black-100 calc(100% - #{$carbon--spacing-07}),
|
|
14
|
+
transparent 100%
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// The focus outline is drawn on this same element, so the edge fade would
|
|
18
|
+
// clip the ring. Drop the mask while focused so the outline is unbroken.
|
|
19
|
+
&:focus {
|
|
20
|
+
mask-image: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Expanded multi-line adds padding-bottom: $spacing-05, so the bottom fade
|
|
25
|
+
// offset matches that padding when content no longer scrolls.
|
|
26
|
+
.#{$prefix}--snippet--multi .#{$prefix}--snippet-container {
|
|
27
|
+
mask-image: linear-gradient(
|
|
28
|
+
90deg,
|
|
29
|
+
$black-100 calc(100% - #{$carbon--spacing-07}),
|
|
30
|
+
transparent 100%
|
|
31
|
+
),
|
|
32
|
+
linear-gradient(
|
|
33
|
+
$black-100 calc(100% - #{$spacing-05}),
|
|
34
|
+
transparent 100%
|
|
35
|
+
);
|
|
36
|
+
mask-composite: intersect;
|
|
37
|
+
|
|
38
|
+
&:focus {
|
|
39
|
+
mask-image: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@include exports("code-snippet-fade") {
|
|
45
|
+
@include code-snippet-fade;
|
|
46
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@import "carbon-components/scss/globals/scss/vars";
|
|
2
|
+
@import "carbon-components/scss/globals/scss/helper-mixins";
|
|
3
|
+
@import "carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once";
|
|
4
|
+
|
|
5
|
+
/// Groups a `ComboButton`'s primary action and icon-only trigger button into
|
|
6
|
+
/// a single visual unit. The divider mirrors v10's own `.bx--btn-set`
|
|
7
|
+
/// technique (a box-shadow on the trigger, since adjacent buttons have no
|
|
8
|
+
/// margin between them); the chevron rotates on open.
|
|
9
|
+
/// @access private
|
|
10
|
+
/// @group components
|
|
11
|
+
@mixin combo-button {
|
|
12
|
+
.#{$prefix}--combo-button {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.#{$prefix}--combo-button .#{$prefix}--combo-button__trigger:not(:focus) {
|
|
17
|
+
box-shadow: to-rem(-1px) 0 0 0 $button-separator;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.#{$prefix}--combo-button
|
|
21
|
+
.#{$prefix}--combo-button__trigger.#{$prefix}--btn--disabled {
|
|
22
|
+
box-shadow: to-rem(-1px) 0 0 0 $disabled-03;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.#{$prefix}--combo-button__trigger .#{$prefix}--btn__icon {
|
|
26
|
+
transition: transform $duration--fast-01 motion(standard, productive);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.#{$prefix}--combo-button__trigger--open .#{$prefix}--btn__icon {
|
|
30
|
+
transform: rotate(180deg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Extra-small (Carbon React size="xs", 24px). Neither Button's "small"
|
|
34
|
+
// class (32px) nor any other Button size lands on 24px, so shrink further
|
|
35
|
+
// on top of the "small" size already passed to both buttons.
|
|
36
|
+
.#{$prefix}--combo-button--xs .#{$prefix}--btn {
|
|
37
|
+
min-height: to-rem(24px);
|
|
38
|
+
padding-top: 0;
|
|
39
|
+
padding-bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.#{$prefix}--combo-button--xs .#{$prefix}--btn--icon-only {
|
|
43
|
+
padding-right: to-rem(4px);
|
|
44
|
+
padding-left: to-rem(4px);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include exports("combo-button") {
|
|
49
|
+
@include combo-button;
|
|
50
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// CopyButton variants: a `ghost` kind and a set of square sizes that mirror
|
|
2
|
+
// `Button`. Carbon ships a single, fixed-size `bx--copy-btn` (a 2.5rem square
|
|
3
|
+
// with a `$layer` fill), so these modifiers extend it to match the `Button`
|
|
4
|
+
// API. The ghost kind reuses Button's ghost theme (transparent fill, subtle
|
|
5
|
+
// hover) so a CopyButton can sit beside a ghost Button without a seam; the
|
|
6
|
+
// sizes scale the square to Button's small/lg/xl heights.
|
|
7
|
+
//
|
|
8
|
+
// Loaded after Carbon's base styles (see all.scss), so each modifier is
|
|
9
|
+
// double-classed to win at equal specificity against the base `bx--copy-btn`
|
|
10
|
+
// declarations it overrides.
|
|
11
|
+
|
|
12
|
+
@import "carbon-components/scss/globals/scss/vars";
|
|
13
|
+
@import "carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once";
|
|
14
|
+
|
|
15
|
+
/// CopyButton ghost kind and square sizes.
|
|
16
|
+
/// @access private
|
|
17
|
+
/// @group copy-button
|
|
18
|
+
@mixin copy-button {
|
|
19
|
+
//--------------------------------------------------------------------------
|
|
20
|
+
// Ghost kind (mirrors Button's ghost theme)
|
|
21
|
+
//--------------------------------------------------------------------------
|
|
22
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--ghost {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--ghost:hover {
|
|
27
|
+
background-color: $hover-ui;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--ghost:active {
|
|
31
|
+
background-color: $active-ui;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--ghost .#{$prefix}--snippet__icon {
|
|
35
|
+
fill: $icon-01;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//--------------------------------------------------------------------------
|
|
39
|
+
// Sizes (square dimensions matching Button's small/lg/xl heights;
|
|
40
|
+
// `default` keeps Carbon's native 2.5rem)
|
|
41
|
+
//--------------------------------------------------------------------------
|
|
42
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--sm {
|
|
43
|
+
width: 2rem;
|
|
44
|
+
height: 2rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--lg {
|
|
48
|
+
width: 3rem;
|
|
49
|
+
height: 3rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--xl {
|
|
53
|
+
width: 4rem;
|
|
54
|
+
height: 4rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Grow the icon on the larger squares so it stays visually centered rather
|
|
58
|
+
// than marooned in whitespace.
|
|
59
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--lg .#{$prefix}--snippet__icon,
|
|
60
|
+
.#{$prefix}--copy-btn.#{$prefix}--copy-btn--xl .#{$prefix}--snippet__icon {
|
|
61
|
+
width: 1.25rem;
|
|
62
|
+
height: 1.25rem;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@include exports("copy-button-variants") {
|
|
67
|
+
@include copy-button;
|
|
68
|
+
}
|
package/css/_datepicker.scss
CHANGED
|
@@ -65,3 +65,73 @@
|
|
|
65
65
|
@include exports('datepicker-month-nav-disabled') {
|
|
66
66
|
@include date-picker-month-nav-disabled;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
// Carbon ships no styles for flatpickr's monthSelect plugin (used by
|
|
70
|
+
// `datePickerType="month"`), so style its raw classes directly, matching
|
|
71
|
+
// the token usage of the day-cell styles Carbon backports from v11.
|
|
72
|
+
@mixin date-picker-month-select {
|
|
73
|
+
.flatpickr-monthSelect-months {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: repeat(3, 1fr);
|
|
76
|
+
margin: 0.625rem 0.0625rem 0.1875rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.flatpickr-monthSelect-month {
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
display: flex;
|
|
82
|
+
padding: 0.625rem;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
border: 0;
|
|
86
|
+
border-radius: 0;
|
|
87
|
+
background: none;
|
|
88
|
+
color: $text-01;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
font-weight: 400;
|
|
91
|
+
text-align: center;
|
|
92
|
+
|
|
93
|
+
&:hover {
|
|
94
|
+
background: $hover-ui;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&:focus {
|
|
98
|
+
outline: 1px solid $focus;
|
|
99
|
+
outline-offset: -1px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.selected {
|
|
103
|
+
background-color: $interactive-01;
|
|
104
|
+
color: $text-04;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.disabled {
|
|
108
|
+
color: $disabled-02;
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
|
|
111
|
+
&:hover {
|
|
112
|
+
background: none;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@include exports('datepicker-month-select') {
|
|
119
|
+
@include date-picker-month-select;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// The month grid is shorter than the day grid Carbon sizes `.flatpickr-calendar.open`
|
|
123
|
+
// for (21rem), which leaves a large empty gap below the 4x3 month layout.
|
|
124
|
+
// `updateClasses` in createCalendar.js marks the container with
|
|
125
|
+
// `.#{$prefix}--date-picker__calendar--month` so this can scope the shorter
|
|
126
|
+
// height without `:has()` (unsupported at the Svelte 5 browser baseline);
|
|
127
|
+
// the extra class also out-specifies the base `.flatpickr-calendar.open` rule
|
|
128
|
+
// (which loads before this partial).
|
|
129
|
+
@mixin date-picker-month-select-height {
|
|
130
|
+
.flatpickr-calendar.open.#{$prefix}--date-picker__calendar--month {
|
|
131
|
+
height: 14rem;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@include exports('datepicker-month-select-height') {
|
|
136
|
+
@include date-picker-month-select-height;
|
|
137
|
+
}
|
package/css/_dialog.scss
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import "carbon-components/scss/globals/scss/vars";
|
|
2
|
+
@import "carbon-components/scss/globals/scss/helper-mixins";
|
|
3
|
+
@import "carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once";
|
|
4
|
+
|
|
5
|
+
/// Dialog primitive. carbon-components@10.58 ships no <dialog> styles, so
|
|
6
|
+
/// layout, background, and backdrop dimming are authored from scratch here,
|
|
7
|
+
/// using the closest v10 token equivalents ($ui-01, $text-01, $ui-03, $overlay-01).
|
|
8
|
+
/// @access private
|
|
9
|
+
/// @group components
|
|
10
|
+
@mixin dialog {
|
|
11
|
+
.#{$prefix}--dialog {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 0;
|
|
14
|
+
right: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
left: 0;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
width: rem(768px);
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
max-height: 100%;
|
|
21
|
+
margin: auto;
|
|
22
|
+
padding: $carbon--spacing-05;
|
|
23
|
+
border: 1px solid $ui-03;
|
|
24
|
+
background-color: $ui-01;
|
|
25
|
+
color: $text-01;
|
|
26
|
+
|
|
27
|
+
@include carbon--breakpoint(md) {
|
|
28
|
+
max-width: 84%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include carbon--breakpoint(lg) {
|
|
32
|
+
max-width: 60%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@include carbon--breakpoint(xlg) {
|
|
36
|
+
max-width: 48%;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.#{$prefix}--dialog::backdrop {
|
|
41
|
+
background-color: $overlay-01;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include exports("dialog") {
|
|
46
|
+
@include dialog;
|
|
47
|
+
}
|