sprintify-ui 0.6.32 → 0.6.33

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 (80) hide show
  1. package/dist/sprintify-ui.es.js +11685 -11472
  2. package/dist/style.css +1 -1
  3. package/dist/tailwindcss/button.js +260 -0
  4. package/dist/tailwindcss/index.js +16 -301
  5. package/dist/tailwindcss/input.js +24 -0
  6. package/dist/tailwindcss/overlay.js +13 -0
  7. package/dist/tailwindcss/theme.js +46 -0
  8. package/dist/types/src/components/BaseActionItemButton.vue.d.ts +2 -2
  9. package/dist/types/src/components/BaseAddressForm.vue.d.ts +10 -0
  10. package/dist/types/src/components/BaseAutocomplete.vue.d.ts +10 -10
  11. package/dist/types/src/components/BaseAutocompleteDrawer.vue.d.ts +3 -3
  12. package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +6 -6
  13. package/dist/types/src/components/BaseAvatarGroup.vue.d.ts +1 -1
  14. package/dist/types/src/components/BaseBelongsTo.vue.d.ts +6 -6
  15. package/dist/types/src/components/BaseBelongsToFetch.vue.d.ts +6 -6
  16. package/dist/types/src/components/BaseButton.vue.d.ts +12 -12
  17. package/dist/types/src/components/BaseButtonGroup.vue.d.ts +24 -24
  18. package/dist/types/src/components/BaseCalendar.vue.d.ts +1 -1
  19. package/dist/types/src/components/BaseColor.vue.d.ts +19 -0
  20. package/dist/types/src/components/BaseDataIterator.vue.d.ts +1 -1
  21. package/dist/types/src/components/BaseDataIteratorSectionColumns.vue.d.ts +4 -4
  22. package/dist/types/src/components/BaseDataTable.vue.d.ts +1 -1
  23. package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +1 -1
  24. package/dist/types/src/components/BaseField.vue.d.ts +13 -3
  25. package/dist/types/src/components/BaseInput.vue.d.ts +35 -4
  26. package/dist/types/src/components/BaseInputError.vue.d.ts +14 -1
  27. package/dist/types/src/components/BaseInputLabel.vue.d.ts +15 -5
  28. package/dist/types/src/components/BaseLayoutSidebarConfigurable.vue.d.ts +1 -1
  29. package/dist/types/src/components/BaseLayoutStackedConfigurable.vue.d.ts +1 -1
  30. package/dist/types/src/components/BaseLoadingCover.vue.d.ts +1 -1
  31. package/dist/types/src/components/BaseMediaGallery.vue.d.ts +1 -1
  32. package/dist/types/src/components/BaseMediaListItem.vue.d.ts +1 -1
  33. package/dist/types/src/components/BaseMediaPictures.vue.d.ts +1 -1
  34. package/dist/types/src/components/BaseMediaPicturesItem.vue.d.ts +1 -1
  35. package/dist/types/src/components/BaseMenu.vue.d.ts +1 -1
  36. package/dist/types/src/components/BaseMenuItem.vue.d.ts +1 -1
  37. package/dist/types/src/components/BaseNavbar.vue.d.ts +1 -1
  38. package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +1 -1
  39. package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +1 -1
  40. package/dist/types/src/components/BaseSelect.vue.d.ts +27 -0
  41. package/dist/types/src/components/BaseSideNavigation.vue.d.ts +3 -3
  42. package/dist/types/src/components/BaseSwitch.vue.d.ts +1 -1
  43. package/dist/types/src/components/BaseTable.vue.d.ts +1 -1
  44. package/dist/types/src/components/BaseTabs.vue.d.ts +3 -3
  45. package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +3 -3
  46. package/dist/types/src/composables/field.d.ts +3 -0
  47. package/dist/types/src/composables/inputSize.d.ts +6 -0
  48. package/dist/types/src/utils/sizes.d.ts +19 -0
  49. package/package.json +1 -1
  50. package/src/assets/form.css +1 -1
  51. package/src/components/BaseAddressForm.stories.js +7 -2
  52. package/src/components/BaseAddressForm.vue +64 -37
  53. package/src/components/BaseAutocomplete.stories.js +1 -1
  54. package/src/components/BaseAutocomplete.vue +86 -96
  55. package/src/components/BaseAutocompleteDrawer.vue +3 -2
  56. package/src/components/BaseAutocompleteFetch.stories.js +1 -1
  57. package/src/components/BaseAutocompleteFetch.vue +3 -2
  58. package/src/components/BaseBelongsTo.stories.js +1 -1
  59. package/src/components/BaseBelongsTo.vue +3 -2
  60. package/src/components/BaseBelongsToFetch.vue +3 -2
  61. package/src/components/BaseButton.stories.js +21 -0
  62. package/src/components/BaseButton.vue +42 -6
  63. package/src/components/BaseButtonGroup.stories.js +31 -1
  64. package/src/components/BaseButtonGroup.vue +46 -33
  65. package/src/components/BaseColor.stories.js +22 -0
  66. package/src/components/BaseColor.vue +28 -25
  67. package/src/components/BaseDropdown.stories.js +2 -3
  68. package/src/components/BaseDropdownAutocomplete.vue +2 -2
  69. package/src/components/BaseField.vue +19 -8
  70. package/src/components/BaseInput.stories.js +35 -1
  71. package/src/components/BaseInput.vue +154 -74
  72. package/src/components/BaseInputError.vue +32 -2
  73. package/src/components/BaseInputLabel.vue +36 -9
  74. package/src/components/BaseSelect.stories.js +34 -0
  75. package/src/components/BaseSelect.vue +57 -8
  76. package/src/components/BaseTagAutocomplete.vue +3 -2
  77. package/src/components/BaseTimelineItem.stories.js +1 -3
  78. package/src/composables/field.ts +20 -0
  79. package/src/composables/inputSize.ts +29 -0
  80. package/src/utils/sizes.ts +21 -0
