@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.
Files changed (50) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +41 -0
  3. package/dist/esm/elements/draggable/Draggable.js +39 -0
  4. package/dist/esm/elements/draggable/components/Content.js +23 -0
  5. package/dist/esm/elements/draggable/components/Grip.js +24 -0
  6. package/dist/esm/elements/draggable-list/DraggableList.js +36 -0
  7. package/dist/esm/elements/draggable-list/components/DropIndicator.js +33 -0
  8. package/dist/esm/elements/draggable-list/components/Item.js +30 -0
  9. package/dist/esm/elements/dropzone/Dropzone.js +63 -0
  10. package/dist/esm/elements/dropzone/components/Icon.js +46 -0
  11. package/dist/esm/elements/dropzone/components/Message.js +40 -0
  12. package/dist/esm/index.js +9 -0
  13. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/grip.svg.js +66 -0
  14. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +27 -0
  15. package/dist/esm/styled/draggable/StyledContent.js +22 -0
  16. package/dist/esm/styled/draggable/StyledDraggable.js +115 -0
  17. package/dist/esm/styled/draggable/StyledGrip.js +32 -0
  18. package/dist/esm/styled/draggable-list/StyledDraggableList.js +38 -0
  19. package/dist/esm/styled/draggable-list/StyledDropIndicator.js +42 -0
  20. package/dist/esm/styled/draggable-list/StyledItem.js +31 -0
  21. package/dist/esm/styled/dropzone/StyledDropzone.js +96 -0
  22. package/dist/esm/styled/dropzone/StyledIcon.js +38 -0
  23. package/dist/esm/styled/dropzone/StyledMessage.js +22 -0
  24. package/dist/esm/utils/useDraggableListContext.js +18 -0
  25. package/dist/esm/utils/useDropzoneContext.js +18 -0
  26. package/dist/index.cjs.js +632 -0
  27. package/dist/typings/elements/draggable/Draggable.d.ts +17 -0
  28. package/dist/typings/elements/draggable/components/Content.d.ts +11 -0
  29. package/dist/typings/elements/draggable/components/Grip.d.ts +11 -0
  30. package/dist/typings/elements/draggable-list/DraggableList.d.ts +17 -0
  31. package/dist/typings/elements/draggable-list/components/DropIndicator.d.ts +11 -0
  32. package/dist/typings/elements/draggable-list/components/Item.d.ts +11 -0
  33. package/dist/typings/elements/dropzone/Dropzone.d.ts +17 -0
  34. package/dist/typings/elements/dropzone/components/Icon.d.ts +11 -0
  35. package/dist/typings/elements/dropzone/components/Message.d.ts +11 -0
  36. package/dist/typings/index.d.ts +10 -0
  37. package/dist/typings/styled/draggable/StyledContent.d.ts +10 -0
  38. package/dist/typings/styled/draggable/StyledDraggable.d.ts +21 -0
  39. package/dist/typings/styled/draggable/StyledGrip.d.ts +11 -0
  40. package/dist/typings/styled/draggable-list/StyledDraggableList.d.ts +17 -0
  41. package/dist/typings/styled/draggable-list/StyledDropIndicator.d.ts +14 -0
  42. package/dist/typings/styled/draggable-list/StyledItem.d.ts +14 -0
  43. package/dist/typings/styled/dropzone/StyledDropzone.d.ts +23 -0
  44. package/dist/typings/styled/dropzone/StyledIcon.d.ts +19 -0
  45. package/dist/typings/styled/dropzone/StyledMessage.d.ts +10 -0
  46. package/dist/typings/styled/index.d.ts +15 -0
  47. package/dist/typings/types/index.d.ts +41 -0
  48. package/dist/typings/utils/useDraggableListContext.d.ts +12 -0
  49. package/dist/typings/utils/useDropzoneContext.d.ts +17 -0
  50. package/package.json +56 -0
