@raxium/vue 0.2.0 → 0.2.2

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.
@@ -47,7 +47,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  "focus",
48
48
  "blur",
49
49
  "input",
50
- "change"
50
+ "change",
51
+ "clear",
52
+ "beforeInput",
53
+ "compositionStart",
54
+ "compositionEnd"
51
55
  ],
52
56
  setup (__props, { emit: __emit }) {
53
57
  const props = createPropsRestProxy(__props, [
@@ -76,6 +80,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
80
  });
77
81
  const inputRef = useTemplateRef("input");
78
82
  const rejectBlur = ref(false);
83
+ function onFocus(event) {
84
+ isFocus.value = true;
85
+ emits("focus", event);
86
+ }
79
87
  function onBlur(event) {
80
88
  setTimeout(()=>{
81
89
  emits("blur", event);
@@ -86,6 +94,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
86
94
  isFocus.value = false;
87
95
  });
88
96
  }
97
+ function onClear() {
98
+ rejectBlur.value = true;
99
+ inputRef.value?.focus();
100
+ modelValue.value = "";
101
+ emits("clear", new CustomEvent("clear"), modelValue.value);
102
+ }
89
103
  const theme = useTheme(()=>__props.theme);
90
104
  const crafts = computed(()=>theme.value.crafts.tvInput());
91
105
  return (_ctx, _cache)=>(openBlock(), createBlock(unref(ark).div, {
@@ -99,7 +113,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
113
  default: withCtx(()=>[
100
114
  renderSlot(_ctx.$slots, "prefix"),
101
115
  withDirectives(createElementVNode("input", {
102
- id: __props.id ?? unref(inputId),
116
+ id: __props.id ?? `input:${unref(inputId)}`,
103
117
  ref: "input",
104
118
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>isRef(modelValue) ? modelValue.value = $event : null),
105
119
  class: normalizeClass(crafts.value.input({
@@ -111,13 +125,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
111
125
  disabled: __props.disabled ? true : void 0,
112
126
  readonly: __props.readonly ? true : void 0,
113
127
  maxlength: __props.maxlength,
114
- onFocus: _cache[1] || (_cache[1] = (event)=>{
115
- isFocus.value = true;
116
- emits("focus", event);
117
- }),
128
+ onFocus,
118
129
  onBlur,
119
- onInput: _cache[2] || (_cache[2] = (e)=>emits("input", e, unref(modelValue))),
120
- onChange: _cache[3] || (_cache[3] = (e)=>emits("change", e, unref(modelValue)))
130
+ onInput: _cache[1] || (_cache[1] = ($event)=>emits("input", $event, unref(modelValue))),
131
+ onChange: _cache[2] || (_cache[2] = ($event)=>emits("change", $event, unref(modelValue))),
132
+ onBeforeinput: _cache[3] || (_cache[3] = ($event)=>emits("beforeInput", $event, unref(modelValue))),
133
+ onCompositionstart: _cache[4] || (_cache[4] = ($event)=>emits("compositionStart", $event)),
134
+ onCompositionend: _cache[5] || (_cache[5] = ($event)=>emits("compositionEnd", $event))
121
135
  }, null, 42, _hoisted_1), [
122
136
  [
123
137
  vModelText,
@@ -130,13 +144,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
130
144
  class: unref(clsx)(__props.ui?.clearable),
131
145
  ...unref(theme)
132
146
  })),
133
- onMousedown: _cache[4] || (_cache[4] = withModifiers(()=>{
134
- rejectBlur.value = true;
135
- inputRef.value?.focus();
136
- modelValue.value = "";
137
- }, [
147
+ onMousedown: withModifiers(onClear, [
138
148
  "stop"
139
- ]))
149
+ ])
140
150
  }, {
141
151
  default: withCtx(()=>[
142
152
  createVNode(unref(CircleX))
@@ -6,17 +6,25 @@ type __VLS_Slots = {} & {
6
6
  suffix?: (props: typeof __VLS_23) => any;
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<InputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- input: (e: Event, value: string | number | undefined) => any;
10
- blur: (e: Event) => any;
11
- change: (e: Event, value: string | number | undefined) => any;
12
- focus: (e: Event) => any;
13
- "update:modelValue": (value: string | number) => any;
9
+ input: (e: InputEvent, value: string | undefined) => any;
10
+ blur: (e: FocusEvent) => any;
11
+ change: (e: Event, value: string | undefined) => any;
12
+ focus: (e: FocusEvent) => any;
13
+ clear: (e: Event, value: string | undefined) => any;
14
+ "update:modelValue": (value: string) => any;
15
+ beforeInput: (e: InputEvent, value: string | undefined) => any;
16
+ compositionStart: (e: CompositionEvent) => any;
17
+ compositionEnd: (e: CompositionEvent) => any;
14
18
  }, string, import("vue").PublicProps, Readonly<InputProps> & Readonly<{
15
- onInput?: ((e: Event, value: string | number | undefined) => any) | undefined;
16
- onBlur?: ((e: Event) => any) | undefined;
17
- onChange?: ((e: Event, value: string | number | undefined) => any) | undefined;
18
- onFocus?: ((e: Event) => any) | undefined;
19
- "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
19
+ onInput?: ((e: InputEvent, value: string | undefined) => any) | undefined;
20
+ onBlur?: ((e: FocusEvent) => any) | undefined;
21
+ onChange?: ((e: Event, value: string | undefined) => any) | undefined;
22
+ onFocus?: ((e: FocusEvent) => any) | undefined;
23
+ onClear?: ((e: Event, value: string | undefined) => any) | undefined;
24
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
25
+ onBeforeInput?: ((e: InputEvent, value: string | undefined) => any) | undefined;
26
+ onCompositionStart?: ((e: CompositionEvent) => any) | undefined;
27
+ onCompositionEnd?: ((e: CompositionEvent) => any) | undefined;
20
28
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
29
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
30
  declare const _default: typeof __VLS_export;
@@ -2,8 +2,8 @@ import type { ThemeCrafts } from '../../providers';
2
2
  import type { HTMLAttributes } from 'vue';
3
3
  export interface InputProps extends ThemeCrafts<'tvInput'> {
4
4
  id?: string;
5
- defaultValue?: string | number;
6
- modelValue?: string | number;
5
+ defaultValue?: string;
6
+ modelValue?: string;
7
7
  class?: HTMLAttributes['class'];
8
8
  placeholder?: string;
9
9
  clearable?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@raxium/vue",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "Vue core components for Raxium, based on Ark UI",
6
6
  "author": {
7
7
  "name": "Hwacc",
@@ -65,10 +65,10 @@
65
65
  "@iconify/vue": "^5.0.0",
66
66
  "@vueuse/core": "^14.1.0",
67
67
  "es-toolkit": "^1.44.0",
68
- "lucide-vue-next": "^0.577.0",
68
+ "lucide-vue-next": "^1.0.0",
69
69
  "vue-component-type-helpers": "^3.2.1",
70
70
  "@raxium/shared": "0.1.1",
71
- "@raxium/themes": "0.1.3"
71
+ "@raxium/themes": "0.1.5"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@ark-ui/vue": "5.35.0",
@@ -89,7 +89,7 @@
89
89
  "vitest": "^4.1.1",
90
90
  "vue-tsc": "^3.2.4",
91
91
  "@raxium/shared": "0.1.1",
92
- "@raxium/themes": "0.1.3"
92
+ "@raxium/themes": "0.1.5"
93
93
  },
94
94
  "publishConfig": {
95
95
  "access": "public"