@pagamio/frontend-commons-lib 0.8.271 → 0.8.273

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.
@@ -14,8 +14,6 @@ function DatePicker({ value, disabled, name, placeholder, onChange }) {
14
14
  useEffect(() => {
15
15
  setSelectedDate(getValidDate(value));
16
16
  }, [value]);
17
- // Only set defaultValue when a value is explicitly provided
18
- const datepickerDefaultValue = selectedDate ?? undefined;
19
17
  const datepickerTheme = {
20
18
  root: {
21
19
  input: {
@@ -74,12 +72,16 @@ function DatePicker({ value, disabled, name, placeholder, onChange }) {
74
72
  },
75
73
  },
76
74
  };
77
- return (_jsx("div", { children: _jsx(Datepicker, { value: selectedDate ?? undefined, onChange: (date) => {
78
- const validDate = date ? new Date(date) : new Date();
75
+ return (_jsx("div", { children: _jsx(Datepicker, { value: selectedDate ?? null, label: placeholder || 'Select date', onChange: (date) => {
76
+ if (!date) {
77
+ setSelectedDate(null);
78
+ return;
79
+ }
80
+ const validDate = new Date(date);
79
81
  setSelectedDate(validDate);
80
82
  if (onChange && !Number.isNaN(validDate.getTime())) {
81
83
  onChange(validDate);
82
84
  }
83
- }, defaultValue: datepickerDefaultValue, name: name, className: "", disabled: disabled, theme: datepickerTheme }) }));
85
+ }, name: name, className: "", disabled: disabled, theme: datepickerTheme }) }));
84
86
  }
85
87
  export default DatePicker;
@@ -1,9 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { HiClipboardCopy } from 'react-icons/hi';
2
+ import { HiCheck, HiClipboardCopy } from 'react-icons/hi';
3
3
  import { useState } from 'react';
4
4
  import Button from './Button';
5
5
  const HoverableValue = ({ value, truncatedValue }) => {
6
6
  const [isHovered, setIsHovered] = useState(false);
7
- return (_jsxs(Button, { type: "button", size: "icon", variant: "ghost", "aria-label": "Copy to clipboard", className: "relative flex cursor-pointer items-center", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => navigator.clipboard.writeText(value), children: [_jsx("span", { title: value, children: truncatedValue }), isHovered && (_jsx(HiClipboardCopy, { className: "ml-2 text-foreground/70 hover:text-foreground", title: "Copy to clipboard" }))] }));
7
+ const [isCopied, setIsCopied] = useState(false);
8
+ const handleCopy = () => {
9
+ navigator.clipboard.writeText(value);
10
+ setIsCopied(true);
11
+ setTimeout(() => setIsCopied(false), 1500);
12
+ };
13
+ let icon = null;
14
+ if (isCopied) {
15
+ icon = _jsx(HiCheck, { className: "h-3.5 w-3.5 text-success shrink-0" });
16
+ }
17
+ else if (isHovered) {
18
+ icon = _jsx(HiClipboardCopy, { className: "h-3.5 w-3.5 text-foreground/50 shrink-0" });
19
+ }
20
+ return (_jsxs(Button, { type: "button", size: "sm", variant: "ghost", "aria-label": "Copy to clipboard", className: "gap-1 whitespace-nowrap font-normal", title: value, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => {
21
+ setIsHovered(false);
22
+ setIsCopied(false);
23
+ }, onClick: handleCopy, children: [_jsx("span", { className: "font-mono", children: truncatedValue }), icon] }));
8
24
  };
9
25
  export default HoverableValue;
package/lib/styles.css CHANGED
@@ -3034,6 +3034,9 @@ video {
3034
3034
  .text-foreground {
3035
3035
  color: hsl(var(--foreground));
3036
3036
  }
3037
+ .text-foreground\/50 {
3038
+ color: hsl(var(--foreground) / 0.5);
3039
+ }
3037
3040
  .text-foreground\/70 {
3038
3041
  color: hsl(var(--foreground) / 0.7);
3039
3042
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagamio/frontend-commons-lib",
3
3
  "description": "Pagamio library for Frontend reusable components like the form engine and table container",
4
- "version": "0.8.271",
4
+ "version": "0.8.273",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false