sprintify-ui 0.6.34 → 0.6.35

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 (49) hide show
  1. package/dist/sprintify-ui.es.js +15345 -15302
  2. package/dist/style.css +1 -1
  3. package/dist/tailwindcss/button.js +2 -2
  4. package/dist/tailwindcss/theme.js +14 -7
  5. package/dist/types/src/components/BaseButtonGroup.vue.d.ts +9 -0
  6. package/dist/types/src/components/BaseDataIterator.vue.d.ts +3 -3
  7. package/dist/types/src/components/BaseDataIteratorSectionButton.vue.d.ts +2 -2
  8. package/dist/types/src/components/BaseDataIteratorSectionColumns.vue.d.ts +8 -8
  9. package/dist/types/src/components/BaseDataTable.vue.d.ts +3 -3
  10. package/dist/types/src/components/BaseDataTableRowAction.vue.d.ts +4 -3
  11. package/dist/types/src/components/BaseDatePicker.vue.d.ts +10 -0
  12. package/dist/types/src/components/BaseDateSelect.vue.d.ts +9 -0
  13. package/dist/types/src/components/BaseRichText.vue.d.ts +9 -0
  14. package/dist/types/src/components/BaseTable.vue.d.ts +3 -3
  15. package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +11 -2
  16. package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +3 -2
  17. package/dist/types/src/stories/PageInputSizes.vue.d.ts +2 -0
  18. package/dist/types/src/utils/slots.d.ts +1 -0
  19. package/package.json +1 -1
  20. package/src/assets/base-rich-text.css +148 -26
  21. package/src/components/BaseButton.vue +3 -2
  22. package/src/components/BaseButtonGroup.vue +37 -9
  23. package/src/components/BaseColor.vue +29 -31
  24. package/src/components/BaseDataIterator.stories.js +8 -1
  25. package/src/components/BaseDataIterator.vue +36 -76
  26. package/src/components/BaseDataIteratorSectionButton.vue +8 -19
  27. package/src/components/BaseDataTable.vue +23 -16
  28. package/src/components/BaseDataTableRowAction.vue +2 -1
  29. package/src/components/BaseDatePicker.stories.js +23 -0
  30. package/src/components/BaseDatePicker.vue +65 -8
  31. package/src/components/BaseDateSelect.stories.js +25 -1
  32. package/src/components/BaseDateSelect.vue +80 -101
  33. package/src/components/BaseDropdownAutocomplete.stories.js +30 -15
  34. package/src/components/BaseHasMany.stories.js +22 -1
  35. package/src/components/BaseInput.stories.js +1 -1
  36. package/src/components/BaseInput.vue +4 -3
  37. package/src/components/BaseMediaPicturesItem.vue +2 -2
  38. package/src/components/BaseRichText.stories.js +6 -0
  39. package/src/components/BaseRichText.vue +12 -2
  40. package/src/components/BaseSelect.vue +5 -0
  41. package/src/components/BaseTable.vue +2 -1
  42. package/src/components/BaseTagAutocomplete.stories.js +1 -1
  43. package/src/components/BaseTagAutocomplete.vue +143 -88
  44. package/src/components/BaseTagAutocompleteFetch.stories.js +22 -1
  45. package/src/components/BaseTextareaAutoresize.vue +7 -7
  46. package/src/composables/inputSize.ts +5 -1
  47. package/src/stories/InputSizes.stories.js +22 -0
  48. package/src/stories/PageInputSizes.vue +205 -0
  49. package/src/utils/slots.ts +13 -0
@@ -1,114 +1,82 @@
1
1
  <template>
2
2
  <div>
3
- <div class="-m-0.5 flex">
4
- <div class="w-auto p-0.5">
5
- <select
6
- v-model="date.year"
7
- :disabled="disabled"
8
- :required="required"
9
- data-cy="year"
10
- class="w-full rounded"
11
- :class="[
12
- {
13
- 'cursor-not-allowed bg-slate-100 text-slate-500': disabled,
14
- },
15
- [hasErrorInternal ? 'border-red-500' : 'border-slate-300'],
16
- ]"
17
- :placeholder="t('sui.year')"
18
- @change="update()"
3
+ <div
4
+ class="flex"
5
+ :class="[
6
+ sizeInternal === 'xs' ? 'gap-0.5' : '',
7
+ sizeInternal === 'sm' ? 'gap-0.5' : '',
8
+ sizeInternal === 'md' ? 'gap-1' : '',
9
+ ]"
10
+ >
11
+ <BaseSelect
12
+ v-model="date.year"
13
+ :disabled="disabled"
14
+ :required="requiredInternal"
15
+ data-cy="year"
16
+ :has-error="hasErrorInternal"
17
+ :placeholder="t('sui.year')"
18
+ :size="sizeInternal"
19
+ @update:model-value="update()"
20
+ >
21
+ <option
22
+ v-for="year in years"
23
+ :key="year"
24
+ :value="year"
19
25
  >
