sprintify-ui 0.10.87 → 0.11.0

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 (116) hide show
  1. package/dist/{BaseCkeditor-Laq0HbvP.js → BaseCkeditor-Dcqohrsz.js} +14 -14
  2. package/dist/sprintify-ui.es.js +12480 -12553
  3. package/dist/style.css +2 -2
  4. package/dist/types/components/BaseActionItem.vue.d.ts +11 -5
  5. package/dist/types/components/BaseAddressForm.vue.d.ts +1 -1
  6. package/dist/types/components/BaseAlert.vue.d.ts +3 -21
  7. package/dist/types/components/BaseApp.vue.d.ts +2 -9
  8. package/dist/types/components/BaseAutocomplete.vue.d.ts +19 -643
  9. package/dist/types/components/BaseAutocompleteDrawer.vue.d.ts +21 -104
  10. package/dist/types/components/BaseAutocompleteFetch.vue.d.ts +26 -1045
  11. package/dist/types/components/BaseAvatarGroup.vue.d.ts +1 -1
  12. package/dist/types/components/BaseBadge.vue.d.ts +3 -20
  13. package/dist/types/components/BaseBelongsTo.vue.d.ts +19 -1022
  14. package/dist/types/components/BaseBelongsToFetch.vue.d.ts +10 -745
  15. package/dist/types/components/BaseButton.vue.d.ts +6 -77
  16. package/dist/types/components/BaseButtonGroup.vue.d.ts +3 -159
  17. package/dist/types/components/BaseCard.vue.d.ts +2 -23
  18. package/dist/types/components/BaseCardRow.vue.d.ts +2 -16
  19. package/dist/types/components/BaseCkeditor.vue.d.ts +1 -1
  20. package/dist/types/components/BaseClipboard.vue.d.ts +2 -42
  21. package/dist/types/components/BaseCollapse.vue.d.ts +2 -26
  22. package/dist/types/components/BaseContainer.vue.d.ts +2 -12
  23. package/dist/types/components/BaseCounter.vue.d.ts +1 -1
  24. package/dist/types/components/BaseCropper.vue.d.ts +3 -35
  25. package/dist/types/components/BaseDataIterator.vue.d.ts +18 -11
  26. package/dist/types/components/BaseDataIteratorSectionBox.vue.d.ts +2 -10
  27. package/dist/types/components/BaseDataIteratorSectionModal.vue.d.ts +2 -16
  28. package/dist/types/components/BaseDataTable.vue.d.ts +54 -2141
  29. package/dist/types/components/BaseDataTableTemplate.vue.d.ts +2 -584
  30. package/dist/types/components/BaseDatePicker.vue.d.ts +2 -2
  31. package/dist/types/components/BaseDescriptionList.vue.d.ts +2 -7
  32. package/dist/types/components/BaseDescriptionListItem.vue.d.ts +2 -9
  33. package/dist/types/components/BaseDialog.vue.d.ts +3 -110
  34. package/dist/types/components/BaseDisplayRelativeTime.vue.d.ts +2 -51
  35. package/dist/types/components/BaseDraggable.vue.d.ts +2 -18
  36. package/dist/types/components/BaseDropdown.vue.d.ts +2 -147
  37. package/dist/types/components/BaseDropdownAutocomplete.vue.d.ts +3 -124
  38. package/dist/types/components/BaseField.vue.d.ts +3 -99
  39. package/dist/types/components/BaseFilePicker.vue.d.ts +2 -28
  40. package/dist/types/components/BaseFilePickerCrop.vue.d.ts +2 -80
  41. package/dist/types/components/BaseFileUploader.vue.d.ts +3 -173
  42. package/dist/types/components/BaseForm.vue.d.ts +3 -150
  43. package/dist/types/components/BaseGantt.vue.d.ts +40 -1141
  44. package/dist/types/components/BaseHasMany.vue.d.ts +18 -577
  45. package/dist/types/components/BaseHasManyFetch.vue.d.ts +3 -589
  46. package/dist/types/components/BaseInput.vue.d.ts +3 -3
  47. package/dist/types/components/BaseInputError.vue.d.ts +2 -19
  48. package/dist/types/components/BaseInputPercent.vue.d.ts +1 -1
  49. package/dist/types/components/BaseLayoutSidebar.vue.d.ts +2 -112
  50. package/dist/types/components/BaseLayoutSidebarConfigurable.vue.d.ts +2 -113
  51. package/dist/types/components/BaseLayoutStacked.vue.d.ts +2 -52
  52. package/dist/types/components/BaseLayoutStackedConfigurable.vue.d.ts +2 -117
  53. package/dist/types/components/BaseLazy.vue.d.ts +2 -13
  54. package/dist/types/components/BaseMediaGallery.vue.d.ts +3 -3
  55. package/dist/types/components/BaseMediaGalleryItem.vue.d.ts +1 -1
  56. package/dist/types/components/BaseMediaLibrary.vue.d.ts +3 -207
  57. package/dist/types/components/BaseMediaList.vue.d.ts +3 -3
  58. package/dist/types/components/BaseMediaListItem.vue.d.ts +1 -1
  59. package/dist/types/components/BaseMediaPictures.vue.d.ts +3 -3
  60. package/dist/types/components/BaseMediaPicturesItem.vue.d.ts +1 -1
  61. package/dist/types/components/BaseMenu.vue.d.ts +2 -209
  62. package/dist/types/components/BaseMenuItem.vue.d.ts +1 -1
  63. package/dist/types/components/BaseModalCenter.vue.d.ts +2 -83
  64. package/dist/types/components/BaseModalSide.vue.d.ts +2 -80
  65. package/dist/types/components/BaseNavbar.vue.d.ts +2 -83
  66. package/dist/types/components/BasePassword.vue.d.ts +1 -1
  67. package/dist/types/components/BaseRadioGroup.vue.d.ts +2 -107
  68. package/dist/types/components/BaseReadMore.vue.d.ts +2 -28
  69. package/dist/types/components/BaseRichText.vue.d.ts +1 -1
  70. package/dist/types/components/BaseSelect.vue.d.ts +4 -148
  71. package/dist/types/components/BaseShortcut.vue.d.ts +1 -1
  72. package/dist/types/components/BaseSideNavigation.vue.d.ts +2 -7
  73. package/dist/types/components/BaseSideNavigationItem.vue.d.ts +3 -19
  74. package/dist/types/components/BaseSkeleton.vue.d.ts +1 -1
  75. package/dist/types/components/BaseSwitch.vue.d.ts +3 -120
  76. package/dist/types/components/BaseSystemAlert.vue.d.ts +3 -55
  77. package/dist/types/components/BaseTabItem.vue.d.ts +4 -27
  78. package/dist/types/components/BaseTable.vue.d.ts +3 -24
  79. package/dist/types/components/BaseTableBody.vue.d.ts +2 -4
  80. package/dist/types/components/BaseTableCell.vue.d.ts +6 -36
  81. package/dist/types/components/BaseTableColumn.vue.d.ts +4 -4
  82. package/dist/types/components/BaseTableHead.vue.d.ts +2 -9
  83. package/dist/types/components/BaseTableHeader.vue.d.ts +4 -40
  84. package/dist/types/components/BaseTableRow.vue.d.ts +4 -38
  85. package/dist/types/components/BaseTabs.vue.d.ts +2 -16
  86. package/dist/types/components/BaseTagAutocomplete.vue.d.ts +25 -571
  87. package/dist/types/components/BaseTagAutocompleteFetch.vue.d.ts +3 -796
  88. package/dist/types/components/BaseTextarea.vue.d.ts +1 -1
  89. package/dist/types/components/BaseTextareaAutoresize.vue.d.ts +1 -1
  90. package/dist/types/components/BaseTimePicker.vue.d.ts +1 -1
  91. package/dist/types/components/BaseTooltip.vue.d.ts +2 -35
  92. package/dist/types/services/gantt/types.d.ts +18 -8
  93. package/package.json +6 -9
  94. package/src/changelog.mdx +1 -1
  95. package/src/components/BaseAssign.mdx +1 -1
  96. package/src/components/BaseAutocomplete.stories.js +10 -0
  97. package/src/components/BaseAutocomplete.vue +11 -1
  98. package/src/components/BaseAutocompleteDrawer.vue +52 -1
  99. package/src/components/BaseAutocompleteFetch.stories.js +6 -0
  100. package/src/components/BaseAutocompleteFetch.vue +15 -0
  101. package/src/components/BaseBelongsTo.stories.js +5 -0
  102. package/src/components/BaseBelongsTo.vue +10 -0
  103. package/src/components/BaseBelongsToFetch.stories.js +6 -0
  104. package/src/components/BaseBelongsToFetch.vue +9 -0
  105. package/src/components/BaseForm.mdx +1 -1
  106. package/src/components/BaseGantt.mdx +79 -0
  107. package/src/components/BaseGantt.stories.js +25 -10
  108. package/src/components/BaseGantt.vue +192 -58
  109. package/src/components/BaseHasMany.stories.js +5 -0
  110. package/src/components/BaseHasMany.vue +10 -0
  111. package/src/components/BaseHasManyFetch.stories.js +12 -0
  112. package/src/components/BaseTagAutocomplete.stories.js +5 -0
  113. package/src/components/BaseTagAutocomplete.vue +34 -1
  114. package/src/components/BaseTagAutocompleteFetch.stories.js +6 -0
  115. package/src/services/gantt/format.ts +30 -7
  116. package/src/services/gantt/types.ts +18 -8
