@particle-network/ui-react 0.3.0-beta.13 → 0.3.0-beta.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.
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import "react";
2
3
  import { ToastProvider, addToast, closeAll, closeToast } from "@heroui/toast";
3
4
  import CircleCheckIcon from "@particle-network/icons/web/CircleCheckIcon";
4
5
  import CircleCloseIcon from "@particle-network/icons/web/CircleCloseIcon";
@@ -28,38 +29,54 @@ const getIcon = (type)=>{
28
29
  });
29
30
  return null;
30
31
  };
32
+ const hasLongWord = (text)=>{
33
+ if ('string' != typeof text) return false;
34
+ const englishWords = text.match(/[a-zA-Z0-9_-]+/g);
35
+ if (!englishWords) return false;
36
+ return englishWords.some((word)=>word.length > 30);
37
+ };
31
38
  const show = (props)=>{
32
- const { type, hideCloseButton, variant, classNames, ...toastProps } = props ?? {};
39
+ const { type, hideCloseButton, variant, classNames, description, ...toastProps } = props ?? {};
40
+ const { base, description: descriptionClassName, icon, loadingComponent, content, closeButton, ...restClassNames } = classNames ?? {};
33
41
  return addToast({
34
42
  classNames: {
35
43
  base: [
36
- 'bg-tertiary rounded-xl px-3.5 py-3 shadow-none border-none !w-fit max-w-[350px]',
44
+ 'bg-tertiary rounded-xl px-3.5 py-3 shadow-none border-none !w-fit',
37
45
  !hideCloseButton && 'pr-12',
38
46
  'flat' === variant && 'success' === type && 'bg-[#0E3728]',
39
- 'flat' === variant && 'error' === type && 'bg-[#501D1D]'
47
+ 'flat' === variant && 'error' === type && 'bg-[#501D1D]',
48
+ hasLongWord(description) ? 'md:max-w-[480px] max-w-[360px]' : 'max-w-[360px]',
49
+ base
40
50
  ],
41
51
  description: [
42
- 'text-foreground text-xs font-medium me-0 leading-4',
43
- 'flat' === variant && 'text-white'
52
+ 'text-foreground text-xs font-medium me-0 leading-4 line-clamp-4',
53
+ 'flat' === variant && 'text-white',
54
+ hasLongWord(description) && 'max-w-[320px]',
55
+ descriptionClassName
44
56
  ],
45
57
  icon: [
46
58
  'shrink-0 h-5 w-5',
47
59
  'success' === type && 'text-success',
48
60
  'error' === type && 'text-danger',
49
- 'loading' === type && 'text-primary'
61
+ 'loading' === type && 'text-primary',
62
+ icon
50
63
  ],
51
64
  loadingComponent: [
52
- 'text-primary h-5 w-5'
65
+ 'text-primary h-5 w-5',
66
+ loadingComponent
53
67
  ],
54
68
  content: [
55
- 'gap-x-2.5'
69
+ 'gap-x-2.5',
70
+ content
56
71
  ],
57
72
  closeButton: [
58
73
  'absolute right-3 top-1/2 -translate-y-1/2',
59
- hideCloseButton ? 'opacity-0' : 'opacity-100'
74
+ hideCloseButton ? 'opacity-0' : 'opacity-100',
75
+ closeButton
60
76
  ],
61
- ...classNames
77
+ ...restClassNames
62
78
  },
79
+ description,
63
80
  icon: getIcon(type),
64
81
  closeIcon: /*#__PURE__*/ jsx(CloseIcon, {
65
82
  className: 'flat' === variant ? 'text-white' : 'text-foreground'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-network/ui-react",
3
- "version": "0.3.0-beta.13",
3
+ "version": "0.3.0-beta.15",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -39,8 +39,8 @@
39
39
  "@types/react": "^19.1.10",
40
40
  "react": "^19.1.0",
41
41
  "typescript": "^5.8.3",
42
- "@particle-network/lintstaged-config": "0.1.0",
43
- "@particle-network/eslint-config": "0.3.0"
42
+ "@particle-network/eslint-config": "0.3.0",
43
+ "@particle-network/lintstaged-config": "0.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=16.9.0",