@firerian/fireui 1.0.2 → 1.0.3

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.
@@ -360,6 +360,10 @@ toolbar: any[];
360
360
 
361
361
  export declare const FButton: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
362
362
 
363
+ export declare const FInput: typeof _default_3 & {
364
+ install: (app: App) => void;
365
+ };
366
+
363
367
  export declare const FireAside: {
364
368
  new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
365
369
  width?: string | number;
@@ -661,10 +665,6 @@ height: string | number;
661
665
  install: (app: App) => void;
662
666
  };
663
667
 
664
- export declare const FireInput: typeof _default_3 & {
665
- install: (app: App) => void;
666
- };
667
-
668
668
  export declare const FireMain: {
669
669
  new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
670
670
  class?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firerian/fireui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "A modern Vue 3 UI component library",
6
6
  "main": "./dist/fireui.cjs",
@@ -24,7 +24,7 @@ export { FireTips } from './tips'
24
24
  export type { TipsProps, TipsEmits, TipsSlots } from './tips/types'
25
25
 
26
26
  // Input 组件
27
- export { FireInput } from './input'
27
+ export { FInput } from './input'
28
28
  export type { InputProps, InputEmits, InputSlots } from './input/types'
29
29
 
30
30
  // Form 组件
@@ -2,7 +2,7 @@ import Input from './input.vue'
2
2
  import { withInstall } from '../../utils'
3
3
  import type { App } from 'vue'
4
4
 
5
- const FireInput = withInstall(Input as any) as typeof Input & { install: (app: App) => void }
5
+ const FInput = withInstall(Input as any) as typeof Input & { install: (app: App) => void }
6
6
 
7
- export { FireInput }
8
- export default FireInput
7
+ export { FInput }
8
+ export default FInput
@@ -1,10 +1,10 @@
1
1
  import { describe, it, expect } from 'vitest'
2
2
  import { mount } from '@vue/test-utils'
3
- import { FireInput } from './index'
3
+ import { FInput } from './index'
4
4
 
5
- describe('FireInput', () => {
5
+ describe('FInput', () => {
6
6
  it('should render correctly', () => {
7
- const wrapper = mount(FireInput, {
7
+ const wrapper = mount(FInput, {
8
8
  props: {
9
9
  modelValue: 'test'
10
10
  }
@@ -15,7 +15,7 @@ describe('FireInput', () => {
15
15
  })
16
16
 
17
17
  it('should update modelValue when input', async () => {
18
- const wrapper = mount(FireInput, {
18
+ const wrapper = mount(FInput, {
19
19
  props: {
20
20
  modelValue: ''
21
21
  }
@@ -30,7 +30,7 @@ describe('FireInput', () => {
30
30
  })
31
31
 
32
32
  it('should emit focus and blur events', async () => {
33
- const wrapper = mount(FireInput)
33
+ const wrapper = mount(FInput)
34
34
 
35
35
  const input = wrapper.find('input')
36
36
  await input.trigger('focus')
@@ -41,7 +41,7 @@ describe('FireInput', () => {
41
41
  })
42
42
 
43
43
  it('should emit enter event', async () => {
44
- const wrapper = mount(FireInput)
44
+ const wrapper = mount(FInput)
45
45
 
46
46
  const input = wrapper.find('input')
47
47
  await input.trigger('keydown.enter')
@@ -49,7 +49,7 @@ describe('FireInput', () => {
49
49
  })
50
50
 
51
51
  it('should be disabled', () => {
52
- const wrapper = mount(FireInput, {
52
+ const wrapper = mount(FInput, {
53
53
  props: {
54
54
  disabled: true
55
55
  }
@@ -61,7 +61,7 @@ describe('FireInput', () => {
61
61
  })
62
62
 
63
63
  it('should be readonly', () => {
64
- const wrapper = mount(FireInput, {
64
+ const wrapper = mount(FInput, {
65
65
  props: {
66
66
  readonly: true
67
67
  }
@@ -72,7 +72,7 @@ describe('FireInput', () => {
72
72
  })
73
73
 
74
74
  it('should show word limit', () => {
75
- const wrapper = mount(FireInput, {
75
+ const wrapper = mount(FInput, {
76
76
  props: {
77
77
  modelValue: 'test',
78
78
  maxlength: 10,
@@ -84,7 +84,7 @@ describe('FireInput', () => {
84
84
  })
85
85
 
86
86
  it('should toggle password visibility', async () => {
87
- const wrapper = mount(FireInput, {
87
+ const wrapper = mount(FInput, {
88
88
  props: {
89
89
  password: true
90
90
  }
@@ -105,7 +105,7 @@ describe('FireInput', () => {
105
105
  const sizes = ['large', 'medium', 'small']
106
106
 
107
107
  sizes.forEach((size) => {
108
- const wrapper = mount(FireInput, {
108
+ const wrapper = mount(FInput, {
109
109
  props: {
110
110
  size: size as 'large' | 'medium' | 'small'
111
111
  }
@@ -116,7 +116,7 @@ describe('FireInput', () => {
116
116
  })
117
117
 
118
118
  it('should render prefix and suffix slots', () => {
119
- const wrapper = mount(FireInput, {
119
+ const wrapper = mount(FInput, {
120
120
  slots: {
121
121
  prefix: '<span class="prefix">P</span>',
122
122
  suffix: '<span class="suffix">S</span>'
@@ -10,7 +10,7 @@
10
10
  }
11
11
  ]"
12
12
  >
13
- <div v-if="$slots.prefix || prefixIcon" class="fire-input__prefix">
13
+ <div v-if="$slots.prefix || prefixIcon" :class="ns.e('prefix')">
14
14
  <slot name="prefix">
15
15
  <component :is="prefixIcon" v-if="prefixIcon" />
16
16
  </slot>
@@ -28,15 +28,15 @@
28
28
  @focus="handleFocus"
29
29
  @blur="handleBlur"
30
30
  @keydown.enter="handleEnter"
31
- class="fire-input__inner"
31
+ :class="ns.e('inner')"
32
32
  />
33
- <div v-if="$slots.suffix || suffixIcon || showWordLimit || (password && !disabled)" class="fire-input__suffix">
34
- <span v-if="showWordLimit" class="fire-input__word-limit">{{ (modelValue || '').toString().length }}/{{ maxlength }}</span>
35
- <div v-if="password && !disabled" class="fire-input__password-toggle">
33
+ <div v-if="$slots.suffix || suffixIcon || showWordLimit || (password && !disabled)" :class="ns.e('suffix')">
34
+ <span v-if="showWordLimit" :class="ns.e('word-limit')">{{ (modelValue || '').toString().length }}/{{ maxlength }}</span>
35
+ <div v-if="password && !disabled" :class="ns.e('password-toggle')">
36
36
  <button
37
37
  type="button"
38
38
  @click="togglePassword"
39
- class="fire-input__password-icon"
39
+ :class="ns.e('password-icon')"
40
40
  aria-label="Toggle password visibility"
41
41
  >
42
42
  <Eye v-if="!showPassword" :size="16" />
@@ -58,6 +58,11 @@ import { useNamespace } from '../../utils'
58
58
  // 初始化命名空间
59
59
  const ns = useNamespace('input')
60
60
 
61
+ // 组件名称
62
+ defineOptions({
63
+ name: 'FInput'
64
+ })
65
+
61
66
  // Props 定义 - 使用 export 导出
62
67
  export interface InputProps {
63
68
  type?: string
@@ -127,47 +132,45 @@ const togglePassword = () => {
127
132
  }
128
133
  </script>
129
134
 
130
- <style scoped lang="scss">
131
- @import '../../styles/variables.scss';
132
-
133
- .#{$namespace}-input {
135
+ <style lang="scss">
136
+ .fire-input {
134
137
  position: relative;
135
138
  display: inline-flex;
136
139
  align-items: center;
137
140
  width: 100%;
138
- border: 1px solid $border-color;
139
- border-radius: $border-radius-base;
141
+ border: 1px solid #d9d9d9;
142
+ border-radius: 4px;
140
143
  transition: all 0.2s ease;
141
144
  background-color: #fff;
142
145
 
143
146
  &:hover {
144
- border-color: $primary-color;
147
+ border-color: #3b82f6;
145
148
  }
146
149
 
147
150
  &:focus-within {
148
- border-color: $primary-color;
149
- box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
151
+ border-color: #3b82f6;
152
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
150
153
  }
151
154
 
152
155
  &--disabled {
153
- background-color: $disabled-bg;
154
- border-color: $border-color;
156
+ background-color: #f5f5f5;
157
+ border-color: #d9d9d9;
155
158
  cursor: not-allowed;
156
159
 
157
- .#{$namespace}-input__inner {
158
- background-color: $disabled-bg;
160
+ .fire-input__inner {
161
+ background-color: #f5f5f5;
159
162
  cursor: not-allowed;
160
163
  }
161
164
  }
162
165
 
163
166
  &--prefix {
164
- .#{$namespace}-input__inner {
167
+ .fire-input__inner {
165
168
  padding-left: 8px;
166
169
  }
167
170
  }
168
171
 
169
172
  &--suffix {
170
- .#{$namespace}-input__inner {
173
+ .fire-input__inner {
171
174
  padding-right: 8px;
172
175
  }
173
176
  }
@@ -175,7 +178,7 @@ const togglePassword = () => {
175
178
  &--large {
176
179
  height: 40px;
177
180
 
178
- .#{$namespace}-input__inner {
181
+ .fire-input__inner {
179
182
  height: 40px;
180
183
  font-size: 14px;
181
184
  padding: 0 12px;
@@ -185,7 +188,7 @@ const togglePassword = () => {
185
188
  &--medium {
186
189
  height: 32px;
187
190
 
188
- .#{$namespace}-input__inner {
191
+ .fire-input__inner {
189
192
  height: 32px;
190
193
  font-size: 14px;
191
194
  padding: 0 12px;
@@ -195,7 +198,7 @@ const togglePassword = () => {
195
198
  &--small {
196
199
  height: 24px;
197
200
 
198
- .#{$namespace}-input__inner {
201
+ .fire-input__inner {
199
202
  height: 24px;
200
203
  font-size: 12px;
201
204
  padding: 0 8px;
@@ -208,17 +211,17 @@ const togglePassword = () => {
208
211
  outline: none;
209
212
  background: transparent;
210
213
  font-size: 14px;
211
- color: $text-color;
214
+ color: #333333;
212
215
  transition: all 0.2s ease;
213
216
 
214
217
  &::placeholder {
215
- color: $text-color-secondary;
218
+ color: #666666;
216
219
  }
217
220
  }
218
221
 
219
222
  &__prefix {
220
223
  padding: 0 8px;
221
- color: $text-color-secondary;
224
+ color: #666666;
222
225
  font-size: 14px;
223
226
  }
224
227
 
@@ -226,13 +229,13 @@ const togglePassword = () => {
226
229
  display: flex;
227
230
  align-items: center;
228
231
  padding: 0 8px;
229
- color: $text-color-secondary;
232
+ color: #666666;
230
233
  font-size: 14px;
231
234
  }
232
235
 
233
236
  &__word-limit {
234
237
  font-size: 12px;
235
- color: $text-color-secondary;
238
+ color: #666666;
236
239
  margin-right: 8px;
237
240
  }
238
241
 
@@ -245,11 +248,11 @@ const togglePassword = () => {
245
248
  border: none;
246
249
  cursor: pointer;
247
250
  padding: 0;
248
- color: $text-color-secondary;
251
+ color: #666666;
249
252
  transition: color 0.2s ease;
250
253
 
251
254
  &:hover {
252
- color: $primary-color;
255
+ color: #3b82f6;
253
256
  }
254
257
  }
255
258
  }
@@ -96,12 +96,13 @@ const handleImageUpload = (file: File, callback: (url: string) => void) => {
96
96
  </script>
97
97
 
98
98
  <style scoped lang="scss">
99
- @import '../../styles/variables.scss';
99
+ @use '../../styles/variables' as *;
100
100
 
101
101
  .#{$namespace}-rich-text {
102
102
  border: 1px solid $border-color;
103
103
  border-radius: $border-radius-base;
104
104
  transition: all 0.2s ease;
105
+ overflow: hidden;
105
106
 
106
107
  &:hover {
107
108
  border-color: $primary-color;
@@ -120,11 +121,15 @@ const handleImageUpload = (file: File, callback: (url: string) => void) => {
120
121
 
121
122
  .ql-container {
122
123
  font-size: 14px;
124
+ height: 100%;
123
125
  }
124
126
 
125
127
  .ql-editor {
126
128
  min-height: calc(100% - 42px);
127
129
  line-height: 1.5;
130
+ max-height: calc(100% - 42px);
131
+ overflow-y: auto;
132
+ padding-bottom: 40px;
128
133
  }
129
134
 
130
135
  .ql-toolbar.ql-snow {
package/src/index.ts CHANGED
@@ -17,10 +17,28 @@
17
17
  */
18
18
 
19
19
  import type { App, Plugin, Component } from 'vue'
20
- import { FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FireInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText } from './components'
20
+ import { FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText } from './components'
21
+
22
+ // 导入组件样式
23
+ import './components/button/button.vue'
24
+ import './components/input/input.vue'
25
+ import './components/rich-text/rich-text.vue'
26
+ import './components/grid/row.vue'
27
+ import './components/grid/col.vue'
28
+ import './components/layout/container.vue'
29
+ import './components/layout/header.vue'
30
+ import './components/layout/aside.vue'
31
+ import './components/layout/main.vue'
32
+ import './components/layout/footer.vue'
33
+ import './components/tooltip/tooltip.vue'
34
+ import './components/tips/tips.vue'
35
+ import './components/form/form.vue'
36
+ import './components/form/form-item.vue'
37
+ import './components/table/table.vue'
38
+ import './components/table/table-column.vue'
21
39
 
22
40
  // 所有组件列表
23
- const components = [FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FireInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText]
41
+ const components = [FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText]
24
42
 
25
43
  /**
26
44
  * 安装函数 - 自动注册所有组件
@@ -35,7 +53,7 @@ const install = (app: App): void => {
35
53
  }
36
54
 
37
55
  // 导出所有组件
38
- export { FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FireInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText }
56
+ export { FButton, FireRow, FireCol, FireContainer, FireHeader, FireAside, FireMain, FireFooter, FireTooltip, FireTips, FInput, FireForm, FireFormItem, FireTable, FireTableColumn, FireRichText }
39
57
 
40
58
  // 导出组件库插件
41
59
  export default {
@@ -0,0 +1,230 @@
1
+ /* Input 组件样式 */
2
+ .fire-input {
3
+ position: relative;
4
+ display: inline-flex;
5
+ align-items: center;
6
+ width: 100%;
7
+ border: 1px solid #d9d9d9;
8
+ border-radius: 4px;
9
+ transition: all 0.2s ease;
10
+ background-color: #fff;
11
+
12
+ &:hover {
13
+ border-color: #3b82f6;
14
+ }
15
+
16
+ &:focus-within {
17
+ border-color: #3b82f6;
18
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
19
+ }
20
+
21
+ &--disabled {
22
+ background-color: #f5f5f5;
23
+ border-color: #d9d9d9;
24
+ cursor: not-allowed;
25
+
26
+ .fire-input__inner {
27
+ background-color: #f5f5f5;
28
+ cursor: not-allowed;
29
+ }
30
+ }
31
+
32
+ &--prefix {
33
+ .fire-input__inner {
34
+ padding-left: 8px;
35
+ }
36
+ }
37
+
38
+ &--suffix {
39
+ .fire-input__inner {
40
+ padding-right: 8px;
41
+ }
42
+ }
43
+
44
+ &--large {
45
+ height: 40px;
46
+
47
+ .fire-input__inner {
48
+ height: 40px;
49
+ font-size: 14px;
50
+ padding: 0 12px;
51
+ }
52
+ }
53
+
54
+ &--medium {
55
+ height: 32px;
56
+
57
+ .fire-input__inner {
58
+ height: 32px;
59
+ font-size: 14px;
60
+ padding: 0 12px;
61
+ }
62
+ }
63
+
64
+ &--small {
65
+ height: 24px;
66
+
67
+ .fire-input__inner {
68
+ height: 24px;
69
+ font-size: 12px;
70
+ padding: 0 8px;
71
+ }
72
+ }
73
+
74
+ &__inner {
75
+ flex: 1;
76
+ border: none;
77
+ outline: none;
78
+ background: transparent;
79
+ font-size: 14px;
80
+ color: #333333;
81
+ transition: all 0.2s ease;
82
+
83
+ &::placeholder {
84
+ color: #666666;
85
+ }
86
+ }
87
+
88
+ &__prefix {
89
+ padding: 0 8px;
90
+ color: #666666;
91
+ font-size: 14px;
92
+ }
93
+
94
+ &__suffix {
95
+ display: flex;
96
+ align-items: center;
97
+ padding: 0 8px;
98
+ color: #666666;
99
+ font-size: 14px;
100
+ }
101
+
102
+ &__word-limit {
103
+ font-size: 12px;
104
+ color: #666666;
105
+ margin-right: 8px;
106
+ }
107
+
108
+ &__password-toggle {
109
+ margin-right: 4px;
110
+ }
111
+
112
+ &__password-icon {
113
+ background: transparent;
114
+ border: none;
115
+ cursor: pointer;
116
+ padding: 0;
117
+ color: #666666;
118
+ transition: color 0.2s ease;
119
+
120
+ &:hover {
121
+ color: #3b82f6;
122
+ }
123
+ }
124
+ }
125
+
126
+ /* RichText 组件样式 */
127
+ .fire-rich-text {
128
+ border: 1px solid #d9d9d9;
129
+ border-radius: 4px;
130
+ transition: all 0.2s ease;
131
+
132
+ &:hover {
133
+ border-color: #3b82f6;
134
+ }
135
+
136
+ &--disabled {
137
+ background-color: #f5f5f5;
138
+ border-color: #d9d9d9;
139
+ cursor: not-allowed;
140
+
141
+ .ql-container {
142
+ background-color: #f5f5f5;
143
+ cursor: not-allowed;
144
+ }
145
+ }
146
+
147
+ .ql-container {
148
+ font-size: 14px;
149
+ }
150
+
151
+ .ql-editor {
152
+ min-height: calc(100% - 42px);
153
+ line-height: 1.5;
154
+ }
155
+
156
+ .ql-toolbar.ql-snow {
157
+ border-bottom: 1px solid #d9d9d9;
158
+ }
159
+
160
+ .ql-snow .ql-picker-label {
161
+ color: #333333;
162
+ }
163
+
164
+ .ql-snow .ql-picker-options {
165
+ color: #333333;
166
+ background-color: #fff;
167
+ }
168
+
169
+ .ql-snow .ql-picker-item:hover {
170
+ background-color: rgba(59, 130, 246, 0.1);
171
+ }
172
+
173
+ .ql-snow .ql-picker-item.ql-selected {
174
+ color: #3b82f6;
175
+ }
176
+
177
+ .ql-snow .ql-button:hover {
178
+ color: #3b82f6;
179
+ }
180
+
181
+ .ql-snow .ql-active {
182
+ color: #3b82f6;
183
+ }
184
+
185
+ .ql-snow .ql-tooltip {
186
+ background-color: #fff;
187
+ border: 1px solid #d9d9d9;
188
+ border-radius: 4px;
189
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
190
+ }
191
+
192
+ .ql-snow .ql-tooltip input[type=text] {
193
+ border: 1px solid #d9d9d9;
194
+ border-radius: 4px;
195
+ }
196
+
197
+ .ql-snow .ql-tooltip input[type=text]:focus {
198
+ border-color: #3b82f6;
199
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
200
+ }
201
+
202
+ .ql-snow .ql-tooltip button {
203
+ background-color: #3b82f6;
204
+ color: #fff;
205
+ border: none;
206
+ border-radius: 4px;
207
+ padding: 4px 8px;
208
+ cursor: pointer;
209
+
210
+ &:hover {
211
+ background-color: #1d4ed8;
212
+ }
213
+ }
214
+
215
+ .ql-snow .ql-tooltip button.ql-action {
216
+ background-color: #22c55e;
217
+
218
+ &:hover {
219
+ background-color: #16a34a;
220
+ }
221
+ }
222
+
223
+ .ql-snow .ql-tooltip button.ql-remove {
224
+ background-color: #ef4444;
225
+
226
+ &:hover {
227
+ background-color: #dc2626;
228
+ }
229
+ }
230
+ }
@@ -3,14 +3,17 @@ import type { App, Component } from 'vue'
3
3
  export function withInstall<T>(component: T & { name?: string }) {
4
4
  const comp = component as any
5
5
  comp.install = (app: App) => {
6
- app.component(comp.name || comp.__name, component)
6
+ // 优先使用组件的 name 属性,然后是 __name,最后使用组件的文件名
7
+ const componentName = comp.name || comp.__name || (typeof comp === 'object' ? 'UnnamedComponent' : 'Unknown')
8
+ app.component(componentName, component)
7
9
  }
8
10
  return component as T & { install: (app: App) => void }
9
11
  }
10
12
 
11
13
  export function registerComponent(app: App, component: Component) {
12
14
  const comp = component as any
13
- app.component(comp.name || comp.__name, component)
15
+ const componentName = comp.name || comp.__name || (typeof comp === 'object' ? 'UnnamedComponent' : 'Unknown')
16
+ app.component(componentName, component)
14
17
  }
15
18
 
16
19
  export function registerComponents(app: App, components: Component[]) {