@licklist/design 0.44.501 → 0.44.502
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/dist/events/event-venue-map/components/MapPoint/MapPoint.d.ts.map +1 -1
- package/dist/events/event-venue-map/components/MapPoint/MapPoint.js +1 -1
- package/dist/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.d.ts.map +1 -1
- package/dist/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.js +1 -1
- package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.d.ts +9 -0
- package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.d.ts.map +1 -0
- package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.js +1 -0
- package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/index.d.ts +2 -0
- package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/index.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/events/event-venue-map/components/MapPoint/MapPoint.tsx +3 -1
- package/src/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.tsx +13 -2
- package/src/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.tsx +68 -0
- package/src/events/event-venue-map/components/MapPoint/components/ProductTooltip/index.ts +1 -0
- package/src/iframe/event/event-venue-map/IframeEventVenueMap.stories.tsx +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapPoint.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/MapPoint/MapPoint.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,aAAK,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,GACjC,WAAW,GAAG;IACZ,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACjE,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,QAAQ,sMAclB,aAAa,
|
|
1
|
+
{"version":3,"file":"MapPoint.d.ts","sourceRoot":"","sources":["../../../../../src/events/event-venue-map/components/MapPoint/MapPoint.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,aAAK,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,GACjC,WAAW,GAAG;IACZ,gBAAgB,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACjE,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,QAAQ,sMAclB,aAAa,gBAqHf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("tslib"),o=require("react"),t=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@licklist/plugins/dist/context/event/EventVenueMapContext"),r=require("react-konva"),u=require("../../utils/index.js"),c=require("./components/PointIcon/PointIcon.js"),d=require("./components/ProductIcon/ProductIcon.js");exports.MapPoint=function(e){var s=e.xCoordinate,l=e.yCoordinate,a=e.id,f=e.imageOffsetX,p=e.imageOffsetY,v=e.imageScale,m=e.localId,P=e.pointNumber,I=e.changeCursorType,x=e.usedInIframe,C=e.choosedProductUuids,M=void 0===C?[]:C,O=e.errorOnChoosedProductUuids,g=void 0===O?[]:O,E=e.isSoldOut,y=o.useContext(i.EventVenueMapContext),b=y.setActiveElementKey,h=y.activeElementKey,q=y.setMapPoints,U=y.editMode,j=y.mapPointProducts,S=n.__read(u.calculatePointsCoordinates(s,l,{imageScale:v,imageOffsetX:f,imageOffsetY:p}),2),B=S[0],_=S[1],k=String(a||m),A=k===h,K=j.find((function(e){return a&&e.pointId&&e.pointId===a})),N=Boolean(j.find((function(e){return M.includes(null==e?void 0:e.productUuid)&&M.includes(null==K?void 0:K.productUuid)}))),T=Boolean(j.find((function(e){return g.includes(null==e?void 0:e.productUuid)&&g.includes(null==K?void 0:K.productUuid)}))),V=function(){q((function(e){var n=e.slice(),o=n.find((function(e){return a&&e.id===a||m&&e.localId===m})),t=n.indexOf(o);return n.splice(t,1),n.push(o),n}))},X=function(e){e.cancelBubble=!0,A||E||(b(k),V())};return t.createElement(r.Group,{onClick:X,onTap:X,onMouseEnter:function(){V(),I("pointer")},onMouseLeave:function(){I()}},x?t.createElement(d.ProductIcon,{x:B,y:_,isSoldOut:E,isActive:A,isProductChoosed:N,isErrorOnChoosedProduct:T}):t.createElement(c.PointIcon,{x:B,y:_,isActive:A,hasProduct:!E&&Boolean(K),pointNumber:P,onDelete:function(){b(),I(),q((function(e){return u.removeMapPointFromPoints(e,a,m)}))},editMode:U}))};
|
package/dist/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductIcon.d.ts","sourceRoot":"","sources":["../../../../../../src/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAQ,eAAe,EAAiB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductIcon.d.ts","sourceRoot":"","sources":["../../../../../../src/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAQ,eAAe,EAAiB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,oBAAY,gBAAgB,GAAG,eAAe,GAC5C,KAAK,CAAC,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB,EAAE,OAAO,CAAC;IACjC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAkBJ,eAAO,MAAM,WAAW,8EAOrB,gBAAgB,gBAwGlB,CAAC"}
|
package/dist/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o,t=require("tslib"),e=require("react"),r=(o=e)&&"object"==typeof o&&"default"in o?o.default:o,n=require("react-konva"),i="#FFFFFF",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o,t=require("tslib"),e=require("react"),r=(o=e)&&"object"==typeof o&&"default"in o?o.default:o,n=require("react-konva"),i=require("../ProductTooltip/ProductTooltip.js"),a="#FFFFFF",c="#FFFFFF80",l="#0E8CE2",u="#878787",d=function(o,t){void 0===t&&(t=!1);var e=document.getElementById("snippet-template-context");if(e){var r=getComputedStyle(e).getPropertyValue(o);return!r||r&&!t?r:"".concat(r,"80")}};exports.ProductIcon=function(o){var s,p,v=o.x,C=o.y,f=o.isActive,F=o.isSoldOut,P=o.isErrorOnChoosedProduct,k=o.isProductChoosed,g=-28,h=t.__read(e.useState(!1),2),y=h[0],m=h[1],x=e.useMemo((function(){return{pointBackgroundColor:d("--snippet-canvas-point-background-color")||a,pointBorderColor:d("--snippet-canvas-point-border-color",!0)||c,pointFontColor:d("--snippet-canvas-point-font-color")||l,activePointBackgroundColor:d("--snippet-canvas-active-point-background-color")||l,activePointBorderColor:d("--snippet-canvas-active-point-border-color",!0)||c,activePointFontColor:d("--snippet-canvas-active-point-font-color")||a}}),[f,P,k]);return r.createElement(n.Group,{x:v,y:C,onMouseEnter:function(){return m(!0)},onMouseLeave:function(){return m(!1)}},r.createElement(n.Circle,t.__assign({radius:14,strokeWidth:2,x:0,y:-21},(s=x.pointBackgroundColor,p=x.pointBorderColor,f&&(p=x.activePointBorderColor),k&&(s=x.activePointBackgroundColor),P&&(p="#ff000080"),F&&(p=u,s=u),{fill:s,stroke:p}))),y&&F&&r.createElement(i.ProductTooltip,{x:-7,y:g,text:"Sold out"}),k?r.createElement(n.Path,{x:-7,y:g,data:"M1.5 6L5.5 10L13.5 2",width:28,height:28,fill:x.activePointBackgroundColor,stroke:x.activePointFontColor,strokeWidth:3}):r.createElement(n.Path,{x:-7,y:g,data:"M14 0C9.3569 0.6633 4.6431 0.6633 0 0L6 7V13H3V14H11V13H8V7L14 0Z",width:28,height:28,strokeWidth:1,fill:x.pointFontColor,stroke:x.pointFontColor}))};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type ProductTooltipProps = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const ProductTooltip: ({ x, y, text }: ProductTooltipProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ProductTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductTooltip.d.ts","sourceRoot":"","sources":["../../../../../../src/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.tsx"],"names":[],"mappings":";AAkBA,aAAK,mBAAmB,GAAG;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,cAAc,mBAAoB,mBAAmB,gBA2CjE,CAAC"}
|
package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,i=require("react-konva"),l="#000";exports.ProductTooltip=function(e){var t=e.x,o=e.y,c=e.text;return r.createElement(i.Group,{width:60,height:20,x:t+30,y:o-1},r.createElement(i.Rect,{x:-5,y:5,sceneFunc:function(e){e.beginPath(),e.moveTo(0,5),e.lineTo(5,0),e.lineTo(5,10),e.closePath(),e.fill()},fill:l,borderColor:l,opacity:.8}),r.createElement(i.Rect,{x:0,y:0,width:60,height:20,fill:l,cornerRadius:5,opacity:.8}),r.createElement(i.Text,{y:4,text:c,strokeWidth:5,width:60,align:"center",verticalAlign:"middle",fill:"#FFF"}))};
|
package/dist/events/event-venue-map/components/MapPoint/components/ProductTooltip/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/events/event-venue-map/components/MapPoint/components/ProductTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -78,7 +78,8 @@ export const MapPoint = ({
|
|
|
78
78
|
// have 2 points near one by one
|
|
79
79
|
const nextPoints = prevPoints.slice();
|
|
80
80
|
const currentPoint = nextPoints.find(
|
|
81
|
-
(
|
|
81
|
+
(point) =>
|
|
82
|
+
(id && point.id === id) || (localId && point.localId === localId)
|
|
82
83
|
);
|
|
83
84
|
const currentPointIndex = nextPoints.indexOf(currentPoint);
|
|
84
85
|
|
|
@@ -106,6 +107,7 @@ export const MapPoint = ({
|
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
const onMouseEnter = () => {
|
|
110
|
+
changePointPosition();
|
|
109
111
|
changeCursorType("pointer");
|
|
110
112
|
};
|
|
111
113
|
|
package/src/events/event-venue-map/components/MapPoint/components/ProductIcon/ProductIcon.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
2
|
import { Path, KonvaNodeEvents, Group, Circle } from "react-konva";
|
|
3
3
|
import Konva from "konva";
|
|
4
|
+
import { ProductTooltip } from "../ProductTooltip";
|
|
4
5
|
|
|
5
6
|
const ICON_DATA =
|
|
6
7
|
"M14 0C9.3569 0.6633 4.6431 0.6633 0 0L6 7V13H3V14H11V13H8V7L14 0Z";
|
|
@@ -62,6 +63,8 @@ export const ProductIcon = ({
|
|
|
62
63
|
const defaultX = -X_OFFSET;
|
|
63
64
|
const defaultY = -Y_OFFSET;
|
|
64
65
|
|
|
66
|
+
const [hovered, setHovered] = useState<boolean>(false);
|
|
67
|
+
|
|
65
68
|
const cssVariableValues = useMemo(() => {
|
|
66
69
|
return {
|
|
67
70
|
pointBackgroundColor:
|
|
@@ -119,7 +122,12 @@ export const ProductIcon = ({
|
|
|
119
122
|
};
|
|
120
123
|
|
|
121
124
|
return (
|
|
122
|
-
<Group
|
|
125
|
+
<Group
|
|
126
|
+
x={x}
|
|
127
|
+
y={y}
|
|
128
|
+
onMouseEnter={() => setHovered(true)}
|
|
129
|
+
onMouseLeave={() => setHovered(false)}
|
|
130
|
+
>
|
|
123
131
|
<Circle
|
|
124
132
|
radius={CIRCLE_RADIUS}
|
|
125
133
|
strokeWidth={POINT_STROKE_WIDTH}
|
|
@@ -127,6 +135,9 @@ export const ProductIcon = ({
|
|
|
127
135
|
y={defaultY * 0.75}
|
|
128
136
|
{...circleColors()}
|
|
129
137
|
/>
|
|
138
|
+
{hovered && isSoldOut && (
|
|
139
|
+
<ProductTooltip x={defaultX} y={defaultY} text="Sold out" />
|
|
140
|
+
)}
|
|
130
141
|
{isProductChoosed ? (
|
|
131
142
|
<Path
|
|
132
143
|
x={defaultX}
|
package/src/events/event-venue-map/components/MapPoint/components/ProductTooltip/ProductTooltip.tsx
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Group, Rect, Text } from "react-konva";
|
|
3
|
+
|
|
4
|
+
const TOOLTIP_WIDTH = 60;
|
|
5
|
+
const TOOLTIP_HEIGHT = 20;
|
|
6
|
+
|
|
7
|
+
const BACKGROUND_COLOR = "#000";
|
|
8
|
+
const BACKGROUND_Y_OFFSET = 1;
|
|
9
|
+
const BACKGROUND_X_OFFSET = 30;
|
|
10
|
+
const BACKGROUND_RADIUS = 5;
|
|
11
|
+
const BACKGROUND_OPACITY = 0.8;
|
|
12
|
+
|
|
13
|
+
const TEXT_Y_OFFSET = 4;
|
|
14
|
+
const TEXT_STROKE_WIDTH = 5;
|
|
15
|
+
const TEXT_COLOR = "#FFF";
|
|
16
|
+
const TEXT_ALIGN = "center";
|
|
17
|
+
const TEXT_VERTICAL_ALIGN = "middle";
|
|
18
|
+
|
|
19
|
+
type ProductTooltipProps = {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const ProductTooltip = ({ x, y, text }: ProductTooltipProps) => {
|
|
26
|
+
return (
|
|
27
|
+
<Group
|
|
28
|
+
width={TOOLTIP_WIDTH}
|
|
29
|
+
height={TOOLTIP_HEIGHT}
|
|
30
|
+
x={x + BACKGROUND_X_OFFSET}
|
|
31
|
+
y={y - BACKGROUND_Y_OFFSET}
|
|
32
|
+
>
|
|
33
|
+
<Rect
|
|
34
|
+
x={-5}
|
|
35
|
+
y={5}
|
|
36
|
+
sceneFunc={(context) => {
|
|
37
|
+
context.beginPath();
|
|
38
|
+
context.moveTo(0, 5);
|
|
39
|
+
context.lineTo(5, 0);
|
|
40
|
+
context.lineTo(5, 10);
|
|
41
|
+
context.closePath();
|
|
42
|
+
context.fill();
|
|
43
|
+
}}
|
|
44
|
+
fill={BACKGROUND_COLOR}
|
|
45
|
+
borderColor={BACKGROUND_COLOR}
|
|
46
|
+
opacity={BACKGROUND_OPACITY}
|
|
47
|
+
/>
|
|
48
|
+
<Rect
|
|
49
|
+
x={0}
|
|
50
|
+
y={0}
|
|
51
|
+
width={TOOLTIP_WIDTH}
|
|
52
|
+
height={TOOLTIP_HEIGHT}
|
|
53
|
+
fill={BACKGROUND_COLOR}
|
|
54
|
+
cornerRadius={BACKGROUND_RADIUS}
|
|
55
|
+
opacity={BACKGROUND_OPACITY}
|
|
56
|
+
/>
|
|
57
|
+
<Text
|
|
58
|
+
y={TEXT_Y_OFFSET}
|
|
59
|
+
text={text}
|
|
60
|
+
strokeWidth={TEXT_STROKE_WIDTH}
|
|
61
|
+
width={TOOLTIP_WIDTH}
|
|
62
|
+
align={TEXT_ALIGN}
|
|
63
|
+
verticalAlign={TEXT_VERTICAL_ALIGN}
|
|
64
|
+
fill={TEXT_COLOR}
|
|
65
|
+
/>
|
|
66
|
+
</Group>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductTooltip } from "./ProductTooltip";
|
|
@@ -6,6 +6,7 @@ import { Page, PageBody, PageHeader } from "../../page";
|
|
|
6
6
|
import { BookingSummaryFooter } from "../../order-process/components/BookingSummaryFooter";
|
|
7
7
|
import { BookingSummary } from "../../order-process/components/BookingSummary";
|
|
8
8
|
import { CalendarSelect } from "../event-calendar/components/CalendarSelect";
|
|
9
|
+
import { Product } from "../../../types";
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
title: "Iframe/Event/IframeEventVenueMap",
|
|
@@ -268,6 +269,10 @@ export function Default() {
|
|
|
268
269
|
pointProducts={MENU_STEPS[0].pointProducts}
|
|
269
270
|
usedInIframe={usedInIframe}
|
|
270
271
|
onPointClick={(pointId) => console.log({ pointId })}
|
|
272
|
+
products={
|
|
273
|
+
MENU_STEPS[0].productCategories[0]
|
|
274
|
+
.products as Partial<Product>[]
|
|
275
|
+
}
|
|
271
276
|
choosedProductUuids={[
|
|
272
277
|
"beb6393c-2fdd-40f7-bb92-8800685b203f",
|
|
273
278
|
"beb6393c-2fdd-40f7-bb92-8800685b203a",
|