authscape 1.0.374 → 1.0.376

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.374",
3
+ "version": "1.0.376",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ import React, {forwardRef, CSSProperties} from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ export const Action = forwardRef(
5
+ ({active, className, cursor, style, ...props}, ref) => {
6
+ return (
7
+ <button
8
+ ref={ref}
9
+ {...props}
10
+ className={"Action"}
11
+ tabIndex={0}
12
+ style={
13
+ {
14
+ ...style,
15
+ cursor,
16
+ '--fill': active?.fill,
17
+ '--background': active?.background,
18
+ }
19
+ }
20
+ />
21
+ );
22
+ }
23
+ );
@@ -0,0 +1,66 @@
1
+ import React, {forwardRef} from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import { Handle } from './Handle';
5
+ import { Remove } from './Remove';
6
+
7
+ import styles from 'authscape/dist/Container.module.css';
8
+
9
+ export const Container = forwardRef(
10
+ (
11
+ {
12
+ children,
13
+ columns = 1,
14
+ handleProps,
15
+ horizontal,
16
+ hover,
17
+ onClick,
18
+ onRemove,
19
+ label,
20
+ placeholder,
21
+ style,
22
+ scrollable,
23
+ shadow,
24
+ unstyled,
25
+ ...props
26
+ },
27
+ ref
28
+ ) => {
29
+ const Component = onClick ? 'button' : 'div';
30
+
31
+ return (
32
+ <Component
33
+ {...props}
34
+ ref={ref}
35
+ style={
36
+ {
37
+ ...style,
38
+ '--columns': columns,
39
+ }
40
+ }
41
+ className={classNames(
42
+ styles.Container,
43
+ unstyled && styles.unstyled,
44
+ horizontal && styles.horizontal,
45
+ hover && styles.hover,
46
+ placeholder && styles.placeholder,
47
+ scrollable && styles.scrollable,
48
+ shadow && styles.shadow
49
+ )}
50
+ onClick={onClick}
51
+ tabIndex={onClick ? 0 : undefined}
52
+ >
53
+ {label ? (
54
+ <div className={"Header"}>
55
+ {label}
56
+ <div className={"Actions"}>
57
+ {onRemove ? <Remove onClick={onRemove} /> : undefined}
58
+ <Handle {...handleProps} />
59
+ </div>
60
+ </div>
61
+ ) : null}
62
+ {placeholder ? children : <ul style={{paddingLeft:"10px", paddingRight:"10px", marginTop:"5px"}}>{children}</ul>}
63
+ </Component>
64
+ );
65
+ }
66
+ );
@@ -0,0 +1,20 @@
1
+ import React, {forwardRef} from 'react';
2
+
3
+ import {Action} from './Action';
4
+
5
+ export const Handle = forwardRef(
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,139 @@
1
+ import React, {useEffect} from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import { Handle } from './Handle';
5
+ import { Remove } from './Remove';
6
+
7
+ import styles from 'authscape/dist/Item.module.css';
8
+ import { Box } from '@mui/material';
9
+
10
+ export const Item = React.memo(
11
+ React.forwardRef(
12
+ (
13
+ {
14
+ color,
15
+ dragOverlay,
16
+ dragging,
17
+ disabled,
18
+ fadeIn,
19
+ name,
20
+ handle,
21
+ handleProps,
22
+ height,
23
+ cardDetail,
24
+ CardTemplate,
25
+ index,
26
+ listeners,
27
+ onRemove,
28
+ renderItem,
29
+ sorting,
30
+ style,
31
+ transition,
32
+ transform,
33
+ value,
34
+ handleMoreClick,
35
+ handleMoreClose,
36
+ wrapperStyle,
37
+ ...props
38
+ },
39
+ ref
40
+ ) => {
41
+ useEffect(() => {
42
+ if (!dragOverlay) {
43
+ return;
44
+ }
45
+
46
+ document.body.style.cursor = 'grabbing';
47
+
48
+ return () => {
49
+ document.body.style.cursor = '';
50
+ };
51
+ }, [dragOverlay]);
52
+
53
+ cardDetail.moreClicked = handleMoreClick;
54
+
55
+ return renderItem ? (
56
+ renderItem({
57
+ dragOverlay: Boolean(dragOverlay),
58
+ dragging: Boolean(dragging),
59
+ sorting: Boolean(sorting),
60
+ index,
61
+ fadeIn: Boolean(fadeIn),
62
+ listeners,
63
+ ref,
64
+ style,
65
+ transform,
66
+ transition,
67
+ value,
68
+ })
69
+ ) : (
70
+ <li
71
+ className={classNames(
72
+ styles.Wrapper,
73
+ fadeIn && styles.fadeIn,
74
+ sorting && styles.sorting,
75
+ dragOverlay && styles.dragOverlay
76
+ )}
77
+ style={
78
+ {
79
+ ...wrapperStyle,
80
+ transition: [transition, wrapperStyle?.transition]
81
+ .filter(Boolean)
82
+ .join(', '),
83
+ '--translate-x': transform
84
+ ? `${Math.round(transform.x)}px`
85
+ : undefined,
86
+ '--translate-y': transform
87
+ ? `${Math.round(transform.y)}px`
88
+ : undefined,
89
+ '--scale-x': transform?.scaleX
90
+ ? `${transform.scaleX}`
91
+ : undefined,
92
+ '--scale-y': transform?.scaleY
93
+ ? `${transform.scaleY}`
94
+ : undefined,
95
+ '--index': index,
96
+ '--color': color,
97
+ paddingTop:"10px"
98
+ }
99
+ }
100
+ ref={ref}
101
+ >
102
+ <Box
103
+ className={classNames(
104
+ styles.Item,
105
+ dragging && styles.dragging,
106
+ handle && styles.withHandle,
107
+ dragOverlay && styles.dragOverlay,
108
+ disabled && styles.disabled,
109
+ color && styles.color
110
+ )}
111
+ style={style}
112
+ data-cypress="draggable-item"
113
+ {...(!handle ? listeners : undefined)}
114
+ {...props}
115
+ tabIndex={!handle ? 0 : undefined}>
116
+
117
+
118
+ {CardTemplate != null &&
119
+ <CardTemplate props={cardDetail} />
120
+ }
121
+
122
+ {CardTemplate == null &&
123
+ <Box>
124
+ {name}
125
+ </Box>
126
+ }
127
+
128
+ <span className={"Actions"}>
129
+ {onRemove ? (
130
+ <Remove className={"Remove"} onClick={onRemove} />
131
+ ) : null}
132
+ {handle ? <Handle {...handleProps} {...listeners} /> : null}
133
+ </span>
134
+ </Box>
135
+ </li>
136
+ );
137
+ }
138
+ )
139
+ );