@next-degree/pickle-shared-js 0.3.25 → 0.3.30

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.
Files changed (73) hide show
  1. package/dist/app/layout.css +30 -13
  2. package/dist/app/layout.css.map +1 -1
  3. package/dist/app/page.cjs +347 -116
  4. package/dist/app/page.cjs.map +1 -1
  5. package/dist/app/page.js +328 -97
  6. package/dist/app/page.js.map +1 -1
  7. package/dist/components/demos/ComboboxDemo.cjs +97 -54
  8. package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
  9. package/dist/components/demos/ComboboxDemo.js +91 -48
  10. package/dist/components/demos/ComboboxDemo.js.map +1 -1
  11. package/dist/components/demos/CounterDemo.cjs +270 -0
  12. package/dist/components/demos/CounterDemo.cjs.map +1 -0
  13. package/dist/components/demos/CounterDemo.d.cts +5 -0
  14. package/dist/components/demos/CounterDemo.d.ts +5 -0
  15. package/dist/components/demos/CounterDemo.js +238 -0
  16. package/dist/components/demos/CounterDemo.js.map +1 -0
  17. package/dist/components/demos/InputDemo.cjs +82 -35
  18. package/dist/components/demos/InputDemo.cjs.map +1 -1
  19. package/dist/components/demos/InputDemo.js +68 -31
  20. package/dist/components/demos/InputDemo.js.map +1 -1
  21. package/dist/components/demos/SelectDemo.cjs +92 -53
  22. package/dist/components/demos/SelectDemo.cjs.map +1 -1
  23. package/dist/components/demos/SelectDemo.js +83 -44
  24. package/dist/components/demos/SelectDemo.js.map +1 -1
  25. package/dist/components/demos/index.cjs +345 -114
  26. package/dist/components/demos/index.cjs.map +1 -1
  27. package/dist/components/demos/index.js +326 -95
  28. package/dist/components/demos/index.js.map +1 -1
  29. package/dist/components/primitives/tooltip.cjs +75 -0
  30. package/dist/components/primitives/tooltip.cjs.map +1 -0
  31. package/dist/components/primitives/tooltip.d.cts +9 -0
  32. package/dist/components/primitives/tooltip.d.ts +9 -0
  33. package/dist/components/primitives/tooltip.js +38 -0
  34. package/dist/components/primitives/tooltip.js.map +1 -0
  35. package/dist/components/ui/Combobox.cjs +83 -42
  36. package/dist/components/ui/Combobox.cjs.map +1 -1
  37. package/dist/components/ui/Combobox.d.cts +5 -2
  38. package/dist/components/ui/Combobox.d.ts +5 -2
  39. package/dist/components/ui/Combobox.js +77 -36
  40. package/dist/components/ui/Combobox.js.map +1 -1
  41. package/dist/components/ui/Counter.cjs +248 -0
  42. package/dist/components/ui/Counter.cjs.map +1 -0
  43. package/dist/components/ui/Counter.d.cts +28 -0
  44. package/dist/components/ui/Counter.d.ts +28 -0
  45. package/dist/components/ui/Counter.js +214 -0
  46. package/dist/components/ui/Counter.js.map +1 -0
  47. package/dist/components/ui/Input.cjs +75 -28
  48. package/dist/components/ui/Input.cjs.map +1 -1
  49. package/dist/components/ui/Input.d.cts +2 -1
  50. package/dist/components/ui/Input.d.ts +2 -1
  51. package/dist/components/ui/Input.js +63 -26
  52. package/dist/components/ui/Input.js.map +1 -1
  53. package/dist/components/ui/Label.cjs +54 -16
  54. package/dist/components/ui/Label.cjs.map +1 -1
  55. package/dist/components/ui/Label.d.cts +2 -1
  56. package/dist/components/ui/Label.d.ts +2 -1
  57. package/dist/components/ui/Label.js +44 -16
  58. package/dist/components/ui/Label.js.map +1 -1
  59. package/dist/components/ui/Select.cjs +83 -46
  60. package/dist/components/ui/Select.cjs.map +1 -1
  61. package/dist/components/ui/Select.d.cts +3 -2
  62. package/dist/components/ui/Select.d.ts +3 -2
  63. package/dist/components/ui/Select.js +75 -38
  64. package/dist/components/ui/Select.js.map +1 -1
  65. package/dist/index.cjs +344 -140
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +1 -0
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +318 -115
  70. package/dist/index.js.map +1 -1
  71. package/dist/styles/globals.css +30 -13
  72. package/dist/styles/globals.css.map +1 -1
  73. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/Counter.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx"],"sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'cva'\nimport { Minus, Plus } from 'lucide-react'\nimport { ChangeEvent, forwardRef, useEffect, useState, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>\ntype CounterVariants = VariantProps<typeof counterVariants>\ntype Props = InputProps &\n CounterVariants & {\n label?: string\n value?: number\n error?: string\n min?: number\n max?: number\n step?: number\n description?: string\n classNames?: { root?: string; input?: string; label?: string }\n onChange?: (n: number) => void\n }\n\nexport const Counter = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props },\n ref\n ) => {\n const [count, setCount] = useState(0)\n\n useEffect(() => {\n setCount(value ?? 0)\n }, [value])\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = parseInt(e.target.value.replace(/\\D/g, ''), 10)\n if (isNaN(newValue)) return\n if (min && newValue < min) {\n onChange?.(min)\n setCount(min)\n return\n }\n if (max && newValue > max) {\n onChange?.(max)\n setCount(max)\n return\n }\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const decrement = () => {\n const proposedValue = count - step\n const newValue = Math.max(min ?? -Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const increment = () => {\n const proposedValue = count + step\n const newValue = Math.min(max ?? Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n return (\n <div\n className={cn('flex w-auto flex-col gap-1', classNames?.root)}\n data-testid={`counter-wrapper-${props.id}`}\n >\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n\n <div className=\"relative flex w-[122px] flex-row items-center\">\n <button\n type=\"button\"\n className=\"absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={decrement}\n >\n <Minus className=\"h-4 w-4 text-green-100\" />\n </button>\n\n <input\n className={cn(counterVariants({ theme }), classNames?.input)}\n ref={ref}\n value={count}\n onChange={handleChange}\n data-testid={`counter-element-${props.id}`}\n {...props}\n />\n\n <button\n type=\"button\"\n className=\"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={increment}\n >\n <Plus className=\"h-4 w-4 text-green-100\" />\n </button>\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nCounter.displayName = 'Counter'\n\nconst counterVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-[122px]',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'text-center',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAuC;AACvC,IAAAA,uBAA4B;AAC5B,mBAAuF;;;ACJvF,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,4CAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,uBAAkC;AAClC,YAAuB;AAcrB,IAAAC,sBAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,eAAe,cAA+B,yBAAQ;;;AClBtD,0BAAyB;AAanB,IAAAC,sBAAA;AALN,SAAS,MAAM,EAAE,MAAM,UAAU,aAAa,WAAW,GAAG,MA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AA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACF;","names":["import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
@@ -0,0 +1,28 @@
1
+ import * as cva_types from 'cva/types';
2
+ import * as React from 'react';
3
+ import { InputHTMLAttributes } from 'react';
4
+ import { VariantProps } from 'cva';
5
+
6
+ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>;
7
+ type CounterVariants = VariantProps<typeof counterVariants>;
8
+ declare const Counter: React.ForwardRefExoticComponent<InputProps & CounterVariants & {
9
+ label?: string;
10
+ value?: number;
11
+ error?: string;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ description?: string;
16
+ classNames?: {
17
+ root?: string;
18
+ input?: string;
19
+ label?: string;
20
+ };
21
+ onChange?: (n: number) => void;
22
+ } & React.RefAttributes<HTMLInputElement>>;
23
+ declare const counterVariants: (props?: ({
24
+ theme?: "light" | "dark" | null | undefined;
25
+ hasIcon?: boolean | null | undefined;
26
+ } & cva_types.ClassProp) | undefined) => string;
27
+
28
+ export { Counter };
@@ -0,0 +1,28 @@
1
+ import * as cva_types from 'cva/types';
2
+ import * as React from 'react';
3
+ import { InputHTMLAttributes } from 'react';
4
+ import { VariantProps } from 'cva';
5
+
6
+ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>;
7
+ type CounterVariants = VariantProps<typeof counterVariants>;
8
+ declare const Counter: React.ForwardRefExoticComponent<InputProps & CounterVariants & {
9
+ label?: string;
10
+ value?: number;
11
+ error?: string;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ description?: string;
16
+ classNames?: {
17
+ root?: string;
18
+ input?: string;
19
+ label?: string;
20
+ };
21
+ onChange?: (n: number) => void;
22
+ } & React.RefAttributes<HTMLInputElement>>;
23
+ declare const counterVariants: (props?: ({
24
+ theme?: "light" | "dark" | null | undefined;
25
+ hasIcon?: boolean | null | undefined;
26
+ } & cva_types.ClassProp) | undefined) => string;
27
+
28
+ export { Counter };
@@ -0,0 +1,214 @@
1
+ "use client";
2
+
3
+ // src/components/ui/Counter.tsx
4
+ import { cva } from "cva";
5
+ import { Minus, Plus } from "lucide-react";
6
+ import { forwardRef as forwardRef2, useEffect, useState } from "react";
7
+
8
+ // src/lib/utils.ts
9
+ import { clsx } from "clsx";
10
+ import { twMerge } from "tailwind-merge";
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+
15
+ // src/components/ui/ErrorMessage.tsx
16
+ import { jsx } from "react/jsx-runtime";
17
+ function ErrorMessage({ message, className, ...props }) {
18
+ if (!message) return null;
19
+ return /* @__PURE__ */ jsx("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
20
+ }
21
+ var ErrorMessage_default = ErrorMessage;
22
+
23
+ // src/components/primitives/tooltip.tsx
24
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
25
+ import * as React from "react";
26
+ import { jsx as jsx2 } from "react/jsx-runtime";
27
+ var TooltipProvider = TooltipPrimitive.Provider;
28
+ var Tooltip = TooltipPrimitive.Root;
29
+ var TooltipTrigger = TooltipPrimitive.Trigger;
30
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
31
+ TooltipPrimitive.Content,
32
+ {
33
+ ref,
34
+ sideOffset,
35
+ className: cn(
36
+ "z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
37
+ className
38
+ ),
39
+ ...props
40
+ }
41
+ ));
42
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
43
+
44
+ // src/components/ui/Label.tsx
45
+ import { InfoIcon } from "lucide-react";
46
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
47
+ function Label({ text, required, description, className, ...props }) {
48
+ if (!text) return null;
49
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row gap-1", children: [
50
+ /* @__PURE__ */ jsxs(
51
+ "label",
52
+ {
53
+ className: cn(
54
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
55
+ className
56
+ ),
57
+ ...props,
58
+ children: [
59
+ text,
60
+ required && /* @__PURE__ */ jsx3("span", { className: "text-red-600", children: "\xA0*" })
61
+ ]
62
+ }
63
+ ),
64
+ !!description && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
65
+ /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(InfoIcon, { className: "h-4 w-4" }) }),
66
+ /* @__PURE__ */ jsx3(TooltipContent, { className: "max-w-48", children: description })
67
+ ] }) })
68
+ ] });
69
+ }
70
+ var Label_default = Label;
71
+
72
+ // src/components/ui/Counter.tsx
73
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
74
+ var Counter = forwardRef2(
75
+ ({ label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props }, ref) => {
76
+ const [count, setCount] = useState(0);
77
+ useEffect(() => {
78
+ setCount(value ?? 0);
79
+ }, [value]);
80
+ const handleChange = (e) => {
81
+ const newValue = parseInt(e.target.value.replace(/\D/g, ""), 10);
82
+ if (isNaN(newValue)) return;
83
+ if (min && newValue < min) {
84
+ onChange?.(min);
85
+ setCount(min);
86
+ return;
87
+ }
88
+ if (max && newValue > max) {
89
+ onChange?.(max);
90
+ setCount(max);
91
+ return;
92
+ }
93
+ onChange?.(newValue);
94
+ setCount(newValue);
95
+ };
96
+ const decrement = () => {
97
+ const proposedValue = count - step;
98
+ const newValue = Math.max(min ?? -Infinity, proposedValue);
99
+ onChange?.(newValue);
100
+ setCount(newValue);
101
+ };
102
+ const increment = () => {
103
+ const proposedValue = count + step;
104
+ const newValue = Math.min(max ?? Infinity, proposedValue);
105
+ onChange?.(newValue);
106
+ setCount(newValue);
107
+ };
108
+ return /* @__PURE__ */ jsxs2(
109
+ "div",
110
+ {
111
+ className: cn("flex w-auto flex-col gap-1", classNames?.root),
112
+ "data-testid": `counter-wrapper-${props.id}`,
113
+ children: [
114
+ label && /* @__PURE__ */ jsx4(
115
+ Label_default,
116
+ {
117
+ text: label,
118
+ htmlFor: props.name,
119
+ required: props.required,
120
+ description,
121
+ className: classNames?.label
122
+ }
123
+ ),
124
+ /* @__PURE__ */ jsxs2("div", { className: "relative flex w-[122px] flex-row items-center", children: [
125
+ /* @__PURE__ */ jsx4(
126
+ "button",
127
+ {
128
+ type: "button",
129
+ className: "absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
130
+ onClick: decrement,
131
+ children: /* @__PURE__ */ jsx4(Minus, { className: "h-4 w-4 text-green-100" })
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsx4(
135
+ "input",
136
+ {
137
+ className: cn(counterVariants({ theme }), classNames?.input),
138
+ ref,
139
+ value: count,
140
+ onChange: handleChange,
141
+ "data-testid": `counter-element-${props.id}`,
142
+ ...props
143
+ }
144
+ ),
145
+ /* @__PURE__ */ jsx4(
146
+ "button",
147
+ {
148
+ type: "button",
149
+ className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
150
+ onClick: increment,
151
+ children: /* @__PURE__ */ jsx4(Plus, { className: "h-4 w-4 text-green-100" })
152
+ }
153
+ )
154
+ ] }),
155
+ /* @__PURE__ */ jsx4(ErrorMessage_default, { message: error })
156
+ ]
157
+ }
158
+ );
159
+ }
160
+ );
161
+ Counter.displayName = "Counter";
162
+ var counterVariants = cva(
163
+ [
164
+ "border-input",
165
+ "placeholder:text-muted-foreground",
166
+ "focus-visible:ring-ring",
167
+ "inline-flex",
168
+ "w-[122px]",
169
+ "h-11",
170
+ "items-center",
171
+ "justify-start",
172
+ "gap-3",
173
+ "rounded-lg",
174
+ "bg-transparent",
175
+ "px-3",
176
+ "pt-0.5",
177
+ "text-sm",
178
+ "text-center",
179
+ "shadow-sm",
180
+ "ring-grey-50",
181
+ "transition-colors",
182
+ "focus-visible:outline-none",
183
+ "focus-visible:ring-1",
184
+ "disabled:cursor-not-allowed",
185
+ "disabled:opacity-50",
186
+ "appearance-none",
187
+ "[&::-webkit-search-cancel-button]:appearance-none",
188
+ "[&::-webkit-search-decoration]:appearance-none",
189
+ "[&::-webkit-search-results-button]:appearance-none",
190
+ "[&::-webkit-search-results-decoration]:appearance-none",
191
+ "[&::-ms-clear]:display-none",
192
+ "[&::-ms-reveal]:display-none"
193
+ ],
194
+ {
195
+ variants: {
196
+ theme: {
197
+ light: "text-grey-80 border",
198
+ dark: "text-white"
199
+ },
200
+ hasIcon: {
201
+ false: "pl-3",
202
+ true: "pl-8"
203
+ }
204
+ },
205
+ defaultVariants: {
206
+ theme: "light",
207
+ hasIcon: false
208
+ }
209
+ }
210
+ );
211
+ export {
212
+ Counter
213
+ };
214
+ //# sourceMappingURL=Counter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ui/Counter.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx"],"sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'cva'\nimport { Minus, Plus } from 'lucide-react'\nimport { ChangeEvent, forwardRef, useEffect, useState, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>\ntype CounterVariants = VariantProps<typeof counterVariants>\ntype Props = InputProps &\n CounterVariants & {\n label?: string\n value?: number\n error?: string\n min?: number\n max?: number\n step?: number\n description?: string\n classNames?: { root?: string; input?: string; label?: string }\n onChange?: (n: number) => void\n }\n\nexport const Counter = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, min, max, step = 1, description, theme, value, classNames, onChange, ...props },\n ref\n ) => {\n const [count, setCount] = useState(0)\n\n useEffect(() => {\n setCount(value ?? 0)\n }, [value])\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = parseInt(e.target.value.replace(/\\D/g, ''), 10)\n if (isNaN(newValue)) return\n if (min && newValue < min) {\n onChange?.(min)\n setCount(min)\n return\n }\n if (max && newValue > max) {\n onChange?.(max)\n setCount(max)\n return\n }\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const decrement = () => {\n const proposedValue = count - step\n const newValue = Math.max(min ?? -Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n const increment = () => {\n const proposedValue = count + step\n const newValue = Math.min(max ?? Infinity, proposedValue)\n onChange?.(newValue)\n setCount(newValue)\n }\n\n return (\n <div\n className={cn('flex w-auto flex-col gap-1', classNames?.root)}\n data-testid={`counter-wrapper-${props.id}`}\n >\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n\n <div className=\"relative flex w-[122px] flex-row items-center\">\n <button\n type=\"button\"\n className=\"absolute inset-y-0 left-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={decrement}\n >\n <Minus className=\"h-4 w-4 text-green-100\" />\n </button>\n\n <input\n className={cn(counterVariants({ theme }), classNames?.input)}\n ref={ref}\n value={count}\n onChange={handleChange}\n data-testid={`counter-element-${props.id}`}\n {...props}\n />\n\n <button\n type=\"button\"\n className=\"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20\"\n onClick={increment}\n >\n <Plus className=\"h-4 w-4 text-green-100\" />\n </button>\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nCounter.displayName = 'Counter'\n\nconst counterVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-[122px]',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'text-center',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n"],"mappings":";;;AAEA,SAAS,WAA8B;AACvC,SAAS,OAAO,YAAY;AAC5B,SAAsB,cAAAA,aAAY,WAAW,gBAA0C;;;ACJvF,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,oBAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,YAAY,sBAAsB;AAClC,YAAY,WAAW;AAcrB,gBAAAC,YAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C,gBAAAA;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,eAAe,cAA+B,yBAAQ;;;AClBtD,SAAS,gBAAgB;AAan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AAa,SAAS,OAAO;AAAA;AAAA;AAAA,IAChC;AAAA,EAEJ;AACF;AACA,QAAQ,cAAc;AAEtB,IAAM,kBAAkB;AAAA,EACtB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACF;","names":["forwardRef","jsx","jsx","jsx","jsxs","forwardRef"]}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/components/ui/Input.tsx
@@ -24,7 +34,7 @@ __export(Input_exports, {
24
34
  });
25
35
  module.exports = __toCommonJS(Input_exports);
26
36
  var import_cva = require("cva");
27
- var import_lucide_react = require("lucide-react");
37
+ var import_lucide_react2 = require("lucide-react");
28
38
  var import_react = require("react");
29
39
 
30
40
  // src/lib/utils.ts
@@ -42,49 +52,86 @@ function ErrorMessage({ message, className, ...props }) {
42
52
  }
43
53
  var ErrorMessage_default = ErrorMessage;
44
54
 
45
- // src/components/ui/Label.tsx
55
+ // src/components/primitives/tooltip.tsx
56
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
57
+ var React = __toESM(require("react"), 1);
46
58
  var import_jsx_runtime2 = require("react/jsx-runtime");
47
- function Label({ text, required, className, ...props }) {
59
+ var TooltipProvider = TooltipPrimitive.Provider;
60
+ var Tooltip = TooltipPrimitive.Root;
61
+ var TooltipTrigger = TooltipPrimitive.Trigger;
62
+ var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
63
+ TooltipPrimitive.Content,
64
+ {
65
+ ref,
66
+ sideOffset,
67
+ className: cn(
68
+ "z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
69
+ className
70
+ ),
71
+ ...props
72
+ }
73
+ ));
74
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
75
+
76
+ // src/components/ui/Label.tsx
77
+ var import_lucide_react = require("lucide-react");
78
+ var import_jsx_runtime3 = require("react/jsx-runtime");
79
+ function Label({ text, required, description, className, ...props }) {
48
80
  if (!text) return null;
49
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
50
- "label",
51
- {
52
- className: cn(
53
- "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
54
- className
55
- ),
56
- ...props,
57
- children: [
58
- text,
59
- required && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-red-600", children: "\xA0*" })
60
- ]
61
- }
62
- );
81
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex w-full flex-row gap-1", children: [
82
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
83
+ "label",
84
+ {
85
+ className: cn(
86
+ "text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
87
+ className
88
+ ),
89
+ ...props,
90
+ children: [
91
+ text,
92
+ required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-red-600", children: "\xA0*" })
93
+ ]
94
+ }
95
+ ),
96
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Tooltip, { children: [
97
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.InfoIcon, { className: "h-4 w-4" }) }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipContent, { className: "max-w-48", children: description })
99
+ ] }) })
100
+ ] });
63
101
  }
