@clickpalm/react 1.3.2 → 1.3.3

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
@@ -3073,7 +3073,7 @@ interface TooltipProps {
3073
3073
  delayDuration?: number;
3074
3074
  }
3075
3075
  declare const Tooltip: {
3076
- ({ content, children, side, sideOffset, open, onOpenChange, delayDuration }: TooltipProps): react_jsx_runtime.JSX.Element;
3076
+ ({ content, children, side, sideOffset, open: controlledOpen, onOpenChange, delayDuration }: TooltipProps): react_jsx_runtime.JSX.Element;
3077
3077
  displayName: string;
3078
3078
  };
3079
3079
 
package/dist/index.js CHANGED
@@ -1218,8 +1218,7 @@ var TextInputContainer = styled("div", {
1218
1218
  marginBottom: "$6",
1219
1219
  FontSize: "$md",
1220
1220
  "&:has(input:focus), &:hover": {
1221
- border: "2px solid $clickpalm_light",
1222
- padding: "calc($4 - 0.9px) calc($4 - 0.9px)"
1221
+ border: "1px solid $clickpalm_light"
1223
1222
  },
1224
1223
  "&:has(input:disabled)": {
1225
1224
  opacity: 0.5,
@@ -1240,8 +1239,7 @@ var TextInputContainer = styled("div", {
1240
1239
  border: "1px solid $danger_dark",
1241
1240
  marginBottom: "0px",
1242
1241
  "&:has(input:focus), &:hover": {
1243
- border: "2px solid $danger_dark",
1244
- padding: "calc($4 - 0.9px) calc($4 - 0.9px)"
1242
+ border: "1px solid $danger_dark"
1245
1243
  }
1246
1244
  }
1247
1245
  },
@@ -1326,9 +1324,22 @@ var CharCounter = styled(Span2, {
1326
1324
  var import_jsx_runtime19 = require("react/jsx-runtime");
1327
1325
  var Input2 = (0, import_react5.forwardRef)(
1328
1326
  ({ prefix, suffix, label, maxLength, showCounter = false, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1329
- const [charCount, setCharCount] = (0, import_react5.useState)(0);
1327
+ const getDisplayValue = (value) => {
1328
+ const stringValue = String(value || "");
1329
+ if (prefix && stringValue.startsWith(prefix)) {
1330
+ return stringValue.substring(prefix.length);
1331
+ }
1332
+ return stringValue;
1333
+ };
1334
+ const [displayValue, setDisplayValue] = (0, import_react5.useState)(getDisplayValue(props.value));
1335
+ const [charCount, setCharCount] = (0, import_react5.useState)((prefix?.length || 0) + getDisplayValue(props.value).length);
1330
1336
  const localInputRef = (0, import_react5.useRef)(null);
1331
1337
  const inputRef = forwardedRef || localInputRef;
1338
+ (0, import_react5.useEffect)(() => {
1339
+ const newDisplayValue = getDisplayValue(props.value);
1340
+ setDisplayValue(newDisplayValue);
1341
+ setCharCount((prefix?.length || 0) + newDisplayValue.length);
1342
+ }, [props.value, prefix]);
1332
1343
  const handleContainerClick = () => {
1333
1344
  inputRef?.current?.focus();
1334
1345
  };
@@ -1355,12 +1366,23 @@ var Input2 = (0, import_react5.forwardRef)(
1355
1366
  {
1356
1367
  ref: inputRef,
1357
1368
  ...props,
1358
- maxLength,
1369
+ value: displayValue,
1370
+ maxLength: maxLength ? maxLength - (prefix?.length || 0) : void 0,
1359
1371
  onChange: (e) => {
1372
+ const currentDisplayValue = e.target.value;
1373
+ setDisplayValue(currentDisplayValue);
1374
+ setCharCount((prefix?.length || 0) + currentDisplayValue.length);
1360
1375
  if (props.onChange) {
1361
- props.onChange(e);
1376
+ const valueWithPrefix = prefix ? prefix + currentDisplayValue : currentDisplayValue;
1377
+ const newEvent = {
1378
+ ...e,
1379
+ target: {
1380
+ ...e.target,
1381
+ value: valueWithPrefix
1382
+ }
1383
+ };
1384
+ props.onChange(newEvent);
1362
1385
  }
1363
- setCharCount(e.target.value.length);
1364
1386
  }
1365
1387
  }
1366
1388
  ),
@@ -2135,7 +2157,7 @@ var StyledRoot3 = styled(Switch.Root, {
2135
2157
  },
2136
2158
  '&[data-state="unchecked"]': {
2137
2159
  backgroundColor: "$white",
2138
- border: "2px solid $gray_dark"
2160
+ border: "1px solid $gray_dark"
2139
2161
  },
2140
2162
  "&:disabled": {
2141
2163
  opacity: 0.5,
@@ -2147,13 +2169,13 @@ var StyledRoot3 = styled(Switch.Root, {
2147
2169
  variants: {
2148
2170
  hasError: {
2149
2171
  true: {
2150
- border: "2px solid $danger_dark",
2172
+ border: "1px solid $danger_dark",
2151
2173
  marginBottom: "0px",
2152
2174
  "&:focus": {
2153
2175
  outline: "1px solid $danger_dark"
2154
2176
  },
2155
2177
  '&[data-state="unchecked"]': {
2156
- border: "2px solid $danger_dark"
2178
+ border: "1px solid $danger_dark"
2157
2179
  }
2158
2180
  }
2159
2181
  }
@@ -2451,7 +2473,7 @@ var TextAreaElement = styled("textarea", {
2451
2473
  width: "100%",
2452
2474
  "&:focus": {
2453
2475
  outline: 0,
2454
- border: "2px solid $clickpalm_light"
2476
+ border: "1px solid $clickpalm_light"
2455
2477
  },
2456
2478
  "&:disabled": {
2457
2479
  opacity: 0.5,
@@ -2476,10 +2498,10 @@ var TextAreaElement = styled("textarea", {
2476
2498
  variants: {
2477
2499
  hasError: {
2478
2500
  true: {
2479
- border: "1px solid $danger_dark",
2501
+ border: "1px solid $danger",
2480
2502
  marginBottom: "0px",
2481
2503
  "&:focus": {
2482
- border: "2px solid $danger_dark"
2504
+ border: "1px solid $danger_dark"
2483
2505
  }
2484
2506
  }
2485
2507
  },
@@ -2614,18 +2636,32 @@ var TooltipArrow = styled(RadixTooltip.Arrow, {
2614
2636
  });
2615
2637
 
2616
2638
  // src/components/Tooltip/index.tsx
2639
+ var import_react14 = require("react");
2617
2640
  var import_jsx_runtime31 = require("react/jsx-runtime");
2618
2641
  var Tooltip = ({
2619
2642
  content,
2620
2643
  children,
2621
2644
  side = "top",
2622
2645
  sideOffset = 5,
2623
- open,
2646
+ open: controlledOpen,
2624
2647
  onOpenChange,
2625
2648
  delayDuration = 100
2626
2649
  }) => {
2627
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadixTooltip2.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(RadixTooltip2.Root, { open, onOpenChange, delayDuration, children: [
2628
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipTrigger, { asChild: true, children }),
2650
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react14.useState)(false);
2651
+ const [isTouchDevice, setIsTouchDevice] = (0, import_react14.useState)(false);
2652
+ (0, import_react14.useEffect)(() => {
2653
+ setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
2654
+ }, []);
2655
+ const open = controlledOpen ?? uncontrolledOpen;
2656
+ const setOpen = onOpenChange ?? setUncontrolledOpen;
2657
+ const handleClick = (event) => {
2658
+ if (isTouchDevice) {
2659
+ event.preventDefault();
2660
+ setOpen(!open);
2661
+ }
2662
+ };
2663
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadixTooltip2.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(RadixTooltip2.Root, { open, onOpenChange: setOpen, delayDuration, children: [
2664
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipTrigger, { asChild: true, onClick: handleClick, children }),
2629
2665
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(TooltipContent, { side, sideOffset, children: [
2630
2666
  content,
2631
2667
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipArrow, {})
@@ -2719,7 +2755,7 @@ var Loader = ({ show, fullscreen = false }) => {
2719
2755
  Loader.displayName = "Loader";
2720
2756
 
2721
2757
  // src/components/MaskedInput/index.tsx
2722
- var import_react14 = require("react");
2758
+ var import_react15 = require("react");
2723
2759
 
2724
2760
  // src/components/MaskedInput/utils.ts
2725
2761
  var MAX_LENGTHS = {
@@ -2784,10 +2820,10 @@ var applyMask = (value, maskType) => {
2784
2820
 
2785
2821
  // src/components/MaskedInput/index.tsx
2786
2822
  var import_jsx_runtime33 = require("react/jsx-runtime");
2787
- var MaskedInput = (0, import_react14.forwardRef)(
2823
+ var MaskedInput = (0, import_react15.forwardRef)(
2788
2824
  ({ maskType, onChange, ...props }, ref) => {
2789
- const [value, setValue] = (0, import_react14.useState)("");
2790
- const inputRef = (0, import_react14.useRef)(null);
2825
+ const [value, setValue] = (0, import_react15.useState)("");
2826
+ const inputRef = (0, import_react15.useRef)(null);
2791
2827
  const handleChange = (e) => {
2792
2828
  const { value: inputValue, selectionStart } = e.target;
2793
2829
  const isBackspace = value.length > inputValue.length;
@@ -2835,7 +2871,7 @@ var MaskedInput = (0, import_react14.forwardRef)(
2835
2871
  MaskedInput.displayName = "MaskedInput";
2836
2872
 
2837
2873
  // src/components/Dropdown/index.tsx
2838
- var import_react15 = __toESM(require("react"));
2874
+ var import_react16 = __toESM(require("react"));
2839
2875
  var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
2840
2876
 
2841
2877
  // src/components/Dropdown/styles.ts
@@ -2923,17 +2959,17 @@ var IconButton = styled("button", {
2923
2959
  // src/components/Dropdown/index.tsx
2924
2960
  var import_jsx_runtime34 = require("react/jsx-runtime");
2925
2961
  var Dropdown = ({ children }) => {
2926
- const childrenArray = import_react15.Children.toArray(children);
2962
+ const childrenArray = import_react16.Children.toArray(children);
2927
2963
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(DropdownMenu2.Root, { children: [
2928
2964
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { variant: "secondary", size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: "Dots", size: 16 }) }) }),
2929
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenu2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StyledContent2, { sideOffset: 5, align: "end", children: childrenArray.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react15.Fragment, { children: [
2965
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenu2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StyledContent2, { sideOffset: 5, align: "end", children: childrenArray.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react16.Fragment, { children: [
2930
2966
  child,
2931
2967
  index < childrenArray.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownSeparator, {})
2932
2968
  ] }, index)) }) })
2933
2969
  ] });
2934
2970
  };
2935
2971
  var DropdownSeparator = StyledSeparator;
2936
- var DropdownItem = import_react15.default.forwardRef(({ children, ...props }, forwardedRef) => {
2972
+ var DropdownItem = import_react16.default.forwardRef(({ children, ...props }, forwardedRef) => {
2937
2973
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StyledItem2, { ...props, ref: forwardedRef, children });
2938
2974
  });
2939
2975
  Dropdown.displayName = "Dropdown";
@@ -3015,7 +3051,7 @@ var Paragraph = (props) => {
3015
3051
  Paragraph.displayName = "Paragraph";
3016
3052
 
3017
3053
  // src/components/Heading.tsx
3018
- var import_react16 = require("react");
3054
+ var import_react17 = require("react");
3019
3055
  var import_jsx_runtime37 = require("react/jsx-runtime");
3020
3056
  var StyledHeading = styled("h2", {
3021
3057
  fontFamily: "$default",
@@ -3038,7 +3074,7 @@ var StyledHeading = styled("h2", {
3038
3074
  size: "md"
3039
3075
  }
3040
3076
  });
3041
- var Heading = (0, import_react16.forwardRef)(function Heading2({ children, ...props }, ref) {
3077
+ var Heading = (0, import_react17.forwardRef)(function Heading2({ children, ...props }, ref) {
3042
3078
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(StyledHeading, { ref, ...props, children });
3043
3079
  });
3044
3080
  Heading.displayName = "Heading";
@@ -3046,7 +3082,7 @@ Heading.displayName = "Heading";
3046
3082
  // src/components/Select/index.tsx
3047
3083
  var import_react_icons2 = require("@radix-ui/react-icons");
3048
3084
  var CustomSelect2 = __toESM(require("@radix-ui/react-select"));
3049
- var import_react17 = require("react");
3085
+ var import_react18 = require("react");
3050
3086
 
3051
3087
  // src/components/Select/styles.ts
3052
3088
  var Select = __toESM(require("@radix-ui/react-select"));
@@ -3082,8 +3118,7 @@ var StyledTrigger = styled(Select.Trigger, {
3082
3118
  },
3083
3119
  "&[data-highlighted], &:focus, &:hover": {
3084
3120
  outline: "none",
3085
- border: "2px solid $clickpalm_light",
3086
- padding: "calc(0.92rem - 0.9px) calc($4 - 0.9px)"
3121
+ border: "1px solid $clickpalm_light"
3087
3122
  },
3088
3123
  "&:disabled": {
3089
3124
  opacity: 0.5,
@@ -3096,8 +3131,7 @@ var StyledTrigger = styled(Select.Trigger, {
3096
3131
  marginBottom: "0px",
3097
3132
  "&[data-highlighted], &:focus, &:hover": {
3098
3133
  outline: "none",
3099
- border: "2px solid $danger_dark",
3100
- padding: "calc(0.92rem - 0.9px) calc($4 - 0.9px)"
3134
+ border: "1px solid $danger_dark"
3101
3135
  }
3102
3136
  }
3103
3137
  }
@@ -3181,7 +3215,7 @@ var Span6 = styled("span", {
3181
3215
 
3182
3216
  // src/components/Select/index.tsx
3183
3217
  var import_jsx_runtime38 = require("react/jsx-runtime");
3184
- var Select2 = (0, import_react17.forwardRef)(
3218
+ var Select2 = (0, import_react18.forwardRef)(
3185
3219
  ({
3186
3220
  value,
3187
3221
  onValueChange,
@@ -3194,7 +3228,7 @@ var Select2 = (0, import_react17.forwardRef)(
3194
3228
  style,
3195
3229
  ...rest
3196
3230
  }, ref) => {
3197
- const [open, setOpen] = (0, import_react17.useState)(false);
3231
+ const [open, setOpen] = (0, import_react18.useState)(false);
3198
3232
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(StyledWrapper4, { css: css2, className, style, children: [
3199
3233
  label && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Label3, { children: label }),
3200
3234
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
@@ -3224,7 +3258,7 @@ var Select2 = (0, import_react17.forwardRef)(
3224
3258
  Select2.displayName = "Select";
3225
3259
 
3226
3260
  // src/components/LabelledValue/index.tsx
3227
- var import_react18 = require("react");
3261
+ var import_react19 = require("react");
3228
3262
 
3229
3263
  // src/components/LabelledValue/styles.ts
3230
3264
  var Container = styled("div", {
@@ -3287,9 +3321,9 @@ var Value2 = styled("div", {
3287
3321
  // src/components/LabelledValue/index.tsx
3288
3322
  var import_jsx_runtime39 = require("react/jsx-runtime");
3289
3323
  function LabelledValue({ position = "vertical", withRow = false, children }) {
3290
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Container, { position, children: import_react18.Children.map(children, (child) => {
3291
- if ((0, import_react18.isValidElement)(child)) {
3292
- return (0, import_react18.cloneElement)(child, { position, withRow });
3324
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Container, { position, children: import_react19.Children.map(children, (child) => {
3325
+ if ((0, import_react19.isValidElement)(child)) {
3326
+ return (0, import_react19.cloneElement)(child, { position, withRow });
3293
3327
  }
3294
3328
  return child;
3295
3329
  }) });
@@ -3885,7 +3919,7 @@ var MultiStep = ({
3885
3919
  MultiStep.displayName = "MultiStep";
3886
3920
 
3887
3921
  // src/components/Carousel/index.tsx
3888
- var import_react19 = require("react");
3922
+ var import_react20 = require("react");
3889
3923
 
3890
3924
  // src/components/Carousel/styles.ts
3891
3925
  var CarouselContainer = styled("div", {
@@ -3996,10 +4030,10 @@ var CarouselItemContainer = styled("div", {
3996
4030
  var import_jsx_runtime43 = require("react/jsx-runtime");
3997
4031
  var SWIPE_THRESHOLD = 50;
3998
4032
  var Carousel = ({ title, variant, children }) => {
3999
- const items = import_react19.Children.toArray(children);
4000
- const [activeIndex, setActiveIndex] = (0, import_react19.useState)(0);
4001
- const [touchStartX, setTouchStartX] = (0, import_react19.useState)(null);
4002
- const [touchEndX, setTouchEndX] = (0, import_react19.useState)(null);
4033
+ const items = import_react20.Children.toArray(children);
4034
+ const [activeIndex, setActiveIndex] = (0, import_react20.useState)(0);
4035
+ const [touchStartX, setTouchStartX] = (0, import_react20.useState)(null);
4036
+ const [touchEndX, setTouchEndX] = (0, import_react20.useState)(null);
4003
4037
  const prev = () => {
4004
4038
  setActiveIndex((prevIndex) => prevIndex === 0 ? items.length - 1 : prevIndex - 1);
4005
4039
  };
@@ -4072,7 +4106,7 @@ var Carousel = ({ title, variant, children }) => {
4072
4106
  onTouchMove,
4073
4107
  onTouchEnd,
4074
4108
  children: items.map(
4075
- (child, index) => (0, import_react19.cloneElement)(child, {
4109
+ (child, index) => (0, import_react20.cloneElement)(child, {
4076
4110
  "aria-hidden": index !== activeIndex,
4077
4111
  style: {
4078
4112
  display: index === activeIndex ? "block" : "none"
@@ -4103,7 +4137,7 @@ var CarouselItem = ({ children, style, ...props }) => /* @__PURE__ */ (0, import
4103
4137
  Carousel.Item = CarouselItem;
4104
4138
 
4105
4139
  // src/components/PasswordInput.tsx
4106
- var import_react20 = require("react");
4140
+ var import_react21 = require("react");
4107
4141
  var import_jsx_runtime44 = require("react/jsx-runtime");
4108
4142
  var ToggleButton = styled("button", {
4109
4143
  all: "unset",
@@ -4119,11 +4153,11 @@ var ToggleButton = styled("button", {
4119
4153
  borderRadius: "$sm"
4120
4154
  }
4121
4155
  });
4122
- var PasswordInput = (0, import_react20.forwardRef)(
4156
+ var PasswordInput = (0, import_react21.forwardRef)(
4123
4157
  ({ value, onChange, ...props }, ref) => {
4124
- const [visible, setVisible] = (0, import_react20.useState)(false);
4125
- const innerRef = (0, import_react20.useRef)(null);
4126
- (0, import_react20.useImperativeHandle)(ref, () => innerRef.current);
4158
+ const [visible, setVisible] = (0, import_react21.useState)(false);
4159
+ const innerRef = (0, import_react21.useRef)(null);
4160
+ (0, import_react21.useImperativeHandle)(ref, () => innerRef.current);
4127
4161
  const handleToggleVisibility = () => {
4128
4162
  setVisible((v) => !v);
4129
4163
  setTimeout(() => {
@@ -4159,7 +4193,7 @@ PasswordInput.displayName = "PasswordInput";
4159
4193
 
4160
4194
  // src/components/Accordion/index.tsx
4161
4195
  var RadixAccordion = __toESM(require("@radix-ui/react-accordion"));
4162
- var import_react21 = __toESM(require("react"));
4196
+ var import_react22 = __toESM(require("react"));
4163
4197
 
4164
4198
  // src/components/Accordion/styles.ts
4165
4199
  var Accordion = __toESM(require("@radix-ui/react-accordion"));
@@ -4246,7 +4280,7 @@ var OptionsButton = styled(Button, {
4246
4280
 
4247
4281
  // src/components/Accordion/index.tsx
4248
4282
  var import_jsx_runtime45 = require("react/jsx-runtime");
4249
- var Accordion2 = import_react21.default.forwardRef(
4283
+ var Accordion2 = import_react22.default.forwardRef(
4250
4284
  ({ title, children, dropdownItems }, ref) => {
4251
4285
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AccordionContainer, { type: "single", collapsible: true, ref, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AccordionItem, { value: "item-1", children: [
4252
4286
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AccordionHeader, { children: [
package/dist/index.mjs CHANGED
@@ -1117,12 +1117,12 @@ Checkbox2.displayName = "Checkbox";
1117
1117
  // src/components/Datepicker/index.tsx
1118
1118
  import { format as format2 } from "date-fns";
1119
1119
  import { ptBR as ptBR2 } from "date-fns/locale";
1120
- import { forwardRef as forwardRef4, useEffect as useEffect3, useImperativeHandle, useRef as useRef4, useState as useState4 } from "react";
1120
+ import { forwardRef as forwardRef4, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as useState4 } from "react";
1121
1121
  import { DayPicker as DayPicker2 } from "react-day-picker";
1122
1122
  import "react-day-picker/dist/style.css";
1123
1123
 
1124
1124
  // src/components/Input/index.tsx
1125
- import React, { forwardRef as forwardRef3, useRef as useRef2, useState as useState2 } from "react";
1125
+ import React, { forwardRef as forwardRef3, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
1126
1126
 
1127
1127
  // src/components/Input/styles.ts
1128
1128
  var StyledWrapper2 = styled("div", {
@@ -1148,8 +1148,7 @@ var TextInputContainer = styled("div", {
1148
1148
  marginBottom: "$6",
1149
1149
  FontSize: "$md",
1150
1150
  "&:has(input:focus), &:hover": {
1151
- border: "2px solid $clickpalm_light",
1152
- padding: "calc($4 - 0.9px) calc($4 - 0.9px)"
1151
+ border: "1px solid $clickpalm_light"
1153
1152
  },
1154
1153
  "&:has(input:disabled)": {
1155
1154
  opacity: 0.5,
@@ -1170,8 +1169,7 @@ var TextInputContainer = styled("div", {
1170
1169
  border: "1px solid $danger_dark",
1171
1170
  marginBottom: "0px",
1172
1171
  "&:has(input:focus), &:hover": {
1173
- border: "2px solid $danger_dark",
1174
- padding: "calc($4 - 0.9px) calc($4 - 0.9px)"
1172
+ border: "1px solid $danger_dark"
1175
1173
  }
1176
1174
  }
1177
1175
  },
@@ -1256,9 +1254,22 @@ var CharCounter = styled(Span2, {
1256
1254
  import { jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
1257
1255
  var Input2 = forwardRef3(
1258
1256
  ({ prefix, suffix, label, maxLength, showCounter = false, errorMessage, noMargin = false, ...props }, forwardedRef) => {
1259
- const [charCount, setCharCount] = useState2(0);
1257
+ const getDisplayValue = (value) => {
1258
+ const stringValue = String(value || "");
1259
+ if (prefix && stringValue.startsWith(prefix)) {
1260
+ return stringValue.substring(prefix.length);
1261
+ }
1262
+ return stringValue;
1263
+ };
1264
+ const [displayValue, setDisplayValue] = useState2(getDisplayValue(props.value));
1265
+ const [charCount, setCharCount] = useState2((prefix?.length || 0) + getDisplayValue(props.value).length);
1260
1266
  const localInputRef = useRef2(null);
1261
1267
  const inputRef = forwardedRef || localInputRef;
1268
+ useEffect2(() => {
1269
+ const newDisplayValue = getDisplayValue(props.value);
1270
+ setDisplayValue(newDisplayValue);
1271
+ setCharCount((prefix?.length || 0) + newDisplayValue.length);
1272
+ }, [props.value, prefix]);
1262
1273
  const handleContainerClick = () => {
1263
1274
  inputRef?.current?.focus();
1264
1275
  };
@@ -1285,12 +1296,23 @@ var Input2 = forwardRef3(
1285
1296
  {
1286
1297
  ref: inputRef,
1287
1298
  ...props,
1288
- maxLength,
1299
+ value: displayValue,
1300
+ maxLength: maxLength ? maxLength - (prefix?.length || 0) : void 0,
1289
1301
  onChange: (e) => {
1302
+ const currentDisplayValue = e.target.value;
1303
+ setDisplayValue(currentDisplayValue);
1304
+ setCharCount((prefix?.length || 0) + currentDisplayValue.length);
1290
1305
  if (props.onChange) {
1291
- props.onChange(e);
1306
+ const valueWithPrefix = prefix ? prefix + currentDisplayValue : currentDisplayValue;
1307
+ const newEvent = {
1308
+ ...e,
1309
+ target: {
1310
+ ...e.target,
1311
+ value: valueWithPrefix
1312
+ }
1313
+ };
1314
+ props.onChange(newEvent);
1292
1315
  }
1293
- setCharCount(e.target.value.length);
1294
1316
  }
1295
1317
  }
1296
1318
  ),
@@ -1312,7 +1334,7 @@ var Input2 = forwardRef3(
1312
1334
  Input2.displayName = "Input";
1313
1335
 
1314
1336
  // src/components/Datepicker/CustomSelect/index.tsx
1315
- import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
1337
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
1316
1338
 
1317
1339
  // src/components/Datepicker/CustomSelect/styles.ts
1318
1340
  var IconWrapper = styled("span", {
@@ -1456,7 +1478,7 @@ var CustomSelect = ({
1456
1478
  }
1457
1479
  setIsOpen(false);
1458
1480
  };
1459
- useEffect2(() => {
1481
+ useEffect3(() => {
1460
1482
  const handleClickOutside = (event) => {
1461
1483
  if (selectRef.current && !selectRef.current.contains(event.target)) {
1462
1484
  setIsOpen(false);
@@ -1632,7 +1654,7 @@ var Datepicker = forwardRef4(({ label, placeholder, value, onChange, errorMessag
1632
1654
  }
1633
1655
  setOpen(false);
1634
1656
  };
1635
- useEffect3(() => {
1657
+ useEffect4(() => {
1636
1658
  const handleClickOutside = (event) => {
1637
1659
  if (calendarRef.current && !calendarRef.current.contains(event.target) && inputRef.current && !inputRef.current.contains(event.target)) {
1638
1660
  setOpen(false);
@@ -1641,7 +1663,7 @@ var Datepicker = forwardRef4(({ label, placeholder, value, onChange, errorMessag
1641
1663
  document.addEventListener("mousedown", handleClickOutside);
1642
1664
  return () => document.removeEventListener("mousedown", handleClickOutside);
1643
1665
  }, []);
1644
- useEffect3(() => {
1666
+ useEffect4(() => {
1645
1667
  if (!open && selected) {
1646
1668
  setMonth(selected);
1647
1669
  }
@@ -1814,7 +1836,7 @@ var Modal = ({ open, onOpenChange, title, description, children }) => {
1814
1836
  };
1815
1837
 
1816
1838
  // src/components/ProgressBar/index.tsx
1817
- import { useEffect as useEffect4, useState as useState5 } from "react";
1839
+ import { useEffect as useEffect5, useState as useState5 } from "react";
1818
1840
 
1819
1841
  // src/components/ProgressBar/styles.ts
1820
1842
  import * as Progress from "@radix-ui/react-progress";
@@ -1847,7 +1869,7 @@ var StyledIndicator = styled(Progress.Indicator, {
1847
1869
  import { jsx as jsx25, jsxs as jsxs8 } from "react/jsx-runtime";
1848
1870
  var ProgressBar = ({ label, value = 0, max = 100, ...rest }) => {
1849
1871
  const [progress2, setProgress] = useState5(0);
1850
- useEffect4(() => {
1872
+ useEffect5(() => {
1851
1873
  const timer = setTimeout(() => setProgress(value), 500);
1852
1874
  return () => clearTimeout(timer);
1853
1875
  }, [value]);
@@ -2065,7 +2087,7 @@ var StyledRoot3 = styled(Switch.Root, {
2065
2087
  },
2066
2088
  '&[data-state="unchecked"]': {
2067
2089
  backgroundColor: "$white",
2068
- border: "2px solid $gray_dark"
2090
+ border: "1px solid $gray_dark"
2069
2091
  },
2070
2092
  "&:disabled": {
2071
2093
  opacity: 0.5,
@@ -2077,13 +2099,13 @@ var StyledRoot3 = styled(Switch.Root, {
2077
2099
  variants: {
2078
2100
  hasError: {
2079
2101
  true: {
2080
- border: "2px solid $danger_dark",
2102
+ border: "1px solid $danger_dark",
2081
2103
  marginBottom: "0px",
2082
2104
  "&:focus": {
2083
2105
  outline: "1px solid $danger_dark"
2084
2106
  },
2085
2107
  '&[data-state="unchecked"]': {
2086
- border: "2px solid $danger_dark"
2108
+ border: "1px solid $danger_dark"
2087
2109
  }
2088
2110
  }
2089
2111
  }
@@ -2381,7 +2403,7 @@ var TextAreaElement = styled("textarea", {
2381
2403
  width: "100%",
2382
2404
  "&:focus": {
2383
2405
  outline: 0,
2384
- border: "2px solid $clickpalm_light"
2406
+ border: "1px solid $clickpalm_light"
2385
2407
  },
2386
2408
  "&:disabled": {
2387
2409
  opacity: 0.5,
@@ -2406,10 +2428,10 @@ var TextAreaElement = styled("textarea", {
2406
2428
  variants: {
2407
2429
  hasError: {
2408
2430
  true: {
2409
- border: "1px solid $danger_dark",
2431
+ border: "1px solid $danger",
2410
2432
  marginBottom: "0px",
2411
2433
  "&:focus": {
2412
- border: "2px solid $danger_dark"
2434
+ border: "1px solid $danger_dark"
2413
2435
  }
2414
2436
  }
2415
2437
  },
@@ -2544,18 +2566,32 @@ var TooltipArrow = styled(RadixTooltip.Arrow, {
2544
2566
  });
2545
2567
 
2546
2568
  // src/components/Tooltip/index.tsx
2569
+ import { useState as useState8, useEffect as useEffect6 } from "react";
2547
2570
  import { jsx as jsx31, jsxs as jsxs13 } from "react/jsx-runtime";
2548
2571
  var Tooltip = ({
2549
2572
  content,
2550
2573
  children,
2551
2574
  side = "top",
2552
2575
  sideOffset = 5,
2553
- open,
2576
+ open: controlledOpen,
2554
2577
  onOpenChange,
2555
2578
  delayDuration = 100
2556
2579
  }) => {
2557
- return /* @__PURE__ */ jsx31(RadixTooltip2.Provider, { children: /* @__PURE__ */ jsxs13(RadixTooltip2.Root, { open, onOpenChange, delayDuration, children: [
2558
- /* @__PURE__ */ jsx31(TooltipTrigger, { asChild: true, children }),
2580
+ const [uncontrolledOpen, setUncontrolledOpen] = useState8(false);
2581
+ const [isTouchDevice, setIsTouchDevice] = useState8(false);
2582
+ useEffect6(() => {
2583
+ setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
2584
+ }, []);
2585
+ const open = controlledOpen ?? uncontrolledOpen;
2586
+ const setOpen = onOpenChange ?? setUncontrolledOpen;
2587
+ const handleClick = (event) => {
2588
+ if (isTouchDevice) {
2589
+ event.preventDefault();
2590
+ setOpen(!open);
2591
+ }
2592
+ };
2593
+ return /* @__PURE__ */ jsx31(RadixTooltip2.Provider, { children: /* @__PURE__ */ jsxs13(RadixTooltip2.Root, { open, onOpenChange: setOpen, delayDuration, children: [
2594
+ /* @__PURE__ */ jsx31(TooltipTrigger, { asChild: true, onClick: handleClick, children }),
2559
2595
  /* @__PURE__ */ jsxs13(TooltipContent, { side, sideOffset, children: [
2560
2596
  content,
2561
2597
  /* @__PURE__ */ jsx31(TooltipArrow, {})
@@ -2649,7 +2685,7 @@ var Loader = ({ show, fullscreen = false }) => {
2649
2685
  Loader.displayName = "Loader";
2650
2686
 
2651
2687
  // src/components/MaskedInput/index.tsx
2652
- import { forwardRef as forwardRef9, useState as useState8, useRef as useRef6 } from "react";
2688
+ import { forwardRef as forwardRef9, useState as useState9, useRef as useRef6 } from "react";
2653
2689
 
2654
2690
  // src/components/MaskedInput/utils.ts
2655
2691
  var MAX_LENGTHS = {
@@ -2716,7 +2752,7 @@ var applyMask = (value, maskType) => {
2716
2752
  import { jsx as jsx33 } from "react/jsx-runtime";
2717
2753
  var MaskedInput = forwardRef9(
2718
2754
  ({ maskType, onChange, ...props }, ref) => {
2719
- const [value, setValue] = useState8("");
2755
+ const [value, setValue] = useState9("");
2720
2756
  const inputRef = useRef6(null);
2721
2757
  const handleChange = (e) => {
2722
2758
  const { value: inputValue, selectionStart } = e.target;
@@ -2976,7 +3012,7 @@ Heading.displayName = "Heading";
2976
3012
  // src/components/Select/index.tsx
2977
3013
  import { TriangleDownIcon, TriangleUpIcon } from "@radix-ui/react-icons";
2978
3014
  import * as CustomSelect2 from "@radix-ui/react-select";
2979
- import { forwardRef as forwardRef11, useState as useState9 } from "react";
3015
+ import { forwardRef as forwardRef11, useState as useState10 } from "react";
2980
3016
 
2981
3017
  // src/components/Select/styles.ts
2982
3018
  import * as Select from "@radix-ui/react-select";
@@ -3012,8 +3048,7 @@ var StyledTrigger = styled(Select.Trigger, {
3012
3048
  },
3013
3049
  "&[data-highlighted], &:focus, &:hover": {
3014
3050
  outline: "none",
3015
- border: "2px solid $clickpalm_light",
3016
- padding: "calc(0.92rem - 0.9px) calc($4 - 0.9px)"
3051
+ border: "1px solid $clickpalm_light"
3017
3052
  },
3018
3053
  "&:disabled": {
3019
3054
  opacity: 0.5,
@@ -3026,8 +3061,7 @@ var StyledTrigger = styled(Select.Trigger, {
3026
3061
  marginBottom: "0px",
3027
3062
  "&[data-highlighted], &:focus, &:hover": {
3028
3063
  outline: "none",
3029
- border: "2px solid $danger_dark",
3030
- padding: "calc(0.92rem - 0.9px) calc($4 - 0.9px)"
3064
+ border: "1px solid $danger_dark"
3031
3065
  }
3032
3066
  }
3033
3067
  }
@@ -3124,7 +3158,7 @@ var Select2 = forwardRef11(
3124
3158
  style,
3125
3159
  ...rest
3126
3160
  }, ref) => {
3127
- const [open, setOpen] = useState9(false);
3161
+ const [open, setOpen] = useState10(false);
3128
3162
  return /* @__PURE__ */ jsxs15(StyledWrapper4, { css: css2, className, style, children: [
3129
3163
  label && /* @__PURE__ */ jsx38(Label3, { children: label }),
3130
3164
  /* @__PURE__ */ jsxs15(
@@ -3819,7 +3853,7 @@ var MultiStep = ({
3819
3853
  MultiStep.displayName = "MultiStep";
3820
3854
 
3821
3855
  // src/components/Carousel/index.tsx
3822
- import { useState as useState11, Children as Children4, cloneElement as cloneElement2 } from "react";
3856
+ import { useState as useState12, Children as Children4, cloneElement as cloneElement2 } from "react";
3823
3857
 
3824
3858
  // src/components/Carousel/styles.ts
3825
3859
  var CarouselContainer = styled("div", {
@@ -3931,9 +3965,9 @@ import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
3931
3965
  var SWIPE_THRESHOLD = 50;
3932
3966
  var Carousel = ({ title, variant, children }) => {
3933
3967
  const items = Children4.toArray(children);
3934
- const [activeIndex, setActiveIndex] = useState11(0);
3935
- const [touchStartX, setTouchStartX] = useState11(null);
3936
- const [touchEndX, setTouchEndX] = useState11(null);
3968
+ const [activeIndex, setActiveIndex] = useState12(0);
3969
+ const [touchStartX, setTouchStartX] = useState12(null);
3970
+ const [touchEndX, setTouchEndX] = useState12(null);
3937
3971
  const prev = () => {
3938
3972
  setActiveIndex((prevIndex) => prevIndex === 0 ? items.length - 1 : prevIndex - 1);
3939
3973
  };
@@ -4037,7 +4071,7 @@ var CarouselItem = ({ children, style, ...props }) => /* @__PURE__ */ jsx43(Caro
4037
4071
  Carousel.Item = CarouselItem;
4038
4072
 
4039
4073
  // src/components/PasswordInput.tsx
4040
- import { forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2, useRef as useRef7, useState as useState12 } from "react";
4074
+ import { forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2, useRef as useRef7, useState as useState13 } from "react";
4041
4075
  import { jsx as jsx44 } from "react/jsx-runtime";
4042
4076
  var ToggleButton = styled("button", {
4043
4077
  all: "unset",
@@ -4055,7 +4089,7 @@ var ToggleButton = styled("button", {
4055
4089
  });
4056
4090
  var PasswordInput = forwardRef12(
4057
4091
  ({ value, onChange, ...props }, ref) => {
4058
- const [visible, setVisible] = useState12(false);
4092
+ const [visible, setVisible] = useState13(false);
4059
4093
  const innerRef = useRef7(null);
4060
4094
  useImperativeHandle2(ref, () => innerRef.current);
4061
4095
  const handleToggleVisibility = () => {
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.2",
6
+ "version": "1.3.3",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/clickpalm/clickpalm-designsystem-lib.git"