@raxium/vue 0.2.3 → 0.2.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.
@@ -10,7 +10,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10
10
  __name: "Button",
11
11
  props: {
12
12
  variant: {
13
- default: "default"
13
+ default: "solid"
14
+ },
15
+ color: {
16
+ default: "primary"
14
17
  },
15
18
  class: {
16
19
  type: [
@@ -62,15 +65,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
62
65
  ref: unref(forwardRef),
63
66
  class: normalizeClass(crafts.value.root({
64
67
  variant: __props.variant,
68
+ color: __props.color,
65
69
  loading: __props.loading,
66
70
  class: unref(clsx)(__props.ui?.root?.class, __props.class),
67
71
  ...unref(theme)
68
72
  })),
69
73
  disabled: __props.disabled,
70
74
  "data-variant": __props.variant,
75
+ "data-color": __props.color,
76
+ "data-surface": unref(theme).surface,
71
77
  "data-ripple": __props.ripple ? true : void 0,
72
78
  "data-loading": __props.loading ? true : void 0,
73
- "data-theme-size": unref(theme).size,
79
+ "data-size": unref(theme).size,
74
80
  "as-child": __props.asChild,
75
81
  onClick
76
82
  }, {
@@ -99,9 +105,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
105
  "class",
100
106
  "disabled",
101
107
  "data-variant",
108
+ "data-color",
109
+ "data-surface",
102
110
  "data-ripple",
103
111
  "data-loading",
104
- "data-theme-size",
112
+ "data-size",
105
113
  "as-child"
106
114
  ]));
107
115
  }
@@ -3,6 +3,7 @@ import type { ThemeCrafts } from '../../providers';
3
3
  import type { HTMLAttributes } from 'vue';
4
4
  export interface ButtonProps extends ThemeCrafts<'tvButton'> {
5
5
  variant?: ButtonVariants['variant'] | string;
6
+ color?: ButtonVariants['color'] | string;
6
7
  class?: HTMLAttributes['class'];
7
8
  disabled?: boolean;
8
9
  tooltip?: string;
@@ -1,14 +1,19 @@
1
- import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderSlot, unref, useId, useTemplateRef, vModelDynamic, watch, withCtx, withDirectives, withModifiers } from "vue";
2
- import { ark } from "@ark-ui/vue/factory";
1
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderSlot, unref, useId, useTemplateRef, vModelDynamic, watch, withDirectives, withModifiers } from "vue";
3
2
  import { clsx } from "@raxium/themes/utils";
4
3
  import { useTheme } from "../../composables/useTheme.js";
5
4
  import { CircleX } from "lucide-vue-next";
6
5
  const _hoisted_1 = [
6
+ "data-state"
7
+ ];
8
+ const _hoisted_2 = [
7
9
  "id",
8
10
  "data-state",
9
11
  "placeholder",
10
12
  "disabled",
11
- "readonly"
13
+ "readonly",
14
+ "maxlength",
15
+ "minlength",
16
+ "type"
12
17
  ];
13
18
  const _sfc_main = /* @__PURE__ */ defineComponent({
14
19
  __name: "Input",
@@ -36,6 +41,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
41
  type: Boolean
37
42
  },
38
43
  placeholder: {},
44
+ maxlength: {},
45
+ minlength: {},
46
+ type: {},
39
47
  ui: {},
40
48
  theme: {}
41
49
  },
@@ -95,68 +103,58 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
95
103
  }
96
104
  const theme = useTheme(()=>__props.theme);
97
105
  const crafts = computed(()=>theme.value.crafts.tvInput());
