@steedos-widgets/sortable 1.0.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.
Files changed (72) hide show
  1. package/.env +1 -0
  2. package/.env.local +8 -0
  3. package/dist/assets-dev.json +25 -0
  4. package/dist/assets.json +25 -0
  5. package/dist/components/MultipleContainers.d.ts +7 -0
  6. package/dist/components/components/Container/Container.d.ts +17 -0
  7. package/dist/components/components/Container/index.d.ts +2 -0
  8. package/dist/components/components/Grid/Grid.d.ts +7 -0
  9. package/dist/components/components/Grid/index.d.ts +1 -0
  10. package/dist/components/components/GridContainer/GridContainer.d.ts +6 -0
  11. package/dist/components/components/GridContainer/index.d.ts +1 -0
  12. package/dist/components/components/Item/Item.d.ts +37 -0
  13. package/dist/components/components/Item/components/Action/Action.d.ts +9 -0
  14. package/dist/components/components/Item/components/Action/index.d.ts +2 -0
  15. package/dist/components/components/Item/components/Handle/Handle.d.ts +3 -0
  16. package/dist/components/components/Item/components/Handle/index.d.ts +1 -0
  17. package/dist/components/components/Item/components/Remove/Remove.d.ts +3 -0
  18. package/dist/components/components/Item/components/Remove/index.d.ts +1 -0
  19. package/dist/components/components/Item/components/index.d.ts +3 -0
  20. package/dist/components/components/Item/index.d.ts +2 -0
  21. package/dist/components/components/index.d.ts +5 -0
  22. package/dist/components/index.d.ts +1 -0
  23. package/dist/components/multipleContainersKeyboardCoordinates.d.ts +2 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/meta.d.ts +9 -0
  26. package/dist/meta.js +180 -0
  27. package/dist/metas/MultipleContainers.d.ts +2 -0
  28. package/dist/sortable.cjs.css +335 -0
  29. package/dist/sortable.cjs.js +56525 -0
  30. package/dist/sortable.cjs.js.map +1 -0
  31. package/dist/sortable.esm.css +335 -0
  32. package/dist/sortable.esm.js +56521 -0
  33. package/dist/sortable.esm.js.map +1 -0
  34. package/dist/sortable.umd.css +335 -0
  35. package/dist/sortable.umd.js +22829 -0
  36. package/dist/utilities/createRange.d.ts +1 -0
  37. package/dist/utilities/index.d.ts +1 -0
  38. package/package.json +51 -0
  39. package/rollup.config.ts +109 -0
  40. package/src/assets.json +25 -0
  41. package/src/components/MultipleContainers.tsx +802 -0
  42. package/src/components/components/Container/Container.module.css +103 -0
  43. package/src/components/components/Container/Container.tsx +83 -0
  44. package/src/components/components/Container/index.ts +2 -0
  45. package/src/components/components/Grid/Grid.module.css +30 -0
  46. package/src/components/components/Grid/Grid.tsx +22 -0
  47. package/src/components/components/Grid/index.ts +1 -0
  48. package/src/components/components/GridContainer/GridContainer.module.css +15 -0
  49. package/src/components/components/GridContainer/GridContainer.tsx +23 -0
  50. package/src/components/components/GridContainer/index.ts +1 -0
  51. package/src/components/components/Item/Item.module.css +145 -0
  52. package/src/components/components/Item/Item.tsx +157 -0
  53. package/src/components/components/Item/components/Action/Action.module.css +50 -0
  54. package/src/components/components/Item/components/Action/Action.tsx +33 -0
  55. package/src/components/components/Item/components/Action/index.ts +2 -0
  56. package/src/components/components/Item/components/Handle/Handle.tsx +20 -0
  57. package/src/components/components/Item/components/Handle/index.ts +1 -0
  58. package/src/components/components/Item/components/Remove/Remove.tsx +19 -0
  59. package/src/components/components/Item/components/Remove/index.ts +1 -0
  60. package/src/components/components/Item/components/index.ts +3 -0
  61. package/src/components/components/Item/index.ts +2 -0
  62. package/src/components/components/index.ts +6 -0
  63. package/src/components/index.ts +1 -0
  64. package/src/components/multipleContainersKeyboardCoordinates.ts +116 -0
  65. package/src/index.ts +1 -0
  66. package/src/meta.ts +20 -0
  67. package/src/metas/MultipleContainers.tsx +131 -0
  68. package/src/types/css.d.ts +4 -0
  69. package/src/types/global.d.ts +6 -0
  70. package/src/utilities/createRange.ts +15 -0
  71. package/src/utilities/index.ts +1 -0
  72. package/tsconfig.json +11 -0
