thailife-react 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,5 @@
1
1
  import "./styles/globals.css";
2
2
  export { Button } from "./components/Button/Button";
3
3
  export type { ButtonProps } from "./components/Button/Button";
4
- export { Input } from "./components/Input/Input";
5
- export type { InputProps } from "./components/Input/Input";
6
- export { Textarea } from "./components/Textarea/Textarea";
7
- export type { TextareaProps } from "./components/Textarea/Textarea";
8
- export { InputFile } from "./components/InputFile/InputFile";
9
- export type { InputFileProps } from "./components/InputFile/InputFile";
10
- export { Checkbox } from "./components/Checkbox/Checkbox";
11
- export type { CheckboxProps } from "./components/Checkbox/Checkbox";
12
- export { Radio } from "./components/Radio/Radio";
13
- export type { RadioProps } from "./components/Radio/Radio";
14
- export { Select } from "./components/Select/Select";
15
- export type { SelectProps, SelectOption } from "./components/Select/Select";
16
4
  export { cn } from "./utils/cn";
17
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAkB5E,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAqB9D,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import require$$0 from 'react';
2
2
 
3
3
  function styleInject(css, ref) {
4
4
  if ( ref === void 0 ) ref = {};
@@ -113,7 +113,7 @@ var hasRequiredReactJsxRuntime_production_min;
113
113
  function requireReactJsxRuntime_production_min () {
114
114
  if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
115
115
  hasRequiredReactJsxRuntime_production_min = 1;
116
- var f=React,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
116
+ var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
117
117
  function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
118
118
  return reactJsxRuntime_production_min;
119
119
  }
@@ -139,7 +139,7 @@ function requireReactJsxRuntime_development () {
139
139
  if (process.env.NODE_ENV !== "production") {
140
140
  (function() {
141
141
 
142
- var React$1 = React;
142
+ var React = require$$0;
143
143
 
144
144
  // ATTENTION
145
145
  // When adding new symbols to this file,
@@ -174,7 +174,7 @@ function requireReactJsxRuntime_development () {
174
174
  return null;
175
175
  }
176
176
 
177
- var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
177
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
178
178
 
179
179
  function error(format) {
180
180
  {
@@ -1462,8 +1462,8 @@ function cn() {
1462
1462
  return clsx(inputs);
1463
1463
  }
1464
1464
 
1465
- const _excluded$6 = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
1466
- const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1465
+ const _excluded = ["className", "color", "variant", "size", "fullWidth", "loading", "disabled", "children"];
1466
+ const Button = /*#__PURE__*/require$$0.forwardRef((_ref, ref) => {
1467
1467
  let {
1468
1468
  className,
1469
1469
  color = "primary",
@@ -1474,7 +1474,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1474
1474
  disabled,
1475
1475
  children
1476
1476
  } = _ref,
1477
- props = _objectWithoutProperties(_ref, _excluded$6);
1477
+ props = _objectWithoutProperties(_ref, _excluded);
1478
1478
  const baseClasses = cn(className, "btn transition-all duration-300 flex items-center justify-center");
1479
1479
  const variants = {
1480
1480
  contained: {
@@ -1511,308 +1511,5 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1511
1511
  });
1512
1512
  Button.displayName = "Button";
1513
1513
 
1514
- const _excluded$5 = ["className", "type", "label", "error", "helperText", "size", "fullWidth", "id"];
1515
- const Input = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1516
- let {
1517
- className,
1518
- type = "text",
1519
- label,
1520
- error,
1521
- helperText,
1522
- size = "md",
1523
- fullWidth = false,
1524
- id
1525
- } = _ref,
1526
- props = _objectWithoutProperties(_ref, _excluded$5);
1527
- const inputId = id || "input-".concat(Math.random().toString(36).substr(2, 9));
1528
- const sizes = {
1529
- sm: "px-3 py-1.5 text-sm",
1530
- md: "px-4 py-2 text-sm",
1531
- lg: "px-4 py-3 text-base"
1532
- };
1533
- 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);
1534
- return jsxRuntimeExports.jsxs("div", {
1535
- className: cn("flex flex-col", fullWidth && "w-full"),
1536
- children: [label && jsxRuntimeExports.jsx("label", {
1537
- htmlFor: inputId,
1538
- className: "mb-1 text-sm font-medium text-secondary-700",
1539
- children: label
1540
- }), jsxRuntimeExports.jsx("input", _objectSpread2({
1541
- type: type,
1542
- className: baseClasses,
1543
- ref: ref,
1544
- id: inputId
1545
- }, props)), (error || helperText) && jsxRuntimeExports.jsx("p", {
1546
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1547
- children: error || helperText
1548
- })]
1549
- });
1550
- });
1551
- Input.displayName = "Input";
1552
-
1553
- const _excluded$4 = ["className", "label", "error", "helperText", "size", "fullWidth", "rows", "id"];
1554
- const Textarea = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1555
- let {
1556
- className,
1557
- label,
1558
- error,
1559
- helperText,
1560
- size = "md",
1561
- fullWidth = false,
1562
- rows = 3,
1563
- id
1564
- } = _ref,
1565
- props = _objectWithoutProperties(_ref, _excluded$4);
1566
- const textareaId = id || "textarea-".concat(Math.random().toString(36).substr(2, 9));
1567
- const sizes = {
1568
- sm: "px-3 py-1.5 text-sm",
1569
- md: "px-4 py-2 text-sm",
1570
- lg: "px-4 py-3 text-base"
1571
- };
1572
- 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);
1573
- return jsxRuntimeExports.jsxs("div", {
1574
- className: cn("flex flex-col", fullWidth && "w-full"),
1575
- children: [label && jsxRuntimeExports.jsx("label", {
1576
- htmlFor: textareaId,
1577
- className: "mb-1 text-sm font-medium text-secondary-700",
1578
- children: label
1579
- }), jsxRuntimeExports.jsx("textarea", _objectSpread2({
1580
- className: baseClasses,
1581
- ref: ref,
1582
- id: textareaId,
1583
- rows: rows
1584
- }, props)), (error || helperText) && jsxRuntimeExports.jsx("p", {
1585
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1586
- children: error || helperText
1587
- })]
1588
- });
1589
- });
1590
- Textarea.displayName = "Textarea";
1591
-
1592
- const _excluded$3 = ["className", "label", "error", "helperText", "size", "fullWidth", "accept", "multiple", "buttonText", "id"];
1593
- const InputFile = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1594
- let {
1595
- className,
1596
- label,
1597
- error,
1598
- helperText,
1599
- size = "md",
1600
- fullWidth = false,
1601
- accept,
1602
- multiple = false,
1603
- buttonText = "Choose File",
1604
- id
1605
- } = _ref,
1606
- props = _objectWithoutProperties(_ref, _excluded$3);
1607
- const inputId = id || "file-input-".concat(Math.random().toString(36).substr(2, 9));
1608
- const sizes = {
1609
- sm: "px-3 py-1.5 text-sm",
1610
- md: "px-4 py-2 text-sm",
1611
- lg: "px-4 py-3 text-base"
1612
- };
1613
- 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);
1614
- return jsxRuntimeExports.jsxs("div", {
1615
- className: cn("flex flex-col", fullWidth && "w-full"),
1616
- children: [label && jsxRuntimeExports.jsx("label", {
1617
- htmlFor: inputId,
1618
- className: "mb-1 text-sm font-medium text-secondary-700",
1619
- children: label
1620
- }), jsxRuntimeExports.jsxs("div", {
1621
- className: "relative",
1622
- children: [jsxRuntimeExports.jsx("input", _objectSpread2({
1623
- type: "file",
1624
- className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer",
1625
- ref: ref,
1626
- id: inputId,
1627
- accept: accept,
1628
- multiple: multiple
1629
- }, props)), jsxRuntimeExports.jsxs("div", {
1630
- className: cn(baseClasses, "flex items-center justify-center"),
1631
- children: [jsxRuntimeExports.jsx("span", {
1632
- className: "text-secondary-600",
1633
- children: buttonText
1634
- }), multiple && jsxRuntimeExports.jsx("span", {
1635
- className: "ml-1 text-xs text-secondary-500",
1636
- children: "(Multiple)"
1637
- })]
1638
- })]
1639
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1640
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1641
- children: error || helperText
1642
- })]
1643
- });
1644
- });
1645
- InputFile.displayName = "InputFile";
1646
-
1647
- const _excluded$2 = ["className", "label", "error", "helperText", "size", "fullWidth", "indeterminate", "id"];
1648
- const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1649
- let {
1650
- className,
1651
- label,
1652
- error,
1653
- helperText,
1654
- size = "md",
1655
- fullWidth = false,
1656
- indeterminate = false,
1657
- id
1658
- } = _ref,
1659
- props = _objectWithoutProperties(_ref, _excluded$2);
1660
- const checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
1661
- const sizes = {
1662
- sm: "w-4 h-4",
1663
- md: "w-5 h-5",
1664
- lg: "w-6 h-6"
1665
- };
1666
- const labelSizes = {
1667
- sm: "text-sm",
1668
- md: "text-sm",
1669
- lg: "text-base"
1670
- };
1671
- 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);
1672
- React.useEffect(() => {
1673
- if (ref && typeof ref === "object" && ref.current) {
1674
- ref.current.indeterminate = indeterminate;
1675
- }
1676
- }, [indeterminate, ref]);
1677
- return jsxRuntimeExports.jsxs("div", {
1678
- className: cn("flex items-start", fullWidth && "w-full"),
1679
- children: [jsxRuntimeExports.jsx("div", {
1680
- className: "flex items-center h-5",
1681
- children: jsxRuntimeExports.jsx("input", _objectSpread2({
1682
- type: "checkbox",
1683
- className: baseClasses,
1684
- ref: ref,
1685
- id: checkboxId
1686
- }, props))
1687
- }), jsxRuntimeExports.jsxs("div", {
1688
- className: "ml-3",
1689
- children: [label && jsxRuntimeExports.jsx("label", {
1690
- htmlFor: checkboxId,
1691
- className: cn("font-medium text-secondary-700 cursor-pointer", labelSizes[size]),
1692
- children: label
1693
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1694
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1695
- children: error || helperText
1696
- })]
1697
- })]
1698
- });
1699
- });
1700
- Checkbox.displayName = "Checkbox";
1701
-
1702
- const _excluded$1 = ["className", "label", "error", "helperText", "size", "fullWidth", "id"];
1703
- const Radio = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1704
- let {
1705
- className,
1706
- label,
1707
- error,
1708
- helperText,
1709
- size = "md",
1710
- fullWidth = false,
1711
- id
1712
- } = _ref,
1713
- props = _objectWithoutProperties(_ref, _excluded$1);
1714
- const radioId = id || "radio-".concat(Math.random().toString(36).substr(2, 9));
1715
- const sizes = {
1716
- sm: "w-4 h-4",
1717
- md: "w-5 h-5",
1718
- lg: "w-6 h-6"
1719
- };
1720
- const labelSizes = {
1721
- sm: "text-sm",
1722
- md: "text-sm",
1723
- lg: "text-base"
1724
- };
1725
- 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);
1726
- return jsxRuntimeExports.jsxs("div", {
1727
- className: cn("flex items-start", fullWidth && "w-full"),
1728
- children: [jsxRuntimeExports.jsx("div", {
1729
- className: "flex items-center h-5",
1730
- children: jsxRuntimeExports.jsx("input", _objectSpread2({
1731
- type: "radio",
1732
- className: baseClasses,
1733
- ref: ref,
1734
- id: radioId
1735
- }, props))
1736
- }), jsxRuntimeExports.jsxs("div", {
1737
- className: "ml-3",
1738
- children: [label && jsxRuntimeExports.jsx("label", {
1739
- htmlFor: radioId,
1740
- className: cn("font-medium text-secondary-700 cursor-pointer", labelSizes[size]),
1741
- children: label
1742
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1743
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1744
- children: error || helperText
1745
- })]
1746
- })]
1747
- });
1748
- });
1749
- Radio.displayName = "Radio";
1750
-
1751
- const _excluded = ["className", "label", "error", "helperText", "size", "fullWidth", "options", "placeholder", "id"];
1752
- const Select = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1753
- let {
1754
- className,
1755
- label,
1756
- error,
1757
- helperText,
1758
- size = "md",
1759
- fullWidth = false,
1760
- options,
1761
- placeholder,
1762
- id
1763
- } = _ref,
1764
- props = _objectWithoutProperties(_ref, _excluded);
1765
- const selectId = id || "select-".concat(Math.random().toString(36).substr(2, 9));
1766
- const sizes = {
1767
- sm: "px-3 py-1.5 text-sm",
1768
- md: "px-4 py-2 text-sm",
1769
- lg: "px-4 py-3 text-base"
1770
- };
1771
- 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);
1772
- return jsxRuntimeExports.jsxs("div", {
1773
- className: cn("flex flex-col", fullWidth && "w-full"),
1774
- children: [label && jsxRuntimeExports.jsx("label", {
1775
- htmlFor: selectId,
1776
- className: "mb-1 text-sm font-medium text-secondary-700",
1777
- children: label
1778
- }), jsxRuntimeExports.jsxs("div", {
1779
- className: "relative",
1780
- children: [jsxRuntimeExports.jsxs("select", _objectSpread2(_objectSpread2({
1781
- className: baseClasses,
1782
- ref: ref,
1783
- id: selectId
1784
- }, props), {}, {
1785
- children: [placeholder && jsxRuntimeExports.jsx("option", {
1786
- value: "",
1787
- disabled: true,
1788
- children: placeholder
1789
- }), options.map(option => jsxRuntimeExports.jsx("option", {
1790
- value: option.value,
1791
- disabled: option.disabled,
1792
- children: option.label
1793
- }, option.value))]
1794
- })), jsxRuntimeExports.jsx("div", {
1795
- className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",
1796
- children: jsxRuntimeExports.jsx("svg", {
1797
- className: "w-4 h-4 text-secondary-400",
1798
- fill: "none",
1799
- stroke: "currentColor",
1800
- viewBox: "0 0 24 24",
1801
- children: jsxRuntimeExports.jsx("path", {
1802
- strokeLinecap: "round",
1803
- strokeLinejoin: "round",
1804
- strokeWidth: 2,
1805
- d: "M19 9l-7 7-7-7"
1806
- })
1807
- })
1808
- })]
1809
- }), (error || helperText) && jsxRuntimeExports.jsx("p", {
1810
- className: cn("mt-1 text-xs", error ? "text-red-600" : "text-secondary-500"),
1811
- children: error || helperText
1812
- })]
1813
- });
1814
- });
1815
- Select.displayName = "Select";
1816
-
1817
- export { Button, Checkbox, Input, InputFile, Radio, Select, Textarea, cn };
1514
+ export { Button, cn };
1818
1515
  //# sourceMappingURL=index.esm.js.map