@onereach/ui-components 18.4.1 → 18.4.2

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.
Files changed (23) hide show
  1. package/dist/bundled/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  2. package/dist/bundled/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +3 -7
  3. package/dist/bundled/components/OrRichTextEditorV3/index.js +1 -1
  4. package/dist/bundled/components/OrRichTextEditorV3/props.d.ts +32 -0
  5. package/dist/bundled/components/OrRichTextEditorV3/props.js +1 -1
  6. package/dist/bundled/components/OrRichTextEditorV3/styles.js +1 -1
  7. package/dist/bundled/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  8. package/dist/bundled/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  9. package/dist/bundled/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  10. package/dist/bundled/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  11. package/dist/bundled/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  12. package/dist/bundled/components/{OrRichTextEditorV3-e736de20.js → OrRichTextEditorV3-d8f48d58.js} +55 -47
  13. package/dist/bundled/components/index.js +1 -1
  14. package/dist/bundled/index.js +1 -1
  15. package/dist/esm/components/index.js +1 -1
  16. package/dist/esm/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +3 -7
  17. package/dist/esm/components/or-rich-text-editor-v3/index.js +55 -47
  18. package/dist/esm/components/or-rich-text-editor-v3/props.d.ts +32 -0
  19. package/dist/esm/index.js +1 -1
  20. package/package.json +3 -3
  21. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +37 -63
  22. package/src/components/or-rich-text-editor-v3/props.ts +34 -0
  23. package/src/types/Item.ts +0 -1
@@ -1 +1 @@
1
- export { s as default } from '../OrRichTextEditorV3-e736de20.js';
1
+ export { s as default } from '../OrRichTextEditorV3-d8f48d58.js';
@@ -1,7 +1,7 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { Level } from '@tiptap/extension-heading';
3
3
  import { ComponentPublicInstance, PropType } from 'vue';
4
- import { Formats, Tools } from './props';
4
+ import { Formats, Tools, RichTextEditorIcons, RichTextEditorTooltips } from './props';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  modelValue: {
7
7
  type: StringConstructor;
@@ -62,17 +62,13 @@ declare const _default: import("vue").DefineComponent<{
62
62
  textareaRef: import("vue").Ref<HTMLTextAreaElement | undefined>;
63
63
  moreRef: import("vue").Ref<any>;
64
64
  menuRef: import("vue").Ref<any>;
65
- iconsEnum: import("vue").Ref<{
66
- [key: string]: string;
67
- }>;
68
65
  handleToolbarClick: (item: string, level?: number) => void;
69
66
  handleEditorClick: () => void;
70
67
  isActive: import("vue").Ref<{
71
68
  [key: string]: boolean;
72
69
  }>;
73
- iconTooltipsEnum: import("vue").Ref<{
74
- [key: string]: string;
75
- }>;
70
+ getRichTextEditorIcon: import("vue").ComputedRef<(item: string) => RichTextEditorIcons>;
71
+ getRichTextEditorTooltipIcon: import("vue").ComputedRef<(item: string) => RichTextEditorTooltips>;
76
72
  getIndexOfHeading: import("vue").ComputedRef<number>;
77
73
  headingLevels: Level[];
78
74
  headingIcon: import("vue").ComputedRef<string>;
@@ -1 +1 @@
1
- export { F as Formats, s as OrRichTextEditorV3 } from '../OrRichTextEditorV3-e736de20.js';
1
+ export { F as Formats, s as OrRichTextEditorV3, R as RichTextEditorIcons, a as RichTextEditorTooltips } from '../OrRichTextEditorV3-d8f48d58.js';
@@ -3,3 +3,35 @@ export declare enum Formats {
3
3
  Markup = "markup"
4
4
  }
5
5
  export type Tools = string[][];
6
+ export declare enum RichTextEditorIcons {
7
+ bold = "format_bold",
8
+ italic = "format_italic",
9
+ underline = "format_underlined",
10
+ strike = "format_strikethrough",
11
+ bulletList = "format_list_bulleted",
12
+ orderedList = "format_list_numbered",
13
+ link = "link",
14
+ highlight = "highlight",
15
+ redo = "redo",
16
+ undo = "undo",
17
+ codeBlock = "code_blocks",
18
+ blockquote = "format_quote",
19
+ file = "attach_file",
20
+ source = "source_notes"
21
+ }
22
+ export declare enum RichTextEditorTooltips {
23
+ bold = "Bold",
24
+ italic = "Italic",
25
+ underline = "Underline",
26
+ strike = "Strike",
27
+ bulletList = "Bulleted List",
28
+ orderedList = "Numbered List",
29
+ link = "Link",
30
+ highlight = "Highlight",
31
+ redo = "Redo",
32
+ undo = "Undo",
33
+ codeBlock = "Code Block",
34
+ blockquote = "Quote",
35
+ file = "File",
36
+ source = "Source"
37
+ }
@@ -1 +1 @@
1
- export { F as Formats } from '../OrRichTextEditorV3-e736de20.js';
1
+ export { F as Formats, R as RichTextEditorIcons, a as RichTextEditorTooltips } from '../OrRichTextEditorV3-d8f48d58.js';
@@ -1 +1 @@
1
- export { R as RichTextEditor, c as RichTextEditorControl, a as RichTextEditorToolbar, b as RichTextEditorToolbarGroup } from '../OrRichTextEditorV3-e736de20.js';
1
+ export { b as RichTextEditor, e as RichTextEditorControl, c as RichTextEditorToolbar, d as RichTextEditorToolbarGroup } from '../OrRichTextEditorV3-d8f48d58.js';
@@ -1,2 +1,2 @@
1
- export { f as default } from '../../../OrRichTextEditorV3-e736de20.js';
1
+ export { h as default } from '../../../OrRichTextEditorV3-d8f48d58.js';
2
2
  import '../../../OrCode-091c4960.js';
@@ -1,2 +1,2 @@
1
- export { C as default } from '../../../OrRichTextEditorV3-e736de20.js';
1
+ export { C as default } from '../../../OrRichTextEditorV3-d8f48d58.js';
2
2
  import '../../../OrCode-091c4960.js';
@@ -1 +1 @@
1
- export { C as CodeMirrorView } from '../../../OrRichTextEditorV3-e736de20.js';
1
+ export { C as CodeMirrorView } from '../../../OrRichTextEditorV3-d8f48d58.js';
@@ -1,3 +1,3 @@
1
1
  import '../../../OrCode-091c4960.js';
2
2
  import '../../../../hooks/useTheme.js';
3
- export { d as color, t as default, e as orCodeHighlightStyle, o as orCodeTheme } from '../../../OrRichTextEditorV3-e736de20.js';
3
+ export { f as color, t as default, g as orCodeHighlightStyle, o as orCodeTheme } from '../../../OrRichTextEditorV3-d8f48d58.js';
@@ -1 +1 @@
1
- export { h as deserialize, g as serialize } from '../../OrRichTextEditorV3-e736de20.js';
1
+ export { j as deserialize, i as serialize } from '../../OrRichTextEditorV3-d8f48d58.js';
@@ -1,4 +1,4 @@
1
- import { defineComponent, shallowRef, ref, computed, onMounted, onBeforeUnmount, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, createElementVNode, Fragment as Fragment$1, renderList, withDirectives, vShow, vModelText } from 'vue';
1
+ import { defineComponent, shallowRef, ref, onMounted, onBeforeUnmount, computed, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, createElementVNode, Fragment as Fragment$1, renderList, withDirectives, vShow, vModelText } from 'vue';
2
2
  import { s as styleInject } from './OrAvatar-96c4b4c5.js';
3
3
  import { f as keyName, g as base, E as EditorView$1, H as HighlightStyle, t as tags, s as syntaxHighlighting, a as EditorState$1, m as highlightActiveLine, n as highlightActiveLineGutter, o as lineNumbers, k as keymap$1, p as minimalSetup, j as javascript } from './OrCode-091c4960.js';
4
4
  import { q as useResizeObserver, s as useDebounceFn, o as onClickOutside } from './OrAutocompleteV3-693d8511.js';
@@ -21094,6 +21094,40 @@ var Formats;
21094
21094
  Formats["Markdown"] = "markdown";
21095
21095
  Formats["Markup"] = "markup";
21096
21096
  })(Formats || (Formats = {}));
