@oatfi/ui 0.3.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 +57 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.esm.js +42 -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 })
|
|
@@ -814,7 +814,7 @@ function CurrencyInput({
|
|
|
814
814
|
name,
|
|
815
815
|
testId
|
|
816
816
|
}) {
|
|
817
|
-
const reactId =
|
|
817
|
+
const reactId = React.useId();
|
|
818
818
|
const inputId = `${reactId}-input`;
|
|
819
819
|
const errorId = `${reactId}-error`;
|
|
820
820
|
const handleChange = (e) => {
|
|
@@ -859,7 +859,7 @@ function DateInput({
|
|
|
859
859
|
min,
|
|
860
860
|
max
|
|
861
861
|
}) {
|
|
862
|
-
const inputRef =
|
|
862
|
+
const inputRef = React.useRef(null);
|
|
863
863
|
const handleIconClick = () => {
|
|
864
864
|
const input = inputRef.current;
|
|
865
865
|
if (!input) return;
|
|
@@ -919,7 +919,7 @@ function DropDown({
|
|
|
919
919
|
name,
|
|
920
920
|
testId
|
|
921
921
|
}) {
|
|
922
|
-
const reactId =
|
|
922
|
+
const reactId = React.useId();
|
|
923
923
|
const labelId = `${reactId}-label`;
|
|
924
924
|
const selectId = `${reactId}-select`;
|
|
925
925
|
const selectDisplayProps = {
|
|
@@ -1130,9 +1130,9 @@ function FileInput({
|
|
|
1130
1130
|
name,
|
|
1131
1131
|
testId
|
|
1132
1132
|
}) {
|
|
1133
|
-
const fileInputRef =
|
|
1134
|
-
const [dragOver, setDragOver] =
|
|
1135
|
-
const reactId =
|
|
1133
|
+
const fileInputRef = React.useRef(null);
|
|
1134
|
+
const [dragOver, setDragOver] = React.useState(false);
|
|
1135
|
+
const reactId = React.useId();
|
|
1136
1136
|
const inputId = `${reactId}-input`;
|
|
1137
1137
|
const errorId = `${reactId}-error`;
|
|
1138
1138
|
const requirementsId = `${reactId}-requirements`;
|
|
@@ -1437,8 +1437,8 @@ function Tabs({
|
|
|
1437
1437
|
onTabChange,
|
|
1438
1438
|
testId
|
|
1439
1439
|
}) {
|
|
1440
|
-
const [activeTab, setActiveTab] =
|
|
1441
|
-
const baseId =
|
|
1440
|
+
const [activeTab, setActiveTab] = React.useState(defaultActiveTab);
|
|
1441
|
+
const baseId = React.useId();
|
|
1442
1442
|
const handleTabClick = (index) => {
|
|
1443
1443
|
setActiveTab(index);
|
|
1444
1444
|
onTabChange?.(index);
|
|
@@ -1483,15 +1483,55 @@ function Loader({ className, size, label = "Loading", testId }) {
|
|
|
1483
1483
|
);
|
|
1484
1484
|
}
|
|
1485
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
|
+
|
|
1486
1526
|
function DotsMenu({
|
|
1487
1527
|
options,
|
|
1488
1528
|
iconSize = "medium",
|
|
1489
1529
|
ariaLabel = "more",
|
|
1490
1530
|
testId
|
|
1491
1531
|
}) {
|
|
1492
|
-
const [anchorEl, setAnchorEl] =
|
|
1532
|
+
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
1493
1533
|
const open = Boolean(anchorEl);
|
|
1494
|
-
const baseId =
|
|
1534
|
+
const baseId = React.useId();
|
|
1495
1535
|
const buttonId = `${baseId}-button`;
|
|
1496
1536
|
const menuId = `${baseId}-menu`;
|
|
1497
1537
|
const handleClick = (event) => {
|
|
@@ -1562,9 +1602,9 @@ const SideColumn = styled.div`
|
|
|
1562
1602
|
min-width: 0;
|
|
1563
1603
|
`;
|
|
1564
1604
|
function PreviewContent() {
|
|
1565
|
-
const [name, setName] =
|
|
1566
|
-
const [plan, setPlan] =
|
|
1567
|
-
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);
|
|
1568
1608
|
return /* @__PURE__ */ jsxRuntime.jsxs(PreviewCard, { "data-testid": "oatfi-ui-preview", children: [
|
|
1569
1609
|
/* @__PURE__ */ jsxRuntime.jsxs(MainColumn, { children: [
|
|
1570
1610
|
/* @__PURE__ */ jsxRuntime.jsxs(HeaderRow, { children: [
|
|
@@ -1631,6 +1671,7 @@ exports.EmailInput = EmailInput;
|
|
|
1631
1671
|
exports.FileInput = FileInput;
|
|
1632
1672
|
exports.FlexColumnWrapper = FlexColumnWrapper;
|
|
1633
1673
|
exports.FlexRowWrapper = FlexRowWrapper;
|
|
1674
|
+
exports.Footnote = Footnote;
|
|
1634
1675
|
exports.Form = Form;
|
|
1635
1676
|
exports.FormActions = FormActions;
|
|
1636
1677
|
exports.FormCheckboxLabel = FormCheckboxLabel;
|