@paybutton/react 5.1.1 → 5.2.1

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.
@@ -14,11 +14,11 @@ export interface WidgetProps {
14
14
  disablePaymentId?: boolean;
15
15
  text?: string;
16
16
  ButtonComponent?: React.ComponentType;
17
- success: boolean;
17
+ success?: boolean;
18
18
  successText?: string;
19
19
  theme?: ThemeName | Theme;
20
20
  foot?: React.ReactNode;
21
- disabled: boolean;
21
+ disabled?: boolean;
22
22
  goalAmount?: number | string | null;
23
23
  currency?: Currency;
24
24
  animation?: animation;
@@ -11,21 +11,21 @@ export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'set
11
11
  currencyObj?: CurrencyObject;
12
12
  cryptoAmount?: string;
13
13
  price?: number;
14
- setCurrencyObj: Function;
14
+ setCurrencyObj?: Function;
15
15
  randomSatoshis?: boolean | number;
16
16
  hideToasts?: boolean;
17
17
  onSuccess?: (transaction: Transaction) => void;
18
18
  onTransaction?: (transaction: Transaction) => void;
19
19
  sound?: boolean;
20
20
  goalAmount?: number | string;
21
- disabled: boolean;
22
- editable: boolean;
21
+ disabled?: boolean;
22
+ editable?: boolean;
23
23
  wsBaseUrl?: string;
24
24
  apiBaseUrl?: string;
25
25
  successText?: string;
26
26
  disableAltpayment?: boolean;
27
27
  contributionOffset?: number;
28
- setNewTxs: Function;
28
+ setNewTxs?: Function;
29
29
  disableSound?: boolean;
30
30
  transactionText?: string;
31
31
  donationAddress?: string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Converts a hex color to RGB values
3
+ */
4
+ export declare const hexToRgb: (hex: string) => {
5
+ r: number;
6
+ g: number;
7
+ b: number;
8
+ } | null;
9
+ /**
10
+ * Normalizes any CSS color value to a hex code using the browser's canvas API
11
+ * Handles hex codes, named colors (e.g., "navy"), rgb(), hsl(), etc.
12
+ */
13
+ export declare const normalizeColorToHex: (color: string) => string | null;
14
+ /**
15
+ * Calculates the relative luminance of a color
16
+ * Based on WCAG 2.0 formula: https://www.w3.org/TR/WCAG20/#relativeluminancedef
17
+ * Returns a value between 0 (black) and 1 (white)
18
+ */
19
+ export declare const getLuminance: (color: string) => number;
20
+ /**
21
+ * Determines if dark mode should be used based on the color
22
+ * Dark mode is enabled when the color is light (luminance > 0.5)
23
+ * This threshold can be adjusted based on needs
24
+ */
25
+ export declare const darkMode: (color: string, threshold?: number) => boolean;
@@ -1,6 +1,7 @@
1
1
  export * from './address';
2
2
  export * from './api-client';
3
3
  export * from './cashtab';
4
+ export * from './color';
4
5
  export * from './constants';
5
6
  export * from './format';
6
7
  export * from './opReturn';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paybutton/react",
3
- "version": "5.1.1",
3
+ "version": "5.2.1",
4
4
  "description": "The easiest way to accept eCash online",
5
5
  "author": "Blockchain Ventures Corp.",
6
6
  "license": "MIT",
@@ -8,6 +8,10 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/PayButton/paybutton.git"
10
10
  },
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
11
15
  "files": [
12
16
  "dist"
13
17
  ],
@@ -56,6 +60,7 @@
56
60
  "@vitejs/plugin-react": "^4.6.0",
57
61
  "babel-eslint": "10.1.0",
58
62
  "babel-loader": "8.2.5",
63
+ "canvas": "^3.2.0",
59
64
  "concurrently": "5.3.0",
60
65
  "cross-env": "7.0.3",
61
66
  "currency-formatter": "1.5.9",
@@ -88,7 +93,6 @@
88
93
  "dependencies": {
89
94
  "@emotion/react": "^11.14.0",
90
95
  "@emotion/styled": "^11.14.1",
91
- "@mui/lab": "^7.0.1-beta.18",
92
96
  "@mui/material": "^7.3.4",
93
97
  "@types/crypto-js": "^4.2.1",
94
98
  "@types/jest": "^29.5.11",
@@ -104,7 +108,6 @@
104
108
  "lodash": "4.17.21",
105
109
  "notistack": "3.0.0",
106
110
  "qrcode.react": "3",
107
- "react-jss": "10.10.0",
108
111
  "react-number-format": "^5.4.4",
109
112
  "socket.io-client": "4.7.4",
110
113
  "ts-jest": "^29.4.5",