sprintify-ui 0.6.38 → 0.6.40

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,4 +1,8 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
+ class: {
3
+ type: import("vue").PropType<string | string[]>;
4
+ default: undefined;
5
+ };
2
6
  color: {
3
7
  type: import("vue").PropType<string>;
4
8
  default: string;
@@ -11,7 +15,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
11
15
  default: undefined;
12
16
  };
13
17
  size: {
14
- type: import("vue").PropType<"base" | "sm" | "lg">;
18
+ type: import("vue").PropType<string>;
15
19
  default: string;
16
20
  };
17
21
  contrast: {
@@ -22,6 +26,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
22
26
  type: import("vue").PropType<boolean>;
23
27
  };
24
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
+ };
25
33
  color: {
26
34
  type: import("vue").PropType<string>;
27
35
  default: string;
@@ -34,7 +42,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
34
42
  default: undefined;
35
43
  };
36
44
  size: {
37
- type: import("vue").PropType<"base" | "sm" | "lg">;
45
+ type: import("vue").PropType<string>;
38
46
  default: string;
39
47
  };
40
48
  contrast: {
@@ -45,9 +53,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
45
53
  type: import("vue").PropType<boolean>;
46
54
  };
47
55
  }>>, {
56
+ class: string | string[];
48
57
  color: string;
49
58
  icon: string;
50
- size: "base" | "sm" | "lg";
59
+ size: string;
51
60
  contrast: "high" | "low";
52
61
  }, {}>, {
53
62
  default?(_: {}): any;
@@ -202,6 +202,9 @@ import { Locales } from './types';
202
202
  import { Country } from './types/Country';
203
203
  import { Region } from './types/Region';
204
204
  import { Size } from './utils/sizes';
205
+ export interface OptionProps {
206
+ size?: Size;
207
+ }
205
208
  export interface Options {
206
209
  http?: AxiosInstance;
207
210
  upload_url?: string;
@@ -210,9 +213,7 @@ export interface Options {
210
213
  parseQueryString?: (params: string) => Record<string, any>;
211
214
  countries?: Country[];
212
215
  regions?: Region[];
213
- props?: {
214
- size?: Size;
215
- };
216
+ props?: OptionProps;
216
217
  }
217
218
  declare const config: {
218
219
  http: AxiosInstance;
@@ -222,9 +223,7 @@ declare const config: {
222
223
  parseQueryString(params: string): Record<string, any>;
223
224
  countries: Country[];
224
225
  regions: Region[];
225
- props: {
226
- size: string;
227
- };
226
+ props: OptionProps | undefined;
228
227
  };
229
228
  declare function install(app: App, options?: Options): void;
230
229
  declare const _default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.6.38",
3
+ "version": "0.6.40",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -4,7 +4,7 @@ import { palette } from '@/utils/colors';
4
4
 
5
5
  const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
6
6
 
7
- const sizes = ['sm', 'base', 'lg'];
7
+ const sizes = ['sm', 'md', 'lg'];
8
8
 
9
9
  export default {
10
10
  title: 'Components/BaseBadge',
@@ -88,9 +88,9 @@ export const Sizes = (args) => ({
88
88
  return { args, colors, sizes };
89
89
  },
90
90
  template: `
91
- <div v-for="size in sizes" :key="size">
92
- <p class="text-xs text-slate-600 leading-tight mb-1">{{ size }}</p>
93
- <BaseBadge v-bind="args" :size="size" icon="heroicons:beaker-20-solid">
91
+ <div v-for="size in sizes" :key="size" class="mb-1">
92
+ <p class="text-xs text-slate-600 leading-tight">{{ size }}</p>
93
+ <BaseBadge v-bind="args" :size="size">
94
94
  Administrator
95
95
  </BaseBadge>
96
96
  </div>
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <span
3
- class="inline-flex items-center rounded-full font-medium leading-tight"
4
- :class="[sizeClasses, wrapClasses]"
3
+ :class="classes"
5
4
  :style="colorStyle"
6
5
  >
7
6
  <BaseIcon
@@ -17,20 +16,29 @@
17
16
  <script lang="ts" setup>
18
17
  import { getColorConfig } from '@/utils/colors';
19
18
  import { Icon as BaseIcon } from '@iconify/vue';
19
+ import { twMerge } from 'tailwind-merge';
20
+
21
+ const sizes = ['sm', 'md', 'lg'];
22
+
23
+ defineOptions({
24
+ inheritAttrs: false,
25
+ })
20
26
 
21
27
  const props = withDefaults(
22
28
  defineProps<{
29
+ class?: string | string[];
23
30
  contrast?: 'low' | 'high';
24
31
  color?: string;
25
- size?: 'sm' | 'base' | 'lg';
32
+ size?: typeof sizes[number];
26
33
  icon?: string;
27
34
  wrap?: boolean;
28
35
  bordered?: boolean;
29
36
  }>(),
30
37
  {
31
- contrast: 'high',
38
+ class: undefined,
39
+ contrast: 'low',
32
40
  color: 'gray',
33
- size: 'base',
41
+ size: 'md',
34
42
  icon: undefined,
35
43
  }
36
44
  );
@@ -52,36 +60,34 @@ const colorStyle = computed((): Record<string, string> => {
52
60
  return styles;
53
61
  });
54
62
 
55
- const wrapClasses = computed(() => {
56
- if (!props.wrap) {
57
- return 'whitespace-nowrap';
63
+ const sizeInternal = computed(() => {
64
+ if (!sizes.includes(props.size)) {
65
+ return 'md';
58
66
  }
59
- return '';
60
- });
61
67
 
62
- const sizeClasses = computed(() => {
63
- if (props.size == 'sm') {
64
- return 'px-2 py-px text-[11px]';
65
- }
66
- if (props.size == 'base') {
67
- return 'px-2.5 py-0.5 text-xs';
68
- }
69
- if (props.size == 'lg') {
70
- return 'px-3 py-0.5 text-sm';
71
- }
72
- return 'px-2.5 py-0.5 text-xs';
68
+ return props.size;
73
69
  });
74
70
 
71
+ const classes = computed(() => {
72
+ const base = 'inline-flex items-center rounded leading-tight';
73
+ const size = {
74
+ sm: 'px-1.5 py-px text-[10px]',
75
+ md: 'px-1.5 py-0.5 text-xs',
76
+ lg: 'px-1.5 py-0.5 text-sm',
77
+ }[sizeInternal.value];
78
+ const wrap = props.wrap ? 'whitespace-nowrap' : '';
79
+
80
+ return twMerge(base, wrap, size, props.class);
81
+ })
82
+
75
83
  const iconSizeClasses = computed(() => {
76
- if (props.size == 'sm') {
77
- return 'h-2.5 w-2.5 mr-1 -ml-px';
78
- }
79
- if (props.size == 'base') {
80
- return 'h-3 w-3 mr-1 -ml-0.5';
81
- }
82
- if (props.size == 'lg') {
83
- return 'h-4 w-4 mr-1 -ml-0.5';
84
- }
85
- return 'h-3 w-3 mr-1 -ml-0.5';
84
+
85
+ const size = {
86
+ sm: 'h-2.5 w-2.5 mr-1',
87
+ md: 'h-3 w-3 mr-1',
88
+ lg: 'h-4 w-4 mr-1',
89
+ }[sizeInternal.value];
90
+
91
+ return size;
86
92
  });
87
93
  </script>
@@ -7,7 +7,7 @@ function useInputSize(size: MaybeRef<Size | '' | undefined | null>) {
7
7
 
8
8
  const bp = useBreakpoints();
9
9
 
10
- const defaultSize = (config.props.size ?? 'md') as Size;
10
+ const defaultSize = (config.props?.size ?? 'md') as Size;
11
11
 
12
12
  const sizeInternal = computed(() => {
13
13
 
package/src/index.ts CHANGED
@@ -19,6 +19,10 @@ import { Region } from './types/Region';
19
19
  import { useI18nStore } from './stores/i18n';
20
20
  import { Size } from './utils/sizes';
21
21
 
22
+ export interface OptionProps {
23
+ size?: Size;
24
+ }
25
+
22
26
  export interface Options {
23
27
  http?: AxiosInstance;
24
28
  upload_url?: string;
@@ -29,9 +33,7 @@ export interface Options {
29
33
  parseQueryString?: (params: string) => Record<string, any>;
30
34
  countries?: Country[];
31
35
  regions?: Region[];
32
- props?: {
33
- size?: Size
34
- }
36
+ props?: OptionProps
35
37
  }
36
38
 
37
39
  const config = {
@@ -57,8 +59,8 @@ const config = {
57
59
  countries: [] as Country[],
58
60
  regions: [] as Region[],
59
61
  props: {
60
- size: 'md'
61
- }
62
+ size: 'md',
63
+ } as OptionProps | undefined
62
64
  };
63
65
 
64
66
  function install(app: App, options?: Options) {
@@ -95,6 +97,10 @@ function install(app: App, options?: Options) {
95
97
  config.regions = options.regions;
96
98
  }
97
99
 
100
+ if (options?.props) {
101
+ config.props = options.props;
102
+ }
103
+
98
104
  if (app.config.globalProperties.$i18n) {
99
105
  watch(
100
106
  () => app.config.globalProperties.$i18n.locale,
@@ -44,7 +44,7 @@ export const palette: Record<string, ColorPalette> = {
44
44
  red: {
45
45
  low: {
46
46
  backgroundColor: colors.red[100],
47
- textColor: colors.red[700],
47
+ textColor: colors.red[800],
48
48
  borderColor: colors.red[300],
49
49
  },
50
50
  high: {
@@ -56,7 +56,7 @@ export const palette: Record<string, ColorPalette> = {
56
56
  orange: {
57
57
  low: {
58
58
  backgroundColor: colors.orange[100],
59
- textColor: colors.orange[700],
59
+ textColor: colors.orange[800],
60
60
  borderColor: colors.orange[300],
61
61
  },
62
62
  high: {
@@ -68,7 +68,7 @@ export const palette: Record<string, ColorPalette> = {
68
68
  yellow: {
69
69
  low: {
70
70
  backgroundColor: colors.yellow[100],
71
- textColor: colors.yellow[700],
71
+ textColor: colors.yellow[800],
72
72
  borderColor: colors.yellow[300],
73
73
  },
74
74
  high: {
@@ -80,7 +80,7 @@ export const palette: Record<string, ColorPalette> = {
80
80
  green: {
81
81
  low: {
82
82
  backgroundColor: colors.green[100],
83
- textColor: colors.green[700],
83
+ textColor: colors.green[800],
84
84
  borderColor: colors.green[300],
85
85
  },
86
86
  high: {
@@ -92,7 +92,7 @@ export const palette: Record<string, ColorPalette> = {
92
92
  teal: {
93
93
  low: {
94
94
  backgroundColor: colors.teal[100],
95
- textColor: colors.teal[700],
95
+ textColor: colors.teal[800],
96
96
  borderColor: colors.teal[300],
97
97
  },
98
98
  high: {
@@ -104,7 +104,7 @@ export const palette: Record<string, ColorPalette> = {
104
104
  cyan: {
105
105
  low: {
106
106
  backgroundColor: colors.cyan[100],
107
- textColor: colors.cyan[700],
107
+ textColor: colors.cyan[800],
108
108
  borderColor: colors.cyan[300],
109
109
  },
110
110
  high: {
@@ -116,7 +116,7 @@ export const palette: Record<string, ColorPalette> = {
116
116
  blue: {
117
117
  low: {
118
118
  backgroundColor: colors.blue[100],
119
- textColor: colors.blue[700],
119
+ textColor: colors.blue[800],
120
120
  borderColor: colors.blue[300],
121
121
  },
122
122
  high: {
@@ -128,7 +128,7 @@ export const palette: Record<string, ColorPalette> = {
128
128
  indigo: {
129
129
  low: {
130
130
  backgroundColor: colors.indigo[100],
131
- textColor: colors.indigo[700],
131
+ textColor: colors.indigo[800],
132
132
  borderColor: colors.indigo[300],
133
133
  },
134
134
  high: {
@@ -140,7 +140,7 @@ export const palette: Record<string, ColorPalette> = {
140
140
  purple: {
141
141
  low: {
142
142
  backgroundColor: colors.purple[100],
143
- textColor: colors.purple[700],
143
+ textColor: colors.purple[800],
144
144
  borderColor: colors.purple[300],
145
145
  },
146
146
  high: {
@@ -152,7 +152,7 @@ export const palette: Record<string, ColorPalette> = {
152
152
  pink: {
153
153
  low: {
154
154
  backgroundColor: colors.pink[100],
155
- textColor: colors.pink[700],
155
+ textColor: colors.pink[800],
156
156
  borderColor: colors.pink[300],
157
157
  },
158
158
  high: {