@onereach/ui-components 21.4.0 → 21.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.
@@ -56,7 +56,7 @@ declare const _default: import("vue").DefineComponent<{
56
56
  toolbarButtonRef: import("vue").Ref<any>;
57
57
  moreButtonRef: import("vue").Ref<any>;
58
58
  textareaRef: import("vue").Ref<HTMLTextAreaElement | undefined>;
59
- moreRef: import("vue").Ref<any>;
59
+ morePopoverRef: import("vue").Ref<any>;
60
60
  menuRef: import("vue").Ref<any>;
61
61
  handleToolbarClick: (item: string, level?: number) => void;
62
62
  handleEditorClick: () => void;
@@ -75,6 +75,7 @@ declare const _default: import("vue").DefineComponent<{
75
75
  link: import("vue").Ref<string>;
76
76
  isFocused: import("vue").Ref<boolean>;
77
77
  isVisible: (value: string | Array<string>) => boolean;
78
+ isMobile: import("vue").ComputedRef<boolean>;
78
79
  countOfNotVisibleTools: import("vue").Ref<number>;
79
80
  notVisibleTools: import("vue").ComputedRef<Set<string>>;
80
81
  handleInput: (event: InputEvent) => void;
@@ -13,7 +13,7 @@ import Underline from '@tiptap/extension-underline';
13
13
  import StarterKit from '@tiptap/starter-kit';
14
14
  import { useResizeObserver, useDebounceFn, onClickOutside } from '@vueuse/core';
15
15
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
16
- import { u as ue, c } from '../OrAutocompleteV3-961163d0.js';
16
+ import { u as ue, n as ne, c } from '../OrAutocompleteV3-961163d0.js';
17
17
  import { TextSelection, Selection } from 'prosemirror-state';
18
18
  import { exitCode } from 'prosemirror-commands';
19
19
  import { EditorState } from '@codemirror/state';
@@ -108,6 +108,8 @@ const RichTextEditor = [
108
108
  const RichTextEditorToolbar = [
109
109
  // Layout
110
110
  'layout-row',
111
+ // Overflow
112
+ 'overflow-x-scroll md:overflow-x-hidden', 'scrollbar-hidden',
111
113
  // Spacing
112
114
  'px-0', 'py-sm',
113
115
  // Theme
@@ -656,7 +658,7 @@ var script = defineComponent({
656
658
  const textareaRef = ref();
657
659
  const containerRef = ref();
658
660
  const moreButtonRef = ref();
659
- const moreRef = ref();
661
+ const morePopoverRef = ref();
660
662
  const toolbarButtonRef = ref();
661
663
  const menuRef = ref();
662
664
  // isActive should be set with default values for all toolbar buttons, otherwise it will not work in vue2
@@ -686,6 +688,9 @@ var script = defineComponent({
686
688
  const link = ref('');
687
689
  const countOfNotVisibleTools = ref(0);
688
690
  const sourceValue = ref('');
691
+ const {
692
+ isMobile
693
+ } = ne();
689
694
  let trap = useFocusTrap(controlRef, {
690
695
  fallbackFocus: '.container',
691
696
  allowOutsideClick: true
@@ -854,9 +859,10 @@ var script = defineComponent({
854
859
  activeHeadingLevel.value = ((_c = (_b = editor.value) === null || _b === void 0 ? void 0 : _b.getAttributes('heading')) === null || _c === void 0 ? void 0 : _c.level) || 0;
855
860
  };
856
861
  const isVisible = value => {
862
+ if (isMobile.value) return true;
857
863
  if (c(value)) {
858
864
  const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
859
- return isHaveNotVisibleTools;
865
+ return !isHaveNotVisibleTools;
860
866
  }
861
867
  return !notVisibleTools.value.has(value);
862
868
  };
@@ -1013,7 +1019,7 @@ var script = defineComponent({
1013
1019
  toolbarButtonRef,
1014
1020
  moreButtonRef,
1015
1021
  textareaRef,
1016
- moreRef,
1022
+ morePopoverRef,
1017
1023
  menuRef,
1018
1024
  handleToolbarClick,
1019
1025
  handleEditorClick,
@@ -1030,6 +1036,7 @@ var script = defineComponent({
1030
1036
  link,
1031
1037
  isFocused,
1032
1038
  isVisible,
1039
+ isMobile,
1033
1040
  countOfNotVisibleTools,
1034
1041
  notVisibleTools,
1035
1042
  handleInput,
@@ -1096,7 +1103,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1096
1103
  return openBlock(), createElementBlock("div", {
1097
1104
  key: index,
1098
1105
  class: normalizeClass([..._ctx.toolbarGroupStyles, {
1099
- 'hidden': _ctx.isVisible(tools)
1106
+ 'hidden': !_ctx.isVisible(tools)
1100
1107
  }]),
1101
1108
  disabled: _ctx.disabled || !_ctx.isFocused
1102
1109
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(tools, item => {
@@ -1135,17 +1142,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1135
1142
  onClick: $event => _ctx.handleToolbarClick(item)
1136
1143
  }, null, 8 /* PROPS */, ["icon", "tooltip", "selected", "disabled", "onClick"])) : createCommentVNode("v-if", true)], 2 /* CLASS */);
1137
1144
  }), 128 /* KEYED_FRAGMENT */))], 10 /* CLASS, PROPS */, _hoisted_2);
1138
- }), 128 /* KEYED_FRAGMENT */)), _ctx.countOfNotVisibleTools > 0 ? (openBlock(), createBlock(_component_OrIconButton, {
1145
+ }), 128 /* KEYED_FRAGMENT */)), _ctx.countOfNotVisibleTools > 0 && !_ctx.isMobile ? (openBlock(), createBlock(_component_OrIconButton, {
1139
1146
  key: 0,
1140
1147
  ref: 'moreButtonRef',
1141
- class: normalizeClass(['px-sm']),
1148
+ class: normalizeClass(['mx-sm']),
1142
1149
  icon: {
1143
1150
  icon: 'more_horiz',
1144
1151
  variant: 'inherit'
1145
1152
  },
1146
1153
  disabled: _ctx.disabled || !_ctx.isFocused,
1147
- onClick: _cache[1] || (_cache[1] = $event => _ctx.moreRef && _ctx.moreRef.open())
1148
- }, null, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 10 /* CLASS, PROPS */, _hoisted_1), createElementVNode("div", _hoisted_3, [withDirectives(createElementVNode("textarea", {
1154
+ "force-state": _ctx.morePopoverRef && _ctx.morePopoverRef.state === 'open' ? 'hover' : undefined,
1155
+ onClick: _cache[1] || (_cache[1] = $event => _ctx.morePopoverRef && _ctx.morePopoverRef.open())
1156
+ }, null, 8 /* PROPS */, ["disabled", "force-state"])) : createCommentVNode("v-if", true)], 10 /* CLASS, PROPS */, _hoisted_1), createElementVNode("div", _hoisted_3, [withDirectives(createElementVNode("textarea", {
1149
1157
  ref: 'textareaRef',
1150
1158
  "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.sourceValue = $event),
1151
1159
  activated: _ctx.disableMarkdown,
@@ -1169,7 +1177,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1169
1177
  _: 1 /* STABLE */
1170
1178
  }, 8 /* PROPS */, ["disabled"]), [[vShow, typeof _ctx.error === 'string' && _ctx.error.length > 0]]), _ctx.moreButtonRef ? (openBlock(), createBlock(_component_OrPopover, {
1171
1179
  key: 2,
1172
- ref: 'moreRef',
1180
+ ref: 'morePopoverRef',
1173
1181
  trigger: _ctx.moreButtonRef && _ctx.moreButtonRef.root,
1174
1182
  placement: 'top-end'
1175
1183
  }, {
@@ -111,6 +111,7 @@ declare const _default: import("vue").DefineComponent<{
111
111
  proxyModelValue: import("@onereach/ui-components-common/hooks").UseProxyModelValueReturn<SelectModelValue>;
112
112
  readonly: import("vue").ComputedRef<boolean>;
113
113
  isEmptyModelValue: import("vue").ComputedRef<boolean>;
114
+ isOpen: import("vue").ComputedRef<boolean>;
114
115
  showClear: import("vue").ComputedRef<boolean>;
115
116
  searchText: import("vue").Ref<string>;
116
117
  internalSearchOptions: import("vue").Ref<{
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, toRefs, computed, withDirectives, openBlock, createElementBlock, normalizeStyle, normalizeClass, vModelDynamic, renderSlot, watch, resolveComponent, createVNode, createSlots, withCtx, createTextVNode, toDisplayString, createElementVNode, vShow, createBlock, createCommentVNode, Fragment, getCurrentInstance, resolveDirective, withModifiers, renderList } from 'vue';
1
+ import { defineComponent, ref, toRefs, computed, withDirectives, openBlock, createElementBlock, normalizeStyle, normalizeClass, vModelDynamic, renderSlot, watch, resolveComponent, createVNode, createSlots, withCtx, createTextVNode, toDisplayString, createElementVNode, vShow, createBlock, createCommentVNode, Fragment, getCurrentInstance, nextTick, resolveDirective, withModifiers, renderList } from 'vue';
2
2
  import { r as re, l as u, F as Ft, m as d, $ as $t, s, f as c, n as ne, H as Ht, P as Pt } from '../OrAutocompleteV3-961163d0.js';
3
3
  import { l } from '../OrEditorTabsV3-856e42f1.js';
4
4
  import { useFocus } from '@vueuse/core';
@@ -695,6 +695,7 @@ var script = defineComponent({
695
695
  var _a;
696
696
  return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
697
697
  });
698
+ const isOpen = computed(() => popoverState.value === 'open');
698
699
  // Props
699
700
  const {
700
701
  enableClear,
@@ -738,6 +739,11 @@ var script = defineComponent({
738
739
  }, {
739
740
  deep: true
740
741
  });
742
+ watch(isOpen, value => {
743
+ if (!value) {
744
+ resetSearch();
745
+ }
746
+ });
741
747
  const groupedOptions = computed(() => {
742
748
  const groupBy = props.groupByFunction;
743
749
  if (groupBy) {
@@ -831,7 +837,9 @@ var script = defineComponent({
831
837
  resetSearch();
832
838
  }
833
839
  function resetSearch() {
834
- searchText.value = '';
840
+ nextTick(() => {
841
+ setTimeout(() => searchText.value = '');
842
+ });
835
843
  }
836
844
  // Utils
837
845
  const {
@@ -861,6 +869,7 @@ var script = defineComponent({
861
869
  proxyModelValue,
862
870
  readonly,
863
871
  isEmptyModelValue,
872
+ isOpen,
864
873
  showClear,
865
874
  searchText,
866
875
  internalSearchOptions,
@@ -928,6 +937,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
928
937
  invalid: !!_ctx.error,
929
938
  readonly: _ctx.readonly,
930
939
  disabled: _ctx.disabled,
940
+ "force-state": _ctx.isOpen ? 'focus-within' : undefined,
931
941
  tabindex: !_ctx.disabled ? 0 : null
932
942
  }, {
933
943
  default: withCtx(() => [createElementVNode("div", {
@@ -1116,7 +1126,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1116
1126
  _: 3 /* FORWARDED */
1117
1127
  }, 8 /* PROPS */, ["class", "custom-styles", "trigger"])]),
1118
1128
  _: 3 /* FORWARDED */
1119
- }, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled", "tabindex"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), _ctx.$slots.hint || _ctx.hint ? withDirectives((openBlock(), createBlock(_component_OrHint, {
1129
+ }, 8 /* PROPS */, ["class", "variant", "size", "invalid", "readonly", "disabled", "force-state", "tabindex"])), [[_directive_dropdown_open, _ctx.toggle], [_directive_dropdown_close, _ctx.close]]), _ctx.$slots.hint || _ctx.hint ? withDirectives((openBlock(), createBlock(_component_OrHint, {
1120
1130
  key: 1,
1121
1131
  disabled: _ctx.disabled
1122
1132
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "21.4.0",
3
+ "version": "21.4.2",
4
4
  "description": "Vue components library for v3",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,8 +45,8 @@
45
45
  "@codemirror/view": "^6",
46
46
  "@floating-ui/dom": "1.5.3",
47
47
  "@lezer/highlight": "*",
48
- "@onereach/styles": "^21.4.0",
49
- "@onereach/ui-components-common": "^21.4.0",
48
+ "@onereach/styles": "^21.4.2",
49
+ "@onereach/ui-components-common": "^21.4.2",
50
50
  "@splidejs/splide": "4.0.6",
51
51
  "@tiptap/core": "2.0.3",
52
52
  "@tiptap/extension-blockquote": "2.0.3",
@@ -103,5 +103,5 @@
103
103
  "access": "public"
104
104
  },
105
105
  "npmUnpacked": "4.15.2",
106
- "gitHead": "6ed081f6c690d452613d05afdfb30703139644c3"
106
+ "gitHead": "c1aa388b69aafd6d5d23479c8be7b0dfd38a0ff5"
107
107
  }