@ruixinkeji/prism-ui 1.0.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.
Files changed (48) hide show
  1. package/README.md +141 -0
  2. package/components/PrismAIAssist/PrismAIAssist.vue +98 -0
  3. package/components/PrismAddressInput/PrismAddressInput.vue +597 -0
  4. package/components/PrismCityCascadeSelect/PrismCityCascadeSelect.vue +793 -0
  5. package/components/PrismCityPicker/PrismCityPicker.vue +1008 -0
  6. package/components/PrismCitySelect/PrismCitySelect.vue +435 -0
  7. package/components/PrismCode/PrismCode.vue +749 -0
  8. package/components/PrismCodeInput/PrismCodeInput.vue +156 -0
  9. package/components/PrismDateTimePicker/PrismDateTimePicker.vue +953 -0
  10. package/components/PrismDropdown/PrismDropdown.vue +77 -0
  11. package/components/PrismGroupSticky/PrismGroupSticky.vue +352 -0
  12. package/components/PrismIdCardInput/PrismIdCardInput.vue +253 -0
  13. package/components/PrismImagePicker/PrismImagePicker.vue +457 -0
  14. package/components/PrismIndexBar/PrismIndexBar.vue +243 -0
  15. package/components/PrismLicensePlateInput/PrismLicensePlateInput.vue +1100 -0
  16. package/components/PrismMusicPlayer/PrismMusicPlayer.vue +530 -0
  17. package/components/PrismNavBar/PrismNavBar.vue +199 -0
  18. package/components/PrismSecureInput/PrismSecureInput.vue +360 -0
  19. package/components/PrismSticky/PrismSticky.vue +173 -0
  20. package/components/PrismSwiper/PrismSwiper.vue +339 -0
  21. package/components/PrismSwitch/PrismSwitch.vue +202 -0
  22. package/components/PrismTabBar/PrismTabBar.vue +147 -0
  23. package/components/PrismTabs/PrismTabs.vue +49 -0
  24. package/components/PrismVoiceInput/PrismVoiceInput.vue +529 -0
  25. package/index.d.ts +24 -0
  26. package/index.esm.js +25 -0
  27. package/index.js +25 -0
  28. package/package.json +89 -0
  29. package/styles/base.scss +227 -0
  30. package/styles/button.scss +120 -0
  31. package/styles/card.scss +306 -0
  32. package/styles/colors.scss +877 -0
  33. package/styles/data.scss +1229 -0
  34. package/styles/effects.scss +407 -0
  35. package/styles/feedback.scss +698 -0
  36. package/styles/form.scss +1574 -0
  37. package/styles/index.scss +46 -0
  38. package/styles/list.scss +184 -0
  39. package/styles/navigation.scss +554 -0
  40. package/styles/overlay.scss +182 -0
  41. package/styles/utilities.scss +134 -0
  42. package/styles/variables.scss +138 -0
  43. package/theme/blue.scss +36 -0
  44. package/theme/cyan.scss +32 -0
  45. package/theme/green.scss +32 -0
  46. package/theme/orange.scss +32 -0
  47. package/theme/purple.scss +32 -0
  48. package/theme/red.scss +32 -0
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <view class="prism-code-input" :class="{ 'dark-mode': appStore.isDarkMode }">
3
+ <view class="code-boxes">
4
+ <view
5
+ v-for="(item, index) in codeLength"
6
+ :key="index"
7
+ class="code-box"
8
+ :class="{ 'active': focusIndex === index, 'filled': codeArray[index] }"
9
+ @click="handleFocus"
10
+ >
11
+ <text class="code-text">{{ codeArray[index] || '' }}</text>
12
+ <view class="cursor" v-if="focusIndex === index && !codeArray[index]"></view>
13
+ </view>
14
+ </view>
15
+ <input
16
+ ref="hiddenInput"
17
+ class="hidden-input"
18
+ type="number"
19
+ :maxlength="codeLength"
20
+ v-model="codeValue"
21
+ :focus="isFocused"
22
+ @input="handleInput"
23
+ @focus="isFocused = true"
24
+ @blur="isFocused = false"
25
+ />
26
+ </view>
27
+ </template>
28
+
29
+ <script setup>
30
+ import { ref, computed, watch } from 'vue';
31
+ import { useAppStore } from '@/store/app';
32
+
33
+ const props = defineProps({
34
+ length: {
35
+ type: Number,
36
+ default: 6
37
+ },
38
+ modelValue: {
39
+ type: String,
40
+ default: ''
41
+ }
42
+ });
43
+
44
+ const emit = defineEmits(['update:modelValue', 'complete']);
45
+
46
+ const appStore = useAppStore();
47
+ const codeValue = ref(props.modelValue);
48
+ const isFocused = ref(false);
49
+
50
+ const codeLength = computed(() => props.length);
51
+
52
+ const codeArray = computed(() => {
53
+ return codeValue.value.split('').slice(0, props.length);
54
+ });
55
+
56
+ const focusIndex = computed(() => {
57
+ if (!isFocused.value) return -1;
58
+ return Math.min(codeArray.value.length, props.length - 1);
59
+ });
60
+
61
+ function handleFocus() {
62
+ isFocused.value = true;
63
+ }
64
+
65
+ function handleInput(e) {
66
+ const value = e.detail.value.replace(/\D/g, '').slice(0, props.length);
67
+ codeValue.value = value;
68
+ emit('update:modelValue', value);
69
+
70
+ if (value.length === props.length) {
71
+ emit('complete', value);
72
+ }
73
+ }
74
+
75
+ watch(() => props.modelValue, (val) => {
76
+ codeValue.value = val;
77
+ });
78
+ </script>
79
+
80
+ <style lang="scss">
81
+ .prism-code-input {
82
+ position: relative;
83
+
84
+ .code-boxes {
85
+ display: flex;
86
+ gap: 16rpx;
87
+ }
88
+
89
+ .code-box {
90
+ width: 76rpx;
91
+ height: 88rpx;
92
+ background: var(--prism-input-bg, #EBEEF2);
93
+ border-radius: 12rpx;
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ position: relative;
98
+ transition: all 0.2s ease;
99
+ border: 2rpx solid transparent;
100
+
101
+ &.active {
102
+ border-color: var(--prism-primary-color, #3478F6);
103
+ background: var(--prism-primary-light, rgba(52, 120, 246, 0.08));
104
+ }
105
+
106
+ &.filled {
107
+ background: var(--prism-primary-light, rgba(52, 120, 246, 0.08));
108
+ }
109
+
110
+ .code-text {
111
+ font-size: 48rpx;
112
+ font-weight: 600;
113
+ color: var(--prism-text-primary, #1D2129);
114
+ }
115
+
116
+ .cursor {
117
+ position: absolute;
118
+ width: 4rpx;
119
+ height: 40rpx;
120
+ background: var(--prism-primary-color, #3478F6);
121
+ animation: blink 1s infinite;
122
+ }
123
+ }
124
+
125
+ .hidden-input {
126
+ position: absolute;
127
+ left: -9999rpx;
128
+ opacity: 0;
129
+ width: 1rpx;
130
+ height: 1rpx;
131
+ }
132
+
133
+ @keyframes blink {
134
+ 0%, 50% { opacity: 1; }
135
+ 51%, 100% { opacity: 0; }
136
+ }
137
+ }
138
+
139
+ .dark-mode .prism-code-input {
140
+ .code-box {
141
+ background: var(--prism-input-bg, #2A2A2A);
142
+
143
+ &.active {
144
+ background: rgba(52, 120, 246, 0.15);
145
+ }
146
+
147
+ &.filled {
148
+ background: rgba(52, 120, 246, 0.15);
149
+ }
150
+
151
+ .code-text {
152
+ color: var(--prism-text-primary, #E5E6EB);
153
+ }
154
+ }
155
+ }
156
+ </style>