20
- <option
21
- disabled
22
- selected
23
- hidden
24
- :value="null"
25
- >
26
- {{ t('sui.year') }}
27
- </option>
28
- <option
29
- v-for="year in years"
30
- :key="year"
31
- :value="year"
32
- >
33
- {{ year }}
34
- </option>
35
- </select>
36
- </div>
37
-
38
- <div class="w-auto p-0.5">
39
- <select
40
- v-model="date.month"
41
- :disabled="disabled"
42
- :required="required"
43
- data-cy="month"
44
- class="w-full rounded capitalize"
45
- :class="[
46
- {
47
- 'cursor-not-allowed bg-slate-100 text-slate-500': disabled,
48
- },
49
- [hasErrorInternal ? 'border-red-500' : 'border-slate-300'],
50
- ]"
51
- :placeholder="t('sui.month')"
52
- @change="update()"
26
+ {{ year }}
27
+ </option>
28
+ </BaseSelect>
29
+
30
+ <BaseSelect
31
+ v-model="date.month"
32
+ :disabled="disabled"
33
+ :required="requiredInternal"
34
+ data-cy="month"
35
+ class="capitalize"
36
+ :has-error="hasErrorInternal"
37
+ :placeholder="t('sui.month')"
38
+ :size="sizeInternal"
39
+ @update:model-value="update()"
40
+ >
41
+ <option
42
+ v-for="(month, i) in months"
43
+ :key="month"
44
+ :value="i + 1"
53
45
  >
54
- <option
55
- disabled
56
- selected
57
- hidden
58
- :value="null"
59
- >
60
- {{ t('sui.month') }}
61
- </option>
62
- <option
63
- v-for="(month, i) in months"
64
- :key="month"
65
- :value="i + 1"
66
- >
67
- {{ month }}
68
- </option>
69
- </select>
70
- </div>
71
-
72
- <div class="w-auto p-0.5">
73
- <select
74
- v-model="date.day"
75
- :disabled="dayDisabled"
76
- :required="required"
77
- data-cy="day"
78
- class="w-full rounded capitalize"
79
- :class="[
80
- {
81
- 'cursor-not-allowed bg-slate-100 text-slate-500': dayDisabled,
82
- },
83
- [hasErrorInternal ? 'border-red-500' : 'border-slate-300'],
84
- ]"
85
- :placeholder="t('sui.day')"
86
- @change="update()"
46
+ {{ month }}
47
+ </option>
48
+ </BaseSelect>
49
+
50
+ <BaseSelect
51
+ v-model="date.day"
52
+ :disabled="dayDisabled"
53
+ :required="requiredInternal"
54
+ data-cy="day"
55
+ :has-error="hasErrorInternal"
56
+ :placeholder="t('sui.day')"
57
+ :size="sizeInternal"
58
+ @update:model-value="update()"
59
+ >
60
+ <option
61
+ v-for="day in days"
62
+ :key="day"
63
+ :value="day"
87
64
  >
88
- <option
89
- disabled
90
- selected
91
- hidden
92
- :value="null"
93
- >
94
- {{ t('sui.day') }}
95
- </option>
96
- <option
97
- v-for="day in days"
98
- :key="day"
99
- :value="day"
100
- >
101
- {{ day }}
102
- </option>
103
- </select>
104
- </div>
65
+ {{ day }}
66
+ </option>
67
+ </BaseSelect>
105
68
  </div>
106
69
 
107
70
  <button
108
71
  v-if="clearable"
109
72
  type="button"
110
73
  :disabled="disabled"
111
- class="mt-1 appearance-none border-transparent bg-transparent text-sm text-slate-700 underline outline-none disabled:cursor-not-allowed disabled:opacity-50"
74
+ class="mt-1 appearance-none border-transparent bg-transparent text-slate-700 underline outline-none disabled:cursor-not-allowed disabled:opacity-50"
75
+ :class="[
76
+ sizeInternal === 'xs' ? 'text-xs' : '',
77
+ sizeInternal === 'sm' ? 'text-xs' : '',
78
+ sizeInternal === 'md' ? 'text-sm' : '',
79
+ ]"
112
80
  @click="clear()"