@@ -120,6 +120,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
120
120
  }>, {
121
121
  class: string | string[];
122
122
  type: string;
123
+ placeholder: string;
123
124
  size: "xs" | "sm" | "md" | "lg" | "xl";
124
125
  required: boolean;
125
126
  disabled: boolean;
@@ -127,7 +128,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
127
128
  modelValue: string | null | undefined;
128
129
  autocomplete: boolean;
129
130
  preventSubmit: boolean;
130
- placeholder: string;
131
131
  hasError: boolean;
132
132
  rows: number;
133
133
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -114,12 +114,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
114
114
  onSubmit?: ((...args: any[]) => any) | undefined;
115
115
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
116
116
  }>, {
117
+ placeholder: string;
117
118
  size: "xs" | "sm" | "md" | "lg" | "xl";
118
119
  required: boolean;
119
120
  disabled: boolean;
120
121
  name: string;
121
122
  modelValue: string | null;
122
- placeholder: string;
123
123
  hasError: boolean;
124
124
  rows: number;
125
125
  maxHeight: number;
@@ -112,12 +112,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
112
112
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
113
113
  }>, {
114
114
  class: string | string[];
115
+ placeholder: string;
115
116
  size: "xs" | "sm" | "md" | "lg" | "xl";
116
117
  required: boolean;
117
118
  disabled: boolean;
118
119
  name: string;
119
120
  modelValue: string | null | undefined;
120
- placeholder: string;
121
121
  hasError: boolean;
122
122
  hourStep: number;
123
123
  minuteStep: number;
@@ -13,45 +13,12 @@ type __VLS_Props = {
13
13
  dark?: boolean;
14
14
  offset?: number;
15
15
  };
16
- declare const targetRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
17
- declare const tooltipRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
18
- declare const floatingStyles: Readonly<import("vue").Ref<{
19
- position: import("@floating-ui/utils").Strategy;
20
- top: string;
21
- left: string;
22
- transform?: string;
23
- willChange?: string;
24
- }, {
25
- position: import("@floating-ui/utils").Strategy;
26
- top: string;
27
- left: string;
28
- transform?: string;
29
- willChange?: string;
30
- }>>, showTooltip: import("vue").Ref<boolean, boolean>;
31
- declare const classInternal: import("vue").ComputedRef<(string | string[] | null)[]>;
32
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
33
16
  declare var __VLS_1: {}, __VLS_11: {};
34
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
17
+ type __VLS_Slots = {} & {
35
18
  default?: (props: typeof __VLS_1) => any;
36
19
  } & {
37
20
  tooltip?: (props: typeof __VLS_11) => any;
38
- }>;
39
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
40
- targetRef: typeof targetRef;
41
- tooltipRef: typeof tooltipRef;
42
- floatingStyles: typeof floatingStyles;
43
- showTooltip: typeof showTooltip;
44
- classInternal: typeof classInternal;
45
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
46
- dark: boolean;
47
- class: string | string[] | null;
48
- text: string | null;
49
- visible: boolean;
50
- floatingOptions: UseFloatingOptions;
51
- interactive: boolean;
52
- delay: number;
53
- offset: number;
54
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ };
55
22
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
56
23
  dark: boolean;