@@ -1,7 +1,37 @@
1
1
  <template>
2
- <p class="block text-sm font-medium leading-tight text-red-600">
2
+ <p :class="classes">
3
3
  <slot />
4
4
  </p>
5
5
  </template>
6
6
 
7
- <script lang="ts" setup></script>
7
+ <script lang="ts" setup>
8
+ import { useInputSize } from '@/composables/inputSize';
9
+ import { Size } from '@/utils/sizes';
10
+ import { PropType } from 'vue';
11
+
12
+
13
+ const props = defineProps({
14
+ size: {
15
+ default: undefined,
16
+ type: String as PropType<Size>,
17
+ },
18
+ });
19
+
20
+ const { size } = useInputSize(computed(() => props.size));
21
+
22
+ const classes = computed(() => {
23
+ const base = 'block font-medium leading-tight text-red-600';
24
+
25
+ const responsive = {
26
+ 'xs': 'text-xs mb-0.5',
27
+ 'sm': 'text-xs mb-1',
28
+ 'md': 'text-sm mb-1',
29
+ }[size.value];
30
+
31
+ return [
32
+ base,
33
+ responsive,
34
+ ]
35
+ });
36
+
37
+ </script>
@@ -2,25 +2,27 @@
2
2
  <label :class="classes">
3
3
  <div
4
4
  ref="labelRef"
5
- class="relative inline-flex"
5
+ class="relative inline-flex items-center flex-wrap"
6
6
  :class="[help ? 'cursor-help' : 'cursor-default']"
7
7
  >
8
8
  <div> {{ label }}</div>
9
9
 
10
+ <div
11
+ v-if="required"
12
+ class="ml-0.5 text-red-600"
13
+ > *</div>
14
+
10
15
  <BaseTooltip
11
16
  v-if="help"
12
17
  :text="help"
13
18
  >
14
19
  <BaseIcon
15
- class="block relative text-slate-900 -bottom-[3px] ml-1 mr-1 h-[13px] w-[13px]"
20
+ class="block relative text-slate-900 ml-1 mr-1 h-[13px] w-[13px]"
16
21
  icon="mdi:information-outline"
17
22
  />
18
23
  </BaseTooltip>
19
24
 
20
- <div
21
- v-if="required"
22
- class="ml-0.5 text-red-600"
23
- > *</div>
25
+
24
26
  </div>
25
27
  </label>
26
28
  </template>
@@ -29,8 +31,15 @@
29
31
  import { PropType } from 'vue';
30
32
  import { Icon as BaseIcon } from '@iconify/vue';
31
33
  import BaseTooltip from './BaseTooltip.vue';
34
+ import { Size } from '@/utils/sizes';
35
+ import { useInputSize } from '@/composables/inputSize';
36
+ import { ClassNameValue, twMerge } from 'tailwind-merge';
32
37
 
