@processdynamics/components 0.1.6 → 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
@@ -33,7 +33,10 @@ var index_exports = {};
33
33
  __export(index_exports, {
34
34
  DatePicker: () => DatePicker,
35
35
  DebouncedInput: () => DebouncedInput,
36
- JobCard: () => JobCard
36
+ JobCard: () => JobCard,
37
+ Toaster: () => Toaster2,
38
+ toast: () => import_sonner2.toast,
39
+ toastColors: () => toastColors
37
40
  });
38
41
  module.exports = __toCommonJS(index_exports);
39
42
 
@@ -702,9 +705,65 @@ var JobCard = ({
702
705
  }
703
706
  );
704
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
+ }
705
761
  // Annotate the CommonJS export names for ESM import in node:
706
762
  0 && (module.exports = {
707
763
  DatePicker,
708
764
  DebouncedInput,
709
- JobCard
765
+ JobCard,
766
+ Toaster,
767
+ toast,
768
+ toastColors
710
769
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as react from 'react';
2
- import { ComponentProps, FocusEventHandler, 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
  /**
@@ -209,5 +211,62 @@ interface JobCardProps {
209
211
  */
210
212
  declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
211
213
 
212
- export { DatePicker, DebouncedInput, JobCard };
213
- export type { DebouncedInputProps, 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 { ComponentProps, FocusEventHandler, 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
  /**
@@ -209,5 +211,62 @@ interface JobCardProps {
209
211
  */
210
212
  declare const JobCard: ({ job, onClick, action, leadingContent, expandedContent, className, }: JobCardProps) => react.JSX.Element;
211
213
 
212
- export { DatePicker, DebouncedInput, JobCard };
213
- export type { DebouncedInputProps, 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
@@ -672,8 +672,64 @@ var JobCard = ({
672
672
  }
673
673
  );
674
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
+ }
675
728
  export {
676
729
  DatePicker,
677
730
  DebouncedInput,
678
- JobCard
731
+ JobCard,
732
+ Toaster2 as Toaster,
733
+ toast,
734
+ toastColors
679
735
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processdynamics/components",
3
- "version": "0.1.6",
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": {
@@ -84,6 +84,7 @@
84
84
  "react-day-picker": "^10.0.2",
85
85
  "react-dom": "19.3.0",
86
86
  "shadcn": "^4.23.0",
87
+ "sonner": "^2.0.8",
87
88
  "storybook": "^10.6.5",
88
89
  "tailwindcss": "^4",
89
90
  "tsup": "^9.0.0",
@@ -101,6 +102,7 @@
101
102
  "radix-ui": "^1.8.1",
102
103
  "react": "^19.0.0",
103
104
  "react-day-picker": "^10.0.2",
104
- "react-dom": "^19.0.0"
105
+ "react-dom": "^19.0.0",
106
+ "sonner": "^2.0.8"
105
107
  }
106
108
  }