57
24
  class: string | string[] | null;
@@ -3,6 +3,7 @@ export interface GanttItem {
3
3
  id: number | string;
4
4
  start: string;
5
5
  end: string;
6
+ height?: number;
6
7
  name: string;
7
8
  meta?: Record<string, unknown>;
8
9
  color: string;
@@ -12,31 +13,40 @@ export interface GanttRow {
12
13
  name: string;
13
14
  meta?: Record<string, unknown>;
14
15
  items: GanttItem[];
16
+ height?: number;
15
17
  }
16
18
  export interface GanttRowFormatted {
17
19
  id: number | string;
18
20
  name: string;
19
- meta?: Record<string, unknown>;
20
21
  items: GanttItemFormatted[];
22
+ height: number;
23
+ barHeight: number;
24
+ width: number;
25
+ start: DateTime;
26
+ end: DateTime;
27
+ x: number;
28
+ y: number;
29
+ meta?: Record<string, unknown>;
21
30
  }
22
31
  export interface GanttItemFormatted {
23
32
  id: number | string;
24
- start: DateTime;
25
- end: DateTime;
26
33
  name: string;
27
- meta?: Record<string, unknown>;
28
34
  color: string;
29
- milliseconds: number;
35
+ height: number;
36
+ barHeight: number;
37
+ width: number;
38
+ start: DateTime;
39
+ end: DateTime;
30
40
  x: number;
31
41
  y: number;
32
- width: number;
33
- height: number;
42
+ milliseconds: number;
43
+ meta?: Record<string, unknown>;
34
44
  }
35
45
  export interface FormatConfig {
36
46
  rows: GanttRow[];
47
+ sidebarWidth: number;
37
48
  minWidth: number;
38
49
  rowHeight: number;
39
- rowPadding: number;
40
50
  includeToday: boolean;
41
51
  }
42
52
  export interface Tick {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.10.87",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -48,12 +48,8 @@
48
48
  "@commitlint/cli": "^17.8.1",
49
49
  "@commitlint/config-conventional": "^17.8.1",
50
50
  "@iconify/vue": "^4.1.1",
51
- "@storybook/addon-controls": "^8.3.0",
52
- "@storybook/addon-docs": "^8.3.0",
53
- "@storybook/manager-api": "^8.3.0",
54
- "@storybook/theming": "^8.3.0",
55
- "@storybook/vue3": "^8.3.0",
56
- "@storybook/vue3-vite": "^8.3.0",
51
+ "@storybook/addon-docs": "10.2.0",
52
+ "@storybook/vue3-vite": "10.2.0",
57
53
  "@tailwindcss/aspect-ratio": "^0.4.2",
58
54
  "@tailwindcss/forms": "^0.5.7",
59
55
  "@tailwindcss/typography": "^0.5.10",
@@ -82,7 +78,7 @@
82
78
  "cz-conventional-changelog": "^3.3.0",
83
79
  "eslint": "^8.57.0",
84
80
  "eslint-plugin-import": "^2.29.1",
85
- "eslint-plugin-storybook": "^0.8.0",
81
+ "eslint-plugin-storybook": "10.2.0",
86
82
  "eslint-plugin-vue": "^9.23.0",
87
83
  "eslint-plugin-vue-scoped-css": "^2.7.2",
88
84
  "flatpickr": "^4.6.13",
@@ -98,12 +94,13 @@
98
94
  "postcss-import": "^15.1.0",
99
95
  "qs": "^6.12.0",
100
96
  "relative-deps": "^1.0.7",
97
+ "remark-gfm": "^4.0.1",
101
98
  "rimraf": "^3.0.2",
102
99
  "rollup-plugin-analyzer": "^4.0.0",
103
100
  "scroll-lock": "^2.1.5",
104
101
  "sortablejs": "^1.15.2",
105
102
  "standard-version": "^9.5.0",
106
- "storybook": "^8.3.0",
103
+ "storybook": "10.2.0",
107
104
  "tailwindcss": "^3.4.1",
108
105
  "tiptap-footnotes": "^3.0.1",
109
106
  "typescript": "^5.6.3",
package/src/changelog.mdx CHANGED
@@ -1,4 +1,4 @@
1
- import { Meta, Markdown } from '@storybook/blocks';
1
+ import { Meta, Markdown } from '@storybook/addon-docs/blocks';
2
2
 
3
3
  import Readme from '../CHANGELOG.md?raw';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Canvas, Meta, Primary, Controls, Story } from '@storybook/blocks';
1
+ import { Canvas, Meta, Primary, Controls, Story } from '@storybook/addon-docs/blocks';
2
2
 
3
3
  import * as BaseAssignStories from './BaseAssign.stories';
4
4
 
@@ -22,6 +22,16 @@ export default {
22
22
  labelKey: "label",
23
23
  valueKey: "value",
24
24
  options: options,
25
+ optionColor: (option) => {
26
+ if (option.type === "jedi") return "blue";
27
+ if (option.type === "sith") return "black";
28
+ return "gray";
29
+ },
30
+ optionIcon: (option) => {
31
+ if (option.type === "jedi") return "fa7-solid:jedi";
32
+ if (option.type === "sith") return "fa7-brands:sith";
33
+ return "mdi:help-circle-outline";
34
+ }
25
35
  },
26
36
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
27
37
  };
