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