sprintify-ui 0.0.93 → 0.0.95

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 (82) hide show
  1. package/dist/sprintify-ui.es.js +15422 -6148
  2. package/dist/style.css +1 -1
  3. package/dist/types/src/components/BaseActionItem.vue.d.ts +25 -102
  4. package/dist/types/src/components/BaseApp.vue.d.ts +8 -47
  5. package/dist/types/src/components/BaseAutocomplete.vue.d.ts +91 -327
  6. package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +85 -290
  7. package/dist/types/src/components/BaseBadge.vue.d.ts +27 -110
  8. package/dist/types/src/components/BaseBelongsTo.vue.d.ts +89 -294
  9. package/dist/types/src/components/BaseButtonGroup.vue.d.ts +71 -254
  10. package/dist/types/src/components/BaseCard.vue.d.ts +15 -68
  11. package/dist/types/src/components/BaseClipboard.vue.d.ts +15 -68
  12. package/dist/types/src/components/BaseColor.vue.d.ts +63 -0
  13. package/dist/types/src/components/BaseDataIterator.vue.d.ts +82 -258
  14. package/dist/types/src/components/BaseDataTable.vue.d.ts +158 -509
  15. package/dist/types/src/components/BaseDescriptionList.vue.d.ts +8 -47
  16. package/dist/types/src/components/BaseDescriptionListItem.vue.d.ts +9 -48
  17. package/dist/types/src/components/BaseDialog.vue.d.ts +31 -131
  18. package/dist/types/src/components/BaseDropdown.vue.d.ts +30 -111
  19. package/dist/types/src/components/BaseField.vue.d.ts +31 -124
  20. package/dist/types/src/components/BaseFieldI18n.vue.d.ts +1 -1
  21. package/dist/types/src/components/BaseFileUploader.vue.d.ts +54 -192
  22. package/dist/types/src/components/BaseForm.vue.d.ts +62 -226
  23. package/dist/types/src/components/BaseHasMany.vue.d.ts +66 -219
  24. package/dist/types/src/components/BaseInput.vue.d.ts +10 -1
  25. package/dist/types/src/components/BaseInputError.vue.d.ts +8 -47
  26. package/dist/types/src/components/BaseInputPercent.vue.d.ts +1 -1
  27. package/dist/types/src/components/BaseLayoutSidebar.vue.d.ts +25 -98
  28. package/dist/types/src/components/BaseLayoutSidebarConfigurable.vue.d.ts +39 -155
  29. package/dist/types/src/components/BaseLayoutStacked.vue.d.ts +17 -70
  30. package/dist/types/src/components/BaseLayoutStackedConfigurable.vue.d.ts +39 -155
  31. package/dist/types/src/components/BaseLocaleForm.vue.d.ts +1 -1
  32. package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +63 -234
  33. package/dist/types/src/components/BaseMenu.vue.d.ts +32 -105
  34. package/dist/types/src/components/BaseModalCenter.vue.d.ts +42 -132
  35. package/dist/types/src/components/BaseModalSide.vue.d.ts +29 -118
  36. package/dist/types/src/components/BaseNavbar.vue.d.ts +24 -87
  37. package/dist/types/src/components/BaseNavbarSideItem.vue.d.ts +3 -3
  38. package/dist/types/src/components/BaseRadioGroup.vue.d.ts +53 -194
  39. package/dist/types/src/components/BaseReadMore.vue.d.ts +15 -68
  40. package/dist/types/src/components/BaseRichText.vue.d.ts +92 -0
  41. package/dist/types/src/components/BaseSelect.vue.d.ts +35 -144
  42. package/dist/types/src/components/BaseSideNavigation.vue.d.ts +8 -47
  43. package/dist/types/src/components/BaseSideNavigationItem.vue.d.ts +23 -94
  44. package/dist/types/src/components/BaseSkeleton.vue.d.ts +19 -82
  45. package/dist/types/src/components/BaseSwitch.vue.d.ts +35 -144
  46. package/dist/types/src/components/BaseSystemAlert.vue.d.ts +27 -116
  47. package/dist/types/src/components/BaseTabItem.vue.d.ts +23 -94
  48. package/dist/types/src/components/BaseTable.vue.d.ts +101 -361
  49. package/dist/types/src/components/BaseTableColumn.vue.d.ts +1 -1
  50. package/dist/types/src/components/BaseTabs.vue.d.ts +8 -47
  51. package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +66 -236
  52. package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +62 -212
  53. package/dist/types/src/components/index.d.ts +3 -1
  54. package/dist/types/src/composables/clickOutside.d.ts +8 -0
  55. package/dist/types/src/composables/modal.d.ts +1 -1
  56. package/dist/types/src/utils/scrollPreventer.d.ts +1 -2
  57. package/package.json +5 -1
  58. package/src/components/BaseAppDialogs.vue +1 -1
  59. package/src/components/BaseAutocomplete.vue +6 -25
  60. package/src/components/BaseButtonGroup.vue +2 -2
  61. package/src/components/BaseColor.stories.js +50 -0
  62. package/src/components/BaseColor.vue +91 -0
  63. package/src/components/BaseDropdown.stories.js +47 -9
  64. package/src/components/BaseDropdown.vue +27 -35
  65. package/src/components/BaseForm.vue +3 -3
  66. package/src/components/BaseInput.stories.js +52 -0
  67. package/src/components/BaseInput.vue +38 -1
  68. package/src/components/BaseLayoutSidebar.vue +4 -1
  69. package/src/components/BaseModalCenter.stories.js +5 -0
  70. package/src/components/BaseModalCenter.vue +14 -10
  71. package/src/components/BaseModalSide.vue +1 -4
  72. package/src/components/BaseRichText.stories.js +102 -0
  73. package/src/components/BaseRichText.vue +121 -0
  74. package/src/components/BaseSideNavigation.vue +4 -1
  75. package/src/components/BaseTable.vue +1 -0
  76. package/src/components/BaseTabs.vue +4 -1
  77. package/src/components/BaseTagAutocomplete.vue +1 -0
  78. package/src/components/BaseTextarea.vue +1 -1
  79. package/src/components/index.ts +4 -0
  80. package/src/composables/clickOutside.ts +57 -0
  81. package/src/composables/modal.ts +2 -6
  82. package/src/utils/scrollPreventer.ts +3 -13