@@ -86,8 +86,10 @@
86
86
  :size="size"
87
87
  :loading="loading"
88
88
  :loading-bottom="loadingBottom"
89
- tw-drawer="p-1"
90
89
  :keywords="keywords"
90
+ :option-color="optionColor"
91
+ :option-icon="optionIcon"
92
+ tw-drawer="p-1"
91
93
  @select="onSelect"
92
94
  @scroll-bottom="emit('scrollBottom')"
93
95
  >
@@ -231,6 +233,14 @@ const props = defineProps({
231
233
  },
232
234
  type: [String] as PropType<string>,
233
235
  },
236
+ optionColor: {
237
+ default: undefined,
238
+ type: Function as PropType<(option: RawOption) => string>,
239
+ },
240
+ optionIcon: {
241
+ default: undefined,
242
+ type: Function as PropType<(option: RawOption) => string>,
243
+ },
234
244
  twInput: {
235
245
  default: undefined,
236
246
  type: [String, Array] as PropType<string | string[]>,
@@ -51,6 +51,29 @@
51
51
  class="flex items-center rounded px-[0.75em] py-[0.5em]"
52
52
  :class="[optionClass(option), optionSizeClass]"
53
53
  >
54
+ <div
55
+ v-if="optionIcon"
56
+ class="shrink-0"
57
+ >
58
+ <BaseIcon
59
+ :icon="option.option ? optionIcon(option.option) : ''"
60
+ class="flex-shrink-0"
61
+ :class="optionIconSizeClass"
62
+ :color="option.option && optionColor ? optionColor(option.option) : 'gray'"
63
+ />
64
+ </div>
65
+ <div
66
+ v-else-if="optionColor"
67
+ class="shrink-0"
68
+ >
69
+ <div
70
+ class="flex-shrink-0 rounded-full"
71
+ :class="optionColorSizeClass"
72
+ :style="{
73
+ backgroundColor: option.option ? optionColor(option.option) : 'gray',
74
+ }"
75
+ />
76
+ </div>
54
77
  <div class="grow">
