@onereach/ui-components-vue2 18.4.0 → 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.
@@ -1,9 +1,10 @@
1
1
  import { defineComponent, ref, computed } from 'vue-demi';
2
2
  import { n as useIntersectionObserver } from '../../index-fe4d407a.js';
3
- import { MenuItem } from './styles.js';
3
+ import { MenuItem, MenuItemIcon, MenuItemIconSelected } from './styles.js';
4
4
  import __vue_component__$1 from '../OrIconV3/OrIcon.js';
5
5
  import __vue_component__$2 from '../OrIconButtonV3/OrIconButton.js';
6
6
  import __vue_component__$3 from '../OrTooltipV3/OrTooltip.js';
7
+ import { IconVariant } from '../OrIconV3/props.js';
7
8
  import { n as normalizeComponent } from '../../normalize-component-cf2db48b.js';
8
9
 
9
10
  var script = defineComponent({
@@ -11,7 +12,7 @@ var script = defineComponent({
11
12
  components: {
12
13
  OrIcon: __vue_component__$1,
13
14
  OrIconButton: __vue_component__$2,
14
- OrToolip: __vue_component__$3
15
+ OrTooltip: __vue_component__$3
15
16
  },
16
17
  props: {
17
18
  icon: {
@@ -37,7 +38,7 @@ var script = defineComponent({
37
38
  },
38
39
  emits: ['click', 'focus', 'blur', 'close'],
39
40
  expose: ['root'],
40
- setup() {
41
+ setup(props) {
41
42
  // Refs
42
43
  const root = ref();
43
44
  const content = ref();
@@ -52,8 +53,18 @@ var script = defineComponent({
52
53
  });
53
54
  // Styles
54
55
  const rootStyles = computed(() => ['or-menu-item-v3', ...MenuItem]);
55
- // Toolip display logic
56
- const isToolitpShown = computed(() => {
56
+ const iconStyles = computed(() => [...MenuItemIcon, ...(props.selected ? MenuItemIconSelected : [])]);
57
+ const iconProps = computed(() => {
58
+ return typeof props.icon === 'string' ? {
59
+ icon: props.icon,
60
+ variant: IconVariant.Inherit
61
+ } : {
62
+ variant: IconVariant.Inherit,
63
+ ...props.icon
64
+ };
65
+ });
66
+ // Tooltip display logic
67
+ const isTooltipShown = computed(() => {
57
68
  if (isRootVisible.value) {
58
69
  return content.value !== undefined && content.value.clientWidth < content.value.scrollWidth;
59
70
  }
@@ -64,7 +75,9 @@ var script = defineComponent({
64
75
  root,
65
76
  tooltip,
66
77
  rootStyles,
67
- isToolitpShown,
78
+ iconStyles,
79
+ isTooltipShown,
80
+ iconProps,
68
81
  isRootVisible,
69
82
  stop
70
83
  };
@@ -83,7 +96,7 @@ var __vue_render__ = function () {
83
96
  ref: 'root',
84
97
  class: _vm.rootStyles,
85
98
  attrs: {
86
- "tabindex": !_vm.disabled ? 0 : null,
99
+ "tabindex": !_vm.disabled ? 0 : undefined,
87
100
  "selected": _vm.selected,
88
101
  "disabled": _vm.disabled
89
102
  },
@@ -98,9 +111,9 @@ var __vue_render__ = function () {
98
111
  return _vm.$emit('blur', $event);
99
112
  }
100
113
  }
101
- }, [_vm.icon ? [_c('OrIcon', _vm._b({}, 'OrIcon', typeof _vm.icon === 'string' ? {
102
- icon: _vm.icon
103
- } : _vm.icon, false))] : _vm._e(), _vm._v(" "), _c('div', {
114
+ }, [_vm.icon && _vm.iconProps.icon ? [_c('OrIcon', _vm._b({
115
+ class: _vm.iconStyles
116
+ }, 'OrIcon', _vm.iconProps, false))] : _vm._e(), _vm._v(" "), _c('div', {
104
117
  ref: "content",
105
118
  class: ['truncate', 'w-full'],
106
119
  on: {
@@ -124,7 +137,7 @@ var __vue_render__ = function () {
124
137
  return _vm.$emit('close');
125
138
  }
126
139
  }
127
- })] : _vm._e(), _vm._v(" "), _vm.isToolitpShown ? _c('OrToolip', {
140
+ })] : _vm._e(), _vm._v(" "), _vm.isTooltipShown ? _c('OrTooltip', {
128
141
  ref: "tooltip",
129
142
  attrs: {
130
143
  "content": _vm.tooltipText,
@@ -1 +1,3 @@
1
1
  export declare const MenuItem: string[];
2
+ export declare const MenuItemIcon: string[];
3
+ export declare const MenuItemIconSelected: string[];
@@ -1,4 +1,6 @@
1
1
  const MenuItem = [
2
+ // Group
3
+ 'group',
2
4
  // Layout
3
5
  'layout-row',
4
6
  // Spacing
@@ -17,5 +19,11 @@ const MenuItem = [
17
19
  'hover:md:theme-foreground-default', 'dark:hover:md:theme-foreground-default-dark',
18
20
  // Theme (active)
19
21
  'active:theme-foreground-default', 'dark:active:theme-foreground-default-dark'];
22
+ const MenuItemIcon = [
23
+ // Iconography (hover)
24
+ 'group-hover:iconography-filled'];
25
+ const MenuItemIconSelected = [
26
+ // Iconography (selected)
27
+ 'selected:iconography-filled'];
20
28
 
21
- export { MenuItem };
29
+ export { MenuItem, MenuItemIcon, MenuItemIconSelected };
@@ -10,8 +10,8 @@ import { History } from '@tiptap/extension-history';
10
10
  import { Text } from '@tiptap/extension-text';
11
11
  import { a as useResizeObserver, o as onClickOutside } from '../../index-fe4d407a.js';
12
12
  import { u as useFocusTrap } from '../../useFocusTrap-747ad0e5.js';
13
- import { defineComponent, shallowRef, ref, computed, onMounted, onBeforeUnmount, watch, nextTick } from 'vue-demi';
14
- import { Formats } from './props.js';
13
+ import { defineComponent, shallowRef, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
14
+ import { Formats, RichTextEditorIcons, RichTextEditorTooltips } from './props.js';
15
15
  import { RichTextEditor, RichTextEditorToolbar, RichTextEditorToolbarGroup, RichTextEditorControl } from './styles.js';
16
16
  import codemirrorNode from './utils/codemirror/codemirrorNode.js';
17
17
  import __vue_component__$1 from '../OrButtonV3/OrButton.js';
@@ -291,14 +291,10 @@ var script = defineComponent({
291
291
  expose: ['root', 'editor'],
292
292
  setup(props, context) {
293
293
  let editor = shallowRef();
294
+ const controlRef = ref();
295
+ const toolbarRef = ref();
294
296
  // Refs & Styles
295
297
  const root = ref();
296
- const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
297
- const toolbarRef = ref();
298
- const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
299
- const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
300
- const controlRef = ref();
301
- const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
302
298
  const textareaRef = ref();
303
299
  const containerRef = ref();
304
300
  const moreButtonRef = ref();
@@ -333,42 +329,9 @@ var script = defineComponent({
333
329
  const countOfNotVisibleTools = ref(0);
334
330
  const sourceValue = ref('');
335
331
  let trap = useFocusTrap(controlRef, {
336
- immediate: true,
337
332
  fallbackFocus: '.container',
338
333
  allowOutsideClick: true
339
334
  });
340
- const iconsEnum = ref({
341
- bold: 'format_bold',
342
- italic: 'format_italic',
343
- underline: 'format_underlined',
344
- strike: 'format_strikethrough',
345
- bulletList: 'format_list_bulleted',
346
- orderedList: 'format_list_numbered',
347
- link: 'link',
348
- highlight: 'highlight',
349
- redo: 'redo',
350
- undo: 'undo',
351
- codeBlock: 'code_blocks',
352
- blockquote: 'format_quote',
353
- file: 'attach_file',
354
- source: 'source_notes'
355
- });
356
- const iconTooltipsEnum = ref({
357
- bold: 'Bold',
358
- italic: 'Italic',
359
- underline: 'Underline',
360
- strike: 'Strike',
361
- bulletList: 'Bulleted List',
362
- orderedList: 'Numbered List',
363
- link: 'Link',
364
- highlight: 'Highlight',
365
- redo: 'Redo',
366
- undo: 'Undo',
367
- codeBlock: 'Code Block',
368
- blockquote: 'Quote',
369
- file: 'File',
370
- source: 'Source'
371
- });
372
335
  useResizeObserver(root, useDebounceFn(entries => {
373
336
  var _a, _b;
374
337
  const entry = entries[0];
@@ -492,6 +455,12 @@ var script = defineComponent({
492
455
  const getIndexOfHeading = computed(() => {
493
456
  return props.toolbar.flat().indexOf('heading');
494
457
  });
458
+ const getRichTextEditorIcon = computed(() => item => {
459
+ return RichTextEditorIcons[item];
460
+ });
461
+ const getRichTextEditorTooltipIcon = computed(() => item => {
462
+ return RichTextEditorTooltips[item];
463
+ });
495
464
  const headingIcon = computed(() => {
496
465
  if (activeHeadingLevel.value && isActive.value.heading) {
497
466
  return `format_h${activeHeadingLevel.value}`;
@@ -662,6 +631,11 @@ var script = defineComponent({
662
631
  }
663
632
  editor === null || editor === void 0 ? void 0 : editor.setEditable(!disabled);
664
633
  });
634
+ // Styles
635
+ const rootStyles = computed(() => ['or-rich-text-editor-v3', ...RichTextEditor]);
636
+ const toolbarStyles = computed(() => [...RichTextEditorToolbar]);
637
+ const toolbarGroupStyles = computed(() => [...RichTextEditorToolbarGroup]);
638
+ const controlStyles = computed(() => ['tiptap-editor-v3', ...RichTextEditorControl]);
665
639
  return {
666
640
  root,
667
641
  rootStyles,
@@ -677,11 +651,11 @@ var script = defineComponent({
677
651
  textareaRef,
678
652
  moreRef,
679
653
  menuRef,
680
- iconsEnum,
681
654
  handleToolbarClick,
682
655
  handleEditorClick,
683
656
  isActive,
684
- iconTooltipsEnum,
657
+ getRichTextEditorIcon,
658
+ getRichTextEditorTooltipIcon,
685
659
  getIndexOfHeading,
686
660
  headingLevels,
687
661
  headingIcon,
@@ -787,11 +761,11 @@ var __vue_render__ = function () {
787
761
  }) : _vm.isVisible(item) ? _c('OrIconButton', {
788
762
  attrs: {
789
763
  "icon": {
790
- icon: _vm.iconsEnum[item],
764
+ icon: _vm.getRichTextEditorIcon(item),
791
765
  variant: 'inherit'
792
766
  },
793
767
  "tooltip": {
794
- content: _vm.iconTooltipsEnum[item],
768
+ content: _vm.getRichTextEditorTooltipIcon(item),
795
769
  placement: 'top'
796
770
  },
797
771
  "selected": _vm.isActive[item],
@@ -893,11 +867,11 @@ var __vue_render__ = function () {
893
867
  key: item,
894
868
  attrs: {
895
869
  "icon": {
896
- icon: _vm.iconsEnum[item],
870
+ icon: _vm.getRichTextEditorIcon(item),
897
871
  variant: 'inherit'
898
872
  },
899
873
  "tooltip": {
900
- content: _vm.iconTooltipsEnum[item],
874
+ content: _vm.getRichTextEditorTooltipIcon(item),
901
875
  placement: 'top'
902
876
  },
903
877
  "selected": _vm.isActive[item]
@@ -1,2 +1,2 @@
1
1
  export { default as OrRichTextEditorV3 } from './OrRichTextEditor.js';
2
- export { Formats } from './props.js';
2
+ export { Formats, RichTextEditorIcons, RichTextEditorTooltips } from './props.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
+ }
@@ -3,5 +3,39 @@ var Formats;
3
3
  Formats["Markdown"] = "markdown";
4
4
  Formats["Markup"] = "markup";
5
5
  })(Formats || (Formats = {}));
6
+ var RichTextEditorIcons;
7
+ (function (RichTextEditorIcons) {
8
+ RichTextEditorIcons["bold"] = "format_bold";
9
+ RichTextEditorIcons["italic"] = "format_italic";
10
+ RichTextEditorIcons["underline"] = "format_underlined";
11
+ RichTextEditorIcons["strike"] = "format_strikethrough";
12
+ RichTextEditorIcons["bulletList"] = "format_list_bulleted";
13
+ RichTextEditorIcons["orderedList"] = "format_list_numbered";
14
+ RichTextEditorIcons["link"] = "link";
15
+ RichTextEditorIcons["highlight"] = "highlight";
16
+ RichTextEditorIcons["redo"] = "redo";
17
+ RichTextEditorIcons["undo"] = "undo";
18
+ RichTextEditorIcons["codeBlock"] = "code_blocks";
19
+ RichTextEditorIcons["blockquote"] = "format_quote";
20
+ RichTextEditorIcons["file"] = "attach_file";
21
+ RichTextEditorIcons["source"] = "source_notes";
22
+ })(RichTextEditorIcons || (RichTextEditorIcons = {}));
23
+ var RichTextEditorTooltips;
24
+ (function (RichTextEditorTooltips) {
25
+ RichTextEditorTooltips["bold"] = "Bold";
26
+ RichTextEditorTooltips["italic"] = "Italic";
27
+ RichTextEditorTooltips["underline"] = "Underline";
28
+ RichTextEditorTooltips["strike"] = "Strike";
29
+ RichTextEditorTooltips["bulletList"] = "Bulleted List";
30
+ RichTextEditorTooltips["orderedList"] = "Numbered List";
31
+ RichTextEditorTooltips["link"] = "Link";
32
+ RichTextEditorTooltips["highlight"] = "Highlight";
33
+ RichTextEditorTooltips["redo"] = "Redo";
34
+ RichTextEditorTooltips["undo"] = "Undo";
35
+ RichTextEditorTooltips["codeBlock"] = "Code Block";
36
+ RichTextEditorTooltips["blockquote"] = "Quote";
37
+ RichTextEditorTooltips["file"] = "File";
38
+ RichTextEditorTooltips["source"] = "Source";
39
+ })(RichTextEditorTooltips || (RichTextEditorTooltips = {}));
6
40
 
7
- export { Formats };
41
+ export { Formats, RichTextEditorIcons, RichTextEditorTooltips };
@@ -147,7 +147,7 @@ export { R as RatingVariant } from '../styles-13d49c4b.js';
147
147
  export { default as OrResizeablePanelV3 } from './OrResizeablePanelV3/OrResizeablePanel.js';
148
148
  export { ResizeablePanelPadding, ResizeablePanelPlacement } from './OrResizeablePanelV3/props.js';
149
149
  export { default as OrRichTextEditorV3 } from './OrRichTextEditorV3/OrRichTextEditor.js';
150
- export { Formats } from './OrRichTextEditorV3/props.js';
150
+ export { Formats, RichTextEditorIcons, RichTextEditorTooltips } from './OrRichTextEditorV3/props.js';
151
151
  export { OrRichTooltipV3, RichTooltipBehavior } from './OrRichTooltipV3/index.js';
152
152
  export { default as OrSearch } from './OrSearch/OrSearch.js';
153
153
  export { default as OrSearchV3 } from './OrSearchV3/OrSearch.js';