@pixpilot/shadcn 1.2.3 → 1.2.6

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.
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  import * as React from "react";
3
- import * as react_jsx_runtime9 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
4
4
  import * as class_variance_authority_types0 from "class-variance-authority/types";
5
5
 
6
6
  //#region src/components/ui/alert.d.ts
@@ -11,14 +11,14 @@ declare function Alert({
11
11
  className,
12
12
  variant,
13
13
  ...props
14
- }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>): react_jsx_runtime9.JSX.Element;
14
+ }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>): react_jsx_runtime5.JSX.Element;
15
15
  declare function AlertTitle({
16
16
  className,
17
17
  ...props
18
- }: React.ComponentProps<'div'>): react_jsx_runtime9.JSX.Element;
18
+ }: React.ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
19
19
  declare function AlertDescription({
20
20
  className,
21
21
  ...props
22
- }: React.ComponentProps<'div'>): react_jsx_runtime9.JSX.Element;
22
+ }: React.ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
23
23
  //#endregion
24
24
  export { Alert, AlertDescription, AlertTitle };
@@ -78,7 +78,10 @@ declare function ColorPickerContent(props: React.ComponentProps<typeof PopoverCo
78
78
  declare function ColorPickerArea(props: DivProps): react_jsx_runtime41.JSX.Element;
79
79
  declare function ColorPickerHueSlider(props: React.ComponentProps<typeof SliderPrimitive.Root>): react_jsx_runtime41.JSX.Element;
80
80
  declare function ColorPickerAlphaSlider(props: React.ComponentProps<typeof SliderPrimitive.Root>): react_jsx_runtime41.JSX.Element;
81
- declare function ColorPickerSwatch(props: DivProps): react_jsx_runtime41.JSX.Element;
81
+ interface ColorPickerSwatchProps extends Omit<DivProps, 'color'> {
82
+ color?: string;
83
+ }
84
+ declare function ColorPickerSwatch(props: ColorPickerSwatchProps): react_jsx_runtime41.JSX.Element;
82
85
  declare function ColorPickerEyeDropper(props: React.ComponentProps<typeof Button>): react_jsx_runtime41.JSX.Element | null;
83
86
  interface ColorPickerFormatSelectProps extends Omit<React.ComponentProps<typeof Select>, 'value' | 'onValueChange'>, Pick<React.ComponentProps<typeof SelectTrigger>, 'size' | 'className'> {}
84
87
  declare function ColorPickerFormatSelect(props: ColorPickerFormatSelectProps): react_jsx_runtime41.JSX.Element;
@@ -231,8 +231,17 @@ function hslToRgb(hsl, alpha = 1) {
231
231
  a: alpha
232
232
  };
233
233
  }
234
+ function isTransparent(color) {
235
+ return color.trim().toLowerCase() === "transparent";
236
+ }
234
237
  function parseColorString(value) {
235
238
  const trimmed = value.trim();
239
+ if (isTransparent(trimmed)) return {
240
+ r: 0,
241
+ g: 0,
242
+ b: 0,
243
+ a: 0
244
+ };
236
245
  if (trimmed.startsWith("#")) {
237
246
  const hexMatch = trimmed.match(/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i);
238
247
  if (hexMatch) {
@@ -701,17 +710,20 @@ function ColorPickerAlphaSlider(props) {
701
710
  });
702
711
  }
703
712
  function ColorPickerSwatch(props) {
704
- const { asChild, className,...swatchProps } = props;
713
+ const { asChild, className, color: colorProp, style: styleProp,...swatchProps } = props;
705
714
  const context = useColorPickerContext(SWATCH_NAME);
706
- const color = useStore((state) => state.color);
715
+ const storeColor = useStore((state) => state.color);
707
716
  const format = useStore((state) => state.format);
717
+ const color = React.useMemo(() => {
718
+ if (colorProp === void 0) return storeColor;
719
+ return parseColorString(colorProp) ?? storeColor;
720
+ }, [colorProp, storeColor]);
708
721
  const backgroundStyle = React.useMemo(() => {
709
- if (!color) return { background: "linear-gradient(to bottom right, transparent calc(50% - 1px), hsl(var(--destructive)) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) no-repeat" };
710
722
  const colorString = `rgba(${color.r}, ${color.g}, ${color.b}, ${color.a})`;
711
723
  if (color.a < 1) return { background: `linear-gradient(${colorString}, ${colorString}), repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0% 50% / 8px 8px` };
712
724
  return { backgroundColor: colorString };
713
725
  }, [color]);
714
- const ariaLabel = !color ? "No color selected" : `Current color: ${colorToString(color, format)}`;
726
+ const ariaLabel = `Current color: ${colorToString(color, format)}`;
715
727
  return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
716
728
  role: "img",
717
729
  "aria-label": ariaLabel,
@@ -720,7 +732,8 @@ function ColorPickerSwatch(props) {
720
732
  className: cn("box-border size-8 rounded-sm border shadow-sm", context.disabled && "opacity-50", className),
721
733
  style: {
722
734
  ...backgroundStyle,
723
- forcedColorAdjust: "none"
735
+ forcedColorAdjust: "none",
736
+ ...styleProp
724
737
  }
725
738
  });
726
739
  }
@@ -1,23 +1,23 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
3
3
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
4
4
 
5
5
  //#region src/components/ui/tooltip.d.ts
6
6
  declare function TooltipProvider({
7
7
  delayDuration,
8
8
  ...props
9
- }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime5.JSX.Element;
9
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime8.JSX.Element;
10
10
  declare function Tooltip({
11
11
  ...props
12
- }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime5.JSX.Element;
12
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime8.JSX.Element;
13
13
  declare function TooltipTrigger({
14
14
  ...props
15
- }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime5.JSX.Element;
15
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime8.JSX.Element;
16
16
  declare function TooltipContent({
17
17
  className,
18
18
  sideOffset,
19
19
  children,
20
20
  ...props
21
- }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime5.JSX.Element;
21
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime8.JSX.Element;
22
22
  //#endregion
23
23
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/shadcn",
3
3
  "type": "module",
4
- "version": "1.2.3",
4
+ "version": "1.2.6",
5
5
  "description": "A collection of reusable UI components built with shadcn/ui and Radix UI primitives.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -62,13 +62,13 @@
62
62
  "date-fns": "^4.1.0",
63
63
  "lucide-react": "0.553.0",
64
64
  "react-day-picker": "^9.14.0",
65
- "react-hook-form": "^8.0.0-beta.1",
65
+ "react-hook-form": "^7.55.0",
66
66
  "tailwind-merge": "^3.5.0",
67
67
  "tailwindcss-animate": "^1.0.7",
68
68
  "zod": "^4.3.6"
69
69
  },
70
70
  "devDependencies": {
71
- "@pixpilot/dev-config": "^3.17.0",
71
+ "@pixpilot/dev-config": "^3.20.0",
72
72
  "@tailwindcss/postcss": "^4.2.2",
73
73
  "@testing-library/jest-dom": "^6.9.1",
74
74
  "@testing-library/react": "^16.3.2",
@@ -84,8 +84,8 @@
84
84
  "tsdown": "^0.15.12",
85
85
  "typescript": "^5.9.3",
86
86
  "typescript-eslint": "^8.58.1",
87
- "@internal/prettier-config": "0.0.1",
88
87
  "@internal/eslint-config": "0.3.0",
88
+ "@internal/prettier-config": "0.0.1",
89
89
  "@internal/tsconfig": "0.1.0",
90
90
  "@internal/tsdown-config": "0.1.0",
91
91
  "@internal/vitest-config": "0.1.0"