55
78
  {{ option.label }}
56
79
  </div>
@@ -120,7 +143,7 @@
120
143
  <script lang="ts" setup>
121
144
  import { PropType } from 'vue';
122
145
  import { useInfiniteScroll } from '@vueuse/core';
123
- import { NormalizedOption } from '@/types';
146
+ import { NormalizedOption, RawOption } from '@/types';
124
147
  import { isArray, isObject, throttle } from 'lodash';
125
148
  import BaseSkeleton from './BaseSkeleton.vue';
126
149
  import { Icon as BaseIcon } from '@iconify/vue';
@@ -157,6 +180,14 @@ const props = defineProps({
157
180
  type: String as PropType<Size>,
158
181
  default: 'md',
159
182
  },
183
+ optionColor: {
184
+ default: undefined,
185
+ type: Function as PropType<(option: RawOption) => string>,
186
+ },
187
+ optionIcon: {
188
+ default: undefined,
189
+ type: Function as PropType<(option: RawOption) => string>,
190
+ },
160
191
  twDrawer: {
161
192
  type: String,
162
193
  default: '',
@@ -380,6 +411,26 @@ const optionIconClass = computed(() => {
380
411
  return 'w-5 h-5';
381
412
  });
382
413
 
414
+ const optionColorSizeClass = computed(() => {
415
+ if (props.size == 'xs') {
416
+ return 'mr-2 -ml-px h-3 w-3';
417
+ }
418
+ if (props.size == 'sm') {
419
+ return 'mr-2 -ml-px h-2.5 w-2.5';
420
+ }
421
+ return 'mr-2 -ml-px h-2.5 w-2.5';
422
+ });
423
+
424
+ const optionIconSizeClass = computed(() => {
425
+ if (props.size == 'xs') {
426
+ return 'mr-2 -ml-px h-3 w-3';
427
+ }
428
+ if (props.size == 'sm') {
429
+ return 'mr-2 -ml-0.5 h-4 w-4';
430
+ }
431
+ return 'mr-2 -ml-0.5 h-4 w-4';
432
+ });
433
+
383
434
  defineExpose({
384
435
  onKeydown,
385
436
  });
@@ -16,6 +16,12 @@ export default {
16
16
  url: "https://faker.witify.io/api/todos",
17
17
  labelKey: "title",
18
18
  valueKey: "id",
19
+ optionColor: (option) => {
20
+ if (option.type === "work") return "green";
21
+ if (option.type === "personal") return "blue";
22
+ if (option.type === "family") return "purple";
23
+ return "gray";
24
+ }
19
25
  },
20
26
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
21
27
  };
@@ -23,6 +23,9 @@
23
23
  :show-remove-button="showRemoveButton"
24
24
  :select="select"
25
25
  :filter="filterOptions"
26
+ :option-color="optionColor"
27
+ :option-icon="optionIcon"
28
+ :icon="icon"
26
29
  :tw-input="twInput"
27
30
  @clear="onClear"
28
31
  @open="onOpen"
@@ -168,6 +171,18 @@ const props = defineProps({
168
171
  default: undefined,
169
172
  type: Object as PropType<SelectConfiguration | undefined>,
170
173
  },
174
+ optionColor: {
175
+ default: undefined,
176
+ type: Function as PropType<(option: RawOption) => string>,
177
+ },
178
+ optionIcon: {
179
+ default: undefined,
180
+ type: Function as PropType<(option: RawOption) => string>,
181
+ },
182
+ icon: {
183
+ default: undefined,
184
+ type: [String] as PropType<string>,
185
+ },
171
186
  twInput: {
172
187
  default: undefined,
173
188
  type: [String, Array] as PropType<string | string[]>,
@@ -16,6 +16,11 @@ export default {
16
16
  options: options,
17
17
  field: "label",
18
18
  primaryKey: "value",
19
+ optionColor: (option) => {
20
+ if (option.type === "jedi") return "blue";
21
+ if (option.type === "sith") return "black";
22
+ return "gray";
23
+ }
19
24
  },
20
25
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
21
26
  };
@@ -22,6 +22,8 @@
22
22
  :focus-on-mount="focusOnMount"
23
23
  :select="select"
24
24
  :icon="icon"
25
+ :option-color="optionColor"
26
+ :option-icon="optionIcon"
25
27
  @update:model-value="onUpdate"
26
28
  >
27
29
  <template #option="optionProps">
@@ -138,6 +140,14 @@ const props = defineProps({
138
140
  default: undefined,
139
141
  type: String,
140
142
  },
143
+ optionColor: {
144
+ default: undefined,
145
+ type: Function as PropType<(option: RawOption) => string>,
146
+ },
147
+ optionIcon: {
148
+ default: undefined,
149
+ type: Function as PropType<(option: RawOption) => string>,
150
+ },
141
151
  });
142
152
 
143
153
  const emit = defineEmits(['update:modelValue']);
@@ -18,6 +18,12 @@ export default {
18
18
  showRouteUrl(id) {
19
19
  return `https://faker.witify.io/api/todos/${id}`;
20
20
  },
21
+ optionColor: (option) => {
22
+ if (option.type === "work") return "green";
23
+ if (option.type === "personal") return "blue";
24
+ if (option.type === "family") return "purple";
25
+ return "gray";
26
+ }
21
27
  },
22
28
  decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
23
29
  };