@@ -7,9 +7,8 @@
7
7
  >
8
8
  <div v-show="modelValue">
9
9
  <div
10
- ref="allow"
10
+ data-scroll-lock-scrollable
11
11
  class="fixed inset-0 z-modal w-full overflow-y-auto overflow-x-hidden"
12
- scroll-lock-target
13
12
  >
14
13
  <div class="flex min-h-full w-full pt-20 sm:pt-0">
15
14
  <div class="min-h-full grow">
@@ -97,10 +96,8 @@ const props = defineProps({
97
96
 
98
97
  const emit = defineEmits(['update:modelValue']);
99
98
 
100
- const allow = ref(null);
101
99
  const modal = useModal(
102
100
  computed(() => props.modelValue),
103
- allow,
104
101
  emit
105
102
  );
106
103
 
@@ -0,0 +1,102 @@
1
+ import BaseRichText from './BaseRichText.vue';
2
+ import ShowValue from '@/../.storybook/components/ShowValue.vue';
3
+ import { createFieldStory } from '@/../.storybook/utils';
4
+
5
+ const toolbarOptions = [
6
+ 'full',
7
+ 'essential',
8
+ 'minimal',
9
+ ['bold', 'italic', 'underline', 'link'],
10
+ ['bold', 'italic', 'underline', 'strike'],
11
+ ['blockquote', 'code-block'],
12
+ ['clean'], // remove formatting button
13
+ ];
14
+
15
+ export default {
16
+ title: 'Form/BaseRichText',
17
+ component: BaseRichText,
18
+ decorators: [
19
+ (story) => ({
20
+ components: { story },
21
+ template: `
22
+ <form @submit.prevent="" class="border-none">
23
+ <story/>
24
+ </form>`,
25
+ }),
26
+ ],
27
+ args: {
28
+ placeholder: 'Describe your complete life in 4 sentences...',
29
+ },
30
+ argTypes: {
31
+ theme: {
32
+ control: { type: 'select' },
33
+ options: ['snow', 'bubble', ''],
34
+ },
35
+ toolbar: {
36
+ control: { type: 'select' },
37
+ options: toolbarOptions,
38
+ },
39
+ },
40
+ };
41
+
42
+ const Template = (args) => ({
43
+ components: { BaseRichText, ShowValue },
44
+ setup() {
45
+ const value = ref(null);
46
+ return { args, value };
47
+ },
48
+ template: `
49
+ <BaseRichText v-model="value" v-bind="args" class="w-full"></BaseRichText>
50
+ <ShowValue :value="value" />
51
+ `,
52
+ });
53
+
54
+ export const Demo = Template.bind({});
55
+
56
+ export const Basic = Template.bind({});
57
+ Basic.args = {
58
+ placeholder: 'Describe your complete life in 4 sentences...',
59
+ };
60
+
61
+ export const FullToolbar = Template.bind({});
62
+ FullToolbar.args = {
63
+ toolbar: 'full',
64
+ placeholder: 'Describe your complete life in 4 sentences...',
65
+ };
66
+
67
+ export const EssentialToolbar = Template.bind({});
68
+ EssentialToolbar.args = {
69
+ toolbar: 'essential',
70
+ placeholder: 'Describe your complete life in 4 sentences...',
71
+ };
72
+
73
+ export const MinimalToolbar = Template.bind({});
74
+ MinimalToolbar.args = {
75
+ toolbar: 'minimal',
76
+ placeholder: 'Describe your complete life in 4 sentences...',
77
+ };
78
+
79
+ export const SnowTheme = Template.bind({});
80
+ SnowTheme.args = {
81
+ theme: 'snow',
82
+ placeholder: 'Describe your complete life in 4 sentences...',
83
+ };
84
+
85
+ export const BubbleTheme = Template.bind({});
86
+ BubbleTheme.args = {
87
+ theme: 'bubble',
88
+ placeholder: 'Describe your complete life in 4 sentences...',
89
+ };
90
+
91
+ export const Disabled = Template.bind({});
92
+ Disabled.args = {
93
+ modelValue: 'Lorem ipsum...',
94
+ disabled: true,
95
+ placeholder: '',
96
+ };
97
+
98
+ export const Field = createFieldStory({
99
+ component: BaseRichText,
100
+ componentName: 'BaseRichText',
101
+ label: 'Name',
102
+ });
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div
3
+ class="base-rich-text relative"
4
+ :class="[hasErrorInternal ? 'error' : '']"
5
+ >
6
+ <quill-editor
7
+ :name="nameInternal"
8
+ :required="requiredInternal"
9
+ :theme="theme"
10
+ :toolbar="toolbar"
11
+ :placeholder="placeholder"
12
+ :content="modelValue"
13
+ :read-only="disabled"
14
+ :enable="enable"
15
+ content-type="html"
16
+ @update:content="emitUpdate(updateChange($event))"
17
+ @ready="onReady"
18
+ >
19
+ </quill-editor>
20
+ </div>
21
+ </template>
22
+
23
+ <script lang="ts" setup>
24
+ import { isString, trim } from 'lodash';
25
+ import { PropType } from 'vue';
26
+ import { useField } from '@/composables/field';
27
+
28
+ import { QuillEditor, Quill } from '@vueup/vue-quill';
29
+ import Delta from 'quill-delta';
30
+ import '@vueup/vue-quill/dist/vue-quill.bubble.css';
31
+ import '@vueup/vue-quill/dist/vue-quill.snow.css';
32
+
33
+ const props = defineProps({
34
+ modelValue: {
35
+ default: undefined,
36
+ type: [String, Delta, undefined] as PropType<string | Delta | undefined>,
37
+ },
38
+ theme: {
39
+ type: String as PropType<'' | 'snow' | 'bubble'>,
40
+ default: 'snow',
41
+ },
42
+ toolbar: {
43
+ type: [String, Array] as PropType<string | string[]>,
44
+ default() {
45
+ return ['bold', 'italic', 'underline', 'link'];
46
+ },
47
+ },
48
+ placeholder: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ enable: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
60
+ required: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ name: {
65
+ default: undefined,
66
+ type: String,
67
+ },
68
+ hasError: {
69
+ default: false,
70
+ type: Boolean,
71
+ },
72
+ });
73
+
74
+ const emit = defineEmits(['update:modelValue']);
75
+
76
+ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
77
+ useField({
78
+ name: computed(() => props.name),
79
+ required: computed(() => props.required),
80
+ hasError: computed(() => props.hasError),
81
+ emit: emit,
82
+ });
83
+
84
+ function updateChange(value: string | null): string | null {
85
+ if (value === null) {
86
+ return '';
87
+ }
88
+
89
+ if (isString(value)) {
90
+ return trim(value);
91
+ }
92
+
93
+ return '';
94
+ }
95
+
96
+ function onReady(quill: Quill) {
97
+ if (quill.root) {
98
+ //(quill.root as HTMLElement).classList.add('prose', 'max-w-full');
99
+ }
100
+ }
101
+ </script>
102
+
103
+ <style lang="postcss">
104
+ .base-rich-text {
105
+ .ql-toolbar.ql-snow {
106
+ @apply rounded-t border-slate-300 font-sans;
107
+ }
108
+ .ql-container.ql-snow {
109
+ @apply rounded-b border-slate-300 font-sans;
110
+ }
111
+ .ql-container {
112
+ @apply font-sans;
113
+ }
114
+ &.error {
115
+ & .ql-toolbar.ql-snow,
116
+ & .ql-container.ql-snow {
117
+ @apply border-red-500;
118
+ }
119
+ }
120
+ }
121
+ </style>
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <nav aria-label="Sidebar" class="relative">
3
3
  <div class="absolute bottom-0 left-0 h-full w-px bg-slate-300" />
4
- <div class="relative overflow-x-auto overflow-y-hidden">
4
+ <div
5
+ class="relative overflow-x-auto overflow-y-hidden"
6
+ data-scroll-lock-scrollable
7
+ >
5
8
  <div class="space-y-2">
6
9
  <slot />
7
10
  </div>
@@ -7,6 +7,7 @@
7
7
  <div class="flex flex-col">
8
8
  <div
9
9
  class="overflow-x-auto overflow-y-auto"
10
+ data-scroll-lock-scrollable
10
11
  :style="{ maxHeight: maxHeight ? maxHeight + 'px' : undefined }"
11
12
  >
12
13
  <div class="inline-block min-w-full align-middle">
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <div class="relative">
3
3
  <div class="absolute bottom-0 left-0 h-px w-full bg-slate-300" />
4
- <div class="relative overflow-x-auto overflow-y-hidden">
4
+ <div
5
+ class="relative overflow-x-auto overflow-y-hidden"
6
+ data-scroll-lock-scrollable
7
+ >
5
8
  <ul class="flex space-x-4 text-center">
6
9
  <slot />
7
10
  </ul>
@@ -58,6 +58,7 @@
58
58
  >
59
59
  <div
60
60
  ref="dropdown"
61
+ data-scroll-lock-scrollable
61
62
  class="max-h-[214px] min-h-[75px] w-full overflow-y-auto"
62
63
  >
63
64
  <slot v-if="filteredNormalizedOptions.length == 0" name="empty">
@@ -8,7 +8,7 @@
8
8
  :required="requiredInternal"
9
9
  :rows="rows"
10
10
  :class="[hasErrorInternal ? 'border-red-500' : 'border-slate-300']"
11
- class="mb-0 block rounded disabled:cursor-not-allowed disabled:text-slate-300"
11
+ class="block mb-0 rounded disabled:cursor-not-allowed disabled:text-slate-300"
12
12
  @input="emitUpdate(transformInputValue($event))"
13
13
  />
14
14
  </template>
@@ -17,6 +17,7 @@ import BaseCard from './BaseCard.vue';
17
17
  import BaseCardRow from './BaseCardRow.vue';
18
18
  import BaseCharacterCounter from './BaseCharacterCounter.vue';
19
19
  import BaseClipboard from './BaseClipboard.vue';
20
+ import BaseColor from './BaseColor.vue';
20
21
  import BaseContainer from './BaseContainer.vue';
21
22
  import BaseCounter from './BaseCounter.vue';
22
23
  import BaseDataIterator from './BaseDataIterator.vue';
@@ -53,6 +54,7 @@ import BasePassword from './BasePassword.vue';
53
54
  import BaseProgressCircle from './BaseProgressCircle.vue';
54
55
  import BaseRadioGroup from './BaseRadioGroup.vue';
55
56
  import BaseReadMore from './BaseReadMore.vue';
57
+ import BaseRichText from './BaseRichText.vue';
56
58
  import BaseSelect from './BaseSelect.vue';
57
59
  import BaseShortcut from './BaseShortcut.vue';
58
60
  import BaseSideNavigation from './BaseSideNavigation.vue';
@@ -97,6 +99,7 @@ export {
97
99
  BaseCardRow,
98
100
  BaseCharacterCounter,
99
101
  BaseClipboard,
102
+ BaseColor,
100
103
  BaseContainer,
101
104
  BaseCounter,
102
105
  BaseDataIterator,
@@ -133,6 +136,7 @@ export {
133
136
  BaseProgressCircle,
134
137
  BaseRadioGroup,
135
138
  BaseReadMore,
139
+ BaseRichText,
136
140
  BaseSelect,
137
141
  BaseShortcut,
138
142
  BaseSideNavigation,
@@ -0,0 +1,57 @@
1
+ import { MaybeElementRef, unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
+
3
+ interface UseClickOutsideOptions {
4
+ includes?: MaybeElementRef[];
5
+ }
6
+
7
+ export function useClickOutside(
8
+ element: MaybeElementRef,
9
+ callback: (outside: boolean) => void,
10
+ options: UseClickOutsideOptions = {}
11
+ ) {
12
+ function cleanup() {
13
+ window.removeEventListener('mousedown', onClick);
14
+ }
15
+
16
+ const stopWatch = watch(
17
+ () => unrefElement(element),
18
+ (el) => {
19
+ if (el) {
20
+ cleanup();
21
+ window.addEventListener('mousedown', onClick);
22
+ }
23
+ },
24
+ { immediate: true }
25
+ );
26
+
27
+ function onClick(e: Event) {
28
+ const el = unrefElement(element);
29
+
30
+ const includeEls = options.includes?.map(unrefElement) ?? [];
31
+
32
+ if (!el) {
33
+ return;
34
+ }
35
+
36
+ const contains = el.contains(e.target as HTMLElement);
37
+
38
+ const includeContainsEl = includeEls.some((exceptionEl) =>
39
+ exceptionEl?.contains(e.target as HTMLElement)
40
+ );
41
+
42
+ const outside = !contains && !includeContainsEl;
43
+
44
+ callback(outside);
45
+ }
46
+
47
+ const stop = () => {
48
+ cleanup();
49
+ stopWatch();
50
+ };
51
+
52
+ tryOnScopeDispose(stop);
53
+
54
+ return {
55
+ stop,
56
+ };
57
+ }
@@ -1,11 +1,7 @@
1
1
  import { disableScroll, enableScroll } from '../utils';
2
2
  import { Ref } from 'vue';
3
3
 
4
- export function useModal(
5
- modelValue: Ref<boolean>,
6
- scrollable: Ref<HTMLElement | null>,
7
- emit: any
8
- ) {
4
+ export function useModal(modelValue: Ref<boolean>, emit: any) {
9
5
  const mounted = ref(false);
10
6
 
11
7
  watch(
@@ -38,7 +34,7 @@ export function useModal(
38
34
  }
39
35
 
40
36
  function activate() {
41
- disableScroll(scrollable.value);
37
+ disableScroll();
42
38
  window.addEventListener('keydown', onKeydown);
43
39
  }
44
40
 
@@ -1,20 +1,10 @@
1
- import {
2
- disablePageScroll,
3
- clearQueueScrollLocks,
4
- enablePageScroll,
5
- ScrollableTarget,
6
- } from 'scroll-lock';
1
+ import { disablePageScroll, enablePageScroll } from 'scroll-lock';
7
2
 
8
- function disableScroll(allow: ScrollableTarget | null = null) {
9
- if (allow == null) {
10
- allow = document.querySelectorAll('[scroll-lock-target]');
11
- }
12
-
13
- disablePageScroll(allow);
3
+ function disableScroll() {
4
+ disablePageScroll();
14
5
  }
15
6
 
16
7
  function enableScroll() {
17
- clearQueueScrollLocks();
18
8
  enablePageScroll();
19
9
  }
20
10