krl-alfred 2.22.1 → 2.23.1
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/components/DescriptionCard/DescriptionCard.d.ts +1 -1
- package/dist/components/DescriptionCard/DescriptionCard.js +7 -7
- package/dist/components/DescriptionCard/DescriptionCard.styled.js +22 -16
- package/dist/components/DescriptionCard/props.d.ts +13 -3
- package/dist/components/DescriptionCard/props.js +5 -3
- package/dist/components/DescriptionCard/stories/DescriptionCard.stories.d.ts +13 -2
- package/dist/components/DescriptionCard/stories/DescriptionCard.stories.js +12 -6
- package/dist/components/ProductCardHorizontal/ProductCardHorizontal.styled.js +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +4 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +113 -0
- package/dist/components/RichTextEditor/RichTextEditor.styled.d.ts +27 -0
- package/dist/components/RichTextEditor/RichTextEditor.styled.js +22 -0
- package/dist/components/RichTextEditor/extensions/VariableBadgeView.d.ts +4 -0
- package/dist/components/RichTextEditor/extensions/VariableBadgeView.js +25 -0
- package/dist/components/RichTextEditor/extensions/VariableNode.d.ts +14 -0
- package/dist/components/RichTextEditor/extensions/VariableNode.js +75 -0
- package/dist/components/RichTextEditor/index.d.ts +4 -0
- package/dist/components/RichTextEditor/index.js +14 -0
- package/dist/components/RichTextEditor/props.d.ts +38 -0
- package/dist/components/RichTextEditor/props.js +13 -0
- package/dist/components/RichTextEditor/stories/RichTextEditor.stories.d.ts +86 -0
- package/dist/components/RichTextEditor/stories/RichTextEditor.stories.js +101 -0
- package/dist/components/RichTextEditor/utils/sanitize.d.ts +13 -0
- package/dist/components/RichTextEditor/utils/sanitize.js +95 -0
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.js +1 -1
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.styled.d.ts +5 -1
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.styled.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/package.json +8 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const RichTextEditorRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
3
|
+
export declare const FieldLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, never>>> & string;
|
|
4
|
+
export declare const EditorShell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$hasError" | "$disabled" | "$focused"> & {
|
|
5
|
+
$hasError?: boolean;
|
|
6
|
+
$disabled?: boolean;
|
|
7
|
+
$focused?: boolean;
|
|
8
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$hasError" | "$disabled" | "$focused"> & {
|
|
9
|
+
$hasError?: boolean;
|
|
10
|
+
$disabled?: boolean;
|
|
11
|
+
$focused?: boolean;
|
|
12
|
+
}, never>>> & string;
|
|
13
|
+
export declare const Toolbar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
14
|
+
export declare const ToolbarButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$active"> & {
|
|
15
|
+
$active?: boolean;
|
|
16
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$active"> & {
|
|
17
|
+
$active?: boolean;
|
|
18
|
+
}, never>>> & string;
|
|
19
|
+
export declare const ToolbarDivider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
20
|
+
export declare const EditorContentArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$minHeight"> & {
|
|
21
|
+
$minHeight?: string;
|
|
22
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$minHeight"> & {
|
|
23
|
+
$minHeight?: string;
|
|
24
|
+
}, never>>> & string;
|
|
25
|
+
export declare const ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
26
|
+
export declare const VariableActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
27
|
+
export declare const VariableChipButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>> & string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VariableChipButton = exports.VariableActions = exports.ErrorMessage = exports.EditorContentArea = exports.ToolbarDivider = exports.ToolbarButton = exports.Toolbar = exports.EditorShell = exports.FieldLabel = exports.RichTextEditorRoot = void 0;
|
|
11
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
+
exports.RichTextEditorRoot = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n"])));
|
|
13
|
+
exports.FieldLabel = styled_components_1.default.label(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin: 0 0 0.5rem;\n color: var(--dark-opacity-50);\n display: block;\n font: var(--caption-bold-12-15);\n"], ["\n margin: 0 0 0.5rem;\n color: var(--dark-opacity-50);\n display: block;\n font: var(--caption-bold-12-15);\n"])));
|
|
14
|
+
exports.EditorShell = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n background: ", ";\n padding: 1.5rem;\n border-radius: 0.5rem;\n border: 1px solid var(--grey-10);\n opacity: ", ";\n pointer-events: ", ";\n transition: border-color 0.15s ease;\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n background: ", ";\n padding: 1.5rem;\n border-radius: 0.5rem;\n border: 1px solid var(--grey-10);\n opacity: ", ";\n pointer-events: ", ";\n transition: border-color 0.15s ease;\n"])), function (props) { return (props.$disabled ? 'var(--dark-opacity-5)' : 'var(--dark-opacity-3)'); }, function (props) { return (props.$disabled ? 0.7 : 1); }, function (props) { return (props.$disabled ? 'none' : 'auto'); });
|
|
15
|
+
exports.Toolbar = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex-wrap: wrap;\n padding: 0 0 1rem;\n margin: 0 0 1rem;\n border-bottom: 1px solid var(--grey-10);\n"], ["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex-wrap: wrap;\n padding: 0 0 1rem;\n margin: 0 0 1rem;\n border-bottom: 1px solid var(--grey-10);\n"])));
|
|
16
|
+
exports.ToolbarButton = styled_components_1.default.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1.25rem;\n height: 1.25rem;\n padding: 0;\n border: none;\n border-radius: 0.25rem;\n background: ", ";\n color: ", ";\n font: var(--body-bold-14-17);\n cursor: pointer;\n transition: background-color 0.15s ease, color 0.15s ease;\n\n &:hover {\n background: var(--primary-opacity-10);\n color: var(--primary);\n }\n\n &:disabled {\n cursor: not-allowed;\n color: var(--dark-opacity-25);\n background: transparent;\n }\n\n svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1.25rem;\n height: 1.25rem;\n padding: 0;\n border: none;\n border-radius: 0.25rem;\n background: ", ";\n color: ", ";\n font: var(--body-bold-14-17);\n cursor: pointer;\n transition: background-color 0.15s ease, color 0.15s ease;\n\n &:hover {\n background: var(--primary-opacity-10);\n color: var(--primary);\n }\n\n &:disabled {\n cursor: not-allowed;\n color: var(--dark-opacity-25);\n background: transparent;\n }\n\n svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n"])), function (props) { return (props.$active ? 'var(--primary-opacity-10)' : 'transparent'); }, function (props) { return (props.$active ? 'var(--primary)' : 'var(--grey-50)'); });
|
|
17
|
+
exports.ToolbarDivider = styled_components_1.default.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-block;\n width: 1px;\n height: 1.25rem;\n margin: 0;\n background: var(--dark-opacity-10);\n"], ["\n display: inline-block;\n width: 1px;\n height: 1.25rem;\n margin: 0;\n background: var(--dark-opacity-10);\n"])));
|
|
18
|
+
exports.EditorContentArea = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n .ProseMirror {\n min-height: ", ";\n padding: 0;\n outline: none;\n color: var(--dark);\n font: var(--body-regular-14-17);\n box-sizing: border-box;\n\n p {\n margin: 0 0 0.75rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n ul,\n ol {\n margin: 0 0 0.75rem;\n padding-left: 1.25rem;\n list-style-position: outside;\n }\n\n ul {\n list-style-type: disc;\n }\n\n ol {\n list-style-type: decimal;\n }\n\n li {\n margin-bottom: 0.25rem;\n display: list-item;\n }\n\n strong {\n font-weight: 700;\n }\n\n em {\n font-style: italic;\n }\n\n u {\n text-decoration: underline;\n }\n\n s {\n text-decoration: line-through;\n }\n\n .rte-variable-node {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n margin: 0 0.125rem;\n user-select: none;\n }\n\n /* getHTML / serialize \u00E7\u0131kt\u0131s\u0131 \u2014 Badges text/secondary ile ayn\u0131 */\n .rte-variable {\n display: inline-flex;\n align-items: center;\n margin: 0 0.125rem;\n padding: 0 8px;\n height: 17px;\n line-height: 17px;\n border-radius: 3px;\n background-color: var(--primary-opacity-10);\n color: var(--primary);\n font: var(--caption-semi-bold-10-12);\n white-space: nowrap;\n vertical-align: middle;\n user-select: none;\n }\n\n p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--dark-opacity-50);\n pointer-events: none;\n height: 0;\n font: var(--body-regular-14-17);\n }\n }\n"], ["\n .ProseMirror {\n min-height: ", ";\n padding: 0;\n outline: none;\n color: var(--dark);\n font: var(--body-regular-14-17);\n box-sizing: border-box;\n\n p {\n margin: 0 0 0.75rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n }\n\n ul,\n ol {\n margin: 0 0 0.75rem;\n padding-left: 1.25rem;\n list-style-position: outside;\n }\n\n ul {\n list-style-type: disc;\n }\n\n ol {\n list-style-type: decimal;\n }\n\n li {\n margin-bottom: 0.25rem;\n display: list-item;\n }\n\n strong {\n font-weight: 700;\n }\n\n em {\n font-style: italic;\n }\n\n u {\n text-decoration: underline;\n }\n\n s {\n text-decoration: line-through;\n }\n\n .rte-variable-node {\n display: inline-flex;\n align-items: center;\n vertical-align: middle;\n margin: 0 0.125rem;\n user-select: none;\n }\n\n /* getHTML / serialize \u00E7\u0131kt\u0131s\u0131 \u2014 Badges text/secondary ile ayn\u0131 */\n .rte-variable {\n display: inline-flex;\n align-items: center;\n margin: 0 0.125rem;\n padding: 0 8px;\n height: 17px;\n line-height: 17px;\n border-radius: 3px;\n background-color: var(--primary-opacity-10);\n color: var(--primary);\n font: var(--caption-semi-bold-10-12);\n white-space: nowrap;\n vertical-align: middle;\n user-select: none;\n }\n\n p.is-editor-empty:first-child::before {\n content: attr(data-placeholder);\n float: left;\n color: var(--dark-opacity-50);\n pointer-events: none;\n height: 0;\n font: var(--body-regular-14-17);\n }\n }\n"])), function (props) { return props.$minHeight || '200px'; });
|
|
19
|
+
exports.ErrorMessage = styled_components_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-top: 0.5rem;\n color: var(--red);\n\n p {\n margin: 0;\n font: var(--caption-semi-bold-11-13);\n }\n"], ["\n display: flex;\n align-items: center;\n margin-top: 0.5rem;\n color: var(--red);\n\n p {\n margin: 0;\n font: var(--caption-semi-bold-11-13);\n }\n"])));
|
|
20
|
+
exports.VariableActions = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.75rem;\n"], ["\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.75rem;\n"])));
|
|
21
|
+
exports.VariableChipButton = styled_components_1.default.button(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n padding: 0.375rem 0.75rem;\n border-radius: 0.375rem;\n border: 1px solid var(--primary-opacity-50);\n background: var(--primary-opacity-10);\n color: var(--primary);\n font: var(--caption-bold-12-15);\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n\n &:hover {\n background: var(--primary-opacity-50);\n border-color: var(--primary);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n padding: 0.375rem 0.75rem;\n border-radius: 0.375rem;\n border: 1px solid var(--primary-opacity-50);\n background: var(--primary-opacity-10);\n color: var(--primary);\n font: var(--caption-bold-12-15);\n cursor: pointer;\n transition: background-color 0.15s ease, border-color 0.15s ease;\n\n &:hover {\n background: var(--primary-opacity-50);\n border-color: var(--primary);\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n"])));
|
|
22
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var react_1 = require("@tiptap/react");
|
|
19
|
+
var Badges_1 = __importDefault(require("../../Badges"));
|
|
20
|
+
var VariableBadgeView = function (_a) {
|
|
21
|
+
var node = _a.node;
|
|
22
|
+
var label = node.attrs.label || node.attrs.id || '';
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(react_1.NodeViewWrapper, __assign({ as: "span", className: "rte-variable-node", "data-variable": "", "data-id": node.attrs.id || undefined, "data-label": node.attrs.label || undefined }, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "secondary", title: label }) })));
|
|
24
|
+
};
|
|
25
|
+
exports.default = VariableBadgeView;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
export type VariableAttributes = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
declare module '@tiptap/core' {
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
variable: {
|
|
9
|
+
insertVariable: (attrs: VariableAttributes) => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const VariableNode: Node<any, any>;
|
|
14
|
+
export default VariableNode;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VariableNode = void 0;
|
|
7
|
+
var core_1 = require("@tiptap/core");
|
|
8
|
+
var react_1 = require("@tiptap/react");
|
|
9
|
+
var VariableBadgeView_1 = __importDefault(require("./VariableBadgeView"));
|
|
10
|
+
exports.VariableNode = core_1.Node.create({
|
|
11
|
+
name: 'variable',
|
|
12
|
+
group: 'inline',
|
|
13
|
+
inline: true,
|
|
14
|
+
atom: true,
|
|
15
|
+
selectable: true,
|
|
16
|
+
addAttributes: function () {
|
|
17
|
+
return {
|
|
18
|
+
id: {
|
|
19
|
+
default: null,
|
|
20
|
+
parseHTML: function (element) { return element.getAttribute('data-id'); },
|
|
21
|
+
renderHTML: function (attributes) {
|
|
22
|
+
if (!attributes.id)
|
|
23
|
+
return {};
|
|
24
|
+
return { 'data-id': attributes.id };
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
default: null,
|
|
29
|
+
parseHTML: function (element) { return element.getAttribute('data-label'); },
|
|
30
|
+
renderHTML: function (attributes) {
|
|
31
|
+
if (!attributes.label)
|
|
32
|
+
return {};
|
|
33
|
+
return { 'data-label': attributes.label };
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
parseHTML: function () {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
tag: 'span[data-variable]',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
},
|
|
45
|
+
renderHTML: function (_a) {
|
|
46
|
+
var node = _a.node, HTMLAttributes = _a.HTMLAttributes;
|
|
47
|
+
return [
|
|
48
|
+
'span',
|
|
49
|
+
(0, core_1.mergeAttributes)(HTMLAttributes, {
|
|
50
|
+
'data-variable': '',
|
|
51
|
+
class: 'rte-variable',
|
|
52
|
+
contenteditable: 'false',
|
|
53
|
+
}),
|
|
54
|
+
node.attrs.label || node.attrs.id || '',
|
|
55
|
+
];
|
|
56
|
+
},
|
|
57
|
+
addNodeView: function () {
|
|
58
|
+
return (0, react_1.ReactNodeViewRenderer)(VariableBadgeView_1.default);
|
|
59
|
+
},
|
|
60
|
+
addCommands: function () {
|
|
61
|
+
var _this = this;
|
|
62
|
+
return {
|
|
63
|
+
insertVariable: function (attrs) {
|
|
64
|
+
return function (_a) {
|
|
65
|
+
var commands = _a.commands;
|
|
66
|
+
return commands.insertContent({
|
|
67
|
+
type: _this.name,
|
|
68
|
+
attrs: attrs,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
exports.default = exports.VariableNode;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default } from './RichTextEditor';
|
|
2
|
+
export type { RichTextEditorProps, RichTextEditorRef, RichTextVariable } from './props';
|
|
3
|
+
export { VariableNode } from './extensions/VariableNode';
|
|
4
|
+
export { sanitizeHtml, serializeEditorHtml, prepareEditorHtml } from './utils/sanitize';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prepareEditorHtml = exports.serializeEditorHtml = exports.sanitizeHtml = exports.VariableNode = exports.default = void 0;
|
|
7
|
+
var RichTextEditor_1 = require("./RichTextEditor");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(RichTextEditor_1).default; } });
|
|
9
|
+
var VariableNode_1 = require("./extensions/VariableNode");
|
|
10
|
+
Object.defineProperty(exports, "VariableNode", { enumerable: true, get: function () { return VariableNode_1.VariableNode; } });
|
|
11
|
+
var sanitize_1 = require("./utils/sanitize");
|
|
12
|
+
Object.defineProperty(exports, "sanitizeHtml", { enumerable: true, get: function () { return sanitize_1.sanitizeHtml; } });
|
|
13
|
+
Object.defineProperty(exports, "serializeEditorHtml", { enumerable: true, get: function () { return sanitize_1.serializeEditorHtml; } });
|
|
14
|
+
Object.defineProperty(exports, "prepareEditorHtml", { enumerable: true, get: function () { return sanitize_1.prepareEditorHtml; } });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
export type RichTextVariable = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
export interface RichTextEditorProps {
|
|
7
|
+
label?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onChange?: (html: string) => void;
|
|
12
|
+
onBlur?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hasError?: boolean;
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
id?: string;
|
|
18
|
+
minHeight?: string;
|
|
19
|
+
/** Story / consumer tarafında değişken listesi göstermek için opsiyonel */
|
|
20
|
+
variables?: RichTextVariable[];
|
|
21
|
+
}
|
|
22
|
+
export interface RichTextEditorRef {
|
|
23
|
+
insertVariable: (variable: RichTextVariable) => void;
|
|
24
|
+
getHTML: () => string;
|
|
25
|
+
getEditor: () => Editor | null;
|
|
26
|
+
focus: () => void;
|
|
27
|
+
clear: () => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const RichTextEditorDefault: {
|
|
30
|
+
label: string;
|
|
31
|
+
placeholder: string;
|
|
32
|
+
defaultValue: string;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
hasError: boolean;
|
|
35
|
+
errorMessage: string;
|
|
36
|
+
minHeight: string;
|
|
37
|
+
variables: RichTextVariable[];
|
|
38
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RichTextEditorDefault = void 0;
|
|
4
|
+
exports.RichTextEditorDefault = {
|
|
5
|
+
label: null,
|
|
6
|
+
placeholder: 'Metin yaz…',
|
|
7
|
+
defaultValue: '',
|
|
8
|
+
disabled: false,
|
|
9
|
+
hasError: false,
|
|
10
|
+
errorMessage: null,
|
|
11
|
+
minHeight: '200px',
|
|
12
|
+
variables: [],
|
|
13
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RichTextEditorRef } from '../props';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../props").RichTextEditorProps & React.RefAttributes<RichTextEditorRef>>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: {
|
|
9
|
+
control: string;
|
|
10
|
+
};
|
|
11
|
+
placeholder: {
|
|
12
|
+
control: string;
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
control: string;
|
|
16
|
+
};
|
|
17
|
+
hasError: {
|
|
18
|
+
control: string;
|
|
19
|
+
};
|
|
20
|
+
errorMessage: {
|
|
21
|
+
control: string;
|
|
22
|
+
};
|
|
23
|
+
minHeight: {
|
|
24
|
+
control: string;
|
|
25
|
+
};
|
|
26
|
+
onChange: {
|
|
27
|
+
control: boolean;
|
|
28
|
+
};
|
|
29
|
+
onBlur: {
|
|
30
|
+
control: boolean;
|
|
31
|
+
};
|
|
32
|
+
value: {
|
|
33
|
+
control: boolean;
|
|
34
|
+
};
|
|
35
|
+
defaultValue: {
|
|
36
|
+
control: boolean;
|
|
37
|
+
};
|
|
38
|
+
variables: {
|
|
39
|
+
control: boolean;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
export declare const Default: {
|
|
45
|
+
args: {
|
|
46
|
+
label: string;
|
|
47
|
+
placeholder: string;
|
|
48
|
+
minHeight: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare const WithSampleContent: {
|
|
52
|
+
name: string;
|
|
53
|
+
args: {
|
|
54
|
+
label: string;
|
|
55
|
+
defaultValue: string;
|
|
56
|
+
minHeight: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare const WithError: {
|
|
60
|
+
args: {
|
|
61
|
+
label: string;
|
|
62
|
+
hasError: boolean;
|
|
63
|
+
errorMessage: string;
|
|
64
|
+
defaultValue: string;
|
|
65
|
+
minHeight: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const Disabled: {
|
|
69
|
+
args: {
|
|
70
|
+
label: string;
|
|
71
|
+
disabled: boolean;
|
|
72
|
+
defaultValue: string;
|
|
73
|
+
minHeight: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare const InsertVariables: {
|
|
77
|
+
name: string;
|
|
78
|
+
render: () => React.JSX.Element;
|
|
79
|
+
parameters: {
|
|
80
|
+
docs: {
|
|
81
|
+
description: {
|
|
82
|
+
story: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.InsertVariables = exports.Disabled = exports.WithError = exports.WithSampleContent = exports.Default = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var react_1 = require("react");
|
|
20
|
+
var RichTextEditor_1 = __importDefault(require("../RichTextEditor"));
|
|
21
|
+
var RichTextEditor_styled_1 = require("../RichTextEditor.styled");
|
|
22
|
+
var SAMPLE_VARIABLES = [
|
|
23
|
+
{ id: 'name', label: 'Ad' },
|
|
24
|
+
{ id: 'order_no', label: 'Sipariş no' },
|
|
25
|
+
{ id: 'amount', label: 'Tutar' },
|
|
26
|
+
];
|
|
27
|
+
var SAMPLE_CONTENT = "\n<p>Merhaba <span data-variable data-id=\"name\" data-label=\"Ad\">Ad</span></p>\n<p>Abonelik sipari\u015Fin ba\u015Far\u0131yla al\u0131nd\u0131, te\u015Fekk\u00FCr ederiz.</p>\n<p><span data-variable data-id=\"order_no\" data-label=\"Sipari\u015F no\">Sipari\u015F no</span> sipari\u015Fin haz\u0131rlanmaya ba\u015Flad\u0131; kargoya verildi\u011Finde sana ayr\u0131 bir bilgilendirme maili g\u00F6nderece\u011Fiz.</p>\n<p>Aboneliklerim sayfandaki sipari\u015F detay b\u00F6l\u00FCm\u00FCnden aboneliklerini g\u00F6r\u00FCnt\u00FCleyebilir ve y\u00F6netebilirsin.</p>\n";
|
|
28
|
+
exports.default = {
|
|
29
|
+
title: 'Components/RichTextEditor',
|
|
30
|
+
component: RichTextEditor_1.default,
|
|
31
|
+
tags: ['autodocs'],
|
|
32
|
+
argTypes: {
|
|
33
|
+
label: { control: 'text' },
|
|
34
|
+
placeholder: { control: 'text' },
|
|
35
|
+
disabled: { control: 'boolean' },
|
|
36
|
+
hasError: { control: 'boolean' },
|
|
37
|
+
errorMessage: { control: 'text' },
|
|
38
|
+
minHeight: { control: 'text' },
|
|
39
|
+
onChange: { control: false },
|
|
40
|
+
onBlur: { control: false },
|
|
41
|
+
value: { control: false },
|
|
42
|
+
defaultValue: { control: false },
|
|
43
|
+
variables: { control: false },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
exports.Default = {
|
|
47
|
+
args: {
|
|
48
|
+
label: 'Mail metni',
|
|
49
|
+
placeholder: 'Metin yaz…',
|
|
50
|
+
minHeight: '220px',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
exports.WithSampleContent = {
|
|
54
|
+
name: 'Örnek içerik + değişken chip’leri',
|
|
55
|
+
args: {
|
|
56
|
+
label: 'Mail metni',
|
|
57
|
+
defaultValue: SAMPLE_CONTENT,
|
|
58
|
+
minHeight: '240px',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
exports.WithError = {
|
|
62
|
+
args: {
|
|
63
|
+
label: 'Mail metni',
|
|
64
|
+
hasError: true,
|
|
65
|
+
errorMessage: 'Mail metni zorunludur.',
|
|
66
|
+
defaultValue: '<p></p>',
|
|
67
|
+
minHeight: '180px',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
exports.Disabled = {
|
|
71
|
+
args: {
|
|
72
|
+
label: 'Mail metni',
|
|
73
|
+
disabled: true,
|
|
74
|
+
defaultValue: SAMPLE_CONTENT,
|
|
75
|
+
minHeight: '220px',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
var InsertVariableStory = function () {
|
|
79
|
+
var editorRef = (0, react_1.useRef)(null);
|
|
80
|
+
var _a = (0, react_1.useState)(SAMPLE_CONTENT), html = _a[0], setHtml = _a[1];
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { maxWidth: 720 } }, { children: [(0, jsx_runtime_1.jsx)(RichTextEditor_1.default, { ref: editorRef, label: "Mail metni", value: html, onChange: setHtml, minHeight: "240px" }), (0, jsx_runtime_1.jsx)(RichTextEditor_styled_1.VariableActions, { children: SAMPLE_VARIABLES.map(function (variable) { return ((0, jsx_runtime_1.jsxs)(RichTextEditor_styled_1.VariableChipButton, __assign({ type: "button", onClick: function () { var _a; return (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.insertVariable(variable); } }, { children: ["+ ", variable.label] }), variable.id)); }) }), (0, jsx_runtime_1.jsxs)("details", __assign({ style: { marginTop: '1rem' } }, { children: [(0, jsx_runtime_1.jsx)("summary", __assign({ style: { cursor: 'pointer', font: 'var(--caption-bold-12-15)', color: 'var(--dark-opacity-50)' } }, { children: "HTML \u00E7\u0131kt\u0131s\u0131" })), (0, jsx_runtime_1.jsx)("pre", __assign({ style: {
|
|
82
|
+
marginTop: '0.5rem',
|
|
83
|
+
padding: '0.75rem',
|
|
84
|
+
borderRadius: '0.5rem',
|
|
85
|
+
background: 'var(--dark-opacity-3)',
|
|
86
|
+
fontSize: 12,
|
|
87
|
+
whiteSpace: 'pre-wrap',
|
|
88
|
+
wordBreak: 'break-word',
|
|
89
|
+
} }, { children: html }))] }))] })));
|
|
90
|
+
};
|
|
91
|
+
exports.InsertVariables = {
|
|
92
|
+
name: 'Değişken ekleme (ref API)',
|
|
93
|
+
render: function () { return (0, jsx_runtime_1.jsx)(InsertVariableStory, {}); },
|
|
94
|
+
parameters: {
|
|
95
|
+
docs: {
|
|
96
|
+
description: {
|
|
97
|
+
story: "\nDesign system bile\u015Feni de\u011Fi\u015Fken se\u00E7ici UI i\u00E7ermez; t\u00FCketici taraf\u0131nda `ref.insertVariable` ile cursor konumuna chip eklenir:\n\n```tsx\nconst ref = useRef<RichTextEditorRef>(null);\n\n<RichTextEditor ref={ref} value={html} onChange={setHtml} />\n<button onClick={() => ref.current?.insertVariable({ id: 'name', label: 'Ad' })}>\n Ad ekle\n</button>\n```\n ",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const sanitizeHtml: (html: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* TipTap HTML → dışarı verilen HTML
|
|
4
|
+
* Boş paragraflar (Enter + yazı yok) <br> olur.
|
|
5
|
+
* İçinde metin olan paragraflar <p> olarak kalır.
|
|
6
|
+
*/
|
|
7
|
+
export declare const serializeEditorHtml: (html: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Dışarıdan gelen HTML → TipTap'in düzenleyebileceği HTML
|
|
10
|
+
* Blok seviyesindeki <br> etiketleri boş <p> olur (Enter satırı).
|
|
11
|
+
* <p> içindeki <br> hard-break olarak kalır.
|
|
12
|
+
*/
|
|
13
|
+
export declare const prepareEditorHtml: (html: string) => string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prepareEditorHtml = exports.serializeEditorHtml = exports.sanitizeHtml = void 0;
|
|
7
|
+
var dompurify_1 = __importDefault(require("dompurify"));
|
|
8
|
+
var ALLOWED_TAGS = [
|
|
9
|
+
'p',
|
|
10
|
+
'br',
|
|
11
|
+
'strong',
|
|
12
|
+
'b',
|
|
13
|
+
'em',
|
|
14
|
+
'i',
|
|
15
|
+
'u',
|
|
16
|
+
's',
|
|
17
|
+
'strike',
|
|
18
|
+
'ul',
|
|
19
|
+
'ol',
|
|
20
|
+
'li',
|
|
21
|
+
'span',
|
|
22
|
+
];
|
|
23
|
+
var ALLOWED_ATTR = [
|
|
24
|
+
'class',
|
|
25
|
+
'data-variable',
|
|
26
|
+
'data-id',
|
|
27
|
+
'data-label',
|
|
28
|
+
];
|
|
29
|
+
var EMPTY_PARAGRAPH_REGEX = /<p>(?:\s| |<br\s*\/?>)*<\/p>/gi;
|
|
30
|
+
var sanitizeHtml = function (html) {
|
|
31
|
+
if (!html)
|
|
32
|
+
return '';
|
|
33
|
+
return dompurify_1.default.sanitize(html, {
|
|
34
|
+
ALLOWED_TAGS: ALLOWED_TAGS,
|
|
35
|
+
ALLOWED_ATTR: ALLOWED_ATTR,
|
|
36
|
+
KEEP_CONTENT: true,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.sanitizeHtml = sanitizeHtml;
|
|
40
|
+
/**
|
|
41
|
+
* TipTap HTML → dışarı verilen HTML
|
|
42
|
+
* Boş paragraflar (Enter + yazı yok) <br> olur.
|
|
43
|
+
* İçinde metin olan paragraflar <p> olarak kalır.
|
|
44
|
+
*/
|
|
45
|
+
var serializeEditorHtml = function (html) {
|
|
46
|
+
var sanitized = (0, exports.sanitizeHtml)(html);
|
|
47
|
+
if (!sanitized)
|
|
48
|
+
return '';
|
|
49
|
+
var serialized = sanitized.replace(EMPTY_PARAGRAPH_REGEX, '<br>');
|
|
50
|
+
if (/^(?:<br\s*\/?>|\s)*$/i.test(serialized)) {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
return serialized;
|
|
54
|
+
};
|
|
55
|
+
exports.serializeEditorHtml = serializeEditorHtml;
|
|
56
|
+
/**
|
|
57
|
+
* Dışarıdan gelen HTML → TipTap'in düzenleyebileceği HTML
|
|
58
|
+
* Blok seviyesindeki <br> etiketleri boş <p> olur (Enter satırı).
|
|
59
|
+
* <p> içindeki <br> hard-break olarak kalır.
|
|
60
|
+
*/
|
|
61
|
+
var prepareEditorHtml = function (html) {
|
|
62
|
+
var sanitized = (0, exports.sanitizeHtml)(html);
|
|
63
|
+
if (!sanitized)
|
|
64
|
+
return '';
|
|
65
|
+
if (typeof DOMParser === 'undefined') {
|
|
66
|
+
return sanitized;
|
|
67
|
+
}
|
|
68
|
+
var parser = new DOMParser();
|
|
69
|
+
var doc = parser.parseFromString("<div id=\"rte-root\">".concat(sanitized, "</div>"), 'text/html');
|
|
70
|
+
var root = doc.getElementById('rte-root');
|
|
71
|
+
if (!root)
|
|
72
|
+
return sanitized;
|
|
73
|
+
var replaceBlockBreaks = function (parent) {
|
|
74
|
+
Array.from(parent.childNodes).forEach(function (child) {
|
|
75
|
+
if (child.nodeType !== Node.ELEMENT_NODE)
|
|
76
|
+
return;
|
|
77
|
+
var element = child;
|
|
78
|
+
var tag = element.tagName;
|
|
79
|
+
if (tag === 'BR') {
|
|
80
|
+
var emptyParagraph = doc.createElement('p');
|
|
81
|
+
parent.replaceChild(emptyParagraph, element);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (tag === 'P' || tag === 'SPAN') {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (tag === 'LI' || tag === 'UL' || tag === 'OL' || tag === 'DIV') {
|
|
88
|
+
replaceBlockBreaks(element);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
replaceBlockBreaks(root);
|
|
93
|
+
return (0, exports.sanitizeHtml)(root.innerHTML);
|
|
94
|
+
};
|
|
95
|
+
exports.prepareEditorHtml = prepareEditorHtml;
|
|
@@ -55,6 +55,6 @@ var ShoppingCartProduct = function (_a) {
|
|
|
55
55
|
var showUpfrontProductPriceLoading = insuranceType === 3 && upfrontAddonChecked && hasUpfrontAddonPriceLoading;
|
|
56
56
|
var hasUpfrontAddonDiscount = Boolean(upfrontAddonOldPrice);
|
|
57
57
|
var hasInsurancePointer = !hasLoading && insuranceType === 1 && Boolean(toggleInsurance);
|
|
58
|
-
return ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ShoppingCartProductStyled, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductInner, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductImage, { children: (0, jsx_runtime_1.jsx)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: image })) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductText, { children: (0, jsx_runtime_1.jsxs)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductTitle, { children: title }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductPriceContent, __assign({ "$discountRate": discountRate }, { children: [discountRate > 0 && (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductDiscountRate, { children: ["%", discountRate] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductPriceStack, { children: showUpfrontProductPriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [oldPrice && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductOldPrice, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductOldPriceAmount, { children: [oldPrice, oldPriceSm && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductOldPriceSmall, { children: oldPriceSm })] }), oldPricePeriod && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductOldPricePeriod, { children: "/".concat(oldPricePeriod) }))] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductNewPrice, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductNewPriceAmount, { children: [price, priceSm && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductNewPriceSmall, { children: priceSm })] }), period && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductNewPricePeriod, { children: "/".concat(period) })] })] })) })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductDeliveryText, { children: [deliveryDangerText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductDeliveryDanger, { children: deliveryDangerText })), deliveryText] })] })) }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: "upfront-addon" }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: "upfront-addon", size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, " ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonOldPrice, { children: upfrontAddonOldPrice })] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: ["yerine \u015Fimdi", " ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] })] })) : ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, upfrontAddonPrice && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] }))] })) }))] })) }))] }));
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ShoppingCartProductStyled, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductInner, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductImage, { children: (0, jsx_runtime_1.jsx)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: image })) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductText, { children: (0, jsx_runtime_1.jsxs)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductTitle, { children: title }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductPriceContent, __assign({ "$discountRate": discountRate }, { children: [discountRate > 0 && (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductDiscountRate, { children: ["%", discountRate] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductPriceStack, __assign({ "$hasPriceLoading": showUpfrontProductPriceLoading }, { children: showUpfrontProductPriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [oldPrice && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductOldPrice, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductOldPriceAmount, { children: [oldPrice, oldPriceSm && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductOldPriceSmall, { children: oldPriceSm })] }), oldPricePeriod && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductOldPricePeriod, { children: "/".concat(oldPricePeriod) }))] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductNewPrice, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductNewPriceAmount, { children: [price, priceSm && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductNewPriceSmall, { children: priceSm })] }), period && (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductNewPricePeriod, { children: "/".concat(period) })] })] })) }))] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.ProductDeliveryText, { children: [deliveryDangerText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductDeliveryDanger, { children: deliveryDangerText })), deliveryText] })] })) }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: "upfront-addon" }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: "upfront-addon", size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, " ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonOldPrice, { children: upfrontAddonOldPrice })] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: ["yerine \u015Fimdi", " ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] })] })) : ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, upfrontAddonPrice && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" ", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] }))] })) }))] })) }))] }));
|
|
59
59
|
};
|
|
60
60
|
exports.default = ShoppingCartProduct;
|