@@ -20,6 +20,9 @@
20
20
  :visible-focus="visibleFocus"
21
21
  :focus-on-mount="focusOnMount"
22
22
  :select="select"
23
+ :option-color="optionColor"
24
+ :option-icon="optionIcon"
25
+ :icon="icon"
23
26
  @update:model-value="onUpdate"
24
27
  >
25
28
  <template #option="optionProps">
@@ -74,6 +77,9 @@ const props = withDefaults(
74
77
  showRemoveButton?: boolean;
75
78
  emptyOptionLabel?: string;
76
79
  select?: SelectConfiguration;
80
+ optionColor?: (option: RawOption) => string;
81
+ optionIcon?: (option: RawOption) => string;
82
+ icon?: string;
77
83
  }>(),
78
84
  {
79
85
  modelValue: undefined,
@@ -95,6 +101,9 @@ const props = withDefaults(
95
101
  showRemoveButton: true,
96
102
  emptyOptionLabel: undefined,
97
103
  select: undefined,
104
+ optionColor: undefined,
105
+ optionIcon: undefined,
106
+ icon: undefined,
98
107
  }
99
108
  );
100
109
 
@@ -1,4 +1,4 @@
1
- import { Canvas, Meta, Primary, Controls, Story } from '@storybook/blocks';
1
+ import { Canvas, Meta, Primary, Controls, Story } from '@storybook/addon-docs/blocks';
2
2
 
