@contentful/f36-drag-handle 4.0.1 → 4.1.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.1.3](https://github.com/contentful/forma-36/compare/@contentful/f36-drag-handle@4.1.2...@contentful/f36-drag-handle@4.1.3) (2022-02-07)
7
+
8
+ **Note:** Version bump only for package @contentful/f36-drag-handle
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.1.2](https://github.com/contentful/forma-36/compare/@contentful/f36-drag-handle@4.1.1...@contentful/f36-drag-handle@4.1.2) (2022-02-04)
15
+
16
+ **Note:** Version bump only for package @contentful/f36-drag-handle
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.1.1](https://github.com/contentful/forma-36/compare/@contentful/f36-drag-handle@4.1.0...@contentful/f36-drag-handle@4.1.1) (2022-01-31)
23
+
24
+ **Note:** Version bump only for package @contentful/f36-drag-handle
25
+
26
+
27
+
28
+
29
+
30
+ # [4.1.0](https://github.com/contentful/forma-36/compare/@contentful/f36-drag-handle@4.0.1...@contentful/f36-drag-handle@4.1.0) (2022-01-31)
31
+
32
+
33
+ ### Features
34
+
35
+ * implement props list redesign [BAU-535] ([#1756](https://github.com/contentful/forma-36/issues/1756)) ([21c57e7](https://github.com/contentful/forma-36/commit/21c57e72008b75990d03af4e7500edc1c7f3d26d))
36
+
37
+
38
+
39
+
40
+
6
41
  ## [4.0.1](https://github.com/contentful/forma-36/compare/@contentful/f36-drag-handle@4.0.0...@contentful/f36-drag-handle@4.0.1) (2022-01-11)
7
42
 
8
43
  **Note:** Version bump only for package @contentful/f36-drag-handle
package/README.mdx CHANGED
@@ -4,11 +4,11 @@ type: 'component'
4
4
  slug: /components/drag-handle/
5
5
  github: 'https://github.com/contentful/forma-36/tree/master/packages/components/drag-handle'
6
6
  typescript: ./src/DragHandle.tsx
7
+ storybook: 'https://v4-f36-storybook.netlify.app/?path=/story/components-draghandle--default'
7
8
  ---
8
9
 
9
10
  import { Heading, Stack, TextLink } from '@contentful/f36-components';
10
11
  import { ExternalLinkIcon } from '@contentful/f36-icons';
11
- import { Props } from '@contentful/f36-docs-utils';
12
12
 
13
13
  DragHandle is a new component to make it easier when creating draggable elements. it contains the styling for focus, hover and dragging states.
14
14
  This component only needs to be used if you're creating a custom component with drag, some of our components already have this implemented, for example [Card](/components/card).
@@ -80,7 +80,7 @@ The DragHandle can be styled based on the props you pass to it:
80
80
  </TextLink>
81
81
  </Stack>
82
82
 
83
- <Props of="DragHandle" />
83
+ <PropsTable of="DragHandle" />
84
84
 
85
85
  ## Accessibility
86
86
 
package/dist/main.js CHANGED
@@ -77,7 +77,14 @@ const $7340ff11beb99de7$export$a0c24614540b0efb = /*#__PURE__*/ $9zqHf$react.for
77
77
  }, [
78
78
  onMouseLeave
79
79
  ]);
80
- return(// https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js
80
+ return(//
81
+ // The other alternative way to fix it was to pass a custom `shouldCancelStart` callback,
82
+ // in every place where we use this component with react-sortable-hoc.
83
+ // (the custom callback with all the logic from default callback, but without button event cancelation).
84
+ // So we decided that just changing it to the div, as it was in v3, is a better fix.
85
+ //
86
+ // default shouldCancelStart callback:
87
+ // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js
81
88
  /*#__PURE__*/ ($parcel$interopDefault($9zqHf$react)).createElement("div", {
82
89
  role: "button",
83
90
  tabIndex: 0,
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AEGO,KAAA,CAAMY,yCAAS,QAAU,CAAhC;QACEK,KAAK,EAAA,EAAE,AAAF,SAAE,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QACE,IAAA,EAAK,CADP;QAEE,QAAA,EAAU,CAAD;QACT,IAAA,EAAK,CAHP;WAIMG,UAAJ;QACA,SAAA,EAAW,iBAAA,CACTE,MAAM,CAACQ,IAAP,CAAY,CANhB;sBAMkBzB,QAAF;uBAAYC,SAAZ;uBAAuBC,SAAAA;QAAvB,CAAZ,GACAI,SAFS;QAIX,MAAA,EAAQgB,UAAD;QACP,OAAA,EAASF,WAAD;QACR,YAAA,EAAcG,gBAAD;QACb,YAAA,EAAcC,gBAAD;QACb,CAAA,eAAcX,MAAD;QACb,GAAA,EAAKG,YAAD;QACJ,KAAA,EAAOF,KAAD;0EAEL,kCAAD;QAAU,OAAA,EAAQ,CAAlB;2EACC,CAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD;AAGpC,CA7FiC;AAgGpCjB,yCAAU,CAACwC,WAAX,GAAyB,CAAzB","sources":["packages/components/drag-handle/src/index.ts","packages/components/drag-handle/src/DragHandle.tsx","packages/components/drag-handle/src/DragHandle.styles.ts"],"sourcesContent":["export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n","import React, {\n forwardRef,\n useCallback,\n useState,\n FocusEventHandler,\n MouseEventHandler,\n} from 'react';\nimport { cx } from 'emotion';\nimport type { PropsWithHTMLElement } from '@contentful/f36-core';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { DragIcon } from '@contentful/f36-icons';\nimport { getStyles } from './DragHandle.styles';\n\nexport type DragHandleInternalProps = CommonProps & {\n /**\n * Applies styling for when the component is actively being dragged by\n * the user\n */\n isActive?: boolean;\n /**\n * Applies focus styling\n */\n isFocused?: boolean;\n /**\n * Applies hover styling\n */\n isHovered?: boolean;\n /**\n * Label rendered in DragHandle - not visible on screen as its purpose\n * is for screen readers only\n */\n label: string;\n /**\n * Set type button for div element\n */\n type?: string;\n};\n\nexport type DragHandleProps = PropsWithHTMLElement<\n DragHandleInternalProps,\n 'div'\n>;\n\nexport const DragHandle = forwardRef<\n HTMLDivElement,\n ExpandProps<DragHandleProps>\n>(\n (\n {\n className,\n isActive,\n isFocused: isFocusedProp,\n isHovered: isHoveredProp,\n label,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n testId = 'cf-ui-drag-handle',\n style,\n ...otherProps\n },\n forwardedRef,\n ) => {\n const styles = getStyles();\n const [isFocused, setisFocused] = useState(isFocusedProp);\n const [isHovered, setisHovered] = useState(isHoveredProp);\n\n const handleFocus = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(true);\n\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(false);\n\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur],\n );\n\n const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(true);\n\n if (onMouseEnter) {\n onMouseEnter(event);\n }\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(false);\n\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n },\n [onMouseLeave],\n );\n\n return (\n // We had to change it to div becouse of the issue in library used by field editors\n // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js\n <div\n role=\"button\"\n tabIndex={0}\n type=\"button\"\n {...otherProps}\n className={cx(\n styles.root({ isActive, isFocused, isHovered }),\n className,\n )}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n data-test-id={testId}\n ref={forwardedRef}\n style={style}\n >\n <DragIcon variant=\"muted\" />\n <span className={styles.label}>{label}</span>\n </div>\n );\n },\n);\n\nDragHandle.displayName = 'DragHandle';\n","import { cx, css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = () => ({\n label: css({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n border: 0,\n }),\n root: ({\n isActive,\n isFocused,\n isHovered,\n }: {\n isActive: boolean;\n isFocused: boolean;\n isHovered: boolean;\n }) => {\n return cx(\n css({\n alignItems: 'center',\n backgroundColor: tokens.gray100,\n border: 0,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderRight: `1px solid ${tokens.gray200}`,\n borderTopLeftRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n padding: 0,\n position: 'relative',\n transition: `background-color ${tokens.transitionDurationDefault} ${tokens.transitionEasingDefault}`,\n width: tokens.spacingL,\n '&:hover, &:focus': {\n backgroundColor: tokens.colorElementLight,\n },\n }),\n (isActive || isFocused || isHovered) &&\n css({\n backgroundColor: tokens.gray200,\n cursor: isActive ? 'grabbing' : 'grab',\n }),\n );\n },\n});\n"],"names":["DragHandle","DragHandleProps","React","forwardRef","useCallback","useState","FocusEventHandler","MouseEventHandler","PropsWithHTMLElement","CommonProps","ExpandProps","DragIcon","getStyles","DragHandleInternalProps","isActive","isFocused","isHovered","label","type","HTMLDivElement","className","isFocusedProp","isHoveredProp","onBlur","onFocus","onMouseEnter","onMouseLeave","testId","style","otherProps","forwardedRef","styles","setisFocused","setisHovered","handleFocus","event","handleBlur","handleMouseEnter","handleMouseLeave","root","displayName","tokens","alignItems","backgroundColor","gray100","border","borderBottomLeftRadius","borderRadiusMedium","borderRight","gray200","borderTopLeftRadius","boxSizing","display","justifyContent","padding","position","transition","transitionDurationDefault","transitionEasingDefault","width","spacingL","colorElementLight","cursor"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AEGO,KAAA,CAAMY,yCAAS,QAAU,CAAhC;QACEK,KAAK,EAAA,EAAE,AAAF,SAAE,AAAF,EAAE,CAAA,kBAAPA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A,EAAA,AAAA,sGAAA;IACA,EAAA,AAAA,kFAAA;IACA,EAAA;IACA,EAAA,AAAA,oCAAA;IACA,EAAA,AAAA,gJAAA;uEACC,CAAD;QACE,IAAA,EAAK,CADP;QAEE,QAAA,EAAU,CAAD;QACT,IAAA,EAAK,CAHP;WAIMG,UAAJ;QACA,SAAA,EAAW,iBAAA,CACTE,MAAM,CAACQ,IAAP,CAAY,CANhB;sBAMkBzB,QAAF;uBAAYC,SAAZ;uBAAuBC,SAAAA;QAAvB,CAAZ,GACAI,SAFS;QAIX,MAAA,EAAQgB,UAAD;QACP,OAAA,EAASF,WAAD;QACR,YAAA,EAAcG,gBAAD;QACb,YAAA,EAAcC,gBAAD;QACb,CAAA,eAAcX,MAAD;QACb,GAAA,EAAKG,YAAD;QACJ,KAAA,EAAOF,KAAD;0EAEL,kCAAD;QAAU,OAAA,EAAQ,CAAlB;2EACC,CAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD;AAGpC,CApGiC;AAuGpCjB,yCAAU,CAACwC,WAAX,GAAyB,CAAzB","sources":["packages/components/drag-handle/src/index.ts","packages/components/drag-handle/src/DragHandle.tsx","packages/components/drag-handle/src/DragHandle.styles.ts"],"sourcesContent":["export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n","import React, {\n forwardRef,\n useCallback,\n useState,\n FocusEventHandler,\n MouseEventHandler,\n} from 'react';\nimport { cx } from 'emotion';\nimport type { PropsWithHTMLElement } from '@contentful/f36-core';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { DragIcon } from '@contentful/f36-icons';\nimport { getStyles } from './DragHandle.styles';\n\nexport type DragHandleInternalProps = CommonProps & {\n /**\n * Applies styling for when the component is actively being dragged by\n * the user\n */\n isActive?: boolean;\n /**\n * Applies focus styling\n */\n isFocused?: boolean;\n /**\n * Applies hover styling\n */\n isHovered?: boolean;\n /**\n * Label rendered in DragHandle - not visible on screen as its purpose\n * is for screen readers only\n */\n label: string;\n /**\n * Set type button for div element\n */\n type?: string;\n};\n\nexport type DragHandleProps = PropsWithHTMLElement<\n DragHandleInternalProps,\n 'div'\n>;\n\nexport const DragHandle = forwardRef<\n HTMLDivElement,\n ExpandProps<DragHandleProps>\n>(\n (\n {\n className,\n isActive,\n isFocused: isFocusedProp,\n isHovered: isHoveredProp,\n label,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n testId = 'cf-ui-drag-handle',\n style,\n ...otherProps\n },\n forwardedRef,\n ) => {\n const styles = getStyles();\n const [isFocused, setisFocused] = useState(isFocusedProp);\n const [isHovered, setisHovered] = useState(isHoveredProp);\n\n const handleFocus = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(true);\n\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(false);\n\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur],\n );\n\n const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(true);\n\n if (onMouseEnter) {\n onMouseEnter(event);\n }\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(false);\n\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n },\n [onMouseLeave],\n );\n\n return (\n // We use div instead of a button because react-sortable-hoc lib cancels sorting if the event target is button.\n //\n // The other alternative way to fix it was to pass a custom `shouldCancelStart` callback,\n // in every place where we use this component with react-sortable-hoc.\n // (the custom callback with all the logic from default callback, but without button event cancelation).\n // So we decided that just changing it to the div, as it was in v3, is a better fix.\n //\n // default shouldCancelStart callback:\n // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js\n <div\n role=\"button\"\n tabIndex={0}\n type=\"button\"\n {...otherProps}\n className={cx(\n styles.root({ isActive, isFocused, isHovered }),\n className,\n )}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n data-test-id={testId}\n ref={forwardedRef}\n style={style}\n >\n <DragIcon variant=\"muted\" />\n <span className={styles.label}>{label}</span>\n </div>\n );\n },\n);\n\nDragHandle.displayName = 'DragHandle';\n","import { cx, css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = () => ({\n label: css({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n border: 0,\n }),\n root: ({\n isActive,\n isFocused,\n isHovered,\n }: {\n isActive: boolean;\n isFocused: boolean;\n isHovered: boolean;\n }) => {\n return cx(\n css({\n alignItems: 'center',\n backgroundColor: tokens.gray100,\n border: 0,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderRight: `1px solid ${tokens.gray200}`,\n borderTopLeftRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n padding: 0,\n position: 'relative',\n transition: `background-color ${tokens.transitionDurationDefault} ${tokens.transitionEasingDefault}`,\n width: tokens.spacingL,\n '&:hover, &:focus': {\n backgroundColor: tokens.colorElementLight,\n },\n }),\n (isActive || isFocused || isHovered) &&\n css({\n backgroundColor: tokens.gray200,\n cursor: isActive ? 'grabbing' : 'grab',\n }),\n );\n },\n});\n"],"names":["DragHandle","DragHandleProps","React","forwardRef","useCallback","useState","FocusEventHandler","MouseEventHandler","PropsWithHTMLElement","CommonProps","ExpandProps","DragIcon","getStyles","DragHandleInternalProps","isActive","isFocused","isHovered","label","type","HTMLDivElement","className","isFocusedProp","isHoveredProp","onBlur","onFocus","onMouseEnter","onMouseLeave","testId","style","otherProps","forwardedRef","styles","setisFocused","setisHovered","handleFocus","event","handleBlur","handleMouseEnter","handleMouseLeave","root","displayName","tokens","alignItems","backgroundColor","gray100","border","borderBottomLeftRadius","borderRadiusMedium","borderRight","gray200","borderTopLeftRadius","boxSizing","display","justifyContent","padding","position","transition","transitionDurationDefault","transitionEasingDefault","width","spacingL","colorElementLight","cursor"],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -69,7 +69,14 @@ const $0d6e001a91dc675e$export$a0c24614540b0efb = /*#__PURE__*/ $8USmO$forwardRe
69
69
  }, [
70
70
  onMouseLeave
71
71
  ]);
72
- return(// https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js
72
+ return(//
73
+ // The other alternative way to fix it was to pass a custom `shouldCancelStart` callback,
74
+ // in every place where we use this component with react-sortable-hoc.
75
+ // (the custom callback with all the logic from default callback, but without button event cancelation).
76
+ // So we decided that just changing it to the div, as it was in v3, is a better fix.
77
+ //
78
+ // default shouldCancelStart callback:
79
+ // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js
73
80
  /*#__PURE__*/ $8USmO$react.createElement("div", {
74
81
  role: "button",
75
82
  tabIndex: 0,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AEGO,KAAA,CAAMY,yCAAS,QAAU,CAAhC;QACEK,KAAK,EAAA,EAAE,AAAF,SAAE,AAAF,EAAE,CAAA,UAAPA,CAAAA,CAAAA;YAAO,IAAA,EAAA,CAAA;YAAA,MAAA,EAAA,CAAA;QAAA,CAAA;QAUPsB,IAAI,GAAG,CAAPA,WACEzB,QADK,cAELC,SAFK,cAGLC,SAAAA,EACC,CAJG,GAQA,CAJH;YAKD,MAAA,CAAO,SAAA,CAAA,EACL,AADK,SACL,AADK,EACL,CAAA,UAAA,CAAI,CADN;gBAEI0B,UAAU,EAAE,CADV;gBAEFC,eAAe,EAAEF,0BAAM,CAACG,OAFtB;gBAGFC,MAAM,EAAE,CAHN;gBAIFC,sBAAsB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F,KAAD;gDAEL,eAAD;QAAU,OAAA,EAAQ,CAAlB;iDACC,CAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD;AAGpC,CA7FiC;AAgGpCjB,yCAAU,CAACwC,WAAX,GAAyB,CAAzB","sources":["packages/components/drag-handle/src/index.ts","packages/components/drag-handle/src/DragHandle.tsx","packages/components/drag-handle/src/DragHandle.styles.ts"],"sourcesContent":["export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n","import React, {\n forwardRef,\n useCallback,\n useState,\n FocusEventHandler,\n MouseEventHandler,\n} from 'react';\nimport { cx } from 'emotion';\nimport type { PropsWithHTMLElement } from '@contentful/f36-core';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { DragIcon } from '@contentful/f36-icons';\nimport { getStyles } from './DragHandle.styles';\n\nexport type DragHandleInternalProps = CommonProps & {\n /**\n * Applies styling for when the component is actively being dragged by\n * the user\n */\n isActive?: boolean;\n /**\n * Applies focus styling\n */\n isFocused?: boolean;\n /**\n * Applies hover styling\n */\n isHovered?: boolean;\n /**\n * Label rendered in DragHandle - not visible on screen as its purpose\n * is for screen readers only\n */\n label: string;\n /**\n * Set type button for div element\n */\n type?: string;\n};\n\nexport type DragHandleProps = PropsWithHTMLElement<\n DragHandleInternalProps,\n 'div'\n>;\n\nexport const DragHandle = forwardRef<\n HTMLDivElement,\n ExpandProps<DragHandleProps>\n>(\n (\n {\n className,\n isActive,\n isFocused: isFocusedProp,\n isHovered: isHoveredProp,\n label,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n testId = 'cf-ui-drag-handle',\n style,\n ...otherProps\n },\n forwardedRef,\n ) => {\n const styles = getStyles();\n const [isFocused, setisFocused] = useState(isFocusedProp);\n const [isHovered, setisHovered] = useState(isHoveredProp);\n\n const handleFocus = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(true);\n\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(false);\n\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur],\n );\n\n const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(true);\n\n if (onMouseEnter) {\n onMouseEnter(event);\n }\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(false);\n\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n },\n [onMouseLeave],\n );\n\n return (\n // We had to change it to div becouse of the issue in library used by field editors\n // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js\n <div\n role=\"button\"\n tabIndex={0}\n type=\"button\"\n {...otherProps}\n className={cx(\n styles.root({ isActive, isFocused, isHovered }),\n className,\n )}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n data-test-id={testId}\n ref={forwardedRef}\n style={style}\n >\n <DragIcon variant=\"muted\" />\n <span className={styles.label}>{label}</span>\n </div>\n );\n },\n);\n\nDragHandle.displayName = 'DragHandle';\n","import { cx, css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = () => ({\n label: css({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n border: 0,\n }),\n root: ({\n isActive,\n isFocused,\n isHovered,\n }: {\n isActive: boolean;\n isFocused: boolean;\n isHovered: boolean;\n }) => {\n return cx(\n css({\n alignItems: 'center',\n backgroundColor: tokens.gray100,\n border: 0,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderRight: `1px solid ${tokens.gray200}`,\n borderTopLeftRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n padding: 0,\n position: 'relative',\n transition: `background-color ${tokens.transitionDurationDefault} ${tokens.transitionEasingDefault}`,\n width: tokens.spacingL,\n '&:hover, &:focus': {\n backgroundColor: tokens.colorElementLight,\n },\n }),\n (isActive || isFocused || isHovered) &&\n css({\n backgroundColor: tokens.gray200,\n cursor: isActive ? 'grabbing' : 'grab',\n }),\n );\n },\n});\n"],"names":["DragHandle","DragHandleProps","React","forwardRef","useCallback","useState","FocusEventHandler","MouseEventHandler","PropsWithHTMLElement","CommonProps","ExpandProps","DragIcon","getStyles","DragHandleInternalProps","isActive","isFocused","isHovered","label","type","HTMLDivElement","className","isFocusedProp","isHoveredProp","onBlur","onFocus","onMouseEnter","onMouseLeave","testId","style","otherProps","forwardedRef","styles","setisFocused","setisHovered","handleFocus","event","handleBlur","handleMouseEnter","handleMouseLeave","root","displayName","tokens","alignItems","backgroundColor","gray100","border","borderBottomLeftRadius","borderRadiusMedium","borderRight","gray200","borderTopLeftRadius","boxSizing","display","justifyContent","padding","position","transition","transitionDurationDefault","transitionEasingDefault","width","spacingL","colorElementLight","cursor"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;AEGO,KAAA,CAAMY,yCAAS,QAAU,CAAhC;QACEK,KAAK,EAAA,EAAE,AAAF,SAAE,AAAF,EAAE,CAAA,UAAPA,CAAAA,CAAAA;YAAO,IAAA,EAAA,CAAA;YAAA,MAAA,EAAA,CAAA;QAAA,CAAA;QAUPsB,IAAI,GAAG,CAAPA,WACEzB,QADK,cAELC,SAFK,cAGLC,SAAAA,EACC,CAJG,GAQA,CAJH;YAKD,MAAA,CAAO,SAAA,CAAA,EACL,AADK,SACL,AADK,EACL,CAAA,UAAA,CAAI,CADN;gBAEI0B,UAAU,EAAE,CADV;gBAEFC,eAAe,EAAEF,0BAAM,CAACG,OAFtB;gBAGFC,MAAM,EAAE,CAHN;gBAIFC,sBAAsB,EAAEL,0BAAM,CAACM,kBAJ7B;gBAKFC,WAAW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gBAAD;QACb,YAAA,EAAcC,gBAAD;QACb,CAAA,eAAcX,MAAD;QACb,GAAA,EAAKG,YAAD;QACJ,KAAA,EAAOF,KAAD;gDAEL,eAAD;QAAU,OAAA,EAAQ,CAAlB;iDACC,CAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD;AAGpC,CApGiC;AAuGpCjB,yCAAU,CAACwC,WAAX,GAAyB,CAAzB","sources":["packages/components/drag-handle/src/index.ts","packages/components/drag-handle/src/DragHandle.tsx","packages/components/drag-handle/src/DragHandle.styles.ts"],"sourcesContent":["export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n","import React, {\n forwardRef,\n useCallback,\n useState,\n FocusEventHandler,\n MouseEventHandler,\n} from 'react';\nimport { cx } from 'emotion';\nimport type { PropsWithHTMLElement } from '@contentful/f36-core';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { DragIcon } from '@contentful/f36-icons';\nimport { getStyles } from './DragHandle.styles';\n\nexport type DragHandleInternalProps = CommonProps & {\n /**\n * Applies styling for when the component is actively being dragged by\n * the user\n */\n isActive?: boolean;\n /**\n * Applies focus styling\n */\n isFocused?: boolean;\n /**\n * Applies hover styling\n */\n isHovered?: boolean;\n /**\n * Label rendered in DragHandle - not visible on screen as its purpose\n * is for screen readers only\n */\n label: string;\n /**\n * Set type button for div element\n */\n type?: string;\n};\n\nexport type DragHandleProps = PropsWithHTMLElement<\n DragHandleInternalProps,\n 'div'\n>;\n\nexport const DragHandle = forwardRef<\n HTMLDivElement,\n ExpandProps<DragHandleProps>\n>(\n (\n {\n className,\n isActive,\n isFocused: isFocusedProp,\n isHovered: isHoveredProp,\n label,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n testId = 'cf-ui-drag-handle',\n style,\n ...otherProps\n },\n forwardedRef,\n ) => {\n const styles = getStyles();\n const [isFocused, setisFocused] = useState(isFocusedProp);\n const [isHovered, setisHovered] = useState(isHoveredProp);\n\n const handleFocus = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(true);\n\n if (onFocus) {\n onFocus(event);\n }\n },\n [onFocus],\n );\n\n const handleBlur = useCallback<FocusEventHandler<HTMLDivElement>>(\n (event) => {\n setisFocused(false);\n\n if (onBlur) {\n onBlur(event);\n }\n },\n [onBlur],\n );\n\n const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(true);\n\n if (onMouseEnter) {\n onMouseEnter(event);\n }\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n setisHovered(false);\n\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n },\n [onMouseLeave],\n );\n\n return (\n // We use div instead of a button because react-sortable-hoc lib cancels sorting if the event target is button.\n //\n // The other alternative way to fix it was to pass a custom `shouldCancelStart` callback,\n // in every place where we use this component with react-sortable-hoc.\n // (the custom callback with all the logic from default callback, but without button event cancelation).\n // So we decided that just changing it to the div, as it was in v3, is a better fix.\n //\n // default shouldCancelStart callback:\n // https://github.com/clauderic/react-sortable-hoc/blob/d94ba3cc67cfc7d6d460b585e7723bdb50015e53/src/SortableContainer/defaultShouldCancelStart.js\n <div\n role=\"button\"\n tabIndex={0}\n type=\"button\"\n {...otherProps}\n className={cx(\n styles.root({ isActive, isFocused, isHovered }),\n className,\n )}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n data-test-id={testId}\n ref={forwardedRef}\n style={style}\n >\n <DragIcon variant=\"muted\" />\n <span className={styles.label}>{label}</span>\n </div>\n );\n },\n);\n\nDragHandle.displayName = 'DragHandle';\n","import { cx, css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = () => ({\n label: css({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n border: 0,\n }),\n root: ({\n isActive,\n isFocused,\n isHovered,\n }: {\n isActive: boolean;\n isFocused: boolean;\n isHovered: boolean;\n }) => {\n return cx(\n css({\n alignItems: 'center',\n backgroundColor: tokens.gray100,\n border: 0,\n borderBottomLeftRadius: tokens.borderRadiusMedium,\n borderRight: `1px solid ${tokens.gray200}`,\n borderTopLeftRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n display: 'flex',\n justifyContent: 'center',\n padding: 0,\n position: 'relative',\n transition: `background-color ${tokens.transitionDurationDefault} ${tokens.transitionEasingDefault}`,\n width: tokens.spacingL,\n '&:hover, &:focus': {\n backgroundColor: tokens.colorElementLight,\n },\n }),\n (isActive || isFocused || isHovered) &&\n css({\n backgroundColor: tokens.gray200,\n cursor: isActive ? 'grabbing' : 'grab',\n }),\n );\n },\n});\n"],"names":["DragHandle","DragHandleProps","React","forwardRef","useCallback","useState","FocusEventHandler","MouseEventHandler","PropsWithHTMLElement","CommonProps","ExpandProps","DragIcon","getStyles","DragHandleInternalProps","isActive","isFocused","isHovered","label","type","HTMLDivElement","className","isFocusedProp","isHoveredProp","onBlur","onFocus","onMouseEnter","onMouseLeave","testId","style","otherProps","forwardedRef","styles","setisFocused","setisHovered","handleFocus","event","handleBlur","handleMouseEnter","handleMouseLeave","root","displayName","tokens","alignItems","backgroundColor","gray100","border","borderBottomLeftRadius","borderRadiusMedium","borderRight","gray200","borderTopLeftRadius","boxSizing","display","justifyContent","padding","position","transition","transitionDurationDefault","transitionEasingDefault","width","spacingL","colorElementLight","cursor"],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -25,269 +25,28 @@ type DragHandleInternalProps = CommonProps & {
25
25
  type?: string;
26
26
  };
27
27
  export type DragHandleProps = PropsWithHTMLElement<DragHandleInternalProps, 'div'>;
28
- export const DragHandle: React.ForwardRefExoticComponent<{
29
- hidden?: boolean;
30
- color?: string;
31
- translate?: "yes" | "no";
32
- slot?: string;
33
- title?: string;
34
- key?: React.Key;
35
- defaultChecked?: boolean;
36
- defaultValue?: string | number | readonly string[];
37
- suppressContentEditableWarning?: boolean;
38
- suppressHydrationWarning?: boolean;
39
- accessKey?: string;
40
- contentEditable?: "inherit" | (boolean | "true" | "false");
41
- contextMenu?: string;
42
- dir?: string;
43
- draggable?: boolean | "true" | "false";
44
- id?: string;
45
- lang?: string;
46
- placeholder?: string;
47
- spellCheck?: boolean | "true" | "false";
48
- tabIndex?: number;
49
- radioGroup?: string;
50
- role?: string;
51
- about?: string;
52
- datatype?: string;
53
- inlist?: any;
54
- prefix?: string;
55
- property?: string;
56
- resource?: string;
57
- typeof?: string;
58
- vocab?: string;
59
- autoCapitalize?: string;
60
- autoCorrect?: string;
61
- autoSave?: string;
62
- itemProp?: string;
63
- itemScope?: boolean;
64
- itemType?: string;
65
- itemID?: string;
66
- itemRef?: string;
67
- results?: number;
68
- security?: string;
69
- unselectable?: "on" | "off";
70
- inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search";
71
- is?: string;
72
- 'aria-activedescendant'?: string;
73
- 'aria-atomic'?: boolean | "true" | "false";
74
- 'aria-autocomplete'?: "none" | "inline" | "list" | "both";
75
- 'aria-busy'?: boolean | "true" | "false";
76
- 'aria-checked'?: boolean | "true" | "false" | "mixed";
77
- 'aria-colcount'?: number;
78
- 'aria-colindex'?: number;
79
- 'aria-colspan'?: number;
80
- 'aria-controls'?: string;
81
- 'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date";
82
- 'aria-describedby'?: string;
83
- 'aria-details'?: string;
84
- 'aria-disabled'?: boolean | "true" | "false";
85
- 'aria-dropeffect'?: "none" | "copy" | "move" | "link" | "execute" | "popup";
86
- 'aria-errormessage'?: string;
87
- 'aria-expanded'?: boolean | "true" | "false";
88
- 'aria-flowto'?: string;
89
- 'aria-grabbed'?: boolean | "true" | "false";
90
- 'aria-haspopup'?: boolean | "grid" | "dialog" | "menu" | "true" | "false" | "listbox" | "tree";
91
- 'aria-hidden'?: boolean | "true" | "false";
92
- 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling";
93
- 'aria-keyshortcuts'?: string;
94
- 'aria-label'?: string;
95
- 'aria-labelledby'?: string;
96
- 'aria-level'?: number;
97
- 'aria-live'?: "off" | "assertive" | "polite";
98
- 'aria-modal'?: boolean | "true" | "false";
99
- 'aria-multiline'?: boolean | "true" | "false";
100
- 'aria-multiselectable'?: boolean | "true" | "false";
101
- 'aria-orientation'?: "horizontal" | "vertical";
102
- 'aria-owns'?: string;
103
- 'aria-placeholder'?: string;
104
- 'aria-posinset'?: number;
105
- 'aria-pressed'?: boolean | "true" | "false" | "mixed";
106
- 'aria-readonly'?: boolean | "true" | "false";
107
- 'aria-relevant'?: "all" | "text" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals";
108
- 'aria-required'?: boolean | "true" | "false";
109
- 'aria-roledescription'?: string;
110
- 'aria-rowcount'?: number;
111
- 'aria-rowindex'?: number;
112
- 'aria-rowspan'?: number;
113
- 'aria-selected'?: boolean | "true" | "false";
114
- 'aria-setsize'?: number;
115
- 'aria-sort'?: "none" | "ascending" | "descending" | "other";
116
- 'aria-valuemax'?: number;
117
- 'aria-valuemin'?: number;
118
- 'aria-valuenow'?: number;
119
- 'aria-valuetext'?: string;
120
- children?: React.ReactNode;
121
- dangerouslySetInnerHTML?: {
122
- __html: string;
123
- };
124
- onCopy?: React.ClipboardEventHandler<HTMLDivElement>;
125
- onCopyCapture?: React.ClipboardEventHandler<HTMLDivElement>;
126
- onCut?: React.ClipboardEventHandler<HTMLDivElement>;
127
- onCutCapture?: React.ClipboardEventHandler<HTMLDivElement>;
128
- onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
129
- onPasteCapture?: React.ClipboardEventHandler<HTMLDivElement>;
130
- onCompositionEnd?: React.CompositionEventHandler<HTMLDivElement>;
131
- onCompositionEndCapture?: React.CompositionEventHandler<HTMLDivElement>;
132
- onCompositionStart?: React.CompositionEventHandler<HTMLDivElement>;
133
- onCompositionStartCapture?: React.CompositionEventHandler<HTMLDivElement>;
134
- onCompositionUpdate?: React.CompositionEventHandler<HTMLDivElement>;
135
- onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLDivElement>;
136
- onFocus?: React.FocusEventHandler<HTMLDivElement>;
137
- onFocusCapture?: React.FocusEventHandler<HTMLDivElement>;
138
- onBlur?: React.FocusEventHandler<HTMLDivElement>;
139
- onBlurCapture?: React.FocusEventHandler<HTMLDivElement>;
140
- onChange?: React.FormEventHandler<HTMLDivElement>;
141
- onChangeCapture?: React.FormEventHandler<HTMLDivElement>;
142
- onBeforeInput?: React.FormEventHandler<HTMLDivElement>;
143
- onBeforeInputCapture?: React.FormEventHandler<HTMLDivElement>;
144
- onInput?: React.FormEventHandler<HTMLDivElement>;
145
- onInputCapture?: React.FormEventHandler<HTMLDivElement>;
146
- onReset?: React.FormEventHandler<HTMLDivElement>;
147
- onResetCapture?: React.FormEventHandler<HTMLDivElement>;
148
- onSubmit?: React.FormEventHandler<HTMLDivElement>;
149
- onSubmitCapture?: React.FormEventHandler<HTMLDivElement>;
150
- onInvalid?: React.FormEventHandler<HTMLDivElement>;
151
- onInvalidCapture?: React.FormEventHandler<HTMLDivElement>;
152
- onLoad?: React.ReactEventHandler<HTMLDivElement>;
153
- onLoadCapture?: React.ReactEventHandler<HTMLDivElement>;
154
- onError?: React.ReactEventHandler<HTMLDivElement>;
155
- onErrorCapture?: React.ReactEventHandler<HTMLDivElement>;
156
- onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
157
- onKeyDownCapture?: React.KeyboardEventHandler<HTMLDivElement>;
158
- onKeyPress?: React.KeyboardEventHandler<HTMLDivElement>;
159
- onKeyPressCapture?: React.KeyboardEventHandler<HTMLDivElement>;
160
- onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
161
- onKeyUpCapture?: React.KeyboardEventHandler<HTMLDivElement>;
162
- onAbort?: React.ReactEventHandler<HTMLDivElement>;
163
- onAbortCapture?: React.ReactEventHandler<HTMLDivElement>;
164
- onCanPlay?: React.ReactEventHandler<HTMLDivElement>;
165
- onCanPlayCapture?: React.ReactEventHandler<HTMLDivElement>;
166
- onCanPlayThrough?: React.ReactEventHandler<HTMLDivElement>;
167
- onCanPlayThroughCapture?: React.ReactEventHandler<HTMLDivElement>;
168
- onDurationChange?: React.ReactEventHandler<HTMLDivElement>;
169
- onDurationChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
170
- onEmptied?: React.ReactEventHandler<HTMLDivElement>;
171
- onEmptiedCapture?: React.ReactEventHandler<HTMLDivElement>;
172
- onEncrypted?: React.ReactEventHandler<HTMLDivElement>;
173
- onEncryptedCapture?: React.ReactEventHandler<HTMLDivElement>;
174
- onEnded?: React.ReactEventHandler<HTMLDivElement>;
175
- onEndedCapture?: React.ReactEventHandler<HTMLDivElement>;
176
- onLoadedData?: React.ReactEventHandler<HTMLDivElement>;
177
- onLoadedDataCapture?: React.ReactEventHandler<HTMLDivElement>;
178
- onLoadedMetadata?: React.ReactEventHandler<HTMLDivElement>;
179
- onLoadedMetadataCapture?: React.ReactEventHandler<HTMLDivElement>;
180
- onLoadStart?: React.ReactEventHandler<HTMLDivElement>;
181
- onLoadStartCapture?: React.ReactEventHandler<HTMLDivElement>;
182
- onPause?: React.ReactEventHandler<HTMLDivElement>;
183
- onPauseCapture?: React.ReactEventHandler<HTMLDivElement>;
184
- onPlay?: React.ReactEventHandler<HTMLDivElement>;
185
- onPlayCapture?: React.ReactEventHandler<HTMLDivElement>;
186
- onPlaying?: React.ReactEventHandler<HTMLDivElement>;
187
- onPlayingCapture?: React.ReactEventHandler<HTMLDivElement>;
188
- onProgress?: React.ReactEventHandler<HTMLDivElement>;
189
- onProgressCapture?: React.ReactEventHandler<HTMLDivElement>;
190
- onRateChange?: React.ReactEventHandler<HTMLDivElement>;
191
- onRateChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
192
- onSeeked?: React.ReactEventHandler<HTMLDivElement>;
193
- onSeekedCapture?: React.ReactEventHandler<HTMLDivElement>;
194
- onSeeking?: React.ReactEventHandler<HTMLDivElement>;
195
- onSeekingCapture?: React.ReactEventHandler<HTMLDivElement>;
196
- onStalled?: React.ReactEventHandler<HTMLDivElement>;
197
- onStalledCapture?: React.ReactEventHandler<HTMLDivElement>;
198
- onSuspend?: React.ReactEventHandler<HTMLDivElement>;
199
- onSuspendCapture?: React.ReactEventHandler<HTMLDivElement>;
200
- onTimeUpdate?: React.ReactEventHandler<HTMLDivElement>;
201
- onTimeUpdateCapture?: React.ReactEventHandler<HTMLDivElement>;
202
- onVolumeChange?: React.ReactEventHandler<HTMLDivElement>;
203
- onVolumeChangeCapture?: React.ReactEventHandler<HTMLDivElement>;
204
- onWaiting?: React.ReactEventHandler<HTMLDivElement>;
205
- onWaitingCapture?: React.ReactEventHandler<HTMLDivElement>;
206
- onAuxClick?: React.MouseEventHandler<HTMLDivElement>;
207
- onAuxClickCapture?: React.MouseEventHandler<HTMLDivElement>;
208
- onClick?: React.MouseEventHandler<HTMLDivElement>;
209
- onClickCapture?: React.MouseEventHandler<HTMLDivElement>;
210
- onContextMenu?: React.MouseEventHandler<HTMLDivElement>;
211
- onContextMenuCapture?: React.MouseEventHandler<HTMLDivElement>;
212
- onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
213
- onDoubleClickCapture?: React.MouseEventHandler<HTMLDivElement>;
214
- onDrag?: React.DragEventHandler<HTMLDivElement>;
215
- onDragCapture?: React.DragEventHandler<HTMLDivElement>;
216
- onDragEnd?: React.DragEventHandler<HTMLDivElement>;
217
- onDragEndCapture?: React.DragEventHandler<HTMLDivElement>;
218
- onDragEnter?: React.DragEventHandler<HTMLDivElement>;
219
- onDragEnterCapture?: React.DragEventHandler<HTMLDivElement>;
220
- onDragExit?: React.DragEventHandler<HTMLDivElement>;
221
- onDragExitCapture?: React.DragEventHandler<HTMLDivElement>;
222
- onDragLeave?: React.DragEventHandler<HTMLDivElement>;
223
- onDragLeaveCapture?: React.DragEventHandler<HTMLDivElement>;
224
- onDragOver?: React.DragEventHandler<HTMLDivElement>;
225
- onDragOverCapture?: React.DragEventHandler<HTMLDivElement>;
226
- onDragStart?: React.DragEventHandler<HTMLDivElement>;
227
- onDragStartCapture?: React.DragEventHandler<HTMLDivElement>;
228
- onDrop?: React.DragEventHandler<HTMLDivElement>;
229
- onDropCapture?: React.DragEventHandler<HTMLDivElement>;
230
- onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
231
- onMouseDownCapture?: React.MouseEventHandler<HTMLDivElement>;
232
- onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
233
- onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
234
- onMouseMove?: React.MouseEventHandler<HTMLDivElement>;
235
- onMouseMoveCapture?: React.MouseEventHandler<HTMLDivElement>;
236
- onMouseOut?: React.MouseEventHandler<HTMLDivElement>;
237
- onMouseOutCapture?: React.MouseEventHandler<HTMLDivElement>;
238
- onMouseOver?: React.MouseEventHandler<HTMLDivElement>;
239
- onMouseOverCapture?: React.MouseEventHandler<HTMLDivElement>;
240
- onMouseUp?: React.MouseEventHandler<HTMLDivElement>;
241
- onMouseUpCapture?: React.MouseEventHandler<HTMLDivElement>;
242
- onSelect?: React.ReactEventHandler<HTMLDivElement>;
243
- onSelectCapture?: React.ReactEventHandler<HTMLDivElement>;
244
- onTouchCancel?: React.TouchEventHandler<HTMLDivElement>;
245
- onTouchCancelCapture?: React.TouchEventHandler<HTMLDivElement>;
246
- onTouchEnd?: React.TouchEventHandler<HTMLDivElement>;
247
- onTouchEndCapture?: React.TouchEventHandler<HTMLDivElement>;
248
- onTouchMove?: React.TouchEventHandler<HTMLDivElement>;
249
- onTouchMoveCapture?: React.TouchEventHandler<HTMLDivElement>;
250
- onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
251
- onTouchStartCapture?: React.TouchEventHandler<HTMLDivElement>;
252
- onPointerDown?: React.PointerEventHandler<HTMLDivElement>;
253
- onPointerDownCapture?: React.PointerEventHandler<HTMLDivElement>;
254
- onPointerMove?: React.PointerEventHandler<HTMLDivElement>;
255
- onPointerMoveCapture?: React.PointerEventHandler<HTMLDivElement>;
256
- onPointerUp?: React.PointerEventHandler<HTMLDivElement>;
257
- onPointerUpCapture?: React.PointerEventHandler<HTMLDivElement>;
258
- onPointerCancel?: React.PointerEventHandler<HTMLDivElement>;
259
- onPointerCancelCapture?: React.PointerEventHandler<HTMLDivElement>;
260
- onPointerEnter?: React.PointerEventHandler<HTMLDivElement>;
261
- onPointerEnterCapture?: React.PointerEventHandler<HTMLDivElement>;
262
- onPointerLeave?: React.PointerEventHandler<HTMLDivElement>;
263
- onPointerLeaveCapture?: React.PointerEventHandler<HTMLDivElement>;
264
- onPointerOver?: React.PointerEventHandler<HTMLDivElement>;
265
- onPointerOverCapture?: React.PointerEventHandler<HTMLDivElement>;
266
- onPointerOut?: React.PointerEventHandler<HTMLDivElement>;
267
- onPointerOutCapture?: React.PointerEventHandler<HTMLDivElement>;
268
- onGotPointerCapture?: React.PointerEventHandler<HTMLDivElement>;
269
- onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement>;
270
- onLostPointerCapture?: React.PointerEventHandler<HTMLDivElement>;
271
- onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement>;
272
- onScroll?: React.UIEventHandler<HTMLDivElement>;
273
- onScrollCapture?: React.UIEventHandler<HTMLDivElement>;
274
- onWheel?: React.WheelEventHandler<HTMLDivElement>;
275
- onWheelCapture?: React.WheelEventHandler<HTMLDivElement>;
276
- onAnimationStart?: React.AnimationEventHandler<HTMLDivElement>;
277
- onAnimationStartCapture?: React.AnimationEventHandler<HTMLDivElement>;
278
- onAnimationEnd?: React.AnimationEventHandler<HTMLDivElement>;
279
- onAnimationEndCapture?: React.AnimationEventHandler<HTMLDivElement>;
280
- onAnimationIteration?: React.AnimationEventHandler<HTMLDivElement>;
281
- onAnimationIterationCapture?: React.AnimationEventHandler<HTMLDivElement>;
282
- onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement>;
283
- onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement>;
284
- className?: string;
285
- testId?: string;
286
- style?: React.CSSProperties;
28
+ export const DragHandle: React.ForwardRefExoticComponent<Omit<Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>>, never>, "isActive" | "isFocused" | "isHovered" | "label" | keyof CommonProps | "type"> & CommonProps & {
29
+ /**
30
+ * Applies styling for when the component is actively being dragged by
31
+ * the user
32
+ */
287
33
  isActive?: boolean;
34
+ /**
35
+ * Applies focus styling
36
+ */
288
37
  isFocused?: boolean;
38
+ /**
39
+ * Applies hover styling
40
+ */
289
41
  isHovered?: boolean;
42
+ /**
43
+ * Label rendered in DragHandle - not visible on screen as its purpose
44
+ * is for screen readers only
45
+ */
290
46
  label: string;
47
+ /**
48
+ * Set type button for div element
49
+ */
291
50
  type?: string;
292
51
  } & React.RefAttributes<HTMLDivElement>>;
293
52
 
@@ -1 +1 @@
1
- {"mappings":";;ACaA,+BAAsC,WAAW,GAAG;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8BAA8B,qBAC5B,uBAAuB,EACvB,KAAK,CACN,CAAC;AAEF,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAzBA,OAAO;gBAIN,OAAO;gBAIP,OAAO;WAKZ,MAAM;WAIN,MAAM;wCAsGd,CAAC","sources":["packages/components/drag-handle/src/src/DragHandle.styles.ts","packages/components/drag-handle/src/src/DragHandle.tsx","packages/components/drag-handle/src/src/index.ts","packages/components/drag-handle/src/index.ts"],"sourcesContent":[null,null,null,"export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;ACaA,+BAAsC,WAAW,GAAG;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8BAA8B,qBAC5B,uBAAuB,EACvB,KAAK,CACN,CAAC;AAEF,OAAO,MAAM;IA7BX;;;OAGG;eACQ,OAAO;IAClB;;OAEG;gBACS,OAAO;IACnB;;OAEG;gBACS,OAAO;IACnB;;;OAGG;WACI,MAAM;IACb;;OAEG;WACI,MAAM;wCA6Gd,CAAC","sources":["packages/components/drag-handle/src/src/DragHandle.styles.ts","packages/components/drag-handle/src/src/DragHandle.tsx","packages/components/drag-handle/src/src/index.ts","packages/components/drag-handle/src/index.ts"],"sourcesContent":[null,null,null,"export { DragHandle } from './DragHandle';\nexport type { DragHandleProps } from './DragHandle';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@contentful/f36-drag-handle",
3
- "version": "4.0.1",
3
+ "version": "4.1.3",
4
4
  "description": "Forma 36: DragHandle component",
5
5
  "scripts": {
6
6
  "build": "parcel build"
7
7
  },
8
8
  "dependencies": {
9
9
  "@babel/runtime": "^7.6.2",
10
- "@contentful/f36-core": "^4.0.1",
11
- "@contentful/f36-icons": "^4.0.1",
10
+ "@contentful/f36-core": "^4.1.1",
11
+ "@contentful/f36-icons": "^4.0.4",
12
12
  "@contentful/f36-tokens": "^4.0.0",
13
13
  "emotion": "^10.0.17"
14
14
  },
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "cee6bd9ae0b1ca2ce23d42873d9344a20fe740d0"
35
+ "gitHead": "1c758aa0198049358c58027ae8daa72122248882"
36
36
  }