-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,450 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Draggable</ids-text> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-draggable> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>no axis</ids-text></div> | ||
</ids-draggable> | ||
<ids-draggable axis="y"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='y'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
<ids-draggable axis="x"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='x'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Draggable (Bounded by Div/Container)</ids-text> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<div class="ids-draggable-demo-content"> | ||
<ids-draggable parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>no axis</ids-text></div> | ||
</ids-draggable> | ||
<ids-draggable axis="y" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='y'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
<ids-draggable axis="x" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='x'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</div> | ||
</ids-layout-grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './example.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.ids-draggable-demo-box { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 64px; | ||
height: 64px; | ||
border-style: dashed; | ||
} | ||
|
||
.ids-draggable-demo-content { | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: row; | ||
width: 312px; | ||
height: 128px; | ||
border: 1px dashed var(--ids-color-palette-graphite-60); | ||
} | ||
|
||
ids-draggable:nth-of-type(1) .ids-draggable-demo-box, | ||
ids-layout-grid-cell:nth-of-type(1) .ids-draggable-demo-box { | ||
border: 1px dashed var(--ids-color-palette-ruby-40); | ||
} | ||
|
||
ids-draggable:nth-of-type(2) .ids-draggable-demo-box, | ||
ids-layout-grid-cell:nth-of-type(2) .ids-draggable-demo-box { | ||
border: 1px dashed var(--ids-color-palette-emerald-40); | ||
} | ||
|
||
ids-draggable:nth-of-type(3) .ids-draggable-demo-box, | ||
ids-layout-grid-cell:nth-of-type(3) .ids-draggable-demo-box { | ||
border: 1px dashed var(--ids-color-palette-azure-40); | ||
} | ||
|
||
.ids-draggable-handle-example { | ||
display: flex; | ||
flex-direction: row; | ||
border: 1px dashed var(--ids-color-palette-ruby-40); | ||
align-items: center; | ||
justify-content: center; | ||
|
||
& div:nth-child(2) { | ||
padding: 16px 8px; | ||
} | ||
} | ||
|
||
.ids-draggable-handle { | ||
align-items: center; | ||
margin-right: 8px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{> ../layouts/head.html }} | ||
{{> example.html }} | ||
{{> ../layouts/footer.html }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import IdsDraggable from '../../src/ids-draggable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{{> ../layouts/head.html }} | ||
|
||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Draggable</ids-text> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-draggable> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>no axis</ids-text></div> | ||
</ids-draggable> | ||
<ids-draggable axis="y"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='y'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
<ids-draggable axis="x"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='x'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Draggable (Bounded by Div/Container)</ids-text> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<div class="ids-draggable-demo-content"> | ||
<ids-draggable parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>no axis</ids-text></div> | ||
</ids-draggable> | ||
<ids-draggable axis="y" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='y'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
<ids-draggable axis="x" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='x'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</div> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Draggable (Bounded by Layout Grid)</ids-text> | ||
</ids-layout-grid> | ||
<ids-layout-grid> | ||
<ids-draggable parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>no axis</ids-text></div> | ||
</ids-draggable> | ||
<ids-draggable axis="y" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='y'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
<ids-draggable axis="x" parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>axis='x'</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</ids-layout-grid> | ||
|
||
<ids-layout-grid> | ||
<ids-draggable handle=".ids-draggable-handle"> | ||
<div class="ids-draggable-handle-example"> | ||
<ids-icon | ||
class="ids-draggable-handle" | ||
icon="drag" | ||
size="large" | ||
></ids-icon> | ||
<div> | ||
drag the handle to the left | ||
</div> | ||
</div> | ||
</ids-draggable> | ||
</ids-layout-grid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import './index'; | ||
import './example.scss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Ids Draggable | ||
|
||
## Description | ||
|
||
A container which limits and tracks the dragging of an HTML Element along a specific axis or within the bounds of it's parent element. | ||
|
||
## Use Cases | ||
|
||
A draggable would be used in the case where you may have a pane splitter (e.g. in `ids-splitter`), or a list that is meant to be dragged along a specific axis. It may also be used in many cases where we have a canvas or pane that should be resized (in one or two dimensions). | ||
|
||
It does not currently support drag/drop targets in the current iteration, but in the future this component may be used for moving items. | ||
|
||
## Features (With Code Examples) | ||
A draggable component with no bounds to where it is moved. | ||
```html | ||
<ids-draggable> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>Drag Me</ids-text> | ||
</div> | ||
</ids-draggable> | ||
``` | ||
|
||
A draggable component along the X axis (e.g. drags horizontally). | ||
```html | ||
<ids-draggable axis="x"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>Horizontally Draggable</ids-text> | ||
</div> | ||
</ids-draggable> | ||
``` | ||
|
||
A draggable component along the Y axis (e.g. drags vertically). | ||
```html | ||
<ids-draggable axis="y"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>Vertically Draggable</ids-text> | ||
</div> | ||
</ids-draggable> | ||
``` | ||
|
||
A draggable component which can be dragged either horizontally or vertically | ||
but is contained by it's first non zero-width/height parent (can also work for non-`<div>`, but cannot be a controlled `ids-layout-grid-cell`). | ||
```html | ||
<div> | ||
<ids-draggable parent-containment> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-text>Vertically Draggable</ids-text></div> | ||
</ids-draggable> | ||
</div> | ||
``` | ||
|
||
A draggable component which is draggable only by a specific handle on the tab (note: a draggable component currently has a limitation of one handle element, even if the class matches multiple handles). | ||
```html | ||
<div> | ||
<ids-draggable handle=".drag-handle"> | ||
<div class="ids-draggable-demo-box"> | ||
<ids-icon | ||
class="drag-handle" | ||
icon="drag" | ||
size="large" | ||
></ids-icon> | ||
<ids-text> | ||
All-content drags, but only .drag-handle is draggable | ||
</ids-text> | ||
</div> | ||
</ids-draggable> | ||
</div> | ||
``` | ||
|
||
## Settings and Attributes | ||
|
||
- `parent-containment` {boolean} Flags this draggable as having drag range being contained only within the first/closest inner parent of the content with a measurable width or height. | ||
- `is-draggable` {boolean} Whether or not the `ids-draggable` and content is being dragged. | ||
- `disabled` {boolean} | ||
- `axis?` {'x' | 'y'} The axis that the draggable content will be moving along (e.g. X => horizontal, Y => vertical); By default, not defined and supports both axes. | ||
- `handle?` {string} A query selector representing an optional handle that can be used to drag the content of the draggable. | ||
|
||
## Accessibility | ||
|
||
- Wherever possible, it would be worth adding some visual indicator that content is dragged (this can be done using the `is-dragging` attribute or listening on `ids-dragstart` and `ids-dragend` callbacks). | ||
- It is good to keep in mind that draggable content may present issues for people with visual impairments, and so things such as scrollability and typical keyboard | ||
navigation should all function as normal in the case where a user is browsing content that may have resize handles or other draggability aspects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# TODO for IDS Draggable | ||
|
||
- [] consider mobile touch. | ||
.... | ||
- documentation: ids-drag event: e.detail.parentRect, e.detail.dragDeltaX/Y, e.detail.translateX/Y | ||
- known issue (minor): in firefox, the cursor when moved quickly flashes between dragging/default as the positioning/detection | ||
isnt instant as it is in chrome. |
Oops, something went wrong.