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