@tbox.cn/app-module-shopping-guide 0.9.12 → 1.0.0-alpha.6

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.
@@ -7,6 +7,18 @@ import type { ActionDraft } from '@tbox.cn/app-contracts-mall';
7
7
 
8
8
  const HIDDEN_DETAIL_ACTION_LABELS = new Set(['查看详情', '导航', '问问导购']);
9
9
 
10
+ /** 营业状态徽章:基础规格 + 按状态码取色(两段均为完整字面量,禁止拼接) */
11
+ const STATUS_BASE_CLASS = 'sg-status inline-block rounded-full px-2 py-0.5 text-xs leading-4 whitespace-nowrap';
12
+ const STATUS_TONE_CLASS: Record<string, string> = {
13
+ enabled: 'sg-status-enabled text-success bg-success-soft',
14
+ available: 'sg-status-available text-success bg-success-soft',
15
+ open: 'sg-status-open bg-[#e9f8ef] text-[#237a48]',
16
+ offline: 'sg-status-offline bg-[#fff4df] text-[#986415]',
17
+ closed: 'sg-status-closed bg-[#fff4df] text-[#986415]',
18
+ unknown: 'sg-status-unknown bg-[#fff4df] text-[#986415]',
19
+ disabled: 'sg-status-disabled bg-[#fff4df] text-[#986415]',
20
+ };
21
+
10
22
  export interface ShopCouponData {
11
23
  readonly name: string;
12
24
  readonly imageUrl?: string;
@@ -166,27 +178,27 @@ export function ShopDetailSheet(props: {
166
178
 
167
179
  return createPortal(
168
180
  <div
169
- className={`sg-shop-sheet${closing ? ' sg-shop-sheet--closing' : ''}`}
181
+ className={`sg-shop-sheet fixed inset-0 z-[60] text-foreground motion-reduce:[animation-duration:1ms] ${closing ? ' sg-shop-sheet--closing pointer-events-none animate-[sg-shop-sheet-out_180ms_ease-in_both]' : ''}`}
170
182
  role="presentation"
171
183
  onAnimationEnd={(event) => {
172
184
  if (closing && event.target === event.currentTarget) finishClose();
173
185
  }}
174
186
  >
175
- <div className="sg-shop-sheet__mask" aria-hidden="true" onClick={requestClose} />
187
+ <div className="sg-shop-sheet__mask absolute inset-0 bg-[rgba(18,21,19,0.52)] backdrop-blur-[2px]" aria-hidden="true" onClick={requestClose} />
176
188
  <section
177
189
  ref={panelRef}
178
- className="sg-shop-sheet__panel"
190
+ className={`sg-shop-sheet__panel absolute bottom-0 left-1/2 flex h-[86vh] max-h-[86vh] w-[min(100%,375px)] [transform:translateX(-50%)] flex-col overflow-hidden rounded-t-[18px] bg-white shadow-[0_-8px_24px_rgba(24,31,27,0.18)] motion-reduce:[animation-duration:1ms] ${closing ? 'animate-[sg-shop-sheet-down_180ms_ease-in_both]' : 'animate-[sg-shop-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both]'}`}
179
191
  role="dialog"
180
192
  aria-modal="true"
181
193
  aria-labelledby={titleId}
182
194
  aria-busy={loading || undefined}
183
195
  >
184
- <header className="sg-shop-sheet__header">
185
- <h2 id={titleId}>门店详情</h2>
196
+ <header className="sg-shop-sheet__header flex shrink-0 items-center border-b-[0.5px] border-border pt-[13px] pr-3.5 pb-[9px] pl-4">
197
+ <h2 id={titleId} className="min-w-0 flex-1 text-base leading-[22px] font-bold text-[#262c28]">门店详情</h2>
186
198
  <button
187
199
  ref={closeButtonRef}
188
200
  type="button"
189
- className="sg-shop-sheet__close"
201
+ className="sg-shop-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 text-[#343936] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)]"
190
202
  aria-label="关闭门店详情"
191
203
  onClick={requestClose}
192
204
  >
@@ -194,45 +206,45 @@ export function ShopDetailSheet(props: {
194
206
  </button>
195
207
  </header>
196
208
 
197
- <div className="sg-shop-sheet__body">
209
+ <div className="sg-shop-sheet__body min-h-0 flex-1 overflow-y-auto px-4 pb-[calc(19px_+_env(safe-area-inset-bottom))] [&::-webkit-scrollbar]:hidden">
198
210
  {(data.coverUrl || data.logoUrl) && (
199
211
  <ImageWithFallback
200
212
  src={data.coverUrl ?? data.logoUrl}
201
213
  alt=""
202
- className="sg-shop-sheet__cover"
214
+ className="sg-shop-sheet__cover mt-[5px] block h-[150px] w-full max-w-full rounded-[10px] object-cover"
203
215
  size={176}
204
216
  />
205
217
  )}
206
218
 
207
- <div className="sg-shop-sheet__identity">
208
- <div className="sg-shop-sheet__identity-copy">
209
- <div className="sg-shop-sheet__name-row">
210
- <h3>{data.name}</h3>
219
+ <div className="sg-shop-sheet__identity mt-3.5 flex items-start gap-[9px]">
220
+ <div className="sg-shop-sheet__identity-copy min-w-0 flex-1">
221
+ <div className="sg-shop-sheet__name-row flex items-center gap-1.5">
222
+ <h3 className="min-w-0 flex-1 truncate text-lg leading-[23px] font-bold text-[#262c28]">{data.name}</h3>
211
223
  </div>
212
224
  {/* unknown 占位(线上厂商无真实营业状态,恒「营业状态以现场为准」)不显示——
213
225
  2026-09-04 用户裁定,同 MerchantRow 2026-09-02 列表行同结论;营业时间 Clock 行常显 */}
214
226
  {(data.rating || data.avgSpend || (data.status.code !== 'unknown' && data.status.label) || loading) && (
215
- <div className="sg-shop-sheet__stats">
227
+ <div className="sg-shop-sheet__stats mt-[5px] flex flex-wrap items-center gap-x-[9px] gap-y-[5px] text-xs text-secondary-foreground">
216
228
  {data.rating && (
217
- <span className="sg-shop-sheet__rating">
229
+ <span className="sg-shop-sheet__rating inline-flex items-center gap-[2.5px] font-bold text-[#ef8e24]">
218
230
  <Star size={15} weight="fill" />
219
231
  {data.rating}
220
232
  </span>
221
233
  )}
222
234
  {data.avgSpend && <span>人均 {data.avgSpend}</span>}
223
235
  {loading
224
- ? <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--status" aria-hidden="true" />
236
+ ? <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--status block h-[18px] w-[46px] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
225
237
  : data.status.code !== 'unknown' && (
226
- <span className={`sg-status sg-status-${data.status.code}`}>{data.status.label}</span>
238
+ <span className={`${STATUS_BASE_CLASS} ${STATUS_TONE_CLASS[data.status.code] ?? STATUS_TONE_CLASS.unknown}`}>{data.status.label}</span>
227
239
  )}
228
240
  </div>
229
241
  )}
230
242
  </div>
231
243
  {loading ? (
232
- <span className="sg-shop-sheet__phone-skeleton" aria-hidden="true" />
244
+ <span className="sg-shop-sheet__phone-skeleton block size-[39px] shrink-0 rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
233
245
  ) : phone && (
234
246
  <a
235
- className="sg-shop-sheet__phone"
247
+ className="sg-shop-sheet__phone flex size-[39px] no-underline shrink-0 flex-col items-center justify-center gap-[2px] rounded-full bg-[#f6f8fb] text-xs text-[#2f3539]"
236
248
  href={phone.value.startsWith('tel:') ? phone.value : `tel:${phone.value}`}
237
249
  aria-label={`拨打${data.name}电话`}
238
250
  >
@@ -242,41 +254,41 @@ export function ShopDetailSheet(props: {
242
254
  )}
243
255
  </div>
244
256
 
245
- <div className="sg-shop-sheet__facts">
246
- <div>
257
+ <div className="sg-shop-sheet__facts mt-2.5 flex flex-col gap-[5px]">
258
+ <div className="flex flex-wrap items-center gap-1 text-xs leading-4 text-[#858b87]">
247
259
  {data.businessCategories.length > 0 && (
248
260
  <span>{data.businessCategories.join(' · ')}</span>
249
261
  )}
250
- <MapPin size={17} weight="fill" />
251
- <span className="sg-shop-sheet__location">{data.location.displayText}</span>
262
+ <MapPin size={17} weight="fill" className="shrink-0 text-[#2979ff]" />
263
+ <span className="sg-shop-sheet__location text-[#2979ff]">{data.location.displayText}</span>
252
264
  </div>
253
- {!loading && data.operatingStatus && <div>{data.operatingStatus}</div>}
265
+ {!loading && data.operatingStatus && <div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">{data.operatingStatus}</div>}
254
266
  {!loading && (
255
- <div>
256
- <Clock size={18} />
267
+ <div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">
268
+ <Clock size={18} className="shrink-0 text-[#2979ff]" />
257
269
  <span>{hoursText}</span>
258
270
  </div>
259
271
  )}
260
272
  {!loading && data.services && data.services.length > 0 && (
261
- <div>支持{data.services.join('、')}</div>
273
+ <div className="flex items-center gap-1 text-xs leading-4 text-[#858b87]">支持{data.services.join('、')}</div>
262
274
  )}
263
275
  {loading && (
264
- <div className="sg-shop-sheet__facts-skeleton" role="status" aria-label="门店详情加载中">
265
- <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact" aria-hidden="true" />
266
- <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact-short" aria-hidden="true" />
276
+ <div className="sg-shop-sheet__facts-skeleton flex w-full flex-col items-stretch gap-1.5" role="status" aria-label="门店详情加载中">
277
+ <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact block h-3 w-[72%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
278
+ <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--fact-short block h-3 w-[48%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" aria-hidden="true" />
267
279
  </div>
268
280
  )}
269
281
  </div>
270
282
 
271
283
  {loading && (
272
- <div className="sg-shop-sheet__details-skeleton" aria-hidden="true">
273
- <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line" />
274
- <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line-short" />
275
- <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-block" />
284
+ <div className="sg-shop-sheet__details-skeleton mt-3 flex flex-col gap-[7px]" aria-hidden="true">
285
+ <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line block h-3 w-[88%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
286
+ <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-line-short block h-3 w-[62%] rounded-full bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
287
+ <span className="sg-shop-sheet__skeleton sg-shop-sheet__skeleton--detail-block block h-13 w-full rounded-[9px] bg-[#eef0ee] animate-[sg-shop-sheet-skeleton_1.4s_ease-in-out_infinite] motion-reduce:animate-none" />
276
288
  </div>
277
289
  )}
278
290
 
279
- {!loading && data.description && <p className="sg-shop-sheet__description">{data.description}</p>}
291
+ {!loading && data.description && <p className="sg-shop-sheet__description mt-3 text-xs leading-4.5 text-[#666d68]">{data.description}</p>}
280
292
 
281
293
  {!loading && data.coupons && data.coupons.length > 0 && (
282
294
  <div className="sg-shop-sheet__coupons" aria-label="门店优惠">
@@ -284,7 +296,7 @@ export function ShopDetailSheet(props: {
284
296
  <Tag size={16} weight="fill" aria-hidden="true" />
285
297
  优惠活动
286
298
  </h3>
287
- <div className="sg-shop-sheet__coupon-list">
299
+ <div className="sg-shop-sheet__coupon-list bg-transparent p-0">
288
300
  {data.coupons.map((coupon, index) => {
289
301
  const purchaseOnly = coupon.salePrice !== undefined && coupon.salePrice > 0;
290
302
  const redirectOnly = purchaseOnly || coupon.freeCouponClaimMode === 'REDIRECT';
@@ -293,10 +305,10 @@ export function ShopDetailSheet(props: {
293
305
  const redirectAction = redirectOnly && Boolean(coupon.offerRef || coupon.purchaseUrl);
294
306
  const claimed = coupon.offerRef !== undefined && claimedRefs.has(coupon.offerRef);
295
307
  return (
296
- <div key={index} className="sg-shop-sheet__coupon-row">
308
+ <div key={index} className="sg-shop-sheet__coupon-row relative grid min-h-[77px] grid-cols-[56px_minmax(0,1fr)_auto] items-center gap-x-2 overflow-hidden border-t-[0.5px] border-[#f0f1f4] bg-transparent py-[9px] first:border-t-0">
297
309
  {/* 右上角金色类型标签(useBusinessType → applicableCategories,样式对齐神券类目标签) */}
298
310
  {coupon.applicableCategories && coupon.applicableCategories.length > 0 && (
299
- <span className="sg-shop-sheet__coupon-tag">
311
+ <span className="sg-shop-sheet__coupon-tag absolute top-[9px] right-0 max-w-[40%] truncate rounded-[0_6px_0_6px] bg-[linear-gradient(160deg,#f9e2ac_0%,#dabd88_100%)] px-[5px] py-[1.5px] text-xs leading-3 font-[650] text-[#746447]">
300
312
  {coupon.applicableCategories.join('、')}
301
313
  </span>
302
314
  )}
@@ -304,39 +316,39 @@ export function ShopDetailSheet(props: {
304
316
  <ImageWithFallback
305
317
  src={coupon.imageUrl}
306
318
  alt={coupon.name}
307
- className="sg-shop-sheet__coupon-img"
319
+ className="sg-shop-sheet__coupon-img size-14 shrink-0 max-w-full rounded-[6px] object-cover shadow-[inset_0_0_0_0.5px_rgba(11,15,23,0.04)]"
308
320
  size={112}
309
321
  />
310
322
  )}
311
- <div className="sg-shop-sheet__coupon-body">
312
- <strong className="sg-shop-sheet__coupon-name">{coupon.name}</strong>
323
+ <div className="sg-shop-sheet__coupon-body flex min-w-0 flex-1 flex-col justify-center gap-[2.5px]">
324
+ <strong className="sg-shop-sheet__coupon-name line-clamp-2 text-xs leading-[15px] font-[750] text-[rgba(11,15,23,0.9)]">{coupon.name}</strong>
313
325
  {coupon.faceValue !== undefined && (
314
- <p className="sg-shop-sheet__coupon-price">
326
+ <p className="sg-shop-sheet__coupon-price mt-px flex items-baseline gap-1">
315
327
  {/* 价格行角色对齐神券行(2026-09-05):主价格 = 售价、划线 = 原面值;
316
328
  售价缺省退回面值为主。免费券主价格 =「免费」+ 面值划线(2026-09-05 文案对齐) */}
317
329
  {coupon.salePrice === 0
318
330
  ? <>
319
- <span className="sg-shop-sheet__coupon-free">免费</span>
320
- <s className="sg-shop-sheet__coupon-face--strike">¥{coupon.faceValue}</s>
331
+ <span className="sg-shop-sheet__coupon-free text-sm leading-4 font-extrabold text-[#e8471c]">免费</span>
332
+ <s className="sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]">¥{coupon.faceValue}</s>
321
333
  </>
322
334
  : coupon.salePrice !== undefined
323
335
  ? <>
324
- <span className="sg-shop-sheet__coupon-face">¥{coupon.salePrice}</span>
325
- <s className="sg-shop-sheet__coupon-face--strike">¥{coupon.faceValue}</s>
336
+ <span className="sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]">¥{coupon.salePrice}</span>
337
+ <s className="sg-shop-sheet__coupon-face--strike overflow-hidden text-xs line-through text-[rgba(11,15,23,0.38)]">¥{coupon.faceValue}</s>
326
338
  </>
327
- : <span className="sg-shop-sheet__coupon-face">¥{coupon.faceValue}</span>}
339
+ : <span className="sg-shop-sheet__coupon-face text-sm leading-4 font-extrabold text-[#e8471c]">¥{coupon.faceValue}</span>}
328
340
  </p>
329
341
  )}
330
342
  {/* sub 行职责 = 可用时间文案(useWeekTime 解析,provider 直出;
331
343
  适用分类已上移为右上角标签,validHours 不再展示(2026-09-05) */}
332
344
  {coupon.usageTimeText && (
333
- <p className="sg-shop-sheet__coupon-sub">{coupon.usageTimeText}</p>
345
+ <p className="sg-shop-sheet__coupon-sub line-clamp-2 text-xs leading-[11.5px] text-[rgba(11,15,23,0.55)]">{coupon.usageTimeText}</p>
334
346
  )}
335
347
  </div>
336
348
  {redirectAction ? (
337
349
  <button
338
350
  type="button"
339
- className="sg-shop-sheet__coupon-claim"
351
+ className="sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45"
340
352
  disabled={!coupon.purchaseUrl}
341
353
  onClick={() => {
342
354
  if (!coupon.purchaseUrl) return;
@@ -352,7 +364,7 @@ export function ShopDetailSheet(props: {
352
364
  ) : claimable && coupon.offerRef ? (
353
365
  <button
354
366
  type="button"
355
- className="sg-shop-sheet__coupon-claim"
367
+ className="sg-shop-sheet__coupon-claim h-8 min-w-12 shrink-0 cursor-pointer rounded-full border-0 bg-[linear-gradient(160deg,#c3ad78_0%,#a89058_100%)] px-[7.5px] text-xs font-bold tracking-[0.5px] text-white enabled:hover:bg-[linear-gradient(160deg,#b39d68_0%,#967f4a_100%)] disabled:cursor-not-allowed disabled:opacity-45"
356
368
  onClick={() => claimCoupon(coupon.offerRef!)}
357
369
  disabled={claimingRef === coupon.offerRef || claimed}
358
370
  >
@@ -371,8 +383,8 @@ export function ShopDetailSheet(props: {
371
383
  actions={detailActions}
372
384
  cardId={cardId}
373
385
  isHistory={isHistory}
374
- className="sg-shop-sheet__actions"
375
- chipClassName="sg-shop-sheet__action"
386
+ className="sg-shop-sheet__actions mt-[15px] flex gap-1.5"
387
+ chipClassName="sg-shop-sheet__action inline-flex min-h-9 flex-1 items-center justify-center rounded-[9px] border-0 bg-[#313833] px-3 text-xs font-semibold text-white disabled:opacity-48"
376
388
  />
377
389
  )}
378
390
  </div>
@@ -8,16 +8,16 @@ import { Storefront } from '@phosphor-icons/react';
8
8
 
9
9
  export function ShopGuideHeader(props: { readonly subtitle: string }) {
10
10
  return (
11
- <header className="sg-rm-header">
11
+ <header className="sg-rm-header relative -mx-3 flex min-h-[77px] items-start justify-between gap-2 overflow-hidden bg-[#f9f0df] px-3.5 py-[15px] after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-[62%] after:bg-[image:var(--tbox-asset-sg-header,linear-gradient(135deg,#f9f0df,#f3e5cd))] after:bg-cover after:bg-right after:opacity-90">
12
12
  {/* 头图经 CSS background(.sg-rm-header::after + --tbox-asset-sg-header 变量链,主题轨 T-2.3) */}
13
- <div className="sg-rm-header-copy">
14
- <div className="sg-rm-header-title-row">
13
+ <div className="sg-rm-header-copy relative z-[1] flex max-w-[66%] flex-col gap-[5px]">
14
+ <div className="sg-rm-header-title-row flex items-center gap-[5px] text-[#2f3a22]">
15
15
  <Storefront size={22} weight="fill" />
16
- <h3 className="sg-rm-header-title">门店导览</h3>
16
+ <h3 className="sg-rm-header-title text-base leading-[21px] font-bold text-[#2f3a22]">门店导览</h3>
17
17
  </div>
18
- <p className="sg-rm-header-subtitle">{props.subtitle}</p>
18
+ <p className="sg-rm-header-subtitle truncate text-xs leading-4 text-[#626b5c]">{props.subtitle}</p>
19
19
  </div>
20
- <span className="sg-rm-header-badge">商场导览</span>
20
+ <span className="sg-rm-header-badge absolute top-3 right-[11px] z-[2] rounded-full border-[0.5px] border-[rgba(57,76,43,0.14)] bg-[rgba(255,255,255,0.72)] px-[7px] py-[3.5px] text-xs leading-[13px] text-[#526a35]">商场导览</span>
21
21
  </header>
22
22
  );
23
23
  }
@@ -6,5 +6,5 @@
6
6
  * 半屏浮层因有搜索与筛选、列表可能很长,保留自己的「当前显示 N 家门店」计数行。
7
7
  */
8
8
  export function ShopGuideSectionLabel() {
9
- return <div className="sg-rm-section-label">门店</div>;
9
+ return <div className="sg-rm-section-label mt-3.5 flex items-center justify-start gap-[7px] text-sm font-bold text-foreground">门店</div>;
10
10
  }
@@ -47,6 +47,20 @@ function floorOrder(a: string, b: string) {
47
47
  : numeric;
48
48
  }
49
49
 
50
+ const SHEET_ROOT_CLASS = 'sg-store-list-sheet fixed inset-0 z-[60] text-foreground motion-reduce:[animation-duration:1ms]';
51
+ const SHEET_PANEL_CLASS =
52
+ 'sg-store-list-sheet__panel absolute bottom-0 left-1/2 flex h-[86vh] max-h-[86vh] w-[min(100%,375px)] [transform:translateX(-50%)] flex-col overflow-hidden rounded-t-[18px] bg-white shadow-[0_-8px_24px_rgba(24,31,27,0.18)] motion-reduce:[animation-duration:1ms]';
53
+ /** 业态按钮:选中态(is-active)与默认态各一串完整字面量,避免拼接。 */
54
+ const CATEGORY_BUTTON_CLASS =
55
+ 'relative min-h-[46px] shrink-0 border-0 bg-transparent px-[9px] py-[7px] text-center text-sm leading-4.5 text-[#4f5551] [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)] max-[700px]:px-[5px] max-[700px]:text-xs';
56
+ const CATEGORY_BUTTON_ACTIVE_CLASS =
57
+ 'is-active relative min-h-[46px] shrink-0 border-0 bg-white px-[9px] py-[7px] text-center text-sm leading-4.5 font-bold text-[#273c2d] [font-family:inherit] before:absolute before:top-[13px] before:bottom-[13px] before:left-0 before:w-[3px] before:rounded-r-[3px] before:bg-[#6c8753] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)] max-[700px]:px-[5px] max-[700px]:text-xs';
58
+ /** 楼层按钮:同上,两态各一串。 */
59
+ const FLOOR_BUTTON_CLASS =
60
+ 'min-h-[23px] border-0 bg-transparent px-[3px] text-xs text-[#7c827e] [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)]';
61
+ const FLOOR_BUTTON_ACTIVE_CLASS =
62
+ 'is-active min-h-[23px] border-0 bg-[#30372f] px-[3px] text-xs text-white [font-family:inherit] focus-visible:z-[1] focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1.5px] focus-visible:outline-[rgba(45,98,69,0.2)]';
63
+
50
64
  export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
51
65
  readonly open: boolean;
52
66
  readonly items: readonly T[];
@@ -183,23 +197,29 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
183
197
 
184
198
  return createPortal(
185
199
  <div
186
- className={`sg-store-list-sheet${closing ? ' sg-store-list-sheet--closing' : ''}`}
200
+ className={`${SHEET_ROOT_CLASS}${closing ? ' sg-store-list-sheet--closing pointer-events-none animate-[sg-shop-sheet-out_180ms_ease-in_both]' : ''}`}
187
201
  role="presentation"
188
202
  onAnimationEnd={(event) => {
189
203
  if (closing && event.target === event.currentTarget) finishClose();
190
204
  }}
191
205
  >
192
- <div className="sg-store-list-sheet__mask" aria-hidden="true" onClick={requestClose} />
193
- <section ref={panelRef} className="sg-store-list-sheet__panel" role="dialog" aria-modal="true" aria-labelledby={titleId}>
194
- <header className="sg-store-list-sheet__header">
195
- <h2 id={titleId}>门店导览</h2>
196
- <button ref={closeButtonRef} type="button" className="sg-store-list-sheet__close" aria-label="关闭门店列表" onClick={requestClose}>
206
+ <div className="sg-store-list-sheet__mask absolute inset-0 bg-[rgba(18,21,19,0.52)] backdrop-blur-[2px]" aria-hidden="true" onClick={requestClose} />
207
+ <section
208
+ ref={panelRef}
209
+ className={`${SHEET_PANEL_CLASS} ${closing ? 'animate-[sg-shop-sheet-down_180ms_ease-in_both]' : 'animate-[sg-shop-sheet-in_240ms_cubic-bezier(0.22,0.72,0.24,1)_both]'}`}
210
+ role="dialog"
211
+ aria-modal="true"
212
+ aria-labelledby={titleId}
213
+ >
214
+ <header className="sg-store-list-sheet__header flex min-h-[52px] shrink-0 items-center pt-[9px] pr-3 pb-[5px] pl-[18px]">
215
+ <h2 id={titleId} className="flex min-w-0 flex-1 items-center justify-center gap-[5px] pl-7 text-lg leading-6">门店导览</h2>
216
+ <button ref={closeButtonRef} type="button" className="sg-store-list-sheet__close flex size-7 shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 text-[#343936] focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.28)]" aria-label="关闭门店列表" onClick={requestClose}>
197
217
  <X size={20} weight="bold" />
198
218
  </button>
199
219
  </header>
200
220
 
201
- <div className="sg-store-list-sheet__search">
202
- <label className="sg-visually-hidden" htmlFor={searchId}>搜索门店</label>
221
+ <div className="sg-store-list-sheet__search mx-[15px] mt-[2px] mb-[9px] flex min-h-[38px] shrink-0 items-center gap-[7px] rounded-[9px] bg-[#f2f3f2] px-[11px] text-[#777d79] focus-within:shadow-[0_0_0_1.5px_rgba(45,98,69,0.16)]">
222
+ <label className="sg-visually-hidden sr-only" htmlFor={searchId}>搜索门店</label>
203
223
  <MagnifyingGlass size={18} aria-hidden="true" />
204
224
  <input
205
225
  id={searchId}
@@ -207,19 +227,20 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
207
227
  value={query}
208
228
  placeholder="请输入要搜索的店铺名"
209
229
  onChange={(event) => setQuery(event.target.value)}
230
+ className="h-[34px] min-w-0 flex-1 appearance-none rounded-none border-0 bg-transparent p-0 text-sm text-[#242724] [font-family:inherit] outline-none placeholder:text-[#a7aba8] [&::-webkit-search-cancel-button]:hidden"
210
231
  />
211
232
  {query && (
212
- <button type="button" aria-label="清空门店搜索" onClick={() => setQuery('')}>
233
+ <button type="button" className="flex size-6 shrink-0 items-center justify-center rounded-full border-0 bg-[#dadeda] p-0 text-[#5f6561]" aria-label="清空门店搜索" onClick={() => setQuery('')}>
213
234
  <X size={14} weight="bold" />
214
235
  </button>
215
236
  )}
216
237
  </div>
217
238
 
218
- <div className="sg-store-list-sheet__content">
219
- <nav className="sg-store-list-sheet__categories" aria-label="按门店业态筛选">
239
+ <div className="sg-store-list-sheet__content relative grid min-h-0 flex-1 grid-cols-[82px_minmax(0,1fr)] overflow-hidden border-t-[0.5px] border-[#f0f1ef] max-[700px]:grid-cols-[74px_minmax(0,1fr)]">
240
+ <nav className="sg-store-list-sheet__categories flex min-h-0 flex-col overflow-y-auto bg-[#f5f6f7] pt-[7px] pb-[calc(22px_+_env(safe-area-inset-bottom))] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" aria-label="按门店业态筛选">
220
241
  <button
221
242
  type="button"
222
- className={!sheetTabCode ? 'is-active' : undefined}
243
+ className={!sheetTabCode ? CATEGORY_BUTTON_ACTIVE_CLASS : CATEGORY_BUTTON_CLASS}
223
244
  aria-pressed={!sheetTabCode}
224
245
  onClick={() => setSheetTabCode('')}
225
246
  >
@@ -231,7 +252,7 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
231
252
  <button
232
253
  key={tab.code}
233
254
  type="button"
234
- className={isActive ? 'is-active' : undefined}
255
+ className={isActive ? CATEGORY_BUTTON_ACTIVE_CLASS : CATEGORY_BUTTON_CLASS}
235
256
  aria-pressed={isActive}
236
257
  onClick={() => setSheetTabCode(tab.code)}
237
258
  >
@@ -241,17 +262,17 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
241
262
  })}
242
263
  </nav>
243
264
 
244
- <div ref={bodyRef} className="sg-store-list-sheet__body">
245
- <p className="sg-store-list-sheet__count" aria-live="polite">当前显示 {filteredItems.length} 家门店</p>
265
+ <div ref={bodyRef} className="sg-store-list-sheet__body min-h-0 min-w-0 flex-1 overflow-y-auto bg-[#f7f8f6] px-3 pb-[calc(27px_+_env(safe-area-inset-bottom))] [scroll-padding-top:30px] [&::-webkit-scrollbar]:hidden max-[700px]:px-[9px]">
266
+ <p className="sg-store-list-sheet__count sticky top-0 z-[2] -mx-px bg-[rgba(247,248,246,0.96)] px-px pt-[9px] pb-[5px] text-xs leading-[15px] text-[#939894]" aria-live="polite">当前显示 {filteredItems.length} 家门店</p>
246
267
  {filteredItems.length === 0 ? (
247
- <div className="sg-store-list-sheet__empty">暂时没有符合条件的门店</div>
268
+ <div className="sg-store-list-sheet__empty px-2.5 py-16 text-center text-sm text-secondary-foreground">暂时没有符合条件的门店</div>
248
269
  ) : (
249
- <ul className="sg-store-list-sheet__list">
270
+ <ul className="sg-store-list-sheet__list m-0 flex list-none flex-col gap-2 p-0">
250
271
  {filteredItems.map((item) => (
251
- <li key={item.merchantId}>
272
+ <li key={item.merchantId} className="border-0 [scroll-margin-top:32px]">
252
273
  <MerchantRow
253
274
  merchant={item}
254
- className="sg-store-list-sheet__item"
275
+ className="sg-store-list-sheet__item min-h-[86px] items-center rounded-[9px] bg-white p-[9px] shadow-[0_2px_8px_rgba(34,42,37,0.05)] focus-visible:rounded-[8px] focus-visible:outline-offset-[1.5px] disabled:cursor-default disabled:opacity-72"
255
276
  onSelect={() => onSelect(item)}
256
277
  />
257
278
  </li>
@@ -261,12 +282,12 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
261
282
  </div>
262
283
 
263
284
  {showFloorRail && (
264
- <nav className="sg-store-list-sheet__floors" aria-label="按楼层筛选">
285
+ <nav className="sg-store-list-sheet__floors absolute right-1 bottom-[calc(30px_+_env(safe-area-inset-bottom))] z-[3] flex w-[35px] flex-col overflow-hidden rounded-[15px] border-[0.5px] border-[#eceeeb] bg-[rgba(255,255,255,0.95)] py-1 shadow-[0_3px_10px_rgba(29,36,31,0.12)]" aria-label="按楼层筛选">
265
286
  {/* 显式的「全」而非再点一次取消:这条轨是窄条,选中态之外没有别的地方能提示
266
287
  「还能退回全部」,靠隐式 toggle 会把人卡在某一层里。 */}
267
288
  <button
268
289
  type="button"
269
- className={!activeFloor ? 'is-active' : undefined}
290
+ className={!activeFloor ? FLOOR_BUTTON_ACTIVE_CLASS : FLOOR_BUTTON_CLASS}
270
291
  aria-pressed={!activeFloor}
271
292
  onClick={() => setActiveFloor('')}
272
293
  >
@@ -276,7 +297,7 @@ export function ShopListSheet<T extends ShopListSheetMerchant>(props: {
276
297
  <button
277
298
  key={floor}
278
299
  type="button"
279
- className={activeFloor === floor ? 'is-active' : undefined}
300
+ className={activeFloor === floor ? FLOOR_BUTTON_ACTIVE_CLASS : FLOOR_BUTTON_CLASS}
280
301
  aria-pressed={activeFloor === floor}
281
302
  onClick={() => setActiveFloor(floor)}
282
303
  >
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * module-shopping-guide 客户端入口(与服务端 serverModule 对称)。
3
3
  */
4
- import './styles/shopping-guide.css'; // 0.4.0 模块自持 CSS(副作用 import,首行保证先行加载)
5
-
6
4
  import type { CardComponent } from '@tbox.cn/app-contracts';
7
5
  import type { ClientContext, ClientModule } from '@tbox.cn/app-agent-sdk-client';
8
6
  import {
package/tbox.module.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "id": "module-shopping-guide",
4
4
  "name": "门店导览",
5
5
  "description": "支持商品与商户搜索、分类浏览、商场导览和人工导购预约",
6
- "version": "0.3.0",
7
6
  "kind": "business",
8
7
  "risk": {
9
8
  "level": "medium",
package/tsup.config.ts CHANGED
@@ -27,11 +27,6 @@ export default defineConfig({
27
27
  'express',
28
28
  '@phosphor-icons/react',
29
29
  ],
30
- // 0.3.2/0.4.0 D1:模块自持 CSS 出货链。
31
- // 顶层 loader 写法(实测:esbuildOptions 内设 loader 被 tsup 覆盖失效——CSS 提取断链静默丢失)。
32
- loader: {
33
- '.css': 'copy',
34
- },
35
30
  esbuildOptions(options) {
36
31
  options.jsx = 'automatic';
37
32
  },