@teja-app/ui 0.0.14 → 0.0.15

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.
@@ -777,6 +777,61 @@ function Badge({
777
777
  children
778
778
  ] });
779
779
  }
780
+ const TONE_COLORS = {
781
+ waiting: { bg: "var(--ai-soft)", fg: "var(--ai)", dot: "var(--ai)" },
782
+ soon: { bg: "var(--warning-soft)", fg: "var(--warning)", dot: "var(--warning)" },
783
+ ready: { bg: "var(--success-soft)", fg: "var(--success)", dot: "var(--success)" }
784
+ };
785
+ function CountdownPill({
786
+ tone,
787
+ label,
788
+ icon = "clock",
789
+ dot,
790
+ testId,
791
+ "data-testid": dataTestId
792
+ }) {
793
+ const showDot = dot ?? tone !== "ready";
794
+ return /* @__PURE__ */ jsxs(
795
+ Badge,
796
+ {
797
+ tone: "neutral",
798
+ colors: TONE_COLORS[tone],
799
+ dot: showDot,
800
+ testId,
801
+ "data-testid": dataTestId,
802
+ children: [
803
+ /* @__PURE__ */ jsx(Icon, { name: icon, size: 12 }),
804
+ /* @__PURE__ */ jsx("span", { style: { fontFamily: "var(--font-mono)", fontWeight: 600 }, children: label })
805
+ ]
806
+ }
807
+ );
808
+ }
809
+ const DAY_S = 86400;
810
+ const HOUR_S = 3600;
811
+ const MIN_S = 60;
812
+ function countdownParts(startMs, nowMs, soonThresholdSeconds = 120) {
813
+ const deltaMs = startMs - nowMs;
814
+ if (deltaMs <= 0) {
815
+ return {
816
+ tone: "ready",
817
+ days: 0,
818
+ hours: 0,
819
+ minutes: 0,
820
+ seconds: 0,
821
+ unit: "now",
822
+ clock: "00:00"
823
+ };
824
+ }
825
+ const total = Math.floor(deltaMs / 1e3);
826
+ const days = Math.floor(total / DAY_S);
827
+ const hours = Math.floor(total % DAY_S / HOUR_S);
828
+ const minutes = Math.floor(total % HOUR_S / MIN_S);
829
+ const seconds = total % MIN_S;
830
+ const unit = days > 0 ? "days" : hours > 0 ? "hours" : "minutes";
831
+ const clock = `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
832
+ const tone = total <= soonThresholdSeconds ? "soon" : "waiting";
833
+ return { tone, days, hours, minutes, seconds, unit, clock };
834
+ }
780
835
  const Card = forwardRef(function Card2({
781
836
  padding = 20,
782
837
  children,
@@ -19093,6 +19148,7 @@ export {
19093
19148
  Chip,
19094
19149
  Combobox,
19095
19150
  ConfirmDialog,
19151
+ CountdownPill,
19096
19152
  CountryPicker,
19097
19153
  DEFAULT_LANG_OPTIONS,
19098
19154
  DENSITY_OPTIONS,
@@ -19185,6 +19241,7 @@ export {
19185
19241
  ViewToggle,
19186
19242
  applyTheme,
19187
19243
  controlBoxStyle,
19244
+ countdownParts,
19188
19245
  ensureAIStyles,
19189
19246
  ensureSidebarNavStyles,
19190
19247
  ensureSkeletonStyles,