@finema/core 2.15.3 → 2.16.0

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/README.md CHANGED
@@ -1,79 +1,79 @@
1
- <!--
2
- Get your module up and running quickly.
3
-
4
- Find and replace all on all files (CMD+SHIFT+F):
5
- - Name: Finema UI Kit (Note: package.json has name: @finema/core, consider aligning these)
6
- - Package name: @finema/core
7
- - Description: A comprehensive UI kit for Finema projects.
8
- -->
9
-
10
- # Finema UI Kit
11
-
12
- [![npm version][npm-version-src]][npm-version-href]
13
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
- [![License][license-src]][license-href]
15
- [![Nuxt][nuxt-src]][nuxt-href]
16
-
17
- A comprehensive UI kit for building consistent and beautiful user interfaces for Finema projects, designed to integrate seamlessly with Nuxt. This package is named `@finema/core` on npm.
18
-
19
- - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
- - [📖 &nbsp;Storybook](https://your-storybook-url.com) <!-- Add a link to your Storybook -->
21
- - [🕹️ &nbsp;Playground](#playground)
22
-
23
- ## Features
24
-
25
- <!-- Highlight some of the features your UI kit provides here -->
26
- - 🎨 &nbsp;Wide range of customizable components, built for Vue and Nuxt
27
- - 📱 &nbsp;Responsive design out-of-the-box
28
- - ♿ &nbsp;Accessibility focused
29
- - 🛠️ &nbsp;Easy to integrate and use with Nuxt auto-import capabilities
30
-
31
- ## 🚀 Installation
32
-
33
- Install the UI kit in your project using npm or yarn:
34
-
35
- ```bash
36
- npm install @finema/core
37
- ```
38
-
39
- or
40
-
41
- ```bash
42
- yarn add @finema/core
43
- ```
44
-
45
- ## 🛠️ Available Scripts
46
-
47
- In the project directory, you can run the following scripts:
48
-
49
- - `npm run dev` or `yarn dev`: Runs the playground app in development mode.
50
- - `npm run dev:build` or `yarn dev:build`: Builds the playground app.
51
- - `npm run dev:prepare` or `yarn dev:prepare`: Prepares the development environment.
52
- - `npm run lint` or `yarn lint`: Lints the codebase.
53
- - `npm run test` or `yarn test`: Runs tests.
54
- - `npm run release` or `yarn release`: Creates a new release (lints, tests, builds, publishes).
55
-
56
- ## 🕹️ Playground
57
-
58
- This project includes a `playground` directory that you can use to test and experiment with the UI components.
59
-
60
- To run the playground:
61
- 1. Navigate to the `playground` directory.
62
- 2. Install dependencies if you haven't already (`npm install` or `yarn install`).
63
- 3. Run `npm run dev` or `yarn dev`.
64
-
65
- ## 🤝 Contributing
66
-
67
- Contributions are welcome! Please refer to the `CONTRIBUTING.md` file for guidelines. (You'll need to create this file).
68
-
69
- <!--
70
- Badge URLs - Keep these at the bottom of the file for better readability
71
- -->
72
- [npm-version-src]: https://img.shields.io/npm/v/@finema/core.svg
73
- [npm-version-href]: https://npmjs.com/package/@finema/core
74
- [npm-downloads-src]: https://img.shields.io/npm/dm/@finema/core.svg
75
- [npm-downloads-href]: https://npmjs.com/package/@finema/core
76
- [license-src]: https://img.shields.io/npm/l/@finema/core.svg
77
- [license-href]: https://npmjs.com/package/@finema/core
78
- [nuxt-src]: https://img.shields.io/badge/Nuxt-00DC82?logo=nuxt.js
79
- [nuxt-href]: https://nuxt.com
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: Finema UI Kit (Note: package.json has name: @finema/core, consider aligning these)
6
+ - Package name: @finema/core
7
+ - Description: A comprehensive UI kit for Finema projects.
8
+ -->
9
+
10
+ # Finema UI Kit
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ A comprehensive UI kit for building consistent and beautiful user interfaces for Finema projects, designed to integrate seamlessly with Nuxt. This package is named `@finema/core` on npm.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ - [📖 &nbsp;Storybook](https://your-storybook-url.com) <!-- Add a link to your Storybook -->
21
+ - [🕹️ &nbsp;Playground](#playground)
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your UI kit provides here -->
26
+ - 🎨 &nbsp;Wide range of customizable components, built for Vue and Nuxt
27
+ - 📱 &nbsp;Responsive design out-of-the-box
28
+ - ♿ &nbsp;Accessibility focused
29
+ - 🛠️ &nbsp;Easy to integrate and use with Nuxt auto-import capabilities
30
+
31
+ ## 🚀 Installation
32
+
33
+ Install the UI kit in your project using npm or yarn:
34
+
35
+ ```bash
36
+ npm install @finema/core
37
+ ```
38
+
39
+ or
40
+
41
+ ```bash
42
+ yarn add @finema/core
43
+ ```
44
+
45
+ ## 🛠️ Available Scripts
46
+
47
+ In the project directory, you can run the following scripts:
48
+
49
+ - `npm run dev` or `yarn dev`: Runs the playground app in development mode.
50
+ - `npm run dev:build` or `yarn dev:build`: Builds the playground app.
51
+ - `npm run dev:prepare` or `yarn dev:prepare`: Prepares the development environment.
52
+ - `npm run lint` or `yarn lint`: Lints the codebase.
53
+ - `npm run test` or `yarn test`: Runs tests.
54
+ - `npm run release` or `yarn release`: Creates a new release (lints, tests, builds, publishes).
55
+
56
+ ## 🕹️ Playground
57
+
58
+ This project includes a `playground` directory that you can use to test and experiment with the UI components.
59
+
60
+ To run the playground:
61
+ 1. Navigate to the `playground` directory.
62
+ 2. Install dependencies if you haven't already (`npm install` or `yarn install`).
63
+ 3. Run `npm run dev` or `yarn dev`.
64
+
65
+ ## 🤝 Contributing
66
+
67
+ Contributions are welcome! Please refer to the `CONTRIBUTING.md` file for guidelines. (You'll need to create this file).
68
+
69
+ <!--
70
+ Badge URLs - Keep these at the bottom of the file for better readability
71
+ -->
72
+ [npm-version-src]: https://img.shields.io/npm/v/@finema/core.svg
73
+ [npm-version-href]: https://npmjs.com/package/@finema/core
74
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@finema/core.svg
75
+ [npm-downloads-href]: https://npmjs.com/package/@finema/core
76
+ [license-src]: https://img.shields.io/npm/l/@finema/core.svg
77
+ [license-href]: https://npmjs.com/package/@finema/core
78
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-00DC82?logo=nuxt.js
79
+ [nuxt-href]: https://nuxt.com
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.15.3",
3
+ "version": "2.16.0",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir, addImports } from '@nuxt/kit';
2
2
  import defu from 'defu';
3
3
  import * as theme from '../dist/runtime/theme/index.js';
4
4
 
5
5
  const name = "@finema/core";
6
- const version = "2.15.3";
6
+ const version = "2.16.0";
7
7
 
8
8
  const nuxtAppOptions = {
9
9
  head: {
@@ -91,7 +91,7 @@ const module = defineNuxtModule({
91
91
  _nuxt.options.colorMode = {
92
92
  preference: "light"
93
93
  };
94
- _nuxt.options.appConfig.ui = {
94
+ _nuxt.options.appConfig.ui = defu({
95
95
  colors: {
96
96
  primary: "main",
97
97
  secondary: "secondary",
@@ -101,9 +101,8 @@ const module = defineNuxtModule({
101
101
  warning: "warning",
102
102
  error: "error",
103
103
  neutral: "slate"
104
- },
105
- ...theme
106
- };
104
+ }
105
+ }, theme);
107
106
  _nuxt.options.build = defu(
108
107
  {
109
108
  transpile: [
@@ -143,18 +142,13 @@ const module = defineNuxtModule({
143
142
  await installModule(
144
143
  "@vee-validate/nuxt",
145
144
  {
146
- autoImports: true,
147
- componentNames: {
148
- Form: "VForm",
149
- Field: "VField",
150
- FieldArray: "VFieldArray",
151
- ErrorMessage: "VErrorMessage"
152
- }
145
+ autoImports: false
153
146
  }
154
147
  );
155
148
  await installModule("nuxt-lodash", {
156
149
  prefix: "_",
157
- upperAfterPrefix: false
150
+ upperAfterPrefix: false,
151
+ exclude: ["get"]
158
152
  });
159
153
  addPlugin(resolve("./runtime/plugin"));
160
154
  void addComponentsDir({
@@ -165,6 +159,51 @@ const module = defineNuxtModule({
165
159
  addImportsDir(resolve(runtimeDir, "composables"));
166
160
  addImportsDir(resolve(runtimeDir, "utils"));
167
161
  addImportsDir(resolve(runtimeDir, "types"));
162
+ addImports([
163
+ // Vee-Validate imports
164
+ {
165
+ name: "useForm",
166
+ from: "vee-validate"
167
+ },
168
+ {
169
+ name: "useField",
170
+ from: "vee-validate"
171
+ },
172
+ {
173
+ name: "useFormErrors",
174
+ from: "vee-validate"
175
+ },
176
+ {
177
+ name: "useFormValues",
178
+ from: "vee-validate"
179
+ },
180
+ {
181
+ name: "useIsFormDirty",
182
+ from: "vee-validate"
183
+ },
184
+ {
185
+ name: "useIsFormValid",
186
+ from: "vee-validate"
187
+ },
188
+ {
189
+ name: "useResetForm",
190
+ from: "vee-validate"
191
+ },
192
+ {
193
+ name: "useSubmitForm",
194
+ from: "vee-validate"
195
+ },
196
+ {
197
+ name: "toTypedSchema",
198
+ from: "@vee-validate/valibot"
199
+ },
200
+ // Valibot namespace import
201
+ {
202
+ name: "*",
203
+ as: "v",
204
+ from: "valibot"
205
+ }
206
+ ]);
168
207
  }
169
208
  });
170
209
 
@@ -1,99 +1,99 @@
1
1
  <template>
2
- <div
3
- v-show="isShowDevTools"
4
- ref="devToolsRef"
5
- class="fixed z-50 overflow-hidden rounded-lg border border-neutral-300 bg-white opacity-80 shadow-2xl"
6
- :style="devToolsDynamicStyles"
7
- >
8
- <!-- Draggable Title Bar -->
9
- <div class="flex items-center justify-between px-2 py-1 select-none">
10
- <p
11
- class="flex-grow cursor-move text-sm font-semibold"
12
- @mousedown.prevent="handleDragStart"
13
- >
14
- Debug Tools
15
- </p>
16
- <div class="flex items-center">
17
- <Button
18
- icon="i-heroicons-arrow-path"
19
- size="xs"
20
- color="neutral"
21
- variant="ghost"
22
- class="mr-1"
23
- title="Reset Position & Size"
24
- @click.stop="resetDevToolsState"
25
- />
26
- <Button
27
- icon="i-heroicons-x-mark"
28
- size="xs"
29
- color="neutral"
30
- variant="ghost"
31
- title="Close DevTools"
32
- @click.stop="closeDevTools"
33
- />
34
- </div>
35
- </div>
36
- <hr class="text-neutral-300" />
37
- <!-- Content Area Target for Logs -->
38
- <div
39
- id="dev-logs"
40
- class="flex flex-1 flex-col space-y-1 overflow-auto p-2"
41
- :style="{ height: `calc(${devToolsHeight} - 40px)` }"
42
- />
43
-
44
- <!-- Resize Handles -->
45
- <div
46
- v-if="!isDragging"
47
- class="resize-handles"
48
- >
49
- <div
50
- class="resize-handle top-left"
51
- @mousedown.prevent="handleResizeStart('top-left', $event)"
52
- />
53
- <div
54
- class="resize-handle top-center"
55
- @mousedown.prevent="handleResizeStart('top', $event)"
56
- />
57
- <div
58
- class="resize-handle top-right"
59
- @mousedown.prevent="handleResizeStart('top-right', $event)"
60
- />
61
- <div
62
- class="resize-handle middle-left"
63
- @mousedown.prevent="handleResizeStart('left', $event)"
64
- />
65
- <div
66
- class="resize-handle middle-right"
67
- @mousedown.prevent="handleResizeStart('right', $event)"
68
- />
69
- <div
70
- class="resize-handle bottom-left"
71
- @mousedown.prevent="handleResizeStart('bottom-left', $event)"
72
- />
73
- <div
74
- class="resize-handle bottom-center"
75
- @mousedown.prevent="handleResizeStart('bottom', $event)"
76
- />
77
- <div
78
- class="resize-handle bottom-right"
79
- @mousedown.prevent="handleResizeStart('bottom-right', $event)"
80
- />
81
- </div>
82
- </div>
83
-
84
- <!-- Toggle button for this DevToolsWindow -->
85
- <div
86
- class="fixed right-1 bottom-1 z-[99999]"
87
- >
88
- <Button
89
- :icon="isShowDevTools ? 'heroicons:x-mark' : 'heroicons:information-circle'"
90
- color="info"
91
- square
92
- size="sm"
93
- :ui="{ base: 'rounded-full' }"
94
- @click="toggleDevTools"
95
- />
96
- </div>
2
+ <div
3
+ v-show="isShowDevTools"
4
+ ref="devToolsRef"
5
+ class="fixed z-50 overflow-hidden rounded-lg border border-neutral-300 bg-white opacity-80 shadow-2xl"
6
+ :style="devToolsDynamicStyles"
7
+ >
8
+ <!-- Draggable Title Bar -->
9
+ <div class="flex items-center justify-between px-2 py-1 select-none">
10
+ <p
11
+ class="flex-grow cursor-move text-sm font-semibold"
12
+ @mousedown.prevent="handleDragStart"
13
+ >
14
+ Debug Tools
15
+ </p>
16
+ <div class="flex items-center">
17
+ <Button
18
+ icon="i-heroicons-arrow-path"
19
+ size="xs"
20
+ color="neutral"
21
+ variant="ghost"
22
+ class="mr-1"
23
+ title="Reset Position & Size"
24
+ @click.stop="resetDevToolsState"
25
+ />
26
+ <Button
27
+ icon="i-heroicons-x-mark"
28
+ size="xs"
29
+ color="neutral"
30
+ variant="ghost"
31
+ title="Close DevTools"
32
+ @click.stop="closeDevTools"
33
+ />
34
+ </div>
35
+ </div>
36
+ <hr class="text-neutral-300" />
37
+ <!-- Content Area Target for Logs -->
38
+ <div
39
+ id="dev-logs"
40
+ class="flex flex-1 flex-col space-y-1 overflow-auto p-2"
41
+ :style="{ height: `calc(${devToolsHeight} - 40px)` }"
42
+ />
43
+
44
+ <!-- Resize Handles -->
45
+ <div
46
+ v-if="!isDragging"
47
+ class="resize-handles"
48
+ >
49
+ <div
50
+ class="resize-handle top-left"
51
+ @mousedown.prevent="handleResizeStart('top-left', $event)"
52
+ />
53
+ <div
54
+ class="resize-handle top-center"
55
+ @mousedown.prevent="handleResizeStart('top', $event)"
56
+ />
57
+ <div
58
+ class="resize-handle top-right"
59
+ @mousedown.prevent="handleResizeStart('top-right', $event)"
60
+ />
61
+ <div
62
+ class="resize-handle middle-left"
63
+ @mousedown.prevent="handleResizeStart('left', $event)"
64
+ />
65
+ <div
66
+ class="resize-handle middle-right"
67
+ @mousedown.prevent="handleResizeStart('right', $event)"
68
+ />
69
+ <div
70
+ class="resize-handle bottom-left"
71
+ @mousedown.prevent="handleResizeStart('bottom-left', $event)"
72
+ />
73
+ <div
74
+ class="resize-handle bottom-center"
75
+ @mousedown.prevent="handleResizeStart('bottom', $event)"
76
+ />
77
+ <div
78
+ class="resize-handle bottom-right"
79
+ @mousedown.prevent="handleResizeStart('bottom-right', $event)"
80
+ />
81
+ </div>
82
+ </div>
83
+
84
+ <!-- Toggle button for this DevToolsWindow -->
85
+ <div
86
+ class="fixed right-1 bottom-1 z-[99999]"
87
+ >
88
+ <Button
89
+ :icon="isShowDevTools ? 'heroicons:x-mark' : 'heroicons:information-circle'"
90
+ color="info"
91
+ square
92
+ size="sm"
93
+ :ui="{ base: 'rounded-full' }"
94
+ @click="toggleDevTools"
95
+ />
96
+ </div>
97
97
  </template>
98
98
 
99
99
  <script setup>
@@ -1,72 +1,72 @@
1
1
  <template>
2
- <div>
3
- <div
4
- v-if="options.isEnabledSearch"
5
- class="mb-4 flex justify-end"
6
- >
7
- <Input
8
- v-model="q"
9
- icon="i-heroicons-magnifying-glass"
10
- :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32...'"
11
- />
12
- </div>
13
-
14
- <slot
15
- v-if="options.status.isSuccess && options.rawData.length === 0"
16
- name="empty-state"
17
- >
18
- <Empty />
19
- </slot>
20
-
21
- <div
22
- v-if="options.pageOptions && options.isEnableInfiniteScroll"
23
- class="mb-4 flex items-center justify-end"
24
- >
25
- <p class="text-xs text-gray-500">
26
- {{ totalInnerRawData }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
27
- </p>
28
- </div>
29
-
30
- <div :class="containerClass">
31
- <slot
32
- v-for="(row, index) in displayData"
33
- :key="index"
34
- :row="row"
35
- />
36
- <div ref="bottomEdgeElement" />
37
- </div>
38
-
39
- <slot
40
- v-if="options.status.isLoading"
41
- name="loading-state"
42
- >
43
- <Loader
44
- :loading="true"
45
- />
46
- </slot>
47
-
48
- <div
49
- v-if="options.pageOptions && !options.isEnableInfiniteScroll && !options.isHidePagination"
50
- class="mt-4 flex justify-between px-3"
51
- >
52
- <p class="text-xs text-gray-500">
53
- {{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
54
- </p>
55
- <Pagination
56
- v-if="options.pageOptions.totalPage > 1 && !isShowSimplePagination"
57
- :default-page="options.pageOptions?.currentPage || 1"
58
- :items-per-page="options.pageOptions.limit"
59
- :total="options.pageOptions.totalCount"
60
- @update:page="onPageChange"
61
- />
62
- <SimplePagination
63
- v-if="options.pageOptions.totalPage > 1 && isShowSimplePagination"
64
- v-model="page"
65
- :page-count="options.pageOptions.limit"
66
- :total="options.pageOptions.totalCount"
67
- />
68
- </div>
69
- </div>
2
+ <div>
3
+ <div
4
+ v-if="options.isEnabledSearch"
5
+ class="mb-4 flex justify-end"
6
+ >
7
+ <Input
8
+ v-model="q"
9
+ icon="i-heroicons-magnifying-glass"
10
+ :placeholder="options.searchPlaceholder || '\u0E04\u0E49\u0E19\u0E2B\u0E32...'"
11
+ />
12
+ </div>
13
+
14
+ <slot
15
+ v-if="options.status.isSuccess && options.rawData.length === 0"
16
+ name="empty-state"
17
+ >
18
+ <Empty />
19
+ </slot>
20
+
21
+ <div
22
+ v-if="options.pageOptions && options.isEnableInfiniteScroll"
23
+ class="mb-4 flex items-center justify-end"
24
+ >
25
+ <p class="text-xs text-gray-500">
26
+ {{ totalInnerRawData }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
27
+ </p>
28
+ </div>
29
+
30
+ <div :class="containerClass">
31
+ <slot
32
+ v-for="(row, index) in displayData"
33
+ :key="index"
34
+ :row="row"
35
+ />
36
+ <div ref="bottomEdgeElement" />
37
+ </div>
38
+
39
+ <slot
40
+ v-if="options.status.isLoading"
41
+ name="loading-state"
42
+ >
43
+ <Loader
44
+ :loading="true"
45
+ />
46
+ </slot>
47
+
48
+ <div
49
+ v-if="options.pageOptions && !options.isEnableInfiniteScroll && !options.isHidePagination"
50
+ class="mt-4 flex justify-between px-3"
51
+ >
52
+ <p class="text-xs text-gray-500">
53
+ {{ pageBetween }} รายการ จากทั้งหมด {{ totalCountWithComma }} รายการ
54
+ </p>
55
+ <Pagination
56
+ v-if="options.pageOptions.totalPage > 1 && !isShowSimplePagination"
57
+ :default-page="options.pageOptions?.currentPage || 1"
58
+ :items-per-page="options.pageOptions.limit"
59
+ :total="options.pageOptions.totalCount"
60
+ @update:page="onPageChange"
61
+ />
62
+ <SimplePagination
63
+ v-if="options.pageOptions.totalPage > 1 && isShowSimplePagination"
64
+ v-model="page"
65
+ :page-count="options.pageOptions.limit"
66
+ :total="options.pageOptions.totalCount"
67
+ />
68
+ </div>
69
+ </div>
70
70
  </template>
71
71
 
72
72
  <script setup>
@@ -1,17 +1,17 @@
1
1
  <template>
2
- <FormField
3
- :label="label"
4
- :name="name"
5
- :description="description"
6
- :hint="hint"
7
- :data-testid="name"
8
- :help="help"
9
- :error="errorMessage"
10
- :required="!!required"
11
- :ui="containerUi"
12
- >
13
- <slot />
14
- </FormField>
2
+ <FormField
3
+ :label="label"
4
+ :name="name"
5
+ :description="description"
6
+ :hint="hint"
7
+ :data-testid="name"
8
+ :help="help"
9
+ :error="errorMessage"
10
+ :required="!!required"
11
+ :ui="containerUi"
12
+ >
13
+ <slot />
14
+ </FormField>
15
15
  </template>
16
16
 
17
17
  <script setup>