64
102
  var Label_default = Label;
65
103
 
66
104
  // src/components/ui/Input.tsx
67
- var import_jsx_runtime3 = require("react/jsx-runtime");
105
+ var import_jsx_runtime4 = require("react/jsx-runtime");
68
106
  var Input = (0, import_react.forwardRef)(
69
- ({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
107
+ ({ label, error, description, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
70
108
  const handleClear = () => {
71
109
  onChange?.({ target: { value: "" } });
72
110
  onClear?.();
73
111
  };
74
- const IconComponent = icon && import_lucide_react.icons[icon];
112
+ const IconComponent = icon && import_lucide_react2.icons[icon];
75
113
  const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
76
114
  const hasIcon = !!icon;
77
115
  const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
78
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
79
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
80
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative flex flex-row items-center", children: [
81
- IconComponent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
116
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "group flex w-full flex-col gap-1", "data-testid": `input-wrapper-${props.id}`, children: [
117
+ label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
118
+ Label_default,
119
+ {
120
+ text: label,
121
+ htmlFor: props.name,
122
+ required: props.required,
123
+ description,
124
+ className: classNames?.label
125
+ }
126
+ ),
127
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex flex-row items-center", children: [
128
+ IconComponent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
82
129
  IconComponent,
83
130
  {
84
131
  className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
85
132
  }
86
133
  ),
87
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
134
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
88
135
  "input",
89
136
  {
90
137
  className: cn(inputVariants({ theme, hasIcon })),
@@ -96,8 +143,8 @@ var Input = (0, import_react.forwardRef)(
96
143
  ...props
97
144
  }
98
145
  ),
99
- hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
100
- import_lucide_react.X,
146
+ hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
147
+ import_lucide_react2.X,
101
148
  {
102
149
  className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
103
150
  onClick: handleClear,
@@ -105,7 +152,7 @@ var Input = (0, import_react.forwardRef)(
105
152
  }
106
153
  )
107
154
  ] }),
108
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
155
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorMessage_default, { message: error })
109
156
  ] });
