Skip to content

Commit afbb764

Browse files
authored
fix: add drag styles for improved UX (#7644)
1 parent b8bc11c commit afbb764

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@mixin sortable-helper-classes() {
2+
.calcite-sortable--chosen,
3+
.calcite-sortable--ghost,
4+
.calcite-sortable--drag {
5+
@apply border border-dashed;
6+
border-color: var(--calcite-ui-brand);
7+
}
8+
}

packages/calcite-components/src/assets/styles/global.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,5 @@
7979
@include animation-reduced-motion();
8080

8181
@include animation-helper-classes();
82+
83+
@include sortable-helper-classes();

packages/calcite-components/src/assets/styles/includes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import "host";
88
@import "spacing";
99
@import "floating-ui";
10+
@import "sortable";
1011

1112
@mixin slotted($selector, $tag, $scope: "") {
1213
#{$scope} slot[name="#{$selector}"]::slotted(#{$tag}),

packages/calcite-components/src/utils/sortableComponent.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export interface DragDetail {
77
dragEl: HTMLElement;
88
}
99

10+
export const CSS = {
11+
ghostClass: "calcite-sortable--ghost",
12+
chosenClass: "calcite-sortable--chosen",
13+
dragClass: "calcite-sortable--drag",
14+
};
15+
1016
/**
1117
* Defines interface for components with sorting functionality.
1218
*/
@@ -81,6 +87,7 @@ export function connectSortableComponent(component: SortableComponent): void {
8187

8288
component.sortable = Sortable.create(component.el, {
8389
dataIdAttr,
90+
...CSS,
8491
...(!!draggable && { draggable }),
8592
...(!!group && {
8693
group: {

0 commit comments

Comments
 (0)