@sarunyu/system-one 3.0.2 → 4.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.
- package/AGENTS.md +102 -0
- package/README.md +75 -39
- package/dist/index.cjs +1109 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1111 -260
- package/dist/index.js.map +1 -1
- package/dist/src/components/card.d.ts +34 -11
- package/dist/src/components/card.d.ts.map +1 -1
- package/dist/src/components/checkbox.d.ts +28 -0
- package/dist/src/components/checkbox.d.ts.map +1 -0
- package/dist/src/components/input.d.ts.map +1 -1
- package/dist/src/components/radio.d.ts +27 -0
- package/dist/src/components/radio.d.ts.map +1 -0
- package/dist/src/components/table.d.ts +50 -0
- package/dist/src/components/table.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/llms.txt +565 -269
- package/package.json +4 -2
- package/dist/src/components/layout.d.ts +0 -50
- package/dist/src/components/layout.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -248,17 +248,78 @@ const Button = React.forwardRef(function Button2({
|
|
|
248
248
|
});
|
|
249
249
|
Button.displayName = "Button";
|
|
250
250
|
const imgBanner = "";
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
251
|
+
function DurationBadge({
|
|
252
|
+
duration,
|
|
253
|
+
size
|
|
254
|
+
}) {
|
|
255
|
+
const isUpcoming = duration === "upcoming";
|
|
256
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: cn(
|
|
260
|
+
"absolute flex items-center gap-[4px] rounded-[4px] bg-black/60",
|
|
261
|
+
size === "lg" ? "bottom-[6px] right-[6px] h-[20px] px-[4px]" : "bottom-[4px] right-[4px] h-[16px] px-[2px]"
|
|
262
|
+
),
|
|
263
|
+
children: [
|
|
264
|
+
isUpcoming && /* @__PURE__ */ jsxRuntime.jsx(react.BroadcastIcon, { size: 14, className: "text-white" }),
|
|
265
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
266
|
+
"p",
|
|
267
|
+
{
|
|
268
|
+
className: cn(
|
|
269
|
+
"whitespace-nowrap font-normal text-white",
|
|
270
|
+
size === "lg" ? "text-[14px] leading-[20px]" : "text-[12px] leading-[16px]"
|
|
271
|
+
),
|
|
272
|
+
children: isUpcoming ? "Up Coming" : duration
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
);
|
|
256
278
|
}
|
|
257
|
-
function
|
|
258
|
-
|
|
279
|
+
function LockBadgeChip({ flush = false }) {
|
|
280
|
+
const corner = flush ? "rounded-none rounded-bl-[4px]" : "rounded-[4px]";
|
|
281
|
+
const borderRing = flush ? "border-0 border-b border-l border-solid border-border" : "border border-solid border-border";
|
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
className: cn(
|
|
286
|
+
"relative flex items-center gap-[4px] bg-hover-bg px-[6px] py-[4px]",
|
|
287
|
+
corner
|
|
288
|
+
),
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
"aria-hidden": "true",
|
|
294
|
+
className: cn(
|
|
295
|
+
"pointer-events-none absolute inset-0",
|
|
296
|
+
borderRing,
|
|
297
|
+
corner
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Lock, { size: 16, weight: "regular", color: "var(--subtle-text)" }),
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-nowrap text-[12px] leading-[18px] text-subtle-text", children: "Lock" })
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
);
|
|
259
306
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
307
|
+
function LockBadge({
|
|
308
|
+
align = "left",
|
|
309
|
+
flush = false,
|
|
310
|
+
size = "desktop"
|
|
311
|
+
}) {
|
|
312
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
className: cn(
|
|
316
|
+
"absolute z-10",
|
|
317
|
+
flush ? "top-0" : size === "mobile" ? "top-[6px]" : "top-[8px]",
|
|
318
|
+
align === "left" ? flush ? "left-0" : size === "mobile" ? "left-[6px]" : "left-[8px]" : flush ? "right-0" : size === "mobile" ? "right-[6px]" : "right-[8px]"
|
|
319
|
+
),
|
|
320
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(LockBadgeChip, { flush })
|
|
321
|
+
}
|
|
322
|
+
);
|
|
262
323
|
}
|
|
263
324
|
const tagConfig = {
|
|
264
325
|
"not-registered": {
|
|
@@ -269,287 +330,775 @@ const tagConfig = {
|
|
|
269
330
|
registered: {
|
|
270
331
|
bg: "var(--success-bg)",
|
|
271
332
|
text: "var(--success)",
|
|
272
|
-
label: "ลงทะเบียนแล้ว"
|
|
333
|
+
label: "ลงทะเบียนแล้ว",
|
|
334
|
+
Icon: react.CheckCircle
|
|
273
335
|
},
|
|
274
336
|
full: {
|
|
275
337
|
bg: "var(--error-bg)",
|
|
276
338
|
text: "var(--destructive)",
|
|
277
|
-
label: "เต็มแล้ว"
|
|
339
|
+
label: "เต็มแล้ว",
|
|
340
|
+
Icon: react.XCircle
|
|
278
341
|
}
|
|
279
342
|
};
|
|
280
343
|
const Card = React.forwardRef(function Card2({
|
|
281
|
-
variant = "
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
344
|
+
variant = "event",
|
|
345
|
+
size = "desktop",
|
|
346
|
+
title,
|
|
347
|
+
locked = true,
|
|
348
|
+
image,
|
|
349
|
+
className,
|
|
350
|
+
// event
|
|
351
|
+
date,
|
|
352
|
+
time,
|
|
353
|
+
location,
|
|
286
354
|
showLocation = true,
|
|
287
355
|
showAudience = true,
|
|
288
356
|
count = "200/200",
|
|
289
|
-
locked = true,
|
|
290
357
|
tagStatus = "not-registered",
|
|
291
|
-
|
|
292
|
-
|
|
358
|
+
// news
|
|
359
|
+
category,
|
|
360
|
+
bookmarked = false,
|
|
361
|
+
onBookmarkToggle,
|
|
362
|
+
// social
|
|
363
|
+
tags,
|
|
364
|
+
source,
|
|
365
|
+
// live
|
|
366
|
+
duration
|
|
293
367
|
}, ref) {
|
|
294
|
-
const widthClass = variant === "desktop" ? "w-[308px]" : variant === "tablet" ? "w-[224px]" : "w-[163px]";
|
|
295
|
-
const padding = variant === "desktop" ? "p-4" : variant === "tablet" ? "p-3" : "p-2.5";
|
|
296
|
-
const titleGap = variant === "desktop" ? "gap-1.5" : "gap-1";
|
|
297
|
-
const bannerClass = variant === "desktop" ? "h-[173px]" : "aspect-video w-full";
|
|
298
|
-
const tag = tagConfig[tagStatus];
|
|
299
368
|
const bannerSrc = image ?? imgBanner;
|
|
369
|
+
if (variant === "social") {
|
|
370
|
+
const isDesktop = size === "desktop";
|
|
371
|
+
const cardWidth = isDesktop ? "w-[587px]" : "w-[343px]";
|
|
372
|
+
const cardPadding = isDesktop ? "p-4" : "p-3";
|
|
373
|
+
const cardGap = isDesktop ? "gap-3" : "gap-2";
|
|
374
|
+
const contentGap = isDesktop ? "gap-6" : "gap-3";
|
|
375
|
+
const textGap = isDesktop ? "gap-[10px]" : "gap-[6px]";
|
|
376
|
+
const titleText = isDesktop ? "text-[16px] leading-[24px]" : "text-[12px] leading-[16px]";
|
|
377
|
+
const tagChip = isDesktop ? "rounded-[4px] px-[6px] py-[4px] text-[12px] leading-[16px]" : "rounded-[4px] px-[4px] py-[2px] text-[9px] leading-[14px]";
|
|
378
|
+
const resolvedTags = tags ?? [
|
|
379
|
+
{
|
|
380
|
+
label: "Analysis",
|
|
381
|
+
bg: "var(--tag-bg-blue, #F3F8FE)",
|
|
382
|
+
text: "var(--tag-text-blue, #095EC4)"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
label: "Stock",
|
|
386
|
+
bg: "var(--tag-bg-cyan, #F3F8FE)",
|
|
387
|
+
text: "var(--tag-text-cyan, #095EC4)"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
label: "My Asset",
|
|
391
|
+
bg: "var(--tag-bg-purple, #F3E8FF)",
|
|
392
|
+
text: "var(--tag-text-purple, #59168B)"
|
|
393
|
+
}
|
|
394
|
+
];
|
|
395
|
+
const resolvedTitle = title ?? "การออกแบบที่ตอบโจทย์ผู้ใช้: สร้างประสบการณ์ที่น่าจดจำ asdasdasdas";
|
|
396
|
+
const resolvedSource = source ?? "Wealth Design Daily";
|
|
397
|
+
const resolvedDate = date ?? "9 ธันวาคม 2567";
|
|
398
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
ref,
|
|
402
|
+
className: cn(
|
|
403
|
+
"relative flex flex-col overflow-clip bg-card shadow-card",
|
|
404
|
+
isDesktop ? "rounded-[8px]" : "rounded-[6px]",
|
|
405
|
+
cardWidth,
|
|
406
|
+
cardPadding,
|
|
407
|
+
cardGap,
|
|
408
|
+
className
|
|
409
|
+
),
|
|
410
|
+
children: [
|
|
411
|
+
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, { align: "right", flush: true }),
|
|
412
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-row items-start", contentGap), children: [
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", textGap), children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-[8px]", children: resolvedTags.map((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
"span",
|
|
416
|
+
{
|
|
417
|
+
className: cn(
|
|
418
|
+
"inline-flex whitespace-nowrap font-normal",
|
|
419
|
+
tagChip
|
|
420
|
+
),
|
|
421
|
+
style: {
|
|
422
|
+
backgroundColor: t.bg ?? "var(--disabled-bg)",
|
|
423
|
+
color: t.text ?? "var(--foreground)"
|
|
424
|
+
},
|
|
425
|
+
children: t.label
|
|
426
|
+
},
|
|
427
|
+
t.label
|
|
428
|
+
)) }),
|
|
429
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
430
|
+
"p",
|
|
431
|
+
{
|
|
432
|
+
className: cn(
|
|
433
|
+
"line-clamp-2 font-semibold text-foreground",
|
|
434
|
+
titleText
|
|
435
|
+
),
|
|
436
|
+
children: resolvedTitle
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-[84px] w-[149px] shrink-0 overflow-clip rounded-[6px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
441
|
+
"img",
|
|
442
|
+
{
|
|
443
|
+
alt: "social thumbnail",
|
|
444
|
+
className: "pointer-events-none absolute inset-0 size-full object-cover",
|
|
445
|
+
src: bannerSrc
|
|
446
|
+
}
|
|
447
|
+
) })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
450
|
+
isDesktop ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-[12px]", children: [
|
|
451
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 text-[12px] leading-[16px] text-subtle-text", children: resolvedSource }),
|
|
452
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 truncate text-[12px] leading-[16px] text-muted-foreground", children: resolvedDate })
|
|
453
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] leading-[16px] text-subtle-text", children: resolvedSource }),
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] leading-[16px] text-muted-foreground", children: resolvedDate })
|
|
456
|
+
] }),
|
|
457
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
458
|
+
"button",
|
|
459
|
+
{
|
|
460
|
+
"aria-label": bookmarked ? "Remove bookmark" : "Add bookmark",
|
|
461
|
+
className: "flex size-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-hover-bg cursor-pointer",
|
|
462
|
+
onClick: onBookmarkToggle,
|
|
463
|
+
type: "button",
|
|
464
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
react.BookmarkSimpleIcon,
|
|
466
|
+
{
|
|
467
|
+
size: 23.65,
|
|
468
|
+
weight: bookmarked ? "fill" : "regular",
|
|
469
|
+
color: bookmarked ? "var(--primary-action)" : "var(--subtle-text)"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
] })
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
if (variant === "live") {
|
|
480
|
+
const isDesktop = size === "desktop";
|
|
481
|
+
const cardWidth = isDesktop ? "w-[704px]" : "w-[343px]";
|
|
482
|
+
const imgWidth = isDesktop ? "w-[212px]" : "w-[149px]";
|
|
483
|
+
const imgHeight = isDesktop ? "h-[119px]" : "h-[84px]";
|
|
484
|
+
const padding2 = isDesktop ? "p-4" : "p-3";
|
|
485
|
+
const gap = isDesktop ? "gap-6" : "gap-3";
|
|
486
|
+
const cardRadius = isDesktop ? "rounded-[8px]" : "rounded-[6px]";
|
|
487
|
+
const thumbRadius = isDesktop ? "rounded-[6px]" : "rounded-[4px]";
|
|
488
|
+
const metaTextClass = isDesktop ? "flex min-w-0 items-center gap-[12px]" : "flex min-w-0 flex-col";
|
|
489
|
+
const resolvedTitle = title ?? "6 หุ้นเด่นทางเทคนิค OSP, BTS, BANPU, SECURE, AH, DCC [TECHNICAL VIEW 17/07/2567]";
|
|
490
|
+
const resolvedSource = source ?? "Wealth Design Daily";
|
|
491
|
+
const resolvedDate = date ?? "9 ธันวาคม 2567";
|
|
492
|
+
const resolvedDuration = duration ?? "1:26:36";
|
|
493
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
494
|
+
"div",
|
|
495
|
+
{
|
|
496
|
+
ref,
|
|
497
|
+
className: cn(
|
|
498
|
+
"flex flex-col overflow-clip bg-card shadow-card",
|
|
499
|
+
cardRadius,
|
|
500
|
+
cardWidth,
|
|
501
|
+
className
|
|
502
|
+
),
|
|
503
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-row items-stretch", padding2, gap), children: [
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-between", children: [
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
+
"p",
|
|
507
|
+
{
|
|
508
|
+
className: cn(
|
|
509
|
+
"min-w-0 line-clamp-2 font-semibold text-foreground",
|
|
510
|
+
isDesktop ? "text-[16px] leading-[24px]" : "text-[12px] leading-[16px]"
|
|
511
|
+
),
|
|
512
|
+
children: resolvedTitle
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: metaTextClass, children: [
|
|
516
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 text-xs leading-4 text-subtle-text", children: resolvedSource }),
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 truncate text-xs leading-4 text-muted-foreground", children: resolvedDate })
|
|
518
|
+
] })
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
521
|
+
"div",
|
|
522
|
+
{
|
|
523
|
+
className: cn(
|
|
524
|
+
"relative shrink-0 overflow-clip",
|
|
525
|
+
thumbRadius,
|
|
526
|
+
imgWidth,
|
|
527
|
+
imgHeight
|
|
528
|
+
),
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
+
"img",
|
|
532
|
+
{
|
|
533
|
+
alt: "live thumbnail",
|
|
534
|
+
className: "pointer-events-none absolute inset-0 size-full object-cover",
|
|
535
|
+
src: bannerSrc
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
539
|
+
"div",
|
|
540
|
+
{
|
|
541
|
+
className: "absolute h-[22px] left-[6px] top-[6px] flex items-center gap-[4px] rounded-[4px] px-[6px]",
|
|
542
|
+
style: { backgroundColor: "#FB2C36" },
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-[6px] shrink-0 rounded-full bg-white" }),
|
|
545
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-nowrap text-[12px] font-semibold leading-[16px] text-white", children: "Live" })
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
DurationBadge,
|
|
551
|
+
{
|
|
552
|
+
duration: resolvedDuration,
|
|
553
|
+
size: isDesktop ? "lg" : "sm"
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
]
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
] })
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
if (variant === "news" && size === "desktop") {
|
|
564
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
565
|
+
"div",
|
|
566
|
+
{
|
|
567
|
+
ref,
|
|
568
|
+
className: cn(
|
|
569
|
+
"flex w-[343px] min-h-[120px] flex-col items-start overflow-clip rounded-[8px] bg-card shadow-card",
|
|
570
|
+
className
|
|
571
|
+
),
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-[184px] w-full shrink-0 overflow-clip", children: [
|
|
574
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
575
|
+
"img",
|
|
576
|
+
{
|
|
577
|
+
alt: "news banner",
|
|
578
|
+
className: "pointer-events-none absolute inset-0 size-full object-cover",
|
|
579
|
+
src: bannerSrc
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, {})
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
585
|
+
NewsContent,
|
|
586
|
+
{
|
|
587
|
+
padding: "px-4 py-3",
|
|
588
|
+
category: category ?? "Category",
|
|
589
|
+
title: title ?? "Great design begins with understanding user needs and creating memorable",
|
|
590
|
+
date: date ?? "01 มกราคม 2025",
|
|
591
|
+
bookmarked,
|
|
592
|
+
onBookmarkToggle,
|
|
593
|
+
tone: "desktop"
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
if (variant === "news" && size === "mobile") {
|
|
601
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
ref,
|
|
605
|
+
className: cn(
|
|
606
|
+
"flex h-[114px] w-[343px] flex-row overflow-clip rounded-[8px] bg-card shadow-card",
|
|
607
|
+
className
|
|
608
|
+
),
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-[114px] w-[171px] shrink-0 overflow-clip", children: [
|
|
611
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
612
|
+
"img",
|
|
613
|
+
{
|
|
614
|
+
alt: "news banner",
|
|
615
|
+
className: "pointer-events-none absolute inset-0 size-full object-cover",
|
|
616
|
+
src: bannerSrc
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, {})
|
|
620
|
+
] }),
|
|
621
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
622
|
+
NewsContent,
|
|
623
|
+
{
|
|
624
|
+
padding: "p-3",
|
|
625
|
+
category: category ?? "Category",
|
|
626
|
+
title: title ?? "Great design begins with understanding user needs and creating memorable",
|
|
627
|
+
date: date ?? "01 มกราคม 2025",
|
|
628
|
+
bookmarked,
|
|
629
|
+
onBookmarkToggle,
|
|
630
|
+
tone: "mobile"
|
|
631
|
+
}
|
|
632
|
+
)
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
const widthClass = size === "desktop" ? "w-[308px]" : size === "tablet" ? "w-[224px]" : "w-[163px]";
|
|
638
|
+
const padding = size === "desktop" ? "p-4" : size === "tablet" ? "p-3" : "p-2.5";
|
|
639
|
+
const bannerClass = size === "desktop" ? "h-[173px]" : "aspect-video w-full";
|
|
640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
641
|
+
"div",
|
|
642
|
+
{
|
|
643
|
+
ref,
|
|
644
|
+
className: cn(
|
|
645
|
+
"flex min-h-[120px] flex-col items-start overflow-clip rounded-[8px] shadow-card",
|
|
646
|
+
widthClass,
|
|
647
|
+
className
|
|
648
|
+
),
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
651
|
+
"div",
|
|
652
|
+
{
|
|
653
|
+
className: cn("relative w-full shrink-0 overflow-clip", bannerClass),
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
656
|
+
"img",
|
|
657
|
+
{
|
|
658
|
+
alt: variant === "news" ? "news banner" : "event banner",
|
|
659
|
+
className: "pointer-events-none absolute inset-0 size-full object-cover",
|
|
660
|
+
src: bannerSrc
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
locked && /* @__PURE__ */ jsxRuntime.jsx(LockBadge, { size })
|
|
664
|
+
]
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
variant === "news" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
668
|
+
NewsContent,
|
|
669
|
+
{
|
|
670
|
+
padding,
|
|
671
|
+
category: category ?? "Category",
|
|
672
|
+
title: title ?? "Great design begins with understanding user needs and creating memorable",
|
|
673
|
+
date: date ?? "01 มกราคม 2025",
|
|
674
|
+
bookmarked,
|
|
675
|
+
onBookmarkToggle,
|
|
676
|
+
tone: "default"
|
|
677
|
+
}
|
|
678
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
679
|
+
EventContent,
|
|
680
|
+
{
|
|
681
|
+
size,
|
|
682
|
+
padding,
|
|
683
|
+
title: title ?? "Lorem ipsum dolor sit amet consectetur. Lectus viverraasdasd",
|
|
684
|
+
date: date ?? "23 มิ.ย. 2567",
|
|
685
|
+
time: time ?? "08.30 - 12.00",
|
|
686
|
+
location: location ?? "ณ หอประชุมศาสตราจารย์สังเวียน อินทรวิชัย ชั้น 7 ตลาดหลักทรัพย์แห่งประเทศไทย",
|
|
687
|
+
showLocation,
|
|
688
|
+
showAudience,
|
|
689
|
+
count,
|
|
690
|
+
tagStatus
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
Card.displayName = "Card";
|
|
698
|
+
function EventContent({
|
|
699
|
+
size,
|
|
700
|
+
padding,
|
|
701
|
+
title,
|
|
702
|
+
date,
|
|
703
|
+
time,
|
|
704
|
+
location,
|
|
705
|
+
showLocation,
|
|
706
|
+
showAudience,
|
|
707
|
+
count,
|
|
708
|
+
tagStatus
|
|
709
|
+
}) {
|
|
710
|
+
const titleGap = size === "desktop" ? "gap-1.5" : "gap-1";
|
|
711
|
+
const tag = tagConfig[tagStatus];
|
|
712
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full shrink-0 bg-card", padding), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex w-full flex-col items-start", titleGap), children: [
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-start gap-1", children: [
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-2 w-full overflow-hidden text-ellipsis text-sm font-bold leading-5 text-foreground", children: title }),
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2", children: [
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] shrink-0 items-center gap-1", children: [
|
|
717
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
718
|
+
react.CalendarBlank,
|
|
719
|
+
{
|
|
720
|
+
size: 16,
|
|
721
|
+
weight: "regular",
|
|
722
|
+
color: "var(--accent-orange)"
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-nowrap text-xs font-semibold leading-4 text-accent-orange", children: date })
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-px shrink-0 bg-border" }),
|
|
728
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text", children: time })
|
|
729
|
+
] }),
|
|
730
|
+
showLocation && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] w-full items-center gap-1", children: [
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.MapPin, { size: 16, weight: "regular", color: "var(--subtle-text)" }),
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text", children: location })
|
|
733
|
+
] }),
|
|
734
|
+
showAudience && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] w-full items-center gap-1", children: [
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Users, { size: 16, weight: "regular", color: "var(--subtle-text)" }),
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-subtle-text", children: "ผู้เข้าร่วม" }),
|
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action", children: count })
|
|
738
|
+
] })
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-start", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
className: "flex items-center justify-center gap-1 overflow-clip rounded-[4px] px-[8px] py-[4px]",
|
|
744
|
+
style: { backgroundColor: tag.bg },
|
|
745
|
+
children: [
|
|
746
|
+
tag.Icon && /* @__PURE__ */ jsxRuntime.jsx(tag.Icon, { size: 14, weight: "fill", color: tag.text }),
|
|
747
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
"p",
|
|
749
|
+
{
|
|
750
|
+
className: "whitespace-nowrap text-[12px] leading-[16px]",
|
|
751
|
+
style: { color: tag.text },
|
|
752
|
+
children: tag.label
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
]
|
|
756
|
+
}
|
|
757
|
+
) })
|
|
758
|
+
] }) });
|
|
759
|
+
}
|
|
760
|
+
function NewsContent({
|
|
761
|
+
padding,
|
|
762
|
+
category,
|
|
763
|
+
title,
|
|
764
|
+
date,
|
|
765
|
+
bookmarked,
|
|
766
|
+
onBookmarkToggle,
|
|
767
|
+
tone = "default"
|
|
768
|
+
}) {
|
|
769
|
+
const isDesktopTone = tone === "desktop";
|
|
770
|
+
const isMobileTone = tone === "mobile";
|
|
771
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
772
|
+
"div",
|
|
773
|
+
{
|
|
774
|
+
className: cn(
|
|
775
|
+
"flex w-full flex-1 shrink-0 flex-col bg-card",
|
|
776
|
+
isDesktopTone || isMobileTone ? "gap-[10px]" : "gap-2",
|
|
777
|
+
padding
|
|
778
|
+
),
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
781
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
782
|
+
"p",
|
|
783
|
+
{
|
|
784
|
+
className: cn(
|
|
785
|
+
"text-primary-action",
|
|
786
|
+
isMobileTone ? "text-[9px] font-semibold leading-[14px]" : isDesktopTone ? "text-xs font-semibold leading-4" : "text-xs leading-4"
|
|
787
|
+
),
|
|
788
|
+
children: category
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
792
|
+
"p",
|
|
793
|
+
{
|
|
794
|
+
className: cn(
|
|
795
|
+
"line-clamp-2 text-foreground",
|
|
796
|
+
isMobileTone ? "text-xs font-semibold leading-4" : isDesktopTone ? "text-sm font-bold leading-5" : "text-sm font-semibold leading-5"
|
|
797
|
+
),
|
|
798
|
+
children: title
|
|
799
|
+
}
|
|
800
|
+
)
|
|
801
|
+
] }),
|
|
802
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
803
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
804
|
+
"p",
|
|
805
|
+
{
|
|
806
|
+
className: cn(
|
|
807
|
+
"text-xs leading-4",
|
|
808
|
+
isDesktopTone ? "text-muted-foreground" : "text-subtle-text"
|
|
809
|
+
),
|
|
810
|
+
children: date
|
|
811
|
+
}
|
|
812
|
+
),
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
"aria-label": bookmarked ? "Remove bookmark" : "Add bookmark",
|
|
817
|
+
className: cn(
|
|
818
|
+
"flex shrink-0 items-center justify-center rounded transition-colors hover:bg-hover-bg cursor-pointer",
|
|
819
|
+
isMobileTone ? "size-5" : isDesktopTone ? "size-6" : "p-0.5"
|
|
820
|
+
),
|
|
821
|
+
onClick: onBookmarkToggle,
|
|
822
|
+
type: "button",
|
|
823
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
824
|
+
react.BookmarkSimpleIcon,
|
|
825
|
+
{
|
|
826
|
+
size: isMobileTone ? 20 : 23.65,
|
|
827
|
+
weight: bookmarked ? "fill" : "regular",
|
|
828
|
+
color: bookmarked ? "var(--primary-action)" : "var(--subtle-text)"
|
|
829
|
+
}
|
|
830
|
+
)
|
|
831
|
+
}
|
|
832
|
+
)
|
|
833
|
+
] })
|
|
834
|
+
]
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
function CheckboxVisual({
|
|
839
|
+
state,
|
|
840
|
+
disabled
|
|
841
|
+
}) {
|
|
842
|
+
if (state === "default") {
|
|
843
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
844
|
+
"span",
|
|
845
|
+
{
|
|
846
|
+
"aria-hidden": "true",
|
|
847
|
+
className: cn(
|
|
848
|
+
"block w-4 h-4 rounded-[2px] border-[1.5px]",
|
|
849
|
+
disabled ? "bg-disabled-bg border-[var(--fill-black-100)]" : "bg-background border-[var(--fill-black-200)]"
|
|
850
|
+
)
|
|
851
|
+
}
|
|
852
|
+
);
|
|
853
|
+
}
|
|
854
|
+
const containerFill = disabled ? "var(--fill-gray-300)" : "var(--fill-p1-600)";
|
|
855
|
+
const iconFill = disabled ? "var(--fill-gray-400)" : "var(--fill-white-1000)";
|
|
856
|
+
if (state === "checked") {
|
|
857
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
858
|
+
"svg",
|
|
859
|
+
{
|
|
860
|
+
"aria-hidden": "true",
|
|
861
|
+
width: "16",
|
|
862
|
+
height: "16",
|
|
863
|
+
viewBox: "0 0 16 16",
|
|
864
|
+
fill: "none",
|
|
865
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
868
|
+
"path",
|
|
869
|
+
{
|
|
870
|
+
d: "M14.2222 0H1.77778C0.8 0 0 0.8 0 1.77778V14.2222C0 15.2 0.8 16 1.77778 16H14.2222C15.2 16 16 15.2 16 14.2222V8V1.77778C16 0.8 15.2 0 14.2222 0ZM6.85333 11.8133C6.50667 12.16 5.94667 12.16 5.6 11.8133L2.40889 8.62222C2.06222 8.27556 2.06222 7.71556 2.40889 7.36889C2.75556 7.02222 3.31556 7.02222 3.66222 7.36889L6.22222 9.92889L12.3378 3.81333C12.6844 3.46667 13.2444 3.46667 13.5911 3.81333C13.9378 4.16 13.9378 4.72 13.5911 5.06667L6.85333 11.8133Z",
|
|
871
|
+
fill: containerFill
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
875
|
+
"path",
|
|
876
|
+
{
|
|
877
|
+
d: "M5.6 11.8133C5.94667 12.16 6.50667 12.16 6.85333 11.8133L13.5911 5.06667C13.9378 4.72 13.9378 4.16 13.5911 3.81333C13.2444 3.46667 12.6844 3.46667 12.3378 3.81333L6.22222 9.92889L3.66222 7.36889C3.31556 7.02222 2.75556 7.02222 2.40889 7.36889C2.06222 7.71556 2.06222 8.27556 2.40889 8.62222L5.6 11.8133Z",
|
|
878
|
+
fill: iconFill
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
886
|
+
"svg",
|
|
887
|
+
{
|
|
888
|
+
"aria-hidden": "true",
|
|
889
|
+
width: "16",
|
|
890
|
+
height: "16",
|
|
891
|
+
viewBox: "0 0 16 16",
|
|
892
|
+
fill: "none",
|
|
893
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
896
|
+
"path",
|
|
897
|
+
{
|
|
898
|
+
d: "M14.2222 0H1.77778C0.8 0 0 0.8 0 1.77778V14.2222C0 15.2 0.8 16 1.77778 16H14.2222C15.2 16 16 15.2 16 14.2222V1.77778C16 0.8 15.2 0 14.2222 0ZM11.5556 8.88889H4.44444C3.95556 8.88889 3.55556 8.48889 3.55556 8C3.55556 7.51111 3.95556 7.11111 4.44444 7.11111H11.5556C12.0444 7.11111 12.4444 7.51111 12.4444 8C12.4444 8.48889 12.0444 8.88889 11.5556 8.88889Z",
|
|
899
|
+
fill: containerFill
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
"path",
|
|
904
|
+
{
|
|
905
|
+
d: "M4.44444 8.88889H11.5556C12.0444 8.88889 12.4444 8.48889 12.4444 8C12.4444 7.51111 12.0444 7.11111 11.5556 7.11111H4.44444C3.95556 7.11111 3.55556 7.51111 3.55556 8C3.55556 8.48889 3.95556 8.88889 4.44444 8.88889Z",
|
|
906
|
+
fill: iconFill
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
const Checkbox = React.forwardRef(function Checkbox2({
|
|
914
|
+
checked = false,
|
|
915
|
+
disabled = false,
|
|
916
|
+
label,
|
|
917
|
+
description,
|
|
918
|
+
variant = "text",
|
|
919
|
+
onChange,
|
|
920
|
+
name,
|
|
921
|
+
value,
|
|
922
|
+
id,
|
|
923
|
+
ariaLabel,
|
|
924
|
+
className
|
|
925
|
+
}, ref) {
|
|
926
|
+
const localRef = React.useRef(null);
|
|
927
|
+
const state = checked === "indeterminate" ? "indeterminate" : checked ? "checked" : "default";
|
|
928
|
+
React.useEffect(() => {
|
|
929
|
+
if (localRef.current) {
|
|
930
|
+
localRef.current.indeterminate = checked === "indeterminate";
|
|
931
|
+
}
|
|
932
|
+
}, [checked]);
|
|
933
|
+
const setRefs = React.useCallback(
|
|
934
|
+
(node) => {
|
|
935
|
+
localRef.current = node;
|
|
936
|
+
if (typeof ref === "function") ref(node);
|
|
937
|
+
else if (ref) ref.current = node;
|
|
938
|
+
},
|
|
939
|
+
[ref]
|
|
940
|
+
);
|
|
941
|
+
const handleChange = (e) => {
|
|
942
|
+
onChange == null ? void 0 : onChange(e.target.checked);
|
|
943
|
+
};
|
|
944
|
+
const hasText = label !== void 0 || description !== void 0;
|
|
945
|
+
const hasActiveBorder = state === "checked" || state === "indeterminate";
|
|
946
|
+
const isButton = variant === "button";
|
|
947
|
+
const buttonBorder = disabled ? "border-[var(--fill-black-100)]" : hasActiveBorder ? "border-primary-action" : "border-[var(--fill-black-200)]";
|
|
300
948
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
301
|
-
"
|
|
949
|
+
"label",
|
|
302
950
|
{
|
|
303
|
-
ref,
|
|
304
951
|
className: cn(
|
|
305
|
-
"
|
|
306
|
-
"
|
|
307
|
-
|
|
952
|
+
"inline-flex gap-1 select-none",
|
|
953
|
+
description ? "items-start" : "items-center",
|
|
954
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
955
|
+
isButton && cn("bg-background rounded-lg border py-2.5 pl-3 pr-4", buttonBorder),
|
|
308
956
|
className
|
|
309
957
|
),
|
|
310
958
|
children: [
|
|
311
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
959
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative inline-flex items-center justify-center w-6 h-6 shrink-0", children: [
|
|
312
960
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
313
|
-
"
|
|
961
|
+
"input",
|
|
314
962
|
{
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
963
|
+
ref: setRefs,
|
|
964
|
+
id,
|
|
965
|
+
name,
|
|
966
|
+
value,
|
|
967
|
+
type: "checkbox",
|
|
968
|
+
checked: checked === true,
|
|
969
|
+
disabled,
|
|
970
|
+
onChange: handleChange,
|
|
971
|
+
"aria-label": ariaLabel,
|
|
972
|
+
"aria-checked": checked === "indeterminate" ? "mixed" : checked,
|
|
973
|
+
className: "absolute inset-0 w-full h-full opacity-0 m-0 cursor-[inherit] disabled:cursor-[inherit]"
|
|
318
974
|
}
|
|
319
975
|
),
|
|
320
|
-
|
|
321
|
-
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx(CheckboxVisual, { state, disabled })
|
|
977
|
+
] }),
|
|
978
|
+
hasText && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col", children: [
|
|
979
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
980
|
+
"span",
|
|
322
981
|
{
|
|
323
982
|
className: cn(
|
|
324
|
-
"
|
|
983
|
+
"text-base leading-6",
|
|
984
|
+
disabled ? "text-disabled" : "text-foreground"
|
|
325
985
|
),
|
|
326
|
-
children:
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
|
-
"div",
|
|
329
|
-
{
|
|
330
|
-
"aria-hidden": "true",
|
|
331
|
-
className: "pointer-events-none absolute inset-0 rounded-[4px] border border-solid border-border"
|
|
332
|
-
}
|
|
333
|
-
),
|
|
334
|
-
/* @__PURE__ */ jsxRuntime.jsx(LockIcon, {}),
|
|
335
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-nowrap text-[12px] leading-[18px] text-subtle-text", children: "Lock" })
|
|
336
|
-
]
|
|
986
|
+
children: label
|
|
337
987
|
}
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col items-start gap-1", children: [
|
|
342
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
-
"p",
|
|
344
|
-
{
|
|
345
|
-
className: cn(
|
|
346
|
-
"line-clamp-2 w-full overflow-hidden text-ellipsis text-sm leading-5 text-foreground"
|
|
347
|
-
),
|
|
348
|
-
children: title
|
|
349
|
-
}
|
|
350
|
-
),
|
|
351
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2", children: [
|
|
352
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] shrink-0 items-center gap-1", children: [
|
|
353
|
-
/* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, {}),
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-nowrap text-xs leading-4 text-accent-orange", children: date })
|
|
355
|
-
] }),
|
|
356
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[14px] w-px shrink-0 bg-border" }),
|
|
357
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
358
|
-
"p",
|
|
359
|
-
{
|
|
360
|
-
className: cn(
|
|
361
|
-
"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text"
|
|
362
|
-
),
|
|
363
|
-
children: time
|
|
364
|
-
}
|
|
365
|
-
)
|
|
366
|
-
] }),
|
|
367
|
-
showLocation && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] w-full items-center gap-1", children: [
|
|
368
|
-
/* @__PURE__ */ jsxRuntime.jsx(LocationIcon, {}),
|
|
369
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
-
"p",
|
|
371
|
-
{
|
|
372
|
-
className: cn(
|
|
373
|
-
"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text"
|
|
374
|
-
),
|
|
375
|
-
children: location
|
|
376
|
-
}
|
|
377
|
-
)
|
|
378
|
-
] }),
|
|
379
|
-
showAudience && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[22px] w-full items-center gap-1", children: [
|
|
380
|
-
/* @__PURE__ */ jsxRuntime.jsx(AudienceIcon, {}),
|
|
381
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-subtle-text", children: "ผู้เข้าร่วม" }),
|
|
382
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action", children: count })
|
|
383
|
-
] })
|
|
384
|
-
] }),
|
|
385
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
-
"div",
|
|
988
|
+
),
|
|
989
|
+
description !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
990
|
+
"span",
|
|
387
991
|
{
|
|
388
|
-
className:
|
|
389
|
-
|
|
390
|
-
|
|
992
|
+
className: cn(
|
|
993
|
+
"text-xs leading-4",
|
|
994
|
+
disabled ? "text-disabled" : "text-subtle-text"
|
|
995
|
+
),
|
|
996
|
+
children: description
|
|
391
997
|
}
|
|
392
|
-
)
|
|
393
|
-
] })
|
|
998
|
+
)
|
|
999
|
+
] })
|
|
394
1000
|
]
|
|
395
1001
|
}
|
|
396
1002
|
);
|
|
397
1003
|
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
sm: "max-w-[640px]",
|
|
401
|
-
md: "max-w-[960px]",
|
|
402
|
-
lg: "max-w-[1200px]",
|
|
403
|
-
xl: "max-w-[1440px]",
|
|
404
|
-
full: "max-w-none"
|
|
405
|
-
};
|
|
406
|
-
const Page = React.forwardRef(function Page2({ width = "lg", className, children, ...rest }, ref) {
|
|
1004
|
+
Checkbox.displayName = "Checkbox";
|
|
1005
|
+
function RadioVisual({ checked, disabled }) {
|
|
407
1006
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
-
"
|
|
1007
|
+
"span",
|
|
409
1008
|
{
|
|
410
|
-
|
|
1009
|
+
"aria-hidden": "true",
|
|
411
1010
|
className: cn(
|
|
412
|
-
"
|
|
413
|
-
|
|
414
|
-
className
|
|
1011
|
+
"w-[18px] h-[18px] rounded-full border-[1.5px] flex items-center justify-center",
|
|
1012
|
+
disabled ? "bg-disabled-bg border-[var(--fill-black-100)]" : checked ? "bg-background border-primary-action" : "bg-background border-[var(--fill-black-200)]"
|
|
415
1013
|
),
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
{
|
|
426
|
-
ref,
|
|
427
|
-
className: cn(
|
|
428
|
-
"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
|
|
429
|
-
className
|
|
430
|
-
),
|
|
431
|
-
...rest,
|
|
432
|
-
children: [
|
|
433
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 min-w-0", children: [
|
|
434
|
-
eyebrow && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-2", children: eyebrow }),
|
|
435
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { children: title }),
|
|
436
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground max-w-[720px]", children: description })
|
|
437
|
-
] }),
|
|
438
|
-
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-3 shrink-0", children: actions })
|
|
439
|
-
]
|
|
440
|
-
}
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
const Section = React.forwardRef(function Section2({ title, description, actions, className, children, ...rest }, ref) {
|
|
445
|
-
const hasHeader = Boolean(title || description || actions);
|
|
446
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
447
|
-
"section",
|
|
448
|
-
{
|
|
449
|
-
ref,
|
|
450
|
-
className: cn("flex flex-col gap-6", className),
|
|
451
|
-
...rest,
|
|
452
|
-
children: [
|
|
453
|
-
hasHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
454
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
455
|
-
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { children: title }),
|
|
456
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground max-w-[720px]", children: description })
|
|
457
|
-
] }),
|
|
458
|
-
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap items-center gap-3 shrink-0", children: actions })
|
|
459
|
-
] }),
|
|
460
|
-
children
|
|
461
|
-
]
|
|
1014
|
+
children: checked && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
"span",
|
|
1016
|
+
{
|
|
1017
|
+
className: cn(
|
|
1018
|
+
"w-2 h-2 rounded-full",
|
|
1019
|
+
disabled ? "bg-[var(--fill-gray-400)]" : "bg-primary-action"
|
|
1020
|
+
)
|
|
1021
|
+
}
|
|
1022
|
+
)
|
|
462
1023
|
}
|
|
463
1024
|
);
|
|
464
|
-
}
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
children,
|
|
478
|
-
end && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center gap-3", children: end })
|
|
479
|
-
]
|
|
480
|
-
}
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
);
|
|
484
|
-
const cardGridColsClass = {
|
|
485
|
-
2: "grid-cols-1 sm:grid-cols-2",
|
|
486
|
-
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
487
|
-
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
|
488
|
-
};
|
|
489
|
-
const CardGrid = React.forwardRef(
|
|
490
|
-
function CardGrid2({ cols = 3, className, children, ...rest }, ref) {
|
|
491
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
|
-
"div",
|
|
493
|
-
{
|
|
494
|
-
ref,
|
|
495
|
-
className: cn("grid gap-6", cardGridColsClass[cols], className),
|
|
496
|
-
...rest,
|
|
497
|
-
children
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
const stackGapClass = {
|
|
503
|
-
1: "gap-1",
|
|
504
|
-
2: "gap-2",
|
|
505
|
-
3: "gap-3",
|
|
506
|
-
4: "gap-4",
|
|
507
|
-
6: "gap-6",
|
|
508
|
-
8: "gap-8",
|
|
509
|
-
10: "gap-10",
|
|
510
|
-
12: "gap-12"
|
|
511
|
-
};
|
|
512
|
-
const stackAlignClass = {
|
|
513
|
-
start: "items-start",
|
|
514
|
-
center: "items-center",
|
|
515
|
-
end: "items-end",
|
|
516
|
-
stretch: "items-stretch"
|
|
517
|
-
};
|
|
518
|
-
const stackJustifyClass = {
|
|
519
|
-
start: "justify-start",
|
|
520
|
-
center: "justify-center",
|
|
521
|
-
end: "justify-end",
|
|
522
|
-
between: "justify-between",
|
|
523
|
-
around: "justify-around"
|
|
524
|
-
};
|
|
525
|
-
const Stack = React.forwardRef(function Stack2({
|
|
526
|
-
direction = "col",
|
|
527
|
-
gap = 4,
|
|
528
|
-
align,
|
|
529
|
-
justify,
|
|
530
|
-
wrap,
|
|
531
|
-
className,
|
|
532
|
-
children,
|
|
533
|
-
...rest
|
|
1025
|
+
}
|
|
1026
|
+
const Radio = React.forwardRef(function Radio2({
|
|
1027
|
+
checked = false,
|
|
1028
|
+
disabled = false,
|
|
1029
|
+
label,
|
|
1030
|
+
description,
|
|
1031
|
+
variant = "text",
|
|
1032
|
+
onChange,
|
|
1033
|
+
name,
|
|
1034
|
+
value,
|
|
1035
|
+
id,
|
|
1036
|
+
ariaLabel,
|
|
1037
|
+
className
|
|
534
1038
|
}, ref) {
|
|
535
|
-
|
|
536
|
-
|
|
1039
|
+
const hasText = label !== void 0 || description !== void 0;
|
|
1040
|
+
const isButton = variant === "button";
|
|
1041
|
+
const handleChange = (e) => {
|
|
1042
|
+
onChange == null ? void 0 : onChange(e.target.checked);
|
|
1043
|
+
};
|
|
1044
|
+
const buttonBorder = disabled ? "border-[var(--fill-black-100)]" : checked ? "border-primary-action" : "border-[var(--fill-black-200)]";
|
|
1045
|
+
const buttonBackground = disabled && !checked ? "bg-disabled-bg" : "bg-background";
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1047
|
+
"label",
|
|
537
1048
|
{
|
|
538
|
-
ref,
|
|
539
1049
|
className: cn(
|
|
540
|
-
"flex",
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
justify && stackJustifyClass[justify],
|
|
545
|
-
wrap && "flex-wrap",
|
|
1050
|
+
"inline-flex gap-1 select-none",
|
|
1051
|
+
description ? "items-start" : "items-center",
|
|
1052
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1053
|
+
isButton && cn(buttonBackground, "rounded-lg border py-2.5 pl-3 pr-4", buttonBorder),
|
|
546
1054
|
className
|
|
547
1055
|
),
|
|
548
|
-
|
|
549
|
-
|
|
1056
|
+
children: [
|
|
1057
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "relative inline-flex items-center justify-center w-6 h-6 shrink-0", children: [
|
|
1058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1059
|
+
"input",
|
|
1060
|
+
{
|
|
1061
|
+
ref,
|
|
1062
|
+
id,
|
|
1063
|
+
name,
|
|
1064
|
+
value,
|
|
1065
|
+
type: "radio",
|
|
1066
|
+
checked,
|
|
1067
|
+
disabled,
|
|
1068
|
+
onChange: handleChange,
|
|
1069
|
+
"aria-label": ariaLabel,
|
|
1070
|
+
className: "absolute inset-0 w-full h-full opacity-0 m-0 cursor-[inherit] disabled:cursor-[inherit]"
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioVisual, { checked, disabled })
|
|
1074
|
+
] }),
|
|
1075
|
+
hasText && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col", children: [
|
|
1076
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
|
+
"span",
|
|
1078
|
+
{
|
|
1079
|
+
className: cn(
|
|
1080
|
+
"text-sm leading-5",
|
|
1081
|
+
disabled ? "text-disabled" : "text-foreground"
|
|
1082
|
+
),
|
|
1083
|
+
children: label
|
|
1084
|
+
}
|
|
1085
|
+
),
|
|
1086
|
+
description !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1087
|
+
"span",
|
|
1088
|
+
{
|
|
1089
|
+
className: cn(
|
|
1090
|
+
"text-xs leading-4",
|
|
1091
|
+
disabled ? "text-disabled" : "text-subtle-text"
|
|
1092
|
+
),
|
|
1093
|
+
children: description
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
] })
|
|
1097
|
+
]
|
|
550
1098
|
}
|
|
551
1099
|
);
|
|
552
1100
|
});
|
|
1101
|
+
Radio.displayName = "Radio";
|
|
553
1102
|
const sizeStyles$1 = {
|
|
554
1103
|
large: {
|
|
555
1104
|
container: "h-9 px-3 gap-1",
|
|
@@ -2581,18 +3130,18 @@ const Input = React.forwardRef(function Input2({
|
|
|
2581
3130
|
const isFocus = state === "focus";
|
|
2582
3131
|
const isFilled = currentValue.length > 0;
|
|
2583
3132
|
const bg = isDisabled ? "bg-disabled-bg" : "bg-background";
|
|
2584
|
-
const floatLabel = isDisabled ? "var(--disabled
|
|
2585
|
-
const filledValue = isDisabled ? "var(--disabled
|
|
2586
|
-
const unitColor = isDisabled ? "var(--disabled
|
|
3133
|
+
const floatLabel = isDisabled ? "var(--disabled)" : "var(--muted-foreground)";
|
|
3134
|
+
const filledValue = isDisabled ? "var(--disabled)" : "var(--foreground)";
|
|
3135
|
+
const unitColor = isDisabled ? "var(--disabled)" : "var(--muted-foreground)";
|
|
2587
3136
|
const borderInset = isFocus || isError ? "-1px" : "0px";
|
|
2588
3137
|
const borderRad = isFocus || isError ? "9px" : "8px";
|
|
2589
|
-
const borderColor = isDisabled ? "var(--border-disabled
|
|
3138
|
+
const borderColor = isDisabled ? "var(--border-disabled)" : isError ? "var(--destructive)" : isFocus ? "var(--primary-action)" : "var(--border)";
|
|
2590
3139
|
const hasRight = Boolean(rightIcon) || Boolean(unit);
|
|
2591
3140
|
const padding = isFilled ? "px-[14px] py-[6px]" : hasRight ? "px-[14px] py-[14px]" : "p-[14px]";
|
|
2592
3141
|
const charCount = currentValue.length;
|
|
2593
3142
|
const showBelow = isError || Boolean(helperText) || showCount;
|
|
2594
3143
|
const leftText = isError ? errorMessage : helperText ?? "";
|
|
2595
|
-
const leftColor = isError ? "var(--destructive
|
|
3144
|
+
const leftColor = isError ? "var(--destructive)" : "var(--muted-foreground)";
|
|
2596
3145
|
const handleChange = (e) => {
|
|
2597
3146
|
if (isDisabled) return;
|
|
2598
3147
|
let next = e.target.value;
|
|
@@ -2612,7 +3161,7 @@ const Input = React.forwardRef(function Input2({
|
|
|
2612
3161
|
};
|
|
2613
3162
|
const containerFlex = isFilled ? !hasRight ? "flex-col items-start justify-center" : rightIcon ? "flex items-center gap-[8px]" : "flex items-end gap-[8px]" : cn("flex items-center", hasRight && "gap-[8px]");
|
|
2614
3163
|
const inputCaretStyle = {
|
|
2615
|
-
caretColor: "var(--caret-color
|
|
3164
|
+
caretColor: "var(--caret-color)"
|
|
2616
3165
|
};
|
|
2617
3166
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn("flex flex-col gap-1 w-full", className), children: [
|
|
2618
3167
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2660,7 +3209,7 @@ const Input = React.forwardRef(function Input2({
|
|
|
2660
3209
|
{
|
|
2661
3210
|
className: "text-xs leading-4",
|
|
2662
3211
|
style: {
|
|
2663
|
-
color: isDisabled ? "var(--disabled
|
|
3212
|
+
color: isDisabled ? "var(--disabled)" : "var(--error-dark)"
|
|
2664
3213
|
},
|
|
2665
3214
|
children: " *"
|
|
2666
3215
|
}
|
|
@@ -2690,7 +3239,7 @@ const Input = React.forwardRef(function Input2({
|
|
|
2690
3239
|
style: isFilled ? { ...inputStyleProp, color: filledValue, ...inputCaretStyle } : {
|
|
2691
3240
|
...inputStyleProp,
|
|
2692
3241
|
color: "transparent",
|
|
2693
|
-
caretColor: isFocus ? "var(--caret-color
|
|
3242
|
+
caretColor: isFocus ? "var(--caret-color)" : "transparent",
|
|
2694
3243
|
padding: hasRight ? "12px 14px" : "14px"
|
|
2695
3244
|
}
|
|
2696
3245
|
}
|
|
@@ -2733,7 +3282,7 @@ const Input = React.forwardRef(function Input2({
|
|
|
2733
3282
|
"span",
|
|
2734
3283
|
{
|
|
2735
3284
|
className: "shrink-0 text-right whitespace-nowrap",
|
|
2736
|
-
style: { color: "var(--muted-foreground
|
|
3285
|
+
style: { color: "var(--muted-foreground)" },
|
|
2737
3286
|
children: [
|
|
2738
3287
|
charCount,
|
|
2739
3288
|
"/",
|
|
@@ -3230,6 +3779,308 @@ function StatusTag({ type = "stop", text, className }) {
|
|
|
3230
3779
|
}
|
|
3231
3780
|
);
|
|
3232
3781
|
}
|
|
3782
|
+
const TableScrollShadowContext = React.createContext({
|
|
3783
|
+
hasLeftOverflow: false,
|
|
3784
|
+
hasRightOverflow: false
|
|
3785
|
+
});
|
|
3786
|
+
const TableRowStateContext = React.createContext({
|
|
3787
|
+
selected: false,
|
|
3788
|
+
hovered: false
|
|
3789
|
+
});
|
|
3790
|
+
function getSurface(selected, hovered) {
|
|
3791
|
+
if (selected) return "bg-[var(--bg-brand-primary-light,#f3f8fe)]";
|
|
3792
|
+
if (hovered) return "bg-[var(--bg-default-secondary,#f9fafb)]";
|
|
3793
|
+
return "bg-[var(--bg-default-primary-medium,white)]";
|
|
3794
|
+
}
|
|
3795
|
+
function getTextClass(textStyle) {
|
|
3796
|
+
return textStyle === "bold" || textStyle === "bold-description" ? "font-bold text-foreground" : "font-normal text-foreground";
|
|
3797
|
+
}
|
|
3798
|
+
function resolveStickyShadowDirection(fixed, fixedShadow) {
|
|
3799
|
+
if (fixedShadow) return fixedShadow;
|
|
3800
|
+
if (fixed === "left") return "right";
|
|
3801
|
+
if (fixed === "right") return "left";
|
|
3802
|
+
return void 0;
|
|
3803
|
+
}
|
|
3804
|
+
function StickyShadowEdge({ direction }) {
|
|
3805
|
+
if (direction === "left") {
|
|
3806
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3807
|
+
"span",
|
|
3808
|
+
{
|
|
3809
|
+
"aria-hidden": "true",
|
|
3810
|
+
className: "pointer-events-none absolute inset-y-0 left-[-10px] w-2.5",
|
|
3811
|
+
style: {
|
|
3812
|
+
background: "linear-gradient(90deg, rgba(16,24,40,0.00) 0%, rgba(16,24,40,0.03) 55%, rgba(16,24,40,0.08) 100%)"
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
);
|
|
3816
|
+
}
|
|
3817
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3818
|
+
"span",
|
|
3819
|
+
{
|
|
3820
|
+
"aria-hidden": "true",
|
|
3821
|
+
className: "pointer-events-none absolute inset-y-0 right-[-10px] w-2.5",
|
|
3822
|
+
style: {
|
|
3823
|
+
background: "linear-gradient(90deg, rgba(16,24,40,0.08) 0%, rgba(16,24,40,0.03) 45%, rgba(16,24,40,0.00) 100%)"
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
);
|
|
3827
|
+
}
|
|
3828
|
+
const Table = React.forwardRef(function Table2({ className, responsive = true, ...props }, ref) {
|
|
3829
|
+
const scrollRef = React.useRef(null);
|
|
3830
|
+
const [shadowState, setShadowState] = React.useState({
|
|
3831
|
+
hasLeftOverflow: false,
|
|
3832
|
+
hasRightOverflow: false
|
|
3833
|
+
});
|
|
3834
|
+
React.useEffect(() => {
|
|
3835
|
+
if (!responsive) return;
|
|
3836
|
+
const el = scrollRef.current;
|
|
3837
|
+
if (!el) return;
|
|
3838
|
+
const updateShadowState = () => {
|
|
3839
|
+
const maxScrollLeft = Math.max(0, el.scrollWidth - el.clientWidth);
|
|
3840
|
+
setShadowState({
|
|
3841
|
+
hasLeftOverflow: el.scrollLeft > 0,
|
|
3842
|
+
hasRightOverflow: el.scrollLeft < maxScrollLeft - 1
|
|
3843
|
+
});
|
|
3844
|
+
};
|
|
3845
|
+
updateShadowState();
|
|
3846
|
+
el.addEventListener("scroll", updateShadowState, { passive: true });
|
|
3847
|
+
window.addEventListener("resize", updateShadowState);
|
|
3848
|
+
const observer = new ResizeObserver(updateShadowState);
|
|
3849
|
+
observer.observe(el);
|
|
3850
|
+
if (el.firstElementChild instanceof HTMLElement) {
|
|
3851
|
+
observer.observe(el.firstElementChild);
|
|
3852
|
+
}
|
|
3853
|
+
return () => {
|
|
3854
|
+
el.removeEventListener("scroll", updateShadowState);
|
|
3855
|
+
window.removeEventListener("resize", updateShadowState);
|
|
3856
|
+
observer.disconnect();
|
|
3857
|
+
};
|
|
3858
|
+
}, [responsive]);
|
|
3859
|
+
const contextValue = React.useMemo(() => shadowState, [shadowState]);
|
|
3860
|
+
const table = /* @__PURE__ */ jsxRuntime.jsx(
|
|
3861
|
+
"table",
|
|
3862
|
+
{
|
|
3863
|
+
ref,
|
|
3864
|
+
className: cn("w-full border-collapse border-spacing-0 text-sm", className),
|
|
3865
|
+
...props
|
|
3866
|
+
}
|
|
3867
|
+
);
|
|
3868
|
+
if (!responsive) return table;
|
|
3869
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableScrollShadowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollRef, className: "w-full overflow-x-auto", children: table }) });
|
|
3870
|
+
});
|
|
3871
|
+
const TableRow = React.forwardRef(
|
|
3872
|
+
function TableRow2({ className, selected = false, hoverable = false, onMouseEnter, onMouseLeave, ...props }, ref) {
|
|
3873
|
+
const [hovered, setHovered] = React.useState(false);
|
|
3874
|
+
const handleMouseEnter = (e) => {
|
|
3875
|
+
if (hoverable) setHovered(true);
|
|
3876
|
+
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
3877
|
+
};
|
|
3878
|
+
const handleMouseLeave = (e) => {
|
|
3879
|
+
if (hoverable) setHovered(false);
|
|
3880
|
+
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
3881
|
+
};
|
|
3882
|
+
const rowState = React.useMemo(
|
|
3883
|
+
() => ({ selected, hovered: hoverable ? hovered : false }),
|
|
3884
|
+
[hoverable, hovered, selected]
|
|
3885
|
+
);
|
|
3886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableRowStateContext.Provider, { value: rowState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3887
|
+
"tr",
|
|
3888
|
+
{
|
|
3889
|
+
ref,
|
|
3890
|
+
className: cn("align-middle", className),
|
|
3891
|
+
onMouseEnter: handleMouseEnter,
|
|
3892
|
+
onMouseLeave: handleMouseLeave,
|
|
3893
|
+
...props
|
|
3894
|
+
}
|
|
3895
|
+
) });
|
|
3896
|
+
}
|
|
3897
|
+
);
|
|
3898
|
+
const TableHeaderCell = React.forwardRef(
|
|
3899
|
+
function TableHeaderCell2({
|
|
3900
|
+
className,
|
|
3901
|
+
type = "text",
|
|
3902
|
+
state = "default",
|
|
3903
|
+
sortable = true,
|
|
3904
|
+
icon,
|
|
3905
|
+
sortDirection = "none",
|
|
3906
|
+
onSortChange,
|
|
3907
|
+
checkState = false,
|
|
3908
|
+
onCheckChange,
|
|
3909
|
+
fixed,
|
|
3910
|
+
fixedOffset = 0,
|
|
3911
|
+
fixedShadow,
|
|
3912
|
+
children = "Title text",
|
|
3913
|
+
style: styleProp,
|
|
3914
|
+
...props
|
|
3915
|
+
}, ref) {
|
|
3916
|
+
const { hasLeftOverflow, hasRightOverflow } = React.useContext(TableScrollShadowContext);
|
|
3917
|
+
const stateClass = state === "disabled" ? "bg-[var(--bg-default-tertiary,#f3f4f6)] text-[var(--text-default-tertiary,#6a7282)]" : state === "hover" ? "bg-[var(--bg-default-secondary,#f9fafb)] text-[var(--text-default-tertiary,#6a7282)]" : "bg-[var(--bg-default-primary,white)] text-[var(--text-default-tertiary,#6a7282)]";
|
|
3918
|
+
const interactiveHoverClass = state === "default" ? "hover:bg-[var(--bg-default-secondary,#f9fafb)]" : "";
|
|
3919
|
+
const sortIcon = sortDirection === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(react.ArrowUp, { size: 16, weight: "fill", className: "shrink-0" }) : sortDirection === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(react.ArrowDown, { size: 16, weight: "fill", className: "shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(react.ArrowsDownUp, { size: 16, weight: "fill", className: "shrink-0" });
|
|
3920
|
+
const handleSortClick = () => {
|
|
3921
|
+
if (!sortable || !onSortChange) return;
|
|
3922
|
+
const nextDirection = sortDirection === "none" ? "asc" : sortDirection === "asc" ? "desc" : "none";
|
|
3923
|
+
onSortChange(nextDirection);
|
|
3924
|
+
};
|
|
3925
|
+
const content = type === "text" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3926
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm leading-5 font-normal", children }),
|
|
3927
|
+
sortable && sortIcon
|
|
3928
|
+
] }) : type === "icon" ? icon ?? /* @__PURE__ */ jsxRuntime.jsx(react.Circle, { size: 20, weight: "regular", className: "shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3929
|
+
Checkbox,
|
|
3930
|
+
{
|
|
3931
|
+
checked: checkState,
|
|
3932
|
+
disabled: state === "disabled",
|
|
3933
|
+
onChange: onCheckChange,
|
|
3934
|
+
ariaLabel: "Select all rows"
|
|
3935
|
+
}
|
|
3936
|
+
);
|
|
3937
|
+
const fixedStyle = fixed === "left" ? { left: fixedOffset } : fixed === "right" ? { right: fixedOffset } : void 0;
|
|
3938
|
+
const shadowDirection = resolveStickyShadowDirection(fixed, fixedShadow);
|
|
3939
|
+
const shouldShowShadow = shadowDirection === "right" ? hasLeftOverflow : shadowDirection === "left" ? hasRightOverflow : false;
|
|
3940
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3941
|
+
"th",
|
|
3942
|
+
{
|
|
3943
|
+
ref,
|
|
3944
|
+
className: cn(
|
|
3945
|
+
"relative h-12 border-b border-border px-4 py-3",
|
|
3946
|
+
type === "text" ? "min-w-[284px] text-left" : "w-[56px] text-center",
|
|
3947
|
+
stateClass,
|
|
3948
|
+
interactiveHoverClass,
|
|
3949
|
+
fixed && "sticky z-20",
|
|
3950
|
+
sortable && type === "text" && onSortChange && "cursor-pointer select-none",
|
|
3951
|
+
className
|
|
3952
|
+
),
|
|
3953
|
+
style: { ...fixedStyle, ...styleProp },
|
|
3954
|
+
...props,
|
|
3955
|
+
onClick: type === "text" ? handleSortClick : props.onClick,
|
|
3956
|
+
children: [
|
|
3957
|
+
shadowDirection && shouldShowShadow && /* @__PURE__ */ jsxRuntime.jsx(StickyShadowEdge, { direction: shadowDirection }),
|
|
3958
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3959
|
+
"div",
|
|
3960
|
+
{
|
|
3961
|
+
className: cn(
|
|
3962
|
+
"flex items-center",
|
|
3963
|
+
type === "text" ? "justify-start gap-1" : "justify-center gap-0"
|
|
3964
|
+
),
|
|
3965
|
+
children: content
|
|
3966
|
+
}
|
|
3967
|
+
)
|
|
3968
|
+
]
|
|
3969
|
+
}
|
|
3970
|
+
);
|
|
3971
|
+
}
|
|
3972
|
+
);
|
|
3973
|
+
const TableCell = React.forwardRef(function TableCell2({
|
|
3974
|
+
className,
|
|
3975
|
+
type = "default",
|
|
3976
|
+
textStyle = "default",
|
|
3977
|
+
selected,
|
|
3978
|
+
hovered,
|
|
3979
|
+
label = "Text label",
|
|
3980
|
+
description = "Text Description",
|
|
3981
|
+
imageSrc,
|
|
3982
|
+
tagText = "Tag",
|
|
3983
|
+
tagVariant = "gray",
|
|
3984
|
+
icon,
|
|
3985
|
+
contentAlign = "start",
|
|
3986
|
+
fixed,
|
|
3987
|
+
fixedOffset = 0,
|
|
3988
|
+
fixedShadow,
|
|
3989
|
+
style: styleProp,
|
|
3990
|
+
...props
|
|
3991
|
+
}, ref) {
|
|
3992
|
+
const { hasLeftOverflow, hasRightOverflow } = React.useContext(TableScrollShadowContext);
|
|
3993
|
+
const rowState = React.useContext(TableRowStateContext);
|
|
3994
|
+
const cellSelected = selected ?? rowState.selected;
|
|
3995
|
+
const cellHovered = hovered ?? rowState.hovered;
|
|
3996
|
+
const surfaceClass = getSurface(cellSelected, cellHovered);
|
|
3997
|
+
const primaryTextClass = getTextClass(textStyle);
|
|
3998
|
+
const hasDescription = textStyle === "bold-description";
|
|
3999
|
+
const iconSize = hasDescription ? 24 : 20;
|
|
4000
|
+
const imageSize = hasDescription ? "size-8" : "size-5";
|
|
4001
|
+
const fixedStyle = fixed === "left" ? { left: fixedOffset } : fixed === "right" ? { right: fixedOffset } : void 0;
|
|
4002
|
+
const shadowDirection = resolveStickyShadowDirection(fixed, fixedShadow);
|
|
4003
|
+
const shouldShowShadow = shadowDirection === "right" ? hasLeftOverflow : shadowDirection === "left" ? hasRightOverflow : false;
|
|
4004
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4005
|
+
"td",
|
|
4006
|
+
{
|
|
4007
|
+
ref,
|
|
4008
|
+
className: cn(
|
|
4009
|
+
"relative border-b border-border px-4",
|
|
4010
|
+
hasDescription ? "py-3 align-top" : "py-3.5 align-middle",
|
|
4011
|
+
surfaceClass,
|
|
4012
|
+
type === "default" || type === "text-icon" || type === "text-image" || type === "tag" ? "min-w-[284px]" : "w-[56px]",
|
|
4013
|
+
fixed && "sticky z-10",
|
|
4014
|
+
className
|
|
4015
|
+
),
|
|
4016
|
+
style: { ...fixedStyle, ...styleProp },
|
|
4017
|
+
...props,
|
|
4018
|
+
children: [
|
|
4019
|
+
shadowDirection && shouldShowShadow && /* @__PURE__ */ jsxRuntime.jsx(StickyShadowEdge, { direction: shadowDirection }),
|
|
4020
|
+
type === "default" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
4021
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-sm leading-5", primaryTextClass), children: label }),
|
|
4022
|
+
hasDescription && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs leading-4 font-normal text-subtle-text", children: description })
|
|
4023
|
+
] }),
|
|
4024
|
+
type === "text-icon" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4025
|
+
icon ?? /* @__PURE__ */ jsxRuntime.jsx(react.Circle, { size: iconSize, weight: "regular", className: "shrink-0 text-subtle-text" }),
|
|
4026
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
4027
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-sm leading-5", primaryTextClass), children: label }),
|
|
4028
|
+
hasDescription && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs leading-4 font-normal text-subtle-text", children: description })
|
|
4029
|
+
] })
|
|
4030
|
+
] }),
|
|
4031
|
+
type === "text-image" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4032
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("shrink-0 overflow-hidden rounded", imageSize), children: imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4033
|
+
"img",
|
|
4034
|
+
{
|
|
4035
|
+
alt: "",
|
|
4036
|
+
className: "pointer-events-none size-full object-cover",
|
|
4037
|
+
src: imageSrc
|
|
4038
|
+
}
|
|
4039
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full bg-hover-bg" }) }),
|
|
4040
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
4041
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-sm leading-5", primaryTextClass), children: label }),
|
|
4042
|
+
hasDescription && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs leading-4 font-normal text-subtle-text", children: description })
|
|
4043
|
+
] })
|
|
4044
|
+
] }),
|
|
4045
|
+
type === "tag" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(Tag, { text: tagText, size: "large", variant: tagVariant }) }),
|
|
4046
|
+
type === "icon" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4047
|
+
"div",
|
|
4048
|
+
{
|
|
4049
|
+
className: cn(
|
|
4050
|
+
"flex items-center",
|
|
4051
|
+
contentAlign === "start" ? "justify-start" : "justify-center"
|
|
4052
|
+
),
|
|
4053
|
+
children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(react.Circle, { size: 24, weight: "regular", className: "text-subtle-text" })
|
|
4054
|
+
}
|
|
4055
|
+
),
|
|
4056
|
+
type === "button" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4057
|
+
"div",
|
|
4058
|
+
{
|
|
4059
|
+
className: cn(
|
|
4060
|
+
"flex items-center",
|
|
4061
|
+
contentAlign === "start" ? "justify-start" : "justify-center"
|
|
4062
|
+
),
|
|
4063
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "xs", variant: "outline-black", children: "Button" })
|
|
4064
|
+
}
|
|
4065
|
+
),
|
|
4066
|
+
type === "checkbox" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4067
|
+
"div",
|
|
4068
|
+
{
|
|
4069
|
+
className: cn(
|
|
4070
|
+
"flex items-center",
|
|
4071
|
+
contentAlign === "start" ? "justify-start" : "justify-center"
|
|
4072
|
+
),
|
|
4073
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { checked: cellSelected })
|
|
4074
|
+
}
|
|
4075
|
+
)
|
|
4076
|
+
]
|
|
4077
|
+
}
|
|
4078
|
+
);
|
|
4079
|
+
});
|
|
4080
|
+
Table.displayName = "Table";
|
|
4081
|
+
TableRow.displayName = "TableRow";
|
|
4082
|
+
TableHeaderCell.displayName = "TableHeaderCell";
|
|
4083
|
+
TableCell.displayName = "TableCell";
|
|
3233
4084
|
const TextArea = React.forwardRef(
|
|
3234
4085
|
function TextArea2({
|
|
3235
4086
|
placeholder = "Text label",
|
|
@@ -4048,24 +4899,24 @@ const TimeInput = React.forwardRef(
|
|
|
4048
4899
|
TimeInput.displayName = "TimeInput";
|
|
4049
4900
|
exports.Button = Button;
|
|
4050
4901
|
exports.Card = Card;
|
|
4051
|
-
exports.
|
|
4902
|
+
exports.Checkbox = Checkbox;
|
|
4052
4903
|
exports.Chip = Chip;
|
|
4053
4904
|
exports.DateInput = DateInput;
|
|
4054
4905
|
exports.Dropdown = Dropdown;
|
|
4055
4906
|
exports.DropdownMultiple = DropdownMultiple;
|
|
4056
4907
|
exports.Input = Input;
|
|
4057
4908
|
exports.OptionList = OptionList;
|
|
4058
|
-
exports.
|
|
4059
|
-
exports.PageHeader = PageHeader;
|
|
4909
|
+
exports.Radio = Radio;
|
|
4060
4910
|
exports.SearchInput = SearchInput;
|
|
4061
|
-
exports.Section = Section;
|
|
4062
|
-
exports.Stack = Stack;
|
|
4063
4911
|
exports.StatusTag = StatusTag;
|
|
4064
4912
|
exports.Tab = Tab;
|
|
4065
4913
|
exports.TabGroup = TabGroup;
|
|
4914
|
+
exports.Table = Table;
|
|
4915
|
+
exports.TableCell = TableCell;
|
|
4916
|
+
exports.TableHeaderCell = TableHeaderCell;
|
|
4917
|
+
exports.TableRow = TableRow;
|
|
4066
4918
|
exports.Tag = Tag;
|
|
4067
4919
|
exports.TextArea = TextArea;
|
|
4068
4920
|
exports.TimeInput = TimeInput;
|
|
4069
|
-
exports.Toolbar = Toolbar;
|
|
4070
4921
|
exports.cn = cn;
|
|
4071
4922
|
//# sourceMappingURL=index.cjs.map
|