diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index 1d653e9..a93e117 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -11,12 +11,177 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. Default: "Add label" +#: editor/schema +msgid "addLabel" +msgstr "" + +#. Default: "Always show the content label tooltip." +#: editor/schema +msgid "alwaysShowDescription" +msgstr "" + +#. Default: "Always show tooltip" +#: editor/schema +msgid "alwaysShowTitle" +msgstr "" + +#. Default: "Down" +#: editor/schema +msgid "down" +msgstr "" + +#. Default: "Edit label" #: editor/index -# defaultMessage: Edit label -msgid "Edit label" +msgid "editLabel" +msgstr "Label bearbeiten" + +#. Default: "Extra wide" +#: editor/schema +msgid "extraWide" +msgstr "" + +#. Default: "High importance" +#: editor/schema +msgid "highImportance" +msgstr "" + +#. Default: "Highlight" +#: editor/schema +msgid "highlight" +msgstr "" + +#. Default: "Label pointing" +#: editor/schema +msgid "labelPointing" msgstr "" +#. Default: "Choose an orientation or leave the default value (No value)." +#: editor/schema +msgid "labelPointingDescription" +msgstr "" + +#. Default: "Type of label" +#: editor/schema +msgid "labelType" +msgstr "" + +#. Default: "Choose a type or leave the default value (Simple)." +#: editor/schema +msgid "labelTypeDescription" +msgstr "" + +#. Default: "Left" +#: editor/schema +msgid "left" +msgstr "" + +#. Default: "Medium importance" +#: editor/schema +msgid "mediumImportance" +msgstr "" + +#. Default: "Remove label" #: editor/index -# defaultMessage: Remove label -msgid "Remove label" +msgid "removeLabel" +msgstr "Label entfernen" + +#. Default: "Right" +#: editor/schema +msgid "right" +msgstr "" + +#. Default: "Show the content label tooltip on hover." +#: editor/schema +msgid "showOnHoverDescription" +msgstr "" + +#. Default: "Show tooltip on hover" +#: editor/schema +msgid "showOnHoverTitle" +msgstr "" + +#. Default: "Simple" +#: editor/schema +msgid "simple" +msgstr "" + +#. Default: "Tooltip" +#: editor/schema +msgid "tooltip" +msgstr "" + +#. Default: "Tooltip content" +#: editor/schema +msgid "tooltipContent" +msgstr "Tooltip-Inhalt" + +#. Default: "Enter the text you want to display in the tooltip." +#: editor/schema +msgid "tooltipContentDescription" +msgstr "Geben Sie den Text ein der im Tooltip angezeigt werden soll." + +#. Default: "Bottom center" +#: editor/schema +msgid "tooltipPointingBottomCenter" +msgstr "" + +#. Default: "Bottom left" +#: editor/schema +msgid "tooltipPointingBottomLeft" +msgstr "" + +#. Default: "Bottom right" +#: editor/schema +msgid "tooltipPointingBottomRight" +msgstr "" + +#. Default: "Left center" +#: editor/schema +msgid "tooltipPointingLeftCenter" +msgstr "" + +#. Default: "Right center" +#: editor/schema +msgid "tooltipPointingRightCenter" +msgstr "" + +#. Default: "Tooltip position" +#: editor/schema +msgid "tooltipPointingTitle" +msgstr "" + +#. Default: "Top center" +#: editor/schema +msgid "tooltipPointingTopCenter" +msgstr "" + +#. Default: "Top left" +#: editor/schema +msgid "tooltipPointingTopLeft" +msgstr "" + +#. Default: "Top right" +#: editor/schema +msgid "tooltipPointingTopRight" +msgstr "" + +#. Default: "Tooltip size" +#: editor/schema +msgid "tooltipSizeTitle" +msgstr "" + +#. Default: "Tooltip type" +#: editor/schema +msgid "tooltipTypeTitle" +msgstr "" + +#. Default: "Up" +#: editor/schema +msgid "up" +msgstr "" + +#. Default: "Wide" +#: editor/schema +msgid "wide" msgstr "" diff --git a/locales/en/LC_MESSAGES/volto.po b/locales/en/LC_MESSAGES/volto.po index 1d653e9..eda1c59 100644 --- a/locales/en/LC_MESSAGES/volto.po +++ b/locales/en/LC_MESSAGES/volto.po @@ -11,12 +11,177 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. Default: "Add label" +#: editor/schema +msgid "addLabel" +msgstr "" + +#. Default: "Always show the content label tooltip." +#: editor/schema +msgid "alwaysShowDescription" +msgstr "" + +#. Default: "Always show tooltip" +#: editor/schema +msgid "alwaysShowTitle" +msgstr "" + +#. Default: "Down" +#: editor/schema +msgid "down" +msgstr "" + +#. Default: "Edit label" #: editor/index -# defaultMessage: Edit label -msgid "Edit label" +msgid "editLabel" msgstr "" +#. Default: "Extra wide" +#: editor/schema +msgid "extraWide" +msgstr "" + +#. Default: "High importance" +#: editor/schema +msgid "highImportance" +msgstr "" + +#. Default: "Highlight" +#: editor/schema +msgid "highlight" +msgstr "" + +#. Default: "Label pointing" +#: editor/schema +msgid "labelPointing" +msgstr "" + +#. Default: "Choose an orientation or leave the default value (No value)." +#: editor/schema +msgid "labelPointingDescription" +msgstr "" + +#. Default: "Type of label" +#: editor/schema +msgid "labelType" +msgstr "" + +#. Default: "Choose a type or leave the default value (Simple)." +#: editor/schema +msgid "labelTypeDescription" +msgstr "" + +#. Default: "Left" +#: editor/schema +msgid "left" +msgstr "" + +#. Default: "Medium importance" +#: editor/schema +msgid "mediumImportance" +msgstr "" + +#. Default: "Remove label" #: editor/index -# defaultMessage: Remove label -msgid "Remove label" +msgid "removeLabel" +msgstr "" + +#. Default: "Right" +#: editor/schema +msgid "right" +msgstr "" + +#. Default: "Show the content label tooltip on hover." +#: editor/schema +msgid "showOnHoverDescription" +msgstr "" + +#. Default: "Show tooltip on hover" +#: editor/schema +msgid "showOnHoverTitle" +msgstr "" + +#. Default: "Simple" +#: editor/schema +msgid "simple" +msgstr "" + +#. Default: "Tooltip" +#: editor/schema +msgid "tooltip" +msgstr "" + +#. Default: "Tooltip content" +#: editor/schema +msgid "tooltipContent" +msgstr "" + +#. Default: "Enter the text you want to display in the tooltip." +#: editor/schema +msgid "tooltipContentDescription" +msgstr "" + +#. Default: "Bottom center" +#: editor/schema +msgid "tooltipPointingBottomCenter" +msgstr "" + +#. Default: "Bottom left" +#: editor/schema +msgid "tooltipPointingBottomLeft" +msgstr "" + +#. Default: "Bottom right" +#: editor/schema +msgid "tooltipPointingBottomRight" +msgstr "" + +#. Default: "Left center" +#: editor/schema +msgid "tooltipPointingLeftCenter" +msgstr "" + +#. Default: "Right center" +#: editor/schema +msgid "tooltipPointingRightCenter" +msgstr "" + +#. Default: "Tooltip position" +#: editor/schema +msgid "tooltipPointingTitle" +msgstr "" + +#. Default: "Top center" +#: editor/schema +msgid "tooltipPointingTopCenter" +msgstr "" + +#. Default: "Top left" +#: editor/schema +msgid "tooltipPointingTopLeft" +msgstr "" + +#. Default: "Top right" +#: editor/schema +msgid "tooltipPointingTopRight" +msgstr "" + +#. Default: "Tooltip size" +#: editor/schema +msgid "tooltipSizeTitle" +msgstr "" + +#. Default: "Tooltip type" +#: editor/schema +msgid "tooltipTypeTitle" +msgstr "" + +#. Default: "Up" +#: editor/schema +msgid "up" +msgstr "" + +#. Default: "Wide" +#: editor/schema +msgid "wide" msgstr "" diff --git a/locales/it/LC_MESSAGES/volto.po b/locales/it/LC_MESSAGES/volto.po index 1d653e9..eda1c59 100644 --- a/locales/it/LC_MESSAGES/volto.po +++ b/locales/it/LC_MESSAGES/volto.po @@ -11,12 +11,177 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. Default: "Add label" +#: editor/schema +msgid "addLabel" +msgstr "" + +#. Default: "Always show the content label tooltip." +#: editor/schema +msgid "alwaysShowDescription" +msgstr "" + +#. Default: "Always show tooltip" +#: editor/schema +msgid "alwaysShowTitle" +msgstr "" + +#. Default: "Down" +#: editor/schema +msgid "down" +msgstr "" + +#. Default: "Edit label" #: editor/index -# defaultMessage: Edit label -msgid "Edit label" +msgid "editLabel" msgstr "" +#. Default: "Extra wide" +#: editor/schema +msgid "extraWide" +msgstr "" + +#. Default: "High importance" +#: editor/schema +msgid "highImportance" +msgstr "" + +#. Default: "Highlight" +#: editor/schema +msgid "highlight" +msgstr "" + +#. Default: "Label pointing" +#: editor/schema +msgid "labelPointing" +msgstr "" + +#. Default: "Choose an orientation or leave the default value (No value)." +#: editor/schema +msgid "labelPointingDescription" +msgstr "" + +#. Default: "Type of label" +#: editor/schema +msgid "labelType" +msgstr "" + +#. Default: "Choose a type or leave the default value (Simple)." +#: editor/schema +msgid "labelTypeDescription" +msgstr "" + +#. Default: "Left" +#: editor/schema +msgid "left" +msgstr "" + +#. Default: "Medium importance" +#: editor/schema +msgid "mediumImportance" +msgstr "" + +#. Default: "Remove label" #: editor/index -# defaultMessage: Remove label -msgid "Remove label" +msgid "removeLabel" +msgstr "" + +#. Default: "Right" +#: editor/schema +msgid "right" +msgstr "" + +#. Default: "Show the content label tooltip on hover." +#: editor/schema +msgid "showOnHoverDescription" +msgstr "" + +#. Default: "Show tooltip on hover" +#: editor/schema +msgid "showOnHoverTitle" +msgstr "" + +#. Default: "Simple" +#: editor/schema +msgid "simple" +msgstr "" + +#. Default: "Tooltip" +#: editor/schema +msgid "tooltip" +msgstr "" + +#. Default: "Tooltip content" +#: editor/schema +msgid "tooltipContent" +msgstr "" + +#. Default: "Enter the text you want to display in the tooltip." +#: editor/schema +msgid "tooltipContentDescription" +msgstr "" + +#. Default: "Bottom center" +#: editor/schema +msgid "tooltipPointingBottomCenter" +msgstr "" + +#. Default: "Bottom left" +#: editor/schema +msgid "tooltipPointingBottomLeft" +msgstr "" + +#. Default: "Bottom right" +#: editor/schema +msgid "tooltipPointingBottomRight" +msgstr "" + +#. Default: "Left center" +#: editor/schema +msgid "tooltipPointingLeftCenter" +msgstr "" + +#. Default: "Right center" +#: editor/schema +msgid "tooltipPointingRightCenter" +msgstr "" + +#. Default: "Tooltip position" +#: editor/schema +msgid "tooltipPointingTitle" +msgstr "" + +#. Default: "Top center" +#: editor/schema +msgid "tooltipPointingTopCenter" +msgstr "" + +#. Default: "Top left" +#: editor/schema +msgid "tooltipPointingTopLeft" +msgstr "" + +#. Default: "Top right" +#: editor/schema +msgid "tooltipPointingTopRight" +msgstr "" + +#. Default: "Tooltip size" +#: editor/schema +msgid "tooltipSizeTitle" +msgstr "" + +#. Default: "Tooltip type" +#: editor/schema +msgid "tooltipTypeTitle" +msgstr "" + +#. Default: "Up" +#: editor/schema +msgid "up" +msgstr "" + +#. Default: "Wide" +#: editor/schema +msgid "wide" msgstr "" diff --git a/locales/ro/LC_MESSAGES/volto.po b/locales/ro/LC_MESSAGES/volto.po index 1d653e9..eda1c59 100644 --- a/locales/ro/LC_MESSAGES/volto.po +++ b/locales/ro/LC_MESSAGES/volto.po @@ -11,12 +11,177 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. Default: "Add label" +#: editor/schema +msgid "addLabel" +msgstr "" + +#. Default: "Always show the content label tooltip." +#: editor/schema +msgid "alwaysShowDescription" +msgstr "" + +#. Default: "Always show tooltip" +#: editor/schema +msgid "alwaysShowTitle" +msgstr "" + +#. Default: "Down" +#: editor/schema +msgid "down" +msgstr "" + +#. Default: "Edit label" #: editor/index -# defaultMessage: Edit label -msgid "Edit label" +msgid "editLabel" msgstr "" +#. Default: "Extra wide" +#: editor/schema +msgid "extraWide" +msgstr "" + +#. Default: "High importance" +#: editor/schema +msgid "highImportance" +msgstr "" + +#. Default: "Highlight" +#: editor/schema +msgid "highlight" +msgstr "" + +#. Default: "Label pointing" +#: editor/schema +msgid "labelPointing" +msgstr "" + +#. Default: "Choose an orientation or leave the default value (No value)." +#: editor/schema +msgid "labelPointingDescription" +msgstr "" + +#. Default: "Type of label" +#: editor/schema +msgid "labelType" +msgstr "" + +#. Default: "Choose a type or leave the default value (Simple)." +#: editor/schema +msgid "labelTypeDescription" +msgstr "" + +#. Default: "Left" +#: editor/schema +msgid "left" +msgstr "" + +#. Default: "Medium importance" +#: editor/schema +msgid "mediumImportance" +msgstr "" + +#. Default: "Remove label" #: editor/index -# defaultMessage: Remove label -msgid "Remove label" +msgid "removeLabel" +msgstr "" + +#. Default: "Right" +#: editor/schema +msgid "right" +msgstr "" + +#. Default: "Show the content label tooltip on hover." +#: editor/schema +msgid "showOnHoverDescription" +msgstr "" + +#. Default: "Show tooltip on hover" +#: editor/schema +msgid "showOnHoverTitle" +msgstr "" + +#. Default: "Simple" +#: editor/schema +msgid "simple" +msgstr "" + +#. Default: "Tooltip" +#: editor/schema +msgid "tooltip" +msgstr "" + +#. Default: "Tooltip content" +#: editor/schema +msgid "tooltipContent" +msgstr "" + +#. Default: "Enter the text you want to display in the tooltip." +#: editor/schema +msgid "tooltipContentDescription" +msgstr "" + +#. Default: "Bottom center" +#: editor/schema +msgid "tooltipPointingBottomCenter" +msgstr "" + +#. Default: "Bottom left" +#: editor/schema +msgid "tooltipPointingBottomLeft" +msgstr "" + +#. Default: "Bottom right" +#: editor/schema +msgid "tooltipPointingBottomRight" +msgstr "" + +#. Default: "Left center" +#: editor/schema +msgid "tooltipPointingLeftCenter" +msgstr "" + +#. Default: "Right center" +#: editor/schema +msgid "tooltipPointingRightCenter" +msgstr "" + +#. Default: "Tooltip position" +#: editor/schema +msgid "tooltipPointingTitle" +msgstr "" + +#. Default: "Top center" +#: editor/schema +msgid "tooltipPointingTopCenter" +msgstr "" + +#. Default: "Top left" +#: editor/schema +msgid "tooltipPointingTopLeft" +msgstr "" + +#. Default: "Top right" +#: editor/schema +msgid "tooltipPointingTopRight" +msgstr "" + +#. Default: "Tooltip size" +#: editor/schema +msgid "tooltipSizeTitle" +msgstr "" + +#. Default: "Tooltip type" +#: editor/schema +msgid "tooltipTypeTitle" +msgstr "" + +#. Default: "Up" +#: editor/schema +msgid "up" +msgstr "" + +#. Default: "Wide" +#: editor/schema +msgid "wide" msgstr "" diff --git a/locales/volto.pot b/locales/volto.pot index de5fe22..40412ef 100644 --- a/locales/volto.pot +++ b/locales/volto.pot @@ -1,24 +1,189 @@ msgid "" msgstr "" "Project-Id-Version: Plone\n" -"POT-Creation-Date: 2023-08-29T17:14:51.219Z\n" +"POT-Creation-Date: 2025-01-31T16:15:13.353Z\n" "Last-Translator: Plone i18n \n" "Language-Team: Plone i18n \n" -"MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" "Language-Code: en\n" "Language-Name: English\n" "Preferred-Encodings: utf-8\n" "Domain: volto\n" +#. Default: "Add label" +#: editor/schema +msgid "addLabel" +msgstr "" + +#. Default: "Always show the content label tooltip." +#: editor/schema +msgid "alwaysShowDescription" +msgstr "" + +#. Default: "Always show tooltip" +#: editor/schema +msgid "alwaysShowTitle" +msgstr "" + +#. Default: "Down" +#: editor/schema +msgid "down" +msgstr "" + +#. Default: "Edit label" #: editor/index -# defaultMessage: Edit label -msgid "Edit label" +msgid "editLabel" +msgstr "" + +#. Default: "Extra wide" +#: editor/schema +msgid "extraWide" +msgstr "" + +#. Default: "High importance" +#: editor/schema +msgid "highImportance" +msgstr "" + +#. Default: "Highlight" +#: editor/schema +msgid "highlight" +msgstr "" + +#. Default: "Label pointing" +#: editor/schema +msgid "labelPointing" +msgstr "" + +#. Default: "Choose an orientation or leave the default value (No value)." +#: editor/schema +msgid "labelPointingDescription" +msgstr "" + +#. Default: "Type of label" +#: editor/schema +msgid "labelType" +msgstr "" + +#. Default: "Choose a type or leave the default value (Simple)." +#: editor/schema +msgid "labelTypeDescription" +msgstr "" + +#. Default: "Left" +#: editor/schema +msgid "left" msgstr "" +#. Default: "Medium importance" +#: editor/schema +msgid "mediumImportance" +msgstr "" + +#. Default: "Remove label" #: editor/index -# defaultMessage: Remove label -msgid "Remove label" +msgid "removeLabel" +msgstr "" + +#. Default: "Right" +#: editor/schema +msgid "right" +msgstr "" + +#. Default: "Show the content label tooltip on hover." +#: editor/schema +msgid "showOnHoverDescription" +msgstr "" + +#. Default: "Show tooltip on hover" +#: editor/schema +msgid "showOnHoverTitle" +msgstr "" + +#. Default: "Simple" +#: editor/schema +msgid "simple" +msgstr "" + +#. Default: "Tooltip" +#: editor/schema +msgid "tooltip" +msgstr "" + +#. Default: "Tooltip content" +#: editor/schema +msgid "tooltipContent" +msgstr "" + +#. Default: "Enter the text you want to display in the tooltip." +#: editor/schema +msgid "tooltipContentDescription" +msgstr "" + +#. Default: "Bottom center" +#: editor/schema +msgid "tooltipPointingBottomCenter" +msgstr "" + +#. Default: "Bottom left" +#: editor/schema +msgid "tooltipPointingBottomLeft" +msgstr "" + +#. Default: "Bottom right" +#: editor/schema +msgid "tooltipPointingBottomRight" +msgstr "" + +#. Default: "Left center" +#: editor/schema +msgid "tooltipPointingLeftCenter" +msgstr "" + +#. Default: "Right center" +#: editor/schema +msgid "tooltipPointingRightCenter" +msgstr "" + +#. Default: "Tooltip position" +#: editor/schema +msgid "tooltipPointingTitle" +msgstr "" + +#. Default: "Top center" +#: editor/schema +msgid "tooltipPointingTopCenter" +msgstr "" + +#. Default: "Top left" +#: editor/schema +msgid "tooltipPointingTopLeft" +msgstr "" + +#. Default: "Top right" +#: editor/schema +msgid "tooltipPointingTopRight" +msgstr "" + +#. Default: "Tooltip size" +#: editor/schema +msgid "tooltipSizeTitle" +msgstr "" + +#. Default: "Tooltip type" +#: editor/schema +msgid "tooltipTypeTitle" +msgstr "" + +#. Default: "Up" +#: editor/schema +msgid "up" +msgstr "" + +#. Default: "Wide" +#: editor/schema +msgid "wide" msgstr "" diff --git a/src/editor/index.js b/src/editor/index.js index 79bb4af..123ab06 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -1,5 +1,5 @@ import commentSVG from '@plone/volto/icons/comment.svg'; -import { defineMessages } from 'react-intl'; // , defineMessages +import { defineMessages, useIntl } from 'react-intl'; import { makeInlineElementPlugin } from '@plone/volto-slate/elementEditor'; @@ -12,15 +12,20 @@ import './styles.less'; const messages = defineMessages({ edit: { - id: 'Edit label', + id: 'editLabel', defaultMessage: 'Edit label', }, delete: { - id: 'Remove label', + id: 'removeLabel', defaultMessage: 'Remove label', }, }); +const SchemaProvider = ({ editSchema, children }) => { + const intl = useIntl(); + return children(editSchema({ intl })); +}; + export default function install(config) { const opts = { title: 'Label', @@ -28,6 +33,7 @@ export default function install(config) { elementType: LABEL, element: LabelElement, isInlineElement: true, + schemaProvider: SchemaProvider, editSchema: LabelEditorSchema, extensions: [withLabel, withBeforeInsertFragment], hasValue: (formData) => !!formData, diff --git a/src/editor/schema.js b/src/editor/schema.js index 471adae..e3df0d8 100644 --- a/src/editor/schema.js +++ b/src/editor/schema.js @@ -1,104 +1,258 @@ -export const LabelEditorSchema = { - title: 'Add label', - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['label_type', 'label_pointing'], - }, - { - id: 'tooltip', - title: 'Tooltip', - fields: [ - 'tooltip_content', - 'tooltip_pointing', - 'tooltip_type', - 'tooltip_size', - 'always_show', - 'show_on_hover', - ], - }, - ], - properties: { - label_type: { - title: 'Type of label', - type: 'string', - factory: 'Choice', - choices: [ - ['simple', 'Simple'], - ['medium', 'Medium importance'], - ['high', 'High importance'], - ['highlight', 'Highlight'], - ], - default: 'simple', - description: 'Choose a type or leave the default value (Simple).', - required: true, - noValueOption: false, - }, - label_pointing: { - title: 'Label pointing', - type: 'string', - factory: 'Choice', - choices: [ - ['pointing', 'Up'], - ['right pointing', 'Right'], - ['left pointing', 'Left'], - ['pointing below', 'Down'], - ], - description: - 'Choose an orientation or leave the default value (No value).', - }, - tooltip_content: { - title: 'Tooltip content', - widget: 'slate', - description: 'Enter the text you want to display in the tooltip.', - }, - tooltip_pointing: { - title: 'Tooltip position', - type: 'string', - factory: 'Choice', - choices: [ - ['top center', 'top center'], - ['top left', 'top left'], - ['top right', 'top right'], - ['bottom center', 'bottom center'], - ['bottom left', 'bottom left'], - ['bottom right', 'bottom right'], - ['right center', 'right center'], - ['left center', 'left center'], - ], - }, - tooltip_type: { - title: 'Tooltip type', - type: 'string', - factory: 'Choice', - choices: [ - ['medium', 'Medium importance'], - ['high', 'High importance'], - ['highlight', 'Highlight'], - ], - default: '', - }, - tooltip_size: { - title: 'Tooltip size', - type: 'string', - factory: 'Choice', - choices: [ - ['wide', 'Wide'], - ['extra', 'Extra wide'], - ], - default: '', - }, - always_show: { - title: 'Always show tooltip', - description: 'Always show the content label tooltip.', - type: 'boolean', - }, - show_on_hover: { - title: 'Show tooltip on hover', - description: 'Show the content label tooltip on hover.', - type: 'boolean', - }, +import { defineMessages } from 'react-intl'; + +const messages = defineMessages({ + addLabel: { + id: 'addLabel', + defaultMessage: 'Add label', + }, + labelType: { + id: 'labelType', + defaultMessage: 'Type of label', + }, + tooltip: { + id: 'tooltip', + defaultMessage: 'Tooltip', + }, + tooltipContent: { + id: 'tooltipContent', + defaultMessage: 'Tooltip content', + }, + tooltipContentDescription: { + id: 'tooltipContentDescription', + defaultMessage: 'Enter the text you want to display in the tooltip.', + }, + simple: { + id: 'simple', + defaultMessage: 'Simple', + }, + mediumImportance: { + id: 'mediumImportance', + defaultMessage: 'Medium importance', + }, + highImportance: { + id: 'highImportance', + defaultMessage: 'High importance', + }, + highlight: { + id: 'highlight', + defaultMessage: 'Highlight', + }, + labelTypeDescription: { + id: 'labelTypeDescription', + defaultMessage: 'Choose a type or leave the default value (Simple).', + }, + labelPointing: { + id: 'labelPointing', + defaultMessage: 'Label pointing', + }, + labelPointingDescription: { + id: 'labelPointingDescription', + defaultMessage: + 'Choose an orientation or leave the default value (No value).', + }, + up: { + id: 'up', + defaultMessage: 'Up', }, - required: [], + right: { + id: 'right', + defaultMessage: 'Right', + }, + left: { + id: 'left', + defaultMessage: 'Left', + }, + down: { + id: 'down', + defaultMessage: 'Down', + }, + tooltipPointingTitle: { + id: 'tooltipPointingTitle', + defaultMessage: 'Tooltip position', + }, + tooltipPointingTopCenter: { + id: 'tooltipPointingTopCenter', + defaultMessage: 'Top center', + }, + tooltipPointingTopLeft: { + id: 'tooltipPointingTopLeft', + defaultMessage: 'Top left', + }, + tooltipPointingTopRight: { + id: 'tooltipPointingTopRight', + defaultMessage: 'Top right', + }, + tooltipPointingBottomCenter: { + id: 'tooltipPointingBottomCenter', + defaultMessage: 'Bottom center', + }, + tooltipPointingBottomLeft: { + id: 'tooltipPointingBottomLeft', + defaultMessage: 'Bottom left', + }, + tooltipPointingBottomRight: { + id: 'tooltipPointingBottomRight', + defaultMessage: 'Bottom right', + }, + tooltipPointingRightCenter: { + id: 'tooltipPointingRightCenter', + defaultMessage: 'Right center', + }, + tooltipPointingLeftCenter: { + id: 'tooltipPointingLeftCenter', + defaultMessage: 'Left center', + }, + tooltipTypeTitle: { + id: 'tooltipTypeTitle', + defaultMessage: 'Tooltip type', + }, + tooltipSizeTitle: { + id: 'tooltipSizeTitle', + defaultMessage: 'Tooltip size', + }, + wide: { + id: 'wide', + defaultMessage: 'Wide', + }, + extraWide: { + id: 'extraWide', + defaultMessage: 'Extra wide', + }, + alwaysShowTitle: { + id: 'alwaysShowTitle', + defaultMessage: 'Always show tooltip', + }, + alwaysShowDescription: { + id: 'alwaysShowDescription', + defaultMessage: 'Always show the content label tooltip.', + }, + showOnHoverTitle: { + id: 'showOnHoverTitle', + defaultMessage: 'Show tooltip on hover', + }, + showOnHoverDescription: { + id: 'showOnHoverDescription', + defaultMessage: 'Show the content label tooltip on hover.', + }, +}); + +export const LabelEditorSchema = ({ intl }) => { + return { + title: intl.formatMessage(messages.addLabel), + fieldsets: [ + { + id: 'default', + title: 'Default', + fields: ['label_type', 'label_pointing'], + }, + { + id: 'tooltip', + title: intl.formatMessage(messages.tooltip), + fields: [ + 'tooltip_content', + 'tooltip_pointing', + 'tooltip_type', + 'tooltip_size', + 'always_show', + 'show_on_hover', + ], + }, + ], + properties: { + label_type: { + title: intl.formatMessage(messages.labelType), + type: 'string', + factory: 'Choice', + choices: [ + ['simple', intl.formatMessage(messages.simple)], + ['medium', intl.formatMessage(messages.mediumImportance)], + ['high', intl.formatMessage(messages.highImportance)], + ['highlight', intl.formatMessage(messages.highlight)], + ], + default: 'simple', + description: intl.formatMessage(messages.labelTypeDescription), + required: true, + noValueOption: false, + }, + label_pointing: { + title: intl.formatMessage(messages.labelPointing), + type: 'string', + factory: 'Choice', + choices: [ + ['pointing', intl.formatMessage(messages.up)], + ['right pointing', intl.formatMessage(messages.right)], + ['left pointing', intl.formatMessage(messages.left)], + ['pointing below', intl.formatMessage(messages.down)], + ], + description: intl.formatMessage(messages.labelPointingDescription), + }, + tooltip_content: { + title: intl.formatMessage(messages.tooltipContent), + widget: 'slate', + description: intl.formatMessage(messages.tooltipContentDescription), + }, + tooltip_pointing: { + title: intl.formatMessage(messages.tooltipPointingTitle), + type: 'string', + factory: 'Choice', + choices: [ + ['top center', intl.formatMessage(messages.tooltipPointingTopCenter)], + ['top left', intl.formatMessage(messages.tooltipPointingTopLeft)], + ['top right', intl.formatMessage(messages.tooltipPointingTopRight)], + [ + 'bottom center', + intl.formatMessage(messages.tooltipPointingBottomCenter), + ], + [ + 'bottom left', + intl.formatMessage(messages.tooltipPointingBottomLeft), + ], + [ + 'bottom right', + intl.formatMessage(messages.tooltipPointingBottomRight), + ], + [ + 'right center', + intl.formatMessage(messages.tooltipPointingRightCenter), + ], + [ + 'left center', + intl.formatMessage(messages.tooltipPointingLeftCenter), + ], + ], + }, + tooltip_type: { + title: intl.formatMessage(messages.tooltipTypeTitle), + type: 'string', + factory: 'Choice', + choices: [ + ['medium', intl.formatMessage(messages.mediumImportance)], + ['high', intl.formatMessage(messages.highImportance)], + ['highlight', intl.formatMessage(messages.highlight)], + ], + default: '', + }, + tooltip_size: { + title: intl.formatMessage(messages.tooltipSizeTitle), + type: 'string', + factory: 'Choice', + choices: [ + ['wide', intl.formatMessage(messages.wide)], + ['extra', intl.formatMessage(messages.extraWide)], + ], + default: '', + }, + always_show: { + title: intl.formatMessage(messages.alwaysShowTitle), + description: intl.formatMessage(messages.alwaysShowDescription), + type: 'boolean', + }, + show_on_hover: { + title: intl.formatMessage(messages.showOnHoverTitle), + description: intl.formatMessage(messages.showOnHoverDescription), + type: 'boolean', + }, + }, + required: [], + }; };