@oatfi/ui 0.2.0 → 0.4.0
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.cjs.js +68 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.esm.js +53 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var styles = require('@mui/material/styles');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
var material = require('@mui/material');
|
|
8
8
|
var CalendarMonthIcon = require('@mui/icons-material/CalendarMonth');
|
|
@@ -219,8 +219,8 @@ const GlobalStyle = styled.createGlobalStyle`
|
|
|
219
219
|
}
|
|
220
220
|
`;
|
|
221
221
|
function ThemeProvider({ branding, children }) {
|
|
222
|
-
const theme =
|
|
223
|
-
const muiTheme =
|
|
222
|
+
const theme = React.useMemo(() => mergeBranding(branding), [branding]);
|
|
223
|
+
const muiTheme = React.useMemo(() => buildMuiTheme(theme), [theme]);
|
|
224
224
|
return /* @__PURE__ */ jsxRuntime.jsxs(styled.ThemeProvider, { theme, children: [
|
|
225
225
|
/* @__PURE__ */ jsxRuntime.jsx(GlobalStyle, {}),
|
|
226
226
|
/* @__PURE__ */ jsxRuntime.jsx(styles.ThemeProvider, { theme: muiTheme, children })
|
|
@@ -477,6 +477,17 @@ const Button = styled.button`
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
+
&.dashed {
|
|
481
|
+
background-color: transparent;
|
|
482
|
+
color: ${({ theme }) => theme.colors.secondary};
|
|
483
|
+
border: 1px dashed ${({ theme }) => theme.colors.border};
|
|
484
|
+
&:hover {
|
|
485
|
+
background-color: ${({ theme }) => theme.colors.surface};
|
|
486
|
+
border-color: ${({ theme }) => theme.colors.secondary};
|
|
487
|
+
color: ${({ theme }) => theme.colors.primary};
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
480
491
|
&.link {
|
|
481
492
|
background-color: transparent;
|
|
482
493
|
color: ${({ theme }) => theme.colors.accent};
|
|
@@ -803,7 +814,7 @@ function CurrencyInput({
|
|
|
803
814
|
name,
|
|
804
815
|
testId
|
|
805
816
|
}) {
|
|
806
|
-
const reactId =
|
|
817
|
+
const reactId = React.useId();
|
|
807
818
|
const inputId = `${reactId}-input`;
|
|
808
819
|
const errorId = `${reactId}-error`;
|
|
809
820
|
const handleChange = (e) => {
|
|
@@ -848,7 +859,7 @@ function DateInput({
|
|
|
848
859
|
min,
|
|
849
860
|
max
|
|
850
861
|
}) {
|
|
851
|
-
const inputRef =
|
|
862
|
+
const inputRef = React.useRef(null);
|
|
852
863
|
const handleIconClick = () => {
|
|
853
864
|
const input = inputRef.current;
|
|
854
865
|
if (!input) return;
|
|
@@ -908,7 +919,7 @@ function DropDown({
|
|
|
908
919
|
name,
|
|
909
920
|
testId
|
|
910
921
|
}) {
|
|
911
|
-
const reactId =
|
|
922
|
+
const reactId = React.useId();
|
|
912
923
|
const labelId = `${reactId}-label`;
|
|
913
924
|
const selectId = `${reactId}-select`;
|
|
914
925
|
const selectDisplayProps = {
|
|
@@ -1119,9 +1130,9 @@ function FileInput({
|
|
|
1119
1130
|
name,
|
|
1120
1131
|
testId
|
|
1121
1132
|
}) {
|
|
1122
|
-
const fileInputRef =
|
|
1123
|
-
const [dragOver, setDragOver] =
|
|
1124
|
-
const reactId =
|
|
1133
|
+
const fileInputRef = React.useRef(null);
|
|
1134
|
+
const [dragOver, setDragOver] = React.useState(false);
|
|
1135
|
+
const reactId = React.useId();
|
|
1125
1136
|
const inputId = `${reactId}-input`;
|
|
1126
1137
|
const errorId = `${reactId}-error`;
|
|
1127
1138
|
const requirementsId = `${reactId}-requirements`;
|
|
@@ -1426,8 +1437,8 @@ function Tabs({
|
|
|
1426
1437
|
onTabChange,
|
|
1427
1438
|
testId
|
|
1428
1439
|
}) {
|
|
1429
|
-
const [activeTab, setActiveTab] =
|
|
1430
|
-
const baseId =
|
|
1440
|
+
const [activeTab, setActiveTab] = React.useState(defaultActiveTab);
|
|
1441
|
+
const baseId = React.useId();
|
|
1431
1442
|
const handleTabClick = (index) => {
|
|
1432
1443
|
setActiveTab(index);
|
|
1433
1444
|
onTabChange?.(index);
|
|
@@ -1472,15 +1483,55 @@ function Loader({ className, size, label = "Loading", testId }) {
|
|
|
1472
1483
|
);
|
|
1473
1484
|
}
|
|
1474
1485
|
|
|
1486
|
+
const Root = styled.footer`
|
|
1487
|
+
margin-top: 2rem;
|
|
1488
|
+
padding-top: 0.75rem;
|
|
1489
|
+
border-top: ${({ theme }) => `${theme.border.width} solid ${theme.colors.border}`};
|
|
1490
|
+
text-align: center;
|
|
1491
|
+
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
1492
|
+
font-size: 0.8125rem;
|
|
1493
|
+
line-height: 1.4;
|
|
1494
|
+
color: ${({ theme }) => theme.colors.secondary};
|
|
1495
|
+
`;
|
|
1496
|
+
const Title = styled.p`
|
|
1497
|
+
margin: 0 0 0.25rem;
|
|
1498
|
+
font-weight: 600;
|
|
1499
|
+
color: ${({ theme }) => theme.colors.primary};
|
|
1500
|
+
`;
|
|
1501
|
+
const Anchor = styled.a`
|
|
1502
|
+
color: ${({ theme }) => theme.colors.accent};
|
|
1503
|
+
text-decoration: none;
|
|
1504
|
+
|
|
1505
|
+
&:hover,
|
|
1506
|
+
&:focus-visible {
|
|
1507
|
+
text-decoration: underline;
|
|
1508
|
+
}
|
|
1509
|
+
`;
|
|
1510
|
+
function Footnote({ title, text, links = [], className, testId }) {
|
|
1511
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Root, { className, "data-testid": testId, children: [
|
|
1512
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(Title, { children: title }),
|
|
1513
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: 0 }, children: [
|
|
1514
|
+
text && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1515
|
+
text,
|
|
1516
|
+
" "
|
|
1517
|
+
] }),
|
|
1518
|
+
links.map((link, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
1519
|
+
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: " \xB7 " }),
|
|
1520
|
+
/* @__PURE__ */ jsxRuntime.jsx(Anchor, { href: link.href, target: "_blank", rel: "noopener noreferrer", children: link.label })
|
|
1521
|
+
] }, link.href))
|
|
1522
|
+
] })
|
|
1523
|
+
] });
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1475
1526
|
function DotsMenu({
|
|
1476
1527
|
options,
|
|
1477
1528
|
iconSize = "medium",
|
|
1478
1529
|
ariaLabel = "more",
|
|
1479
1530
|
testId
|
|
1480
1531
|
}) {
|
|
1481
|
-
const [anchorEl, setAnchorEl] =
|
|
1532
|
+
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
1482
1533
|
const open = Boolean(anchorEl);
|
|
1483
|
-
const baseId =
|
|
1534
|
+
const baseId = React.useId();
|
|
1484
1535
|
const buttonId = `${baseId}-button`;
|
|
1485
1536
|
const menuId = `${baseId}-menu`;
|
|
1486
1537
|
const handleClick = (event) => {
|
|
@@ -1551,9 +1602,9 @@ const SideColumn = styled.div`
|
|
|
1551
1602
|
min-width: 0;
|
|
1552
1603
|
`;
|
|
1553
1604
|
function PreviewContent() {
|
|
1554
|
-
const [name, setName] =
|
|
1555
|
-
const [plan, setPlan] =
|
|
1556
|
-
const [autopay, setAutopay] =
|
|
1605
|
+
const [name, setName] = React.useState("Acme Corporation");
|
|
1606
|
+
const [plan, setPlan] = React.useState("growth");
|
|
1607
|
+
const [autopay, setAutopay] = React.useState(true);
|
|
1557
1608
|
return /* @__PURE__ */ jsxRuntime.jsxs(PreviewCard, { "data-testid": "oatfi-ui-preview", children: [
|
|
1558
1609
|
/* @__PURE__ */ jsxRuntime.jsxs(MainColumn, { children: [
|
|
1559
1610
|
/* @__PURE__ */ jsxRuntime.jsxs(HeaderRow, { children: [
|
|
@@ -1620,6 +1671,7 @@ exports.EmailInput = EmailInput;
|
|
|
1620
1671
|
exports.FileInput = FileInput;
|
|
1621
1672
|
exports.FlexColumnWrapper = FlexColumnWrapper;
|
|
1622
1673
|
exports.FlexRowWrapper = FlexRowWrapper;
|
|
1674
|
+
exports.Footnote = Footnote;
|
|
1623
1675
|
exports.Form = Form;
|
|
1624
1676
|
exports.FormActions = FormActions;
|
|
1625
1677
|
exports.FormCheckboxLabel = FormCheckboxLabel;
|