@clickpalm/react 1.3.0 → 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
 
@@ -3058,6 +3059,7 @@ interface TextAreaProps extends ComponentPropsWithoutRef<'textarea'>, VariantPro
3058
3059
  htmlFor?: string;
3059
3060
  errorMessage?: string;
3060
3061
  maxLength?: number;
3062
+ showCounter?: boolean;
3061
3063
  }
3062
3064
  declare const TextArea: react.ForwardRefExoticComponent<TextAreaProps & react.RefAttributes<HTMLTextAreaElement>>;
3063
3065
 
@@ -3088,6 +3090,7 @@ interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
3088
3090
  noMargin?: boolean;
3089
3091
  errorMessage?: string;
3090
3092
  maxLength?: number;
3093
+ showCounter?: boolean;
3091
3094
  }
3092
3095
  declare const Input: react__default.ForwardRefExoticComponent<TextInputProps & react__default.RefAttributes<HTMLInputElement>>;
3093
3096
 
package/dist/index.js CHANGED
@@ -1312,7 +1312,7 @@ var CharCounter = styled(Span2, {
1312
1312
  whiteSpace: "nowrap",
1313
1313
  paddingRight: "1px",
1314
1314
  marginTop: "2px",
1315
- marginBottom: "$6",
1315
+ marginBottom: "0px",
1316
1316
  variants: {
1317
1317
  hasReachedMax: {
1318
1318
  true: {
@@ -1325,7 +1325,7 @@ var CharCounter = styled(Span2, {
1325
1325
  // src/components/Input/index.tsx
1326
1326
  var import_jsx_runtime19 = require("react/jsx-runtime");
1327
1327
  var Input2 = (0, import_react5.forwardRef)(
1328
- ({ prefix, suffix, label, maxLength, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1328
+ ({ prefix, suffix, label, maxLength, showCounter = false, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1329
1329
  const [charCount, setCharCount] = (0, import_react5.useState)(0);
1330
1330
  const localInputRef = (0, import_react5.useRef)(null);
1331
1331
  const inputRef = forwardedRef || localInputRef;
@@ -1346,7 +1346,7 @@ var Input2 = (0, import_react5.forwardRef)(
1346
1346
  hasButtonSuffix: isButtonElement(suffix),
1347
1347
  noMargin,
1348
1348
  hasError: !!errorMessage,
1349
- hasCounter: !!maxLength,
1349
+ hasCounter: showCounter,
1350
1350
  onClick: handleContainerClick,
1351
1351
  children: [
1352
1352
  !!prefix && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Prefix, { children: prefix }),
@@ -1370,7 +1370,7 @@ var Input2 = (0, import_react5.forwardRef)(
1370
1370
  ),
1371
1371
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Footer, { children: [
1372
1372
  errorMessage && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Span2, { children: errorMessage }),
1373
- maxLength && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(CharCounter, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
1373
+ showCounter && maxLength && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(CharCounter, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
1374
1374
  charCount,
1375
1375
  "/",
1376
1376
  maxLength
@@ -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 }) }),
@@ -2502,7 +2518,7 @@ var CharCounter2 = styled(Span5, {
2502
2518
  whiteSpace: "nowrap",
2503
2519
  paddingRight: "1px",
2504
2520
  marginTop: "2px",
2505
- marginBottom: "$6",
2521
+ marginBottom: "0px",
2506
2522
  variants: {
2507
2523
  hasReachedMax: {
2508
2524
  true: {
@@ -2512,7 +2528,7 @@ var CharCounter2 = styled(Span5, {
2512
2528
  }
2513
2529
  });
2514
2530
  var TextArea = (0, import_react13.forwardRef)(
2515
- ({ label, id, htmlFor, errorMessage, maxLength, ...props }, ref) => {
2531
+ ({ label, id, htmlFor, errorMessage, maxLength, showCounter = false, ...props }, ref) => {
2516
2532
  const textAreaId = id || htmlFor || `textarea-${crypto.randomUUID()}`;
2517
2533
  const [charCount, setCharCount] = (0, import_react13.useState)(0);
2518
2534
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Wrapper4, { children: [
@@ -2523,7 +2539,7 @@ var TextArea = (0, import_react13.forwardRef)(
2523
2539
  id: textAreaId,
2524
2540
  ...props,
2525
2541
  hasError: !!errorMessage,
2526
- hasCounter: !!maxLength,
2542
+ hasCounter: showCounter,
2527
2543
  ref,
2528
2544
  maxLength,
2529
2545
  onChange: (e) => {
@@ -2536,7 +2552,7 @@ var TextArea = (0, import_react13.forwardRef)(
2536
2552
  ),
2537
2553
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Footer2, { children: [
2538
2554
  errorMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Span5, { children: errorMessage }),
2539
- maxLength && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(CharCounter2, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
2555
+ showCounter && maxLength && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(CharCounter2, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
2540
2556
  charCount,
2541
2557
  "/",
2542
2558
  maxLength
@@ -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
@@ -1242,7 +1242,7 @@ var CharCounter = styled(Span2, {
1242
1242
  whiteSpace: "nowrap",
1243
1243
  paddingRight: "1px",
1244
1244
  marginTop: "2px",
1245
- marginBottom: "$6",
1245
+ marginBottom: "0px",
1246
1246
  variants: {
1247
1247
  hasReachedMax: {
1248
1248
  true: {
@@ -1255,7 +1255,7 @@ var CharCounter = styled(Span2, {
1255
1255
  // src/components/Input/index.tsx
1256
1256
  import { jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
1257
1257
  var Input2 = forwardRef3(
1258
- ({ prefix, suffix, label, maxLength, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1258
+ ({ prefix, suffix, label, maxLength, showCounter = false, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1259
1259
  const [charCount, setCharCount] = useState2(0);
1260
1260
  const localInputRef = useRef2(null);
1261
1261
  const inputRef = forwardedRef || localInputRef;
@@ -1276,7 +1276,7 @@ var Input2 = forwardRef3(
1276
1276
  hasButtonSuffix: isButtonElement(suffix),
1277
1277
  noMargin,
1278
1278
  hasError: !!errorMessage,
1279
- hasCounter: !!maxLength,
1279
+ hasCounter: showCounter,
1280
1280
  onClick: handleContainerClick,
1281
1281
  children: [
1282
1282
  !!prefix && /* @__PURE__ */ jsx19(Prefix, { children: prefix }),
@@ -1300,7 +1300,7 @@ var Input2 = forwardRef3(
1300
1300
  ),
1301
1301
  /* @__PURE__ */ jsxs4(Footer, { children: [
1302
1302
  errorMessage && /* @__PURE__ */ jsx19(Span2, { children: errorMessage }),
1303
- maxLength && /* @__PURE__ */ jsxs4(CharCounter, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
1303
+ showCounter && maxLength && /* @__PURE__ */ jsxs4(CharCounter, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
1304
1304
  charCount,
1305
1305
  "/",
1306
1306
  maxLength
@@ -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 }) }),
@@ -2432,7 +2448,7 @@ var CharCounter2 = styled(Span5, {
2432
2448
  whiteSpace: "nowrap",
2433
2449
  paddingRight: "1px",
2434
2450
  marginTop: "2px",
2435
- marginBottom: "$6",
2451
+ marginBottom: "0px",
2436
2452
  variants: {
2437
2453
  hasReachedMax: {
2438
2454
  true: {
@@ -2442,7 +2458,7 @@ var CharCounter2 = styled(Span5, {
2442
2458
  }
2443
2459
  });
2444
2460
  var TextArea = forwardRef8(
2445
- ({ label, id, htmlFor, errorMessage, maxLength, ...props }, ref) => {
2461
+ ({ label, id, htmlFor, errorMessage, maxLength, showCounter = false, ...props }, ref) => {
2446
2462
  const textAreaId = id || htmlFor || `textarea-${crypto.randomUUID()}`;
2447
2463
  const [charCount, setCharCount] = useState7(0);
2448
2464
  return /* @__PURE__ */ jsxs12(Wrapper4, { children: [
@@ -2453,7 +2469,7 @@ var TextArea = forwardRef8(
2453
2469
  id: textAreaId,
2454
2470
  ...props,
2455
2471
  hasError: !!errorMessage,
2456
- hasCounter: !!maxLength,
2472
+ hasCounter: showCounter,
2457
2473
  ref,
2458
2474
  maxLength,
2459
2475
  onChange: (e) => {
@@ -2466,7 +2482,7 @@ var TextArea = forwardRef8(
2466
2482
  ),
2467
2483
  /* @__PURE__ */ jsxs12(Footer2, { children: [
2468
2484
  errorMessage && /* @__PURE__ */ jsx30(Span5, { children: errorMessage }),
2469
- maxLength && /* @__PURE__ */ jsxs12(CharCounter2, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
2485
+ showCounter && maxLength && /* @__PURE__ */ jsxs12(CharCounter2, { hasReachedMax: maxLength ? charCount >= maxLength : false, children: [
2470
2486
  charCount,
2471
2487
  "/",
2472
2488
  maxLength
@@ -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.0",
6
+ "version": "1.3.2",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/clickpalm/clickpalm-designsystem-lib.git"