@processdynamics/components 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -200,6 +200,7 @@ The packages the components import are declared as `peerDependencies` in `packag
200
200
  - `lucide-react` for icons
201
201
  - `class-variance-authority` for button variants
202
202
  - `cn` for class merging
203
+ - `sonner` for the toaster
203
204
 
204
205
  They are also dev dependencies here so Storybook and the tests can run.
205
206
 
package/dist/index.cjs CHANGED
@@ -32,7 +32,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var index_exports = {};
33
33
  __export(index_exports, {
34
34
  DatePicker: () => DatePicker,
35
- JobCard: () => JobCard
35
+ DebouncedInput: () => DebouncedInput,
36
+ JobCard: () => JobCard,
37
+ Toaster: () => Toaster2,
38
+ toast: () => import_sonner2.toast,
39
+ toastColors: () => toastColors
36
40
  });
37
41
  module.exports = __toCommonJS(index_exports);
38
42
 
@@ -423,15 +427,103 @@ var DatePicker = ({
423
427
  );
424
428
  };
425
429
 
430
+ // src/components/debounceInput/DebouncedInput.tsx
431
+ var import_react2 = require("react");
432
+
433
+ // src/lib/debounce.ts
434
+ function debounce(fn, delayMs) {
435
+ let timeout = null;
436
+ let latestArgs = null;
437
+ const run = () => {
438
+ const args = latestArgs;
439
+ timeout = null;
440
+ latestArgs = null;
441
+ if (args) fn(...args);
442
+ };
443
+ const debounced = (...args) => {
444
+ latestArgs = args;
445
+ if (timeout) clearTimeout(timeout);
446
+ timeout = setTimeout(run, delayMs);
447
+ };
448
+ debounced.cancel = () => {
449
+ if (timeout) clearTimeout(timeout);
450
+ timeout = null;
451
+ latestArgs = null;
452
+ };
453
+ debounced.flush = () => {
454
+ if (!timeout) return;
455
+ clearTimeout(timeout);
456
+ run();
457
+ };
458
+ return debounced;
459
+ }
460
+
461
+ // src/components/debounceInput/DebouncedInput.tsx
462
+ var import_jsx_runtime6 = require("react/jsx-runtime");
463
+ function DebouncedInput({
464
+ value,
465
+ onValueChange,
466
+ delay = 250,
467
+ onFocus,
468
+ onBlur,
469
+ ...inputProps
470
+ }) {
471
+ const [text, setText] = (0, import_react2.useState)(value);
472
+ const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
473
+ const onValueChangeRef = (0, import_react2.useRef)(onValueChange);
474
+ (0, import_react2.useEffect)(() => {
475
+ onValueChangeRef.current = onValueChange;
476
+ });
477
+ const commitTextRef = (0, import_react2.useRef)(null);
478
+ (0, import_react2.useEffect)(() => {
479
+ const commitText = debounce(
480
+ (next) => onValueChangeRef.current(next),
481
+ delay
482
+ );
483
+ commitTextRef.current = commitText;
484
+ const flushWaitingText = () => commitText.flush();
485
+ document.addEventListener("pointerdown", flushWaitingText, true);
486
+ return () => {
487
+ document.removeEventListener("pointerdown", flushWaitingText, true);
488
+ commitText.flush();
489
+ commitTextRef.current = null;
490
+ };
491
+ }, [delay]);
492
+ if (!isFocused && text !== value) {
493
+ setText(value);
494
+ }
495
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
496
+ Input,
497
+ {
498
+ ...inputProps,
499
+ type: "text",
500
+ value: text,
501
+ onChange: (e) => {
502
+ setText(e.target.value);
503
+ commitTextRef.current?.(e.target.value);
504
+ },
505
+ onFocus: (e) => {
506
+ setIsFocused(true);
507
+ onFocus?.(e);
508
+ },
509
+ onBlur: (e) => {
510
+ commitTextRef.current?.flush();
511
+ setIsFocused(false);
512
+ onBlur?.(e);
513
+ }
514
+ }
515
+ );
516
+ }
517
+
426
518
  // src/components/ui/card.tsx
427
519
  var import_cn5 = require("cn");
428
- var import_jsx_runtime6 = require("react/jsx-runtime");
520
+ var import_jsx_runtime7 = require("react/jsx-runtime");
429
521
  function Card({
430
522
  className,
431
523
  size = "default",
432
524
  ...props
433
525
  }) {
434
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
526
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
435
527
  "div",
436
528
  {
437
529
  "data-slot": "card",
@@ -445,7 +537,7 @@ function Card({
445
537
  );
446
538
  }
447
539
  function CardContent({ className, ...props }) {
448
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
540
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
449
541
  "div",
450
542
  {
451
543
  "data-slot": "card-content",
@@ -459,14 +551,14 @@ function CardContent({ className, ...props }) {
459
551
  var import_cn6 = require("cn");
460
552
 
461
553
  // src/components/jobCard/JobCardBannerBar.tsx
462
- var import_jsx_runtime7 = require("react/jsx-runtime");
463
- var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mt-3 flex items-center gap-2 rounded border border-blue-300 bg-blue-50 px-3 py-1.5 text-xs text-gray-600 shadow [&>svg]:h-4 [&>svg]:w-4", children: [
554
+ var import_jsx_runtime8 = require("react/jsx-runtime");
555
+ var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mt-3 flex items-center gap-2 rounded border border-blue-300 bg-blue-50 px-3 py-1.5 text-xs text-gray-600 shadow [&>svg]:h-4 [&>svg]:w-4", children: [
464
556
  banner.icon,
465
557
  banner.label
466
558
  ] });
467
559
 
468
560
  // src/components/jobCard/JobCardParts.tsx
469
- var import_jsx_runtime8 = require("react/jsx-runtime");
561
+ var import_jsx_runtime9 = require("react/jsx-runtime");
470
562
  var DEFAULT_STAGE_COLOR = "#6b7280";
471
563
  var BADGE_COLOR_CLASSES = {
472
564
  gray: "bg-gray-300",
@@ -477,45 +569,45 @@ var BADGE_COLOR_CLASSES = {
477
569
  blue: "bg-blue-300",
478
570
  purple: "bg-purple-300"
479
571
  };
480
- var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex justify-between w-full", children: [
481
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-2 font-bold text-base", children: [
572
+ var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between w-full", children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex items-center gap-2 font-bold text-base", children: [
482
574
  leadingContent,
483
575
  title
484
576
  ] }),
485
- stage && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
486
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
577
+ stage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
578
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
487
579
  "span",
488
580
  {
489
581
  className: "w-2 h-2 rounded-full",
490
582
  style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
491
583
  }
492
584
  ),
493
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-gray-900", children: stage.label })
585
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-gray-900", children: stage.label })
494
586
  ] })
495
587
  ] }) });
496
- var JobCardDetails = ({ details }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
497
- var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
588
+ var JobCardDetails = ({ details }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
589
+ var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
498
590
  "div",
499
591
  {
500
592
  className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
501
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: callout })
593
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: callout })
502
594
  },
503
595
  `${index}-${callout}`
504
596
  )) }) });
505
597
  var JobCardSummary = ({
506
598
  job,
507
599
  leadingContent
508
- }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full", children: [
509
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
510
- job.subtitle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
511
- job.details && job.details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardDetails, { details: job.details }),
512
- job.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
513
- job.callouts && job.callouts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JobCardCallouts, { callouts: job.callouts })
600
+ }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full", children: [
601
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
602
+ job.subtitle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
603
+ job.details && job.details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardDetails, { details: job.details }),
604
+ job.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
605
+ job.callouts && job.callouts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardCallouts, { callouts: job.callouts })
514
606
  ] });
515
607
  var JobCardBadgeBlock = ({
516
608
  badge,
517
609
  hasPills
518
- }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
610
+ }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
519
611
  "span",
520
612
  {
521
613
  className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
@@ -524,7 +616,7 @@ var JobCardBadgeBlock = ({
524
616
  ) });
525
617
 
526
618
  // src/components/jobCard/JobCardPills.tsx
527
- var import_jsx_runtime9 = require("react/jsx-runtime");
619
+ var import_jsx_runtime10 = require("react/jsx-runtime");
528
620
  var PILL_BASE = "flex items-center gap-1 h-5 rounded-full text-center text-[10px] md:text-xs [&>svg]:w-3 [&>svg]:h-3";
529
621
  var PILL_TONE_CLASSES = {
530
622
  critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
@@ -538,27 +630,27 @@ var PILL_TONE_CLASSES = {
538
630
  outline: "px-3 border border-gray-300 bg-white text-gray-600",
539
631
  dashed: "px-3 border border-dashed border-gray-400 bg-white text-gray-600"
540
632
  };
541
- var JobCardPillItem = ({ pill }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: `${PILL_BASE} ${PILL_TONE_CLASSES[pill.tone]}`, children: [
633
+ var JobCardPillItem = ({ pill }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: `${PILL_BASE} ${PILL_TONE_CLASSES[pill.tone]}`, children: [
542
634
  pill.icon,
543
635
  pill.label
544
636
  ] });
545
637
  var JobCardPillList = ({ pills }) => {
546
638
  const priorityPills = pills.filter((pill) => pill.priority);
547
639
  const otherPills = pills.filter((pill) => !pill.priority);
548
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 flex-wrap", children: [
549
- priorityPills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
640
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-2 flex-wrap", children: [
641
+ priorityPills.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
550
642
  "div",
551
643
  {
552
644
  className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
553
- children: priorityPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardPillItem, { pill }, pill.label))
645
+ children: priorityPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardPillItem, { pill }, pill.label))
554
646
  }
555
647
  ),
556
- otherPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(JobCardPillItem, { pill }, pill.label))
648
+ otherPills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardPillItem, { pill }, pill.label))
557
649
  ] });
558
650
  };
559
651
 
560
652
  // src/components/jobCard/JobCard.tsx
561
- var import_jsx_runtime10 = require("react/jsx-runtime");
653
+ var import_jsx_runtime11 = require("react/jsx-runtime");
562
654
  var CARD_TONE_CLASSES = {
563
655
  success: "border-green-400 bg-green-50",
564
656
  warning: "border-orange-400 bg-orange-50",
@@ -574,7 +666,7 @@ var JobCard = ({
574
666
  className
575
667
  }) => {
576
668
  const hasPills = Boolean(job.pills && job.pills.length > 0);
577
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
669
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
578
670
  Card,
579
671
  {
580
672
  onClick,
@@ -588,14 +680,14 @@ var JobCard = ({
588
680
  CARD_TONE_CLASSES[job.tone ?? "neutral"],
589
681
  className
590
682
  ),
591
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(CardContent, { className: "p-3.5", children: [
592
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardSummary, { job, leadingContent }) }),
593
- (job.badge || hasPills) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-2 text-xs", children: [
594
- job.badge && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardBadgeBlock, { badge: job.badge, hasPills }),
595
- hasPills && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardPillList, { pills: job.pills ?? [] })
683
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CardContent, { className: "p-3.5", children: [
684
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(JobCardSummary, { job, leadingContent }) }),
685
+ (job.badge || hasPills) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-2 text-xs", children: [
686
+ job.badge && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(JobCardBadgeBlock, { badge: job.badge, hasPills }),
687
+ hasPills && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(JobCardPillList, { pills: job.pills ?? [] })
596
688
  ] }),
597
- job.banner && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(JobCardBannerBar, { banner: job.banner }),
598
- action && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
689
+ job.banner && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(JobCardBannerBar, { banner: job.banner }),
690
+ action && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
599
691
  Button,
600
692
  {
601
693
  onClick: (event) => {
@@ -608,13 +700,70 @@ var JobCard = ({
608
700
  children: action.label
609
701
  }
610
702
  ),
611
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: expandedContent })
703
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: expandedContent })
612
704
  ] })
613
705
  }
614
706
  );
615
707
  };
708
+
709
+ // src/components/toaster/Toaster.tsx
710
+ var import_sonner2 = require("sonner");
711
+
712
+ // src/components/ui/sonner.tsx
713
+ var import_sonner = require("sonner");
714
+ var import_lucide_react3 = require("lucide-react");
715
+ var import_jsx_runtime12 = require("react/jsx-runtime");
716
+ var Toaster = ({ icons, ...props }) => {
717
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
718
+ import_sonner.Toaster,
719
+ {
720
+ className: "toaster group",
721
+ icons: {
722
+ success: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.CircleCheckIcon, { className: "size-4" }),
723
+ info: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.InfoIcon, { className: "size-4" }),
724
+ warning: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.TriangleAlertIcon, { className: "size-4" }),
725
+ error: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.OctagonXIcon, { className: "size-4" }),
726
+ loading: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Loader2Icon, { className: "size-4 animate-spin" }),
727
+ ...icons
728
+ },
729
+ style: {
730
+ "--normal-bg": "var(--popover)",
731
+ "--normal-text": "var(--popover-foreground)",
732
+ "--normal-border": "var(--border)",
733
+ "--border-radius": "var(--radius)"
734
+ },
735
+ toastOptions: {
736
+ classNames: {
737
+ toast: "cn-toast"
738
+ }
739
+ },
740
+ ...props
741
+ }
742
+ );
743
+ };
744
+
745
+ // src/components/toaster/Toaster.tsx
746
+ var import_jsx_runtime13 = require("react/jsx-runtime");
747
+ function toastColors({
748
+ background,
749
+ text,
750
+ border
751
+ }) {
752
+ return {
753
+ ...background && { "--normal-bg": background },
754
+ ...text && { "--normal-text": text },
755
+ ...border && { "--normal-border": border }
756
+ };
757
+ }
758
+ function Toaster2({ position = "top-center", ...props }) {
759
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Toaster, { position, ...props });
760
+ }
616
761
  // Annotate the CommonJS export names for ESM import in node:
617
762
  0 && (module.exports = {
618
763
  DatePicker,
619
- JobCard
764
+ DebouncedInput,
765
+ JobCard,
766
+ Toaster,
767
+ toast,
768
+ toastColors
620
769
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties } from 'react';
3
+ import { ToasterProps as ToasterProps$1 } from 'sonner';
4
+ export { toast } from 'sonner';
3
5
 
4
6
  interface IDatePicker {
5
7
  /**
@@ -38,6 +40,49 @@ interface IDatePicker {
38
40
  */
39
41
  declare const DatePicker: ({ onSelect, date, dateFormat, }: IDatePicker) => react.JSX.Element;
40
42
 
43
+ declare function Input({ className, type, ...props }: react.ComponentProps<"input">): react.JSX.Element;
44
+
45
+ interface DebouncedInputProps extends Omit<ComponentProps<typeof Input>, "type" | "value" | "defaultValue" | "onChange"> {
46
+ /**
47
+ * The text the owner holds. Controlled: the box shows what is typed at once,
48
+ * and follows this value when it changes from elsewhere (opening a saved job,
49
+ * resetting the form). While the box has focus, outside changes are ignored
50
+ * so they cannot overwrite characters typed since.
51
+ */
52
+ value: string;
53
+ /**
54
+ * Called with the latest text once typing has paused for `delay`, and not on
55
+ * every keystroke. The waiting text is also passed through at once when the
56
+ * box loses focus, when it unmounts, and on the next press anywhere on the
57
+ * page. The owner should store it and pass it back as `value`.
58
+ */
59
+ onValueChange: (value: string) => void;
60
+ /** How long typing must pause before `onValueChange` is called. */
61
+ delay?: number;
62
+ /**
63
+ * Called when the box gains focus. Typing is not reported by this: it only
64
+ * says the box was entered, and the value is unchanged.
65
+ */
66
+ onFocus?: FocusEventHandler<HTMLInputElement>;
67
+ /**
68
+ * Called when the box loses focus. Any text still waiting for the pause is
69
+ * passed to `onValueChange` first, so by the time this runs the owner already
70
+ * holds what was typed.
71
+ */
72
+ onBlur?: FocusEventHandler<HTMLInputElement>;
73
+ }
74
+ /**
75
+ * Text input that tells its owner about a change only after typing pauses.
76
+ *
77
+ * The typed text lives locally so every keystroke shows at once, while the
78
+ * owner (a store that re-renders a whole form) is written to once per pause.
79
+ * The waiting text is pushed through straight away on blur, on unmount, and on
80
+ * the next press anywhere on the page. The press covers a Save tapped soon
81
+ * after typing: iOS Safari does not blur a focused input when a button is
82
+ * tapped, so blur alone could let Save read the old value.
83
+ */
84
+ declare function DebouncedInput({ value, onValueChange, delay, onFocus, onBlur, ...inputProps }: DebouncedInputProps): react.JSX.Element;
85
+
41
86
  /**
42
87
  * How the whole card is coloured. `success` is green, `warning` orange,
43
88
  * `danger` red and `neutral` grey. What each one means is up to the using app,
@@ -166,5 +211,62 @@ interface JobCardProps {
166
211
  */
167
212
  declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
168
213
 
169
- export { DatePicker, JobCard };
170
- export type { JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone };
214
+ declare const Toaster$1: ({ icons, ...props }: ToasterProps$1) => react.JSX.Element;
215
+
216
+ type SonnerToasterProps = ComponentProps<typeof Toaster$1>;
217
+ /**
218
+ * Props for `Toaster`. Any other Sonner toaster prop (`duration`, `richColors`,
219
+ * `closeButton` and so on) is passed straight through.
220
+ */
221
+ interface ToasterProps extends SonnerToasterProps {
222
+ /**
223
+ * Where on the screen toasts appear: a vertical edge and a horizontal place,
224
+ * such as `"top-center"` or `"bottom-right"`. Default `"top-center"`.
225
+ */
226
+ position?: SonnerToasterProps["position"];
227
+ /**
228
+ * `"light"`, `"dark"` or `"system"`. It is not read from the app, so pass it
229
+ * if toasts should follow a theme. Default is Sonner's own (light).
230
+ */
231
+ theme?: SonnerToasterProps["theme"];
232
+ /**
233
+ * Replaces the icon for a type of toast: `success`, `info`, `warning`,
234
+ * `error`, `loading` or `close`. Optional, and only the types given change,
235
+ * the others keep their default icon. A single toast can also set its own
236
+ * with `toast("Saved", { icon: <StarIcon /> })`.
237
+ */
238
+ icons?: SonnerToasterProps["icons"];
239
+ }
240
+ /**
241
+ * Colors for one toast. Every field is optional, and one left out keeps the
242
+ * theme's color. Each is any CSS color, or a theme variable such as
243
+ * `var(--primary)`.
244
+ */
245
+ interface ToastColors {
246
+ /** Background of the toast. */
247
+ background?: string;
248
+ /** Color of the message and the icon. */
249
+ text?: string;
250
+ /** Color of the toast's border. */
251
+ border?: string;
252
+ }
253
+ /**
254
+ * Turns colors into the `style` of a single toast:
255
+ * `toast("Saved", { style: toastColors({ background: "var(--primary)" }) })`.
256
+ *
257
+ * It sets the toast's own color variables, which is why the color names are
258
+ * not needed by the caller. With the `richColors` prop on, the success, error,
259
+ * warning and info toasts use their own colors instead, and these are ignored.
260
+ */
261
+ declare function toastColors({ background, text, border, }: ToastColors): CSSProperties;
262
+ /**
263
+ * Where toasts appear and how they look. Mount it once near the root of the
264
+ * app, then show a toast from anywhere by calling `toast`.
265
+ *
266
+ * `position` defaults to `"top-center"`. The theme is not read from the app:
267
+ * pass `theme` (`"light"`, `"dark"` or `"system"`) if it should follow one.
268
+ */
269
+ declare function Toaster({ position, ...props }: ToasterProps): react.JSX.Element;
270
+
271
+ export { DatePicker, DebouncedInput, JobCard, Toaster, toastColors };
272
+ export type { DebouncedInputProps, JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone, ToastColors, ToasterProps };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties } from 'react';
3
+ import { ToasterProps as ToasterProps$1 } from 'sonner';
4
+ export { toast } from 'sonner';
3
5
 
4
6
  interface IDatePicker {
5
7
  /**
@@ -38,6 +40,49 @@ interface IDatePicker {
38
40
  */
39
41
  declare const DatePicker: ({ onSelect, date, dateFormat, }: IDatePicker) => react.JSX.Element;
40
42
 
43
+ declare function Input({ className, type, ...props }: react.ComponentProps<"input">): react.JSX.Element;
44
+
45
+ interface DebouncedInputProps extends Omit<ComponentProps<typeof Input>, "type" | "value" | "defaultValue" | "onChange"> {
46
+ /**
47
+ * The text the owner holds. Controlled: the box shows what is typed at once,
48
+ * and follows this value when it changes from elsewhere (opening a saved job,
49
+ * resetting the form). While the box has focus, outside changes are ignored
50
+ * so they cannot overwrite characters typed since.
51
+ */
52
+ value: string;
53
+ /**
54
+ * Called with the latest text once typing has paused for `delay`, and not on
55
+ * every keystroke. The waiting text is also passed through at once when the
56
+ * box loses focus, when it unmounts, and on the next press anywhere on the
57
+ * page. The owner should store it and pass it back as `value`.
58
+ */
59
+ onValueChange: (value: string) => void;
60
+ /** How long typing must pause before `onValueChange` is called. */
61
+ delay?: number;
62
+ /**
63
+ * Called when the box gains focus. Typing is not reported by this: it only
64
+ * says the box was entered, and the value is unchanged.
65
+ */
66
+ onFocus?: FocusEventHandler<HTMLInputElement>;
67
+ /**
68
+ * Called when the box loses focus. Any text still waiting for the pause is
69
+ * passed to `onValueChange` first, so by the time this runs the owner already
70
+ * holds what was typed.
71
+ */
72
+ onBlur?: FocusEventHandler<HTMLInputElement>;
73
+ }
74
+ /**
75
+ * Text input that tells its owner about a change only after typing pauses.
76
+ *
77
+ * The typed text lives locally so every keystroke shows at once, while the
78
+ * owner (a store that re-renders a whole form) is written to once per pause.
79
+ * The waiting text is pushed through straight away on blur, on unmount, and on
80
+ * the next press anywhere on the page. The press covers a Save tapped soon
81
+ * after typing: iOS Safari does not blur a focused input when a button is
82
+ * tapped, so blur alone could let Save read the old value.
83
+ */
84
+ declare function DebouncedInput({ value, onValueChange, delay, onFocus, onBlur, ...inputProps }: DebouncedInputProps): react.JSX.Element;
85
+
41
86
  /**
42
87
  * How the whole card is coloured. `success` is green, `warning` orange,
43
88
  * `danger` red and `neutral` grey. What each one means is up to the using app,
@@ -166,5 +211,62 @@ interface JobCardProps {
166
211
  */
167
212
  declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
168
213
 
169
- export { DatePicker, JobCard };
170
- export type { JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone };
214
+ declare const Toaster$1: ({ icons, ...props }: ToasterProps$1) => react.JSX.Element;
215
+
216
+ type SonnerToasterProps = ComponentProps<typeof Toaster$1>;
217
+ /**
218
+ * Props for `Toaster`. Any other Sonner toaster prop (`duration`, `richColors`,
219
+ * `closeButton` and so on) is passed straight through.
220
+ */
221
+ interface ToasterProps extends SonnerToasterProps {
222
+ /**
223
+ * Where on the screen toasts appear: a vertical edge and a horizontal place,
224
+ * such as `"top-center"` or `"bottom-right"`. Default `"top-center"`.
225
+ */
226
+ position?: SonnerToasterProps["position"];
227
+ /**
228
+ * `"light"`, `"dark"` or `"system"`. It is not read from the app, so pass it
229
+ * if toasts should follow a theme. Default is Sonner's own (light).
230
+ */
231
+ theme?: SonnerToasterProps["theme"];
232
+ /**
233
+ * Replaces the icon for a type of toast: `success`, `info`, `warning`,
234
+ * `error`, `loading` or `close`. Optional, and only the types given change,
235
+ * the others keep their default icon. A single toast can also set its own
236
+ * with `toast("Saved", { icon: <StarIcon /> })`.
237
+ */
238
+ icons?: SonnerToasterProps["icons"];
239
+ }
240
+ /**
241
+ * Colors for one toast. Every field is optional, and one left out keeps the
242
+ * theme's color. Each is any CSS color, or a theme variable such as
243
+ * `var(--primary)`.
244
+ */
245
+ interface ToastColors {
246
+ /** Background of the toast. */
247
+ background?: string;
248
+ /** Color of the message and the icon. */
249
+ text?: string;
250
+ /** Color of the toast's border. */
251
+ border?: string;
252
+ }
253
+ /**
254
+ * Turns colors into the `style` of a single toast:
255
+ * `toast("Saved", { style: toastColors({ background: "var(--primary)" }) })`.
256
+ *
257
+ * It sets the toast's own color variables, which is why the color names are
258
+ * not needed by the caller. With the `richColors` prop on, the success, error,
259
+ * warning and info toasts use their own colors instead, and these are ignored.
260
+ */
261
+ declare function toastColors({ background, text, border, }: ToastColors): CSSProperties;
262
+ /**
263
+ * Where toasts appear and how they look. Mount it once near the root of the
264
+ * app, then show a toast from anywhere by calling `toast`.
265
+ *
266
+ * `position` defaults to `"top-center"`. The theme is not read from the app:
267
+ * pass `theme` (`"light"`, `"dark"` or `"system"`) if it should follow one.
268
+ */
269
+ declare function Toaster({ position, ...props }: ToasterProps): react.JSX.Element;
270
+
271
+ export { DatePicker, DebouncedInput, JobCard, Toaster, toastColors };
272
+ export type { DebouncedInputProps, JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone, ToastColors, ToasterProps };
package/dist/index.js CHANGED
@@ -390,15 +390,107 @@ var DatePicker = ({
390
390
  );
391
391
  };
392
392
 
393
+ // src/components/debounceInput/DebouncedInput.tsx
394
+ import {
395
+ useEffect as useEffect2,
396
+ useRef as useRef2,
397
+ useState as useState2
398
+ } from "react";
399
+
400
+ // src/lib/debounce.ts
401
+ function debounce(fn, delayMs) {
402
+ let timeout = null;
403
+ let latestArgs = null;
404
+ const run = () => {
405
+ const args = latestArgs;
406
+ timeout = null;
407
+ latestArgs = null;
408
+ if (args) fn(...args);
409
+ };
410
+ const debounced = (...args) => {
411
+ latestArgs = args;
412
+ if (timeout) clearTimeout(timeout);
413
+ timeout = setTimeout(run, delayMs);
414
+ };
415
+ debounced.cancel = () => {
416
+ if (timeout) clearTimeout(timeout);
417
+ timeout = null;
418
+ latestArgs = null;
419
+ };
420
+ debounced.flush = () => {
421
+ if (!timeout) return;
422
+ clearTimeout(timeout);
423
+ run();
424
+ };
425
+ return debounced;
426
+ }
427
+
428
+ // src/components/debounceInput/DebouncedInput.tsx
429
+ import { jsx as jsx6 } from "react/jsx-runtime";
430
+ function DebouncedInput({
431
+ value,
432
+ onValueChange,
433
+ delay = 250,
434
+ onFocus,
435
+ onBlur,
436
+ ...inputProps
437
+ }) {
438
+ const [text, setText] = useState2(value);
439
+ const [isFocused, setIsFocused] = useState2(false);
440
+ const onValueChangeRef = useRef2(onValueChange);
441
+ useEffect2(() => {
442
+ onValueChangeRef.current = onValueChange;
443
+ });
444
+ const commitTextRef = useRef2(null);
445
+ useEffect2(() => {
446
+ const commitText = debounce(
447
+ (next) => onValueChangeRef.current(next),
448
+ delay
449
+ );
450
+ commitTextRef.current = commitText;
451
+ const flushWaitingText = () => commitText.flush();
452
+ document.addEventListener("pointerdown", flushWaitingText, true);
453
+ return () => {
454
+ document.removeEventListener("pointerdown", flushWaitingText, true);
455
+ commitText.flush();
456
+ commitTextRef.current = null;
457
+ };
458
+ }, [delay]);
459
+ if (!isFocused && text !== value) {
460
+ setText(value);
461
+ }
462
+ return /* @__PURE__ */ jsx6(
463
+ Input,
464
+ {
465
+ ...inputProps,
466
+ type: "text",
467
+ value: text,
468
+ onChange: (e) => {
469
+ setText(e.target.value);
470
+ commitTextRef.current?.(e.target.value);
471
+ },
472
+ onFocus: (e) => {
473
+ setIsFocused(true);
474
+ onFocus?.(e);
475
+ },
476
+ onBlur: (e) => {
477
+ commitTextRef.current?.flush();
478
+ setIsFocused(false);
479
+ onBlur?.(e);
480
+ }
481
+ }
482
+ );
483
+ }
484
+
393
485
  // src/components/ui/card.tsx
394
486
  import { cn as cn5 } from "cn";
395
- import { jsx as jsx6 } from "react/jsx-runtime";
487
+ import { jsx as jsx7 } from "react/jsx-runtime";
396
488
  function Card({
397
489
  className,
398
490
  size = "default",
399
491
  ...props
400
492
  }) {
401
- return /* @__PURE__ */ jsx6(
493
+ return /* @__PURE__ */ jsx7(
402
494
  "div",
403
495
  {
404
496
  "data-slot": "card",
@@ -412,7 +504,7 @@ function Card({
412
504
  );
413
505
  }
414
506
  function CardContent({ className, ...props }) {
415
- return /* @__PURE__ */ jsx6(
507
+ return /* @__PURE__ */ jsx7(
416
508
  "div",
417
509
  {
418
510
  "data-slot": "card-content",
@@ -433,7 +525,7 @@ var JobCardBannerBar = ({ banner }) => /* @__PURE__ */ jsxs2("div", { className:
433
525
  ] });
434
526
 
435
527
  // src/components/jobCard/JobCardParts.tsx
436
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
528
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
437
529
  var DEFAULT_STAGE_COLOR = "#6b7280";
438
530
  var BADGE_COLOR_CLASSES = {
439
531
  gray: "bg-gray-300",
@@ -444,28 +536,28 @@ var BADGE_COLOR_CLASSES = {
444
536
  blue: "bg-blue-300",
445
537
  purple: "bg-purple-300"
446
538
  };
447
- var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-between w-full", children: [
539
+ var JobCardHeading = ({ title, stage, leadingContent }) => /* @__PURE__ */ jsx8("div", { className: "flex items-center gap-2 mb-1", children: /* @__PURE__ */ jsxs3("div", { className: "flex justify-between w-full", children: [
448
540
  /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2 font-bold text-base", children: [
449
541
  leadingContent,
450
542
  title
451
543
  ] }),
452
544
  stage && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 text-xs", children: [
453
- /* @__PURE__ */ jsx7(
545
+ /* @__PURE__ */ jsx8(
454
546
  "span",
455
547
  {
456
548
  className: "w-2 h-2 rounded-full",
457
549
  style: { backgroundColor: stage.color ?? DEFAULT_STAGE_COLOR }
458
550
  }
459
551
  ),
460
- /* @__PURE__ */ jsx7("span", { className: "text-gray-900", children: stage.label })
552
+ /* @__PURE__ */ jsx8("span", { className: "text-gray-900", children: stage.label })
461
553
  ] })
462
554
  ] }) });
463
- var JobCardDetails = ({ details }) => /* @__PURE__ */ jsx7("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ jsx7("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
464
- var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ jsx7("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ jsx7("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ jsx7(
555
+ var JobCardDetails = ({ details }) => /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-1", children: details.map((detail, index) => /* @__PURE__ */ jsx8("div", { className: "text-xs text-gray-500", children: detail }, `${index}-${detail}`)) });
556
+ var JobCardCallouts = ({ callouts }) => /* @__PURE__ */ jsx8("div", { className: "flex justify-between w-full", children: /* @__PURE__ */ jsx8("div", { className: "text-xs my-1 w-full space-y-1", children: callouts.map((callout, index) => /* @__PURE__ */ jsx8(
465
557
  "div",
466
558
  {
467
559
  className: "flex gap-2 items-center border p-2 rounded bg-white shadow",
468
- children: /* @__PURE__ */ jsx7("span", { children: callout })
560
+ children: /* @__PURE__ */ jsx8("span", { children: callout })
469
561
  },
470
562
  `${index}-${callout}`
471
563
  )) }) });
@@ -473,16 +565,16 @@ var JobCardSummary = ({
473
565
  job,
474
566
  leadingContent
475
567
  }) => /* @__PURE__ */ jsxs3("div", { className: "w-full", children: [
476
- /* @__PURE__ */ jsx7(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
477
- job.subtitle && /* @__PURE__ */ jsx7("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
478
- job.details && job.details.length > 0 && /* @__PURE__ */ jsx7(JobCardDetails, { details: job.details }),
479
- job.description && /* @__PURE__ */ jsx7("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
480
- job.callouts && job.callouts.length > 0 && /* @__PURE__ */ jsx7(JobCardCallouts, { callouts: job.callouts })
568
+ /* @__PURE__ */ jsx8(JobCardHeading, { title: job.title, stage: job.stage, leadingContent }),
569
+ job.subtitle && /* @__PURE__ */ jsx8("div", { className: "text-[13px] text-gray-600 mb-1", children: job.subtitle }),
570
+ job.details && job.details.length > 0 && /* @__PURE__ */ jsx8(JobCardDetails, { details: job.details }),
571
+ job.description && /* @__PURE__ */ jsx8("div", { className: "text-sm text-gray-700 italic mt-1", children: job.description }),
572
+ job.callouts && job.callouts.length > 0 && /* @__PURE__ */ jsx8(JobCardCallouts, { callouts: job.callouts })
481
573
  ] });
482
574
  var JobCardBadgeBlock = ({
483
575
  badge,
484
576
  hasPills
485
- }) => /* @__PURE__ */ jsx7("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ jsx7(
577
+ }) => /* @__PURE__ */ jsx8("div", { className: `flex pr-4 w-20 ${hasPills ? "border-r" : ""}`, children: /* @__PURE__ */ jsx8(
486
578
  "span",
487
579
  {
488
580
  className: `flex items-center shadow border rounded px-4 py-1 text-center text-wrap ${BADGE_COLOR_CLASSES[badge.color]} ${hasPills ? "border-r" : ""}`,
@@ -491,7 +583,7 @@ var JobCardBadgeBlock = ({
491
583
  ) });
492
584
 
493
585
  // src/components/jobCard/JobCardPills.tsx
494
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
586
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
495
587
  var PILL_BASE = "flex items-center gap-1 h-5 rounded-full text-center text-[10px] md:text-xs [&>svg]:w-3 [&>svg]:h-3";
496
588
  var PILL_TONE_CLASSES = {
497
589
  critical: "px-3 bg-red-500 text-white font-bold shadow-md shadow-red-900/70",
@@ -513,19 +605,19 @@ var JobCardPillList = ({ pills }) => {
513
605
  const priorityPills = pills.filter((pill) => pill.priority);
514
606
  const otherPills = pills.filter((pill) => !pill.priority);
515
607
  return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 flex-wrap", children: [
516
- priorityPills.length > 0 && /* @__PURE__ */ jsx8(
608
+ priorityPills.length > 0 && /* @__PURE__ */ jsx9(
517
609
  "div",
518
610
  {
519
611
  className: `flex gap-2 w-full ${otherPills.length > 0 ? "pb-2 border-b" : ""}`,
520
- children: priorityPills.map((pill) => /* @__PURE__ */ jsx8(JobCardPillItem, { pill }, pill.label))
612
+ children: priorityPills.map((pill) => /* @__PURE__ */ jsx9(JobCardPillItem, { pill }, pill.label))
521
613
  }
522
614
  ),
523
- otherPills.map((pill) => /* @__PURE__ */ jsx8(JobCardPillItem, { pill }, pill.label))
615
+ otherPills.map((pill) => /* @__PURE__ */ jsx9(JobCardPillItem, { pill }, pill.label))
524
616
  ] });
525
617
  };
526
618
 
527
619
  // src/components/jobCard/JobCard.tsx
528
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
620
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
529
621
  var CARD_TONE_CLASSES = {
530
622
  success: "border-green-400 bg-green-50",
531
623
  warning: "border-orange-400 bg-orange-50",
@@ -541,7 +633,7 @@ var JobCard = ({
541
633
  className
542
634
  }) => {
543
635
  const hasPills = Boolean(job.pills && job.pills.length > 0);
544
- return /* @__PURE__ */ jsx9(
636
+ return /* @__PURE__ */ jsx10(
545
637
  Card,
546
638
  {
547
639
  onClick,
@@ -556,13 +648,13 @@ var JobCard = ({
556
648
  className
557
649
  ),
558
650
  children: /* @__PURE__ */ jsxs5(CardContent, { className: "p-3.5", children: [
559
- /* @__PURE__ */ jsx9("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ jsx9(JobCardSummary, { job, leadingContent }) }),
651
+ /* @__PURE__ */ jsx10("div", { className: "flex justify-between items-start mb-2", children: /* @__PURE__ */ jsx10(JobCardSummary, { job, leadingContent }) }),
560
652
  (job.badge || hasPills) && /* @__PURE__ */ jsxs5("div", { className: "flex gap-2 text-xs", children: [
561
- job.badge && /* @__PURE__ */ jsx9(JobCardBadgeBlock, { badge: job.badge, hasPills }),
562
- hasPills && /* @__PURE__ */ jsx9(JobCardPillList, { pills: job.pills ?? [] })
653
+ job.badge && /* @__PURE__ */ jsx10(JobCardBadgeBlock, { badge: job.badge, hasPills }),
654
+ hasPills && /* @__PURE__ */ jsx10(JobCardPillList, { pills: job.pills ?? [] })
563
655
  ] }),
564
- job.banner && /* @__PURE__ */ jsx9(JobCardBannerBar, { banner: job.banner }),
565
- action && /* @__PURE__ */ jsx9(
656
+ job.banner && /* @__PURE__ */ jsx10(JobCardBannerBar, { banner: job.banner }),
657
+ action && /* @__PURE__ */ jsx10(
566
658
  Button,
567
659
  {
568
660
  onClick: (event) => {
@@ -575,12 +667,69 @@ var JobCard = ({
575
667
  children: action.label
576
668
  }
577
669
  ),
578
- /* @__PURE__ */ jsx9("div", { children: expandedContent })
670
+ /* @__PURE__ */ jsx10("div", { children: expandedContent })
579
671
  ] })
580
672
  }
581
673
  );
582
674
  };
675
+
676
+ // src/components/toaster/Toaster.tsx
677
+ import { toast } from "sonner";
678
+
679
+ // src/components/ui/sonner.tsx
680
+ import { Toaster as Sonner } from "sonner";
681
+ import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react";
682
+ import { jsx as jsx11 } from "react/jsx-runtime";
683
+ var Toaster = ({ icons, ...props }) => {
684
+ return /* @__PURE__ */ jsx11(
685
+ Sonner,
686
+ {
687
+ className: "toaster group",
688
+ icons: {
689
+ success: /* @__PURE__ */ jsx11(CircleCheckIcon, { className: "size-4" }),
690
+ info: /* @__PURE__ */ jsx11(InfoIcon, { className: "size-4" }),
691
+ warning: /* @__PURE__ */ jsx11(TriangleAlertIcon, { className: "size-4" }),
692
+ error: /* @__PURE__ */ jsx11(OctagonXIcon, { className: "size-4" }),
693
+ loading: /* @__PURE__ */ jsx11(Loader2Icon, { className: "size-4 animate-spin" }),
694
+ ...icons
695
+ },
696
+ style: {
697
+ "--normal-bg": "var(--popover)",
698
+ "--normal-text": "var(--popover-foreground)",
699
+ "--normal-border": "var(--border)",
700
+ "--border-radius": "var(--radius)"
701
+ },
702
+ toastOptions: {
703
+ classNames: {
704
+ toast: "cn-toast"
705
+ }
706
+ },
707
+ ...props
708
+ }
709
+ );
710
+ };
711
+
712
+ // src/components/toaster/Toaster.tsx
713
+ import { jsx as jsx12 } from "react/jsx-runtime";
714
+ function toastColors({
715
+ background,
716
+ text,
717
+ border
718
+ }) {
719
+ return {
720
+ ...background && { "--normal-bg": background },
721
+ ...text && { "--normal-text": text },
722
+ ...border && { "--normal-border": border }
723
+ };
724
+ }
725
+ function Toaster2({ position = "top-center", ...props }) {
726
+ return /* @__PURE__ */ jsx12(Toaster, { position, ...props });
727
+ }
583
728
  export {
584
729
  DatePicker,
585
- JobCard
730
+ DebouncedInput,
731
+ JobCard,
732
+ Toaster2 as Toaster,
733
+ toast,
734
+ toastColors
586
735
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processdynamics/components",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Process Dynamics React component library, built on shadcn (Radix) and Tailwind CSS v4.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -59,6 +59,10 @@
59
59
  "@storybook/nextjs-vite": "^10.6.5",
60
60
  "@tailwindcss/turbopack": "^4",
61
61
  "@tailwindcss/vite": "^4.3.3",
62
+ "@testing-library/dom": "^10.4.2",
63
+ "@testing-library/jest-dom": "^7.0.1",
64
+ "@testing-library/react": "^16.3.3",
65
+ "@testing-library/user-event": "^14.6.8",
62
66
  "@types/node": "^20",
63
67
  "@types/react": "^19",
64
68
  "@types/react-dom": "^19",
@@ -71,6 +75,7 @@
71
75
  "eslint-config-next": "16.4.3",
72
76
  "eslint-plugin-storybook": "^10.6.5",
73
77
  "husky": "^9.1.7",
78
+ "jsdom": "^30.1.3",
74
79
  "lucide-react": "^1.66.0",
75
80
  "next": "16.4.3",
76
81
  "playwright": "latest",
@@ -79,6 +84,7 @@
79
84
  "react-day-picker": "^10.0.2",
80
85
  "react-dom": "19.3.0",
81
86
  "shadcn": "^4.23.0",
87
+ "sonner": "^2.0.8",
82
88
  "storybook": "^10.6.5",
83
89
  "tailwindcss": "^4",
84
90
  "tsup": "^9.0.0",
@@ -96,6 +102,7 @@
96
102
  "radix-ui": "^1.8.1",
97
103
  "react": "^19.0.0",
98
104
  "react-day-picker": "^10.0.2",
99
- "react-dom": "^19.0.0"
105
+ "react-dom": "^19.0.0",
106
+ "sonner": "^2.0.8"
100
107
  }
101
108
  }