33
- defineProps({
38
+ defineOptions({
39
+ inheritAttrs: false,
40
+ });
41
+
42
+ const props = defineProps({
34
43
  required: {
35
44
  default: false,
36
45
  type: Boolean,
@@ -39,16 +48,34 @@ defineProps({
39
48
  required: true,
40
49
  type: String,
41
50
  },
42
- classes: {
51
+ class: {
43
52
  default: 'mb-1 block text-sm',
44
- type: String,
53
+ type: [String, Array] as PropType<ClassNameValue>,
45
54
  },
46
55
  help: {
47
56
  default: null,
48
57
  type: [String, null] as PropType<string | null>,
49
58
  },
59
+ size: {
60
+ default: undefined,
61
+ type: String as PropType<Size>,
62
+ },
50
63
  });
51
64
 
52
65
  const labelRef = ref();
53
66
 
67
+ const { size } = useInputSize(computed(() => props.size));
68
+
69
+ const classes = computed(() => {
70
+ const base = 'mb-1 block text-sm';
71
+
72
+ const responsive = {
73
+ 'xs': 'text-xs mb-[0.2rem]',
74
+ 'sm': 'text-sm mb-1',
75
+ 'md': 'text-sm mb-1',
76
+ }[size.value];
77
+
78
+ return twMerge(base, responsive, props.class);
79
+ });
80
+
54
81
  </script>
@@ -78,6 +78,23 @@ Disabled.args = {
78
78
  disabled: true,
79
79
  };
80
80
 
81
+ const TemplateSizes = (args) => ({
82
+ components: { BaseSelect },
83
+ setup() {
84
+ const value = ref(null);
85
+ const sizes = ['xs', 'sm', 'md'];
86
+ return { args, value, sizes, options };
87
+ },
88
+ template: `
89
+ <div v-for="size in sizes" :key="size" class="mb-4">
90
+ <p class="text-xs text-slate-600 leading-tight mb-1">btn {{ size }}</p>
91
+ <BaseSelect v-model="value" v-bind="args" :options="options" label-key="label" value-key="value" :size="size" class="w-full"></BaseSelect>
92
+ </div>
93
+ `,
94
+ });
95
+
96
+ export const Sizes = TemplateSizes.bind({});
97
+
81
98
  export const OptionsAsProps = (args) => ({
82
99
  components: { BaseSelect, ShowValue },
83
100
  setup() {
@@ -106,6 +123,23 @@ OptionsAsProps.args = {
106
123
  valueKey: 'label',
107
124
  };
108
125
 
126
+ const CustomClassesT = (args) => ({
127
+ components: { BaseSelect },
128
+ setup() {
129
+ const value = ref(null);
130
+ return { args, value };
131
+ },
132
+ template: `
133
+ <BaseSelect
134
+ v-model="value"
135
+ v-bind="args"
136
+ class="w-full bg-green-100 text-green-700 border-green-700 focus-within:border-red-500 focus-within:ring-red-800 placeholder:text-green-400 shadow-xl"
137
+ ></BaseSelect>
138
+ `,
139
+ });
140
+
141
+ export const CustomClasses = CustomClassesT.bind({});
142
+
109
143
  export const Field = createFieldStory({
110
144
  component: BaseSelect,
111
145
  componentName: 'BaseSelect',
@@ -5,11 +5,7 @@
5
5
  :name="nameInternal"
6
6
  :disabled="disabled"
7
7
  :required="requiredInternal"
8
- class="rounded border disabled:cursor-not-allowed disabled:text-slate-300 disabled:opacity-100"
9
- :class="[
10
- !modelValue && requiredInternal ? 'text-slate-400' : '',
11
- hasErrorInternal ? 'border-red-600' : 'border-slate-300',
12
- ]"
8
+ :class="classes"
13
9
  @change="onChange($event)"
14
10
  >
15
11
  <template v-if="requiredInternal">
@@ -43,17 +39,22 @@
43
39
 
44
40
  <script lang="ts" setup>
45
41
  import { PropType } from 'vue';
46
- import { get, isArray, isEqual } from 'lodash';
47
- import { useMutationObserver } from '@vueuse/core';
42
+ import { get, isArray } from 'lodash';
48
43
  import { useField } from '@/composables/field';
49
44
  import { NormalizedOption, OptionValue, Option } from '@/types';
50
45
  import { t } from '@/i18n';
46
+ import { twMerge } from 'tailwind-merge';
47
+ import { Size, sizes } from '@/utils/sizes';
51
48
 
52
49
  type SelectOption = string | number | null;
53
50
 
54
51
  const EMPTY_VALUE_INTERNAL = '';
55
52
  const EMPTY_VALUE_EXTERNAL = null;
56
53
 
54
+ defineOptions({
55
+ inheritAttrs: false,
56
+ });
57
+
57
58
  const props = defineProps({
58
59
  modelValue: {
59
60
  default: undefined,
@@ -63,6 +64,14 @@ const props = defineProps({
63
64
  default: undefined,
64
65
  type: String,
65
66
  },
67
+ class: {
68
+ default: '',
69
+ type: [String, Array] as PropType<string | string[]>,
70
+ },
71
+ size: {
72
+ default: undefined,
73
+ type: String as PropType<Size>,
74
+ },
66
75
  placeholder: {
67
76
  default: '',
68
77
  type: String,
@@ -91,16 +100,21 @@ const props = defineProps({
91
100
  default: undefined,
92
101
  type: String,
93
102
  },
103
+ visibleFocus: {
104
+ default: true,
105
+ type: Boolean,
106
+ },
94
107
  });
95
108
 
96
109
  const select = ref<HTMLSelectElement | null>(null);
97
110
 
98
111
  const emit = defineEmits(['update:modelValue']);
99
112
 
100
- const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
113
+ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeInternal } =
101
114
  useField({
102
115
  name: computed(() => props.name),
103
116
  required: computed(() => props.required),
117
+ size: computed(() => props.size),
104
118
  hasError: computed(() => props.hasError),
105
119
  emit: emit,
106
120
  });
@@ -182,4 +196,39 @@ const normalizedOptions = computed<NormalizedOption[] | undefined>(() => {
182
196
  } as NormalizedOption;
183
197
  });
184
198
  });
199
+
200
+ const classes = computed(() => {
201
+ const base = 'input-rounded border transition-colors duration-200 py-0';
202
+
203
+ let focusClass = '';
204
+ if (props.visibleFocus) {
205
+ if (hasErrorInternal.value) {
206
+ focusClass = 'focus-within:input-focus-error';
207
+ } else {
208
+ focusClass = 'focus-within:input-focus';
209
+ }
210
+ }
211
+
212
+ const disabled = 'disabled:cursor-not-allowed disabled:text-slate-300 disabled:opacity-100';
213
+ const error = hasErrorInternal.value ? 'border-red-600' : 'border-slate-300';
214
+ const textColor = !props.modelValue && requiredInternal ? 'text-slate-400' : '';
215
+ const sizeConfig = sizes[sizeInternal.value];
216
+ const padding = {
217
+ xs: 'pl-2 pr-7',
218
+ sm: 'pl-2.5 pr-8',
219
+ md: 'pl-3 pr-10',
220
+ }[sizeInternal.value];
221
+
222
+ return twMerge([
223
+ base,
224
+ focusClass,
225
+ disabled,
226
+ error,
227
+ textColor,
228
+ sizeConfig.height,
229
+ sizeConfig.fontSize,
230
+ padding,
231
+ props.class,
232
+ ]);
233
+ });
185
234
  </script>
@@ -116,6 +116,7 @@ import { useNotificationsStore } from '@/stores/notifications';
116
116
  import BaseAutocompleteDrawer from './BaseAutocompleteDrawer.vue';
117
117
  import { twMerge } from 'tailwind-merge';
118
118
  import { t } from '@/i18n';
119
+ import { Size } from '@/utils/sizes';
119
120
 
120
121
  const notifications = useNotificationsStore();
121
122
 
@@ -177,8 +178,8 @@ const props = defineProps({
177
178
  type: Boolean,
178
179
  },
179
180
  size: {
180
- default: 'base',
181
- type: String as PropType<'xs' | 'sm' | 'base'>,
181
+ default: 'md',
182
+ type: String as PropType<Size>,
182
183
  },
183
184
  dropdownShow: {
184
185
  default: 'focus',
@@ -68,9 +68,7 @@ WithDescription.args = {
68
68
  item: {
69
69
  title: 'Advanced to phone screening by Bethany Blake',
70
70
  icon: 'heroicons:shield-check-20-solid',
71
- description:
72
- 'Lorem nostrud quis aute elit ea Lorem magna eiusmod ipsum. Eu ipsum eiusmod ad minim adipisicing irure. Fugiat ut adipisicing consequat dolor.',
73
- color: 'primary',
71
+ description: 'Lorem nostrud quis aute elit ea Lorem magna eiusmod ipsum. Eu ipsum eiusmod ad minim adipisicing irure. Fugiat ut adipisicing consequat dolor.',
74
72
  date: '15 Jan',
75
73
  },
76
74
  };
@@ -1,21 +1,26 @@
1
+ import { Size } from '@/utils/sizes';
1
2
  import { uniqueId } from 'lodash';
2
3
  import { Ref } from 'vue';
4
+ import { useInputSize } from './inputSize';
3
5
 
4
6
  interface Config {
5
7
  name: Ref<string | null | undefined>;
6
8
  required: Ref<boolean>;
7
9
  hasError: Ref<boolean | undefined>;
8
10
  emit: any;
11
+ size?: Ref<Size | undefined>;
9
12
  errorType?: string;
10
13
  labelClass?: string;
11
14
  }
12
15
 
13
16
  export function useField(config: Config) {
17
+
14
18
  const uuid = uniqueId();
15
19
  const name = config.name;
16
20
  const required = config.required;
17
21
  const hasError = config.hasError;
18
22
  const emit = config.emit;
23
+ const size = config.size;
19
24
  const errorType = config.errorType ?? null;
20
25
  const labelClass = config.labelClass ?? null;
21
26
 
@@ -23,6 +28,7 @@ export function useField(config: Config) {
23
28
 
24
29
  const fieldRequired = inject('field:required', ref(false)) as Ref<boolean>;
25
30
  const fieldName = inject('field:name', ref('')) as Ref<string>;
31
+ const fieldSize = inject('field:size', ref('md')) as Ref<Size>;
26
32
 
27
33
  const fieldOnUpdate = inject('field:onUpdate', () => {
28
34
  return;
@@ -88,6 +94,19 @@ export function useField(config: Config) {
88
94
  return fieldName.value;
89
95
  });
90
96
 
97
+ const sizeInternal = computed((): Size => {
98
+
99
+ let s = size?.value ?? null;
100
+
101
+ if (!s) {
102
+ s = fieldSize.value;
103
+ }
104
+
105
+ const inputSize = useInputSize(s);
106
+
107
+ return inputSize.size.value;
108
+ });
109
+
91
110
  const errorMessageInternal = computed((): string | null | undefined => {
92
111
  return getErrorMessageByName(nameInternal.value);
93
112
  });
@@ -110,6 +129,7 @@ export function useField(config: Config) {
110
129
  nameInternal,
111
130
  hasErrorInternal,
112
131
  errorMessageInternal,
132
+ sizeInternal,
113
133
  emitUpdate,
114
134
  enableForm: () => enableForm(uuid),
115
135
  disableForm: () => disableForm(uuid),
@@ -0,0 +1,29 @@
1
+ import { useBreakpoints } from "./breakpoints";
2
+ import { Size } from "@/utils/sizes";
3
+ import { MaybeRef } from "vue";
4
+
5
+ function useInputSize(size: MaybeRef<Size | '' | undefined | null>) {
6
+
7
+ const bp = useBreakpoints();
8
+
9
+ const sizeInternal = computed(() => {
10
+
11
+ if (bp.smaller('sm').value) {
12
+ return 'md';
13
+ }
14
+
15
+ let s = unref(size);
16
+
17
+ if (!s) {
18
+ s = 'md';
19
+ }
20
+
21
+ return s;
22
+ });
23
+
24
+ return {
25
+ size: sizeInternal,
26
+ };
27
+ }
28
+
29
+ export { useInputSize };
@@ -0,0 +1,21 @@
1
+ const sizes = {
2
+ xs: {
3
+ fontSize: 'text-xs',
4
+ height: 'h-control-xs',
5
+ iconSize: 'h-[0.9rem] w-[0.9rem]'
6
+ },
7
+ sm: {
8
+ fontSize: 'text-sm',
9
+ height: 'h-control-sm',
10
+ iconSize: 'h-[1.125rem] w-[1.125rem]'
11
+ },
12
+ md: {
13
+ fontSize: 'text-base',
14
+ height: 'h-control-md',
15
+ iconSize: 'h-5 w-5'
16
+ },
17
+ };
18
+
19
+ type Size = keyof typeof sizes;
20
+
21
+ export { sizes, Size }