sprintify-ui 0.8.22 → 0.8.24

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.
@@ -61,7 +61,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
61
61
  }>>> & {
62
62
  onClick?: ((...args: any[]) => any) | undefined;
63
63
  }, {
64
- class: string | false | 0 | ClassNameValue[] | null;
64
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
65
65
  type: "button" | "submit" | "reset";
66
66
  size: "xs" | "sm" | "md" | "lg" | "xl";
67
67
  color: string;
@@ -16,7 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
16
16
  }>>> & {
17
17
  onClick?: ((...args: any[]) => any) | undefined;
18
18
  }, {
19
- class: string | false | 0 | ClassNameValue[] | null;
19
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
20
20
  size: "xs" | "sm" | "lg" | "base";
21
21
  }, {}>, {
22
22
  default?(_: {}): any;
@@ -4,7 +4,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
4
4
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
5
5
  fixedHeader?: boolean | undefined;
6
6
  fixedColumn?: boolean | undefined;
7
- grid?: boolean | undefined;
8
7
  striped?: boolean | undefined;
9
8
  flush?: boolean | undefined;
10
9
  class?: ClassNameValue;
@@ -14,7 +13,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
14
13
  size: string;
15
14
  fixedHeader: boolean;
16
15
  fixedColumn: boolean;
17
- grid: boolean;
18
16
  striped: boolean;
19
17
  flush: boolean;
20
18
  class: undefined;
@@ -26,7 +24,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
26
24
  size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
27
25
  fixedHeader?: boolean | undefined;
28
26
  fixedColumn?: boolean | undefined;
29
- grid?: boolean | undefined;
30
27
  striped?: boolean | undefined;
31
28
  flush?: boolean | undefined;
32
29
  class?: ClassNameValue;
@@ -36,20 +33,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
36
33
  size: string;
37
34
  fixedHeader: boolean;
38
35
  fixedColumn: boolean;
39
- grid: boolean;
40
36
  striped: boolean;
41
37
  flush: boolean;
42
38
  class: undefined;
43
39
  maxHeight: undefined;
44
40
  loading: boolean;
45
41
  }>>>, {
46
- class: string | false | 0 | ClassNameValue[] | null;
42
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
47
43
  size: "xs" | "sm" | "md" | "lg" | "xl";
48
44
  loading: boolean;
49
45
  maxHeight: number;
50
46
  fixedHeader: boolean;
51
47
  fixedColumn: boolean;
52
- grid: boolean;
53
48
  striped: boolean;
54
49
  flush: boolean;
55
50
  }, {}>, {
@@ -46,7 +46,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
46
46
  onClick: undefined;
47
47
  ignoreRowInteractions: boolean;
48
48
  }>>>, {
49
- class: string | false | 0 | ClassNameValue[] | null;
49
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
50
50
  onClick: (e: MouseEvent) => void;
51
51
  title: string;
52
52
  to: RouteLocationRaw;
@@ -8,7 +8,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
8
8
  }>, {
9
9
  class: undefined;
10
10
  }>>>, {
11
- class: string | false | 0 | ClassNameValue[] | null;
11
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
12
12
  }, {}>, {
13
13
  default?(_: {}): any;
14
14
  }>;
