sprintify-ui 0.6.44 → 0.6.45

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.
@@ -1,51 +1,70 @@
1
- import { PropType } from 'vue';
2
- declare const _default: import("vue").DefineComponent<{
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
+ class: {
3
+ type: import("vue").PropType<string | string[]>;
4
+ default: undefined;
5
+ };
3
6
  title: {
4
- required: false;
5
- default: string;
6
- type: StringConstructor;
7
+ type: import("vue").PropType<string>;
8
+ default: undefined;
7
9
  };
8
10
  color: {
11
+ type: import("vue").PropType<string>;
12
+ required: true;
13
+ default: string;
14
+ };
15
+ icon: {
16
+ type: import("vue").PropType<string>;
17
+ required: true;
9
18
  default: string;
10
- type: PropType<"danger" | "success" | "warning" | "info">;
11
19
  };
12
20
  showIcon: {
21
+ type: import("vue").PropType<boolean>;
13
22
  default: boolean;
14
- type: BooleanConstructor;
15
23
  };
16
24
  bordered: {
25
+ type: import("vue").PropType<boolean>;
17
26
  default: boolean;
18
- type: BooleanConstructor;
19
- };
20
- }, unknown, unknown, {
21
- backgroundClass(): string;
22
- borderClass(): string;
23
- titleClass(): string;
24
- textClass(): string;
25
- iconClass(): string;
26
- icon(): string;
27
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
27
+ };
28
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
29
+ class: {
30
+ type: import("vue").PropType<string | string[]>;
31
+ default: undefined;
32
+ };
28
33
  title: {
29
- required: false;
30
- default: string;
31
- type: StringConstructor;
34
+ type: import("vue").PropType<string>;
35
+ default: undefined;
32
36
  };
33
37
  color: {
38
+ type: import("vue").PropType<string>;
39
+ required: true;
40
+ default: string;
41
+ };
42
+ icon: {
43
+ type: import("vue").PropType<string>;
44
+ required: true;
34
45
  default: string;
35
- type: PropType<"danger" | "success" | "warning" | "info">;
36
46
  };
37
47
  showIcon: {
48
+ type: import("vue").PropType<boolean>;
38
49
  default: boolean;
39
- type: BooleanConstructor;
40
50
  };
41
51
  bordered: {
52
+ type: import("vue").PropType<boolean>;
42
53
  default: boolean;
43
- type: BooleanConstructor;
44
54
  };
45
55
  }>>, {
56
+ class: string | string[];
46
57
  title: string;
47
- color: "danger" | "success" | "warning" | "info";
58
+ color: string;
59
+ icon: string;
48
60
  showIcon: boolean;
49
61
  bordered: boolean;
50
- }, {}>;
62
+ }, {}>, {
63
+ default?(_: {}): any;
64
+ }>;
51
65
  export default _default;
66
+ type __VLS_WithTemplateSlots<T, S> = T & {
67
+ new (): {
68
+ $slots: S;
69
+ };
70
+ };
@@ -7,13 +7,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
7
7
  type: import("vue").PropType<string>;
8
8
  default: string;
9
9
  };
10
- bordered: {
11
- type: import("vue").PropType<boolean>;
12
- };
13
10
  icon: {
14
11
  type: import("vue").PropType<string>;
15
12
  default: undefined;
16
13
  };
14
+ bordered: {
15
+ type: import("vue").PropType<boolean>;
16
+ };
17
17
  size: {
18
18
  type: import("vue").PropType<string>;
19
19
  default: string;
@@ -34,13 +34,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
34
34
  type: import("vue").PropType<string>;
35
35
  default: string;
36
36
  };
37
- bordered: {
38
- type: import("vue").PropType<boolean>;
39
- };
40
37
  icon: {
41
38
  type: import("vue").PropType<string>;
42
39
  default: undefined;
43
40
  };
