@yorkjs/hive-ui 0.0.3 → 0.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -13,17 +13,19 @@
13
13
  white-space nowrap
14
14
  box-sizing border-box
15
15
 
16
- halfBorder(top left right bottom, transparent, 8PX)
16
+ halfBorder(top left right bottom, var(--tag-border-color, transparent), 8PX)
17
17
 
18
18
  .tag-text
19
19
  line-height 1
20
20
 
21
21
  .type-default
22
- &:before
23
- border-color var(--lineBorder)
22
+ --tag-border-color: var(--lineBorder)
24
23
  :global(.is-dark)
25
- &:before
26
- border-color transparent
24
+ --tag-border-color: transparent
25
+
26
+ .tag-component:before
27
+ border-color: var(--tag-border-color, transparent)
28
+
27
29
 
28
30
  .type-primary, .type-info, .type-success, .type-error
29
31
  border none
@@ -30,7 +30,6 @@ const Tag: React.FC<TagProps> = ({
30
30
  className,
31
31
  style
32
32
  }) => {
33
-
34
33
  const themeSelect = (light: string, dark: string) => (isDark ? dark : light)
35
34
 
36
35
  const tagStyle = useMemo(() => {
@@ -92,6 +91,20 @@ const Tag: React.FC<TagProps> = ({
92
91
  return mapping[type] || mapping.default
93
92
  }, [type])
94
93
 
94
+ const finalStyle = useMemo(() => {
95
+ const s: React.CSSProperties & { [key: string]: any } = {
96
+ backgroundColor: tagStyle.backgroundColor,
97
+ color: tagStyle.color,
98
+ ...style,
99
+ }
100
+
101
+ if (style?.borderColor) {
102
+ s['--tag-border-color'] = style.borderColor
103
+ }
104
+
105
+ return s
106
+ }, [tagStyle, style])
107
+
95
108
  return (
96
109
  <View
97
110
  className={formatClassNames(
@@ -99,11 +112,7 @@ const Tag: React.FC<TagProps> = ({
99
112
  styles[`type-${type}`],
100
113
  className
101
114
  )}
102
- style={{
103
- backgroundColor: tagStyle.backgroundColor,
104
- color: tagStyle.color,
105
- ...style
106
- }}
115
+ style={finalStyle}
107
116
  >
108
117
  <Text
109
118
  className={styles['tag-text']}
@@ -26,7 +26,7 @@ $F_BUY_COUNT = 14PX // RN 14
26
26
  width 100%
27
27
 
28
28
  .checkbox-container
29
- height 72PX // 对齐图片高度 72
29
+ height 72PX
30
30
  margin-right 10PX
31
31
  display flex
32
32
  justify-content center
@@ -43,7 +43,7 @@ $F_BUY_COUNT = 14PX // RN 14
43
43
  .product-image
44
44
  width 72PX
45
45
  height 72PX
46
- border-radius 10PX // 对齐 RN: IMAGE_RADIUS = 10
46
+ border-radius 10PX
47
47
  background-color var(--containerInner)
48
48
 
49
49
  .status-overlay
@@ -60,7 +60,7 @@ $F_BUY_COUNT = 14PX // RN 14
60
60
  z-index 2
61
61
 
62
62
  .status-text
63
- font-size 12PX // 对齐 RN: 12
63
+ font-size 12PX
64
64
  color #FFF
65
65
  line-height 1
66
66
 
@@ -70,7 +70,7 @@ $F_BUY_COUNT = 14PX // RN 14
70
70
  flex-direction column
71
71
  justify-content space-between
72
72
  min-height 72PX
73
- min-width 0 // 关键:确保内部 Flex 截断能正常工作
73
+ min-width 0
74
74
 
75
75
  .content-body
76
76
  flex 1
@@ -85,7 +85,8 @@ $F_BUY_COUNT = 14PX // RN 14
85
85
 
86
86
  .product-tag-container
87
87
  display flex
88
- margin-right 8PX
88
+ align-items center
89
+ margin-right 5PX
89
90
  flex-shrink 0
90
91
  line-height 1
91
92
 
@@ -116,9 +117,8 @@ $F_BUY_COUNT = 14PX // RN 14
116
117
  .info-line
117
118
  width 1PX
118
119
  height 10PX
119
- background-color var(--textContent)
120
120
  margin 0 5PX
121
- transform scaleX(0.5)
121
+ halfBorder(left, var(--textContent))
122
122
 
123
123
  .info-text
124
124
  font-size $F_INFO
@@ -153,19 +153,25 @@ $F_BUY_COUNT = 14PX // RN 14
153
153
  padding 1PX 5PX
154
154
  border-radius 3PX
155
155
  font-size $F_TAG_NORMAL
156
- border 1PX solid transparent
156
+ height 15PX
157
+ line-height 15PX
157
158
 
158
159
  .activity-tag
159
160
  display flex
160
161
  flex-direction row
161
162
  align-items center
162
- border 1PX solid #F21902 // 对齐 RN: borderColor: '#F21902'
163
+ halfBorder(top left right bottom, #F21902, 6PX)
164
+ height 15PX
165
+ line-height 15PX
163
166
  border-radius 3PX
164
167
  overflow hidden
165
168
 
166
169
  .activity-tag-badge
170
+ padding 0 3PX
171
+ height 100%
167
172
  background-color #F21902
168
- padding 1PX 4PX // 对齐 RN: paddingHorizontal: 4, paddingVertical: 1
173
+ border-top-right-radius 3PX
174
+ border-bottom-right-radius 3PX
169
175
  display flex
170
176
  align-items center
171
177
  justify-content center
@@ -176,7 +182,8 @@ $F_BUY_COUNT = 14PX // RN 14
176
182
  line-height 1
177
183
 
178
184
  .activity-tag-content
179
- padding 1PX 5PX // 对齐 RN: paddingHorizontal: 5, paddingVertical: 1
185
+ display flex
186
+ padding 1PX 5PX
180
187
 
181
188
  .activity-tag-text
182
189
  font-size $F_TAG_NORMAL
@@ -186,15 +193,15 @@ $F_BUY_COUNT = 14PX // RN 14
186
193
  .spec-text
187
194
  font-size $F_SPEC
188
195
  color var(--textContent)
189
- line-height 15PX // 对齐 RN: lineHeight: 15
190
- margin-top 5PX // 对齐 RN: marginTop: 5
196
+ line-height 15PX
197
+ margin-top 5PX
191
198
  lineClamp(1)
192
199
 
193
200
  .customization-text
194
201
  font-size $F_CUSTOM
195
202
  color var(--textMuted)
196
- line-height 15PX // 对齐 RN: lineHeight: 15
197
- margin-top 5PX // 对齐 RN: marginTop: 5
203
+ line-height 15PX
204
+ margin-top 5PX
198
205
  lineClamp(3)
199
206
 
200
207
  .content-bottom
@@ -202,7 +209,7 @@ $F_BUY_COUNT = 14PX // RN 14
202
209
  flex-direction row
203
210
  align-items center
204
211
  justify-content space-between
205
- margin-top 10PX // 对齐 RN: marginTop: 10
212
+ margin-top 5PX
206
213
 
207
214
  .price-container
208
215
  display flex
@@ -212,35 +219,35 @@ $F_BUY_COUNT = 14PX // RN 14
212
219
  .price-row
213
220
  display flex
214
221
  flex-direction row
215
- align-items baseline // 确保符号和数值底部对齐
222
+ align-items baseline
216
223
 
217
224
  .price-symbol
218
225
  font-size $F_PRICE_SYM
219
226
  color var(--textMoney)
220
- font-weight bold // 对齐 RN: FONT_WEIGHT_BOLD
227
+ font-weight bold
221
228
  margin-right 1PX
222
229
 
223
230
  .price-value
224
231
  font-size $F_PRICE_VAL
225
232
  color var(--textMoney)
226
- font-weight bold // 对齐 RN: FONT_WEIGHT_BOLD
233
+ font-weight bold
227
234
 
228
235
  .original-price
229
- font-size 11PX // 对齐 RN: 11
236
+ font-size 11PX
230
237
  color var(--textMuted)
231
238
  text-decoration line-through
232
- margin-left 5PX // 对齐 RN: marginLeft: 5
239
+ margin-left 5PX
233
240
 
234
241
  .buy-count-value
235
242
  font-size $F_BUY_COUNT
236
243
  color var(--textContent)
237
- margin-left 10PX // 对齐 RN: marginLeft: 10
244
+ margin-left 10PX
238
245
 
239
246
  .delete-container
240
247
  position absolute
241
- top 16PX // 对齐 RN: top: 16
242
- right 11PX // 对齐 RN: right: 11
243
- padding 5PX // 对齐 RN: pressHitSlop
248
+ top 16PX
249
+ right 11PX
250
+ padding 5PX
244
251
  z-index 10
245
252
 
246
253
  .delete-icon
@@ -170,9 +170,18 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
170
170
  const productTypeTag = useMemo(() => {
171
171
  if (productType === undefined) return null
172
172
  const colorMap: Record<number, { color: string; text: string | undefined }> = {
173
- [MALL_PRODUCT_TYPE_REAL]: { color: 'var(--primary)', text: labels.product_type?.real },
174
- [MALL_PRODUCT_TYPE_VIRTUAL]: { color: '#E4B700', text: labels.product_type?.virtual },
175
- [MALL_PRODUCT_TYPE_SERVICE]: { color: '#03BE02', text: labels.product_type?.service },
173
+ [MALL_PRODUCT_TYPE_REAL]: {
174
+ color: 'var(--primary)',
175
+ text: labels.product_type?.real
176
+ },
177
+ [MALL_PRODUCT_TYPE_VIRTUAL]: {
178
+ color: '#E4B700',
179
+ text: labels.product_type?.virtual
180
+ },
181
+ [MALL_PRODUCT_TYPE_SERVICE]: {
182
+ color: '#03BE02',
183
+ text: labels.product_type?.service
184
+ },
176
185
  }
177
186
  const item = colorMap[productType]
178
187
  if (!item) return null
@@ -193,11 +202,25 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
193
202
  return deliveryTypes.map(type => {
194
203
  let tagProps: any = null
195
204
  if (type === MALL_PRODUCT_DELIVERY_TYPE_DINE) {
196
- tagProps = { text: labels.delivery_type?.dine, color: '#2db7f5', bg: 'rgba(145, 213, 255, 0.16)' }
197
- } else if (type === MALL_PRODUCT_DELIVERY_TYPE_SELF) {
198
- tagProps = { text: labels.delivery_type?.self_pickup, color: '#FF3D15', bg: 'rgba(255,61,21,0.16)' }
199
- } else if (type === MALL_PRODUCT_DELIVERY_TYPE_EXPRESS || type === MALL_PRODUCT_DELIVERY_TYPE_SHOP) {
200
- tagProps = { text: labels.delivery_type?.delivery, color: '#FF8901', bg: 'rgba(255,137,1,0.16)' }
205
+ tagProps = {
206
+ text: labels.delivery_type?.dine,
207
+ color: '#2db7f5',
208
+ bg: 'rgba(145, 213, 255, 0.16)'
209
+ }
210
+ }
211
+ else if (type === MALL_PRODUCT_DELIVERY_TYPE_SELF) {
212
+ tagProps = {
213
+ text: labels.delivery_type?.self_pickup,
214
+ color: '#FF3D15',
215
+ bg: 'rgba(255,61,21,0.16)'
216
+ }
217
+ }
218
+ else if (type === MALL_PRODUCT_DELIVERY_TYPE_EXPRESS || type === MALL_PRODUCT_DELIVERY_TYPE_SHOP) {
219
+ tagProps = {
220
+ text: labels.delivery_type?.delivery,
221
+ color: '#FF8901',
222
+ bg: 'rgba(255,137,1,0.16)'
223
+ }
201
224
  }
202
225
  if (!tagProps) return null
203
226
  return (
@@ -222,7 +245,9 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
222
245
  </View>
223
246
  )}
224
247
  {saleCount && (
225
- <Text className={styles['info-text']}>{labels.sale_label} {saleCount}</Text>
248
+ <Text className={styles['info-text']}>
249
+ {labels.sale_label} {saleCount}
250
+ </Text>
226
251
  )}
227
252
  </View>
228
253
  )
@@ -233,14 +258,24 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
233
258
  <View className={styles['card-main-body']}>
234
259
  {showCheckbox && (
235
260
  <View className={styles['checkbox-container']}>
236
- <Checkbox checked={checkboxChecked} disabled={checkboxDisabled} readOnly />
261
+ <Checkbox
262
+ checked={checkboxChecked}
263
+ disabled={checkboxDisabled}
264
+ readOnly
265
+ />
237
266
  </View>
238
267
  )}
239
268
  <View className={styles['image-container']}>
240
- <Image src={image?.url} className={styles['product-image']} mode='aspectFill' />
269
+ <Image
270
+ src={image?.url}
271
+ className={styles['product-image']}
272
+ mode='aspectFill'
273
+ />
241
274
  {(showSoldOut || showOffline) && (
242
275
  <View className={styles['status-overlay']}>
243
- <Text className={styles['status-text']}>{showSoldOut ? labels.sold_out : labels.offline}</Text>
276
+ <Text className={styles['status-text']}>
277
+ {showSoldOut ? labels.sold_out : labels.offline}
278
+ </Text>
244
279
  </View>
245
280
  )}
246
281
  </View>
@@ -279,20 +314,98 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
279
314
  {deliveryTags}
280
315
  </View>
281
316
  )}
282
- {spec && <Text className={styles['spec-text']} style={{ WebkitLineClamp: specMaxLines }}>{labels.spec_label}:{spec}</Text>}
283
- {customization && <Text className={styles['customization-text']} style={{ WebkitLineClamp: customizationMaxLines }}>{customization}</Text>}
317
+ {
318
+ spec
319
+ ? (
320
+ <Text
321
+ className={styles['spec-text']}
322
+ style={{ WebkitLineClamp: specMaxLines }}
323
+ >
324
+ {labels.spec_label}:{spec}
325
+ </Text>
326
+ )
327
+ : undefined
328
+ }
329
+ {
330
+ customization
331
+ ? (
332
+ <Text
333
+ className={styles['customization-text']}
334
+ style={{ WebkitLineClamp: customizationMaxLines }}
335
+ >
336
+ {customization}
337
+ </Text>
338
+ )
339
+ : undefined
340
+ }
284
341
  </View>
285
342
  <View className={styles['content-bottom']}>
286
343
  <View className={styles['price-container']}>
287
- <View className={styles['price-row']}><Text className={styles['price-symbol']}>¥</Text><Text className={styles['price-value']}>{salePrice}</Text></View>
288
- {originalPrice && <Text className={styles['original-price']}>¥{originalPrice}</Text>}
344
+ <View className={styles['price-row']}>
345
+ <Text className={styles['price-symbol']}>
346
+ ¥
347
+ </Text>
348
+ <Text className={styles['price-value']}>
349
+ {salePrice}
350
+ </Text>
351
+ </View>
352
+ {
353
+ originalPrice
354
+ ? (
355
+ <Text className={styles['original-price']}>
356
+ ¥{originalPrice}
357
+ </Text>
358
+ )
359
+ : undefined
360
+ }
361
+ </View>
362
+ <View
363
+ className={styles['action-area']}
364
+ >
365
+ {
366
+ buyCount
367
+ ? (
368
+ <Text className={styles['buy-count-value']}>
369
+ x{buyCount}
370
+ </Text>
371
+ )
372
+ : action
373
+ }
289
374
  </View>
290
- <View className={styles['action-area']}>{buyCount ? <Text className={styles['buy-count-value']}>x{buyCount}</Text> : action}</View>
291
375
  </View>
292
376
  </View>
293
377
  </View>
294
- {children && <View className={styles['card-footer']} onClick={e => e.stopPropagation()}>{children}</View>}
295
- {showDelete && <View className={styles['delete-container']} onClick={(e: ITouchEvent) => { e.stopPropagation(); onDelete?.(); }}><Icon name='trash' size={13} className={styles['delete-icon']} /></View>}
378
+ {
379
+ children
380
+ ? (
381
+ <View
382
+ className={styles['card-footer']}
383
+ onClick={e => e.stopPropagation()}
384
+ >
385
+ {children}
386
+ </View>
387
+ )
388
+ : undefined
389
+ }
390
+ {
391
+ showDelete
392
+ ? (
393
+ <View
394
+ className={styles['delete-container']}
395
+ onClick={(e: ITouchEvent) => {
396
+ e.stopPropagation()
397
+ onDelete?.()
398
+ }}
399
+ >
400
+ <Icon
401
+ name='trash'
402
+ size={13}
403
+ className={styles['delete-icon']}
404
+ />
405
+ </View>
406
+ )
407
+ : undefined
408
+ }
296
409
  </View>
297
410
  )
298
411
  }