@pixpilot/shadcn 1.2.6 → 1.3.0

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_runtime5 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime9 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_runtime5.JSX.Element;
14
+ }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>): react_jsx_runtime9.JSX.Element;
15
15
  declare function AlertTitle({
16
16
  className,
17
17
  ...props
18
- }: React.ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
18
+ }: React.ComponentProps<'div'>): react_jsx_runtime9.JSX.Element;
19
19
  declare function AlertDescription({
20
20
  className,
21
21
  ...props
22
- }: React.ComponentProps<'div'>): react_jsx_runtime5.JSX.Element;
22
+ }: React.ComponentProps<'div'>): react_jsx_runtime9.JSX.Element;
23
23
  //#endregion
24
24
  export { Alert, AlertDescription, AlertTitle };
@@ -83,7 +83,9 @@ interface ColorPickerSwatchProps extends Omit<DivProps, 'color'> {
83
83
  }
84
84
  declare function ColorPickerSwatch(props: ColorPickerSwatchProps): react_jsx_runtime41.JSX.Element;
85
85
  declare function ColorPickerEyeDropper(props: React.ComponentProps<typeof Button>): react_jsx_runtime41.JSX.Element | null;
86
- interface ColorPickerFormatSelectProps extends Omit<React.ComponentProps<typeof Select>, 'value' | 'onValueChange'>, Pick<React.ComponentProps<typeof SelectTrigger>, 'size' | 'className'> {}
86
+ interface ColorPickerFormatSelectProps extends Omit<React.ComponentProps<typeof Select>, 'value' | 'onValueChange'>, Pick<React.ComponentProps<typeof SelectTrigger>, 'size' | 'className'> {
87
+ id?: string;
88
+ }
87
89
  declare function ColorPickerFormatSelect(props: ColorPickerFormatSelectProps): react_jsx_runtime41.JSX.Element;
88
90
  interface ColorPickerInputProps extends Omit<React.ComponentProps<typeof Input>, 'value' | 'onChange' | 'color'> {
89
91
  withoutAlpha?: boolean;
@@ -37,6 +37,9 @@ const colorFormats = [
37
37
  "hsl",
38
38
  "hsb"
39
39
  ];
40
+ function getId(baseId, suffix) {
41
+ return baseId === void 0 ? void 0 : `${baseId}-${suffix}`;
42
+ }
40
43
  function hexToRgb(hex, alpha) {
41
44
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
42
45
  return result ? {
@@ -716,14 +719,15 @@ function ColorPickerSwatch(props) {
716
719
  const format = useStore((state) => state.format);
717
720
  const color = React.useMemo(() => {
718
721
  if (colorProp === void 0) return storeColor;
719
- return parseColorString(colorProp) ?? storeColor;
722
+ return parseColorString(colorProp);
720
723
  }, [colorProp, storeColor]);
721
724
  const backgroundStyle = React.useMemo(() => {
725
+ if (!color) return { backgroundColor: colorProp };
722
726
  const colorString = `rgba(${color.r}, ${color.g}, ${color.b}, ${color.a})`;
723
727
  if (color.a < 1) return { background: `linear-gradient(${colorString}, ${colorString}), repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0% 50% / 8px 8px` };
724
728
  return { backgroundColor: colorString };
725
- }, [color]);
726
- const ariaLabel = `Current color: ${colorToString(color, format)}`;
729
+ }, [color, colorProp]);
730
+ const ariaLabel = color ? `Current color: ${colorToString(color, format)}` : colorProp ? `Current color: ${colorProp}` : "No color selected";
727
731
  return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
728
732
  role: "img",
729
733
  "aria-label": ariaLabel,
@@ -771,7 +775,7 @@ function ColorPickerEyeDropper(props) {
771
775
  });
772
776
  }
773
777
  function ColorPickerFormatSelect(props) {
774
- const { size, disabled, className,...selectProps } = props;
778
+ const { id, size, disabled, className,...selectProps } = props;
775
779
  const context = useColorPickerContext(FORMAT_SELECT_NAME);
776
780
  const store = useStoreContext(FORMAT_SELECT_NAME);
777
781
  const isDisabled = disabled || context.disabled;
@@ -786,11 +790,13 @@ function ColorPickerFormatSelect(props) {
786
790
  onValueChange: onFormatChange,
787
791
  disabled: isDisabled,
788
792
  children: [/* @__PURE__ */ jsx(SelectTrigger, {
793
+ id,
789
794
  "data-slot": "color-picker-format-select-trigger",
790
795
  size: size ?? "sm",
791
796
  className: cn(className),
792
797
  children: /* @__PURE__ */ jsx(SelectValue, {})
793
798
  }), /* @__PURE__ */ jsx(SelectContent, { children: colorFormats.map((format$1) => /* @__PURE__ */ jsx(SelectItem, {
799
+ id: getId(id, `option-${format$1}`),
794
800
  value: format$1,
795
801
  children: format$1.toUpperCase()
796
802
  }, format$1)) })]
@@ -1,23 +1,23 @@
1
1
  import * as React from "react";
2
- import * as react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime5 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_runtime8.JSX.Element;
9
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime5.JSX.Element;
10
10
  declare function Tooltip({
11
11
  ...props
12
- }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime8.JSX.Element;
12
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime5.JSX.Element;
13
13
  declare function TooltipTrigger({
14
14
  ...props
15
- }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime8.JSX.Element;
15
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime5.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_runtime8.JSX.Element;
21
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime5.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.6",
4
+ "version": "1.3.0",
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",