21097
+ var RichTextEditorIcons;
21098
+ (function (RichTextEditorIcons) {
21099
+ RichTextEditorIcons["bold"] = "format_bold";
21100
+ RichTextEditorIcons["italic"] = "format_italic";
21101
+ RichTextEditorIcons["underline"] = "format_underlined";
21102
+ RichTextEditorIcons["strike"] = "format_strikethrough";
21103
+ RichTextEditorIcons["bulletList"] = "format_list_bulleted";
21104
+ RichTextEditorIcons["orderedList"] = "format_list_numbered";
21105
+ RichTextEditorIcons["link"] = "link";
21106
+ RichTextEditorIcons["highlight"] = "highlight";
21107
+ RichTextEditorIcons["redo"] = "redo";
21108
+ RichTextEditorIcons["undo"] = "undo";
21109
+ RichTextEditorIcons["codeBlock"] = "code_blocks";
21110
+ RichTextEditorIcons["blockquote"] = "format_quote";
21111
+ RichTextEditorIcons["file"] = "attach_file";
21112
+ RichTextEditorIcons["source"] = "source_notes";
21113
+ })(RichTextEditorIcons || (RichTextEditorIcons = {}));
21114
+ var RichTextEditorTooltips;
21115
+ (function (RichTextEditorTooltips) {
21116
+ RichTextEditorTooltips["bold"] = "Bold";
21117
+ RichTextEditorTooltips["italic"] = "Italic";
21118
+ RichTextEditorTooltips["underline"] = "Underline";
21119
+ RichTextEditorTooltips["strike"] = "Strike";
21120
+ RichTextEditorTooltips["bulletList"] = "Bulleted List";
21121
+ RichTextEditorTooltips["orderedList"] = "Numbered List";
21122
+ RichTextEditorTooltips["link"] = "Link";
21123
+ RichTextEditorTooltips["highlight"] = "Highlight";
21124
+ RichTextEditorTooltips["redo"] = "Redo";
21125
+ RichTextEditorTooltips["undo"] = "Undo";
21126
+ RichTextEditorTooltips["codeBlock"] = "Code Block";
21127
+ RichTextEditorTooltips["blockquote"] = "Quote";
21128
+ RichTextEditorTooltips["file"] = "File";
21129
+ RichTextEditorTooltips["source"] = "Source";
21130
+ })(RichTextEditorTooltips || (RichTextEditorTooltips = {}));
21097
21131
 
