@unsource/ui 2.7.8 → 2.7.10

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "2.7.8",
4
+ "version": "2.7.10",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,3 +1,4 @@
1
+ export type CardCustomClass = Partial<Record<'prepend' | 'append' | 'label' | 'image' | 'avatar' | 'nameDesc', string>>;
1
2
  type __VLS_Props = {
2
3
  label?: string;
3
4
  icon?: string;
@@ -5,10 +6,8 @@ type __VLS_Props = {
5
6
  prepend?: string;
6
7
  variant?: string;
7
8
  mini?: boolean;
9
+ customClass?: CardCustomClass;
8
10
  };
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
10
- mini: boolean;
11
- variant: string;
12
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
12
  declare const _default: typeof __VLS_export;
14
13
  export default _default;
@@ -3,53 +3,40 @@
3
3
  class="flex items-center px-2 py-1 gap-1 rounded-full cursor-pointer shrink-0"
4
4
  :class="classVariant"
5
5
  >
6
- <div
7
- class="flex items-center justify-center"
8
- :class="[prepend ? mini ? 'w-4' : 'w-8' : 'w-0', mini ? 'h-4' : 'h-8']"
6
+ <UnNuxtIcon
7
+ v-if="prepend"
8
+ :name="prepend"
9
+ class="text-base"
10
+ :class="[prependClass, mini ? 'w-4 h-4' : 'w-8 h-8', customClass.prepend]"
11
+ @click="$emit('prependClick')"
12
+ />
13
+ <p
14
+ :class="customClass.label"
15
+ class="text-xs"
9
16
  >
10
- <UnNuxtIcon
11
- v-if="prepend"
12
- :name="prepend"
13
- class="text-base"
14
- :class="prependClass"
15
- @click="$emit('prependClick')"
16
- />
17
- </div>
18
- <p class="text-xs">
19
17
  {{ label }}
20
18
  </p>
21
19
  <UnNuxtIcon
22
20
  v-if="icon"
23
21
  :name="icon"
24
22
  class="text-base"
23
+ :class="customClass.append"
25
24
  @click="$emit('iconClick')"
26
25
  />
27
26
  </div>
28
27
  </template>
29
28
 
30
29
  <script setup>
31
- import { computed } from "#imports";
32
- const props = defineProps({
30
+ import { computed, variants } from "#imports";
31
+ const { variant = "danger", mini = false, customClass = {} } = defineProps({
33
32
  label: { type: String, required: false },
34
33
  icon: { type: String, required: false },
35
34
  prependClass: { type: String, required: false },
36
35
  prepend: { type: String, required: false },
37
- variant: { type: String, required: false, default: "danger" },
38
- mini: { type: Boolean, required: false, default: false }
36
+ variant: { type: String, required: false },
37
+ mini: { type: Boolean, required: false },
38
+ customClass: { type: Object, required: false }
39
39
  });
40
40
  defineEmits(["prependClick", "iconClick"]);
41
- const variants = {
42
- "success": "bg-success/10 text-success",
43
- "success-fill": "bg-success text-white",
44
- "danger": "bg-danger/10 text-danger",
45
- "danger-fill": "bg-danger text-white",
46
- "warning": "bg-warning/10 text-warning",
47
- "warning-fill": "bg-warning text-white",
48
- "primary": "bg-primary-500/10 text-primary-500",
49
- "primary-fill": "bg-primary-500 text-white",
50
- "primary-border": "bg-primary-500/10 text-primary-500 border-(1 solid primary-500)",
51
- "secondary": "bg-gray-600/10 text-gray-600",
52
- "secondary-fill": "bg-gray-600 text-white"
53
- };
54
- const classVariant = computed(() => variants?.[props.variant]);
41
+ const classVariant = computed(() => variants?.[variant]);
55
42
  </script>
@@ -1,3 +1,4 @@
1
+ export type CardCustomClass = Partial<Record<'prepend' | 'append' | 'label' | 'image' | 'avatar' | 'nameDesc', string>>;
1
2
  type __VLS_Props = {
2
3
  label?: string;
3
4
  icon?: string;
@@ -5,10 +6,8 @@ type __VLS_Props = {
5
6
  prepend?: string;
6
7
  variant?: string;
7
8
  mini?: boolean;
9
+ customClass?: CardCustomClass;
8
10
  };
9
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
10
- mini: boolean;
11
- variant: string;
12
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
12
  declare const _default: typeof __VLS_export;
14
13
  export default _default;
@@ -6,6 +6,7 @@ export type TableCol = {
6
6
  key?: string | string[];
7
7
  subKey?: string | string[];
8
8
  class?: string;
9
+ classHandler?: () => string;
9
10
  dir?: string;
10
11
  isDesktop?: boolean;
11
12
  isMobile?: boolean;
@@ -14,6 +15,7 @@ type __VLS_Props = {
14
15
  cols?: TableCol[];
15
16
  items?: Record<string, unknown>[];
16
17
  thClass?: string;
18
+ trClass?: () => string;
17
19
  tdClass?: string;
18
20
  textClass?: string;
19
21
  boxMode?: boolean;
@@ -73,6 +73,7 @@
73
73
  :level="0"
74
74
  :item="item"
75
75
  :items
76
+ :tr-class
76
77
  :cols="cols"
77
78
  :td-class
78
79
  :text-class
@@ -99,6 +100,7 @@ const { parentKey, idKey, cols = [], items = [], thClass = "bg-gray-100 border-g
99
100
  cols: { type: Array, required: false },
100
101
  items: { type: Array, required: false },
101
102
  thClass: { type: String, required: false },
103
+ trClass: { type: Function, required: false },
102
104
  tdClass: { type: String, required: false },
103
105
  textClass: { type: String, required: false },
104
106
  boxMode: { type: Boolean, required: false },
@@ -6,6 +6,7 @@ export type TableCol = {
6
6
  key?: string | string[];
7
7
  subKey?: string | string[];
8
8
  class?: string;
9
+ classHandler?: () => string;
9
10
  dir?: string;
10
11
  isDesktop?: boolean;
11
12
  isMobile?: boolean;
@@ -14,6 +15,7 @@ type __VLS_Props = {
14
15
  cols?: TableCol[];
15
16
  items?: Record<string, unknown>[];
16
17
  thClass?: string;
18
+ trClass?: () => string;
17
19
  tdClass?: string;
18
20
  textClass?: string;
19
21
  boxMode?: boolean;
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ trClass?: () => string;
10
11
  level?: number;
11
12
  };
12
13
  type __VLS_ModelProps = {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <tr
3
3
  class="children:p-3 <md:children:p-1 text-center border-b-(2 solid border) hover:bg-primary/10"
4
- :class="{ '!bg-primary/20': selected?.[idKey] === item[idKey] }"
4
+ :class="[trClass?.(item, items), { '!bg-primary/20': selected?.[idKey] === item[idKey] }]"
5
5
  @click="$emit('click:row', item);
6
6
  selected = item"
7
7
  @dbclick="$emit('dbclick:row', item)"
@@ -23,7 +23,7 @@
23
23
  :key="col.name + '-td'"
24
24
  class="text-gray-400 text-sm text-center first:rounded-l-lg last:rounded-r-lg"
25
25
  :style="{ paddingInlineStart: parentKey ? level * 10 + 5 + 'px' : 'unset' }"
26
- :class="[col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
26
+ :class="[col.classHandler?.(item, col, items, cols), col.class, { '<md:hidden': col.isDesktop, 'hidden <md:table-cell': col.isMobile }, tdClass]"
27
27
  :dir="col.dir"
28
28
  >
29
29
  <slot
@@ -68,6 +68,7 @@
68
68
  :id-key
69
69
  :text-class
70
70
  :td-class
71
+ :tr-class
71
72
  @click:row="$emit('click:row', i)"
72
73
  @dbclick:row="$emit('dbclick:row', i)"
73
74
  @add:row="$emit('add:row', i)"
@@ -86,6 +87,7 @@ const { level = 0, parentKey, idKey = "id", item = {}, items = [] } = defineProp
86
87
  parentKey: { type: String, required: false },
87
88
  idKey: { type: String, required: false },
88
89
  tdClass: { type: String, required: false },
90
+ trClass: { type: Function, required: false },
89
91
  level: { type: Number, required: false }
90
92
  });
91
93
  const open = ref(false);
@@ -7,6 +7,7 @@ type __VLS_Props = {
7
7
  parentKey?: string;
8
8
  idKey?: string;
9
9
  tdClass?: string;
10
+ trClass?: () => string;
10
11
  level?: number;
11
12
  };
12
13
  type __VLS_ModelProps = {
@@ -92,3 +92,21 @@ export declare const setOptions: (f: Form, ctx?: {}) => Promise<Form | {
92
92
  inputId: string;
93
93
  }>;
94
94
  export declare const merge: (v: string | Record<string, unknown>, s: string | Record<string, unknown>) => string | Record<string, unknown> | undefined;
95
+ export declare const variants: {
96
+ success: string;
97
+ 'success-fill': string;
98
+ 'success-flat': string;
99
+ danger: string;
100
+ 'danger-fill': string;
101
+ 'danger-flat': string;
102
+ warning: string;
103
+ 'warning-fill': string;
104
+ 'warning-flat': string;
105
+ primary: string;
106
+ 'primary-fill': string;
107
+ 'primary-border': string;
108
+ 'primary-flat': string;
109
+ secondary: string;
110
+ 'secondary-fill': string;
111
+ 'secondary-flat': string;
112
+ };
@@ -379,3 +379,21 @@ export const merge = (v, s) => {
379
379
  return _mergeWith(s, v, merge);
380
380
  }
381
381
  };
382
+ export const variants = {
383
+ "success": "bg-success/10 text-success",
384
+ "success-fill": "bg-success text-white",
385
+ "success-flat": "bg-white text-success",
386
+ "danger": "bg-danger/10 text-danger",
387
+ "danger-fill": "bg-danger text-white",
388
+ "danger-flat": "bg-white bg-danger",
389
+ "warning": "bg-warning/10 text-warning",
390
+ "warning-fill": "bg-warning text-white",
391
+ "warning-flat": "bg-white text-warning",
392
+ "primary": "bg-primary-500/10 text-primary-500",
393
+ "primary-fill": "bg-primary-500 text-white",
394
+ "primary-border": "bg-primary-500/10 text-primary-500 border-(1 solid primary-500)",
395
+ "primary-flat": "bg-white text-primary-500",
396
+ "secondary": "bg-gray-600/10 text-secondary-500",
397
+ "secondary-fill": "bg-secondary-500 text-white",
398
+ "secondary-flat": "bg-white text-secondary-500"
399
+ };
@@ -9,18 +9,17 @@ import { presetScrollbar } from "unocss-preset-scrollbar";
9
9
  export default defineConfig({
10
10
  theme: {
11
11
  colors: {
12
- border: "#cccdd5",
13
- danger: "#e60c21",
14
- warning: "#ffc600",
15
- success: "#35d123",
16
- secondary: {
17
- 500: "#fdf037"
18
- },
19
- primary: "#1270da",
20
- text: {
12
+ "border": "#cccdd5",
13
+ "danger": "#e60c21",
14
+ "warning": "#ffc600",
15
+ "success": "#35d123",
16
+ "secondary": "#5e5e5e",
17
+ "secondary-500": "#fdf037",
18
+ "primary": "#1270da",
19
+ "text": {
21
20
  head: "#4D4444"
22
21
  },
23
- gray: {
22
+ "gray": {
24
23
  200: "#949494",
25
24
  500: "#696969",
26
25
  600: "#1e1e1e"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "2.7.8",
3
+ "version": "2.7.10",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",