@bunnyapp/components 1.0.12 → 1.0.13
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/cjs/index.js +45 -55
- package/dist/esm/index.js +46 -56
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1631,28 +1631,6 @@ var extraQueryClient = new reactQuery.QueryClient();
|
|
|
1631
1631
|
function BunnyProvider(_a) {
|
|
1632
1632
|
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, queryClient = _a.queryClient, apiHost = _a.apiHost, token = _a.token, window = _a.window, onTokenExpired = _a.onTokenExpired;
|
|
1633
1633
|
var graphQLClient = createGraphQLClient(token, apiHost || "");
|
|
1634
|
-
var isMobile = common.useIsMobile();
|
|
1635
|
-
var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
1636
|
-
// ====== START - Copied straight from PageContainer.tsx ========
|
|
1637
|
-
var entityBranding = React.useMemo(function () {
|
|
1638
|
-
var _a;
|
|
1639
|
-
// This is to determine if the secondary color should be white or black
|
|
1640
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1641
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1642
|
-
: common.DEFAULT_BRAND_COLOR;
|
|
1643
|
-
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
1644
|
-
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1645
|
-
secondaryColor = "#ffffff";
|
|
1646
|
-
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1647
|
-
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
|
|
1648
|
-
return {
|
|
1649
|
-
accentColor: accentColor,
|
|
1650
|
-
brandColor: brandColor,
|
|
1651
|
-
secondaryColor: secondaryColor,
|
|
1652
|
-
topNavImageUrl: topNavImageUrl,
|
|
1653
|
-
};
|
|
1654
|
-
}, [branding, isMobile]);
|
|
1655
|
-
// ============================= END ==============================
|
|
1656
1634
|
React.useEffect(function () {
|
|
1657
1635
|
var script = document.createElement("script");
|
|
1658
1636
|
script.src = "https://js.finix.com/v/1/0/6/finix.js";
|
|
@@ -1670,44 +1648,35 @@ function BunnyProvider(_a) {
|
|
|
1670
1648
|
token: token,
|
|
1671
1649
|
window: window,
|
|
1672
1650
|
onTokenExpired: onTokenExpired,
|
|
1673
|
-
} }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsxRuntime.jsx(
|
|
1674
|
-
algorithm: darkMode
|
|
1675
|
-
? theme__default["default"].darkAlgorithm
|
|
1676
|
-
: theme__default["default"].defaultAlgorithm,
|
|
1677
|
-
token: {
|
|
1678
|
-
borderRadius: 4,
|
|
1679
|
-
colorPrimary: entityBranding.brandColor,
|
|
1680
|
-
colorLink: entityBranding.brandColor,
|
|
1681
|
-
colorLinkActive: entityBranding.brandColor,
|
|
1682
|
-
colorLinkHover: entityBranding.brandColor,
|
|
1683
|
-
fontFamily: common.MARK_PRO,
|
|
1684
|
-
colorBorder: common.INPUT_BORDER_COLOR,
|
|
1685
|
-
},
|
|
1686
|
-
components: {
|
|
1687
|
-
Drawer: {
|
|
1688
|
-
colorBgElevated: darkMode
|
|
1689
|
-
? "var(--row-background-dark)"
|
|
1690
|
-
: common.SLATE_50,
|
|
1691
|
-
},
|
|
1692
|
-
Divider: {
|
|
1693
|
-
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
1694
|
-
},
|
|
1695
|
-
},
|
|
1696
|
-
} }, { children: jsxRuntime.jsx(SecondaryWrapper, __assign({ setBranding: setBranding }, { children: children })) })) })) }) }))] })));
|
|
1651
|
+
} }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsxRuntime.jsx(ContextualWrapper, __assign({ darkMode: darkMode }, { children: children })) }))] })));
|
|
1697
1652
|
}
|
|
1698
|
-
function
|
|
1699
|
-
var children = _a.children,
|
|
1653
|
+
function ContextualWrapper(_a) {
|
|
1654
|
+
var children = _a.children, darkMode = _a.darkMode;
|
|
1700
1655
|
var _b = React.useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
|
|
1701
1656
|
var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
|
|
1702
|
-
var
|
|
1657
|
+
var branding = reactQuery.useQuery({
|
|
1703
1658
|
queryKey: common.QueryKeyFactory.default.brandingKey,
|
|
1704
1659
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
1705
1660
|
}).data;
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1661
|
+
var isMobile = common.useIsMobile();
|
|
1662
|
+
var entityBranding = React.useMemo(function () {
|
|
1663
|
+
var _a;
|
|
1664
|
+
// This is to determine if the secondary color should be white or black
|
|
1665
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1666
|
+
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1667
|
+
: common.DEFAULT_BRAND_COLOR;
|
|
1668
|
+
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
1669
|
+
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1670
|
+
secondaryColor = "#ffffff";
|
|
1671
|
+
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1672
|
+
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
|
|
1673
|
+
return {
|
|
1674
|
+
accentColor: accentColor,
|
|
1675
|
+
brandColor: brandColor,
|
|
1676
|
+
secondaryColor: secondaryColor,
|
|
1677
|
+
topNavImageUrl: topNavImageUrl,
|
|
1678
|
+
};
|
|
1679
|
+
}, [branding, isMobile]);
|
|
1711
1680
|
// Check if Inter font is loaded
|
|
1712
1681
|
React.useEffect(function () {
|
|
1713
1682
|
document.fonts.ready.then(function () {
|
|
@@ -1716,7 +1685,28 @@ function SecondaryWrapper(_a) {
|
|
|
1716
1685
|
}, []);
|
|
1717
1686
|
if (!interFontLoaded)
|
|
1718
1687
|
return null;
|
|
1719
|
-
return jsxRuntime.jsx(
|
|
1688
|
+
return (jsxRuntime.jsx(recoil.RecoilRoot, { children: jsxRuntime.jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsxRuntime.jsx(antd.ConfigProvider, __assign({ theme: {
|
|
1689
|
+
algorithm: darkMode ? theme__default["default"].darkAlgorithm : theme__default["default"].defaultAlgorithm,
|
|
1690
|
+
token: {
|
|
1691
|
+
borderRadius: 4,
|
|
1692
|
+
colorPrimary: entityBranding.brandColor,
|
|
1693
|
+
colorLink: entityBranding.brandColor,
|
|
1694
|
+
colorLinkActive: entityBranding.brandColor,
|
|
1695
|
+
colorLinkHover: entityBranding.brandColor,
|
|
1696
|
+
fontFamily: common.MARK_PRO,
|
|
1697
|
+
colorBorder: common.INPUT_BORDER_COLOR,
|
|
1698
|
+
},
|
|
1699
|
+
components: {
|
|
1700
|
+
Drawer: {
|
|
1701
|
+
colorBgElevated: darkMode
|
|
1702
|
+
? "var(--row-background-dark)"
|
|
1703
|
+
: common.SLATE_50,
|
|
1704
|
+
},
|
|
1705
|
+
Divider: {
|
|
1706
|
+
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
1707
|
+
},
|
|
1708
|
+
},
|
|
1709
|
+
} }, { children: children })) })) }));
|
|
1720
1710
|
}
|
|
1721
1711
|
|
|
1722
1712
|
var useAjax = function (onError) {
|
package/dist/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { createContext, useContext, useEffect, useState, useMemo
|
|
|
4
4
|
import { Markup } from 'interweave';
|
|
5
5
|
import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Modal, Form, Drawer, Card as Card$1, Select, Image, Dropdown } from 'antd';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
-
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200,
|
|
7
|
+
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, invokePlugin, useErrorNotification, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
|
|
8
8
|
import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
|
|
9
9
|
import theme from 'antd/lib/theme';
|
|
10
10
|
import { RecoilRoot } from 'recoil';
|
|
@@ -1603,28 +1603,6 @@ var extraQueryClient = new QueryClient();
|
|
|
1603
1603
|
function BunnyProvider(_a) {
|
|
1604
1604
|
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, queryClient = _a.queryClient, apiHost = _a.apiHost, token = _a.token, window = _a.window, onTokenExpired = _a.onTokenExpired;
|
|
1605
1605
|
var graphQLClient = createGraphQLClient(token, apiHost || "");
|
|
1606
|
-
var isMobile = useIsMobile();
|
|
1607
|
-
var _c = useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
1608
|
-
// ====== START - Copied straight from PageContainer.tsx ========
|
|
1609
|
-
var entityBranding = useMemo(function () {
|
|
1610
|
-
var _a;
|
|
1611
|
-
// This is to determine if the secondary color should be white or black
|
|
1612
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1613
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1614
|
-
: DEFAULT_BRAND_COLOR;
|
|
1615
|
-
var secondaryColor = DEFAULT_SECONDARY_COLOR;
|
|
1616
|
-
if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1617
|
-
secondaryColor = "#ffffff";
|
|
1618
|
-
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1619
|
-
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || DEFAULT_ACCENT_COLOR;
|
|
1620
|
-
return {
|
|
1621
|
-
accentColor: accentColor,
|
|
1622
|
-
brandColor: brandColor,
|
|
1623
|
-
secondaryColor: secondaryColor,
|
|
1624
|
-
topNavImageUrl: topNavImageUrl,
|
|
1625
|
-
};
|
|
1626
|
-
}, [branding, isMobile]);
|
|
1627
|
-
// ============================= END ==============================
|
|
1628
1606
|
useEffect(function () {
|
|
1629
1607
|
var script = document.createElement("script");
|
|
1630
1608
|
script.src = "https://js.finix.com/v/1/0/6/finix.js";
|
|
@@ -1642,44 +1620,35 @@ function BunnyProvider(_a) {
|
|
|
1642
1620
|
token: token,
|
|
1643
1621
|
window: window,
|
|
1644
1622
|
onTokenExpired: onTokenExpired,
|
|
1645
|
-
} }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsx(
|
|
1646
|
-
algorithm: darkMode
|
|
1647
|
-
? theme.darkAlgorithm
|
|
1648
|
-
: theme.defaultAlgorithm,
|
|
1649
|
-
token: {
|
|
1650
|
-
borderRadius: 4,
|
|
1651
|
-
colorPrimary: entityBranding.brandColor,
|
|
1652
|
-
colorLink: entityBranding.brandColor,
|
|
1653
|
-
colorLinkActive: entityBranding.brandColor,
|
|
1654
|
-
colorLinkHover: entityBranding.brandColor,
|
|
1655
|
-
fontFamily: MARK_PRO,
|
|
1656
|
-
colorBorder: INPUT_BORDER_COLOR,
|
|
1657
|
-
},
|
|
1658
|
-
components: {
|
|
1659
|
-
Drawer: {
|
|
1660
|
-
colorBgElevated: darkMode
|
|
1661
|
-
? "var(--row-background-dark)"
|
|
1662
|
-
: SLATE_50,
|
|
1663
|
-
},
|
|
1664
|
-
Divider: {
|
|
1665
|
-
colorSplit: darkMode ? SLATE_400 : SLATE_200,
|
|
1666
|
-
},
|
|
1667
|
-
},
|
|
1668
|
-
} }, { children: jsx(SecondaryWrapper, __assign({ setBranding: setBranding }, { children: children })) })) })) }) }))] })));
|
|
1623
|
+
} }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsx(ContextualWrapper, __assign({ darkMode: darkMode }, { children: children })) }))] })));
|
|
1669
1624
|
}
|
|
1670
|
-
function
|
|
1671
|
-
var children = _a.children,
|
|
1625
|
+
function ContextualWrapper(_a) {
|
|
1626
|
+
var children = _a.children, darkMode = _a.darkMode;
|
|
1672
1627
|
var _b = useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
|
|
1673
1628
|
var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
|
|
1674
|
-
var
|
|
1629
|
+
var branding = useQuery({
|
|
1675
1630
|
queryKey: QueryKeyFactory.default.brandingKey,
|
|
1676
1631
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
1677
1632
|
}).data;
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1633
|
+
var isMobile = useIsMobile();
|
|
1634
|
+
var entityBranding = useMemo(function () {
|
|
1635
|
+
var _a;
|
|
1636
|
+
// This is to determine if the secondary color should be white or black
|
|
1637
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1638
|
+
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1639
|
+
: DEFAULT_BRAND_COLOR;
|
|
1640
|
+
var secondaryColor = DEFAULT_SECONDARY_COLOR;
|
|
1641
|
+
if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1642
|
+
secondaryColor = "#ffffff";
|
|
1643
|
+
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1644
|
+
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || DEFAULT_ACCENT_COLOR;
|
|
1645
|
+
return {
|
|
1646
|
+
accentColor: accentColor,
|
|
1647
|
+
brandColor: brandColor,
|
|
1648
|
+
secondaryColor: secondaryColor,
|
|
1649
|
+
topNavImageUrl: topNavImageUrl,
|
|
1650
|
+
};
|
|
1651
|
+
}, [branding, isMobile]);
|
|
1683
1652
|
// Check if Inter font is loaded
|
|
1684
1653
|
useEffect(function () {
|
|
1685
1654
|
document.fonts.ready.then(function () {
|
|
@@ -1688,7 +1657,28 @@ function SecondaryWrapper(_a) {
|
|
|
1688
1657
|
}, []);
|
|
1689
1658
|
if (!interFontLoaded)
|
|
1690
1659
|
return null;
|
|
1691
|
-
return jsx(
|
|
1660
|
+
return (jsx(RecoilRoot, { children: jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsx(ConfigProvider, __assign({ theme: {
|
|
1661
|
+
algorithm: darkMode ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
1662
|
+
token: {
|
|
1663
|
+
borderRadius: 4,
|
|
1664
|
+
colorPrimary: entityBranding.brandColor,
|
|
1665
|
+
colorLink: entityBranding.brandColor,
|
|
1666
|
+
colorLinkActive: entityBranding.brandColor,
|
|
1667
|
+
colorLinkHover: entityBranding.brandColor,
|
|
1668
|
+
fontFamily: MARK_PRO,
|
|
1669
|
+
colorBorder: INPUT_BORDER_COLOR,
|
|
1670
|
+
},
|
|
1671
|
+
components: {
|
|
1672
|
+
Drawer: {
|
|
1673
|
+
colorBgElevated: darkMode
|
|
1674
|
+
? "var(--row-background-dark)"
|
|
1675
|
+
: SLATE_50,
|
|
1676
|
+
},
|
|
1677
|
+
Divider: {
|
|
1678
|
+
colorSplit: darkMode ? SLATE_400 : SLATE_200,
|
|
1679
|
+
},
|
|
1680
|
+
},
|
|
1681
|
+
} }, { children: children })) })) }));
|
|
1692
1682
|
}
|
|
1693
1683
|
|
|
1694
1684
|
var useAjax = function (onError) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"vite": "^5.4.11"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@bunnyapp/common": "^1.0.
|
|
64
|
+
"@bunnyapp/common": "^1.0.38",
|
|
65
65
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
66
66
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
|
67
67
|
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|