Skip to content

Commit

Permalink
add new ImageMagnify component
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmars committed May 4, 2024
1 parent 0c856dc commit da08136
Show file tree
Hide file tree
Showing 9 changed files with 1,294 additions and 699 deletions.
6 changes: 0 additions & 6 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# Use default npmjs registry for the SDKs
registry = https://registry.npmjs.org/
# For now, turn off npm auto-install of peer dependencies to get rid of warnings
legacy-peer-deps=true
# Turn off messages such as > [email protected] list and > dx-component-builder-sdk list
loglevel=silent
#
#
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"PHARMACODE",
"reactflow",
"Talia",
"timegrid"
"timegrid",
"widthpx"
]
}
1,304 changes: 624 additions & 680 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"polished": "^4.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"reactflow": "^11.11.2",
"react-image-magnifiers": "^1.4.0",
"reactflow": "^11.11.3",
"signature_pad": "^4.2.0",
"styled-components": "^5.3.11"
},
Expand All @@ -65,27 +66,28 @@
"@pega/eslint-config": "^0.10.0",
"@pega/pcore-pconnect-typedefs": "^3.0.0",
"@pega/tsconfig": "^0.10.0",
"@storybook/addon-a11y": "^7.6.18",
"@storybook/addon-essentials": "^7.6.18",
"@storybook/manager-api": "^7.6.18",
"@storybook/react": "^7.6.18",
"@storybook/react-webpack5": "^7.6.18",
"@storybook/addon-a11y": "^7.6.19",
"@storybook/addon-essentials": "^7.6.19",
"@storybook/manager-api": "^7.6.19",
"@storybook/react": "^7.6.19",
"@storybook/react-webpack5": "^7.6.19",
"@storybook/test-runner": "^0.17.0",
"@storybook/theming": "^7.6.18",
"@testing-library/jest-dom": "^6.4.2",
"@storybook/theming": "^7.6.19",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^12.1.5",
"@types/dagre": "^0.7.52",
"@types/jest": "^29.5.12",
"@types/react": "^17.0.80",
"@types/react-dom": "^17.0.25",
"@types/react-image-magnifiers": "^1.3.5",
"@types/styled-components": "^5.1.34",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"axe-playwright": "^2.0.1",
"cspell": "^8.7.0",
"cspell": "^8.8.0",
"cspell-dict-lorem-ipsum": "^1.1.2",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.3.0",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-prettier": "^5.1.3",
Expand All @@ -101,8 +103,8 @@
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"sort-package-json": "^2.10.0",
"storybook": "^7.6.18",
"stylelint": "^16.4.0",
"storybook": "^7.6.19",
"stylelint": "^16.5.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"
},
Expand Down
19 changes: 19 additions & 0 deletions src/components/Pega_Extensions_ImageMagnify/Docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Meta, Primary, Controls, Story } from '@storybook/blocks';
import * as DemoStories from './demo.stories';

<Meta of={DemoStories} />

# Overview

The Image Magnify component provides image magnification features. Users can zoom in on images either by hovering over them or by clicking/double-clicking, based on the specified trigger mode.
This component offers two magnification modes: the default "Side by side" mode displays the original image on one side and the magnified version on the other. Users can customize this arrangement to display the zoomed image on the left or within the same space as the preview. Additionally, the zoomed image can be set to fill the available screen space if desired.

In Advanced mode, users can access configuration options to adjust the size and position of the zoomed image, along with additional settings like z-index and preview image horizontal offset position for finer control.

This component operates with a single image provided via the mapped URL field. Users can adjust the size of the smaller image by setting the width value smaller than the actual width of the full referenced image.

<Primary />

## Props

