@zendeskgarden/react-draggable 9.0.0-next.19
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/LICENSE.md +176 -0
- package/README.md +41 -0
- package/dist/esm/elements/draggable/Draggable.js +39 -0
- package/dist/esm/elements/draggable/components/Content.js +23 -0
- package/dist/esm/elements/draggable/components/Grip.js +24 -0
- package/dist/esm/elements/draggable-list/DraggableList.js +36 -0
- package/dist/esm/elements/draggable-list/components/DropIndicator.js +33 -0
- package/dist/esm/elements/draggable-list/components/Item.js +30 -0
- package/dist/esm/elements/dropzone/Dropzone.js +63 -0
- package/dist/esm/elements/dropzone/components/Icon.js +46 -0
- package/dist/esm/elements/dropzone/components/Message.js +40 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/grip.svg.js +66 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +27 -0
- package/dist/esm/styled/draggable/StyledContent.js +22 -0
- package/dist/esm/styled/draggable/StyledDraggable.js +115 -0
- package/dist/esm/styled/draggable/StyledGrip.js +32 -0
- package/dist/esm/styled/draggable-list/StyledDraggableList.js +38 -0
- package/dist/esm/styled/draggable-list/StyledDropIndicator.js +42 -0
- package/dist/esm/styled/draggable-list/StyledItem.js +31 -0
- package/dist/esm/styled/dropzone/StyledDropzone.js +96 -0
- package/dist/esm/styled/dropzone/StyledIcon.js +38 -0
- package/dist/esm/styled/dropzone/StyledMessage.js +22 -0
- package/dist/esm/utils/useDraggableListContext.js +18 -0
- package/dist/esm/utils/useDropzoneContext.js +18 -0
- package/dist/index.cjs.js +632 -0
- package/dist/typings/elements/draggable/Draggable.d.ts +17 -0
- package/dist/typings/elements/draggable/components/Content.d.ts +11 -0
- package/dist/typings/elements/draggable/components/Grip.d.ts +11 -0
- package/dist/typings/elements/draggable-list/DraggableList.d.ts +17 -0
- package/dist/typings/elements/draggable-list/components/DropIndicator.d.ts +11 -0
- package/dist/typings/elements/draggable-list/components/Item.d.ts +11 -0
- package/dist/typings/elements/dropzone/Dropzone.d.ts +17 -0
- package/dist/typings/elements/dropzone/components/Icon.d.ts +11 -0
- package/dist/typings/elements/dropzone/components/Message.d.ts +11 -0
- package/dist/typings/index.d.ts +10 -0
- package/dist/typings/styled/draggable/StyledContent.d.ts +10 -0
- package/dist/typings/styled/draggable/StyledDraggable.d.ts +21 -0
- package/dist/typings/styled/draggable/StyledGrip.d.ts +11 -0
- package/dist/typings/styled/draggable-list/StyledDraggableList.d.ts +17 -0
- package/dist/typings/styled/draggable-list/StyledDropIndicator.d.ts +14 -0
- package/dist/typings/styled/draggable-list/StyledItem.d.ts +14 -0
- package/dist/typings/styled/dropzone/StyledDropzone.d.ts +23 -0
- package/dist/typings/styled/dropzone/StyledIcon.d.ts +19 -0
- package/dist/typings/styled/dropzone/StyledMessage.d.ts +10 -0
- package/dist/typings/styled/index.d.ts +15 -0
- package/dist/typings/types/index.d.ts +41 -0
- package/dist/typings/utils/useDraggableListContext.d.ts +12 -0
- package/dist/typings/utils/useDropzoneContext.d.ts +17 -0
- package/package.json +56 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'draggable.content';
|
|
11
|
+
const StyledContent = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledContent",
|
|
16
|
+
componentId: "sc-15arore-0"
|
|
17
|
+
})(["flex:1;word-wrap:break-word;overflow-wrap:anywhere;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledContent.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledContent };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledGrip } from './StyledGrip.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'draggable';
|
|
12
|
+
function getDragShadow(theme) {
|
|
13
|
+
const {
|
|
14
|
+
space,
|
|
15
|
+
shadows
|
|
16
|
+
} = theme;
|
|
17
|
+
const offsetY = `${space.base * 5}px`;
|
|
18
|
+
const blurRadius = `${space.base * 7}px`;
|
|
19
|
+
const color = getColor({
|
|
20
|
+
variable: 'shadow.large',
|
|
21
|
+
theme
|
|
22
|
+
});
|
|
23
|
+
return shadows.lg(offsetY, blurRadius, color);
|
|
24
|
+
}
|
|
25
|
+
const colorStyles = props => {
|
|
26
|
+
const {
|
|
27
|
+
isBare,
|
|
28
|
+
isGrabbed,
|
|
29
|
+
isDisabled,
|
|
30
|
+
isPlaceholder,
|
|
31
|
+
focusInset,
|
|
32
|
+
theme
|
|
33
|
+
} = props;
|
|
34
|
+
const dragShadow = getDragShadow(theme);
|
|
35
|
+
const baseBgColor = getColor({
|
|
36
|
+
variable: 'background.default',
|
|
37
|
+
theme
|
|
38
|
+
});
|
|
39
|
+
const placeholderBgColor = getColor({
|
|
40
|
+
variable: 'background.disabled',
|
|
41
|
+
theme
|
|
42
|
+
});
|
|
43
|
+
const disabledBgColor = getColor({
|
|
44
|
+
variable: 'background.disabled',
|
|
45
|
+
theme
|
|
46
|
+
});
|
|
47
|
+
const disabledColor = getColor({
|
|
48
|
+
variable: 'foreground.disabled',
|
|
49
|
+
theme
|
|
50
|
+
});
|
|
51
|
+
let color;
|
|
52
|
+
let hoverBackgroundColor;
|
|
53
|
+
let boxShadow;
|
|
54
|
+
let borderColor = 'transparent';
|
|
55
|
+
let backgroundColor = baseBgColor;
|
|
56
|
+
if (isDisabled) {
|
|
57
|
+
backgroundColor = disabledBgColor;
|
|
58
|
+
color = disabledColor;
|
|
59
|
+
} else if (isPlaceholder) {
|
|
60
|
+
backgroundColor = placeholderBgColor;
|
|
61
|
+
} else {
|
|
62
|
+
color = getColor({
|
|
63
|
+
variable: 'foreground.default',
|
|
64
|
+
theme
|
|
65
|
+
});
|
|
66
|
+
borderColor = isBare ? 'transparent' : getColor({
|
|
67
|
+
variable: 'border.default',
|
|
68
|
+
theme
|
|
69
|
+
});
|
|
70
|
+
hoverBackgroundColor = getColor({
|
|
71
|
+
variable: isGrabbed ? 'background.raised' : 'background.primaryEmphasis',
|
|
72
|
+
...(!isGrabbed && {
|
|
73
|
+
transparency: theme.opacity[100],
|
|
74
|
+
dark: {
|
|
75
|
+
offset: -100
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
theme
|
|
79
|
+
});
|
|
80
|
+
boxShadow = dragShadow;
|
|
81
|
+
}
|
|
82
|
+
return css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";&:hover{background-color:", ";}", " > ", "{color:", ";}"], borderColor, isGrabbed && boxShadow, backgroundColor, color, hoverBackgroundColor, focusStyles({
|
|
83
|
+
theme,
|
|
84
|
+
inset: focusInset,
|
|
85
|
+
boxShadow: isGrabbed ? dragShadow : undefined
|
|
86
|
+
}), StyledGrip, isDisabled && disabledColor);
|
|
87
|
+
};
|
|
88
|
+
const sizeStyles = props => {
|
|
89
|
+
const {
|
|
90
|
+
isCompact,
|
|
91
|
+
theme
|
|
92
|
+
} = props;
|
|
93
|
+
const paddingDefault = theme.space.base * 2.25;
|
|
94
|
+
const paddingCompact = theme.space.base * 1.25;
|
|
95
|
+
return css(["margin:0;border:", ";border-radius:", ";padding:", ";line-height:", ";font-size:", ";font-weight:", ";"], theme.borders.sm, theme.borderRadii.md, isCompact ? `${paddingCompact}px ${paddingDefault}px` : `${paddingDefault}px`, getLineHeight(theme.space.base * 5, theme.fontSizes.md), theme.fontSizes.md, theme.fontWeights.regular);
|
|
96
|
+
};
|
|
97
|
+
const getCursor = props => {
|
|
98
|
+
let cursor = props.isGrabbed ? 'grabbing' : 'grab';
|
|
99
|
+
if (props.isDisabled || props.isPlaceholder) {
|
|
100
|
+
cursor = 'default';
|
|
101
|
+
}
|
|
102
|
+
return cursor;
|
|
103
|
+
};
|
|
104
|
+
const StyledDraggable = styled.div.attrs({
|
|
105
|
+
'data-garden-id': COMPONENT_ID,
|
|
106
|
+
'data-garden-version': '9.0.0-next.19'
|
|
107
|
+
}).withConfig({
|
|
108
|
+
displayName: "StyledDraggable",
|
|
109
|
+
componentId: "sc-3lxpf1-0"
|
|
110
|
+
})(["display:flex;flex:1;align-items:center;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,z-index 0.25s ease-in-out;cursor:", ";font-family:", ";direction:", ";box-sizing:border-box;", " ", " > *{visibility:", ";}", ";"], getCursor, props => props.theme.fonts.system, props => props.theme.rtl && 'rtl', sizeStyles, colorStyles, p => p.isPlaceholder && !p.isDisabled && 'hidden', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
111
|
+
StyledDraggable.defaultProps = {
|
|
112
|
+
theme: DEFAULT_THEME
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { StyledDraggable, getDragShadow };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'draggable.grip';
|
|
11
|
+
function sizeStyles(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const property = theme.rtl ? 'margin-left' : 'margin-right';
|
|
16
|
+
return css(["", ":", ";"], property, theme.space.xs);
|
|
17
|
+
}
|
|
18
|
+
const StyledGrip = styled.div.attrs({
|
|
19
|
+
'data-garden-id': COMPONENT_ID,
|
|
20
|
+
'data-garden-version': '9.0.0-next.19'
|
|
21
|
+
}).withConfig({
|
|
22
|
+
displayName: "StyledGrip",
|
|
23
|
+
componentId: "sc-13uv9iv-0"
|
|
24
|
+
})(["display:flex;transition:color 0.1s ease-in-out;box-sizing:border-box;color:", ";", " ", ";"], p => getColor({
|
|
25
|
+
variable: 'foreground.subtle',
|
|
26
|
+
theme: p.theme
|
|
27
|
+
}), sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
28
|
+
StyledGrip.defaultProps = {
|
|
29
|
+
theme: DEFAULT_THEME
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { StyledGrip };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledItem } from './StyledItem.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'draggable_list';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const {
|
|
14
|
+
isHorizontal,
|
|
15
|
+
theme: {
|
|
16
|
+
space
|
|
17
|
+
}
|
|
18
|
+
} = props;
|
|
19
|
+
let marginStart = 'margin-top';
|
|
20
|
+
let marginEnd = 'margin-bottom';
|
|
21
|
+
if (isHorizontal) {
|
|
22
|
+
marginStart = 'margin-right';
|
|
23
|
+
marginEnd = 'margin-left';
|
|
24
|
+
}
|
|
25
|
+
return css(["", ":-", ";", ":-", ";"], marginStart, space.xxs, marginEnd, space.xxs);
|
|
26
|
+
};
|
|
27
|
+
const StyledDraggableList = styled.ul.attrs({
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '9.0.0-next.19'
|
|
30
|
+
}).withConfig({
|
|
31
|
+
displayName: "StyledDraggableList",
|
|
32
|
+
componentId: "sc-17agksa-0"
|
|
33
|
+
})(["display:flex;flex-direction:", ";margin:0;padding:0;list-style:none;box-sizing:border-box;direction:", ";> ", "{flex:1;}", ";", ";"], p => p.isHorizontal ? 'row' : 'column', props => props.theme.rtl && 'rtl', StyledItem, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
34
|
+
StyledDraggableList.defaultProps = {
|
|
35
|
+
theme: DEFAULT_THEME
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StyledDraggableList };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'draggable_list.drop_indicator';
|
|
11
|
+
const colorStyles = props => {
|
|
12
|
+
const {
|
|
13
|
+
theme
|
|
14
|
+
} = props;
|
|
15
|
+
const color = getColor({
|
|
16
|
+
variable: 'border.primaryEmphasis',
|
|
17
|
+
theme
|
|
18
|
+
});
|
|
19
|
+
return css(["box-shadow:", ";&::before,&::after{background-color:", ";}&:focus{outline:none;}"], theme.shadows.xs(color), color);
|
|
20
|
+
};
|
|
21
|
+
const sizeStyles = props => {
|
|
22
|
+
const {
|
|
23
|
+
isHorizontal,
|
|
24
|
+
theme
|
|
25
|
+
} = props;
|
|
26
|
+
const pseudoSize = theme.space.xs;
|
|
27
|
+
const translateX = isHorizontal ? theme.space.xxs : theme.space.xs;
|
|
28
|
+
const translateY = isHorizontal ? theme.space.xs : theme.space.xxs;
|
|
29
|
+
return css(["&::before,&::after{border-radius:50%;width:", ";height:", ";}&::before{top:0;left:0;transform:translate(-", ",-", ");}&::after{right:0;bottom:0;transform:translate(", ",", ");}"], pseudoSize, pseudoSize, translateX, translateY, translateX, translateY);
|
|
30
|
+
};
|
|
31
|
+
const StyledDropIndicator = styled.li.attrs({
|
|
32
|
+
'data-garden-id': COMPONENT_ID,
|
|
33
|
+
'data-garden-version': '9.0.0-next.19'
|
|
34
|
+
}).withConfig({
|
|
35
|
+
displayName: "StyledDropIndicator",
|
|
36
|
+
componentId: "sc-1f1u2lh-0"
|
|
37
|
+
})(["position:relative;", " ", " &::before,&::after{position:absolute;content:'';}", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
38
|
+
StyledDropIndicator.defaultProps = {
|
|
39
|
+
theme: DEFAULT_THEME
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { StyledDropIndicator };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'draggable_list.item';
|
|
11
|
+
const sizeStyles = props => {
|
|
12
|
+
const {
|
|
13
|
+
isHorizontal,
|
|
14
|
+
theme: {
|
|
15
|
+
space
|
|
16
|
+
}
|
|
17
|
+
} = props;
|
|
18
|
+
return css(["padding:", ";"], isHorizontal ? `0 ${space.xxs}` : `${space.xxs} 0`);
|
|
19
|
+
};
|
|
20
|
+
const StyledItem = styled.li.attrs({
|
|
21
|
+
'data-garden-id': COMPONENT_ID,
|
|
22
|
+
'data-garden-version': '9.0.0-next.19'
|
|
23
|
+
}).withConfig({
|
|
24
|
+
displayName: "StyledItem",
|
|
25
|
+
componentId: "sc-1nps3s3-0"
|
|
26
|
+
})(["display:flex;", " ", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
27
|
+
StyledItem.defaultProps = {
|
|
28
|
+
theme: DEFAULT_THEME
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { StyledItem };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropzone';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const {
|
|
14
|
+
isDanger,
|
|
15
|
+
isDisabled,
|
|
16
|
+
isActive,
|
|
17
|
+
isHighlighted,
|
|
18
|
+
theme
|
|
19
|
+
} = props;
|
|
20
|
+
const fgVariable = isDanger ? 'foreground.danger' : 'foreground.primary';
|
|
21
|
+
const fgActive = getColor({
|
|
22
|
+
variable: fgVariable,
|
|
23
|
+
theme
|
|
24
|
+
});
|
|
25
|
+
const borderActive = getColor({
|
|
26
|
+
variable: isDanger ? `border.dangerEmphasis` : 'border.primaryEmphasis',
|
|
27
|
+
theme
|
|
28
|
+
});
|
|
29
|
+
let backgroundColor = 'transparent';
|
|
30
|
+
let borderColor = getColor({
|
|
31
|
+
variable: `border.emphasis`,
|
|
32
|
+
theme
|
|
33
|
+
});
|
|
34
|
+
let color = getColor({
|
|
35
|
+
variable: `foreground.subtle`,
|
|
36
|
+
theme
|
|
37
|
+
});
|
|
38
|
+
if (isDisabled) {
|
|
39
|
+
backgroundColor = getColor({
|
|
40
|
+
variable: 'background.disabled',
|
|
41
|
+
theme
|
|
42
|
+
});
|
|
43
|
+
borderColor = getColor({
|
|
44
|
+
variable: `border.disabled`,
|
|
45
|
+
theme
|
|
46
|
+
});
|
|
47
|
+
color = getColor({
|
|
48
|
+
variable: 'foreground.disabled',
|
|
49
|
+
theme
|
|
50
|
+
});
|
|
51
|
+
} else if (isActive || isHighlighted) {
|
|
52
|
+
color = isHighlighted ? getColor({
|
|
53
|
+
variable: fgVariable,
|
|
54
|
+
light: {
|
|
55
|
+
offset: 200
|
|
56
|
+
},
|
|
57
|
+
dark: {
|
|
58
|
+
offset: -200
|
|
59
|
+
},
|
|
60
|
+
theme
|
|
61
|
+
}) : fgActive;
|
|
62
|
+
backgroundColor = getColor({
|
|
63
|
+
variable: isDanger ? 'background.dangerEmphasis' : 'background.primaryEmphasis',
|
|
64
|
+
transparency: theme.opacity[100],
|
|
65
|
+
dark: {
|
|
66
|
+
offset: -100
|
|
67
|
+
},
|
|
68
|
+
theme
|
|
69
|
+
});
|
|
70
|
+
borderColor = borderActive;
|
|
71
|
+
} else if (isDanger) {
|
|
72
|
+
borderColor = borderActive;
|
|
73
|
+
color = fgActive;
|
|
74
|
+
}
|
|
75
|
+
return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, color);
|
|
76
|
+
};
|
|
77
|
+
const sizeStyles = props => {
|
|
78
|
+
const {
|
|
79
|
+
theme,
|
|
80
|
+
isHighlighted
|
|
81
|
+
} = props;
|
|
82
|
+
const borderWidth = isHighlighted ? math(`${theme.borderWidths.sm} * 2`) : theme.borderWidths.sm;
|
|
83
|
+
return css(["border-width:", ";border-style:", ";border-radius:", ";padding:", "px;width:100%;font-family:", ";font-size:", ";"], borderWidth, isHighlighted ? theme.borderStyles.solid : 'dashed', theme.borderRadii.md, isHighlighted ? theme.space.base * 4 - 1 : theme.space.base * 4, theme.fonts.system, theme.fontSizes.md);
|
|
84
|
+
};
|
|
85
|
+
const StyledDropzone = styled.div.attrs({
|
|
86
|
+
'data-garden-id': COMPONENT_ID,
|
|
87
|
+
'data-garden-version': '9.0.0-next.19'
|
|
88
|
+
}).withConfig({
|
|
89
|
+
displayName: "StyledDropzone",
|
|
90
|
+
componentId: "sc-1b7zuip-0"
|
|
91
|
+
})(["display:", ";flex-direction:", ";align-items:", ";justify-content:", ";transition:border-color 0.25s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,z-index 0.25s ease-in-out;margin:0;text-align:", ";direction:", ";box-sizing:border-box;", " ", " ", ";"], p => (p.hasMessage || p.hasIcon) && 'flex', p => p.hasMessage && p.isVertical && 'column', p => (p.hasMessage || p.hasIcon) && 'center', p => (p.hasMessage || p.hasIcon) && 'center', p => p.hasMessage && 'center', props => props.theme.rtl && 'rtl', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
92
|
+
StyledDropzone.defaultProps = {
|
|
93
|
+
theme: DEFAULT_THEME
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { StyledDropzone };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'dropzone.icon';
|
|
11
|
+
function sizeStyles(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
theme,
|
|
14
|
+
isVertical
|
|
15
|
+
} = _ref;
|
|
16
|
+
let property;
|
|
17
|
+
let value;
|
|
18
|
+
if (isVertical) {
|
|
19
|
+
property = 'margin-bottom';
|
|
20
|
+
value = theme.space.xs;
|
|
21
|
+
} else {
|
|
22
|
+
property = theme.rtl ? 'margin-left' : 'margin-right';
|
|
23
|
+
value = theme.space.xs;
|
|
24
|
+
}
|
|
25
|
+
return css(["", ":", ";"], property, value);
|
|
26
|
+
}
|
|
27
|
+
const StyledIcon = styled.div.attrs({
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '9.0.0-next.19'
|
|
30
|
+
}).withConfig({
|
|
31
|
+
displayName: "StyledIcon",
|
|
32
|
+
componentId: "sc-1o12gen-0"
|
|
33
|
+
})(["display:flex;width:", ";height:", ";", " ", ";"], props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, p => p.hasMessage && sizeStyles(p), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
34
|
+
StyledIcon.defaultProps = {
|
|
35
|
+
theme: DEFAULT_THEME
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StyledIcon };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { getLineHeight, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'dropzone.message';
|
|
11
|
+
const StyledMessage = styled.p.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledMessage",
|
|
16
|
+
componentId: "sc-5kb2l2-0"
|
|
17
|
+
})(["margin:0;line-height:", ";color:inherit;font-size:", ";font-weight:", ";", ";"], p => getLineHeight(p.theme.space.base * 5, p.theme.fontSizes.md), p => p.theme.fontSizes.md, p => p.theme.fontWeights.regular, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledMessage.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledMessage };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
const DraggableListContext = createContext(undefined);
|
|
10
|
+
const useDraggableListContext = () => {
|
|
11
|
+
const context = useContext(DraggableListContext);
|
|
12
|
+
if (context === undefined) {
|
|
13
|
+
throw new Error('This component must be rendered within a DraggableList component');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { DraggableListContext, useDraggableListContext };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
const DropzoneContext = createContext(undefined);
|
|
10
|
+
const useDropzoneContext = () => {
|
|
11
|
+
const context = useContext(DropzoneContext);
|
|
12
|
+
if (context === undefined) {
|
|
13
|
+
throw new Error('This component must be rendered within a Dropzone component');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { DropzoneContext, useDropzoneContext };
|