karsten-design-system 1.0.67 → 1.0.68

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/dist/index.js CHANGED
@@ -32,4 +32,5 @@ export { EmptyContent } from './stories/components/emptyContent.js';
32
32
  export { Select } from './stories/components/select.js';
33
33
  export { CalendarInput } from './stories/components/calendarInput.js';
34
34
  export { Table } from './stories/components/table.js';
35
+ import './stories/components/customToast.js';
35
36
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,41 @@
1
+ import { j as jsxRuntimeExports } from '../../_virtual/jsx-runtime.js';
2
+ import clsx from 'clsx';
3
+ import { Toast } from 'primereact/toast';
4
+ import { forwardRef, useRef, useImperativeHandle } from 'react';
5
+ import SuccessIcon from '../../assets/icons/success.js';
6
+ import ErrorIcon from '../../assets/icons/error.js';
7
+ import InfoIcon from '../../assets/icons/info.js';
8
+
9
+ forwardRef(({ severity = 'info', summary = '', detail = '', life = 3000, onShow }, ref) => {
10
+ const customToastRef = useRef(null);
11
+ const getIcon = (severity) => {
12
+ switch (severity) {
13
+ case 'success':
14
+ return SuccessIcon;
15
+ case 'error':
16
+ return ErrorIcon;
17
+ default:
18
+ return InfoIcon;
19
+ }
20
+ };
21
+ useImperativeHandle(ref, () => ({
22
+ show: (showProps) => {
23
+ const mergedProps = { severity, summary, detail, life, onShow, ...showProps };
24
+ customToastRef.current?.show({
25
+ severity: mergedProps.severity,
26
+ summary: mergedProps.summary,
27
+ detail: mergedProps.detail,
28
+ life: mergedProps.life,
29
+ className: clsx(mergedProps.severity === 'error' ? 'border-redError' : 'border-primary'),
30
+ icon: getIcon(mergedProps.severity),
31
+ contentClassName: clsx('text-primary bg-secondary border border-l-4 rounded-r-lg', mergedProps.severity === 'error'
32
+ ? 'border-redError text-redError'
33
+ : 'border-primary text-primary'),
34
+ closeIcon: clsx('pi pi-times text-primary', mergedProps.severity === 'error' ? 'text-redError' : 'text-primary'),
35
+ });
36
+ mergedProps.onShow?.();
37
+ },
38
+ }));
39
+ return jsxRuntimeExports.jsx(Toast, { ref: customToastRef });
40
+ });
41
+ //# sourceMappingURL=customToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customToast.js","sources":["../../../../src/stories/components/customToast.tsx"],"sourcesContent":[null],"names":["_jsx","ToastPrime"],"mappings":";;;;;;;;AAqBoB,UAAU,CAC5B,CAAC,EAAE,QAAQ,GAAG,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,KAAI;AAC7E,IAAA,MAAM,cAAc,GAAG,MAAM,CAAa,IAAI,CAAC;AAE/C,IAAA,MAAM,OAAO,GAAG,CAAC,QAA6B,KAAI;QAChD,QAAQ,QAAQ;AACd,YAAA,KAAK,SAAS;AACZ,gBAAA,OAAO,WAAW;AACpB,YAAA,KAAK,OAAO;AACV,gBAAA,OAAO,SAAS;AAClB,YAAA;AACE,gBAAA,OAAO,QAAQ;;AAErB,KAAC;AAED,IAAA,mBAAmB,CAAC,GAAG,EAAE,OAAO;AAC9B,QAAA,IAAI,EAAE,CAAC,SAA4B,KAAI;AACrC,YAAA,MAAM,WAAW,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE;AAE7E,YAAA,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC;gBAC3B,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,gBAAA,SAAS,EAAE,IAAI,CACb,WAAW,CAAC,QAAQ,KAAK,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CACxE;AACD,gBAAA,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACnC,gBAAgB,EAAE,IAAI,CACpB,0DAA0D,EAC1D,WAAW,CAAC,QAAQ,KAAK;AACvB,sBAAE;sBACA,6BAA6B,CAClC;AACD,gBAAA,SAAS,EAAE,IAAI,CACb,0BAA0B,EAC1B,WAAW,CAAC,QAAQ,KAAK,OAAO,GAAG,eAAe,GAAG,cAAc,CACpE;AACF,aAAA,CAAC;AAEF,YAAA,WAAW,CAAC,MAAM,IAAI;SACvB;AACF,KAAA,CAAC,CAAC;AAEH,IAAA,OAAOA,sBAACC,KAAU,EAAA,EAAC,GAAG,EAAE,cAAc,GAAI;AAC5C,CAAC"}
@@ -32,3 +32,4 @@ export * from './stories/components/emptyContent';
32
32
  export * from './stories/components/select';
33
33
  export * from './stories/components/calendarInput';
34
34
  export * from './stories/components/table';
35
+ export * from './stories/components/customToast';
@@ -0,0 +1,13 @@
1
+ export type CustomToastSeverity = 'success' | 'info' | 'error';
2
+ export type CustomToastProps = {
3
+ severity?: CustomToastSeverity;
4
+ summary?: string;
5
+ detail?: string;
6
+ life?: number;
7
+ onShow?: () => void;
8
+ };
9
+ export type CustomToastRef = {
10
+ show: (props?: CustomToastProps) => void;
11
+ };
12
+ declare const CustomToast: import("react").ForwardRefExoticComponent<CustomToastProps & import("react").RefAttributes<CustomToastRef>>;
13
+ export default CustomToast;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "karsten-design-system",
3
3
  "description": "Karsten Design System Components",
4
- "version": "1.0.67",
4
+ "version": "1.0.68",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",