@@ -25,7 +25,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
25
25
  }>>> & {
26
26
  onClick?: ((...args: any[]) => any) | undefined;
27
27
  }, {
28
- class: string | false | 0 | ClassNameValue[] | null;
28
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
29
29
  align: "right" | "left" | "center";
30
30
  style: string | false | import("vue").CSSProperties | StyleValue[] | null;
31
31
  colspan: number;
@@ -6,6 +6,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
6
6
  target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
7
7
  title?: string | undefined;
8
8
  class?: ClassNameValue;
9
+ selected?: boolean | undefined;
9
10
  onClick?: ((e: MouseEvent) => void) | undefined;
10
11
  }>, {
11
12
  href: undefined;
@@ -13,6 +14,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
13
14
  target: undefined;
14
15
  title: undefined;
15
16
  class: undefined;
17
+ selected: boolean;
16
18
  onClick: undefined;
17
19
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
20
  click: (...args: any[]) => void;
@@ -24,6 +26,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
24
26
  target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
25
27
  title?: string | undefined;
26
28
  class?: ClassNameValue;
29
+ selected?: boolean | undefined;
27
30
  onClick?: ((e: MouseEvent) => void) | undefined;
28
31
  }>, {
29
32
  href: undefined;
@@ -31,18 +34,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
31
34
  target: undefined;
32
35
  title: undefined;
33
36
  class: undefined;
37
+ selected: boolean;
34
38
  onClick: undefined;
35
39
  }>>> & {
36
40
  onClick?: ((...args: any[]) => any) | undefined;
37
41
  onMouseenter?: ((...args: any[]) => any) | undefined;
38
42
  onMouseleave?: ((...args: any[]) => any) | undefined;
39
43
  }, {
40
- class: string | false | 0 | ClassNameValue[] | null;
44
+ class: string | false | 0 | 0n | ClassNameValue[] | null;
41
45
  onClick: (e: MouseEvent) => void;
42
46
  title: string;
43
47
  to: RouteLocationRaw;
44
48
  href: string;
45
49
  target: "_blank" | "_self" | "_parent" | "_top";
50
+ selected: boolean;
46
51
  }, {}>, {
47
52
  default?(_: {}): any;
48
53
  }>;
@@ -5,6 +5,7 @@ export interface TableProps {
5
5
  flush?: boolean;
6
6
  fixedHeader?: boolean;
7
7
  fixedColumn?: boolean;
8
+ striped?: boolean;
8
9
  }
9
10
  export type CellConfig = TableProps;
10
11
  export interface CellProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -48,7 +48,7 @@
48
48
  "@fullcalendar/vue3": "^6.1.11",
49
49
  "@headlessui/vue": "^1.7.19",
50
50
  "color2k": "^2.0.3",
51
- "tailwind-merge": "^1.14.0"
51
+ "tailwind-merge": "^2.4.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@babel/core": "^7.24.0",
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <div
2
+ <form
3
3
  class="relative transform overflow-hidden rounded-lg bg-white ring-1 ring-black ring-opacity-10 p-4 text-left shadow-xl transition-all || sm:my-8 sm:w-full sm:max-w-lg"
4
+ @submit.prevent="confirm"
4
5
  >
5
6
  <div class="sm:flex sm:items-start || sm:gap-4">
6
7
  <div
@@ -33,7 +34,9 @@
33
34
  icon="heroicons:information-circle-20-solid"
34
35
  />
35
36
  </div>
36
- <div class="mt-3 text-center || sm:mt-0 sm:text-left">
37
+ <div
38
+ class="mt-3 text-center grow || sm:mt-0 sm:text-left"
39
+ >
37
40
  <slot>
38
41
  <h3
39
42
  id="modal-title"
@@ -69,7 +72,6 @@
69
72
  name="input"
70
73
  :placeholder="inputConfig.placeholder"
71
74
  class="w-full"
72
- tw-input="w-full"
73
75
  />
74
76
  <BaseInput
75
77
  v-else
@@ -88,11 +90,9 @@
88
90
  <div class="mt-5 || sm:mt-4 sm:flex sm:flex-row-reverse">
89
91
  <BaseButton
90
92
  ref="confirm"
91
- type="button"
92
93
  size="sm"
93
94
  class="mb-2 w-full sm:mb-0 sm:w-auto"
94
95
  :color="color"
95
- @click="confirm"
96
96
  >
97
97
  {{ confirmText ?? t('sui.confirm') }}
98
98
  </BaseButton>
@@ -105,7 +105,7 @@
105
105
  {{ cancelText ?? t('sui.cancel') }}
106
106
  </BaseButton>
107
107
  </div>
108
- </div>
108
+ </form>
109
109
  </template>
110
110
 
111
111
  <script lang="ts" setup>
@@ -199,6 +199,9 @@ function confirm() {
199
199
  }
200
200
 
201
201
  emit('confirm', input.value);
202
+
203
+ input.value = '';
204
+
202
205
  }
203
206
 
204
207
  </script>
@@ -251,7 +251,7 @@ function successHandler(response: AxiosResponse<any, any>) {
251
251
  if (props.successHandler) {
252
252
  props.successHandler(response);
253
253
  } else {
254
- const message = response.data.message ?? ('' as string);
254
+ const message = get(response, 'response.data.message', null);
255
255
 
256
256
  if (!message) {
257
257
  return;
@@ -18,6 +18,11 @@ export default {
18
18
  },
19
19
  options: ['none', 'xs', 'sm', 'md', 'lg'],
20
20
  },
21
+ loading: {
22
+ control: {
23
+ type: 'boolean',
24
+ },
25
+ },
21
26
  },
22
27
  };
