@clickpalm/react 1.3.1 → 1.3.2

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
@@ -2313,6 +2313,7 @@ interface DatePickerInputProps {
2313
2313
  value?: string;
2314
2314
  onChange: (date: string) => void;
2315
2315
  errorMessage?: string;
2316
+ endDate?: Date;
2316
2317
  }
2317
2318
  declare const Datepicker: react.ForwardRefExoticComponent<DatePickerInputProps & react.RefAttributes<HTMLInputElement>>;
2318
2319
 
package/dist/index.js CHANGED
@@ -1430,7 +1430,8 @@ var SelectOptionsList = styled("ul", {
1430
1430
  fontFamily: theme.fonts.default,
1431
1431
  fontWeight: theme.fontWeights.regular,
1432
1432
  textAlign: "left",
1433
- width: "100%",
1433
+ width: "120px",
1434
+ overflowX: "hidden",
1434
1435
  "&::-webkit-scrollbar": {
1435
1436
  width: "8px"
1436
1437
  },
@@ -1455,6 +1456,14 @@ var SelectOptionItem = styled("li", {
1455
1456
  backgroundColor: theme.colors.gray_background,
1456
1457
  color: theme.colors.clickpalm_mid
1457
1458
  },
1459
+ '&[aria-disabled="true"]': {
1460
+ color: theme.colors.gray_mid,
1461
+ cursor: "not-allowed",
1462
+ "&:hover": {
1463
+ backgroundColor: "transparent",
1464
+ color: theme.colors.gray_mid
1465
+ }
1466
+ },
1458
1467
  variants: {
1459
1468
  selected: {
1460
1469
  true: {
@@ -1539,7 +1548,8 @@ var CustomSelect = ({
1539
1548
  SelectOptionItem,
1540
1549
  {
1541
1550
  selected: option.value === value,
1542
- onClick: () => handleOptionClick(option.value),
1551
+ onClick: () => !option.disabled && handleOptionClick(option.value),
1552
+ "aria-disabled": option.disabled,
1543
1553
  children: option.label
1544
1554
  },
1545
1555
  option.value
@@ -1563,9 +1573,14 @@ function DatePickerSelectAdapter(props) {
1563
1573
  const label = typeof option.label === "string" ? option.label.charAt(0).toUpperCase() + option.label.slice(1) : option.label;
1564
1574
  return {
1565
1575
  label,
1566
- value: option.value?.toString() ?? ""
1576
+ value: option.value?.toString() ?? "",
1577
+ disabled: option.disabled
1567
1578
  };
1568
1579
  }) || [];
1580
+ const isYearDropdown = options && options.length > 0 && typeof options[0].value === "number" && options[0].value > 31;
1581
+ if (isYearDropdown) {
1582
+ selectOptions.reverse();
1583
+ }
1569
1584
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1570
1585
  CustomSelect,
1571
1586
  {
@@ -1671,7 +1686,8 @@ var datePickerStyles = globalCss({
1671
1686
  // src/components/Datepicker/index.tsx
1672
1687
  var import_jsx_runtime22 = require("react/jsx-runtime");
1673
1688
  datePickerStyles();
1674
- var Datepicker = (0, import_react7.forwardRef)(({ label, placeholder, value, onChange, errorMessage }, ref) => {
1689
+ var oneYearMore = new Date((/* @__PURE__ */ new Date()).getFullYear() + 1, 11);
1690
+ var Datepicker = (0, import_react7.forwardRef)(({ label, placeholder, value, onChange, errorMessage, endDate = oneYearMore }, ref) => {
1675
1691
  const [selected, setSelected] = (0, import_react7.useState)(void 0);
1676
1692
  const [month, setMonth] = (0, import_react7.useState)(/* @__PURE__ */ new Date());
1677
1693
  const [open, setOpen] = (0, import_react7.useState)(false);
@@ -1739,7 +1755,7 @@ var Datepicker = (0, import_react7.forwardRef)(({ label, placeholder, value, onC
1739
1755
  showOutsideDays: true,
1740
1756
  captionLayout: "dropdown",
1741
1757
  startMonth: new Date(1915, 0),
1742
- endMonth: /* @__PURE__ */ new Date(),
1758
+ endMonth: endDate,
1743
1759
  components: {
1744
1760
  PreviousMonthButton: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "secondary", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "TriangleLeft", size: 16 }) }),
1745
1761
  NextMonthButton: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { size: "sm", variant: "secondary", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "TriangleRight", size: 16 }) }),
@@ -4171,19 +4187,24 @@ var AccordionHeader = styled(Accordion.Header, {
4171
4187
  display: "flex",
4172
4188
  alignItems: "center",
4173
4189
  justifyContent: "space-between",
4174
- padding: "0 $5"
4190
+ padding: "0 $5",
4191
+ gap: "$2"
4175
4192
  });
4176
4193
  var AccordionTrigger = styled(Accordion.Trigger, {
4177
4194
  all: "unset",
4178
- fontFamily: "$default",
4179
4195
  backgroundColor: "transparent",
4180
4196
  display: "flex",
4181
4197
  alignItems: "center",
4198
+ fontFamily: "$default",
4199
+ fontWeight: "$bold",
4182
4200
  fontSize: "$md",
4183
4201
  lineHeight: "$regular",
4202
+ textAlign: "left",
4184
4203
  color: "$black",
4185
- fontWeight: "$bold",
4186
4204
  width: "100%",
4205
+ flexWrap: "wrap",
4206
+ wordBreak: "break-word",
4207
+ whiteSpace: "normal",
4187
4208
  "&:hover": {
4188
4209
  cursor: "pointer"
4189
4210
  },
package/dist/index.mjs CHANGED
@@ -1360,7 +1360,8 @@ var SelectOptionsList = styled("ul", {
1360
1360
  fontFamily: theme.fonts.default,
1361
1361
  fontWeight: theme.fontWeights.regular,
1362
1362
  textAlign: "left",
1363
- width: "100%",
1363
+ width: "120px",
1364
+ overflowX: "hidden",
1364
1365
  "&::-webkit-scrollbar": {
1365
1366
  width: "8px"
1366
1367
  },
@@ -1385,6 +1386,14 @@ var SelectOptionItem = styled("li", {
1385
1386
  backgroundColor: theme.colors.gray_background,
1386
1387
  color: theme.colors.clickpalm_mid
1387
1388
  },
1389
+ '&[aria-disabled="true"]': {
1390
+ color: theme.colors.gray_mid,
1391
+ cursor: "not-allowed",
1392
+ "&:hover": {
1393
+ backgroundColor: "transparent",
1394
+ color: theme.colors.gray_mid
1395
+ }
1396
+ },
1388
1397
  variants: {
1389
1398
  selected: {
1390
1399
  true: {
@@ -1469,7 +1478,8 @@ var CustomSelect = ({
1469
1478
  SelectOptionItem,
1470
1479
  {
1471
1480
  selected: option.value === value,
1472
- onClick: () => handleOptionClick(option.value),
1481
+ onClick: () => !option.disabled && handleOptionClick(option.value),
1482
+ "aria-disabled": option.disabled,
1473
1483
  children: option.label
1474
1484
  },
1475
1485
  option.value
@@ -1493,9 +1503,14 @@ function DatePickerSelectAdapter(props) {
1493
1503
  const label = typeof option.label === "string" ? option.label.charAt(0).toUpperCase() + option.label.slice(1) : option.label;
1494
1504
  return {
1495
1505
  label,
1496
- value: option.value?.toString() ?? ""
1506
+ value: option.value?.toString() ?? "",
1507
+ disabled: option.disabled
1497
1508
  };
1498
1509
  }) || [];
1510
+ const isYearDropdown = options && options.length > 0 && typeof options[0].value === "number" && options[0].value > 31;
1511
+ if (isYearDropdown) {
1512
+ selectOptions.reverse();
1513
+ }
1499
1514
  return /* @__PURE__ */ jsx21(
1500
1515
  CustomSelect,
1501
1516
  {
@@ -1601,7 +1616,8 @@ var datePickerStyles = globalCss({
1601
1616
  // src/components/Datepicker/index.tsx
1602
1617
  import { jsx as jsx22, jsxs as jsxs6 } from "react/jsx-runtime";
1603
1618
  datePickerStyles();
1604
- var Datepicker = forwardRef4(({ label, placeholder, value, onChange, errorMessage }, ref) => {
1619
+ var oneYearMore = new Date((/* @__PURE__ */ new Date()).getFullYear() + 1, 11);
1620
+ var Datepicker = forwardRef4(({ label, placeholder, value, onChange, errorMessage, endDate = oneYearMore }, ref) => {
1605
1621
  const [selected, setSelected] = useState4(void 0);
1606
1622
  const [month, setMonth] = useState4(/* @__PURE__ */ new Date());
1607
1623
  const [open, setOpen] = useState4(false);
@@ -1669,7 +1685,7 @@ var Datepicker = forwardRef4(({ label, placeholder, value, onChange, errorMessag
1669
1685
  showOutsideDays: true,
1670
1686
  captionLayout: "dropdown",
1671
1687
  startMonth: new Date(1915, 0),
1672
- endMonth: /* @__PURE__ */ new Date(),
1688
+ endMonth: endDate,
1673
1689
  components: {
1674
1690
  PreviousMonthButton: (props) => /* @__PURE__ */ jsx22(Button, { size: "sm", variant: "secondary", ...props, children: /* @__PURE__ */ jsx22(Icon, { name: "TriangleLeft", size: 16 }) }),
1675
1691
  NextMonthButton: (props) => /* @__PURE__ */ jsx22(Button, { size: "sm", variant: "secondary", ...props, children: /* @__PURE__ */ jsx22(Icon, { name: "TriangleRight", size: 16 }) }),
@@ -4105,19 +4121,24 @@ var AccordionHeader = styled(Accordion.Header, {
4105
4121
  display: "flex",
4106
4122
  alignItems: "center",
4107
4123
  justifyContent: "space-between",
4108
- padding: "0 $5"
4124
+ padding: "0 $5",
4125
+ gap: "$2"
4109
4126
  });
4110
4127
  var AccordionTrigger = styled(Accordion.Trigger, {
4111
4128
  all: "unset",
4112
- fontFamily: "$default",
4113
4129
  backgroundColor: "transparent",
4114
4130
  display: "flex",
4115
4131
  alignItems: "center",
4132
+ fontFamily: "$default",
4133
+ fontWeight: "$bold",
4116
4134
  fontSize: "$md",
4117
4135
  lineHeight: "$regular",
4136
+ textAlign: "left",
4118
4137
  color: "$black",
4119
- fontWeight: "$bold",
4120
4138
  width: "100%",
4139
+ flexWrap: "wrap",
4140
+ wordBreak: "break-word",
4141
+ whiteSpace: "normal",
4121
4142
  "&:hover": {
4122
4143
  cursor: "pointer"
4123
4144
  },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Design System da Clikpalm",
4
4
  "author": "Enisson Shilo",
5
5
  "license": "MIT",
6
- "version": "1.3.1",
6
+ "version": "1.3.2",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/clickpalm/clickpalm-designsystem-lib.git"