113
81
  >
114
82
  <span>{{ t('sui.clear') }}</span>
@@ -123,6 +91,8 @@ import { DateTime, Info } from 'luxon';
123
91
  import { useField } from '@/composables/field';
124
92
  import { t } from '@/i18n';
125
93
  import { useI18nStore } from '@/stores/i18n';
94
+ import BaseSelect from './BaseSelect.vue';
95
+ import { Size } from '@/utils/sizes';
126
96
 
127
97
  const props = defineProps({
128
98
  modelValue: {
@@ -133,6 +103,10 @@ const props = defineProps({
133
103
  default: false,
134
104
  type: Boolean,
135
105
  },
106
+ size: {
107
+ default: undefined,
108
+ type: String as PropType<Size>,
109
+ },
136
110
  disabled: {
137
111
  default: false,
138
112
  type: Boolean,
@@ -161,15 +135,18 @@ const props = defineProps({
161
135
 
162
136
  const emit = defineEmits(['update:modelValue']);
163
137
 
164
- const { hasErrorInternal, emitUpdate } = useField({
138
+ const { hasErrorInternal, emitUpdate, requiredInternal, sizeInternal } = useField({
165
139
  name: computed(() => props.name),
166
140
  required: computed(() => props.required),
141
+ size: computed(() => props.size),
167
142
  hasError: computed(() => props.hasError),
168
143
  emit: emit,
169
144
  });
170
145
 
171
146
  const years = range(props.maxYear, props.minYear) as number[];
147
+
172
148
  const months = Info.months('short', { locale: useI18nStore().locale });
149
+
173
150
  const days = computed(() => {
174
151
  if (!date.value.year) {
175
152
  return [];
@@ -197,6 +174,8 @@ watch(
197
174
  date.value.year = datetime.year;
198
175
  date.value.month = datetime.month;
199
176
  date.value.day = datetime.day;
177
+ } else {
178
+ clear();
200
179
  }
201
180
  },
202
181
  { immediate: true }
@@ -19,6 +19,35 @@ export default {
19
19
  },
20
20
  };
21
21
 
22
+ const template = `<template #button="{ newValue }">
23
+ <div class="btn btn-sm">
24
+ <div v-if="newValue" class="flex items-center gap-2 text-sm">
25
+ <div class="h-2 w-2 bg-red-500 rounded-full"></div>
26
+ <span>
27
+ {{ newValue.label }}
28
+ </span>
29
+ </div>
30
+ <div v-else class="">
31
+ Select a character
32
+ </div>
33
+ </div>
34
+ </template>
35
+ <template #option="{ option }">
36
+ <div class="flex items-center gap-2 text-sm px-2">
37
+ <div
38
+ class="h-2 w-2 rounded-full"
39
+ :class="{
40
+ 'bg-red-500': option?.type === 'sith',
41
+ 'bg-green-500': option?.type === 'jedi',
42
+ 'bg-slate-300': option?.type === undefined,
43
+ }"
44
+ ></div>
45
+ <span>
46
+ {{ option.label }}
47
+ </span>
48
+ </div>
49
+ </template>`
50
+
22
51
  export const Autocomplete = (args) => ({
23
52
  components: { BaseDropdownAutocomplete, BaseBadge, ShowValue },
24
53
  setup() {
@@ -30,21 +59,7 @@ export const Autocomplete = (args) => ({
30
59
  v-bind="args"
31
60
  v-model="value"
32
61
  >
33
- <template #button="{ newValue }">
34
- <BaseBadge v-if="newValue">
35
- {{ newValue.label }}
36
- </BaseBadge>
37
- <div v-else>
38
- <BaseBadge contrast="low">
39
- Nothing
40
- </BaseBadge>
41
- </div>
42
- </template>
43
- <template #option="{ option }">
44
- <BaseBadge :contrast="option?.value ? 'high' : 'low'">
45
- {{ option.label }}
46
- </BaseBadge>
47
- </template>
62
+ ${template}
48
63
  </BaseDropdownAutocomplete>
49
64
  <ShowValue :value="value" />
50
65
  `,
@@ -4,10 +4,17 @@ import { createFieldStory, options } from '../../.storybook/utils';
4
4
  import BaseAppNotifications from './BaseAppNotifications.vue';
5
5
  import QueryString from 'qs';
6
6
 
7
+ const sizes = ['xs', 'sm', 'md'];
8
+
7
9
  export default {
8
10
  title: 'Form/BaseHasMany',
9
11
  component: BaseHasMany,
10
- argTypes: {},
12
+ argTypes: {
13
+ size: {
14
+ control: { type: 'select' },
15
+ options: sizes,
16
+ },
17
+ },
11
18
  args: {
12
19
  url: 'https://effettandem.com/api/content/articles',
13
20
  field: 'title',
@@ -72,6 +79,20 @@ ShowRouteUrl.args = {
72
79
  },
73
80
  };
74
81
 
82
+ export const Sizes = (args) => ({
83
+ components: { BaseHasMany },
84
+ setup() {
85
+ const value = ref([]);
86
+ return { args, sizes, value };
87
+ },
88
+ template: `
89
+ <div v-for="size in sizes" class="mb-1">
90
+ <p class="text-xs text-slate-600 leading-tight">{{ size }}</p>
91
+ <BaseHasMany v-model="value" v-bind="args" :size="size"></BaseHasMany>
92
+ </div>
93
+ `,
94
+ });
95
+
75
96
  export const SlotOption = (args) => {
76
97
  return {
77
98
  components: { BaseHasMany },
@@ -54,7 +54,7 @@ export const Demo = Template.bind({});
54
54
 
55
55
  export const IconLeft = Template.bind({});
56
56
  IconLeft.args = {
57
- iconLeft: 'heroicons:phone-20-solid',
57
+ iconLeft: 'heroicons:calendar',
58
58
  placeholder: 'Enter your phone',
59
59
  };
60
60
 
@@ -284,6 +284,7 @@ const classes = computed(() => {
284
284
  const base = `inline-flex bg-white input-rounded border transition-colors duration-200`;
285
285
  const border = hasErrorInternal.value ? 'border-red-500' : 'border-slate-300';
286
286
  const disabled = props.disabled ? 'cursor-not-allowed text-slate-300' : '';
287
+
287
288
  const sizeConfig = sizes[sizeInternal.value];
288
289
  let focusClass = '';
289
290
  if (props.visibleFocus) {
@@ -311,9 +312,9 @@ const baseClasses = computed(() => {
311
312
  const disabled = props.disabled ? 'cursor-not-allowed text-slate-300' : '';
312
313
 
313
314
  const paddingX = {
314
- xs: [hasLeftDecoration.value ? 'pl-0.5' : 'pl-2', hasRightDecoration.value ? 'pr-0' : 'pr-2'],
315
- sm: [hasLeftDecoration.value ? 'pl-0.5' : 'pl-2.5', hasRightDecoration.value ? 'pr-0' : 'pr-2.5'],
316
- md: [hasLeftDecoration.value ? 'pl-1' : 'pl-3', hasRightDecoration.value ? 'pr-1' : 'pr-3'],
315
+ xs: [hasLeftDecoration.value ? 'pl-0' : 'pl-2', hasRightDecoration.value ? 'pr-0' : 'pr-2'],
316
+ sm: [hasLeftDecoration.value ? 'pl-0' : 'pl-2.5', hasRightDecoration.value ? 'pr-0' : 'pr-2.5'],
317
+ md: [hasLeftDecoration.value ? 'pl-0' : 'pl-3', hasRightDecoration.value ? 'pr-1' : 'pr-3'],
317
318
  }[sizeInternal.value];
318
319
 
319
320
  return [
@@ -22,7 +22,7 @@
22
22
  v-if="url"
23
23
  :href="url"
24
24
  target="_blank"
25
- class="btn btn-white rounded-full p-1 shadow-sm ring-1 ring-black ring-opacity-10"
25
+ class="btn btn-white btn-sm rounded-full aspect-1 p-0 shadow-sm ring-1 ring-black ring-opacity-[0.15]"
26
26
  >
27
27
  <BaseIcon
28
28
  class="h-4 w-4"
@@ -33,7 +33,7 @@
33
33
  v-if="showRemove"
34
34
  type="button"
35
35
  :disabled="disabled"
36
- class="btn btn-white rounded-full p-1 shadow-sm ring-1 ring-black ring-opacity-10 disabled:bg-white disabled:opacity-70"
36
+ class="btn btn-white btn-sm rounded-full aspect-1 p-0 shadow-sm ring-1 ring-black ring-opacity-[0.15] disabled:bg-white disabled:opacity-70"
37
37
  @click="$emit('remove')"
38
38
  >
39
39
  <BaseIcon
@@ -2,6 +2,8 @@ import BaseRichText from './BaseRichText.vue';
2
2
  import ShowValue from '@/../.storybook/components/ShowValue.vue';
3
3
  import { createFieldStory } from '@/../.storybook/utils';
4
4
 
5
+ const sizes = ['xs', 'sm', 'md'];
6
+
5
7
  const toolbarOptions = [
6
8
  'full',
7
9
  'essential',
@@ -28,6 +30,10 @@ export default {
28
30
  placeholder: 'Describe your complete life in 4 sentences...',
29
31
  },
30
32
  argTypes: {
33
+ size: {
34
+ control: { type: 'select' },
35
+ options: sizes,
36
+ },
31
37
  theme: {
32
38
  control: { type: 'select' },
33
39
  options: ['snow', 'bubble', ''],
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <div
3
3
  class="base-rich-text relative"
4
- :class="[hasErrorInternal ? 'error' : '']"
4
+ :class="[
5
+ hasErrorInternal ? 'error' : '',
6
+ sizeInternal == 'sm' ? 'base-rich-text-sm' : '',
7
+ sizeInternal == 'xs' ? 'base-rich-text-xs' : '',
8
+ ]"
5
9
  >
6
10
  <quill-editor
7
11
  :name="nameInternal"
@@ -25,6 +29,7 @@ import { useField } from '@/composables/field';
25
29
 
26
30
  import { QuillEditor } from '@vueup/vue-quill';
27
31
  import Delta from 'quill-delta';
32
+ import { Size } from '@/utils/sizes';
28
33
 
29
34
 
30
35
  const props = defineProps({
@@ -38,6 +43,10 @@ const props = defineProps({
38
43
  type: String as PropType<'' | 'snow' | 'bubble'>,
39
44
  default: 'snow',
40
45
  },
46
+ size: {
47
+ default: undefined,
48
+ type: String as PropType<Size>,
49
+ },
41
50
  toolbar: {
42
51
  type: [String, Array, Object] as PropType<
43
52
  string | unknown[] | Record<string, any> | undefined
@@ -74,10 +83,11 @@ const props = defineProps({
74
83
 
75
84
  const emit = defineEmits(['update:modelValue']);
76
85
 
77
- const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
86
+ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate, sizeInternal } =
78
87
  useField({
79
88
  name: computed(() => props.name),
80
89
  required: computed(() => props.required),
90
+ size: computed(() => props.size),
81
91
  hasError: computed(() => props.hasError),
82
92
  emit: emit,
83
93
  });
@@ -209,6 +209,10 @@ const classes = computed(() => {
209
209
  }
210
210
  }
211
211
 
212
+ // For placeholder
213
+
214
+ const fontWeight = props.modelValue ? 'font-normal' : 'font-light';
215
+
212
216
  const disabled = 'disabled:cursor-not-allowed disabled:text-slate-300 disabled:opacity-100';
213
217
  const error = hasErrorInternal.value ? 'border-red-600' : 'border-slate-300';
214
218
  const textColor = !props.modelValue && requiredInternal ? 'text-slate-400' : '';
@@ -222,6 +226,7 @@ const classes = computed(() => {
222
226
  return twMerge([
223
227
  base,
224
228
  focusClass,
229
+ fontWeight,
225
230
  disabled,
226
231
  error,
227
232
  textColor,
@@ -286,6 +286,7 @@ import SlotComponent from './SlotComponent';
286
286
  import { useResizeObserver, useScroll } from '@vueuse/core';
287
287
  import { debounce, isArray } from 'lodash';
288
288
  import BaseSpinnerLarge from '../svg/BaseSpinnerLarge.vue';
289
+ import { Size } from '@/utils/sizes';
289
290
 
290
291
  const checkboxStyle =
291
292
  'disabled:bg-slate-100 group-hover:shadow-md disabled:border-slate-300 disabled:cursor-not-allowed duration-300 cursor-pointer focus:ring-blue-300 border border-slate-300 shadow h-[18px] w-[18px] rounded';
@@ -371,7 +372,7 @@ const props = defineProps({
371
372
  type: Number,
372
373
  },
373
374
  size: {
374
- type: String as PropType<'sm' | 'md'>,
375
+ type: String as PropType<Size>,
375
376
  default: 'md',
376
377
  },
377
378
  });
@@ -3,7 +3,7 @@ import BaseTagAutocomplete from './BaseTagAutocomplete.vue';
3
3
  import ShowValue from '@/../.storybook/components/ShowValue.vue';
4
4
  import BaseAppNotifications from './BaseAppNotifications.vue';
5
5
 
6
- const sizes = ['xs', 'sm', 'base'];
6
+ const sizes = ['xs', 'sm', 'md'];
7
7
 
8
8
  export default {
9
9
  title: 'Form/BaseTagAutocomplete',