@finema/core 1.3.10 → 1.3.12

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import { merge } from 'lodash-es';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.3.10";
5
+ const version = "1.3.12";
6
6
 
7
7
  const colors = {
8
8
  black: "#20243E",
@@ -68,7 +68,10 @@ const colors = {
68
68
  };
69
69
 
70
70
  const ui = {
71
- safelistColors: ["secondary"]
71
+ safelistColors: ["secondary"],
72
+ icons: {
73
+ dynamic: true
74
+ }
72
75
  };
73
76
 
74
77
  const _merge = merge;
@@ -28,6 +28,12 @@
28
28
  v-bind="option.props"
29
29
  v-on="option.on ?? {}"
30
30
  />
31
+ <FormInputTextarea
32
+ v-if="option.type === INPUT_TYPES.TEXTAREA"
33
+ :form="form"
34
+ v-bind="option.props"
35
+ v-on="option.on ?? {}"
36
+ />
31
37
  <FormInputToggle
32
38
  v-if="option.type === INPUT_TYPES.TOGGLE"
33
39
  :form="form"
@@ -40,6 +46,12 @@
40
46
  v-bind="option.props"
41
47
  v-on="option.on ?? {}"
42
48
  />
49
+ <FormInputRadio
50
+ v-if="option.type === INPUT_TYPES.RADIO"
51
+ :form="form"
52
+ v-bind="option.props"
53
+ v-on="option.on ?? {}"
54
+ />
43
55
  <FormInputCheckbox
44
56
  v-if="option.type === INPUT_TYPES.CHECKBOX"
45
57
  :form="form"
@@ -5,6 +5,7 @@
5
5
  :disabled="disabled"
6
6
  :name="name"
7
7
  :label="props.label"
8
+ :required="isRequired"
8
9
  :color="color"
9
10
  :ui="ui"
10
11
  />
@@ -17,5 +18,5 @@ import { type ICheckboxFieldProps } from '#core/components/Form/InputCheckbox/ty
17
18
 
18
19
  const props = withDefaults(defineProps<ICheckboxFieldProps>(), {})
19
20
 
20
- const { value, wrapperProps, disabled, handleChange } = useFieldHOC<boolean>(props)
21
+ const { value, wrapperProps, disabled, handleChange, isRequired } = useFieldHOC<boolean>(props)
21
22
  </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <URadioGroup
4
+ v-model="value"
5
+ :options="options"
6
+ :disabled="disabled"
7
+ :required="isRequired"
8
+ value-attribute="value"
9
+ option-attribute="label"
10
+ :icon="icon"
11
+ :color="color"
12
+ :size="size"
13
+ :ui="ui"
14
+ :ui-menu="uiMenu"
15
+ />
16
+ </FieldWrapper>
17
+ </template>
18
+
19
+ <script lang="ts" setup>
20
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
21
+ import { useFieldHOC } from '#core/composables/useForm'
22
+ import { type ISelectFieldProps } from '#core/components/Form/InputSelect/types'
23
+
24
+ const props = withDefaults(defineProps<ISelectFieldProps>(), {})
25
+
26
+ const { value, wrapperProps, disabled, handleChange, isRequired } = useFieldHOC<any>(props)
27
+ </script>
@@ -0,0 +1,12 @@
1
+ import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
2
+ import { type IOption } from '#core/types/common';
3
+ export interface IRadioFieldProps extends IFieldProps {
4
+ color?: string;
5
+ icon?: string;
6
+ size?: string;
7
+ ui?: object | any;
8
+ options: IOption[];
9
+ }
10
+ export type IRadioField = IFormFieldBase<INPUT_TYPES.RADIO, IRadioFieldProps, {
11
+ change?: (value: string) => void;
12
+ }>;
@@ -1,11 +1,37 @@
1
1
  <template>
2
- <div>
3
- <USelect v-bind="$attrs" />
4
- </div>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <USelectMenu
4
+ v-model="value"
5
+ searchable
6
+ :options="options"
7
+ :placeholder="placeholder || label"
8
+ :disabled="disabled"
9
+ :loading="isLoading"
10
+ :searchable-placeholder="searchablePlaceholder"
11
+ value-attribute="value"
12
+ option-attribute="label"
13
+ :required="isRequired"
14
+ :icon="icon"
15
+ :color="color"
16
+ :size="size"
17
+ :ui="ui"
18
+ :ui-menu="uiMenu"
19
+ >
20
+ <template #label>
21
+ <span v-if="value" class="truncate">
22
+ {{ options.find((item) => item.value === value)?.label || value }}
23
+ </span>
24
+ </template>
25
+ </USelectMenu>
26
+ </FieldWrapper>
5
27
  </template>
6
28
 
7
29
  <script lang="ts" setup>
8
- defineOptions({
9
- inheritAttrs: true,
10
- })
30
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
31
+ import { useFieldHOC } from '#core/composables/useForm'
32
+ import { type ISelectFieldProps } from '#core/components/Form/InputSelect/types'
33
+
34
+ const props = withDefaults(defineProps<ISelectFieldProps>(), {})
35
+
36
+ const { value, wrapperProps, disabled, handleChange, isRequired } = useFieldHOC<any>(props)
11
37
  </script>
@@ -0,0 +1,15 @@
1
+ import type { IFieldProps, IFormFieldBase, INPUT_TYPES } from '#core/components/Form/types';
2
+ import { type IOption } from '#core/types/common';
3
+ export interface ISelectFieldProps extends IFieldProps {
4
+ color?: string;
5
+ icon?: string;
6
+ size?: string;
7
+ searchablePlaceholder?: string;
8
+ loading?: boolean;
9
+ ui?: object | any;
10
+ uiMenu?: object | any;
11
+ options: IOption[];
12
+ }
13
+ export type ISelectField = IFormFieldBase<INPUT_TYPES.SELECT, ISelectFieldProps, {
14
+ change?: (value: string) => void;
15
+ }>;
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <FieldWrapper v-bind="wrapperProps">
3
+ <UTextarea
4
+ v-model="value"
5
+ :disabled="disabled"
6
+ :name="name"
7
+ :resize="resize"
8
+ :placeholder="placeholder ?? props.label"
9
+ :autofocus="!!autoFocus"
10
+ :autoresize="autoresize"
11
+ :rows="rows"
12
+ :color="color"
13
+ :ui="ui"
14
+ />
15
+ </FieldWrapper>
16
+ </template>
17
+ <script lang="ts" setup>
18
+ import { useFieldHOC } from '#core/composables/useForm'
19
+ import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
20
+ import { type ITextareaFieldProps } from '#core/components/Form/InputTextarea/types'
21
+
22
+ const props = withDefaults(defineProps<ITextareaFieldProps>(), {})
23
+ const emits = defineEmits<{
24
+ (event: 'change', value: string): void
25
+ (event: 'blur', value: string): void
26
+ }>()
27
+
28
+ const { value, wrapperProps, disabled, handleChange } = useFieldHOC<string>(props)
29
+ </script>
@@ -0,0 +1,12 @@
1
+ import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
2
+ export interface ITextareaFieldProps extends IFieldProps {
3
+ autoresize?: boolean;
4
+ resize?: boolean;
5
+ rows?: number;
6
+ color?: string;
7
+ ui?: object | any;
8
+ }
9
+ export type ITextareaField = IFormFieldBase<INPUT_TYPES.TEXTAREA, ITextareaFieldProps, {
10
+ change?: (value: string) => void;
11
+ blur?: (value: string) => void;
12
+ }>;
@@ -2,13 +2,20 @@ import { type Component } from '@nuxt/schema';
2
2
  import { type FormContext, type RuleExpression } from 'vee-validate';
3
3
  import { type ITextField } from '#core/components/Form/InputText/types';
4
4
  import { type IStaticField } from '#core/components/Form/InputStatic/types';
5
+ import { type ICheckboxField } from '#core/components/Form/InputCheckbox/types';
6
+ import { type IRadioField } from '#core/components/Form/InputRadio/types';
7
+ import { type ISelectField } from '#core/components/Form/InputSelect/types';
8
+ import { type IToggleField } from '#core/components/Form/InputToggle/types';
9
+ import { type ITextareaField } from '#core/components/Form/InputTextarea/types';
5
10
  export declare const enum INPUT_TYPES {
6
11
  TEXT = "TEXT",
12
+ TEXTAREA = "TEXTAREA",
7
13
  PASSWORD = "PASSWORD",
8
14
  EMAIL = "EMAIL",
9
15
  STATIC = "STATIC",
10
16
  TOGGLE = "TOGGLE",
11
17
  SELECT = "SELECT",
18
+ RADIO = "RADIO",
12
19
  CHECKBOX = "CHECKBOX"
13
20
  }
14
21
  export interface IOption {
@@ -46,4 +53,4 @@ export interface IFormFieldBase<I extends INPUT_TYPES, P extends object = never,
46
53
  props: IFieldProps & P;
47
54
  on?: O;
48
55
  }
49
- export type IFormField = ITextField | IStaticField;
56
+ export type IFormField = ITextField | IStaticField | ICheckboxField | IRadioField | ISelectField | IToggleField | ITextareaField;
@@ -1,10 +1,12 @@
1
1
  export var INPUT_TYPES = /* @__PURE__ */ ((INPUT_TYPES2) => {
2
2
  INPUT_TYPES2["TEXT"] = "TEXT";
3
+ INPUT_TYPES2["TEXTAREA"] = "TEXTAREA";
3
4
  INPUT_TYPES2["PASSWORD"] = "PASSWORD";
4
5
  INPUT_TYPES2["EMAIL"] = "EMAIL";
5
6
  INPUT_TYPES2["STATIC"] = "STATIC";
6
7
  INPUT_TYPES2["TOGGLE"] = "TOGGLE";
7
8
  INPUT_TYPES2["SELECT"] = "SELECT";
9
+ INPUT_TYPES2["RADIO"] = "RADIO";
8
10
  INPUT_TYPES2["CHECKBOX"] = "CHECKBOX";
9
11
  return INPUT_TYPES2;
10
12
  })(INPUT_TYPES || {});
@@ -2,7 +2,7 @@ export interface IError {
2
2
  code: string;
3
3
  message: any;
4
4
  }
5
- export interface IOption {
5
+ export interface IOption extends Record<string, any> {
6
6
  value: any;
7
7
  label: string;
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Development Team",
@@ -1,11 +0,0 @@
1
- <template>
2
- <div>
3
- <USelectMenu v-bind="$attrs" />
4
- </div>
5
- </template>
6
-
7
- <script lang="ts" setup>
8
- defineOptions({
9
- inheritAttrs: true,
10
- })
11
- </script>