3
3
  import * as BaseFormStories from './BaseForm.stories';
4
4
 
@@ -0,0 +1,79 @@
1
+ import { Canvas, Meta, Primary, Controls, Story } from '@storybook/addon-docs/blocks';
2
+
3
+ import * as BaseGanttStories from './BaseGantt.stories';
4
+
5
+ <Meta of={BaseGanttStories} />
6
+
7
+ # BaseGantt
8
+
9
+ ## Introduction
10
+
11
+ This is the BaseGantt component used to display Gantt charts. It allows you to visualize tasks or events over a timeline.
12
+
13
+ <Primary />
14
+
15
+ ## API
16
+
17
+ ### GanttRow
18
+
19
+ | Prop | Type | Description |
20
+ |-----------|-----------------------------|--------------------------------------------------|
21
+ | id | number \| string | Unique identifier for the row |
22
+ | name | string | Name of the row |
23
+ | meta | Object? | Optional metadata for the row |
24
+ | items | GanttItem[] | Array of items (tasks/events) in the row |
25
+ | height | number? | Optional custom height for the row. If not provided, props.rowHeight will be used. |
26
+
27
+ ### GanttItem
28
+
29
+ | Prop | Type | Description |
30
+ |-----------|-----------------------------|--------------------------------------------------|
31
+ | id | number \| string | Unique identifier for the item |
32
+ | start | string | Start date/time (ISO string) |
33
+ | end | string | End date/time (ISO string) |
34
+ | height | number? | Optional custom height for the item. If not provided, props.rowHeight will be used. |
35
+ | name | string | Name of the item |
36
+ | meta | Object? | Optional metadata for the item |
37
+ | color | string | Color used to display the item |
38
+
39
+ ### GanttRowFormatted
40
+
41
+ Once the rows have been formatted for rendering, the GanttRowFormatted type is used.
42
+
43
+ | Prop | Type | Description |
44
+ |-----------|-----------------------------|--------------------------------------------------|
45
+ | id | number \| string | Unique identifier for the row |
46
+ | name | string | Name of the row |
47
+ | items | GanttItemFormatted[] | Array of formatted items (tasks/events) in the row |
48
+ | height | number | The rendered height of the row |
49
+ | barHeight | number | The height of the bars in the row |
50
+ | width | number | The width of the bar in pixels |
51
+ | start | DateTime | The DateTime start of the bar |
52
+ | end | DateTime | The DateTime end of the bar |
53
+ | x | number | The x position of the bar in pixels |
54
+ | y | number | The y position of the bar in pixels |
55
+ | meta | Object? | Optional metadata for the row |
56
+
57
+ ### GanttItemFormatted
58
+
59
+ Once the items have been formatted for rendering, the GanttItemFormatted type is used.
60
+
61
+ | Prop | Type | Description |
62
+ |-----------|-----------------------------|--------------------------------------------------|
63
+ | id | number \| string | Unique identifier for the item |
64
+ | name | string | Name of the item |
65
+ | color | string | The color of the item |
66
+ | height | number | The rendered height of the item |
67
+ | barHeight | number | The height of the bar in the item |
68
+ | width | number | The width of the item in pixels |
69
+ | start | DateTime | The DateTime start of the item |
70
+ | end | DateTime | The DateTime end of the item |
71
+ | x | number | The x position of the item in pixels |
72
+ | y | number | The y position of the item in pixels |
73
+ | milliseconds | number | The duration of the item in milliseconds |
74
+ | meta | Object? | Optional metadata for the item |
75
+
76
+
77
+ ## Props
78
+
79
+ <Controls />
@@ -10,10 +10,12 @@ const rows = [];
10
10
  for (let i = 0; i < 10; i++) {
11
11
  const items = [];
12
12
 
13
- for (let j = 0; j < 1; j++) {
13
+ for (let j = 0; j < 2; j++) {
14
+
14
15
  const start = DateTime.now()
15
16
  .minus({ days: 50 })
16
- .plus({ days: i * 2 });
17
+ .plus({ days: j + i * 2 });
18
+
17
19
  const end = start.plus({ days: 50 });
18
20
 
19
21
  const colors = [
@@ -42,8 +44,9 @@ for (let i = 0; i < 10; i++) {
42
44
 
43
45
  rows.push({
44
46
  id: i + 1,
45
- name: `Project ${i + 1}`,
47
+ name: `Project sdf sdfg sdf gsdf gsdf gsdf g sdf sdf sdfg dsfg dsfg ${i + 1}`,
46
48
  items: items,
49
+ height: 30,
47
50
  });
48
51
  }
49
52
 
@@ -98,6 +101,13 @@ const SlotItemTemplate = (args) => ({
98
101
  template: `
99
102
  <BaseCard clipped>
100
103
  <BaseGantt v-bind="args" @item:click="onItemClick">
104
+ <template #row="{ row }">
105
+ <div class="flex w-full h-full items-center overflow-hidden hover:bg-slate-600 duration-200 text-white bg-slate-900 rounded-full">
106
+ <div class="flex items-center justify-center px-2">
107
+ <span class="truncate text-[10px] font-semibold uppercase"> {{ row.name }} </span>
108
+ </div>
109
+ </div>
110
+ </template>
101
111
  <template #item="{ item }">
102
112
  <div class="flex w-full h-full items-center overflow-hidden hover:opacity-80 duration-200 bg-slate-100 hover:bg-slate-200 border border-slate-300 rounded-full">
103
113
  <div class="flex items-center justify-center">
@@ -114,7 +124,7 @@ const SlotItemTemplate = (args) => ({
114
124
  export const SlotItem = SlotItemTemplate.bind({});
115
125
  SlotItem.args = {};
116
126
 
117
- const SlotSidebarItemTemplate = (args) => ({
127
+ const SlotSidebarSlotsTemplate = (args) => ({
118
128
  components: {
119
129
  BaseCard,
120
130
  BaseGantt,
@@ -130,10 +140,15 @@ const SlotSidebarItemTemplate = (args) => ({
130
140
  template: `
131
141
  <BaseCard clipped>
132
142
  <BaseGantt v-bind="args" @item:click="onItemClick">
133
- <template #sidebarItem="{ row }">
134
- <button class="flex items-center px-3 bg-slate-100 hover:bg-slate-300 w-full">
135
- <Icon class="mr-2 h-4 w-4 text-slate-600" icon="heroicons:folder-solid" />
136
- <span class="text-xs font-semibold"> {{ row.name }} </span>
143
+ <template #sidebarRow="{ row }">
144
+ <button class="flex items-center pr-3 h-full w-full overflow-hidden">
145
+ <Icon class="mr-2 h-4 w-4 text-slate-600 shrink-0" icon="heroicons:folder-solid" />
146
+ <span class="text-xs font-semibold truncate"> {{ row.name }} </span>
147
+ </button>
148
+ </template>
149
+ <template #sidebarItem="{ item }">
150
+ <button class="flex items-center px-3 bg-slate-100 hover:bg-slate-300 h-full w-full">
151
+ <span class="text-xs truncate"> {{ item.name }} </span>
137
152
  </button>
138
153
  </template>
139
154
  </BaseGantt>
@@ -141,5 +156,5 @@ const SlotSidebarItemTemplate = (args) => ({
141
156
  `,
142
157
  });
143
158
 
144
- export const SlotSidebarItem = SlotSidebarItemTemplate.bind({});
145
- SlotSidebarItem.args = {};
159
+ export const SlotSidebarSlots = SlotSidebarSlotsTemplate.bind({});
160
+ SlotSidebarSlots.args = {};