@contentful/f36-drag-handle 4.6.0 → 4.7.0
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 +24 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.7.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`e50b8945`](https://github.com/contentful/forma-36/commit/e50b8945faef7323187e1bd9a2a9cbfcbae2e405)]:
|
|
8
|
+
- @contentful/f36-core@4.7.0
|
|
9
|
+
- @contentful/f36-icons@4.7.0
|
|
10
|
+
|
|
11
|
+
## 4.6.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies []:
|
|
16
|
+
- @contentful/f36-icons@4.6.2
|
|
17
|
+
- @contentful/f36-core@4.6.2
|
|
18
|
+
|
|
19
|
+
## 4.6.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies []:
|
|
24
|
+
- @contentful/f36-icons@4.6.1
|
|
25
|
+
- @contentful/f36-core@4.6.1
|
|
26
|
+
|
|
3
27
|
## 4.6.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;A;;;A;;;AEGO,MAAMY,yCAAS,GAAG,IAAO,CAAA;QAC9BK,KAAK,EAAA,aAAE,CAAA,kBAAPA,CAAAA;YAAO,IAAA,EAAA,SAAA;YAAA,MAAA,EAAA,8GAAA;SAAA,CADuB;QAW9BsB,IAAI,EAAE,CAAC,E,UACLzB,QADK,CAAA,E,WAELC,SAFK,CAAA,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AA;IACA,sCAAA;IACA,kJAAA;kBACA,qDAAC,KAAD;QACE,IAAA,EAAK,QADP;QAEE,QAAA,EAAU,CAAD;QACT,IAAA,EAAK,QAHP;QAIE,GAAIG,UAAJ;QACA,SAAA,EAAW,iBAAA,CACTE,MAAM,CAACQ,IAAP,CAAY;Y,UAAEzB,QAAF;Y,WAAYC,SAAZ;Y,WAAuBC,SAAAA;SAAnC,CADS,EAETI,SAFS,CAAD;QAIV,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;qBAEN,qDAAC,kCAAD;QAAU,OAAA,EAAQ,OAAlB;MAAR,gBACQ,qDAAC,MAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD,CAAvC,CACA,EA7BI;CArEgC,CAA7B,AAoGJ;AAGHjB,yCAAU,CAACwC,WAAX,GAAyB,YAAzB,CAAAxC;;ADlJA","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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;A;;;A;;;AEGO,MAAMY,yCAAS,GAAG,IAAO,CAAA;QAC9BK,KAAK,EAAA,aAAE,CAAA,UAAPA,CAAAA;YAAO,IAAA,EAAA,SAAA;YAAA,MAAA,EAAA,8GAAA;SAAA,CADuB;QAW9BsB,IAAI,EAAE,CAAC,E,UACLzB,QADK,CAAA,E,WAELC,SAFK,CAAA,E,WAGLC,SAAAA,CAAAA,EAHI,GAQA;YACJ,OAAO,SAAA,CAAA,aACL,CAAA,UAAA,CAAI;gBACF0B,UAAU,EAAE,QADV;gBAEFC,eAAe,EAAEF,0BAAM,CAACG,OAFtB;gBAGFC,MAAM,EAAE,CAHN;gBAIFC,sBAAsB,EAAEL,0BAAM,CAACM,kBAJ7B;gBAKFC,WAAW,EAAG,CAAA,UAAA,EAAYP,0BAAM,CAACQ,OAAQ,CAAA,CALvC;gBAMFC,mBAAmB,EAAET,0BAAM,CAACM,kBAN1B;gBAOFI,SAAS,EAAE,YAPT;gBAQFC,OAAO,EAAE,MARP;gBASFC,cAAc,EAAE,QATd;gBAUFC,OAAO,EAAE,CAVP;gBAWFC,QAAQ,EAAE,UAXR;gBAYFC,UAAU,EAAG,CAAA,iBAAA,EAAmBf,0BAAM,CAACgB,yBAA0B,CAAA,CAAA,EAAGhB,0BAAM,CAACiB,uBAAwB,CAAA,CAZjG;gBAaFC,KAAK,EAAElB,0BAAM,CAACmB,QAbZ;gBAcF,kBAAA,EAAoB;oBAClBjB,eAAe,EAAEF,0BAAM,CAACoB,iBAAxBlB;iBADkB;aAdtB,CADK,EAmBL,AAAC7B,CAAAA,QAAQ,IAAI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GAAGjC,kBAAW,CACjC+B,CAAAA,KAAD,GAAW;QACTF,YAAY,CAAC,IAAD,CAAZ,CAAAA;QAEA,IAAIR,YAAJ,EACEA,YAAY,CAACU,KAAD,CAAZ,CAAAV;KAL8B,EAQlC;QAACA,YAAD;KARkC,CAApC,AAOG;IAIH,MAAMa,gBAAgB,GAAGlC,kBAAW,CACjC+B,CAAAA,KAAD,GAAW;QACTF,YAAY,CAAC,KAAD,CAAZ,CAAAA;QAEA,IAAIP,YAAJ,EACEA,YAAY,CAACS,KAAD,CAAZ,CAAAT;KAL8B,EAQlC;QAACA,YAAD;KARkC,CAApC,AAOG;IAIH,OAEE,EAAA;IACA,yFAAA;IACA,sEAAA;IACA,wGAAA;IACA,oFAAA;IACA,EAAA;IACA,sCAAA;IACA,kJAAA;kBACA,2BAAC,KAAD;QACE,IAAA,EAAK,QADP;QAEE,QAAA,EAAU,CAAD;QACT,IAAA,EAAK,QAHP;QAIE,GAAIG,UAAJ;QACA,SAAA,EAAW,SAAA,CACTE,MAAM,CAACQ,IAAP,CAAY;Y,UAAEzB,QAAF;Y,WAAYC,SAAZ;Y,WAAuBC,SAAAA;SAAnC,CADS,EAETI,SAFS,CAAD;QAIV,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;qBAEN,2BAAC,eAAD;QAAU,OAAA,EAAQ,OAAlB;MAAR,gBACQ,2BAAC,MAAD;QAAM,SAAA,EAAWG,MAAM,CAACd,KAAR;OAAgBA,KAAD,CAAvC,CACA,EA7BI;CArEgC,CAA7B,AAoGJ;AAGHjB,yCAAU,CAACwC,WAAX,GAAyB,YAAzB,CAAAxC;;ADlJA","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/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/f36-drag-handle",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
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.
|
|
11
|
-
"@contentful/f36-icons": "^4.
|
|
10
|
+
"@contentful/f36-core": "^4.7.0",
|
|
11
|
+
"@contentful/f36-icons": "^4.7.0",
|
|
12
12
|
"@contentful/f36-tokens": "^4.0.1",
|
|
13
13
|
"emotion": "^10.0.17"
|
|
14
14
|
},
|