@finema/core 1.3.3 → 1.3.5

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,109 +1,109 @@
1
- <template>
2
- <USlideover
3
- v-bind="attrs"
4
- :model-value="modelValue"
5
- :prevent-close="preventClose"
6
- :overlay="overlay"
7
- :transition="transition"
8
- :side="side"
9
- :initial-focus="emptyFocusRef"
10
- :ui="ui"
11
- @update:model-value="$emit('update:modelValue', $event)"
12
- >
13
- <div v-if="!isHideCloseBtn && preventClose" class="absolute right-0 m-4">
14
- <Icon
15
- v-if="!isHideCloseBtn"
16
- name="i-heroicons-x-mark"
17
- class="h-6 w-6 cursor-pointer"
18
- @click="close"
19
- />
20
- </div>
21
-
22
- <div :class="['overflow-y-auto', ui.bodyWrapper]">
23
- <slot />
24
- </div>
25
- </USlideover>
26
-
27
- <div ref="emptyFocusRef" />
28
- </template>
29
-
30
- <script lang="ts" setup>
31
- import { ref, type PropType, toRef, defineShortcuts, watch } from '#imports'
32
- import type { Strategy } from '#core/types/utils'
33
- import { useUI } from '#ui/composables/useUI'
34
- import { slideover } from '#core/ui.config'
35
- import { useUiConfig } from '#core/composables/useConfig'
36
-
37
- const config = useUiConfig<typeof slideover>(slideover, 'slideover')
38
-
39
- const props = defineProps({
40
- modelValue: {
41
- type: Boolean as PropType<boolean>,
42
- default: false,
43
- },
44
- side: {
45
- type: String as PropType<'left' | 'right'>,
46
- default: 'right',
47
- validator: (value: string) => ['left', 'right'].includes(value),
48
- },
49
- overlay: {
50
- type: Boolean,
51
- default: true,
52
- },
53
- preventClose: {
54
- type: Boolean,
55
- default: false,
56
- },
57
- isHideCloseBtn: {
58
- type: Boolean,
59
- default: false,
60
- },
61
- transition: {
62
- type: Boolean,
63
- default: true,
64
- },
65
- size: {
66
- type: String as PropType<keyof typeof slideover.size>,
67
- default: () => slideover.default.size,
68
- },
69
- class: {
70
- type: [String, Array, Object] as PropType<any>,
71
- default: undefined,
72
- },
73
- ui: {
74
- type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
75
- default: undefined,
76
- },
77
- })
78
-
79
- const emits = defineEmits(['update:modelValue'])
80
-
81
- const emptyFocusRef = ref<HTMLElement | null>(null)
82
-
83
- defineShortcuts({
84
- escape: {
85
- usingInput: true,
86
- handler: () => {
87
- if (props.preventClose) return
88
- emits('update:modelValue', false)
89
- },
90
- },
91
- })
92
-
93
- const close = () => {
94
- emits('update:modelValue', false)
95
- }
96
-
97
- const { ui, attrs } = useUI('slideover', toRef(props, 'ui'), config, toRef(props, 'class'))
98
-
99
- watch(
100
- () => props.modelValue,
101
- () => {
102
- if (props.modelValue) {
103
- const size = config.size[props.size]
104
-
105
- ui.value.width = size
106
- }
107
- }
108
- )
109
- </script>
1
+ <template>
2
+ <USlideover
3
+ v-bind="attrs"
4
+ :model-value="modelValue"
5
+ :prevent-close="preventClose"
6
+ :overlay="overlay"
7
+ :transition="transition"
8
+ :side="side"
9
+ :initial-focus="emptyFocusRef"
10
+ :ui="ui"
11
+ @update:model-value="$emit('update:modelValue', $event)"
12
+ >
13
+ <div v-if="!isHideCloseBtn && preventClose" class="absolute right-0 m-4">
14
+ <Icon
15
+ v-if="!isHideCloseBtn"
16
+ name="i-heroicons-x-mark"
17
+ class="h-6 w-6 cursor-pointer"
18
+ @click="close"
19
+ />
20
+ </div>
21
+
22
+ <div :class="['overflow-y-auto', ui.bodyWrapper]">
23
+ <slot />
24
+ </div>
25
+ </USlideover>
26
+
27
+ <div ref="emptyFocusRef" />
28
+ </template>
29
+
30
+ <script lang="ts" setup>
31
+ import { ref, type PropType, toRef, defineShortcuts, watch } from '#imports'
32
+ import type { Strategy } from '#core/types/utils'
33
+ import { useUI } from '#ui/composables/useUI'
34
+ import { slideover } from '#core/ui.config'
35
+ import { useUiConfig } from '#core/composables/useConfig'
36
+
37
+ const config = useUiConfig<typeof slideover>(slideover, 'slideover')
38
+
39
+ const props = defineProps({
40
+ modelValue: {
41
+ type: Boolean as PropType<boolean>,
42
+ default: false,
43
+ },
44
+ side: {
45
+ type: String as PropType<'left' | 'right'>,
46
+ default: 'right',
47
+ validator: (value: string) => ['left', 'right'].includes(value),
48
+ },
49
+ overlay: {
50
+ type: Boolean,
51
+ default: true,
52
+ },
53
+ preventClose: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ isHideCloseBtn: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+ transition: {
62
+ type: Boolean,
63
+ default: true,
64
+ },
65
+ size: {
66
+ type: String as PropType<keyof typeof slideover.size>,
67
+ default: () => slideover.default.size,
68
+ },
69
+ class: {
70
+ type: [String, Array, Object] as PropType<any>,
71
+ default: undefined,
72
+ },
73
+ ui: {
74
+ type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
75
+ default: undefined,
76
+ },
77
+ })
78
+
79
+ const emits = defineEmits(['update:modelValue'])
80
+
81
+ const emptyFocusRef = ref<HTMLElement | null>(null)
82
+
83
+ defineShortcuts({
84
+ escape: {
85
+ usingInput: true,
86
+ handler: () => {
87
+ if (props.preventClose) return
88
+ emits('update:modelValue', false)
89
+ },
90
+ },
91
+ })
92
+
93
+ const close = () => {
94
+ emits('update:modelValue', false)
95
+ }
96
+
97
+ const { ui, attrs } = useUI('slideover', toRef(props, 'ui'), config, toRef(props, 'class'))
98
+
99
+ watch(
100
+ () => props.modelValue,
101
+ () => {
102
+ if (props.modelValue) {
103
+ const size = config.size[props.size]
104
+
105
+ ui.value.width = size
106
+ }
107
+ }
108
+ )
109
+ </script>
@@ -1,84 +1,84 @@
1
- <template>
2
- <div>
3
- <div
4
- v-if="!options.isHideToolbar"
5
- class="flex border-b border-gray-200 px-3 py-3.5 dark:border-gray-700"
6
- >
7
- <UInput v-model="q" placeholder="Search..." />
8
- </div>
9
- <UTable
10
- :loading="options.status.isLoading"
11
- :columns="options.columns"
12
- :rows="options.rawData"
13
- v-bind="$attrs"
14
- >
15
- <template #empty-state>
16
- <div class="flex flex-col items-center justify-center gap-3 py-6">
17
- <span class="text-sm italic">No one here!</span>
18
- </div>
19
- </template>
20
- <template
21
- v-for="column in options.columns"
22
- #[`${column.key}-data`]="{ row }"
23
- :key="column.key"
24
- >
25
- <ColumnNumber
26
- v-if="column.type === COLUMN_TYPES.NUMBER"
27
- :value="row[column.key]"
28
- :column="column"
29
- :row="row"
30
- />
31
- <ColumnImage
32
- v-if="column.type === COLUMN_TYPES.IMAGE"
33
- :value="row[column.key]"
34
- :column="column"
35
- :row="row"
36
- />
37
- <template v-else>
38
- <span :title="row[column.key]">{{ row[column.key] ?? '-' }}</span>
39
- </template>
40
- </template>
41
- <template v-for="(_, slot) of $slots" #[slot]="scope">
42
- <slot :name="slot" v-bind="scope" />
43
- </template>
44
- </UTable>
45
- <div class="mt-4 flex justify-end">
46
- <UPagination
47
- v-model="page"
48
- :page-count="options.pageOptions.totalPage"
49
- :total="options.pageOptions.totalCount"
50
- />
51
- </div>
52
- </div>
53
- </template>
54
- <script lang="ts" setup>
55
- import { type PropType } from 'vue'
56
- import { COLUMN_TYPES, type ITableOptions } from '#core/components/Table/types'
57
- import { _debounce, ref, watch } from '#imports'
58
- import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
59
- import ColumnImage from '#core/components/Table/ColumnImage.vue'
60
-
61
- const emits = defineEmits<{
62
- (event: 'pageChange', page: number): void
63
- (event: 'search', q: string): void
64
- }>()
65
-
66
- const props = defineProps({
67
- options: { type: Object as PropType<ITableOptions>, required: true },
68
- })
69
-
70
- const q = ref(props.options?.pageOptions.search ?? '')
71
-
72
- const page = ref(props.options?.pageOptions.currentPage)
73
-
74
- watch(
75
- q,
76
- _debounce((value) => {
77
- emits('search', value)
78
- }, 500)
79
- )
80
-
81
- watch(page, () => {
82
- emits('pageChange', page.value)
83
- })
84
- </script>
1
+ <template>
2
+ <div>
3
+ <div
4
+ v-if="!options.isHideToolbar"
5
+ class="flex border-b border-gray-200 px-3 py-3.5 dark:border-gray-700"
6
+ >
7
+ <UInput v-model="q" placeholder="Search..." />
8
+ </div>
9
+ <UTable
10
+ :loading="options.status.isLoading"
11
+ :columns="options.columns"
12
+ :rows="options.rawData"
13
+ v-bind="$attrs"
14
+ >
15
+ <template #empty-state>
16
+ <div class="flex flex-col items-center justify-center gap-3 py-6">
17
+ <span class="text-sm italic">No one here!</span>
18
+ </div>
19
+ </template>
20
+ <template
21
+ v-for="column in options.columns"
22
+ #[`${column.key}-data`]="{ row }"
23
+ :key="column.key"
24
+ >
25
+ <ColumnNumber
26
+ v-if="column.type === COLUMN_TYPES.NUMBER"
27
+ :value="row[column.key]"
28
+ :column="column"
29
+ :row="row"
30
+ />
31
+ <ColumnImage
32
+ v-if="column.type === COLUMN_TYPES.IMAGE"
33
+ :value="row[column.key]"
34
+ :column="column"
35
+ :row="row"
36
+ />
37
+ <template v-else>
38
+ <span :title="row[column.key]">{{ row[column.key] ?? '-' }}</span>
39
+ </template>
40
+ </template>
41
+ <template v-for="(_, slot) of $slots" #[slot]="scope">
42
+ <slot :name="slot" v-bind="scope" />
43
+ </template>
44
+ </UTable>
45
+ <div class="mt-4 flex justify-end">
46
+ <UPagination
47
+ v-model="page"
48
+ :page-count="options.pageOptions.totalPage"
49
+ :total="options.pageOptions.totalCount"
50
+ />
51
+ </div>
52
+ </div>
53
+ </template>
54
+ <script lang="ts" setup>
55
+ import { type PropType } from 'vue'
56
+ import { COLUMN_TYPES, type ITableOptions } from '#core/components/Table/types'
57
+ import { _debounce, ref, watch } from '#imports'
58
+ import ColumnNumber from '#core/components/Table/ColumnNumber.vue'
59
+ import ColumnImage from '#core/components/Table/ColumnImage.vue'
60
+
61
+ const emits = defineEmits<{
62
+ (event: 'pageChange', page: number): void
63
+ (event: 'search', q: string): void
64
+ }>()
65
+
66
+ const props = defineProps({
67
+ options: { type: Object as PropType<ITableOptions>, required: true },
68
+ })
69
+
70
+ const q = ref(props.options?.pageOptions.search ?? '')
71
+
72
+ const page = ref(props.options?.pageOptions.currentPage)
73
+
74
+ watch(
75
+ q,
76
+ _debounce((value) => {
77
+ emits('search', value)
78
+ }, 500)
79
+ )
80
+
81
+ watch(page, () => {
82
+ emits('pageChange', page.value)
83
+ })
84
+ </script>
@@ -1 +1 @@
1
- export type UIComponentList = 'modal' | 'slideover';
1
+ export type UIComponentList = 'modal' | 'slideover' | 'dropdown';
@@ -1,14 +1,14 @@
1
- :root {
2
- --color-primary-50: 248 248 255;
3
- --color-primary-100: 232 239 253;
4
- --color-primary-200: 190 227 248;
5
- --color-primary-300: 144 205 244;
6
- --color-primary-400: 99 179 237;
7
- --color-primary-500: 54 117 251;
8
- --color-primary-600: 0 104 254;
9
- --color-primary-700: 43 108 176;
10
- --color-primary-800: 44 82 130;
11
- --color-primary-900: 32 36 62;
12
- --color-primary-950: 32 36 62;
13
- --color-primary-DEFAULT: 54 117 251;
14
- }
1
+ :root {
2
+ --color-primary-50: 248 248 255;
3
+ --color-primary-100: 232 239 253;
4
+ --color-primary-200: 190 227 248;
5
+ --color-primary-300: 144 205 244;
6
+ --color-primary-400: 99 179 237;
7
+ --color-primary-500: 54 117 251;
8
+ --color-primary-600: 0 104 254;
9
+ --color-primary-700: 43 108 176;
10
+ --color-primary-800: 44 82 130;
11
+ --color-primary-900: 32 36 62;
12
+ --color-primary-950: 32 36 62;
13
+ --color-primary-DEFAULT: 54 117 251;
14
+ }
package/package.json CHANGED
@@ -1,79 +1,79 @@
1
- {
2
- "name": "@finema/core",
3
- "version": "1.3.3",
4
- "repository": "https://gitlab.finema.co/finema/ui-kit",
5
- "license": "MIT",
6
- "author": "Finema Development Team",
7
- "type": "module",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/types.d.ts",
11
- "import": "./dist/module.mjs",
12
- "require": "./dist/module.cjs"
13
- }
14
- },
15
- "main": "./dist/module.cjs",
16
- "types": "./dist/types.d.ts",
17
- "files": [
18
- "dist"
19
- ],
20
- "engines": {
21
- "node": ">=18.0.0"
22
- },
23
- "scripts": {
24
- "prepack": "nuxt-module-build build",
25
- "dev": "nuxi dev playground",
26
- "dev:build": "nuxi build playground",
27
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
28
- "lint": "eslint .",
29
- "lint:fix": "eslint . --fix",
30
- "test": "vitest run",
31
- "test:watch": "vitest watch",
32
- "release": "release-it",
33
- "prepare": "husky install"
34
- },
35
- "dependencies": {
36
- "@headlessui/vue": "^1.7.16",
37
- "@iconify-json/mdi": "^1.1.54",
38
- "@iconify-json/simple-icons": "^1.1.76",
39
- "@nuxt/kit": "^3.7.4",
40
- "@nuxt/ui": "^2.9.0",
41
- "@pinia/nuxt": "^0.4.11",
42
- "@vee-validate/nuxt": "^4.11.8",
43
- "@vee-validate/zod": "^4.11.8",
44
- "axios": "^1.5.1",
45
- "dayjs": "^1.11.10",
46
- "lodash-es": "^4.17.21",
47
- "nuxt-security": "^0.14.4",
48
- "pinia": "^2.1.6",
49
- "url-join": "^5.0.0",
50
- "zod": "^3.22.4"
51
- },
52
- "devDependencies": {
53
- "@finema/eslint-config": "^1.2.0",
54
- "@nuxt/devtools": "latest",
55
- "@nuxt/eslint-config": "^0.2.0",
56
- "@nuxt/module-builder": "^0.5.2",
57
- "@nuxt/schema": "^3.7.4",
58
- "@nuxt/test-utils": "^3.7.4",
59
- "@release-it/conventional-changelog": "^7.0.2",
60
- "@types/lodash-es": "^4.17.12",
61
- "@types/node": "^18.18.1",
62
- "changelogen": "^0.5.5",
63
- "eslint": "^8.50.0",
64
- "husky": "^8.0.3",
65
- "lint-staged": "^14.0.1",
66
- "nuxt": "^3.7.4",
67
- "prettier": "^3.0.3",
68
- "release-it": "^16.2.1",
69
- "stylelint": "^15.10.3",
70
- "stylelint-config-prettier-scss": "^1.0.0",
71
- "stylelint-config-standard-scss": "^11.0.0",
72
- "vitest": "^0.33.0"
73
- },
74
- "lint-staged": {
75
- "*.{ts,vue,tsx,js}": "eslint --fix",
76
- "*.{css,scss}": "stylelint --fix",
77
- "*.{html,json}": "prettier --write"
78
- }
79
- }
1
+ {
2
+ "name": "@finema/core",
3
+ "version": "1.3.5",
4
+ "repository": "https://gitlab.finema.co/finema/ui-kit",
5
+ "license": "MIT",
6
+ "author": "Finema Development Team",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types.d.ts",
11
+ "import": "./dist/module.mjs",
12
+ "require": "./dist/module.cjs"
13
+ }
14
+ },
15
+ "main": "./dist/module.cjs",
16
+ "types": "./dist/types.d.ts",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "engines": {
21
+ "node": ">=18.0.0"
22
+ },
23
+ "scripts": {
24
+ "prepack": "nuxt-module-build build",
25
+ "dev": "nuxi dev playground",
26
+ "dev:build": "nuxi build playground",
27
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
28
+ "lint": "eslint .",
29
+ "lint:fix": "eslint . --fix",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest watch",
32
+ "release": "release-it",
33
+ "prepare": "husky install"
34
+ },
35
+ "dependencies": {
36
+ "@headlessui/vue": "^1.7.16",
37
+ "@iconify-json/mdi": "^1.1.54",
38
+ "@iconify-json/simple-icons": "^1.1.76",
39
+ "@nuxt/kit": "^3.7.4",
40
+ "@nuxt/ui": "^2.11.1",
41
+ "@pinia/nuxt": "^0.4.11",
42
+ "@vee-validate/nuxt": "^4.11.8",
43
+ "@vee-validate/zod": "^4.11.8",
44
+ "axios": "^1.5.1",
45
+ "dayjs": "^1.11.10",
46
+ "lodash-es": "^4.17.21",
47
+ "nuxt-security": "^0.14.4",
48
+ "pinia": "^2.1.6",
49
+ "url-join": "^5.0.0",
50
+ "zod": "^3.22.4"
51
+ },
52
+ "devDependencies": {
53
+ "@finema/eslint-config": "^1.2.0",
54
+ "@nuxt/devtools": "latest",
55
+ "@nuxt/eslint-config": "^0.2.0",
56
+ "@nuxt/module-builder": "^0.5.2",
57
+ "@nuxt/schema": "^3.7.4",
58
+ "@nuxt/test-utils": "^3.7.4",
59
+ "@release-it/conventional-changelog": "^7.0.2",
60
+ "@types/lodash-es": "^4.17.12",
61
+ "@types/node": "^18.18.1",
62
+ "changelogen": "^0.5.5",
63
+ "eslint": "^8.50.0",
64
+ "husky": "^8.0.3",
65
+ "lint-staged": "^14.0.1",
66
+ "nuxt": "^3.7.4",
67
+ "prettier": "^3.0.3",
68
+ "release-it": "^16.2.1",
69
+ "stylelint": "^15.10.3",
70
+ "stylelint-config-prettier-scss": "^1.0.0",
71
+ "stylelint-config-standard-scss": "^11.0.0",
72
+ "vitest": "^0.33.0"
73
+ },
74
+ "lint-staged": {
75
+ "*.{ts,vue,tsx,js}": "eslint --fix",
76
+ "*.{css,scss}": "stylelint --fix",
77
+ "*.{html,json}": "prettier --write"
78
+ }
79
+ }