23
28
 
@@ -72,6 +77,7 @@ const Template = (args) => ({
72
77
  :key="option.value"
73
78
  :href="'https://www.google.com/search?q=' + option.label"
74
79
  target="_blank"
80
+ :selected="option.value === 'darth_maul'"
75
81
  >
76
82
  ${cellsTemplate}
77
83
  </BaseTableRow>
@@ -84,6 +90,16 @@ const Template = (args) => ({
84
90
  export const Demo = Template.bind({});
85
91
  Demo.args = {};
86
92
 
93
+ export const Striped = Template.bind({});
94
+ Striped.args = {
95
+ striped: true,
96
+ };
97
+
98
+ export const Flush = Template.bind({});
99
+ Flush.args = {
100
+ flush: true,
101
+ };
102
+
87
103
  export const FixedHeader = Template.bind({});
88
104
  FixedHeader.args = {
89
105
  fixedHeader: true,
@@ -171,7 +187,7 @@ const TemplateCellClick = (args) => ({
171
187
  {{ option.type ?? 'N/A' }}
172
188
  </BaseTableCell>
173
189
  <BaseTableCell>
174
- ...
190
+ Actions...
175
191
  </BaseTableCell>
176
192
  <BaseTableCell @click="al()">
177
193
  Click me
@@ -49,7 +49,6 @@ const props = withDefaults(defineProps<{
49
49
  size?: Size,
50
50
  fixedHeader?: boolean,
51
51
  fixedColumn?: boolean,
52
- grid?: boolean,
53
52
  striped?: boolean,
54
53
  flush?: boolean,
55
54
  class?: ClassNameValue,
@@ -59,7 +58,6 @@ const props = withDefaults(defineProps<{
59
58
  size: 'md',
60
59
  fixedHeader: false,
61
60
  fixedColumn: false,
62
- grid: false,
63
61
  striped: false,
64
62
  flush: false,
65
63
  class: undefined,
@@ -34,8 +34,6 @@ import { cellClasses } from '../services/table/classes'
34
34
  import { ClassNameValue, twMerge } from 'tailwind-merge';
35
35
  import { cloneDeep, merge } from 'lodash';
36
36
  import { ComputedRef, StyleValue } from 'vue';
37
- import { useIsFirstColumn } from '../composables/isFirstColumn'
38
- import { useIsLastColumn } from '../composables/isLastColumn'
39
37
 
40
38
  defineOptions({
41
39
  inheritAttrs: false,
@@ -45,9 +43,11 @@ const baseTable = inject('table:props') as ComputedRef<TableProps> | undefined;
45
43
  const baseTableHead = inject('tableHead:props', undefined);
46
44
  const baseTableRow = inject('tableRow:props', undefined) as ComputedRef<CellProps> | undefined;
47
45
  const baseTableRowHover = inject('tableRow:hover', undefined) as ComputedRef<boolean> | undefined;
46
+ const baseTableRowSelected = inject('tableRow:selected', undefined) as ComputedRef<boolean> | undefined;
48
47
  const baseTableHorizontalScrolling = inject('table:horizontalScrolling', undefined) as ComputedRef<boolean> | undefined;
49
48
  const hoverForFullRow = inject('tableRow:hoverForFullRow') as ComputedRef<boolean> | undefined;
50
49
  const setHoverForFullRow = inject('tableRow:setHoverForFullRow') as (active: boolean) => void;
50
+ const baseTableStriped = computed(() => baseTable?.value.striped);
51
51
 
52
52
  if (!baseTableRow) {
53
53
  throw new Error('BaseTableCell must be used within a BaseTableRow.');
@@ -126,33 +126,51 @@ const hoverInternal = computed(() => {
126
126
  });
127
127
 
128
128
  const classes = computed(() => {
129
+
130
+ const hovered = clickable.value && hoverInternal.value;
131
+ const selected = baseTableRowSelected?.value;
132
+
129
133
  const base = cellClasses(cellConfig.value);
130
- const baseTd = 'relative bg-white border-b border-slate-200 group-last/row:border-b-0';
134
+ const baseTd = 'relative border-b group-last/row:border-b-0';
131
135
  const click = clickable.value ? 'cursor-pointer' : '';
132
- const hover = clickable.value && hoverInternal.value ? 'bg-slate-50' : '';
133
- const firstCol = isFirstColumn.value ? 'border-r border-r-transparent' : '';
134
- const horizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value && isFirstColumn.value ? 'sticky z-[1] left-0 border-r-slate-200' : '';
135
- const flushLeft = baseTable?.value.flush && isFirstColumn.value ? 'pl-0' : '';
136
- const flushRight = baseTable?.value.flush && isLastColumn.value ? 'pr-0' : '';
136
+
137
+ let backgroundColor = baseTableStriped.value ? 'group-even/row:bg-slate-100/70' : 'bg-white';
138
+
139
+ if (hovered) {
140
+ backgroundColor = 'bg-slate-100';
141
+ }
142
+
143
+ if (selected) {
144
+ backgroundColor = 'bg-slate-200';
145
+ }
146
+
147
+ let borderColor = 'border-slate-200';
148
+
149
+ if (selected) {
150
+ borderColor = 'border-slate-300';
151
+ }
152
+
153
+ const firstCol = 'first:border-r first:border-r-transparent';
154
+ const horizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value ? 'first:sticky first:z-[1] first:left-0 first:border-r-slate-200' : '';
155
+ const flush = baseTable?.value.flush ? 'first:pl-0 last:pr-0' : '';
137
156
 
138
157
  return twMerge(
139
- base,
140
- baseTd,
141
- click,
142
- hover,
143
- firstCol,
144
- horizontalScrolling,
145
- flushLeft,
146
- flushRight,
158
+ [
159
+ base,
160
+ baseTd,
161
+ click,
162
+ backgroundColor,
163
+ borderColor,
164
+ firstCol,
165
+ horizontalScrolling,
166
+ flush,
167
+ ],
147
168
  props.class,
148
169
  );
149
170
  });
150
171
 
151
172
  const tdRef = ref<HTMLTableCellElement | null>(null);
152
173
 
153
- const { isFirstColumn } = useIsFirstColumn(tdRef);
154
- const { isLastColumn } = useIsLastColumn(tdRef);
155
-
156
174
  function onClick(event: MouseEvent) {
157
175
  propsInternal.value.onClick?.(event);
158
176
  }
@@ -12,8 +12,6 @@
12
12
  </template>
13
13
 
14
14
  <script lang="ts" setup>
15
- import { useIsFirstColumn } from '@/composables/isFirstColumn';
16
- import { useIsLastColumn } from '@/composables/isLastColumn';
17
15
  import { cellClasses } from '@/services/table/classes';
18
16
  import { CellConfig, TableProps } from '@/services/table/types';
19
17
  import { ClassNameValue, twMerge } from 'tailwind-merge';
@@ -59,27 +57,23 @@ const cellConfig = computed<CellConfig>(() => {
59
57
 
60
58
  const thRef = ref<HTMLTableCellElement | null>(null);
61
59
 
62
- const { isFirstColumn } = useIsFirstColumn(thRef);
63
- const { isLastColumn } = useIsLastColumn(thRef);
64
-
65
-
66
60
  const classes = computed(() => {
67
61
  const base = cellClasses(cellConfig.value);
68
62
  const baseTh = 'bg-white text-slate-500 border-b border-slate-300 group';
69
63
  const sticky = baseTable?.value.fixedHeader ? 'sticky top-0 z-[2]' : '';
70
- const firstCol = isFirstColumn.value ? 'border-r border-r-transparent' : '';
71
- const horizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value && isFirstColumn.value ? 'sticky z-[3] left-0 border-r-slate-200' : '';
72
- const flushLeft = baseTable?.value.flush && isFirstColumn.value ? 'pl-0' : '';
73
- const flushRight = baseTable?.value.flush && isLastColumn.value ? 'pr-0' : '';
64
+ const firstCol = 'first:border-r first:border-r-transparent';
65
+ const horizontalScrolling = baseTable?.value.fixedColumn && baseTableHorizontalScrolling?.value ? 'first:sticky first:z-[3] first:left-0 first:border-r-slate-200' : '';
66
+ const flush = baseTable?.value.flush ? 'first:pl-0 last:pr-0' : '';
74
67
 
75
68
  return twMerge(
76
- base,
77
- baseTh,
78
- sticky,
79
- firstCol,
80
- horizontalScrolling,
81
- flushLeft,
82
- flushRight,
69
+ [
70
+ base,
71
+ baseTh,
72
+ sticky,
73
+ firstCol,
74
+ horizontalScrolling,
75
+ flush,
76
+ ],
83
77
  props.class,
84
78
  );
85
79
  });
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <tr
3
+ ref="trRef"
3
4
  :class="classes"
4
5
  @mouseenter="onMouseEnter"
5
6
  @mouseleave="onMouseLeave"
@@ -30,6 +31,7 @@ const props = withDefaults(defineProps<{
30
31
  target?: '_blank' | '_self' | '_parent' | '_top',
31
32
  title?: string,
32
33
  class?: ClassNameValue,
34
+ selected?: boolean,
33
35
  onClick?: (e: MouseEvent) => void,
34
36
  }>(), {
35
37
  href: undefined,
@@ -37,9 +39,17 @@ const props = withDefaults(defineProps<{
37
39
  target: undefined,
38
40
  title: undefined,
39
41
  class: undefined,
42
+ selected: false,
40
43
  onClick: undefined,
41
44
  });
42
45
 
46
+ const trRef = ref<null | HTMLTableRowElement>(null);
47
+ const parent = ref<null | undefined | HTMLElement>(null);
48
+
49
+ onMounted(() => {
50
+ parent.value = trRef.value?.parentElement;
51
+ });
52
+
43
53
  const classes = computed(() => {
44
54
  const base = 'group/row';
45
55
 
@@ -68,6 +78,7 @@ function onMouseLeave() {
68
78
 
69
79
  provide('tableRow:props', computed(() => props));
70
80
  provide('tableRow:hover', computed(() => hover.value));
81
+ provide('tableRow:selected', computed(() => props.selected));
71
82
  provide('tableRow:setHoverForFullRow', setHoverForFullRow);
72
83
  provide('tableRow:hoverForFullRow', computed(() => hoverForFullRow.value));
73
84
 
@@ -1,11 +1,10 @@
1
- import { twMerge } from "tailwind-merge";
2
1
  import { CellConfig, CellSize } from "./types";
3
2
 
4
3
  export function cellClasses(config: CellConfig): string {
5
4
  const base = '';
6
5
  const space = size(config.size ?? 'md');
7
6
 
8
- return twMerge([base, space]);
7
+ return [base, space].join(' ');
9
8
  }
10
9
 
11
10
  function size(size: CellSize): string {
@@ -7,6 +7,7 @@ export interface TableProps {
7
7
  flush?: boolean;
8
8
  fixedHeader?: boolean;
9
9
  fixedColumn?: boolean;
10
+ striped?: boolean;
10
11
  }
11
12
 
12
13
  export type CellConfig = TableProps;
@@ -1,4 +0,0 @@
1
- import { MaybeRef } from "vue";
2
- export declare function useIsFirstColumn(tdOrTh: MaybeRef<HTMLTableCellElement | null>): {
3
- isFirstColumn: import("vue").ComputedRef<boolean>;
4
- };
@@ -1,31 +0,0 @@
1
- import { MaybeRef } from "vue";
2
-
3
- export function useIsFirstColumn(tdOrTh: MaybeRef<HTMLTableCellElement | null>) {
4
-
5
- const leftCol = ref<HTMLTableCellElement | null>();
6
-
7
- onMounted(() => {
8
- leftCol.value = unref(tdOrTh)?.previousElementSibling as HTMLTableCellElement | null;
9
- });
10
-
11
- const isFirstColumn = computed(() => {
12
-
13
- if (!leftCol.value) {
14
- return true;
15
- }
16
-
17
- if (leftCol.value.tagName.toLowerCase() === 'th') {
18
- return false;
19
- }
20
-
21
- if (leftCol.value.tagName.toLowerCase() === 'td') {
22
- return false;
23
- }
24
-
25
- return true;
26
- });
27
-
28
- return {
29
- isFirstColumn,
30
- };
31
- }