21098
21132
  const RichTextEditor = [
21099
21133
  // Layout
@@ -29017,14 +29051,10 @@ var script = defineComponent({
29017
29051
  expose: ['root', 'editor'],
29018
29052
  setup(props, context) {
29019
29053
  let editor = shallowRef();
29054
+ const controlRef = ref();
29055
+ const toolbarRef = ref();
29020
29056
  // Refs & Styles
29021
29057
  const root = ref();
29022
- const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
29023
- const toolbarRef = ref();
29024
- const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
29025
- const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
29026
- const controlRef = ref();
29027
- const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
29028
29058
  const textareaRef = ref();
29029
29059
  const containerRef = ref();
29030
29060
  const moreButtonRef = ref();
@@ -29059,42 +29089,9 @@ var script = defineComponent({
29059
29089
  const countOfNotVisibleTools = ref(0);
29060
29090
  const sourceValue = ref('');
29061
29091
  let trap = useFocusTrap(controlRef, {
29062
- immediate: true,
29063
29092
  fallbackFocus: '.container',
29064
29093
  allowOutsideClick: true
29065
29094
  });
29066
- const iconsEnum = ref({
29067
- bold: 'format_bold',
29068
- italic: 'format_italic',
29069
- underline: 'format_underlined',
29070
- strike: 'format_strikethrough',
29071
- bulletList: 'format_list_bulleted',
29072
- orderedList: 'format_list_numbered',
29073
- link: 'link',
29074
- highlight: 'highlight',
29075
- redo: 'redo',
29076
- undo: 'undo',
29077
- codeBlock: 'code_blocks',
29078
- blockquote: 'format_quote',
29079
- file: 'attach_file',
29080
- source: 'source_notes'
29081
- });
29082
- const iconTooltipsEnum = ref({
29083
- bold: 'Bold',
29084
- italic: 'Italic',
29085
- underline: 'Underline',
29086
- strike: 'Strike',
29087
- bulletList: 'Bulleted List',
29088
- orderedList: 'Numbered List',
29089
- link: 'Link',
29090
- highlight: 'Highlight',
29091
- redo: 'Redo',
29092
- undo: 'Undo',
29093
- codeBlock: 'Code Block',
29094
- blockquote: 'Quote',
29095
- file: 'File',
29096
- source: 'Source'
29097
- });
29098
29095
  useResizeObserver(root, useDebounceFn(entries => {
29099
29096
  var _a, _b;
29100
29097
  const entry = entries[0];
@@ -29218,6 +29215,12 @@ var script = defineComponent({
29218
29215
  const getIndexOfHeading = computed(() => {
29219
29216
  return props.toolbar.flat().indexOf('heading');
29220
29217
  });
29218
+ const getRichTextEditorIcon = computed(() => item => {
29219
+ return RichTextEditorIcons[item];
29220
+ });
29221
+ const getRichTextEditorTooltipIcon = computed(() => item => {
29222
+ return RichTextEditorTooltips[item];
29223
+ });
29221
29224
  const headingIcon = computed(() => {
29222
29225
  if (activeHeadingLevel.value && isActive.value.heading) {
29223
29226
  return `format_h${activeHeadingLevel.value}`;
@@ -29388,6 +29391,11 @@ var script = defineComponent({
29388
29391
  }
29389
29392
  editor === null || editor === void 0 ? void 0 : editor.setEditable(!disabled);
29390
29393
  });
29394
+ // Styles
29395
+ const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
29396
+ const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
29397
+ const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
29398
+ const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
29391
29399
  return {
29392
29400
  root,
29393
29401
  rootStyles,
@@ -29403,11 +29411,11 @@ var script = defineComponent({
29403
29411
  textareaRef,
29404
29412
  moreRef,
29405
29413
  menuRef,
29406
- iconsEnum,
29407
29414
  handleToolbarClick,
29408
29415
  handleEditorClick,
29409
29416
  isActive,
29410
- iconTooltipsEnum,
29417
+ getRichTextEditorIcon,
29418
+ getRichTextEditorTooltipIcon,
29411
29419
  getIndexOfHeading,
29412
29420
  headingLevels,
29413
29421
  headingIcon,
@@ -29510,11 +29518,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
29510
29518
  }, null, 8 /* PROPS */, ["icon", "tooltip", "selected", "disabled"])) : _ctx.isVisible(item) ? (openBlock(), createBlock(_component_OrIconButton, {
29511
29519
  key: 1,
29512
29520
  icon: {
29513
- icon: _ctx.iconsEnum[item],
29521
+ icon: _ctx.getRichTextEditorIcon(item),
29514
29522
  variant: 'inherit'
29515
29523
  },
29516
29524
  tooltip: {
29517
- content: _ctx.iconTooltipsEnum[item],
29525
+ content: _ctx.getRichTextEditorTooltipIcon(item),
29518
29526
  placement: 'top'
29519
29527
  },
29520
29528
  selected: _ctx.isActive[item],
@@ -29564,11 +29572,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
29564
29572
  return openBlock(), createBlock(_component_OrIconButton, {
29565
29573
  key: item,
29566
29574
  icon: {
29567
- icon: _ctx.iconsEnum[item],
29575
+ icon: _ctx.getRichTextEditorIcon(item),
29568
29576
  variant: 'inherit'
29569
29577
  },
29570
29578
  tooltip: {
29571
- content: _ctx.iconTooltipsEnum[item],
29579
+ content: _ctx.getRichTextEditorTooltipIcon(item),
29572
29580
  placement: 'top'
29573
29581
  },
29574
29582
  selected: _ctx.isActive[item],
@@ -29638,4 +29646,4 @@ styleInject(css_248z);
29638
29646
  script.render = render;
29639
29647
  script.__file = "src/components/or-rich-text-editor-v3/OrRichTextEditor.vue";
29640
29648
 
29641
- export { CodeMirrorView as C, Formats as F, RichTextEditor as R, RichTextEditorToolbar as a, RichTextEditorToolbarGroup as b, RichTextEditorControl as c, color as d, orCodeHighlightStyle as e, codemirrorNode as f, serialize as g, deserialize as h, orCodeTheme as o, script as s, theme as t };
29649
+ export { CodeMirrorView as C, Formats as F, RichTextEditorIcons as R, RichTextEditorTooltips as a, RichTextEditor as b, RichTextEditorToolbar as c, RichTextEditorToolbarGroup as d, RichTextEditorControl as e, color as f, orCodeHighlightStyle as g, codemirrorNode as h, serialize as i, deserialize as j, orCodeTheme as o, script as s, theme as t };
@@ -87,7 +87,7 @@ export { s as OrRadioV3 } from './OrRadioV3-24091b7e.js';
87
87
  export { s as OrRangeSliderV3 } from './OrRangeSliderV3-0954d4ec.js';
88
88
  export { s as OrRatingV3, R as RatingVariant } from './OrRatingV3-2a906a67.js';
89
89
  export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement } from './OrResizeablePanelV3-8098fbf3.js';
90
- export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditorV3-e736de20.js';
90
+ export { F as Formats, s as OrRichTextEditorV3, R as RichTextEditorIcons, a as RichTextEditorTooltips } from './OrRichTextEditorV3-d8f48d58.js';
91
91
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './OrRichTooltipV3-1c3321db.js';
92
92
  export { default as OrSearch } from './OrSearch/OrSearch.js';
93
93
  export { default as OrSearchV3 } from './OrSearchV3/OrSearch.js';
@@ -44,7 +44,7 @@ export { s as OrRadio } from './components/OrRadio-30e01fc0.js';
44
44
  export { default as OrRadioGroup } from './components/OrRadioGroup/OrRadioGroup.js';
45
45
  export { default as OrRadioGroupV3 } from './components/OrRadioGroupV3/OrRadioGroup.js';
46
46
  export { s as OrRangeSliderV3 } from './components/OrRangeSliderV3-0954d4ec.js';
47
- export { F as Formats, s as OrRichTextEditorV3 } from './components/OrRichTextEditorV3-e736de20.js';
47
+ export { F as Formats, s as OrRichTextEditorV3, R as RichTextEditorIcons, a as RichTextEditorTooltips } from './components/OrRichTextEditorV3-d8f48d58.js';
48
48
  export { s as OrRichTooltipV3, R as RichTooltipBehavior } from './components/OrRichTooltipV3-1c3321db.js';
49
49
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './components/OrSegmentedControlV3-5db203ab.js';
50
50
  export { s as OrSelect } from './components/OrSelect-2966f641.js';
@@ -103,7 +103,7 @@ export { OrRadioV3 } from './or-radio-v3/index.js';
103
103
  export { OrRangeSliderV3 } from './or-range-slider-v3/index.js';
104
104
  export { OrRatingV3, RatingVariant } from './or-rating-v3/index.js';
105
105
  export { OrResizeablePanelV3, ResizeablePanelPadding, ResizeablePanelPlacement } from './or-resizeable-panel-v3/index.js';
106
- export { Formats, OrRichTextEditorV3 } from './or-rich-text-editor-v3/index.js';
106
+ export { Formats, OrRichTextEditorV3, RichTextEditorIcons, RichTextEditorTooltips } from './or-rich-text-editor-v3/index.js';
107
107
  export { OrRichTooltipV3, RichTooltipBehavior } from './or-rich-tooltip-v3/index.js';
108
108
  export { OrSearch } from './or-search/index.js';
109
109
  export { OrSearchV3 } from './or-search-v3/index.js';
@@ -1,7 +1,7 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { Level } from '@tiptap/extension-heading';
3
3
  import { ComponentPublicInstance, PropType } from 'vue';
4
- import { Formats, Tools } from './props';
4
+ import { Formats, Tools, RichTextEditorIcons, RichTextEditorTooltips } from './props';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  modelValue: {
7
7
  type: StringConstructor;
@@ -62,17 +62,13 @@ declare const _default: import("vue").DefineComponent<{
62
62
  textareaRef: import("vue").Ref<HTMLTextAreaElement | undefined>;
63
63
  moreRef: import("vue").Ref<any>;
64
64
  menuRef: import("vue").Ref<any>;
65
- iconsEnum: import("vue").Ref<{
66
- [key: string]: string;
67
- }>;
68
65
  handleToolbarClick: (item: string, level?: number) => void;
69
66
  handleEditorClick: () => void;
70
67
  isActive: import("vue").Ref<{
71
68
  [key: string]: boolean;
72
69
  }>;
73
- iconTooltipsEnum: import("vue").Ref<{
74
- [key: string]: string;
75
- }>;
70
+ getRichTextEditorIcon: import("vue").ComputedRef<(item: string) => RichTextEditorIcons>;
71
+ getRichTextEditorTooltipIcon: import("vue").ComputedRef<(item: string) => RichTextEditorTooltips>;
76
72
  getIndexOfHeading: import("vue").ComputedRef<number>;
77
73
  headingLevels: Level[];
78
74
  headingIcon: import("vue").ComputedRef<string>;
@@ -11,7 +11,7 @@ import Underline from '@tiptap/extension-underline';
11
11
  import StarterKit from '@tiptap/starter-kit';
12
12
  import { useResizeObserver, useDebounceFn, onClickOutside } from '@vueuse/core';
13
13
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
14
- import { defineComponent, shallowRef, ref, computed, onMounted, onBeforeUnmount, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, createElementVNode, Fragment, renderList, withDirectives, vShow, vModelText } from 'vue';
14
+ import { defineComponent, shallowRef, ref, onMounted, onBeforeUnmount, computed, watch, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, createElementVNode, Fragment, renderList, withDirectives, vShow, vModelText } from 'vue';
15
15
  import '../../dom-11141778.js';
16
16
  import { i as isArray } from '../../isArray-135d4ff2.js';
17
17
  import { OrButtonV3 as script$1 } from '../or-button-v3/index.js';
@@ -74,6 +74,40 @@ var Formats;
74
74
  Formats["Markdown"] = "markdown";
75
75
  Formats["Markup"] = "markup";
76
76
  })(Formats || (Formats = {}));
77
+ var RichTextEditorIcons;
78
+ (function (RichTextEditorIcons) {
79
+ RichTextEditorIcons["bold"] = "format_bold";
80
+ RichTextEditorIcons["italic"] = "format_italic";
81
+ RichTextEditorIcons["underline"] = "format_underlined";
82
+ RichTextEditorIcons["strike"] = "format_strikethrough";
83
+ RichTextEditorIcons["bulletList"] = "format_list_bulleted";
84
+ RichTextEditorIcons["orderedList"] = "format_list_numbered";
85
+ RichTextEditorIcons["link"] = "link";
86
+ RichTextEditorIcons["highlight"] = "highlight";
87
+ RichTextEditorIcons["redo"] = "redo";
88
+ RichTextEditorIcons["undo"] = "undo";
89
+ RichTextEditorIcons["codeBlock"] = "code_blocks";
90
+ RichTextEditorIcons["blockquote"] = "format_quote";
91
+ RichTextEditorIcons["file"] = "attach_file";
92
+ RichTextEditorIcons["source"] = "source_notes";
93
+ })(RichTextEditorIcons || (RichTextEditorIcons = {}));
94
+ var RichTextEditorTooltips;
95
+ (function (RichTextEditorTooltips) {
96
+ RichTextEditorTooltips["bold"] = "Bold";
97
+ RichTextEditorTooltips["italic"] = "Italic";
98
+ RichTextEditorTooltips["underline"] = "Underline";
99
+ RichTextEditorTooltips["strike"] = "Strike";
100
+ RichTextEditorTooltips["bulletList"] = "Bulleted List";
101
+ RichTextEditorTooltips["orderedList"] = "Numbered List";
102
+ RichTextEditorTooltips["link"] = "Link";
103
+ RichTextEditorTooltips["highlight"] = "Highlight";
104
+ RichTextEditorTooltips["redo"] = "Redo";
105
+ RichTextEditorTooltips["undo"] = "Undo";
106
+ RichTextEditorTooltips["codeBlock"] = "Code Block";
107
+ RichTextEditorTooltips["blockquote"] = "Quote";
108
+ RichTextEditorTooltips["file"] = "File";
109
+ RichTextEditorTooltips["source"] = "Source";
110
+ })(RichTextEditorTooltips || (RichTextEditorTooltips = {}));
77
111
 
78
112
  const RichTextEditor = [
79
113
  // Layout
@@ -281,14 +315,10 @@ var script = defineComponent({
281
315
  expose: ['root', 'editor'],
282
316
  setup(props, context) {
283
317
  let editor = shallowRef();
318
+ const controlRef = ref();
319
+ const toolbarRef = ref();
284
320
  // Refs & Styles
285
321
  const root = ref();
286
- const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
287
- const toolbarRef = ref();
288
- const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
289
- const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
290
- const controlRef = ref();
291
- const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
292
322
  const textareaRef = ref();
293
323
  const containerRef = ref();
294
324
  const moreButtonRef = ref();
@@ -323,42 +353,9 @@ var script = defineComponent({
323
353
  const countOfNotVisibleTools = ref(0);
324
354
  const sourceValue = ref('');
325
355
  let trap = useFocusTrap(controlRef, {
326
- immediate: true,
327
356
  fallbackFocus: '.container',
328
357
  allowOutsideClick: true
329
358
  });
330
- const iconsEnum = ref({
331
- bold: 'format_bold',
332
- italic: 'format_italic',
333
- underline: 'format_underlined',
334
- strike: 'format_strikethrough',
335
- bulletList: 'format_list_bulleted',
336
- orderedList: 'format_list_numbered',
337
- link: 'link',
338
- highlight: 'highlight',
339
- redo: 'redo',
340
- undo: 'undo',
341
- codeBlock: 'code_blocks',
342
- blockquote: 'format_quote',
343
- file: 'attach_file',
344
- source: 'source_notes'
345
- });
346
- const iconTooltipsEnum = ref({
347
- bold: 'Bold',
348
- italic: 'Italic',
349
- underline: 'Underline',
350
- strike: 'Strike',
351
- bulletList: 'Bulleted List',
352
- orderedList: 'Numbered List',
353
- link: 'Link',
354
- highlight: 'Highlight',
355
- redo: 'Redo',
356
- undo: 'Undo',
357
- codeBlock: 'Code Block',
358
- blockquote: 'Quote',
359
- file: 'File',
360
- source: 'Source'
361
- });
362
359
  useResizeObserver(root, useDebounceFn(entries => {
363
360
  var _a, _b;
364
361
  const entry = entries[0];
@@ -482,6 +479,12 @@ var script = defineComponent({
482
479
  const getIndexOfHeading = computed(() => {
483
480
  return props.toolbar.flat().indexOf('heading');
484
481
  });
482
+ const getRichTextEditorIcon = computed(() => item => {
483
+ return RichTextEditorIcons[item];
484
+ });
485
+ const getRichTextEditorTooltipIcon = computed(() => item => {
486
+ return RichTextEditorTooltips[item];
487
+ });
485
488
  const headingIcon = computed(() => {
486
489
  if (activeHeadingLevel.value && isActive.value.heading) {
487
490
  return `format_h${activeHeadingLevel.value}`;
@@ -652,6 +655,11 @@ var script = defineComponent({
652
655
  }
653
656
  editor === null || editor === void 0 ? void 0 : editor.setEditable(!disabled);
654
657
  });
658
+ // Styles
659
+ const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
660
+ const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
661
+ const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
662
+ const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
655
663
  return {
656
664
  root,
657
665
  rootStyles,
@@ -667,11 +675,11 @@ var script = defineComponent({
667
675
  textareaRef,
668
676
  moreRef,
669
677
  menuRef,
670
- iconsEnum,
671
678
  handleToolbarClick,
672
679
  handleEditorClick,
673
680
  isActive,
674
- iconTooltipsEnum,
681
+ getRichTextEditorIcon,
682
+ getRichTextEditorTooltipIcon,
675
683
  getIndexOfHeading,
676
684
  headingLevels,
677
685
  headingIcon,
@@ -774,11 +782,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
774
782
  }, null, 8 /* PROPS */, ["icon", "tooltip", "selected", "disabled"])) : _ctx.isVisible(item) ? (openBlock(), createBlock(_component_OrIconButton, {
775
783
  key: 1,
776
784
  icon: {
777
- icon: _ctx.iconsEnum[item],
785
+ icon: _ctx.getRichTextEditorIcon(item),
778
786
  variant: 'inherit'
779
787
  },
780
788
  tooltip: {
781
- content: _ctx.iconTooltipsEnum[item],
789
+ content: _ctx.getRichTextEditorTooltipIcon(item),
782
790
  placement: 'top'
783
791
  },
784
792
  selected: _ctx.isActive[item],
@@ -828,11 +836,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
828
836
  return openBlock(), createBlock(_component_OrIconButton, {
829
837
  key: item,
830
838
  icon: {
831
- icon: _ctx.iconsEnum[item],
839
+ icon: _ctx.getRichTextEditorIcon(item),
832
840
  variant: 'inherit'
833
841
  },
834
842
  tooltip: {
835
- content: _ctx.iconTooltipsEnum[item],
843
+ content: _ctx.getRichTextEditorTooltipIcon(item),
836
844
  placement: 'top'
837
845
  },
838
846
  selected: _ctx.isActive[item],
@@ -902,4 +910,4 @@ styleInject(css_248z);
902
910
  script.render = render;
903
911
  script.__file = "src/components/or-rich-text-editor-v3/OrRichTextEditor.vue";
904
912
 
905
- export { Formats, script as OrRichTextEditorV3 };
913
+ export { Formats, script as OrRichTextEditorV3, RichTextEditorIcons, RichTextEditorTooltips };
@@ -3,3 +3,35 @@ export declare enum Formats {
3
3
  Markup = "markup"
4
4
  }
5
5
  export type Tools = string[][];
6
+ export declare enum RichTextEditorIcons {
7
+ bold = "format_bold",
8
+ italic = "format_italic",
9
+ underline = "format_underlined",
10
+ strike = "format_strikethrough",
11
+ bulletList = "format_list_bulleted",
12
+ orderedList = "format_list_numbered",
13
+ link = "link",
14
+ highlight = "highlight",
15
+ redo = "redo",
16
+ undo = "undo",
17
+ codeBlock = "code_blocks",
18
+ blockquote = "format_quote",
19
+ file = "attach_file",
20
+ source = "source_notes"
21
+ }
22
+ export declare enum RichTextEditorTooltips {
23
+ bold = "Bold",
24
+ italic = "Italic",
25
+ underline = "Underline",
26
+ strike = "Strike",
27
+ bulletList = "Bulleted List",
28
+ orderedList = "Numbered List",
29
+ link = "Link",
30
+ highlight = "Highlight",
31
+ redo = "Redo",
32
+ undo = "Undo",
33
+ codeBlock = "Code Block",
34
+ blockquote = "Quote",
35
+ file = "File",
36
+ source = "Source"
37
+ }
package/dist/esm/index.js CHANGED
@@ -103,7 +103,7 @@ export { OrRadioV3 } from './components/or-radio-v3/index.js';
103
103
  export { OrRangeSliderV3 } from './components/or-range-slider-v3/index.js';
104
104
  export { OrRatingV3, RatingVariant } from './components/or-rating-v3/index.js';
105
105
  export { OrResizeablePanelV3, ResizeablePanelPadding, ResizeablePanelPlacement } from './components/or-resizeable-panel-v3/index.js';
106
- export { Formats, OrRichTextEditorV3 } from './components/or-rich-text-editor-v3/index.js';
106
+ export { Formats, OrRichTextEditorV3, RichTextEditorIcons, RichTextEditorTooltips } from './components/or-rich-text-editor-v3/index.js';
107
107
  export { OrRichTooltipV3, RichTooltipBehavior } from './components/or-rich-tooltip-v3/index.js';
108
108
  export { OrSearch } from './components/or-search/index.js';
109
109
  export { OrSearchV3 } from './components/or-search-v3/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "18.4.1",
3
+ "version": "18.4.2",
4
4
  "npmUnpacked": "4.15.2",
5
5
  "description": "Vue components library for v3",
6
6
  "sideEffects": false,
@@ -33,7 +33,7 @@
33
33
  "@codemirror/view": "^6",
34
34
  "@floating-ui/dom": "1.5.3",
35
35
  "@lezer/highlight": "*",
36
- "@onereach/styles": "^18.4.1",
36
+ "@onereach/styles": "^18.4.2",
37
37
  "@splidejs/splide": "4.0.6",
38
38
  "@tiptap/core": "2.0.3",
39
39
  "@tiptap/extension-blockquote": "2.0.3",
@@ -141,5 +141,5 @@
141
141
  },
142
142
  "./package.json": "./package.json"
143
143
  },
144
- "gitHead": "e7514cc883e08e4368951a4ca978a00dd5c4addc"
144
+ "gitHead": "c22551ce5da2acc781045646793561b99225f026"
145
145
  }
@@ -54,8 +54,8 @@
54
54
 
55
55
  <OrIconButton
56
56
  v-else-if="isVisible(item)"
57
- :icon="{ icon: iconsEnum[item], variant: 'inherit' }"
58
- :tooltip="{ content: iconTooltipsEnum[item], placement: 'top' }"
57
+ :icon="{ icon: getRichTextEditorIcon(item), variant: 'inherit' }"
58
+ :tooltip="{ content: getRichTextEditorTooltipIcon(item), placement: 'top' }"
59
59
  :selected="isActive[item]"
60
60
  :disabled="disabled || !isFocused"
61
61
  @click="handleToolbarClick(item)"
@@ -121,8 +121,8 @@
121
121
  <OrIconButton
122
122
  v-for="item in notVisibleTools"
123
123
  :key="item"
124
- :icon="{ icon: iconsEnum[item], variant: 'inherit' }"
125
- :tooltip="{ content: iconTooltipsEnum[item], placement: 'top' }"
124
+ :icon="{ icon: getRichTextEditorIcon(item), variant: 'inherit' }"
125
+ :tooltip="{ content: getRichTextEditorTooltipIcon(item), placement: 'top' }"
126
126
  :selected="isActive[item]"
127
127
  @click="handleToolbarClick(item)"
128
128
  />
@@ -222,7 +222,7 @@ import { OrMenuItemV3 as OrMenuItem } from '../or-menu-item-v3';
222
222
  import { OrMenuV3 as OrMenu } from '../or-menu-v3';
223
223
  import { OrModalV3 as OrModal } from '../or-modal-v3';
224
224
  import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
225
- import { Formats, Tools } from './props';
225
+ import { Formats, Tools, RichTextEditorIcons, RichTextEditorTooltips } from './props';
226
226
  import * as Styles from './styles';
227
227
  import codemirrorNode from './utils/codemirror/codemirrorNode';
228
228
  import { deserialize, serialize } from './utils/markdown';
@@ -320,32 +320,12 @@ export default defineComponent({
320
320
 
321
321
  setup(props, context) {
322
322
  let editor = shallowRef<Editor>();
323
+ const controlRef = ref<HTMLDivElement>();
324
+ const toolbarRef = ref<ComponentPublicInstance<HTMLInputElement>>();
323
325
 
324
326
  // Refs & Styles
325
327
  const root = ref<HTMLElement>();
326
328
 
327
- const rootStyles = computed(() => [
328
- 'or-rich-text-editor-v3',
329
- ...Styles.RichTextEditor,
330
- ]);
331
-
332
- const toolbarRef = ref<ComponentPublicInstance<HTMLInputElement>>();
333
-
334
- const toolbarStyles = computed(() => [
335
- ...Styles.RichTextEditorToolbar,
336
- ]);
337
-
338
- const toolbarGroupStyles = computed(() => [
339
- ...Styles.RichTextEditorToolbarGroup,
340
- ]);
341
-
342
- const controlRef = ref<HTMLDivElement>();
343
-
344
- const controlStyles = computed(() => [
345
- 'tiptap-editor-v3',
346
- ...Styles.RichTextEditorControl,
347
- ]);
348
-
349
329
  const textareaRef = ref<HTMLTextAreaElement>();
350
330
  const containerRef = ref<ComponentPublicInstance<HTMLInputElement>>();
351
331
  const moreButtonRef = ref<InstanceType<typeof OrIconButton>>();
@@ -383,44 +363,10 @@ export default defineComponent({
383
363
  const sourceValue = ref<string>('');
384
364
 
385
365
  let trap: UseFocusTrapReturn = useFocusTrap(controlRef, {
386
- immediate: true,
387
366
  fallbackFocus: '.container',
388
367
  allowOutsideClick: true,
389
368
  });
390
369
 
391
- const iconsEnum = ref<{[key: string]: string;}>({
392
- bold: 'format_bold',
393
- italic: 'format_italic',
394
- underline: 'format_underlined',
395
- strike: 'format_strikethrough',
396
- bulletList: 'format_list_bulleted',
397
- orderedList: 'format_list_numbered',
398
- link: 'link',
399
- highlight: 'highlight',
400
- redo: 'redo',
401
- undo: 'undo',
402
- codeBlock: 'code_blocks',
403
- blockquote: 'format_quote',
404
- file: 'attach_file',
405
- source: 'source_notes',
406
- });
407
-
408
- const iconTooltipsEnum = ref<{[key: string]: string;}>({
409
- bold: 'Bold',
410
- italic: 'Italic',
411
- underline: 'Underline',
412
- strike: 'Strike',
413
- bulletList: 'Bulleted List',
414
- orderedList: 'Numbered List',
415
- link: 'Link',
416
- highlight: 'Highlight',
417
- redo: 'Redo',
418
- undo: 'Undo',
419
- codeBlock: 'Code Block',
420
- blockquote: 'Quote',
421
- file: 'File',
422
- source: 'Source',
423
- });
424
370
 
425
371
  useResizeObserver(root, useDebounceFn((entries) => {
426
372
  const entry = entries[0];
@@ -557,6 +503,14 @@ export default defineComponent({
557
503
  return props.toolbar.flat().indexOf('heading');
558
504
  });
559
505
 
506
+ const getRichTextEditorIcon = computed(() => (item: string) => {
507
+ return RichTextEditorIcons[item as keyof typeof RichTextEditorTooltips];
508
+ });
509
+
510
+ const getRichTextEditorTooltipIcon = computed(() => (item: string) => {
511
+ return RichTextEditorTooltips[item as keyof typeof RichTextEditorTooltips];
512
+ });
513
+
560
514
  const headingIcon = computed(() => {
561
515
  if (activeHeadingLevel.value && isActive.value.heading) {
562
516
  return `format_h${activeHeadingLevel.value}`;
@@ -728,6 +682,7 @@ export default defineComponent({
728
682
  });
729
683
  };
730
684
 
685
+
731
686
  // Effects
732
687
  watch([
733
688
  editor,
@@ -749,6 +704,25 @@ export default defineComponent({
749
704
  editor?.setEditable(!disabled);
750
705
  });
751
706
 
707
+ // Styles
708
+ const rootStyles = computed(() => [
709
+ 'or-rich-text-editor-v3',
710
+ ...Styles.RichTextEditor,
711
+ ]);
712
+
713
+ const toolbarStyles = computed(() => [
714
+ ...Styles.RichTextEditorToolbar,
715
+ ]);
716
+
717
+ const toolbarGroupStyles = computed(() => [
718
+ ...Styles.RichTextEditorToolbarGroup,
719
+ ]);
720
+
721
+ const controlStyles = computed(() => [
722
+ 'tiptap-editor-v3',
723
+ ...Styles.RichTextEditorControl,
724
+ ]);
725
+
752
726
  return {
753
727
  root,
754
728
  rootStyles,
@@ -768,11 +742,11 @@ export default defineComponent({
768
742
  textareaRef,
769
743
  moreRef,
770
744
  menuRef,
771
- iconsEnum,
772
745
  handleToolbarClick,
773
746
  handleEditorClick,
774
747
  isActive,
775
- iconTooltipsEnum,
748
+ getRichTextEditorIcon,
749
+ getRichTextEditorTooltipIcon,
776
750
  getIndexOfHeading,
777
751
  headingLevels,
778
752
  headingIcon,
@@ -4,3 +4,37 @@ export enum Formats {
4
4
  }
5
5
 
6
6
  export type Tools = string[][]; // TODO: Improve this type
7
+
8
+ export enum RichTextEditorIcons {
9
+ bold = 'format_bold',
10
+ italic = 'format_italic',
11
+ underline = 'format_underlined',
12
+ strike = 'format_strikethrough',
13
+ bulletList = 'format_list_bulleted',
14
+ orderedList = 'format_list_numbered',
15
+ link = 'link',
16
+ highlight = 'highlight',
17
+ redo = 'redo',
18
+ undo = 'undo',
19
+ codeBlock = 'code_blocks',
20
+ blockquote = 'format_quote',
21
+ file = 'attach_file',
22
+ source = 'source_notes',
23
+ }
24
+
25
+ export enum RichTextEditorTooltips {
26
+ bold = 'Bold',
27
+ italic = 'Italic',
28
+ underline = 'Underline',
29
+ strike = 'Strike',
30
+ bulletList = 'Bulleted List',
31
+ orderedList = 'Numbered List',
32
+ link = 'Link',
33
+ highlight = 'Highlight',
34
+ redo = 'Redo',
35
+ undo = 'Undo',
36
+ codeBlock = 'Code Block',
37
+ blockquote = 'Quote',
38
+ file = 'File',
39
+ source = 'Source',
40
+ }
package/src/types/Item.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export type Item<T> = {
2
2
  label: string;
3
3
  value: T;
4
-
5
4
  disabled?: boolean;
6
5
  };