98
- return (_ctx, _cache)=>(openBlock(), createBlock(unref(ark).div, {
99
- "as-child": false,
106
+ return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
100
107
  class: normalizeClass(crafts.value.root({
101
108
  class: unref(clsx)(__props.ui?.root, __props.class),
102
109
  ...unref(theme)
103
110
  })),
104
111
  "data-state": inputState.value
105
- }, {
106
- default: withCtx(()=>[
107
- renderSlot(_ctx.$slots, "prefix"),
108
- withDirectives(createElementVNode("input", mergeProps({
109
- id: __props.id ?? `input:${unref(inputId)}`,
110
- ref: "input"
111
- }, _ctx.$attrs, {
112
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>innerValue.value = $event),
113
- class: crafts.value.input({
114
- class: unref(clsx)(__props.ui?.input),
115
- ...unref(theme)
116
- }),
117
- "data-state": inputState.value,
118
- placeholder: __props.placeholder,
119
- disabled: __props.disabled ? true : void 0,
120
- readonly: __props.readonly ? true : void 0,
121
- onFocusin,
122
- onFocusout,
123
- onInput: _cache[1] || (_cache[1] = ($event)=>emits("input", $event, innerValue.value)),
124
- onChange: _cache[2] || (_cache[2] = ($event)=>emits("change", $event, innerValue.value)),
125
- onBeforeinput: _cache[3] || (_cache[3] = ($event)=>emits("beforeInput", $event, innerValue.value)),
126
- onCompositionstart: _cache[4] || (_cache[4] = ($event)=>emits("compositionStart", $event)),
127
- onCompositionend: _cache[5] || (_cache[5] = ($event)=>emits("compositionEnd", $event)),
128
- onKeydown: _cache[6] || (_cache[6] = ($event)=>emits("keydown", $event)),
129
- onKeyup: _cache[7] || (_cache[7] = ($event)=>emits("keyup", $event))
130
- }), null, 16, _hoisted_1), [
131
- [
132
- vModelDynamic,
133
- innerValue.value
134
- ]
135
- ]),
136
- "focused" === inputState.value && __props.clearable && __props.modelValue ? (openBlock(), createBlock(unref(ark).div, {
137
- key: 0,
138
- class: normalizeClass(crafts.value.clearable({
139
- class: unref(clsx)(__props.ui?.clearable),
140
- ...unref(theme)
141
- })),
142
- onMousedown: withModifiers(onClear, [
143
- "stop"
144
- ])
145
- }, {
146
- default: withCtx(()=>[
147
- createVNode(unref(CircleX))
148
- ]),
149
- _: 1
150
- }, 8, [
151
- "class"
152
- ])) : createCommentVNode("", true),
153
- renderSlot(_ctx.$slots, "suffix")
154
- ]),
155
- _: 3
156
- }, 8, [
157
- "class",
158
- "data-state"
159
- ]));
112
+ }, [
113
+ renderSlot(_ctx.$slots, "prefix"),
114
+ withDirectives(createElementVNode("input", {
115
+ id: __props.id ?? `input:${unref(inputId)}`,
116
+ ref: "input",
117
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>innerValue.value = $event),
118
+ class: normalizeClass(crafts.value.input({
119
+ class: unref(clsx)(__props.ui?.input),
120
+ ...unref(theme)
121
+ })),
122
+ "data-state": inputState.value,
123
+ placeholder: __props.placeholder,
124
+ disabled: __props.disabled ? true : void 0,
125
+ readonly: __props.readonly ? true : void 0,
126
+ maxlength: __props.maxlength,
127
+ minlength: __props.minlength,
128
+ type: __props.type,
129
+ onFocusin,
130
+ onFocusout,
131
+ onInput: _cache[1] || (_cache[1] = ($event)=>emits("input", $event, innerValue.value)),
132
+ onChange: _cache[2] || (_cache[2] = ($event)=>emits("change", $event, innerValue.value)),
133
+ onBeforeinput: _cache[3] || (_cache[3] = ($event)=>emits("beforeInput", $event, innerValue.value)),
134
+ onCompositionstart: _cache[4] || (_cache[4] = ($event)=>emits("compositionStart", $event)),
135
+ onCompositionend: _cache[5] || (_cache[5] = ($event)=>emits("compositionEnd", $event)),
136
+ onKeydown: _cache[6] || (_cache[6] = ($event)=>emits("keydown", $event)),
137
+ onKeyup: _cache[7] || (_cache[7] = ($event)=>emits("keyup", $event))
138
+ }, null, 42, _hoisted_2), [
139
+ [
140
+ vModelDynamic,
141
+ innerValue.value
142
+ ]
143
+ ]),
144
+ "focused" === inputState.value && __props.clearable && __props.modelValue ? (openBlock(), createElementBlock("div", {
145
+ key: 0,
146
+ class: normalizeClass(crafts.value.clearable({
147
+ class: unref(clsx)(__props.ui?.clearable),
148
+ ...unref(theme)
149
+ })),
150
+ onMousedown: withModifiers(onClear, [
151
+ "stop"
152
+ ])
153
+ }, [
154
+ createVNode(unref(CircleX))
155
+ ], 34)) : createCommentVNode("", true),
156
+ renderSlot(_ctx.$slots, "suffix")
157
+ ], 10, _hoisted_1));
160
158
  }
161
159
  });
162
160
  const Input = _sfc_main;
@@ -1,9 +1,9 @@
1
1
  import type { InputProps } from '.';
