@ctlyst.id/internal-ui 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1242,18 +1242,19 @@ import {
1242
1242
  FormErrorMessage as FormErrorMessage3,
1243
1243
  FormHelperText as FormHelperText3,
1244
1244
  FormLabel as FormLabel3,
1245
+ IconButton as IconButton3,
1245
1246
  InputGroup as InputGroup4,
1246
1247
  InputRightElement as InputRightElement3
1247
1248
  } from "@chakra-ui/react";
1248
1249
  import { cx as cx8 } from "@chakra-ui/shared-utils";
1250
+ import { Calendar, Close as Close4 } from "@ctlyst.id/internal-icon";
1249
1251
  import ReactDatePicker from "react-datepicker";
1250
- import { FiCalendar, FiX } from "react-icons/fi";
1251
1252
 
1252
1253
  // src/components/datepicker/components/styles.tsx
1253
1254
  import { useColorMode } from "@chakra-ui/system";
1254
1255
  import { Global } from "@emotion/react";
1255
1256
  import { jsx as jsx24 } from "react/jsx-runtime";
1256
- var Styles = () => {
1257
+ var Styles = ({ showHeader }) => {
1257
1258
  const { colorMode } = useColorMode();
1258
1259
  return /* @__PURE__ */ jsx24(
1259
1260
  Global,
@@ -1333,8 +1334,7 @@ var Styles = () => {
1333
1334
  }
1334
1335
 
1335
1336
  .react-datepicker {
1336
- font-family: "inherit", helvetica, arial, sans-serif;
1337
- font-size: 0.75;
1337
+ font-family: Poppins;
1338
1338
  background-color: ${colorMode === "light" ? "#ffffff" : "#283046"};
1339
1339
  color: ${colorMode === "light" ? "#000" : "#d0d1d2"};
1340
1340
  filter: drop-shadow(0px 3px 10px rgba(0, 0, 0, 0.08));
@@ -1394,9 +1394,9 @@ var Styles = () => {
1394
1394
 
1395
1395
  .react-datepicker__header {
1396
1396
  text-align: center;
1397
- background-color: ${colorMode === "light" ? "#ffffff" : "#131620"};
1397
+ background-color: '#ffffff';
1398
1398
  border-top-left-radius: 0.3rem;
1399
- padding: 8px 0;
1399
+ padding-top:16px;
1400
1400
  position: relative;
1401
1401
  }
1402
1402
  .react-datepicker__header--time {
@@ -1429,9 +1429,11 @@ var Styles = () => {
1429
1429
  .react-datepicker__current-month,
1430
1430
  .react-datepicker-time__header,
1431
1431
  .react-datepicker-year-header {
1432
+ display:${showHeader ? "block" : "none"};
1432
1433
  margin-top: 0;
1433
1434
  color: ${colorMode === "light" ? "#111111" : "#d0d1d2"};
1434
- font-size: 0.75;
1435
+ font-size:14px;
1436
+ font-weight:600;
1435
1437
  }
1436
1438
 
1437
1439
  .react-datepicker-time__header {
@@ -1448,7 +1450,7 @@ var Styles = () => {
1448
1450
  text-align: center;
1449
1451
  cursor: pointer;
1450
1452
  position: absolute;
1451
- top: 2px;
1453
+ top: 10px;
1452
1454
  padding: 0;
1453
1455
  border: none;
1454
1456
  z-index: 1;
@@ -1458,10 +1460,14 @@ var Styles = () => {
1458
1460
  overflow: hidden;
1459
1461
  }
1460
1462
  .react-datepicker__navigation--previous {
1461
- left: 2px;
1463
+ left: 22px;
1464
+ border:1px solid var(--chakra-colors-neutral-400);
1465
+ border-radius:4px;
1462
1466
  }
1463
1467
  .react-datepicker__navigation--next {
1464
- right: 2px;
1468
+ right: 22px;
1469
+ border:1px solid var(--chakra-colors-neutral-400);
1470
+ border-radius:4px;
1465
1471
  }
1466
1472
  .react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {
1467
1473
  right: 85px;
@@ -1494,14 +1500,14 @@ var Styles = () => {
1494
1500
  }
1495
1501
  .react-datepicker__navigation-icon--next::before {
1496
1502
  transform: rotate(45deg);
1497
- left: -7px;
1503
+ left: -4px;
1498
1504
  }
1499
1505
  .react-datepicker__navigation-icon--previous {
1500
1506
  right: -2px;
1501
1507
  }
1502
1508
  .react-datepicker__navigation-icon--previous::before {
1503
1509
  transform: rotate(225deg);
1504
- right: -7px;
1510
+ right: -4px;
1505
1511
  }
1506
1512
 
1507
1513
  .react-datepicker__month-container {
@@ -1525,7 +1531,7 @@ var Styles = () => {
1525
1531
  }
1526
1532
 
1527
1533
  .react-datepicker__month {
1528
- margin: 0.4rem;
1534
+ padding: 0 1rem 1rem 1rem;
1529
1535
  text-align: center;
1530
1536
  }
1531
1537
  .react-datepicker__month .react-datepicker__month-text,
@@ -1649,17 +1655,20 @@ var Styles = () => {
1649
1655
 
1650
1656
  .react-datepicker__day-names {
1651
1657
  margin-bottom: 0px;
1658
+ margin-top: 8px;
1652
1659
  }
1653
1660
 
1654
1661
  .react-datepicker__day-name,
1655
1662
  .react-datepicker__day,
1656
1663
  .react-datepicker__time-name {
1657
- color: ${colorMode === "light" ? "#000" : "#d0d1d2"};
1664
+ colors: #000;
1658
1665
  display: inline-block;
1659
- width: 1.7rem;
1660
- line-height: 1.7rem;
1666
+ width: 2.25rem;
1667
+ line-height: 2.25rem;
1661
1668
  text-align: center;
1662
- padding: 0.166rem;
1669
+ }
1670
+ .react-datepicker__day-name{
1671
+ color:var(--chakra-colors-black-medium)
1663
1672
  }
1664
1673
 
1665
1674
  .react-datepicker__month--selected, .react-datepicker__month--in-selecting-range, .react-datepicker__month--in-range,
@@ -1697,8 +1706,8 @@ var Styles = () => {
1697
1706
  .react-datepicker__month-text:hover,
1698
1707
  .react-datepicker__quarter-text:hover,
1699
1708
  .react-datepicker__year-text:hover {
1700
- border-radius: 0.3rem;
1701
- background-color: ${colorMode === "light" ? "#f0f0f0" : "#131620"};
1709
+ border-radius: 2rem;
1710
+ background-color: var(--chakra-colors-neutral-200);
1702
1711
  }
1703
1712
  .react-datepicker__day--highlighted,
1704
1713
  .react-datepicker__month-text--highlighted,
@@ -1736,8 +1745,8 @@ var Styles = () => {
1736
1745
  .react-datepicker__year-text--selected,
1737
1746
  .react-datepicker__year-text--in-selecting-range,
1738
1747
  .react-datepicker__year-text--in-range {
1739
- border-radius: 0.3rem;
1740
- background-color: ${colorMode === "light" ? "#12784A" : "#131620"};
1748
+ border-radius: var(--chakra-radii-2xl);
1749
+ background-color: var(--chakra-colors-primary-500);
1741
1750
  color: #fff;
1742
1751
  }
1743
1752
  .react-datepicker__day--selected:hover, .react-datepicker__day--in-selecting-range:hover, .react-datepicker__day--in-range:hover,
@@ -1750,13 +1759,13 @@ var Styles = () => {
1750
1759
  .react-datepicker__year-text--selected:hover,
1751
1760
  .react-datepicker__year-text--in-selecting-range:hover,
1752
1761
  .react-datepicker__year-text--in-range:hover {
1753
- background-color: ${colorMode === "light" ? "#075331" : "#131620"};
1762
+ background-color: var(--chakra-colors-primary-500);
1754
1763
  }
1755
1764
  .react-datepicker__day--keyboard-selected,
1756
1765
  .react-datepicker__month-text--keyboard-selected,
1757
1766
  .react-datepicker__quarter-text--keyboard-selected,
1758
1767
  .react-datepicker__year-text--keyboard-selected {
1759
- border-radius: 0.3rem;
1768
+ border-radius: 2rem;
1760
1769
  background-color: ${colorMode === "light" ? "#075331" : "#131620"};
1761
1770
  color: #fff;
1762
1771
  }
@@ -1782,7 +1791,7 @@ var Styles = () => {
1782
1791
  .react-datepicker__month-text--in-range,
1783
1792
  .react-datepicker__quarter-text--in-range,
1784
1793
  .react-datepicker__year-text--in-range) {
1785
- background-color: rgba(18, 120, 74, 0.1);
1794
+ background-color: var(--chakra-colors-primary-50);
1786
1795
  color: ${colorMode === "light" ? "#000" : "#d0d1d2"};
1787
1796
  }
1788
1797
  .react-datepicker__month--selecting-range .react-datepicker__day--in-range:not(.react-datepicker__day--in-selecting-range,
@@ -1868,7 +1877,7 @@ var Styles = () => {
1868
1877
 
1869
1878
  }
1870
1879
  .react-datepicker__header:not(.react-datepicker__header--has-time-select) {
1871
- background: ${colorMode === "light" ? "#F5F5F5" : "inherit"} ;
1880
+ background:var(--chakra-colors-neutral-50);
1872
1881
 
1873
1882
  border-top-left-radius: 8px;
1874
1883
  border-top-right-radius: 8px;
@@ -2022,12 +2031,12 @@ var Styles = () => {
2022
2031
  }
2023
2032
  .react-datepicker__day.react-datepicker__day--in-range {
2024
2033
  border-radius: 0;
2025
- background: rgba(18, 120, 74, 0.1);
2026
- color: #12784A;
2034
+ background: var(--chakra-colors-primary-50);
2035
+ color: #111111;
2027
2036
  }
2028
2037
  .react-datepicker__day.react-datepicker__day--range-start.react-datepicker__day--in-range,
2029
2038
  .react-datepicker__day.react-datepicker__day--range-end.react-datepicker__day--in-range {
2030
- background: #12784A;
2039
+ background: var(--chakra-colors-primary-500);
2031
2040
  color: #fff;
2032
2041
  }
2033
2042
  .react-datepicker__day.react-datepicker__day--range-start.react-datepicker__day--in-range {
@@ -2047,18 +2056,45 @@ var Styles = () => {
2047
2056
  background-color: inherit;
2048
2057
  }
2049
2058
  .react-datepicker__day--keyboard-selected, .react-datepicker__day--keyboard-selected:hover {
2050
- background-color: inherit;
2059
+ background-color: var(--chakra-colors-primary-50);
2051
2060
  color: inherit;
2052
2061
  }
2053
2062
  .react-datepicker__day--today, .react-datepicker__day--today:hover {
2054
- color: #D82F23;
2063
+ border-radius: 2rem;
2064
+ border-color: var(--chakra-colors-primary-500);
2065
+ border-width: 1px;
2066
+ line-height: 34px;
2055
2067
  }
2056
- .react-datepicker__day--today:hover {
2057
- background: #f0f0f0;
2068
+ .react-datepicker__day--today:hover:not(.react-datepicker__day--in-range) {
2069
+ background: var(--chakra-colors-neutral-200);
2070
+ border-color:transparent;
2071
+ color:var(--chakra-colors-black-high);
2058
2072
  }
2059
2073
  .react-datepicker__day--selected.react-datepicker__day--today {
2060
2074
  color: white;
2061
- background: #12784A;
2075
+ background: var(--chakra-colors-primary-500);
2076
+ }
2077
+ .react-datepicker__aria-live {
2078
+ position: absolute;
2079
+ clip-path: circle(0);
2080
+ border: 0;
2081
+ height: 1px;
2082
+ margin: -1px;
2083
+ overflow: hidden;
2084
+ padding: 0;
2085
+ width: 1px;
2086
+ white-space: nowrap;
2087
+ }
2088
+ .react-datepicker__day.react-datepicker__day--in-range.react-datepicker__day--today{
2089
+ border-radius:0px;
2090
+ border-color:transparent;
2091
+ background-color:var(--chakra-colors-primary-50);
2092
+ }
2093
+ .react-datepicker__month-select,.react-datepicker__year-select {
2094
+ background-color:transparent;
2095
+ font-size:14px;
2096
+ font-weight:600;
2097
+ text-align:center;
2062
2098
  }
2063
2099
  `
2064
2100
  }
@@ -2077,10 +2113,25 @@ var TimeInput = ({ value, onChange, label, rightAddon }) => {
2077
2113
  setTime(((_a = e.target) == null ? void 0 : _a.value) || "00:00");
2078
2114
  if (onChange) onChange(((_b = e.target) == null ? void 0 : _b.value) || "00:00");
2079
2115
  };
2080
- return /* @__PURE__ */ jsxs10(Flex2, { flexDir: "column", alignItems: "center", justifyContent: "center", p: 4, pt: 0, children: [
2116
+ return /* @__PURE__ */ jsxs10(Flex2, { flexDir: "column", p: 4, pt: 0, children: [
2081
2117
  /* @__PURE__ */ jsx25(Text5, { mb: 2, children: label }),
2082
- /* @__PURE__ */ jsxs10(InputGroup3, { alignItems: "center", justifyContent: "center", children: [
2083
- /* @__PURE__ */ jsx25(Input, { onChange: handleChange, type: "time", value: time, "data-test-id": "CT_Component_datepicker_input_time" }),
2118
+ /* @__PURE__ */ jsxs10(InputGroup3, { alignItems: "center", borderColor: "neutral.400", children: [
2119
+ /* @__PURE__ */ jsx25(
2120
+ Input,
2121
+ {
2122
+ onChange: handleChange,
2123
+ type: "time",
2124
+ value: time,
2125
+ "data-test-id": "CT_Component_datepicker_input_time",
2126
+ flex: 1,
2127
+ borderRadius: "sm",
2128
+ border: "1px solid",
2129
+ borderColor: "inherit",
2130
+ _focusWithin: {
2131
+ borderColor: "primary.500"
2132
+ }
2133
+ }
2134
+ ),
2084
2135
  rightAddon && /* @__PURE__ */ jsx25(InputRightAddon3, { children: rightAddon })
2085
2136
  ] })
2086
2137
  ] });
@@ -2111,9 +2162,9 @@ var Datepicker = ({
2111
2162
  shortMonth,
2112
2163
  ...props
2113
2164
  }) => {
2114
- var _a;
2165
+ var _a, _b;
2115
2166
  const selected = value ? new Date(value) : void 0;
2116
- const dateFormat = ((_a = props.dateFormat) != null ? _a : withTime) ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd";
2167
+ const dateFormat = ((_a = props.dateFormat) != null ? _a : withTime) ? "dd MMMM yyyy, HH:mm" : "dd MMMM yyyy";
2117
2168
  const getTimeProps = () => {
2118
2169
  if (!withTime) return {};
2119
2170
  return {
@@ -2122,8 +2173,9 @@ var Datepicker = ({
2122
2173
  customTimeInput: /* @__PURE__ */ jsx26(time_input_default, {})
2123
2174
  };
2124
2175
  };
2176
+ const hasMultipleMonthShow = ((_b = props == null ? void 0 : props.monthsShown) != null ? _b : 1) < 2;
2125
2177
  const component = /* @__PURE__ */ jsxs11(Fragment, { children: [
2126
- /* @__PURE__ */ jsx26(styles_default, {}),
2178
+ /* @__PURE__ */ jsx26(styles_default, { showHeader: !hasMultipleMonthShow }),
2127
2179
  /* @__PURE__ */ jsx26(
2128
2180
  ReactDatePicker,
2129
2181
  {
@@ -2131,11 +2183,14 @@ var Datepicker = ({
2131
2183
  name,
2132
2184
  selected,
2133
2185
  customInput: /* @__PURE__ */ jsx26(input_field_default, { autoComplete: "off" }),
2134
- dateFormat,
2135
2186
  showPopperArrow: false,
2136
2187
  calendarClassName: cx8({ inline: props.inline }),
2137
- showMonthDropdown: showMonth,
2188
+ dropdownMode: "select",
2189
+ showMonthDropdown: hasMultipleMonthShow,
2190
+ showYearDropdown: hasMultipleMonthShow,
2191
+ shouldCloseOnSelect: !(props.selectsRange || withTime),
2138
2192
  useShortMonthInDropdown: showMonth ? shortMonth : false,
2193
+ dateFormat,
2139
2194
  ...getTimeProps(),
2140
2195
  ...props
2141
2196
  }
@@ -2148,9 +2203,23 @@ var Datepicker = ({
2148
2203
  label && /* @__PURE__ */ jsx26(FormLabel3, { fontSize: "text.sm", children: label }),
2149
2204
  /* @__PURE__ */ jsxs11(InputGroup4, { children: [
2150
2205
  component,
2151
- /* @__PURE__ */ jsxs11(InputRightElement3, { children: [
2152
- !value && /* @__PURE__ */ jsx26(FiCalendar, {}),
2153
- value && /* @__PURE__ */ jsx26(FiX, { "data-test-id": "bcpJJyCP0z_RIAGZXDU6s", onClick: onClear, cursor: "pointer" })
2206
+ /* @__PURE__ */ jsxs11(InputRightElement3, { alignSelf: "center", bottom: 0, flexDir: "row-reverse", width: "auto", mr: 2, gap: 2, children: [
2207
+ /* @__PURE__ */ jsx26(Calendar, { size: 4, color: "neutral.400" }),
2208
+ value && /* @__PURE__ */ jsx26(
2209
+ IconButton3,
2210
+ {
2211
+ "data-test-id": "H0rseVCzGIaqoLho-EPbu",
2212
+ display: "flex",
2213
+ alignItems: "center",
2214
+ variant: "unstyled",
2215
+ "aria-label": "Remove",
2216
+ onClick: onClear,
2217
+ cursor: "pointer",
2218
+ size: "sm",
2219
+ minW: "unset",
2220
+ icon: /* @__PURE__ */ jsx26(Close4, { size: 4, color: "neutral.600" })
2221
+ }
2222
+ )
2154
2223
  ] })
2155
2224
  ] }),
2156
2225
  !isError ? /* @__PURE__ */ jsx26(FormHelperText3, { fontSize: "text.xs", mt: 1, children: helperText }) : /* @__PURE__ */ jsx26(FormErrorMessage3, { fontSize: "text.xs", mt: 1, children: error })
@@ -2708,11 +2777,11 @@ import { List, ListIcon, ListItem, ListItemProps, ListProps, OrderedList, Unorde
2708
2777
 
2709
2778
  // src/components/modal/components/modal-back-button.tsx
2710
2779
  import { ChevronLeftIcon } from "@chakra-ui/icons";
2711
- import { IconButton as IconButton3 } from "@chakra-ui/react";
2780
+ import { IconButton as IconButton4 } from "@chakra-ui/react";
2712
2781
  import { jsx as jsx37 } from "react/jsx-runtime";
2713
2782
  var ModalBackButton = ({ onClick }) => {
2714
2783
  return /* @__PURE__ */ jsx37(
2715
- IconButton3,
2784
+ IconButton4,
2716
2785
  {
2717
2786
  icon: /* @__PURE__ */ jsx37(ChevronLeftIcon, { w: "4.5", h: "4.5" }),
2718
2787
  size: "sm",
@@ -11111,7 +11180,7 @@ SidebarMenu.defaultProps = {
11111
11180
  // src/components/switch/components/switch.tsx
11112
11181
  import { chakra as chakra6, Flex as Flex12, forwardRef as forwardRef14, omitThemingProps as omitThemingProps2, useCheckbox as useCheckbox2, useMultiStyleConfig as useMultiStyleConfig2 } from "@chakra-ui/react";
11113
11182
  import { cx as cx10, dataAttr } from "@chakra-ui/shared-utils";
11114
- import { Check, Close as Close4 } from "@ctlyst.id/internal-icon";
11183
+ import { Check, Close as Close5 } from "@ctlyst.id/internal-icon";
11115
11184
  import { useMemo as useMemo8 } from "react";
11116
11185
  import { jsx as jsx62, jsxs as jsxs27 } from "react/jsx-runtime";
11117
11186
  var Switch = forwardRef14(function Switch2(props, ref) {
@@ -11169,7 +11238,7 @@ var Switch = forwardRef14(function Switch2(props, ref) {
11169
11238
  /* @__PURE__ */ jsxs27(chakra6.span, { ...getCheckboxProps(), className: "chakra-switch__track", pos: "relative", __css: trackStyles, children: [
11170
11239
  /* @__PURE__ */ jsxs27(Flex12, { gap: 2, pos: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)", children: [
11171
11240
  /* @__PURE__ */ jsx62(Check, { color: "white", size: getIconSize(props.size) }),
11172
- /* @__PURE__ */ jsx62(Close4, { color: state.isDisabled ? "neutral.600" : "neutral.900", size: getIconSize(props.size) })
11241
+ /* @__PURE__ */ jsx62(Close5, { color: state.isDisabled ? "neutral.600" : "neutral.900", size: getIconSize(props.size) })
11173
11242
  ] }),
11174
11243
  /* @__PURE__ */ jsx62(
11175
11244
  chakra6.span,