<Controls />
294 changes: 294 additions & 0 deletions src/components/Pega_Extensions_ImageMagnify/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
{
"name": "Pega_Extensions_ImageMagnify",
"label": "Image Magnify",
"description": "Image Magnify",
"organization": "Pega",
"version": "1.0.0",
"library": "Extensions",
"allowedApplications": [],
"componentKey": "Pega_Extensions_ImageMagnify",
"type": "Field",
"subtype": "Text-URL",
"icon": "images/pz-url-active.svg",
"properties": [
{
"name": "label",
"label": "Field label",
"format": "TEXT"
},
{
"label": "Column settings",
"format": "GROUP",
"visibility": "@VIEWTYPE == 'MultiRecordDisplayAsTable'",
"properties": [
{
"name": "columnWidth",
"label": "Column width",
"format": "SELECT",
"source": [
{
"key": "auto",
"value": "Auto"
},
{
"key": "custom",
"value": "Custom"
}
]
},
{
"name": "width",
"label": "Width (px)",
"format": "NUMBER",
"visibility": "$this.columnWidth == 'custom'"
}
]
},
{
"label": "Preview Image settings",
"format": "GROUP",
"properties": [
{
"format": "GROUP",
"properties": [
{
"format": "SELECT",
"name": "widthSel",
"label": "Width",
"defaultValue": "defaultWidth",
"source": [
{
"key": "defaultWidth",
"value": "Default Width"
},
{
"key": "widthpx",
"value": "Custom Width"
}
]
},
{
"name": "customWidth",
"label": "Width (px)",
"visibility": "(widthSel = widthpx)",
"format": "NUMBER"
},
{
"format": "CASCADE",
"source": {
"format": "SELECT",
"label": "Image Alt Text",
"name": "altText",
"defaultValue": "constant",
"source": [
{
"key": "constant",
"value": "Constant"
},
{
"key": "propertyRef",
"value": "Property Reference"
}
]
},
"cascadeElements": [
{
"key": "altTextOfImage",
"format": "TEXT",
"name": "altTextOfImage",
"label": "Alt Text Value",
"defaultValue": "",
"match": "constant"
},
{
"key": "altTextOfImage",
"format": "PROPERTY",
"name": "propaltTextOfImage",
"label": "Alt Text Value",
"match": "propertyRef"
}
]
}
]
}
]
},
{
"label": "Magnification settings",
"format": "GROUP",
"properties": [
{
"name": "magnifyMode",
"label": "Magnifier mode",
"format": "SELECT",
"defaultValue": "magSideBySide",
"source": [
{
"key": "magSideBySide",
"value": "Side by side"
},
{
"key": "magAdvanced",
"value": "Advanced"
}
]
},
{
"name": "magnifyTrigger",
"label": "Magnifier activation trigger",
"format": "SELECT",
"defaultValue": "magTriggerHover",
"source": [
{
"key": "magTriggerHover",
"value": "Hover"
},
{
"key": "magTriggerClick",
"value": "Click"
},
{
"key": "magTriggerDoubleClick",
"value": "Double click"
}
]
},
{
"label": "Side by Side",
"format": "GROUP",
"visibility": "$this.magnifyMode == magSideBySide",
"properties": [
{
"name": "alwaysInPlace",
"label": "Always magnify in place",
"format": "BOOLEAN"
},
{
"name": "switchSides",
"label": "Show on left",
"format": "BOOLEAN"
},
{
"name": "fillAvailableSpace",
"label": "Fill available Space",
"format": "BOOLEAN"
},
{
"name": "fillAlignTop",
"label": "Align to top",
"format": "BOOLEAN"
},
{
"name": "fillGapTop",
"label": "Gap top",
"format": "NUMBER"
},
{
"name": "fillGapBottom",
"label": "Gap bottom",
"format": "NUMBER"
},
{
"name": "fillGapLeft",
"label": "Gap left",
"format": "NUMBER"
},
{
"name": "fillGapRight",
"label": "Gap right",
"format": "NUMBER"
}
]
},
{
"label": "Advanced",
"format": "GROUP",
"visibility": "$this.magnifyMode == magAdvanced",
"properties": [
{
"name": "zoomTop",
"label": "Zoom top position (px)",
"format": "NUMBER"
},
{
"name": "zoomLeft",
"label": "Zoom left position (px)",
"format": "NUMBER"
},
{
"name": "zoomHeight",
"label": "Zoom display height (%)",
"format": "NUMBER"
},
{
"name": "zoomWidth",
"label": "Zoom display width (px)",
"format": "NUMBER"
}
]
}
]
},
{
"label": "Conditions",
"format": "GROUP",
"properties": [
{
"name": "visibility",
"label": "Visibility",
"format": "VISIBILITY"
}
]
},
{
"label": "Advanced",
"format": "GROUP",
"collapsible": true,
"properties": [
{
"name": "testId",
"label": "Test ID",
"format": "TEXT",
"ignorePattern": "[^-_\\p{N}\\p{L}]",
"includeAnnotations": false
},
{
"name": "zoomZIndex",
"label": "Zoom display z-index value",
"format": "NUMBER",
"visibility": "$this.magnifyMode == magAdvanced"
},
{
"name": "previewRightOffset",
"label": "Preview image right offset (px)",
"format": "NUMBER",
"visibility": "$this.magnifyMode == magAdvanced"
}
]
}
],
"defaultConfig": {
"label": "@L $this.label",
"widthSel": "defaultWidth",
"customWidth": 100,
"altText": "constant",
"altTextOfImage": "",
"propaltTextOfImage": "",
"magnifyTrigger": "magTriggerHover",
"magnifyMode": "magSideBySide",
"fillAvailableSpace": false,
"fillAlignTop": false,
"fillGapLeft": 0,
"fillGapRight": 0,
"fillGapTop": 0,
"fillGapBottom": 0,
"switchSides": false,
"alwaysInPlace": false,
"zoomTop": 0,
"zoomLeft": 0,
"zoomHeight": 100,
"zoomWidth": 300,
"previewRightOffset": 0,
"zoomZIndex": 999
}
}
Loading

0 comments on commit da08136

Please sign in to comment.