thailife-react 0.0.12 → 0.0.14
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/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.stories.d.ts +8 -1
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.stories.d.ts +8 -1
- package/dist/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/components/InputFile/InputFile.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +5 -0
- package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +866 -183
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +867 -184
- package/dist/index.js.map +1 -1
- package/dist/styles/ThemeProvider.d.ts +7 -0
- package/dist/styles/ThemeProvider.d.ts.map +1 -0
- package/dist/styles/index.d.ts +3 -5
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/theme.d.ts +87 -0
- package/dist/styles/theme.d.ts.map +1 -0
- package/package.json +8 -11
- package/dist/styles/globals.css +0 -35
- package/dist/styles.css +0 -3
- package/dist/utils/cn.d.ts +0 -7
- package/dist/utils/cn.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
export { default as React, default } from 'react';
|
|
4
|
+
import styled, { css, ThemeProvider as ThemeProvider$1 } from 'styled-components';
|
|
4
5
|
|
|
5
6
|
function _defineProperty(e, r, t) {
|
|
6
7
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
@@ -51,6 +52,13 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
51
52
|
}
|
|
52
53
|
return t;
|
|
53
54
|
}
|
|
55
|
+
function _taggedTemplateLiteral(e, t) {
|
|
56
|
+
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
57
|
+
raw: {
|
|
58
|
+
value: Object.freeze(t)
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
54
62
|
function _toPrimitive(t, r) {
|
|
55
63
|
if ("object" != typeof t || !t) return t;
|
|
56
64
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1427,21 +1435,157 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
1427
1435
|
|
|
1428
1436
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
1429
1437
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1438
|
+
const theme = {
|
|
1439
|
+
colors: {
|
|
1440
|
+
primary: "#007AC2",
|
|
1441
|
+
error: "#ff1100",
|
|
1442
|
+
dark: "#333333",
|
|
1443
|
+
light: "#666666",
|
|
1444
|
+
white: "#ffffff",
|
|
1445
|
+
black: "#000000",
|
|
1446
|
+
gray: {
|
|
1447
|
+
50: "#f9fafb",
|
|
1448
|
+
100: "#f3f4f6",
|
|
1449
|
+
200: "#e5e7eb",
|
|
1450
|
+
300: "#d1d5db",
|
|
1451
|
+
400: "#9ca3af",
|
|
1452
|
+
500: "#6b7280",
|
|
1453
|
+
600: "#4b5563",
|
|
1454
|
+
700: "#374151",
|
|
1455
|
+
800: "#1f2937",
|
|
1456
|
+
900: "#111827"
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
spacing: {
|
|
1460
|
+
0: "0",
|
|
1461
|
+
1: "0.25rem",
|
|
1462
|
+
2: "0.5rem",
|
|
1463
|
+
3: "0.75rem",
|
|
1464
|
+
4: "1rem",
|
|
1465
|
+
5: "1.25rem",
|
|
1466
|
+
6: "1.5rem",
|
|
1467
|
+
8: "2rem",
|
|
1468
|
+
10: "2.5rem",
|
|
1469
|
+
12: "3rem",
|
|
1470
|
+
16: "4rem",
|
|
1471
|
+
18: "4.5rem",
|
|
1472
|
+
20: "5rem",
|
|
1473
|
+
24: "6rem",
|
|
1474
|
+
32: "8rem",
|
|
1475
|
+
40: "10rem",
|
|
1476
|
+
48: "12rem",
|
|
1477
|
+
56: "14rem",
|
|
1478
|
+
64: "16rem",
|
|
1479
|
+
88: "22rem"
|
|
1480
|
+
},
|
|
1481
|
+
fontSize: {
|
|
1482
|
+
xs: "0.75rem",
|
|
1483
|
+
sm: "0.875rem",
|
|
1484
|
+
base: "1rem",
|
|
1485
|
+
lg: "1.125rem",
|
|
1486
|
+
xl: "1.25rem",
|
|
1487
|
+
"2xl": "1.5rem",
|
|
1488
|
+
"3xl": "1.875rem",
|
|
1489
|
+
"4xl": "2.25rem",
|
|
1490
|
+
"5xl": "3rem",
|
|
1491
|
+
"6xl": "3.75rem"
|
|
1492
|
+
},
|
|
1493
|
+
fontFamily: {
|
|
1494
|
+
sans: ["Inter", "system-ui", "sans-serif"],
|
|
1495
|
+
serif: ["Georgia", "Cambria", "Times New Roman", "Times", "serif"],
|
|
1496
|
+
mono: ["Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", "monospace"]
|
|
1497
|
+
},
|
|
1498
|
+
borderRadius: {
|
|
1499
|
+
none: "0",
|
|
1500
|
+
sm: "0.125rem",
|
|
1501
|
+
base: "0.25rem",
|
|
1502
|
+
md: "0.375rem",
|
|
1503
|
+
lg: "0.5rem",
|
|
1504
|
+
xl: "0.75rem",
|
|
1505
|
+
"2xl": "1rem",
|
|
1506
|
+
"3xl": "1.5rem",
|
|
1507
|
+
full: "9999px"
|
|
1508
|
+
},
|
|
1509
|
+
shadows: {
|
|
1510
|
+
sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
1511
|
+
base: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",
|
|
1512
|
+
md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
1513
|
+
lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
|
|
1514
|
+
xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"
|
|
1515
|
+
},
|
|
1516
|
+
transitions: {
|
|
1517
|
+
fast: "150ms ease-in-out",
|
|
1518
|
+
base: "300ms ease-in-out",
|
|
1519
|
+
slow: "500ms ease-in-out"
|
|
1439
1520
|
}
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1521
|
+
};
|
|
1442
1522
|
|
|
1443
1523
|
const _excluded$6 = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
|
|
1444
|
-
|
|
1524
|
+
var _templateObject$6, _templateObject2$6, _templateObject3$6, _templateObject4$6, _templateObject5$6, _templateObject6$6, _templateObject7$6, _templateObject8$6, _templateObject9$6, _templateObject0$6;
|
|
1525
|
+
const StyledButton = styled.button(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: ", ";\n font-family: ", ";\n font-weight: 500;\n cursor: pointer;\n transition: all ", ";\n outline: none;\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n ", "\n\n ", "\n\n ", "\n"])), _ref => {
|
|
1526
|
+
var _theme$borderRadius;
|
|
1527
|
+
let {
|
|
1528
|
+
theme: theme$1
|
|
1529
|
+
} = _ref;
|
|
1530
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$borderRadius = theme$1.borderRadius) === null || _theme$borderRadius === void 0 ? void 0 : _theme$borderRadius.md) || theme.borderRadius.md;
|
|
1531
|
+
}, _ref2 => {
|
|
1532
|
+
var _theme$fontFamily;
|
|
1533
|
+
let {
|
|
1534
|
+
theme: theme$1
|
|
1535
|
+
} = _ref2;
|
|
1536
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$fontFamily = theme$1.fontFamily) === null || _theme$fontFamily === void 0 || (_theme$fontFamily = _theme$fontFamily.sans) === null || _theme$fontFamily === void 0 ? void 0 : _theme$fontFamily.join(", ")) || theme.fontFamily.sans.join(", ");
|
|
1537
|
+
}, _ref3 => {
|
|
1538
|
+
var _theme$transitions;
|
|
1539
|
+
let {
|
|
1540
|
+
theme: theme$1
|
|
1541
|
+
} = _ref3;
|
|
1542
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$transitions = theme$1.transitions) === null || _theme$transitions === void 0 ? void 0 : _theme$transitions.base) || theme.transitions.base;
|
|
1543
|
+
}, _ref4 => {
|
|
1544
|
+
var _theme$colors;
|
|
1545
|
+
let {
|
|
1546
|
+
theme: theme$1
|
|
1547
|
+
} = _ref4;
|
|
1548
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$colors = theme$1.colors) === null || _theme$colors === void 0 ? void 0 : _theme$colors.primary) || theme.colors.primary;
|
|
1549
|
+
}, _ref5 => {
|
|
1550
|
+
let {
|
|
1551
|
+
variant,
|
|
1552
|
+
color,
|
|
1553
|
+
theme: theme$1
|
|
1554
|
+
} = _ref5;
|
|
1555
|
+
const currentTheme = theme$1 || theme;
|
|
1556
|
+
if (variant === "contained") {
|
|
1557
|
+
return css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n background-color: ", ";\n color: ", ";\n &:hover:not(:disabled) {\n background-color: ", "cc;\n }\n "])), currentTheme.colors[color || "primary"], currentTheme.colors.white, currentTheme.colors[color || "primary"]);
|
|
1558
|
+
}
|
|
1559
|
+
if (variant === "outlined") {
|
|
1560
|
+
return css(_templateObject3$6 || (_templateObject3$6 = _taggedTemplateLiteral(["\n background-color: transparent;\n border: 1px solid ", ";\n color: ", ";\n &:hover:not(:disabled) {\n background-color: ", "1a;\n }\n "])), currentTheme.colors[color || "primary"], currentTheme.colors[color || "primary"], currentTheme.colors[color || "primary"]);
|
|
1561
|
+
}
|
|
1562
|
+
if (variant === "link") {
|
|
1563
|
+
return css(_templateObject4$6 || (_templateObject4$6 = _taggedTemplateLiteral(["\n background-color: transparent;\n color: ", ";\n text-decoration: underline;\n &:hover:not(:disabled) {\n text-decoration: none;\n }\n "])), currentTheme.colors[color || "primary"]);
|
|
1564
|
+
}
|
|
1565
|
+
return css(_templateObject5$6 || (_templateObject5$6 = _taggedTemplateLiteral([""])));
|
|
1566
|
+
}, _ref6 => {
|
|
1567
|
+
let {
|
|
1568
|
+
size,
|
|
1569
|
+
theme: theme$1
|
|
1570
|
+
} = _ref6;
|
|
1571
|
+
const currentTheme = theme$1 || theme;
|
|
1572
|
+
if (size === "sm") {
|
|
1573
|
+
return css(_templateObject6$6 || (_templateObject6$6 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[3], currentTheme.spacing[3], currentTheme.fontSize.sm);
|
|
1574
|
+
}
|
|
1575
|
+
if (size === "md") {
|
|
1576
|
+
return css(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[2], currentTheme.spacing[4], currentTheme.fontSize.sm);
|
|
1577
|
+
}
|
|
1578
|
+
if (size === "lg") {
|
|
1579
|
+
return css(_templateObject8$6 || (_templateObject8$6 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[3], currentTheme.spacing[6], currentTheme.fontSize.base);
|
|
1580
|
+
}
|
|
1581
|
+
return css(_templateObject9$6 || (_templateObject9$6 = _taggedTemplateLiteral([""])));
|
|
1582
|
+
}, _ref7 => {
|
|
1583
|
+
let {
|
|
1584
|
+
fullWidth
|
|
1585
|
+
} = _ref7;
|
|
1586
|
+
return fullWidth && css(_templateObject0$6 || (_templateObject0$6 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1587
|
+
});
|
|
1588
|
+
const Button = /*#__PURE__*/React__default.forwardRef((_ref8, ref) => {
|
|
1445
1589
|
let {
|
|
1446
1590
|
className,
|
|
1447
1591
|
color = "primary",
|
|
@@ -1451,38 +1595,17 @@ const Button = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1451
1595
|
loading = false,
|
|
1452
1596
|
disabled,
|
|
1453
1597
|
children
|
|
1454
|
-
} =
|
|
1455
|
-
props = _objectWithoutProperties(
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
primary: "border border-primary text-primary hover:bg-primary/10",
|
|
1466
|
-
error: "border border-error text-error hover:bg-error/10",
|
|
1467
|
-
dark: "border border-dark text-dark hover:bg-dark/10",
|
|
1468
|
-
light: "border border-light text-light hover:bg-light/10"
|
|
1469
|
-
},
|
|
1470
|
-
link: {
|
|
1471
|
-
primary: "text-primary underline",
|
|
1472
|
-
error: "text-error underline",
|
|
1473
|
-
dark: "text-dark underline",
|
|
1474
|
-
light: "text-light underline"
|
|
1475
|
-
}
|
|
1476
|
-
};
|
|
1477
|
-
const sizes = {
|
|
1478
|
-
sm: "px-3 py-1.5 text-sm",
|
|
1479
|
-
md: "px-4 py-2 text-sm",
|
|
1480
|
-
lg: "px-6 py-3 text-base"
|
|
1481
|
-
};
|
|
1482
|
-
return jsxRuntimeExports.jsx("button", _objectSpread2(_objectSpread2({
|
|
1483
|
-
className: cn(baseClasses, variants[variant][color], sizes[size], fullWidth && "w-full", (disabled || loading) && "opacity-50 cursor-not-allowed", className),
|
|
1484
|
-
ref: ref,
|
|
1485
|
-
disabled: disabled || loading
|
|
1598
|
+
} = _ref8,
|
|
1599
|
+
props = _objectWithoutProperties(_ref8, _excluded$6);
|
|
1600
|
+
return jsxRuntimeExports.jsx(StyledButton, _objectSpread2(_objectSpread2({
|
|
1601
|
+
className: className,
|
|
1602
|
+
color: color,
|
|
1603
|
+
variant: variant,
|
|
1604
|
+
size: size,
|
|
1605
|
+
fullWidth: fullWidth,
|
|
1606
|
+
loading: loading,
|
|
1607
|
+
disabled: disabled || loading,
|
|
1608
|
+
ref: ref
|
|
1486
1609
|
}, props), {}, {
|
|
1487
1610
|
children: children
|
|
1488
1611
|
}));
|
|
@@ -1490,7 +1613,113 @@ const Button = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1490
1613
|
Button.displayName = "Button";
|
|
1491
1614
|
|
|
1492
1615
|
const _excluded$5 = ["className", "type", "label", "error", "helperText", "size", "fullWidth", "id"];
|
|
1493
|
-
|
|
1616
|
+
var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$5, _templateObject5$5, _templateObject6$5, _templateObject7$5, _templateObject8$5, _templateObject9$5, _templateObject0$5;
|
|
1617
|
+
const InputContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), _ref => {
|
|
1618
|
+
let {
|
|
1619
|
+
fullWidth
|
|
1620
|
+
} = _ref;
|
|
1621
|
+
return fullWidth && css(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1622
|
+
});
|
|
1623
|
+
const InputLabel = styled.label(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-size: ", ";\n font-weight: 500;\n color: ", ";\n"])), _ref2 => {
|
|
1624
|
+
var _theme$spacing;
|
|
1625
|
+
let {
|
|
1626
|
+
theme: theme$1
|
|
1627
|
+
} = _ref2;
|
|
1628
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$spacing = theme$1.spacing) === null || _theme$spacing === void 0 ? void 0 : _theme$spacing[1]) || theme.spacing[1];
|
|
1629
|
+
}, _ref3 => {
|
|
1630
|
+
var _theme$fontSize;
|
|
1631
|
+
let {
|
|
1632
|
+
theme: theme$1
|
|
1633
|
+
} = _ref3;
|
|
1634
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$fontSize = theme$1.fontSize) === null || _theme$fontSize === void 0 ? void 0 : _theme$fontSize.sm) || theme.fontSize.sm;
|
|
1635
|
+
}, _ref4 => {
|
|
1636
|
+
var _theme$colors;
|
|
1637
|
+
let {
|
|
1638
|
+
theme: theme$1
|
|
1639
|
+
} = _ref4;
|
|
1640
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$colors = theme$1.colors) === null || _theme$colors === void 0 || (_theme$colors = _theme$colors.gray) === null || _theme$colors === void 0 ? void 0 : _theme$colors[700]) || theme.colors.gray[700];
|
|
1641
|
+
});
|
|
1642
|
+
const StyledInput = styled.input(_templateObject4$5 || (_templateObject4$5 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: ", ";\n transition: border-color ", ";\n outline: none;\n font-family: ", ";\n\n &:focus {\n border-color: ", ";\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n background-color: ", ";\n }\n\n ", "\n\n ", "\n"])), _ref5 => {
|
|
1643
|
+
var _theme$colors2, _theme$colors3;
|
|
1644
|
+
let {
|
|
1645
|
+
theme: theme$1,
|
|
1646
|
+
hasError
|
|
1647
|
+
} = _ref5;
|
|
1648
|
+
return hasError ? (theme$1 === null || theme$1 === void 0 || (_theme$colors2 = theme$1.colors) === null || _theme$colors2 === void 0 ? void 0 : _theme$colors2.error) || theme.colors.error : (theme$1 === null || theme$1 === void 0 || (_theme$colors3 = theme$1.colors) === null || _theme$colors3 === void 0 || (_theme$colors3 = _theme$colors3.gray) === null || _theme$colors3 === void 0 ? void 0 : _theme$colors3[300]) || theme.colors.gray[300];
|
|
1649
|
+
}, _ref6 => {
|
|
1650
|
+
var _theme$borderRadius;
|
|
1651
|
+
let {
|
|
1652
|
+
theme: theme$1
|
|
1653
|
+
} = _ref6;
|
|
1654
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$borderRadius = theme$1.borderRadius) === null || _theme$borderRadius === void 0 ? void 0 : _theme$borderRadius.md) || theme.borderRadius.md;
|
|
1655
|
+
}, _ref7 => {
|
|
1656
|
+
var _theme$transitions;
|
|
1657
|
+
let {
|
|
1658
|
+
theme: theme$1
|
|
1659
|
+
} = _ref7;
|
|
1660
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$transitions = theme$1.transitions) === null || _theme$transitions === void 0 ? void 0 : _theme$transitions.base) || theme.transitions.base;
|
|
1661
|
+
}, _ref8 => {
|
|
1662
|
+
var _theme$fontFamily;
|
|
1663
|
+
let {
|
|
1664
|
+
theme: theme$1
|
|
1665
|
+
} = _ref8;
|
|
1666
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$fontFamily = theme$1.fontFamily) === null || _theme$fontFamily === void 0 || (_theme$fontFamily = _theme$fontFamily.sans) === null || _theme$fontFamily === void 0 ? void 0 : _theme$fontFamily.join(", ")) || theme.fontFamily.sans.join(", ");
|
|
1667
|
+
}, _ref9 => {
|
|
1668
|
+
var _theme$colors4, _theme$colors5;
|
|
1669
|
+
let {
|
|
1670
|
+
theme: theme$1,
|
|
1671
|
+
hasError
|
|
1672
|
+
} = _ref9;
|
|
1673
|
+
return hasError ? (theme$1 === null || theme$1 === void 0 || (_theme$colors4 = theme$1.colors) === null || _theme$colors4 === void 0 ? void 0 : _theme$colors4.error) || theme.colors.error : (theme$1 === null || theme$1 === void 0 || (_theme$colors5 = theme$1.colors) === null || _theme$colors5 === void 0 ? void 0 : _theme$colors5.primary) || theme.colors.primary;
|
|
1674
|
+
}, _ref0 => {
|
|
1675
|
+
var _theme$colors6;
|
|
1676
|
+
let {
|
|
1677
|
+
theme: theme$1
|
|
1678
|
+
} = _ref0;
|
|
1679
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$colors6 = theme$1.colors) === null || _theme$colors6 === void 0 || (_theme$colors6 = _theme$colors6.gray) === null || _theme$colors6 === void 0 ? void 0 : _theme$colors6[50]) || theme.colors.gray[50];
|
|
1680
|
+
}, _ref1 => {
|
|
1681
|
+
let {
|
|
1682
|
+
size,
|
|
1683
|
+
theme: theme$1
|
|
1684
|
+
} = _ref1;
|
|
1685
|
+
const currentTheme = theme$1 || theme;
|
|
1686
|
+
if (size === "sm") {
|
|
1687
|
+
return css(_templateObject5$5 || (_templateObject5$5 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[3], currentTheme.spacing[3], currentTheme.fontSize.sm);
|
|
1688
|
+
}
|
|
1689
|
+
if (size === "md") {
|
|
1690
|
+
return css(_templateObject6$5 || (_templateObject6$5 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[2], currentTheme.spacing[4], currentTheme.fontSize.sm);
|
|
1691
|
+
}
|
|
1692
|
+
if (size === "lg") {
|
|
1693
|
+
return css(_templateObject7$5 || (_templateObject7$5 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), currentTheme.spacing[3], currentTheme.spacing[4], currentTheme.fontSize.base);
|
|
1694
|
+
}
|
|
1695
|
+
return css(_templateObject8$5 || (_templateObject8$5 = _taggedTemplateLiteral([""])));
|
|
1696
|
+
}, _ref10 => {
|
|
1697
|
+
let {
|
|
1698
|
+
fullWidth
|
|
1699
|
+
} = _ref10;
|
|
1700
|
+
return fullWidth && css(_templateObject9$5 || (_templateObject9$5 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1701
|
+
});
|
|
1702
|
+
const HelperText$5 = styled.p(_templateObject0$5 || (_templateObject0$5 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref11 => {
|
|
1703
|
+
var _theme$spacing2;
|
|
1704
|
+
let {
|
|
1705
|
+
theme: theme$1
|
|
1706
|
+
} = _ref11;
|
|
1707
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$spacing2 = theme$1.spacing) === null || _theme$spacing2 === void 0 ? void 0 : _theme$spacing2[1]) || theme.spacing[1];
|
|
1708
|
+
}, _ref12 => {
|
|
1709
|
+
var _theme$fontSize2;
|
|
1710
|
+
let {
|
|
1711
|
+
theme: theme$1
|
|
1712
|
+
} = _ref12;
|
|
1713
|
+
return (theme$1 === null || theme$1 === void 0 || (_theme$fontSize2 = theme$1.fontSize) === null || _theme$fontSize2 === void 0 ? void 0 : _theme$fontSize2.xs) || theme.fontSize.xs;
|
|
1714
|
+
}, _ref13 => {
|
|
1715
|
+
var _theme$colors7, _theme$colors8;
|
|
1716
|
+
let {
|
|
1717
|
+
theme: theme$1,
|
|
1718
|
+
hasError
|
|
1719
|
+
} = _ref13;
|
|
1720
|
+
return hasError ? (theme$1 === null || theme$1 === void 0 || (_theme$colors7 = theme$1.colors) === null || _theme$colors7 === void 0 ? void 0 : _theme$colors7.error) || theme.colors.error : (theme$1 === null || theme$1 === void 0 || (_theme$colors8 = theme$1.colors) === null || _theme$colors8 === void 0 || (_theme$colors8 = _theme$colors8.gray) === null || _theme$colors8 === void 0 ? void 0 : _theme$colors8[500]) || theme.colors.gray[500];
|
|
1721
|
+
});
|
|
1722
|
+
const Input = /*#__PURE__*/React__default.forwardRef((_ref14, ref) => {
|
|
1494
1723
|
let {
|
|
1495
1724
|
className,
|
|
1496
1725
|
type = "text",
|
|
@@ -1500,28 +1729,24 @@ const Input = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1500
1729
|
size = "md",
|
|
1501
1730
|
fullWidth = false,
|
|
1502
1731
|
id
|
|
1503
|
-
} =
|
|
1504
|
-
props = _objectWithoutProperties(
|
|
1732
|
+
} = _ref14,
|
|
1733
|
+
props = _objectWithoutProperties(_ref14, _excluded$5);
|
|
1505
1734
|
const inputId = id || "input-".concat(Math.random().toString(36).substr(2, 9));
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
lg: "px-4 py-3 text-base"
|
|
1510
|
-
};
|
|
1511
|
-
const baseClasses = cn("border transition-colors focus:outline-none focus:border-transparent", error ? "border-red-500 focus:ring-red-500" : "border-secondary focus:border-primary", "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-secondary-50", sizes[size], fullWidth && "w-full", className);
|
|
1512
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
1513
|
-
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
1514
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1735
|
+
return jsxRuntimeExports.jsxs(InputContainer, {
|
|
1736
|
+
fullWidth: fullWidth,
|
|
1737
|
+
children: [label && jsxRuntimeExports.jsx(InputLabel, {
|
|
1515
1738
|
htmlFor: inputId,
|
|
1516
|
-
className: "mb-1 text-sm font-medium text-secondary-700",
|
|
1517
1739
|
children: label
|
|
1518
|
-
}), jsxRuntimeExports.jsx(
|
|
1740
|
+
}), jsxRuntimeExports.jsx(StyledInput, _objectSpread2({
|
|
1519
1741
|
type: type,
|
|
1520
|
-
|
|
1742
|
+
size: size,
|
|
1743
|
+
fullWidth: fullWidth,
|
|
1744
|
+
hasError: !!error,
|
|
1745
|
+
className: className,
|
|
1521
1746
|
ref: ref,
|
|
1522
1747
|
id: inputId
|
|
1523
|
-
}, props)), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1524
|
-
|
|
1748
|
+
}, props)), (error || helperText) && jsxRuntimeExports.jsx(HelperText$5, {
|
|
1749
|
+
hasError: !!error,
|
|
1525
1750
|
children: error || helperText
|
|
1526
1751
|
})]
|
|
1527
1752
|
});
|
|
@@ -1529,7 +1754,100 @@ const Input = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1529
1754
|
Input.displayName = "Input";
|
|
1530
1755
|
|
|
1531
1756
|
const _excluded$4 = ["className", "label", "error", "helperText", "size", "fullWidth", "rows", "id"];
|
|
1532
|
-
|
|
1757
|
+
var _templateObject$4, _templateObject2$4, _templateObject3$4, _templateObject4$4, _templateObject5$4, _templateObject6$4, _templateObject7$4, _templateObject8$4, _templateObject9$4, _templateObject0$4;
|
|
1758
|
+
const TextareaContainer = styled.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), _ref => {
|
|
1759
|
+
let {
|
|
1760
|
+
fullWidth
|
|
1761
|
+
} = _ref;
|
|
1762
|
+
return fullWidth && css(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1763
|
+
});
|
|
1764
|
+
const TextareaLabel = styled.label(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-size: ", ";\n font-weight: 500;\n color: ", ";\n"])), _ref2 => {
|
|
1765
|
+
let {
|
|
1766
|
+
theme
|
|
1767
|
+
} = _ref2;
|
|
1768
|
+
return theme.spacing[1];
|
|
1769
|
+
}, _ref3 => {
|
|
1770
|
+
let {
|
|
1771
|
+
theme
|
|
1772
|
+
} = _ref3;
|
|
1773
|
+
return theme.fontSize.sm;
|
|
1774
|
+
}, _ref4 => {
|
|
1775
|
+
let {
|
|
1776
|
+
theme
|
|
1777
|
+
} = _ref4;
|
|
1778
|
+
return theme.colors.gray[700];
|
|
1779
|
+
});
|
|
1780
|
+
const StyledTextarea = styled.textarea(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: ", ";\n transition: border-color ", ";\n outline: none;\n resize: vertical;\n font-family: ", ";\n\n &:focus {\n border-color: ", ";\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n background-color: ", ";\n }\n\n ", "\n\n ", "\n"])), _ref5 => {
|
|
1781
|
+
let {
|
|
1782
|
+
theme,
|
|
1783
|
+
hasError
|
|
1784
|
+
} = _ref5;
|
|
1785
|
+
return hasError ? theme.colors.error : theme.colors.gray[300];
|
|
1786
|
+
}, _ref6 => {
|
|
1787
|
+
let {
|
|
1788
|
+
theme
|
|
1789
|
+
} = _ref6;
|
|
1790
|
+
return theme.borderRadius.md;
|
|
1791
|
+
}, _ref7 => {
|
|
1792
|
+
let {
|
|
1793
|
+
theme
|
|
1794
|
+
} = _ref7;
|
|
1795
|
+
return theme.transitions.base;
|
|
1796
|
+
}, _ref8 => {
|
|
1797
|
+
let {
|
|
1798
|
+
theme
|
|
1799
|
+
} = _ref8;
|
|
1800
|
+
return theme.fontFamily.sans.join(", ");
|
|
1801
|
+
}, _ref9 => {
|
|
1802
|
+
let {
|
|
1803
|
+
theme,
|
|
1804
|
+
hasError
|
|
1805
|
+
} = _ref9;
|
|
1806
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
1807
|
+
}, _ref0 => {
|
|
1808
|
+
let {
|
|
1809
|
+
theme
|
|
1810
|
+
} = _ref0;
|
|
1811
|
+
return theme.colors.gray[50];
|
|
1812
|
+
}, _ref1 => {
|
|
1813
|
+
let {
|
|
1814
|
+
size,
|
|
1815
|
+
theme
|
|
1816
|
+
} = _ref1;
|
|
1817
|
+
if (size === "sm") {
|
|
1818
|
+
return css(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[3], theme.fontSize.sm);
|
|
1819
|
+
}
|
|
1820
|
+
if (size === "md") {
|
|
1821
|
+
return css(_templateObject6$4 || (_templateObject6$4 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[2], theme.spacing[4], theme.fontSize.sm);
|
|
1822
|
+
}
|
|
1823
|
+
if (size === "lg") {
|
|
1824
|
+
return css(_templateObject7$4 || (_templateObject7$4 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[4], theme.fontSize.base);
|
|
1825
|
+
}
|
|
1826
|
+
return css(_templateObject8$4 || (_templateObject8$4 = _taggedTemplateLiteral([""])));
|
|
1827
|
+
}, _ref10 => {
|
|
1828
|
+
let {
|
|
1829
|
+
fullWidth
|
|
1830
|
+
} = _ref10;
|
|
1831
|
+
return fullWidth && css(_templateObject9$4 || (_templateObject9$4 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1832
|
+
});
|
|
1833
|
+
const HelperText$4 = styled.p(_templateObject0$4 || (_templateObject0$4 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref11 => {
|
|
1834
|
+
let {
|
|
1835
|
+
theme
|
|
1836
|
+
} = _ref11;
|
|
1837
|
+
return theme.spacing[1];
|
|
1838
|
+
}, _ref12 => {
|
|
1839
|
+
let {
|
|
1840
|
+
theme
|
|
1841
|
+
} = _ref12;
|
|
1842
|
+
return theme.fontSize.xs;
|
|
1843
|
+
}, _ref13 => {
|
|
1844
|
+
let {
|
|
1845
|
+
theme,
|
|
1846
|
+
hasError
|
|
1847
|
+
} = _ref13;
|
|
1848
|
+
return hasError ? theme.colors.error : theme.colors.gray[500];
|
|
1849
|
+
});
|
|
1850
|
+
const Textarea = /*#__PURE__*/React__default.forwardRef((_ref14, ref) => {
|
|
1533
1851
|
let {
|
|
1534
1852
|
className,
|
|
1535
1853
|
label,
|
|
@@ -1539,28 +1857,24 @@ const Textarea = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1539
1857
|
fullWidth = false,
|
|
1540
1858
|
rows = 3,
|
|
1541
1859
|
id
|
|
1542
|
-
} =
|
|
1543
|
-
props = _objectWithoutProperties(
|
|
1860
|
+
} = _ref14,
|
|
1861
|
+
props = _objectWithoutProperties(_ref14, _excluded$4);
|
|
1544
1862
|
const textareaId = id || "textarea-".concat(Math.random().toString(36).substr(2, 9));
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
lg: "px-4 py-3 text-base"
|
|
1549
|
-
};
|
|
1550
|
-
const baseClasses = cn("border transition-colors focus:outline-none focus:border-transparent resize-vertical", error ? "border-red-500 focus:ring-red-500" : "border-secondary focus:border-primary", "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-secondary-50", sizes[size], fullWidth && "w-full", className);
|
|
1551
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
1552
|
-
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
1553
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
1863
|
+
return jsxRuntimeExports.jsxs(TextareaContainer, {
|
|
1864
|
+
fullWidth: fullWidth,
|
|
1865
|
+
children: [label && jsxRuntimeExports.jsx(TextareaLabel, {
|
|
1554
1866
|
htmlFor: textareaId,
|
|
1555
|
-
className: "mb-1 text-sm font-medium text-secondary-700",
|
|
1556
1867
|
children: label
|
|
1557
|
-
}), jsxRuntimeExports.jsx(
|
|
1558
|
-
|
|
1868
|
+
}), jsxRuntimeExports.jsx(StyledTextarea, _objectSpread2({
|
|
1869
|
+
size: size,
|
|
1870
|
+
fullWidth: fullWidth,
|
|
1871
|
+
hasError: !!error,
|
|
1872
|
+
className: className,
|
|
1559
1873
|
ref: ref,
|
|
1560
1874
|
id: textareaId,
|
|
1561
1875
|
rows: rows
|
|
1562
|
-
}, props)), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1563
|
-
|
|
1876
|
+
}, props)), (error || helperText) && jsxRuntimeExports.jsx(HelperText$4, {
|
|
1877
|
+
hasError: !!error,
|
|
1564
1878
|
children: error || helperText
|
|
1565
1879
|
})]
|
|
1566
1880
|
});
|
|
@@ -1568,7 +1882,115 @@ const Textarea = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1568
1882
|
Textarea.displayName = "Textarea";
|
|
1569
1883
|
|
|
1570
1884
|
const _excluded$3 = ["className", "label", "error", "helperText", "size", "fullWidth", "accept", "multiple", "buttonText", "id"];
|
|
1571
|
-
|
|
1885
|
+
var _templateObject$3, _templateObject2$3, _templateObject3$3, _templateObject4$3, _templateObject5$3, _templateObject6$3, _templateObject7$3, _templateObject8$3, _templateObject9$3, _templateObject0$3, _templateObject1$3, _templateObject10$3, _templateObject11$2, _templateObject12$2;
|
|
1886
|
+
const InputFileContainer = styled.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), _ref => {
|
|
1887
|
+
let {
|
|
1888
|
+
fullWidth
|
|
1889
|
+
} = _ref;
|
|
1890
|
+
return fullWidth && css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1891
|
+
});
|
|
1892
|
+
const InputFileLabel = styled.label(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-size: ", ";\n font-weight: 500;\n color: ", ";\n"])), _ref2 => {
|
|
1893
|
+
let {
|
|
1894
|
+
theme
|
|
1895
|
+
} = _ref2;
|
|
1896
|
+
return theme.spacing[1];
|
|
1897
|
+
}, _ref3 => {
|
|
1898
|
+
let {
|
|
1899
|
+
theme
|
|
1900
|
+
} = _ref3;
|
|
1901
|
+
return theme.fontSize.sm;
|
|
1902
|
+
}, _ref4 => {
|
|
1903
|
+
let {
|
|
1904
|
+
theme
|
|
1905
|
+
} = _ref4;
|
|
1906
|
+
return theme.colors.gray[700];
|
|
1907
|
+
});
|
|
1908
|
+
const InputFileWrapper = styled.div(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
1909
|
+
const HiddenInput = styled.input(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n cursor: pointer;\n"])));
|
|
1910
|
+
const FileUploadArea = styled.div(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteral(["\n border: 2px dashed ", ";\n transition: all ", ";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:hover {\n border-color: ", ";\n }\n\n &:focus-within {\n border-color: ", ";\n }\n\n ", "\n\n ", "\n"])), _ref5 => {
|
|
1911
|
+
let {
|
|
1912
|
+
theme,
|
|
1913
|
+
hasError
|
|
1914
|
+
} = _ref5;
|
|
1915
|
+
return hasError ? theme.colors.error : theme.colors.gray[300];
|
|
1916
|
+
}, _ref6 => {
|
|
1917
|
+
let {
|
|
1918
|
+
theme
|
|
1919
|
+
} = _ref6;
|
|
1920
|
+
return theme.transitions.base;
|
|
1921
|
+
}, _ref7 => {
|
|
1922
|
+
let {
|
|
1923
|
+
theme,
|
|
1924
|
+
hasError
|
|
1925
|
+
} = _ref7;
|
|
1926
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
1927
|
+
}, _ref8 => {
|
|
1928
|
+
let {
|
|
1929
|
+
theme,
|
|
1930
|
+
hasError
|
|
1931
|
+
} = _ref8;
|
|
1932
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
1933
|
+
}, _ref9 => {
|
|
1934
|
+
let {
|
|
1935
|
+
size,
|
|
1936
|
+
theme
|
|
1937
|
+
} = _ref9;
|
|
1938
|
+
if (size === "sm") {
|
|
1939
|
+
return css(_templateObject7$3 || (_templateObject7$3 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[3], theme.fontSize.sm);
|
|
1940
|
+
}
|
|
1941
|
+
if (size === "md") {
|
|
1942
|
+
return css(_templateObject8$3 || (_templateObject8$3 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[2], theme.spacing[4], theme.fontSize.base);
|
|
1943
|
+
}
|
|
1944
|
+
if (size === "lg") {
|
|
1945
|
+
return css(_templateObject9$3 || (_templateObject9$3 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[4], theme.fontSize.base);
|
|
1946
|
+
}
|
|
1947
|
+
return css(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteral([""])));
|
|
1948
|
+
}, _ref0 => {
|
|
1949
|
+
let {
|
|
1950
|
+
fullWidth
|
|
1951
|
+
} = _ref0;
|
|
1952
|
+
return fullWidth && css(_templateObject1$3 || (_templateObject1$3 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
1953
|
+
});
|
|
1954
|
+
const ButtonText = styled.span(_templateObject10$3 || (_templateObject10$3 = _taggedTemplateLiteral(["\n color: ", ";\n"])), _ref1 => {
|
|
1955
|
+
let {
|
|
1956
|
+
theme
|
|
1957
|
+
} = _ref1;
|
|
1958
|
+
return theme.colors.gray[600];
|
|
1959
|
+
});
|
|
1960
|
+
const MultipleText = styled.span(_templateObject11$2 || (_templateObject11$2 = _taggedTemplateLiteral(["\n margin-left: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref10 => {
|
|
1961
|
+
let {
|
|
1962
|
+
theme
|
|
1963
|
+
} = _ref10;
|
|
1964
|
+
return theme.spacing[1];
|
|
1965
|
+
}, _ref11 => {
|
|
1966
|
+
let {
|
|
1967
|
+
theme
|
|
1968
|
+
} = _ref11;
|
|
1969
|
+
return theme.fontSize.xs;
|
|
1970
|
+
}, _ref12 => {
|
|
1971
|
+
let {
|
|
1972
|
+
theme
|
|
1973
|
+
} = _ref12;
|
|
1974
|
+
return theme.colors.gray[500];
|
|
1975
|
+
});
|
|
1976
|
+
const HelperText$3 = styled.p(_templateObject12$2 || (_templateObject12$2 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref13 => {
|
|
1977
|
+
let {
|
|
1978
|
+
theme
|
|
1979
|
+
} = _ref13;
|
|
1980
|
+
return theme.spacing[1];
|
|
1981
|
+
}, _ref14 => {
|
|
1982
|
+
let {
|
|
1983
|
+
theme
|
|
1984
|
+
} = _ref14;
|
|
1985
|
+
return theme.fontSize.xs;
|
|
1986
|
+
}, _ref15 => {
|
|
1987
|
+
let {
|
|
1988
|
+
theme,
|
|
1989
|
+
hasError
|
|
1990
|
+
} = _ref15;
|
|
1991
|
+
return hasError ? theme.colors.error : theme.colors.gray[500];
|
|
1992
|
+
});
|
|
1993
|
+
const InputFile = /*#__PURE__*/React__default.forwardRef((_ref16, ref) => {
|
|
1572
1994
|
let {
|
|
1573
1995
|
className,
|
|
1574
1996
|
label,
|
|
@@ -1580,42 +2002,34 @@ const InputFile = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1580
2002
|
multiple = false,
|
|
1581
2003
|
buttonText = "Choose File",
|
|
1582
2004
|
id
|
|
1583
|
-
} =
|
|
1584
|
-
props = _objectWithoutProperties(
|
|
2005
|
+
} = _ref16,
|
|
2006
|
+
props = _objectWithoutProperties(_ref16, _excluded$3);
|
|
1585
2007
|
const inputId = id || "file-input-".concat(Math.random().toString(36).substr(2, 9));
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
lg: "px-4 py-3 text-base"
|
|
1590
|
-
};
|
|
1591
|
-
const baseClasses = cn("border-2 border-dashed transition-colors focus:outline-none focus:border-transparent cursor-pointer", error ? "border-red-500 focus:ring-red-500 hover:border-red-400" : "border-secondary focus:border-primary hover:border-primary/60", "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-secondary-50", sizes[size], fullWidth && "w-full", className);
|
|
1592
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
1593
|
-
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
1594
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2008
|
+
return jsxRuntimeExports.jsxs(InputFileContainer, {
|
|
2009
|
+
fullWidth: fullWidth,
|
|
2010
|
+
children: [label && jsxRuntimeExports.jsx(InputFileLabel, {
|
|
1595
2011
|
htmlFor: inputId,
|
|
1596
|
-
className: "mb-1 text-sm font-medium text-secondary-700",
|
|
1597
2012
|
children: label
|
|
1598
|
-
}), jsxRuntimeExports.jsxs(
|
|
1599
|
-
|
|
1600
|
-
children: [jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
2013
|
+
}), jsxRuntimeExports.jsxs(InputFileWrapper, {
|
|
2014
|
+
children: [jsxRuntimeExports.jsx(HiddenInput, _objectSpread2({
|
|
1601
2015
|
type: "file",
|
|
1602
|
-
className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer",
|
|
1603
2016
|
ref: ref,
|
|
1604
2017
|
id: inputId,
|
|
1605
2018
|
accept: accept,
|
|
1606
2019
|
multiple: multiple
|
|
1607
|
-
}, props)), jsxRuntimeExports.jsxs(
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
2020
|
+
}, props)), jsxRuntimeExports.jsxs(FileUploadArea, {
|
|
2021
|
+
size: size,
|
|
2022
|
+
fullWidth: fullWidth,
|
|
2023
|
+
hasError: !!error,
|
|
2024
|
+
className: className,
|
|
2025
|
+
children: [jsxRuntimeExports.jsx(ButtonText, {
|
|
1611
2026
|
children: buttonText
|
|
1612
|
-
}), multiple && jsxRuntimeExports.jsx(
|
|
1613
|
-
className: "ml-1 text-xs text-secondary-500",
|
|
2027
|
+
}), multiple && jsxRuntimeExports.jsx(MultipleText, {
|
|
1614
2028
|
children: "(Multiple)"
|
|
1615
2029
|
})]
|
|
1616
2030
|
})]
|
|
1617
|
-
}), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1618
|
-
|
|
2031
|
+
}), (error || helperText) && jsxRuntimeExports.jsx(HelperText$3, {
|
|
2032
|
+
hasError: !!error,
|
|
1619
2033
|
children: error || helperText
|
|
1620
2034
|
})]
|
|
1621
2035
|
});
|
|
@@ -1623,7 +2037,102 @@ const InputFile = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1623
2037
|
InputFile.displayName = "InputFile";
|
|
1624
2038
|
|
|
1625
2039
|
const _excluded$2 = ["className", "label", "error", "helperText", "size", "fullWidth", "indeterminate", "id"];
|
|
1626
|
-
|
|
2040
|
+
var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4$2, _templateObject5$2, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject0$2, _templateObject1$2, _templateObject10$2, _templateObject11$1, _templateObject12$1, _templateObject13$1;
|
|
2041
|
+
const CheckboxContainer = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n ", "\n"])), _ref => {
|
|
2042
|
+
let {
|
|
2043
|
+
fullWidth
|
|
2044
|
+
} = _ref;
|
|
2045
|
+
return fullWidth && css(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
2046
|
+
});
|
|
2047
|
+
const CheckboxWrapper = styled.div(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: ", ";\n"])), _ref2 => {
|
|
2048
|
+
let {
|
|
2049
|
+
theme
|
|
2050
|
+
} = _ref2;
|
|
2051
|
+
return theme.spacing[5];
|
|
2052
|
+
});
|
|
2053
|
+
const StyledCheckbox = styled.input(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteral(["\n border-radius: ", ";\n border: 1px solid ", ";\n transition: all ", ";\n outline: none;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n ", "\n"])), _ref3 => {
|
|
2054
|
+
let {
|
|
2055
|
+
theme
|
|
2056
|
+
} = _ref3;
|
|
2057
|
+
return theme.borderRadius.md;
|
|
2058
|
+
}, _ref4 => {
|
|
2059
|
+
let {
|
|
2060
|
+
theme,
|
|
2061
|
+
hasError
|
|
2062
|
+
} = _ref4;
|
|
2063
|
+
return hasError ? theme.colors.error : theme.colors.gray[300];
|
|
2064
|
+
}, _ref5 => {
|
|
2065
|
+
let {
|
|
2066
|
+
theme
|
|
2067
|
+
} = _ref5;
|
|
2068
|
+
return theme.transitions.base;
|
|
2069
|
+
}, _ref6 => {
|
|
2070
|
+
let {
|
|
2071
|
+
theme,
|
|
2072
|
+
hasError
|
|
2073
|
+
} = _ref6;
|
|
2074
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
2075
|
+
}, _ref7 => {
|
|
2076
|
+
let {
|
|
2077
|
+
size,
|
|
2078
|
+
theme
|
|
2079
|
+
} = _ref7;
|
|
2080
|
+
if (size === "sm") {
|
|
2081
|
+
return css(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[4], theme.spacing[4]);
|
|
2082
|
+
}
|
|
2083
|
+
if (size === "md") {
|
|
2084
|
+
return css(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[5], theme.spacing[5]);
|
|
2085
|
+
}
|
|
2086
|
+
if (size === "lg") {
|
|
2087
|
+
return css(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[6], theme.spacing[6]);
|
|
2088
|
+
}
|
|
2089
|
+
return css(_templateObject8$2 || (_templateObject8$2 = _taggedTemplateLiteral([""])));
|
|
2090
|
+
});
|
|
2091
|
+
const LabelContainer$1 = styled.div(_templateObject9$2 || (_templateObject9$2 = _taggedTemplateLiteral(["\n margin-left: ", ";\n"])), _ref8 => {
|
|
2092
|
+
let {
|
|
2093
|
+
theme
|
|
2094
|
+
} = _ref8;
|
|
2095
|
+
return theme.spacing[3];
|
|
2096
|
+
});
|
|
2097
|
+
const CheckboxLabel = styled.label(_templateObject0$2 || (_templateObject0$2 = _taggedTemplateLiteral(["\n font-weight: 500;\n color: ", ";\n cursor: pointer;\n\n ", "\n"])), _ref9 => {
|
|
2098
|
+
let {
|
|
2099
|
+
theme
|
|
2100
|
+
} = _ref9;
|
|
2101
|
+
return theme.colors.gray[700];
|
|
2102
|
+
}, _ref0 => {
|
|
2103
|
+
let {
|
|
2104
|
+
size,
|
|
2105
|
+
theme
|
|
2106
|
+
} = _ref0;
|
|
2107
|
+
if (size === "sm") {
|
|
2108
|
+
return css(_templateObject1$2 || (_templateObject1$2 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.sm);
|
|
2109
|
+
}
|
|
2110
|
+
if (size === "md") {
|
|
2111
|
+
return css(_templateObject10$2 || (_templateObject10$2 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.sm);
|
|
2112
|
+
}
|
|
2113
|
+
if (size === "lg") {
|
|
2114
|
+
return css(_templateObject11$1 || (_templateObject11$1 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.base);
|
|
2115
|
+
}
|
|
2116
|
+
return css(_templateObject12$1 || (_templateObject12$1 = _taggedTemplateLiteral([""])));
|
|
2117
|
+
});
|
|
2118
|
+
const HelperText$2 = styled.p(_templateObject13$1 || (_templateObject13$1 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref1 => {
|
|
2119
|
+
let {
|
|
2120
|
+
theme
|
|
2121
|
+
} = _ref1;
|
|
2122
|
+
return theme.spacing[1];
|
|
2123
|
+
}, _ref10 => {
|
|
2124
|
+
let {
|
|
2125
|
+
theme
|
|
2126
|
+
} = _ref10;
|
|
2127
|
+
return theme.fontSize.xs;
|
|
2128
|
+
}, _ref11 => {
|
|
2129
|
+
let {
|
|
2130
|
+
theme,
|
|
2131
|
+
hasError
|
|
2132
|
+
} = _ref11;
|
|
2133
|
+
return hasError ? theme.colors.error : theme.colors.gray[500];
|
|
2134
|
+
});
|
|
2135
|
+
const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref12, ref) => {
|
|
1627
2136
|
let {
|
|
1628
2137
|
className,
|
|
1629
2138
|
label,
|
|
@@ -1633,43 +2142,32 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1633
2142
|
fullWidth = false,
|
|
1634
2143
|
indeterminate = false,
|
|
1635
2144
|
id
|
|
1636
|
-
} =
|
|
1637
|
-
props = _objectWithoutProperties(
|
|
2145
|
+
} = _ref12,
|
|
2146
|
+
props = _objectWithoutProperties(_ref12, _excluded$2);
|
|
1638
2147
|
const checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
1639
|
-
const sizes = {
|
|
1640
|
-
sm: "w-4 h-4",
|
|
1641
|
-
md: "w-5 h-5",
|
|
1642
|
-
lg: "w-6 h-6"
|
|
1643
|
-
};
|
|
1644
|
-
const labelSizes = {
|
|
1645
|
-
sm: "text-sm",
|
|
1646
|
-
md: "text-sm",
|
|
1647
|
-
lg: "text-base"
|
|
1648
|
-
};
|
|
1649
|
-
const baseClasses = cn("rounded border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", error ? "border-red-500 focus:ring-red-500" : "border-secondary focus:ring-primary", "disabled:opacity-50 disabled:cursor-not-allowed", sizes[size], className);
|
|
1650
2148
|
React__default.useEffect(() => {
|
|
1651
2149
|
if (ref && typeof ref === "object" && ref.current) {
|
|
1652
2150
|
ref.current.indeterminate = indeterminate;
|
|
1653
2151
|
}
|
|
1654
2152
|
}, [indeterminate, ref]);
|
|
1655
|
-
return jsxRuntimeExports.jsxs(
|
|
1656
|
-
|
|
1657
|
-
children: [jsxRuntimeExports.jsx(
|
|
1658
|
-
|
|
1659
|
-
children: jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
2153
|
+
return jsxRuntimeExports.jsxs(CheckboxContainer, {
|
|
2154
|
+
fullWidth: fullWidth,
|
|
2155
|
+
children: [jsxRuntimeExports.jsx(CheckboxWrapper, {
|
|
2156
|
+
children: jsxRuntimeExports.jsx(StyledCheckbox, _objectSpread2({
|
|
1660
2157
|
type: "checkbox",
|
|
1661
|
-
|
|
2158
|
+
size: size,
|
|
2159
|
+
hasError: !!error,
|
|
2160
|
+
className: className,
|
|
1662
2161
|
ref: ref,
|
|
1663
2162
|
id: checkboxId
|
|
1664
2163
|
}, props))
|
|
1665
|
-
}), jsxRuntimeExports.jsxs(
|
|
1666
|
-
|
|
1667
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2164
|
+
}), jsxRuntimeExports.jsxs(LabelContainer$1, {
|
|
2165
|
+
children: [label && jsxRuntimeExports.jsx(CheckboxLabel, {
|
|
1668
2166
|
htmlFor: checkboxId,
|
|
1669
|
-
|
|
2167
|
+
size: size,
|
|
1670
2168
|
children: label
|
|
1671
|
-
}), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1672
|
-
|
|
2169
|
+
}), (error || helperText) && jsxRuntimeExports.jsx(HelperText$2, {
|
|
2170
|
+
hasError: !!error,
|
|
1673
2171
|
children: error || helperText
|
|
1674
2172
|
})]
|
|
1675
2173
|
})]
|
|
@@ -1678,7 +2176,97 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1678
2176
|
Checkbox.displayName = "Checkbox";
|
|
1679
2177
|
|
|
1680
2178
|
const _excluded$1 = ["className", "label", "error", "helperText", "size", "fullWidth", "id"];
|
|
1681
|
-
|
|
2179
|
+
var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject0$1, _templateObject1$1, _templateObject10$1, _templateObject11, _templateObject12, _templateObject13;
|
|
2180
|
+
const RadioContainer = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n ", "\n"])), _ref => {
|
|
2181
|
+
let {
|
|
2182
|
+
fullWidth
|
|
2183
|
+
} = _ref;
|
|
2184
|
+
return fullWidth && css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
2185
|
+
});
|
|
2186
|
+
const RadioWrapper = styled.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: ", ";\n"])), _ref2 => {
|
|
2187
|
+
let {
|
|
2188
|
+
theme
|
|
2189
|
+
} = _ref2;
|
|
2190
|
+
return theme.spacing[5];
|
|
2191
|
+
});
|
|
2192
|
+
const StyledRadio = styled.input(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n border: 2px solid ", ";\n transition: all ", ";\n outline: none;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n ", "\n"])), _ref3 => {
|
|
2193
|
+
let {
|
|
2194
|
+
theme,
|
|
2195
|
+
hasError
|
|
2196
|
+
} = _ref3;
|
|
2197
|
+
return hasError ? theme.colors.error : theme.colors.gray[300];
|
|
2198
|
+
}, _ref4 => {
|
|
2199
|
+
let {
|
|
2200
|
+
theme
|
|
2201
|
+
} = _ref4;
|
|
2202
|
+
return theme.transitions.base;
|
|
2203
|
+
}, _ref5 => {
|
|
2204
|
+
let {
|
|
2205
|
+
theme,
|
|
2206
|
+
hasError
|
|
2207
|
+
} = _ref5;
|
|
2208
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
2209
|
+
}, _ref6 => {
|
|
2210
|
+
let {
|
|
2211
|
+
size,
|
|
2212
|
+
theme
|
|
2213
|
+
} = _ref6;
|
|
2214
|
+
if (size === "sm") {
|
|
2215
|
+
return css(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[4], theme.spacing[4]);
|
|
2216
|
+
}
|
|
2217
|
+
if (size === "md") {
|
|
2218
|
+
return css(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[5], theme.spacing[5]);
|
|
2219
|
+
}
|
|
2220
|
+
if (size === "lg") {
|
|
2221
|
+
return css(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n "])), theme.spacing[6], theme.spacing[6]);
|
|
2222
|
+
}
|
|
2223
|
+
return css(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral([""])));
|
|
2224
|
+
});
|
|
2225
|
+
const LabelContainer = styled.div(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteral(["\n margin-left: ", ";\n"])), _ref7 => {
|
|
2226
|
+
let {
|
|
2227
|
+
theme
|
|
2228
|
+
} = _ref7;
|
|
2229
|
+
return theme.spacing[3];
|
|
2230
|
+
});
|
|
2231
|
+
const RadioLabel = styled.label(_templateObject0$1 || (_templateObject0$1 = _taggedTemplateLiteral(["\n font-weight: 500;\n color: ", ";\n cursor: pointer;\n\n ", "\n"])), _ref8 => {
|
|
2232
|
+
let {
|
|
2233
|
+
theme
|
|
2234
|
+
} = _ref8;
|
|
2235
|
+
return theme.colors.gray[700];
|
|
2236
|
+
}, _ref9 => {
|
|
2237
|
+
let {
|
|
2238
|
+
size,
|
|
2239
|
+
theme
|
|
2240
|
+
} = _ref9;
|
|
2241
|
+
if (size === "sm") {
|
|
2242
|
+
return css(_templateObject1$1 || (_templateObject1$1 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.sm);
|
|
2243
|
+
}
|
|
2244
|
+
if (size === "md") {
|
|
2245
|
+
return css(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.sm);
|
|
2246
|
+
}
|
|
2247
|
+
if (size === "lg") {
|
|
2248
|
+
return css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n font-size: ", ";\n "])), theme.fontSize.base);
|
|
2249
|
+
}
|
|
2250
|
+
return css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral([""])));
|
|
2251
|
+
});
|
|
2252
|
+
const HelperText$1 = styled.p(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref0 => {
|
|
2253
|
+
let {
|
|
2254
|
+
theme
|
|
2255
|
+
} = _ref0;
|
|
2256
|
+
return theme.spacing[1];
|
|
2257
|
+
}, _ref1 => {
|
|
2258
|
+
let {
|
|
2259
|
+
theme
|
|
2260
|
+
} = _ref1;
|
|
2261
|
+
return theme.fontSize.xs;
|
|
2262
|
+
}, _ref10 => {
|
|
2263
|
+
let {
|
|
2264
|
+
theme,
|
|
2265
|
+
hasError
|
|
2266
|
+
} = _ref10;
|
|
2267
|
+
return hasError ? theme.colors.error : theme.colors.gray[500];
|
|
2268
|
+
});
|
|
2269
|
+
const Radio = /*#__PURE__*/React__default.forwardRef((_ref11, ref) => {
|
|
1682
2270
|
let {
|
|
1683
2271
|
className,
|
|
1684
2272
|
label,
|
|
@@ -1687,38 +2275,27 @@ const Radio = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1687
2275
|
size = "md",
|
|
1688
2276
|
fullWidth = false,
|
|
1689
2277
|
id
|
|
1690
|
-
} =
|
|
1691
|
-
props = _objectWithoutProperties(
|
|
2278
|
+
} = _ref11,
|
|
2279
|
+
props = _objectWithoutProperties(_ref11, _excluded$1);
|
|
1692
2280
|
const radioId = id || "radio-".concat(Math.random().toString(36).substr(2, 9));
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
};
|
|
1698
|
-
const labelSizes = {
|
|
1699
|
-
sm: "text-sm",
|
|
1700
|
-
md: "text-sm",
|
|
1701
|
-
lg: "text-base"
|
|
1702
|
-
};
|
|
1703
|
-
const baseClasses = cn("border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2", error ? "border-red-500 focus:ring-red-500" : "border-secondary focus:ring-primary", "disabled:opacity-50 disabled:cursor-not-allowed", sizes[size], className);
|
|
1704
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
1705
|
-
className: cn("flex items-start", fullWidth && "w-full"),
|
|
1706
|
-
children: [jsxRuntimeExports.jsx("div", {
|
|
1707
|
-
className: "flex items-center h-5",
|
|
1708
|
-
children: jsxRuntimeExports.jsx("input", _objectSpread2({
|
|
2281
|
+
return jsxRuntimeExports.jsxs(RadioContainer, {
|
|
2282
|
+
fullWidth: fullWidth,
|
|
2283
|
+
children: [jsxRuntimeExports.jsx(RadioWrapper, {
|
|
2284
|
+
children: jsxRuntimeExports.jsx(StyledRadio, _objectSpread2({
|
|
1709
2285
|
type: "radio",
|
|
1710
|
-
|
|
2286
|
+
size: size,
|
|
2287
|
+
hasError: !!error,
|
|
2288
|
+
className: className,
|
|
1711
2289
|
ref: ref,
|
|
1712
2290
|
id: radioId
|
|
1713
2291
|
}, props))
|
|
1714
|
-
}), jsxRuntimeExports.jsxs(
|
|
1715
|
-
|
|
1716
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2292
|
+
}), jsxRuntimeExports.jsxs(LabelContainer, {
|
|
2293
|
+
children: [label && jsxRuntimeExports.jsx(RadioLabel, {
|
|
1717
2294
|
htmlFor: radioId,
|
|
1718
|
-
|
|
2295
|
+
size: size,
|
|
1719
2296
|
children: label
|
|
1720
|
-
}), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1721
|
-
|
|
2297
|
+
}), (error || helperText) && jsxRuntimeExports.jsx(HelperText$1, {
|
|
2298
|
+
hasError: !!error,
|
|
1722
2299
|
children: error || helperText
|
|
1723
2300
|
})]
|
|
1724
2301
|
})]
|
|
@@ -1727,7 +2304,112 @@ const Radio = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1727
2304
|
Radio.displayName = "Radio";
|
|
1728
2305
|
|
|
1729
2306
|
const _excluded = ["className", "label", "error", "helperText", "size", "fullWidth", "options", "placeholder", "id"];
|
|
1730
|
-
|
|
2307
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0, _templateObject1, _templateObject10;
|
|
2308
|
+
const SelectContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), _ref => {
|
|
2309
|
+
let {
|
|
2310
|
+
fullWidth
|
|
2311
|
+
} = _ref;
|
|
2312
|
+
return fullWidth && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
2313
|
+
});
|
|
2314
|
+
const SelectLabel = styled.label(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n font-size: ", ";\n font-weight: 500;\n color: ", ";\n"])), _ref2 => {
|
|
2315
|
+
let {
|
|
2316
|
+
theme
|
|
2317
|
+
} = _ref2;
|
|
2318
|
+
return theme.spacing[1];
|
|
2319
|
+
}, _ref3 => {
|
|
2320
|
+
let {
|
|
2321
|
+
theme
|
|
2322
|
+
} = _ref3;
|
|
2323
|
+
return theme.fontSize.sm;
|
|
2324
|
+
}, _ref4 => {
|
|
2325
|
+
let {
|
|
2326
|
+
theme
|
|
2327
|
+
} = _ref4;
|
|
2328
|
+
return theme.colors.gray[700];
|
|
2329
|
+
});
|
|
2330
|
+
const SelectWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
2331
|
+
const StyledSelect = styled.select(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: ", ";\n transition: border-color ", ";\n outline: none;\n appearance: none;\n background-color: ", ";\n font-family: ", ";\n\n &:focus {\n border-color: ", ";\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n background-color: ", ";\n }\n\n ", "\n\n ", "\n"])), _ref5 => {
|
|
2332
|
+
let {
|
|
2333
|
+
theme,
|
|
2334
|
+
hasError
|
|
2335
|
+
} = _ref5;
|
|
2336
|
+
return hasError ? theme.colors.error : theme.colors.gray[300];
|
|
2337
|
+
}, _ref6 => {
|
|
2338
|
+
let {
|
|
2339
|
+
theme
|
|
2340
|
+
} = _ref6;
|
|
2341
|
+
return theme.borderRadius.md;
|
|
2342
|
+
}, _ref7 => {
|
|
2343
|
+
let {
|
|
2344
|
+
theme
|
|
2345
|
+
} = _ref7;
|
|
2346
|
+
return theme.transitions.base;
|
|
2347
|
+
}, _ref8 => {
|
|
2348
|
+
let {
|
|
2349
|
+
theme
|
|
2350
|
+
} = _ref8;
|
|
2351
|
+
return theme.colors.white;
|
|
2352
|
+
}, _ref9 => {
|
|
2353
|
+
let {
|
|
2354
|
+
theme
|
|
2355
|
+
} = _ref9;
|
|
2356
|
+
return theme.fontFamily.sans.join(", ");
|
|
2357
|
+
}, _ref0 => {
|
|
2358
|
+
let {
|
|
2359
|
+
theme,
|
|
2360
|
+
hasError
|
|
2361
|
+
} = _ref0;
|
|
2362
|
+
return hasError ? theme.colors.error : theme.colors.primary;
|
|
2363
|
+
}, _ref1 => {
|
|
2364
|
+
let {
|
|
2365
|
+
theme
|
|
2366
|
+
} = _ref1;
|
|
2367
|
+
return theme.colors.gray[50];
|
|
2368
|
+
}, _ref10 => {
|
|
2369
|
+
let {
|
|
2370
|
+
size,
|
|
2371
|
+
theme
|
|
2372
|
+
} = _ref10;
|
|
2373
|
+
if (size === "sm") {
|
|
2374
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[3], theme.fontSize.sm);
|
|
2375
|
+
}
|
|
2376
|
+
if (size === "md") {
|
|
2377
|
+
return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[2], theme.spacing[4], theme.fontSize.sm);
|
|
2378
|
+
}
|
|
2379
|
+
if (size === "lg") {
|
|
2380
|
+
return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n font-size: ", ";\n "])), theme.spacing[3], theme.spacing[4], theme.fontSize.base);
|
|
2381
|
+
}
|
|
2382
|
+
return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral([""])));
|
|
2383
|
+
}, _ref11 => {
|
|
2384
|
+
let {
|
|
2385
|
+
fullWidth
|
|
2386
|
+
} = _ref11;
|
|
2387
|
+
return fullWidth && css(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
2388
|
+
});
|
|
2389
|
+
const SelectIcon = styled.div(_templateObject1 || (_templateObject1 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n padding-right: ", ";\n pointer-events: none;\n"])), _ref12 => {
|
|
2390
|
+
let {
|
|
2391
|
+
theme
|
|
2392
|
+
} = _ref12;
|
|
2393
|
+
return theme.spacing[3];
|
|
2394
|
+
});
|
|
2395
|
+
const HelperText = styled.p(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: ", ";\n font-size: ", ";\n color: ", ";\n"])), _ref13 => {
|
|
2396
|
+
let {
|
|
2397
|
+
theme
|
|
2398
|
+
} = _ref13;
|
|
2399
|
+
return theme.spacing[1];
|
|
2400
|
+
}, _ref14 => {
|
|
2401
|
+
let {
|
|
2402
|
+
theme
|
|
2403
|
+
} = _ref14;
|
|
2404
|
+
return theme.fontSize.xs;
|
|
2405
|
+
}, _ref15 => {
|
|
2406
|
+
let {
|
|
2407
|
+
theme,
|
|
2408
|
+
hasError
|
|
2409
|
+
} = _ref15;
|
|
2410
|
+
return hasError ? theme.colors.error : theme.colors.gray[500];
|
|
2411
|
+
});
|
|
2412
|
+
const Select = /*#__PURE__*/React__default.forwardRef((_ref16, ref) => {
|
|
1731
2413
|
let {
|
|
1732
2414
|
className,
|
|
1733
2415
|
label,
|
|
@@ -1738,25 +2420,20 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1738
2420
|
options,
|
|
1739
2421
|
placeholder,
|
|
1740
2422
|
id
|
|
1741
|
-
} =
|
|
1742
|
-
props = _objectWithoutProperties(
|
|
2423
|
+
} = _ref16,
|
|
2424
|
+
props = _objectWithoutProperties(_ref16, _excluded);
|
|
1743
2425
|
const selectId = id || "select-".concat(Math.random().toString(36).substr(2, 9));
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
lg: "px-4 py-3 text-base"
|
|
1748
|
-
};
|
|
1749
|
-
const baseClasses = cn("border transition-colors focus:outline-none focus:border-transparent appearance-none bg-white", error ? "border-red-500 focus:ring-red-500" : "border-secondary focus:border-primary", "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-secondary-50", sizes[size], fullWidth && "w-full", className);
|
|
1750
|
-
return jsxRuntimeExports.jsxs("div", {
|
|
1751
|
-
className: cn("flex flex-col", fullWidth && "w-full"),
|
|
1752
|
-
children: [label && jsxRuntimeExports.jsx("label", {
|
|
2426
|
+
return jsxRuntimeExports.jsxs(SelectContainer, {
|
|
2427
|
+
fullWidth: fullWidth,
|
|
2428
|
+
children: [label && jsxRuntimeExports.jsx(SelectLabel, {
|
|
1753
2429
|
htmlFor: selectId,
|
|
1754
|
-
className: "mb-1 text-sm font-medium text-secondary-700",
|
|
1755
2430
|
children: label
|
|
1756
|
-
}), jsxRuntimeExports.jsxs(
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
2431
|
+
}), jsxRuntimeExports.jsxs(SelectWrapper, {
|
|
2432
|
+
children: [jsxRuntimeExports.jsxs(StyledSelect, _objectSpread2(_objectSpread2({
|
|
2433
|
+
size: size,
|
|
2434
|
+
fullWidth: fullWidth,
|
|
2435
|
+
hasError: !!error,
|
|
2436
|
+
className: className,
|
|
1760
2437
|
ref: ref,
|
|
1761
2438
|
id: selectId
|
|
1762
2439
|
}, props), {}, {
|
|
@@ -1769,13 +2446,16 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1769
2446
|
disabled: option.disabled,
|
|
1770
2447
|
children: option.label
|
|
1771
2448
|
}, option.value))]
|
|
1772
|
-
})), jsxRuntimeExports.jsx(
|
|
1773
|
-
className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",
|
|
2449
|
+
})), jsxRuntimeExports.jsx(SelectIcon, {
|
|
1774
2450
|
children: jsxRuntimeExports.jsx("svg", {
|
|
1775
|
-
|
|
2451
|
+
width: "16",
|
|
2452
|
+
height: "16",
|
|
1776
2453
|
fill: "none",
|
|
1777
2454
|
stroke: "currentColor",
|
|
1778
2455
|
viewBox: "0 0 24 24",
|
|
2456
|
+
style: {
|
|
2457
|
+
color: "#9ca3af"
|
|
2458
|
+
},
|
|
1779
2459
|
children: jsxRuntimeExports.jsx("path", {
|
|
1780
2460
|
strokeLinecap: "round",
|
|
1781
2461
|
strokeLinejoin: "round",
|
|
@@ -1784,22 +2464,25 @@ const Select = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
1784
2464
|
})
|
|
1785
2465
|
})
|
|
1786
2466
|
})]
|
|
1787
|
-
}), (error || helperText) && jsxRuntimeExports.jsx(
|
|
1788
|
-
|
|
2467
|
+
}), (error || helperText) && jsxRuntimeExports.jsx(HelperText, {
|
|
2468
|
+
hasError: !!error,
|
|
1789
2469
|
children: error || helperText
|
|
1790
2470
|
})]
|
|
1791
2471
|
});
|
|
1792
2472
|
});
|
|
1793
2473
|
Select.displayName = "Select";
|
|
1794
2474
|
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
2475
|
+
const ThemeProvider = _ref => {
|
|
2476
|
+
let {
|
|
2477
|
+
children
|
|
2478
|
+
} = _ref;
|
|
2479
|
+
return jsxRuntimeExports.jsx(ThemeProvider$1, {
|
|
2480
|
+
theme: theme,
|
|
2481
|
+
children: children
|
|
2482
|
+
});
|
|
1800
2483
|
};
|
|
1801
2484
|
|
|
1802
2485
|
// Ensure React is available before importing components
|
|
1803
2486
|
|
|
1804
|
-
export { Button, Checkbox, Input, InputFile, Radio, Select, Textarea,
|
|
2487
|
+
export { Button, Checkbox, Input, InputFile, Radio, Select, Textarea, ThemeProvider, theme };
|
|
1805
2488
|
//# sourceMappingURL=index.esm.js.map
|