@@ -0,0 +1,632 @@
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
+ 'use strict';
8
+
9
+ var React = require('react');
10
+ var styled = require('styled-components');
11
+ var reactTheming = require('@zendeskgarden/react-theming');
12
+ var polished = require('polished');
13
+
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ function _interopNamespace(e) {
17
+ if (e && e.__esModule) return e;
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
35
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
36
+
37
+ const COMPONENT_ID$8 = 'draggable.grip';
38
+ function sizeStyles$6(_ref) {
39
+ let {
40
+ theme
41
+ } = _ref;
42
+ const property = theme.rtl ? 'margin-left' : 'margin-right';
43
+ return styled.css(["", ":", ";"], property, theme.space.xs);
44
+ }
45
+ const StyledGrip = styled__default.default.div.attrs({
46
+ 'data-garden-id': COMPONENT_ID$8,
47
+ 'data-garden-version': '9.0.0-next.19'
48
+ }).withConfig({
49
+ displayName: "StyledGrip",
50
+ componentId: "sc-13uv9iv-0"
51
+ })(["display:flex;transition:color 0.1s ease-in-out;box-sizing:border-box;color:", ";", " ", ";"], p => reactTheming.getColor({
52
+ variable: 'foreground.subtle',
53
+ theme: p.theme
54
+ }), sizeStyles$6, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
55
+ StyledGrip.defaultProps = {
56
+ theme: reactTheming.DEFAULT_THEME
57
+ };
58
+
59
+ const COMPONENT_ID$7 = 'draggable';
60
+ function getDragShadow(theme) {
61
+ const {
62
+ space,
63
+ shadows
64
+ } = theme;
65
+ const offsetY = `${space.base * 5}px`;
66
+ const blurRadius = `${space.base * 7}px`;
67
+ const color = reactTheming.getColor({
68
+ variable: 'shadow.large',
69
+ theme
70
+ });
71
+ return shadows.lg(offsetY, blurRadius, color);
72
+ }
73
+ const colorStyles$2 = props => {
74
+ const {
75
+ isBare,
76
+ isGrabbed,
77
+ isDisabled,
78
+ isPlaceholder,
79
+ focusInset,
80
+ theme
81
+ } = props;
82
+ const dragShadow = getDragShadow(theme);
83
+ const baseBgColor = reactTheming.getColor({
84
+ variable: 'background.default',
85
+ theme
86
+ });
87
+ const placeholderBgColor = reactTheming.getColor({
88
+ variable: 'background.disabled',
89
+ theme
90
+ });
91
+ const disabledBgColor = reactTheming.getColor({
92
+ variable: 'background.disabled',
93
+ theme
94
+ });
95
+ const disabledColor = reactTheming.getColor({
96
+ variable: 'foreground.disabled',
97
+ theme
98
+ });
99
+ let color;
100
+ let hoverBackgroundColor;
101
+ let boxShadow;
102
+ let borderColor = 'transparent';
103
+ let backgroundColor = baseBgColor;
104
+ if (isDisabled) {
105
+ backgroundColor = disabledBgColor;
106
+ color = disabledColor;
107
+ } else if (isPlaceholder) {
108
+ backgroundColor = placeholderBgColor;
109
+ } else {
110
+ color = reactTheming.getColor({
111
+ variable: 'foreground.default',
112
+ theme
113
+ });
114
+ borderColor = isBare ? 'transparent' : reactTheming.getColor({
115
+ variable: 'border.default',
116
+ theme
117
+ });
118
+ hoverBackgroundColor = reactTheming.getColor({
119
+ variable: isGrabbed ? 'background.raised' : 'background.primaryEmphasis',
120
+ ...(!isGrabbed && {
121
+ transparency: theme.opacity[100],
122
+ dark: {
123
+ offset: -100
124
+ }
125
+ }),
126
+ theme
127
+ });
128
+ boxShadow = dragShadow;
129
+ }
130
+ return styled.css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";&:hover{background-color:", ";}", " > ", "{color:", ";}"], borderColor, isGrabbed && boxShadow, backgroundColor, color, hoverBackgroundColor, reactTheming.focusStyles({
131
+ theme,
132
+ inset: focusInset,
133
+ boxShadow: isGrabbed ? dragShadow : undefined
134
+ }), StyledGrip, isDisabled && disabledColor);
135
+ };
136
+ const sizeStyles$5 = props => {
137
+ const {
138
+ isCompact,
139
+ theme
140
+ } = props;
141
+ const paddingDefault = theme.space.base * 2.25;
142
+ const paddingCompact = theme.space.base * 1.25;
143
+ return styled.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`, reactTheming.getLineHeight(theme.space.base * 5, theme.fontSizes.md), theme.fontSizes.md, theme.fontWeights.regular);
144
+ };
145
+ const getCursor = props => {
146
+ let cursor = props.isGrabbed ? 'grabbing' : 'grab';
147
+ if (props.isDisabled || props.isPlaceholder) {
148
+ cursor = 'default';
149
+ }
150
+ return cursor;
151
+ };
152
+ const StyledDraggable = styled__default.default.div.attrs({
153
+ 'data-garden-id': COMPONENT_ID$7,
154
+ 'data-garden-version': '9.0.0-next.19'
155
+ }).withConfig({
156
+ displayName: "StyledDraggable",
157
+ componentId: "sc-3lxpf1-0"
158
+ })(["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$5, colorStyles$2, p => p.isPlaceholder && !p.isDisabled && 'hidden', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
159
+ StyledDraggable.defaultProps = {
160
+ theme: reactTheming.DEFAULT_THEME
161
+ };
162
+
163
+ const COMPONENT_ID$6 = 'draggable.content';
164
+ const StyledContent = styled__default.default.div.attrs({
165
+ 'data-garden-id': COMPONENT_ID$6,
166
+ 'data-garden-version': '9.0.0-next.19'
167
+ }).withConfig({
168
+ displayName: "StyledContent",
169
+ componentId: "sc-15arore-0"
170
+ })(["flex:1;word-wrap:break-word;overflow-wrap:anywhere;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
171
+ StyledContent.defaultProps = {
172
+ theme: reactTheming.DEFAULT_THEME
173
+ };
174
+
175
+ const COMPONENT_ID$5 = 'draggable_list.item';
176
+ const sizeStyles$4 = props => {
177
+ const {
178
+ isHorizontal,
179
+ theme: {
180
+ space
181
+ }
182
+ } = props;
183
+ return styled.css(["padding:", ";"], isHorizontal ? `0 ${space.xxs}` : `${space.xxs} 0`);
184
+ };
185
+ const StyledItem = styled__default.default.li.attrs({
186
+ 'data-garden-id': COMPONENT_ID$5,
187
+ 'data-garden-version': '9.0.0-next.19'
188
+ }).withConfig({
189
+ displayName: "StyledItem",
190
+ componentId: "sc-1nps3s3-0"
191
+ })(["display:flex;", " ", ";"], sizeStyles$4, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
192
+ StyledItem.defaultProps = {
193
+ theme: reactTheming.DEFAULT_THEME
194
+ };
195
+
196
+ const COMPONENT_ID$4 = 'draggable_list';
197
+ const sizeStyles$3 = props => {
198
+ const {
199
+ isHorizontal,
200
+ theme: {
201
+ space
202
+ }
203
+ } = props;
204
+ let marginStart = 'margin-top';
205
+ let marginEnd = 'margin-bottom';
206
+ if (isHorizontal) {
207
+ marginStart = 'margin-right';
208
+ marginEnd = 'margin-left';
209
+ }
210
+ return styled.css(["", ":-", ";", ":-", ";"], marginStart, space.xxs, marginEnd, space.xxs);
211
+ };
212
+ const StyledDraggableList = styled__default.default.ul.attrs({
213
+ 'data-garden-id': COMPONENT_ID$4,
214
+ 'data-garden-version': '9.0.0-next.19'
215
+ }).withConfig({
216
+ displayName: "StyledDraggableList",
217
+ componentId: "sc-17agksa-0"
218
+ })(["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$3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
219
+ StyledDraggableList.defaultProps = {
220
+ theme: reactTheming.DEFAULT_THEME
221
+ };
222
+
223
+ const COMPONENT_ID$3 = 'draggable_list.drop_indicator';
224
+ const colorStyles$1 = props => {
225
+ const {
226
+ theme
227
+ } = props;
228
+ const color = reactTheming.getColor({
229
+ variable: 'border.primaryEmphasis',
230
+ theme
231
+ });
232
+ return styled.css(["box-shadow:", ";&::before,&::after{background-color:", ";}&:focus{outline:none;}"], theme.shadows.xs(color), color);
233
+ };
234
+ const sizeStyles$2 = props => {
235
+ const {
236
+ isHorizontal,
237
+ theme
238
+ } = props;
239
+ const pseudoSize = theme.space.xs;
240
+ const translateX = isHorizontal ? theme.space.xxs : theme.space.xs;
241
+ const translateY = isHorizontal ? theme.space.xs : theme.space.xxs;
242
+ return styled.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);
243
+ };
244
+ const StyledDropIndicator = styled__default.default.li.attrs({
245
+ 'data-garden-id': COMPONENT_ID$3,
246
+ 'data-garden-version': '9.0.0-next.19'
247
+ }).withConfig({
248
+ displayName: "StyledDropIndicator",
249
+ componentId: "sc-1f1u2lh-0"
250
+ })(["position:relative;", " ", " &::before,&::after{position:absolute;content:'';}", ";"], sizeStyles$2, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
251
+ StyledDropIndicator.defaultProps = {
252
+ theme: reactTheming.DEFAULT_THEME
253
+ };
254
+
255
+ const COMPONENT_ID$2 = 'dropzone';
256
+ const colorStyles = props => {
257
+ const {
258
+ isDanger,
259
+ isDisabled,
260
+ isActive,
261
+ isHighlighted,
262
+ theme
263
+ } = props;
264
+ const fgVariable = isDanger ? 'foreground.danger' : 'foreground.primary';
265
+ const fgActive = reactTheming.getColor({
266
+ variable: fgVariable,
267
+ theme
268
+ });
269
+ const borderActive = reactTheming.getColor({
270
+ variable: isDanger ? `border.dangerEmphasis` : 'border.primaryEmphasis',
271
+ theme
272
+ });
273
+ let backgroundColor = 'transparent';
274
+ let borderColor = reactTheming.getColor({
275
+ variable: `border.emphasis`,
276
+ theme
277
+ });
278
+ let color = reactTheming.getColor({
279
+ variable: `foreground.subtle`,
280
+ theme
281
+ });
282
+ if (isDisabled) {
283
+ backgroundColor = reactTheming.getColor({
284
+ variable: 'background.disabled',
285
+ theme
286
+ });
287
+ borderColor = reactTheming.getColor({
288
+ variable: `border.disabled`,
289
+ theme
290
+ });
291
+ color = reactTheming.getColor({
292
+ variable: 'foreground.disabled',
293
+ theme
294
+ });
295
+ } else if (isActive || isHighlighted) {
296
+ color = isHighlighted ? reactTheming.getColor({
297
+ variable: fgVariable,
298
+ light: {
299
+ offset: 200
300
+ },
301
+ dark: {
302
+ offset: -200
303
+ },
304
+ theme
305
+ }) : fgActive;
306
+ backgroundColor = reactTheming.getColor({
307
+ variable: isDanger ? 'background.dangerEmphasis' : 'background.primaryEmphasis',
308
+ transparency: theme.opacity[100],
309
+ dark: {
310
+ offset: -100
311
+ },
312
+ theme
313
+ });
314
+ borderColor = borderActive;
315
+ } else if (isDanger) {
316
+ borderColor = borderActive;
317
+ color = fgActive;
318
+ }
319
+ return styled.css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, color);
320
+ };
321
+ const sizeStyles$1 = props => {
322
+ const {
323
+ theme,
324
+ isHighlighted
325
+ } = props;
326
+ const borderWidth = isHighlighted ? polished.math(`${theme.borderWidths.sm} * 2`) : theme.borderWidths.sm;
327
+ return styled.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);
328
+ };
329
+ const StyledDropzone = styled__default.default.div.attrs({
330
+ 'data-garden-id': COMPONENT_ID$2,
331
+ 'data-garden-version': '9.0.0-next.19'
332
+ }).withConfig({
333
+ displayName: "StyledDropzone",
334
+ componentId: "sc-1b7zuip-0"
335
+ })(["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$1, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
336
+ StyledDropzone.defaultProps = {
337
+ theme: reactTheming.DEFAULT_THEME
338
+ };
339
+
340
+ const COMPONENT_ID$1 = 'dropzone.message';
341
+ const StyledMessage = styled__default.default.p.attrs({
342
+ 'data-garden-id': COMPONENT_ID$1,
343
+ 'data-garden-version': '9.0.0-next.19'
344
+ }).withConfig({
345
+ displayName: "StyledMessage",
346
+ componentId: "sc-5kb2l2-0"
347
+ })(["margin:0;line-height:", ";color:inherit;font-size:", ";font-weight:", ";", ";"], p => reactTheming.getLineHeight(p.theme.space.base * 5, p.theme.fontSizes.md), p => p.theme.fontSizes.md, p => p.theme.fontWeights.regular, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
348
+ StyledMessage.defaultProps = {
349
+ theme: reactTheming.DEFAULT_THEME
350
+ };
351
+
352
+ const COMPONENT_ID = 'dropzone.icon';
353
+ function sizeStyles(_ref) {
354
+ let {
355
+ theme,
356
+ isVertical
357
+ } = _ref;
358
+ let property;
359
+ let value;
360
+ if (isVertical) {
361
+ property = 'margin-bottom';
362
+ value = theme.space.xs;
363
+ } else {
364
+ property = theme.rtl ? 'margin-left' : 'margin-right';
365
+ value = theme.space.xs;
366
+ }
367
+ return styled.css(["", ":", ";"], property, value);
368
+ }
369
+ const StyledIcon = styled__default.default.div.attrs({
370
+ 'data-garden-id': COMPONENT_ID,
371
+ 'data-garden-version': '9.0.0-next.19'
372
+ }).withConfig({
373
+ displayName: "StyledIcon",
374
+ componentId: "sc-1o12gen-0"
375
+ })(["display:flex;width:", ";height:", ";", " ", ";"], props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, p => p.hasMessage && sizeStyles(p), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
376
+ StyledIcon.defaultProps = {
377
+ theme: reactTheming.DEFAULT_THEME
378
+ };
379
+
380
+ const Content = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledContent, Object.assign({}, props, {
381
+ ref: ref
382
+ })));
383
+ Content.displayName = 'Draggable.Content';
384
+
385
+ var _g;
386
+ function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
387
+ var SvgGrip = function SvgGrip(props) {
388
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
389
+ xmlns: "http://www.w3.org/2000/svg",
390
+ width: 12,
391
+ height: 12,
392
+ focusable: "false",
393
+ viewBox: "0 0 12 12",
394
+ "aria-hidden": "true"
395
+ }, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
396
+ fill: "currentColor"
397
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
398
+ width: 2,
399
+ height: 2,
400
+ x: 3,
401
+ y: 1,
402
+ rx: 0.5,
403
+ ry: 0.5
404
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
405
+ width: 2,
406
+ height: 2,
407
+ x: 7,
408
+ y: 1,
409
+ rx: 0.5,
410
+ ry: 0.5
411
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
412
+ width: 2,
413
+ height: 2,
414
+ x: 3,
415
+ y: 5,
416
+ rx: 0.5,
417
+ ry: 0.5
418
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
419
+ width: 2,
420
+ height: 2,
421
+ x: 7,
422
+ y: 5,
423
+ rx: 0.5,
424
+ ry: 0.5
425
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
426
+ width: 2,
427
+ height: 2,
428
+ x: 3,
429
+ y: 9,
430
+ rx: 0.5,
431
+ ry: 0.5
432
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
433
+ width: 2,
434
+ height: 2,
435
+ x: 7,
436
+ y: 9,
437
+ rx: 0.5,
438
+ ry: 0.5
439
+ }))));
440
+ };
441
+
442
+ const Grip = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledGrip, Object.assign({}, props, {
443
+ ref: ref
444
+ }), React__namespace.default.createElement(SvgGrip, null)));
445
+ Grip.displayName = 'Draggable.Grip';
446
+
447
+ const DraggableComponent = React.forwardRef((_ref, ref) => {
448
+ let {
449
+ tag,
450
+ ...props
451
+ } = _ref;
452
+ const isDisabled = props.isDisabled;
453
+ return React__namespace.default.createElement(StyledDraggable, Object.assign({
454
+ as: tag,
455
+ "aria-disabled": isDisabled,
456
+ tabIndex: isDisabled ? undefined : 0
457
+ }, props, {
458
+ ref: ref
459
+ }));
460
+ });
461
+ DraggableComponent.displayName = 'Draggable';
462
+ const Draggable = DraggableComponent;
463
+ Draggable.Grip = Grip;
464
+ Draggable.Content = Content;
465
+
466
+ const DraggableListContext = React.createContext(undefined);
467
+ const useDraggableListContext = () => {
468
+ const context = React.useContext(DraggableListContext);
469
+ if (context === undefined) {
470
+ throw new Error('This component must be rendered within a DraggableList component');
471
+ }
472
+ return context;
473
+ };
474
+
475
+ const DropIndicator = React.forwardRef((props, ref) => {
476
+ const {
477
+ isHorizontal
478
+ } = useDraggableListContext();
479
+ const ariaLabel = reactTheming.useText(DropIndicator, props, 'aria-label', 'Drop indicator');
480
+ return React__namespace.default.createElement(StyledDropIndicator, Object.assign({}, props, {
481
+ "aria-label": ariaLabel,
482
+ isHorizontal: isHorizontal,
483
+ ref: ref
484
+ }));
485
+ });
486
+ DropIndicator.displayName = 'DraggableList.DropIndicator';
487
+
488
+ const Item = React.forwardRef((props, ref) => {
489
+ const {
490
+ isHorizontal
491
+ } = useDraggableListContext();
492
+ return React__namespace.default.createElement(StyledItem, Object.assign({}, props, {
493
+ isHorizontal: isHorizontal,
494
+ ref: ref
495
+ }));
496
+ });
497
+ Item.displayName = 'DraggableList.Item';
498
+
499
+ const DraggableListComponent = React.forwardRef((props, ref) => {
500
+ const value = React.useMemo(() => ({
501
+ isHorizontal: props.isHorizontal
502
+ }), [props.isHorizontal]);
503
+ return React__namespace.default.createElement(DraggableListContext.Provider, {
504
+ value: value
505
+ }, React__namespace.default.createElement(StyledDraggableList, Object.assign({}, props, {
506
+ ref: ref
507
+ })));
508
+ });
509
+ DraggableListComponent.displayName = 'DraggableList';
510
+ const DraggableList = DraggableListComponent;
511
+ DraggableList.Item = Item;
512
+ DraggableList.DropIndicator = DropIndicator;
513
+
514
+ var _path;
515
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
516
+ var SvgTrashStroke = function SvgTrashStroke(props) {
517
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
518
+ xmlns: "http://www.w3.org/2000/svg",
519
+ width: 16,
520
+ height: 16,
521
+ focusable: "false",
522
+ viewBox: "0 0 16 16",
523
+ "aria-hidden": "true"
524
+ }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
525
+ fill: "none",
526
+ stroke: "currentColor",
527
+ strokeLinecap: "round",
528
+ d: "M6.5 2.5V1c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v1.5M3 2.5h10m-6.5 11v-8m3 8v-8m-6-1V15c0 .3.2.5.5.5h8c.3 0 .5-.2.5-.5V4.5"
529
+ })));
530
+ };
531
+
532
+ const DropzoneContext = React.createContext(undefined);
533
+ const useDropzoneContext = () => {
534
+ const context = React.useContext(DropzoneContext);
535
+ if (context === undefined) {
536
+ throw new Error('This component must be rendered within a Dropzone component');
537
+ }
538
+ return context;
539
+ };
540
+
541
+ const Message = React.forwardRef((props, ref) => {
542
+ const {
543
+ setHasMessage,
544
+ hasMessage
545
+ } = useDropzoneContext();
546
+ React.useEffect(() => {
547
+ if (setHasMessage && !hasMessage) {
548
+ setHasMessage(true);
549
+ }
550
+ return () => {
551
+ if (setHasMessage && hasMessage) {
552
+ setHasMessage(false);
553
+ }
554
+ };
555
+ }, [setHasMessage, hasMessage]);
556
+ return React__namespace.default.createElement(StyledMessage, Object.assign({}, props, {
557
+ ref: ref
558
+ }));
559
+ });
560
+ Message.displayName = 'Dropzone.Message';
561
+
562
+ const Icon = React.forwardRef((props, ref) => {
563
+ const {
564
+ hasIcon,
565
+ setHasIcon,
566
+ hasMessage,
567
+ isVertical
568
+ } = useDropzoneContext();
569
+ React.useEffect(() => {
570
+ if (setHasIcon && !hasIcon) {
571
+ setHasIcon(true);
572
+ }
573
+ return () => {
574
+ if (setHasIcon && hasIcon) {
575
+ setHasIcon(false);
576
+ }
577
+ };
578
+ }, [setHasIcon, hasIcon]);
579
+ return React__namespace.default.createElement(StyledIcon, Object.assign({
580
+ "aria-hidden": "true"
581
+ }, props, {
582
+ hasMessage: hasMessage,
583
+ isVertical: isVertical,
584
+ ref: ref
585
+ }));
586
+ });
587
+ Icon.displayName = 'Dropzone.Icon';
588
+
589
+ const DropzoneComponent = React.forwardRef((_ref, ref) => {
590
+ let {
591
+ tag,
592
+ isVertical,
593
+ children,
594
+ ...props
595
+ } = _ref;
596
+ const {
597
+ isDanger
598
+ } = props;
599
+ const [hasMessage, setHasMessage] = React.useState(false);
600
+ const [hasIcon, setHasIcon] = React.useState(false);
601
+ const value = React.useMemo(() => ({
602
+ isVertical,
603
+ hasMessage,
604
+ setHasMessage,
605
+ hasIcon,
606
+ setHasIcon,
607
+ isDanger
608
+ }), [hasMessage, hasIcon, isDanger, isVertical]);
609
+ return React__namespace.default.createElement(DropzoneContext.Provider, {
610
+ value: value
611
+ }, React__namespace.default.createElement(StyledDropzone, Object.assign({
612
+ as: tag,
613
+ "aria-disabled": props.isDisabled
614
+ }, props, {
615
+ hasIcon: hasIcon,
616
+ hasMessage: hasMessage,
617
+ isVertical: isVertical,
618
+ ref: ref
619
+ }), hasMessage && isDanger && !hasIcon && React__namespace.default.createElement(StyledIcon, {
620
+ "aria-hidden": "true",
621
+ hasMessage: hasMessage,
622
+ isVertical: isVertical
623
+ }, React__namespace.default.createElement(SvgTrashStroke, null)), children));
624
+ });
625
+ DropzoneComponent.displayName = 'Dropzone';
626
+ const Dropzone = DropzoneComponent;
627
+ Dropzone.Message = Message;
628
+ Dropzone.Icon = Icon;
629
+
630
+ exports.Draggable = Draggable;
631
+ exports.DraggableList = DraggableList;
632
+ exports.Dropzone = Dropzone;
@@ -0,0 +1,17 @@
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 React from 'react';
8
+ import { Content } from './components/Content';
9
+ import { Grip } from './components/Grip';
10
+ import { IDraggableProps } from '../../types';
11
+ /**
12
+ * @extends HTMLAttributes<HTMLDivElement>
13
+ */
14
+ export declare const Draggable: React.ForwardRefExoticComponent<IDraggableProps & React.RefAttributes<HTMLDivElement>> & {
15
+ Grip: typeof Grip;
16
+ Content: typeof Content;
17
+ };
@@ -0,0 +1,11 @@
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 React from 'react';
8
+ /**
9
+ * @extends HTMLAttributes<HTMLDivElement>
10
+ */
11
+ export declare const Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
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 React from 'react';
8
+ /**
9
+ * @extends HTMLAttributes<HTMLDivElement>
10
+ */
11
+ export declare const Grip: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
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 React from 'react';
8
+ import { DropIndicator } from './components/DropIndicator';
9
+ import { Item } from './components/Item';
10
+ import { IDraggableListProps } from '../../types';
11
+ /**
12
+ * @extends HTMLAttributes<HTMLUListElement>
13
+ */
14
+ export declare const DraggableList: React.ForwardRefExoticComponent<IDraggableListProps & React.RefAttributes<HTMLUListElement>> & {
15
+ Item: typeof Item;
16
+ DropIndicator: typeof DropIndicator;
17
+ };