@@ -0,0 +1,103 @@
1
+ .Container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ grid-auto-rows: max-content;
5
+ overflow: hidden;
6
+ box-sizing: border-box;
7
+ appearance: none;
8
+ outline: none;
9
+ min-width: 350px;
10
+ margin: 10px;
11
+ border-radius: 5px;
12
+ min-height: 200px;
13
+ transition: background-color 350ms ease;
14
+ background-color: rgba(246, 246, 246, 1);
15
+ border: 1px solid rgba(0, 0, 0, 0.05);
16
+ font-size: 1em;
17
+
18
+ ul {
19
+ display: grid;
20
+ grid-gap: 10px;
21
+ grid-template-columns: repeat(var(--columns, 1), 1fr);
22
+ list-style: none;
23
+ padding: 10px;
24
+ margin: 0;
25
+ }
26
+
27
+ &.scrollable {
28
+ ul {
29
+ overflow-y: auto;
30
+ }
31
+ }
32
+
33
+ &.placeholder {
34
+ justify-content: center;
35
+ align-items: center;
36
+ cursor: pointer;
37
+ color: rgba(0, 0, 0, 0.5);
38
+ background-color: transparent;
39
+ border-style: dashed;
40
+ border-color: rgba(0, 0, 0, 0.08);
41
+
42
+ &:hover {
43
+ border-color: rgba(0, 0, 0, 0.15);
44
+ }
45
+ }
46
+
47
+ &.hover {
48
+ background-color: rgb(235, 235, 235, 1);
49
+ }
50
+
51
+ &.unstyled {
52
+ overflow: visible;
53
+ background-color: transparent !important;
54
+ border: none !important;
55
+ }
56
+
57
+ &.horizontal {
58
+ width: 100%;
59
+
60
+ ul {
61
+ grid-auto-flow: column;
62
+ }
63
+ }
64
+
65
+ &.shadow {
66
+ box-shadow: 0 1px 10px 0 rgba(34, 33, 81, 0.1);
67
+ }
68
+
69
+ &:focus-visible {
70
+ border-color: transparent;
71
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0), 0 0px 0px 2px #4c9ffe;
72
+ }
73
+ }
74
+
75
+ .Header {
76
+ display: flex;
77
+ padding: 5px 20px;
78
+ padding-right: 8px;
79
+ align-items: center;
80
+ justify-content: space-between;
81
+ background-color: #fff;
82
+ border-top-left-radius: 5px;
83
+ border-top-right-radius: 5px;
84
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
85
+
86
+ &:hover {
87
+ .Actions > * {
88
+ opacity: 1 !important;
89
+ }
90
+ }
91
+ }
92
+
93
+ .Actions {
94
+ display: flex;
95
+
96
+ > *:first-child:not(:last-child) {
97
+ opacity: 0;
98
+
99
+ &:focus-visible {
100
+ opacity: 1;
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,83 @@
1
+ //@ts-nocheck
2
+
3
+ import React, {forwardRef} from 'react';
4
+ import classNames from 'classnames';
5
+
6
+ import {Handle, Remove} from '../Item';
7
+
8
+ import styles from './Container.module.css';
9
+
10
+ export interface Props {
11
+ children: React.ReactNode;
12
+ columns?: number;
13
+ label?: string;
14
+ style?: React.CSSProperties;
15
+ horizontal?: boolean;
16
+ hover?: boolean;
17
+ handleProps?: React.HTMLAttributes<any>;
18
+ scrollable?: boolean;
19
+ shadow?: boolean;
20
+ placeholder?: boolean;
21
+ unstyled?: boolean;
22
+ onClick?(): void;
23
+ onRemove?(): void;
24
+ }
25
+
26
+ export const Container = forwardRef<HTMLDivElement, Props>(
27
+ (
28
+ {
29
+ children,
30
+ columns = 1,
31
+ handleProps,
32
+ horizontal,
33
+ hover,
34
+ onClick,
35
+ onRemove,
36
+ label,
37
+ placeholder,
38
+ style,
39
+ scrollable,
40
+ shadow,
41
+ unstyled,
42
+ ...props
43
+ }: Props,
44
+ ref
45
+ ) => {
46
+ const Component = onClick ? 'button' : 'div';
47
+
48
+ return (
49
+ <Component
50
+ {...props}
51
+ ref={ref}
52
+ style={
53
+ {
54
+ ...style,
55
+ '--columns': columns,
56
+ } as React.CSSProperties
57
+ }
58
+ className={classNames(
59
+ styles.Container,
60
+ unstyled && styles.unstyled,
61
+ horizontal && styles.horizontal,
62
+ hover && styles.hover,
63
+ placeholder && styles.placeholder,
64
+ scrollable && styles.scrollable,
65
+ shadow && styles.shadow
66
+ )}
67
+ onClick={onClick}
68
+ tabIndex={onClick ? 0 : undefined}
69
+ >
70
+ {label ? (
71
+ <div className={styles.Header}>
72
+ {label}
73
+ <div className={styles.Actions}>
74
+ {onRemove ? <Remove onClick={onRemove} /> : undefined}
75
+ <Handle {...handleProps} />
76
+ </div>
77
+ </div>
78
+ ) : null}
79
+ {placeholder ? children : <ul>{children}</ul>}
80
+ </Component>
81
+ );
82
+ }
83
+ );
@@ -0,0 +1,2 @@
1
+ export {Container} from './Container';
2
+ export type {Props as ContainerProps} from './Container';
@@ -0,0 +1,30 @@
1
+ .Grid {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background-image: repeating-linear-gradient(
8
+ 0deg,
9
+ transparent,
10
+ transparent calc(var(--grid-size) - 1px),
11
+ #ddd calc(var(--grid-size) - 1px),
12
+ #ddd var(--grid-size)
13
+ ),
14
+ repeating-linear-gradient(
15
+ -90deg,
16
+ transparent,
17
+ transparent calc(var(--grid-size) - 1px),
18
+ #ddd calc(var(--grid-size) - 1px),
19
+ #ddd var(--grid-size)
20
+ );
21
+ background-size: var(--grid-size) var(--grid-size);
22
+ z-index: -1;
23
+ pointer-events: none;
24
+ }
25
+
26
+ .RangeSlider {
27
+ position: fixed;
28
+ right: 20px;
29
+ bottom: 20px;
30
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+
3
+ import styles from './Grid.module.css';
4
+
5
+ export interface Props {
6
+ size: number;
7
+ step?: number;
8
+ onSizeChange(size: number): void;
9
+ }
10
+
11
+ export function Grid({size}: Props) {
12
+ return (
13
+ <div
14
+ className={styles.Grid}
15
+ style={
16
+ {
17
+ '--grid-size': `${size}px`,
18
+ } as React.CSSProperties
19
+ }
20
+ />
21
+ );
22
+ }
@@ -0,0 +1 @@
1
+ export {Grid} from './Grid';
@@ -0,0 +1,15 @@
1
+ .GridContainer {
2
+ max-width: 800px;
3
+ display: grid;
4
+ grid-template-columns: repeat(var(--col-count), 1fr);
5
+ grid-gap: 10px;
6
+ padding: 20px;
7
+
8
+ @media (max-width: 850px) {
9
+ grid-template-columns: repeat(calc(var(--col-count) - 1), 1fr);
10
+ }
11
+
12
+ @media (max-width: 650px) {
13
+ grid-template-columns: repeat(calc(var(--col-count) - 2), 1fr);
14
+ }
15
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+
3
+ import styles from './GridContainer.module.css';
4
+
5
+ export interface Props {
6
+ children: React.ReactNode;
7
+ columns: number;
8
+ }
9
+
10
+ export function GridContainer({children, columns}: Props) {
11
+ return (
12
+ <ul
13
+ className={styles.GridContainer}
14
+ style={
15
+ {
16
+ '--col-count': columns,
17
+ } as React.CSSProperties
18
+ }
19
+ >
20
+ {children}
21
+ </ul>
22
+ );
23
+ }
@@ -0,0 +1 @@
1
+ export {GridContainer} from './GridContainer';
@@ -0,0 +1,145 @@
1
+ $font-weight: 400;
2
+ $background-color: #fff;
3
+ $border-color: #efefef;
4
+ $text-color: #333;
5
+ $handle-color: rgba(0, 0, 0, 0.25);
6
+ $box-shadow-border: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05);
7
+ $box-shadow-common: 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
8
+ $box-shadow: $box-shadow-border, $box-shadow-common;
9
+ $focused-outline-color: #4c9ffe;
10
+
11
+ @keyframes pop {
12
+ 0% {
13
+ transform: scale(1);
14
+ box-shadow: var(--box-shadow);
15
+ }
16
+ 100% {
17
+ transform: scale(var(--scale));
18
+ box-shadow: var(--box-shadow-picked-up);
19
+ }
20
+ }
21
+
22
+ @keyframes fadeIn {
23
+ 0% {
24
+ opacity: 0;
25
+ }
26
+ 100% {
27
+ opacity: 1;
28
+ }
29
+ }
30
+
31
+ .Wrapper {
32
+ display: flex;
33
+ box-sizing: border-box;
34
+ transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0)
35
+ scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
36
+ transform-origin: 0 0;
37
+ touch-action: manipulation;
38
+
39
+ &.fadeIn {
40
+ animation: fadeIn 500ms ease;
41
+ }
42
+
43
+ &.dragOverlay {
44
+ --scale: 1.05;
45
+ --box-shadow: $box-shadow;
46
+ --box-shadow-picked-up: $box-shadow-border,
47
+ -1px 0 15px 0 rgba(34, 33, 81, 0.01),
48
+ 0px 15px 15px 0 rgba(34, 33, 81, 0.25);
49
+ z-index: 999;
50
+ }
51
+ }
52
+
53
+ .Item {
54
+ position: relative;
55
+ display: flex;
56
+ flex-grow: 1;
57
+ align-items: center;
58
+ padding: 8px 10px;
59
+ background-color: $background-color;
60
+ box-shadow: $box-shadow;
61
+ outline: none;
62
+ border-radius: calc(4px / var(--scale-x, 1));
63
+ box-sizing: border-box;
64
+ list-style: none;
65
+ transform-origin: 50% 50%;
66
+
67
+ -webkit-tap-highlight-color: transparent;
68
+
69
+ color: $text-color;
70
+ font-weight: $font-weight;
71
+ font-size: 1rem;
72
+ white-space: nowrap;
73
+
74
+ transform: scale(var(--scale, 1));
75
+ transition: box-shadow 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
76
+
77
+ &:focus-visible {
78
+ box-shadow: 0 0px 4px 1px $focused-outline-color, $box-shadow;
79
+ }
80
+
81
+ &:not(.withHandle) {
82
+ touch-action: manipulation;
83
+ cursor: grab;
84
+ }
85
+
86
+ &.dragging:not(.dragOverlay) {
87
+ opacity: var(--dragging-opacity, 0.5);
88
+ z-index: 0;
89
+
90
+ &:focus {
91
+ box-shadow: $box-shadow;
92
+ }
93
+ }
94
+
95
+ &.disabled {
96
+ color: #999;
97
+ background-color: #f1f1f1;
98
+ &:focus {
99
+ box-shadow: 0 0px 4px 1px rgba(0, 0, 0, 0.1), $box-shadow;
100
+ }
101
+ cursor: not-allowed;
102
+ }
103
+
104
+ &.dragOverlay {
105
+ cursor: inherit;
106
+ /* box-shadow: 0 0px 6px 2px $focused-outline-color; */
107
+ animation: pop 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
108
+ transform: scale(var(--scale));
109
+ box-shadow: var(--box-shadow-picked-up);
110
+ opacity: 1;
111
+ }
112
+
113
+ &.color:before {
114
+ content: '';
115
+ position: absolute;
116
+ top: 50%;
117
+ transform: translateY(-50%);
118
+ left: 0;
119
+ height: 100%;
120
+ width: 3px;
121
+ display: block;
122
+ border-top-left-radius: 3px;
123
+ border-bottom-left-radius: 3px;
124
+ background-color: var(--color);
125
+ }
126
+
127
+ &:hover {
128
+ .Remove {
129
+ visibility: visible;
130
+ }
131
+ }
132
+ }
133
+
134
+ .Remove {
135
+ visibility: hidden;
136
+ }
137
+
138
+ .Actions {
139
+ display: flex;
140
+ align-self: flex-start;
141
+ margin-top: -12px;
142
+ margin-left: auto;
143
+ margin-bottom: -15px;
144
+ margin-right: -10px;
145
+ }
@@ -0,0 +1,157 @@
1
+ import React, {useEffect} from 'react';
2
+ import classNames from 'classnames';
3
+ import type {DraggableSyntheticListeners} from '@dnd-kit/core';
4
+ import type {Transform} from '@dnd-kit/utilities';
5
+
6
+ import {Handle, Remove} from './components';
7
+
8
+ import styles from './Item.module.css';
9
+
10
+ export interface Props {
11
+ dragOverlay?: boolean;
12
+ color?: string;
13
+ disabled?: boolean;
14
+ dragging?: boolean;
15
+ handle?: boolean;
16
+ handleProps?: any;
17
+ height?: number;
18
+ index?: number;
19
+ columnSpan?: number;
20
+ fadeIn?: boolean;
21
+ transform?: Transform | null;
22
+ listeners?: DraggableSyntheticListeners;
23
+ sorting?: boolean;
24
+ style?: React.CSSProperties;
25
+ transition?: string | null;
26
+ wrapperStyle?: React.CSSProperties;
27
+ value: React.ReactNode;
28
+ onRemove?(): void;
29
+ renderItem?(args: {
30
+ dragOverlay: boolean;
31
+ dragging: boolean;
32
+ sorting: boolean;
33
+ index: number | undefined;
34
+ fadeIn: boolean;
35
+ listeners: DraggableSyntheticListeners;
36
+ ref: React.Ref<HTMLElement>;
37
+ style: React.CSSProperties | undefined;
38
+ transform: Props['transform'];
39
+ transition: Props['transition'];
40
+ value: Props['value'];
41
+ }): React.ReactElement;
42
+ }
43
+
44
+ export const Item = React.memo(
45
+ React.forwardRef<HTMLLIElement, Props>(
46
+ (
47
+ {
48
+ color,
49
+ dragOverlay,
50
+ dragging,
51
+ disabled,
52
+ fadeIn,
53
+ handle,
54
+ handleProps,
55
+ height,
56
+ columnSpan = 1,
57
+ index,
58
+ listeners,
59
+ onRemove,
60
+ renderItem,
61
+ sorting,
62
+ style,
63
+ transition,
64
+ transform,
65
+ value,
66
+ wrapperStyle,
67
+ ...props
68
+ },
69
+ ref
70
+ ) => {
71
+ useEffect(() => {
72
+ if (!dragOverlay) {
73
+ return;
74
+ }
75
+
76
+ document.body.style.cursor = 'grabbing';
77
+
78
+ return () => {
79
+ document.body.style.cursor = '';
80
+ };
81
+ }, [dragOverlay]);
82
+
83
+ return renderItem ? (
84
+ renderItem({
85
+ dragOverlay: Boolean(dragOverlay),
86
+ dragging: Boolean(dragging),
87
+ sorting: Boolean(sorting),
88
+ index,
89
+ fadeIn: Boolean(fadeIn),
90
+ listeners,
91
+ ref,
92
+ style,
93
+ transform,
94
+ transition,
95
+ value,
96
+ })
97
+ ) : (
98
+ <li
99
+ className={classNames(
100
+ styles.Wrapper,
101
+ fadeIn && styles.fadeIn,
102
+ sorting && styles.sorting,
103
+ dragOverlay && styles.dragOverlay
104
+ )}
105
+ style={
106
+ {
107
+ ...wrapperStyle,
108
+ gridColumn: `span ${columnSpan} / span ${columnSpan}`,
109
+ transition: [transition, wrapperStyle?.transition]
110
+ .filter(Boolean)
111
+ .join(', '),
112
+ '--translate-x': transform
113
+ ? `${Math.round(transform.x)}px`
114
+ : undefined,
115
+ '--translate-y': transform
116
+ ? `${Math.round(transform.y)}px`
117
+ : undefined,
118
+ '--scale-x': transform?.scaleX
119
+ ? `${transform.scaleX}`
120
+ : undefined,
121
+ '--scale-y': transform?.scaleY
122
+ ? `${transform.scaleY}`
123
+ : undefined,
124
+ '--index': index,
125
+ '--color': color,
126
+ } as React.CSSProperties
127
+ }
128
+ ref={ref}
129
+ >
130
+ <div
131
+ className={classNames(
132
+ styles.Item,
133
+ dragging && styles.dragging,
134
+ handle && styles.withHandle,
135
+ dragOverlay && styles.dragOverlay,
136
+ disabled && styles.disabled,
137
+ color && styles.color
138
+ )}
139
+ style={style}
140
+ data-cypress="draggable-item"
141
+ {...(!handle ? listeners : undefined)}
142
+ {...props}
143
+ tabIndex={!handle ? 0 : undefined}
144
+ >
145
+ {value}
146
+ <span className={styles.Actions}>
147
+ {onRemove ? (
148
+ <Remove className={styles.Remove} onClick={onRemove} />
149
+ ) : null}
150
+ {handle ? <Handle {...handleProps} {...listeners} /> : null}
151
+ </span>
152
+ </div>
153
+ </li>
154
+ );
155
+ }
156
+ )
157
+ );
@@ -0,0 +1,50 @@
1
+ $focused-outline-color: #4c9ffe;
2
+
3
+ .Action {
4
+ display: flex;
5
+ width: 12px;
6
+ padding: 10px;
7
+ align-items: center;
8
+ justify-content: center;
9
+ flex: 0 0 auto;
10
+ touch-action: none;
11
+ cursor: var(--cursor, pointer);
12
+ border-radius: 5px;
13
+ border: none;
14
+ outline: none;
15
+ appearance: none;
16
+ background-color: transparent;
17
+ -webkit-tap-highlight-color: transparent;
18
+
19
+ @media (hover: hover) {
20
+ &:hover {
21
+ background-color: var(--action-background, rgba(0, 0, 0, 0.05));
22
+
23
+ svg {
24
+ fill: #6f7b88;
25
+ }
26
+ }
27
+ }
28
+
29
+ svg {
30
+ flex: 0 0 auto;
31
+ margin: auto;
32
+ height: 100%;
33
+ overflow: visible;
34
+ fill: #919eab;
35
+ }
36
+
37
+ &:active {
38
+ background-color: var(--background, rgba(0, 0, 0, 0.05));
39
+
40
+ svg {
41
+ fill: var(--fill, #788491);
42
+ }
43
+ }
44
+
45
+ &:focus-visible {
46
+ outline: none;
47
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0),
48
+ 0 0px 0px 2px $focused-outline-color;
49
+ }
50
+ }
@@ -0,0 +1,33 @@
1
+ import React, {forwardRef, CSSProperties} from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import styles from './Action.module.css';
5
+
6
+ export interface Props extends React.HTMLAttributes<HTMLButtonElement> {
7
+ active?: {
8
+ fill: string;
9
+ background: string;
10
+ };
11
+ cursor?: CSSProperties['cursor'];
12
+ }
13
+
14
+ export const Action = forwardRef<HTMLButtonElement, Props>(
15
+ ({active, className, cursor, style, ...props}, ref) => {
16
+ return (
17
+ <button
18
+ ref={ref}
19
+ {...props}
20
+ className={classNames(styles.Action, className)}
21
+ tabIndex={0}
22
+ style={
23
+ {
24
+ ...style,
25
+ cursor,
26
+ '--fill': active?.fill,
27
+ '--background': active?.background,
28
+ } as CSSProperties
29
+ }
30
+ />
31
+ );
32
+ }
33
+ );
@@ -0,0 +1,2 @@
1
+ export {Action} from './Action';
2
+ export type {Props as ActionProps} from './Action';
@@ -0,0 +1,20 @@
1
+ import React, {forwardRef} from 'react';
2
+
3
+ import {Action, ActionProps} from '../Action';
4
+
5
+ export const Handle = forwardRef<HTMLButtonElement, ActionProps>(
6
+ (props, ref) => {
7
+ return (
8
+ <Action
9
+ ref={ref}
10
+ cursor="grab"
11
+ data-cypress="draggable-handle"
12
+ {...props}
13
+ >
14
+ <svg viewBox="0 0 20 20" width="12">
15
+ <path d="M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"></path>
16
+ </svg>
17
+ </Action>
18
+ );
19
+ }
20
+ );
@@ -0,0 +1 @@
1
+ export {Handle} from './Handle';