2
- declare var __VLS_8: {}, __VLS_23: {};
2
+ declare var __VLS_1: {}, __VLS_8: {};
3
3
  type __VLS_Slots = {} & {
4
- prefix?: (props: typeof __VLS_8) => any;
4
+ prefix?: (props: typeof __VLS_1) => any;
5
5
  } & {
6
- suffix?: (props: typeof __VLS_23) => any;
6
+ suffix?: (props: typeof __VLS_8) => any;
7
7
  };
8
8
  declare const __VLS_base: import("vue").DefineComponent<InputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  input: (e: InputEvent, value: string | undefined) => any;
@@ -9,6 +9,9 @@ export interface InputProps extends ThemeCrafts<'tvInput'> {
9
9
  disabled?: boolean;
10
10
  readonly?: boolean;
11
11
  placeholder?: string;
12
+ maxlength?: number;
13
+ minlength?: number;
14
+ type?: string;
12
15
  ui?: {
13
16
  root?: HTMLAttributes['class'];
14
17
  input?: HTMLAttributes['class'];
@@ -19,6 +19,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  ]
20
20
  },
21
21
  ui: {},
22
+ dynamicPageEnd: {},
22
23
  count: {},
23
24
  defaultPage: {},
24
25
  defaultPageSize: {},
@@ -47,7 +48,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
48
  const props = createPropsRestProxy(__props, [
48
49
  "class",
49
50
  "theme",
50
- "ui"
51
+ "ui",
52
+ "dynamicPageEnd"
51
53
  ]);
52
54
  const emit = __emit;
53
55
  const pagination = usePagination(useForwardProps(props), emit);
@@ -56,6 +58,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
56
58
  const itemClx = computed(()=>crafts.value.item({
57
59
  ...theme.value
58
60
  }));
61
+ const isDynamicPageEnd = computed(()=>__props.dynamicPageEnd && __props.dynamicPageEnd > 1);
62
+ const dynamicPages = computed(()=>{
63
+ if (!isDynamicPageEnd.value) return pagination.value.pages;
64
+ const { page, pages, totalPages } = pagination.value;
65
+ if (page + __props.dynamicPageEnd - 1 < totalPages) {
66
+ const newPages = [
67
+ ...pages
68
+ ];
69
+ newPages.splice(pages.length - 1, 1, {
70
+ type: "page",
71
+ value: page + __props.dynamicPageEnd
72
+ });
73
+ return newPages;
74
+ }
75
+ return pages;
76
+ });
59
77
  __expose({
60
78
  $api: pagination
61
79
  });
@@ -113,7 +131,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
113
131
  }, 8, [
114
132
  "class"
115
133
  ]),
116
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagination).pages, (page, index)=>(openBlock(), createElementBlock(Fragment, {
134
+ (openBlock(true), createElementBlock(Fragment, null, renderList(isDynamicPageEnd.value ? dynamicPages.value : unref(pagination).pages, (page, index)=>(openBlock(), createElementBlock(Fragment, {
117
135
  key: index
118
136
  }, [
119
137
  "page" === page.type ? (openBlock(), createBlock(unref(Pagination).Item, mergeProps({
@@ -14,6 +14,7 @@ export interface PaginationProps extends PaginationRootBaseProps, ThemeCrafts<'t
14
14
  item?: HTMLAttributes['class'];
15
15
  ellipsis?: HTMLAttributes['class'];
16
16
  };
17
+ dynamicPageEnd?: number;
17
18
  }
18
19
  export interface PaginationGoToProps extends ThemeNoCrafts {
19
20
  class?: HTMLAttributes['class'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@raxium/vue",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.2.5",
5
5
  "description": "Vue core components for Raxium, based on Ark UI",
6
6
  "author": {
7
7
  "name": "Hwacc",
@@ -67,8 +67,8 @@
67
67
  "es-toolkit": "^1.44.0",
68
68
  "lucide-vue-next": "^1.0.0",
69
69
  "vue-component-type-helpers": "^3.2.1",
70
- "@raxium/themes": "0.1.6",
71
- "@raxium/shared": "0.1.1"
70
+ "@raxium/shared": "0.1.1",
71
+ "@raxium/themes": "0.1.7"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@ark-ui/vue": "5.35.0",
@@ -88,8 +88,8 @@
88
88
  "tsc-alias": "^1.8.16",
89
89
  "vitest": "^4.1.1",
90
90
  "vue-tsc": "^3.2.4",
91
- "@raxium/shared": "0.1.1",
92
- "@raxium/themes": "0.1.6"
91
+ "@raxium/themes": "0.1.7",
92
+ "@raxium/shared": "0.1.1"
93
93
  },
94
94
  "publishConfig": {
95
95
  "access": "public"