110
157
  }
111
158
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/Input.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'cva'\nimport { icons, X } from 'lucide-react'\nimport { type ChangeEvent, forwardRef, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {\n label?: string\n error?: string\n icon?: keyof typeof icons\n onClear?: () => void\n classNames?: { label?: string }\n}\n\nconst Input = forwardRef<HTMLInputElement, Props>(\n ({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {\n const handleClear = () => {\n onChange?.({ target: { value: '' } } as ChangeEvent<HTMLInputElement>)\n onClear?.()\n }\n\n const IconComponent = icon && icons[icon]\n\n const placeholder = props.placeholder ?? (icon === 'Search' ? 'Search...' : '')\n const hasIcon = !!icon\n\n const iconColor = theme === 'dark' ? 'text-white' : 'text-grey-80'\n\n return (\n <div className=\"group flex w-full flex-col\" data-testid={`input-wrapper-${props.id}`}>\n {label && (\n <Label text={label} htmlFor={props.name} className={cn('body mb-1', classNames?.label)} />\n )}\n <div className=\"relative flex flex-row items-center\">\n {IconComponent && (\n <IconComponent\n className={`absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`}\n />\n )}\n <input\n className={cn(inputVariants({ theme, hasIcon }))}\n ref={ref}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n data-testid={`input-element-${props.id}`}\n {...props}\n />\n {hasIcon && value && (\n <X\n className={`absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`}\n onClick={handleClear}\n data-testid=\"clear-button\"\n />\n )}\n </div>\n\n <ErrorMessage message={error} className=\"mt-1\" />\n </div>\n )\n }\n)\nInput.displayName = 'Input'\n\nconst inputVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-full',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n\nexport default Input\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n}\n\nfunction Label({ text, required, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n )\n}\n\nexport default Label\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuC;AACvC,0BAAyB;AACzB,mBAAuE;;;ACFvE,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,4CAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;ACLX,IAAAA,sBAAA;AAJJ,SAAS,MAAM,EAAE,MAAM,UAAU,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,KAAM,QAAO;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAA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;AACF;AACA,MAAM,cAAc;AAEpB,IAAM,oBAAgB;AAAA,EACpB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,SAAS;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;","names":["import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/ui/Input.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'cva'\nimport { icons, X } from 'lucide-react'\nimport { type ChangeEvent, forwardRef, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {\n label?: string\n error?: string\n icon?: keyof typeof icons\n description?: string\n classNames?: { label?: string }\n onClear?: () => void\n}\n\nconst Input = forwardRef<HTMLInputElement, Props>(\n (\n { label, error, description, theme, icon, onClear, value, onChange, classNames, ...props },\n ref\n ) => {\n const handleClear = () => {\n onChange?.({ target: { value: '' } } as ChangeEvent<HTMLInputElement>)\n onClear?.()\n }\n\n const IconComponent = icon && icons[icon]\n\n const placeholder = props.placeholder ?? (icon === 'Search' ? 'Search...' : '')\n const hasIcon = !!icon\n\n const iconColor = theme === 'dark' ? 'text-white' : 'text-grey-80'\n\n return (\n <div className=\"group flex w-full flex-col gap-1\" data-testid={`input-wrapper-${props.id}`}>\n {label && (\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n )}\n <div className=\"relative flex flex-row items-center\">\n {IconComponent && (\n <IconComponent\n className={`absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`}\n />\n )}\n <input\n className={cn(inputVariants({ theme, hasIcon }))}\n ref={ref}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n data-testid={`input-element-${props.id}`}\n {...props}\n />\n {hasIcon && value && (\n <X\n className={`absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`}\n onClick={handleClear}\n data-testid=\"clear-button\"\n />\n )}\n </div>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nInput.displayName = 'Input'\n\nconst inputVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-full',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n\nexport default Input\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50',\n className\n )}\n {...props}\n />\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { InfoIcon } from 'lucide-react'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n required?: boolean\n description?: string\n}\n\nfunction Label({ text, required, description, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <div className=\"flex w-full flex-row gap-1\">\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n {required && <span className=\"text-red-600\">&nbsp;*</span>}\n </label>\n\n {!!description && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <InfoIcon className=\"h-4 w-4\" />\n </TooltipTrigger>\n <TooltipContent className=\"max-w-48\">{description}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )\n}\n\nexport default Label\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuC;AACvC,IAAAA,uBAAyB;AACzB,mBAAuE;;;ACFvE,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACOI;AAJJ,SAAS,aAAa,EAAE,SAAS,WAAW,GAAG,MAAM,GAAoB;AACvE,MAAI,CAAC,QAAS,QAAO;AAErB,SACE,4CAAC,OAAE,WAAW,GAAG,6BAA6B,SAAS,GAAI,GAAG,OAC3D,mBACH;AAEJ;AAEA,IAAO,uBAAQ;;;AChBf,uBAAkC;AAClC,YAAuB;AAcrB,IAAAC,sBAAA;AAVF,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,GAAG,MAAM,GAAG,QAC1C;AAAA,EAAkB;AAAA,EAAjB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F;AAEA,IAAO,gBAAQ;","names":["import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
@@ -8,10 +8,11 @@ interface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<type
8
8
  label?: string;
9
9
  error?: string;
10
10
  icon?: keyof typeof icons;
11
- onClear?: () => void;
11
+ description?: string;
12
12
  classNames?: {
13
13
  label?: string;
14
14
  };
15
+ onClear?: () => void;
15
16
  }
16
17
  declare const Input: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
17
18
  declare const inputVariants: (props?: ({
@@ -8,10 +8,11 @@ interface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<type
8
8
  label?: string;
9
9
  error?: string;
10
10
  icon?: keyof typeof icons;
11
- onClear?: () => void;
11
+ description?: string;
12
12
  classNames?: {
13
13
  label?: string;
14
14
  };
15
+ onClear?: () => void;
15
16
  }
16
17
  declare const Input: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
17
18
  declare const inputVariants: (props?: ({