41
+ bordered: {
42
+ type: import("vue").PropType<boolean>;
43
+ };
44
44
  size: {
45
45
  type: import("vue").PropType<string>;
46
46
  default: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.6.44",
3
+ "version": "0.6.45",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,12 +1,16 @@
1
1
  import BaseAlert from './BaseAlert.vue';
2
2
 
3
+ import { palette } from '@/utils/colors';
4
+
5
+ const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
6
+
3
7
  export default {
4
8
  title: 'Components/BaseAlert',
5
9
  component: BaseAlert,
6
10
  argTypes: {
7
11
  color: {
8
12
  control: { type: 'select' },
9
- options: ['success', 'info', 'warning', 'danger'],
13
+ options: colors,
10
14
  },
11
15
  },
12
16
  };
@@ -50,3 +54,22 @@ Info.args = {
50
54
  color: 'info',
51
55
  bordered: true,
52
56
  };
57
+
58
+ export const Colors = (args) => ({
59
+ components: { BaseAlert },
60
+ setup() {
61
+ return { args, colors };
62
+ },
63
+ template: `
64
+ <div v-for="color in colors" :key="color" class="mb-1">
65
+ <p class="text-xs text-slate-600 leading-tight">{{ color }}</p>
66
+ <BaseAlert v-bind="args" :color="color" icon="heroicons:beaker-20-solid">
67
+ <p>Nisi Lorem sunt amet aliqua dolor ullamco deserunt enim irure non ad. Excepteur culpa consectetur dolore culpa sunt aliquip proident quis. Excepteur officia mollit aute sint quis nisi sint.</p>
68
+ </BaseAlert>
69
+ </div>
70
+ `,
71
+ });
72
+
73
+ Colors.args = {
74
+ bordered: true,
75
+ };
@@ -1,30 +1,14 @@
1
1
  <template>
2
2
  <div
3
- class="flex w-full items-start rounded-md p-4"
4
- :class="[backgroundClass, borderClass]"
3
+ :class="classes"
4
+ :style="colorStyle"
5
5
  >
6
6
  <div
7
7
  v-if="showIcon"
8
- class="mr-3"
8
+ class="shrink-0"
9
9
  >
10
10
  <BaseIcon
11
- v-if="color == 'warning'"
12
- icon="heroicons:exclamation-triangle"
13
- :class="iconClass"
14
- />
15
- <BaseIcon
16
- v-else-if="color == 'danger'"
17
- icon="heroicons:exclamation-circle"
18
- :class="iconClass"
19
- />
20
- <BaseIcon
21
- v-else-if="color == 'success'"
22
- icon="heroicons:check-circle"
23
- :class="iconClass"
24
- />
25
- <BaseIcon
26
- v-else-if="color == 'info'"
27
- icon="heroicons:information-circle"
11
+ :icon="icon"
28
12
  :class="iconClass"
29
13
  />
30
14
  </div>
@@ -33,14 +17,13 @@
33
17
  <h3
34
18
  v-if="title"
35
19
  class="mb-1 text-sm font-semibold leading-tight"
36
- :class="[titleClass]"
37
20
  >
38
21
  {{ title }}
39
22
  </h3>
40
23
 
41
24
  <div
42
25
  v-if="$slots.default"
43
- :class="[textClass, 'text-sm font-light leading-snug']"
26
+ class="text-sm font-light leading-snug"
44
27
  >
45
28
  <slot />
46
29
  </div>
@@ -48,111 +31,70 @@
48
31
  </div>
49
32
  </template>
50
33
 
51
- <script lang="ts">
52
- import { defineComponent, PropType } from 'vue';
34
+ <script lang="ts" setup>
35
+ import { getColorConfig } from '@/utils/colors';
36
+ import { twMerge } from 'tailwind-merge';
37
+
38
+ defineOptions({
39
+ inheritAttrs: false,
40
+ });
41
+
42
+ const props = withDefaults(defineProps<{
43
+ title?: string;
44
+ color: 'info' | 'success' | 'danger' | 'warning' | string;
45
+ icon: string;
46
+ showIcon?: boolean;
47
+ bordered?: boolean;
48
+ class?: string | string[];
49
+ }>(), {
50
+ title: undefined,
51
+ color: 'info',
52
+ icon: '',
53
+ showIcon: true,
54
+ bordered: false,
55
+ class: undefined,
56
+ });
57
+
58
+ const classes = computed(() => {
59
+ const base = 'flex w-full items-start rounded-md p-4 gap-2.5';
60
+ const iconPadding = props.showIcon ? 'pl-3.5' : '';
61
+
62
+ return twMerge(
63
+ base,
64
+ iconPadding,
65
+ props.class
66
+ );
67
+ });
68
+
69
+ const colorStyle = computed((): Record<string, string> => {
70
+ const config = getColorConfig(props.color, false);
71
+
72
+ const styles: Record<string, string> = {
73
+ backgroundColor: config.backgroundColor,
74
+ color: config.textColor,
75
+ };
76
+
77
+ if (props.bordered) {
78
+ styles.borderColor = config.borderColor;
79
+ styles.borderWidth = '1px';
80
+ styles.borderStyle = 'solid';
81
+ }
82
+
83
+ return styles;
84
+ });
85
+
86
+ const iconClass = computed(() => {
87
+ return props.icon + ' w-4 h-4 mt-px';
88
+ });
89
+
90
+ const icon = computed(() => {
91
+ const iconName = {
92
+ info: 'heroicons:information-circle-16-solid',
93
+ success: 'heroicons:check-circle-16-solid',
94
+ danger: 'heroicons:exclamation-circle-16-solid',
95
+ warning: 'heroicons:exclamation-triangle-16-solid',
96
+ }[props.color as never] ?? null;
53
97
 
54
- export default defineComponent({
55
- props: {
56
- title: {
57
- required: false,
58
- default: '',
59
- type: String,
60
- },
61
- color: {
62
- default: 'success',
63
- type: String as PropType<'info' | 'success' | 'danger' | 'warning'>,
64
- },
65
- showIcon: {
66
- default: true,
67
- type: Boolean,
68
- },
69
- bordered: {
70
- default: false,
71
- type: Boolean,
72
- },
73
- },
74
- computed: {
75
- backgroundClass(): string {
76
- if (this.color == 'info') {
77
- return 'bg-blue-50';
78
- }
79
- if (this.color == 'success') {
80
- return 'bg-green-50';
81
- }
82
- if (this.color == 'danger') {
83
- return 'bg-red-50';
84
- }
85
- if (this.color == 'warning') {
86
- return 'bg-orange-50';
87
- }
88
- return 'bg-slate-900';
89
- },
90
- borderClass(): string {
91
- if (!this.bordered) {
92
- return '';
93
- }
94
- if (this.color == 'info') {
95
- return 'border border-blue-400';
96
- }
97
- if (this.color == 'success') {
98
- return 'border border-green-400';
99
- }
100
- if (this.color == 'danger') {
101
- return 'border border-red-400';
102
- }
103
- if (this.color == 'warning') {
104
- return 'border border-orange-400';
105
- }
106
- return 'borer border-slate-900';
107
- },
108
- titleClass(): string {
109
- if (this.color == 'info') {
110
- return 'text-blue-900';
111
- }
112
- if (this.color == 'success') {
113
- return 'text-green-900';
114
- }
115
- if (this.color == 'warning') {
116
- return 'text-orange-900';
117
- }
118
- if (this.color == 'danger') {
119
- return 'text-red-900';
120
- }
121
- return 'text-white';
122
- },
123
- textClass(): string {
124
- if (this.color == 'info') {
125
- return 'text-blue-900';
126
- }
127
- if (this.color == 'success') {
128
- return 'text-green-900';
129
- }
130
- if (this.color == 'warning') {
131
- return 'text-orange-900';
132
- }
133
- if (this.color == 'danger') {
134
- return 'text-red-900';
135
- }
136
- return 'text-white';
137
- },
138
- iconClass(): string {
139
- return this.icon + ' w-5 h-5';
140
- },
141
- icon(): string {
142
- if (this.color == 'info') {
143
- return 'text-blue-600';
144
- }
145
- if (this.color == 'success') {
146
- return 'text-green-600';
147
- }
148
- if (this.color == 'warning') {
149
- return 'text-orange-600';
150
- }
151
- if (this.color == 'danger') {
152
- return 'text-red-600';
153
- }
154
- return 'text-white';
155
- },
156
- },
98
+ return iconName ?? props.icon;
157
99
  });
158
100
  </script>
@@ -22,7 +22,7 @@ const sizes = ['sm', 'md', 'lg'];
22
22
 
23
23
  defineOptions({
24
24
  inheritAttrs: false,
25
- })
25
+ });
26
26
 
27
27
  const props = withDefaults(
28
28
  defineProps<{
@@ -20,8 +20,8 @@ export const palette: Record<string, ColorPalette> = {
20
20
  black: {
21
21
  low: {
22
22
  backgroundColor: colors.slate[200],
23
- textColor: colors.slate[900],
24
- borderColor: 'transparent',
23
+ textColor: colors.slate[800],
24
+ borderColor: colors.slate[300],
25
25
  },
26
26
  high: {
27
27
  backgroundColor: colors.black,