@next-degree/pickle-shared-js 0.7.52 → 0.9.2
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/components/jobPost/JobDescription.cjs +2 -1
- package/dist/components/jobPost/JobDescription.cjs.map +1 -1
- package/dist/components/jobPost/JobDescription.js +2 -1
- package/dist/components/jobPost/JobDescription.js.map +1 -1
- package/dist/components/jobPost/JobPost.cjs +2 -1
- package/dist/components/jobPost/JobPost.cjs.map +1 -1
- package/dist/components/jobPost/JobPost.d.cts +1 -1
- package/dist/components/jobPost/JobPost.d.ts +1 -1
- package/dist/components/jobPost/JobPost.js +2 -1
- package/dist/components/jobPost/JobPost.js.map +1 -1
- package/dist/components/primitives/command.d.cts +7 -7
- package/dist/components/primitives/command.d.ts +7 -7
- package/dist/components/primitives/input-otp.d.cts +2 -2
- package/dist/components/primitives/input-otp.d.ts +2 -2
- package/dist/components/primitives/radio-group.cjs +74 -0
- package/dist/components/primitives/radio-group.cjs.map +1 -0
- package/dist/components/primitives/radio-group.d.cts +9 -0
- package/dist/components/primitives/radio-group.d.ts +9 -0
- package/dist/components/primitives/radio-group.js +39 -0
- package/dist/components/primitives/radio-group.js.map +1 -0
- package/dist/components/ui/Button.cjs +2 -1
- package/dist/components/ui/Button.cjs.map +1 -1
- package/dist/components/ui/Button.d.cts +1 -1
- package/dist/components/ui/Button.d.ts +1 -1
- package/dist/components/ui/Button.js +2 -1
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Checkbox.cjs +38 -13
- package/dist/components/ui/Checkbox.cjs.map +1 -1
- package/dist/components/ui/Checkbox.d.cts +2 -1
- package/dist/components/ui/Checkbox.d.ts +2 -1
- package/dist/components/ui/Checkbox.js +31 -11
- package/dist/components/ui/Checkbox.js.map +1 -1
- package/dist/components/ui/Combobox.cjs +62 -41
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.js +53 -32
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/DatePicker.cjs +133 -149
- package/dist/components/ui/DatePicker.cjs.map +1 -1
- package/dist/components/ui/DatePicker.js +132 -148
- package/dist/components/ui/DatePicker.js.map +1 -1
- package/dist/components/ui/ListItem.cjs +40 -21
- package/dist/components/ui/ListItem.cjs.map +1 -1
- package/dist/components/ui/ListItem.js +36 -17
- package/dist/components/ui/ListItem.js.map +1 -1
- package/dist/components/ui/Radio.cjs +177 -0
- package/dist/components/ui/Radio.cjs.map +1 -0
- package/dist/components/ui/Radio.d.cts +27 -0
- package/dist/components/ui/Radio.d.ts +27 -0
- package/dist/components/ui/Radio.js +142 -0
- package/dist/components/ui/Radio.js.map +1 -0
- package/dist/components/ui/ReadMore.cjs +2 -1
- package/dist/components/ui/ReadMore.cjs.map +1 -1
- package/dist/components/ui/ReadMore.js +2 -1
- package/dist/components/ui/ReadMore.js.map +1 -1
- package/dist/components/ui/Select.cjs +48 -24
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.js +49 -25
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/components/ui/Switch.cjs +83 -0
- package/dist/components/ui/Switch.cjs.map +1 -0
- package/dist/components/ui/Switch.d.cts +10 -0
- package/dist/components/ui/Switch.d.ts +10 -0
- package/dist/components/ui/Switch.js +48 -0
- package/dist/components/ui/Switch.js.map +1 -0
- package/dist/components/ui/buttonShadcn.cjs +2 -9
- package/dist/components/ui/buttonShadcn.cjs.map +1 -1
- package/dist/components/ui/buttonShadcn.d.cts +2 -2
- package/dist/components/ui/buttonShadcn.d.ts +2 -2
- package/dist/components/ui/buttonShadcn.js +2 -9
- package/dist/components/ui/buttonShadcn.js.map +1 -1
- package/dist/components/ui/calendar.cjs +7 -17
- package/dist/components/ui/calendar.cjs.map +1 -1
- package/dist/components/ui/calendar.js +7 -17
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/{displayText-6TMMBOmQ.d.cts → displayText-ca_ofoAC.d.cts} +2 -2
- package/dist/{displayText-BCC_oy5I.d.ts → displayText-eoAHqSNz.d.ts} +2 -2
- package/dist/hooks/useDisplayText.d.cts +3 -3
- package/dist/hooks/useDisplayText.d.ts +3 -3
- package/dist/index.cjs +454 -327
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +434 -309
- package/dist/index.js.map +1 -1
- package/dist/lib/locations.d.cts +2 -2
- package/dist/lib/locations.d.ts +2 -2
- package/dist/lib/mappings.d.cts +3 -3
- package/dist/lib/mappings.d.ts +3 -3
- package/dist/lib/salaryRange.d.cts +1 -1
- package/dist/lib/salaryRange.d.ts +1 -1
- package/dist/services/displayText.d.cts +3 -3
- package/dist/services/displayText.d.ts +3 -3
- package/dist/styles/globals.css +78 -0
- package/dist/styles/globals.css.map +1 -1
- package/dist/types/data/company_service_latest.d.cts +1 -1
- package/dist/types/data/company_service_latest.d.ts +1 -1
- package/dist/types/data/job_posting_service_latest.d.cts +1 -1
- package/dist/types/data/job_posting_service_latest.d.ts +1 -1
- package/dist/types/data/shared_pickle_output_latest.d.cts +1 -1
- package/dist/types/data/shared_pickle_output_latest.d.ts +1 -1
- package/package.json +7 -10
- package/dist/{company_service_latest-BUKbZgpZ.d.cts → company_service_latest-CRQFzMep.d.cts} +366 -366
- package/dist/{company_service_latest-BUKbZgpZ.d.ts → company_service_latest-CRQFzMep.d.ts} +366 -366
- package/dist/{job_posting_service_latest-2KcpupDl.d.cts → job_posting_service_latest-BOVbz68F.d.cts} +324 -324
- package/dist/{job_posting_service_latest-2KcpupDl.d.ts → job_posting_service_latest-BOVbz68F.d.ts} +324 -324
- package/dist/{shared_pickle_output_latest-D2n-PRlx.d.cts → shared_pickle_output_latest-DKOmTyYk.d.cts} +20 -20
- package/dist/{shared_pickle_output_latest-D2n-PRlx.d.ts → shared_pickle_output_latest-DKOmTyYk.d.ts} +20 -20
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/components/ui/Radio.tsx
|
|
2
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
3
|
+
|
|
4
|
+
// src/components/primitives/radio-group.tsx
|
|
5
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
6
|
+
|
|
7
|
+
// src/lib/utils.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// src/components/primitives/radio-group.tsx
|
|
15
|
+
import { forwardRef } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var RadioGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className, ...props, ref }));
|
|
18
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
19
|
+
var RadioGroupItem = forwardRef(({ className, children, ...props }, ref) => {
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center gap-2", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
RadioGroupPrimitive.Item,
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: cn(
|
|
26
|
+
"focus-visible:ring-ring peer aspect-square h-4 rounded-full border border-grey-10 shadow outline outline-1 outline-offset-2 outline-transparent focus:outline-none focus:outline-purple-100 focus-visible:ring-1 active:border-green-80 disabled:cursor-not-allowed disabled:opacity-50 group-hover:border-grey-20 data-[state=checked]:border-4 data-[disabled]:border-grey-20 data-[state=checked]:border-green-90 data-[disabled]:bg-grey-10 data-[state=checked]:group-hover:border-green-80",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsx("label", { htmlFor: props.id, className: "text-sm peer-data-[disabled]:text-grey-40", children })
|
|
33
|
+
] });
|
|
34
|
+
});
|
|
35
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
36
|
+
|
|
37
|
+
// src/components/ui/ErrorMessage.tsx
|
|
38
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
39
|
+
function ErrorMessage({ message, className, ...props }) {
|
|
40
|
+
if (!message) return null;
|
|
41
|
+
return /* @__PURE__ */ jsx2("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
|
|
42
|
+
}
|
|
43
|
+
var ErrorMessage_default = ErrorMessage;
|
|
44
|
+
|
|
45
|
+
// src/components/ui/Label.tsx
|
|
46
|
+
import { InfoIcon } from "lucide-react";
|
|
47
|
+
|
|
48
|
+
// src/components/primitives/tooltip.tsx
|
|
49
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
50
|
+
import * as React from "react";
|
|
51
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
52
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
53
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
54
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
55
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx3(
|
|
56
|
+
TooltipPrimitive.Content,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
sideOffset,
|
|
60
|
+
className: cn(
|
|
61
|
+
"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",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
...props
|
|
65
|
+
}
|
|
66
|
+
));
|
|
67
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
68
|
+
|
|
69
|
+
// src/components/ui/Label.tsx
|
|
70
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
71
|
+
function Label({ text, required, description, className, ...props }) {
|
|
72
|
+
if (!text) return null;
|
|
73
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-row gap-1", children: [
|
|
74
|
+
/* @__PURE__ */ jsxs2(
|
|
75
|
+
"label",
|
|
76
|
+
{
|
|
77
|
+
className: cn(
|
|
78
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
79
|
+
className
|
|
80
|
+
),
|
|
81
|
+
...props,
|
|
82
|
+
children: [
|
|
83
|
+
text,
|
|
84
|
+
required && /* @__PURE__ */ jsx4("span", { className: "text-red-600", children: "\xA0*" })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
!!description && /* @__PURE__ */ jsx4(TooltipProvider, { children: /* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx4(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx4(InfoIcon, { className: "h-4 w-4" }) }),
|
|
90
|
+
/* @__PURE__ */ jsx4(TooltipContent, { className: "max-w-48", children: description })
|
|
91
|
+
] }) })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
var Label_default = Label;
|
|
95
|
+
|
|
96
|
+
// src/components/ui/Radio.tsx
|
|
97
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
98
|
+
var Radio = forwardRef3(
|
|
99
|
+
({
|
|
100
|
+
label,
|
|
101
|
+
error,
|
|
102
|
+
description,
|
|
103
|
+
options,
|
|
104
|
+
classNames,
|
|
105
|
+
onChange: handleValueChange,
|
|
106
|
+
orientation,
|
|
107
|
+
...props
|
|
108
|
+
}, ref) => {
|
|
109
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-1", classNames?.root), children: [
|
|
110
|
+
/* @__PURE__ */ jsx5(Label_default, { text: label, description, required: props.required }),
|
|
111
|
+
/* @__PURE__ */ jsx5(
|
|
112
|
+
RadioGroup,
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
className: cn(
|
|
116
|
+
"flex text-sm",
|
|
117
|
+
orientation === "vertical" ? "flex-col gap-2" : "flex-row gap-4",
|
|
118
|
+
classNames?.group
|
|
119
|
+
),
|
|
120
|
+
onValueChange: handleValueChange,
|
|
121
|
+
...props,
|
|
122
|
+
children: options?.map(({ id, title, value }) => /* @__PURE__ */ jsx5(
|
|
123
|
+
RadioGroupItem,
|
|
124
|
+
{
|
|
125
|
+
value,
|
|
126
|
+
id: `radio-group-item-${title}`,
|
|
127
|
+
className: classNames?.item,
|
|
128
|
+
children: title
|
|
129
|
+
},
|
|
130
|
+
id
|
|
131
|
+
))
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx5(ErrorMessage_default, { message: error })
|
|
135
|
+
] });
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
Radio.displayName = "Radio";
|
|
139
|
+
export {
|
|
140
|
+
Radio
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=Radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/Radio.tsx","../../../src/components/primitives/radio-group.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/primitives/tooltip.tsx"],"sourcesContent":["import { ComponentProps, forwardRef } from 'react'\nimport { RadioGroup, RadioGroupItem } from '@/components/primitives/radio-group'\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ntype RadioItem = { id: string | number; title: string; value: string }\ntype RadioClassNames = { root?: string; group?: string; item?: string }\ntype RadioGroupProps = Omit<ComponentProps<typeof RadioGroup>, 'onValueChange'>\nexport type RadioProps = RadioGroupProps & {\n label?: string\n error?: string\n description?: string\n classNames?: RadioClassNames\n options?: RadioItem[]\n onChange?: (value: string) => void\n}\n\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(\n (\n {\n label,\n error,\n description,\n options,\n classNames,\n onChange: handleValueChange,\n orientation,\n ...props\n },\n ref\n ) => {\n return (\n <div className={cn('flex flex-col gap-1', classNames?.root)}>\n <Label text={label} description={description} required={props.required} />\n\n <RadioGroup\n ref={ref}\n className={cn(\n 'flex text-sm',\n orientation === 'vertical' ? 'flex-col gap-2' : 'flex-row gap-4',\n classNames?.group\n )}\n onValueChange={handleValueChange}\n {...props}\n >\n {options?.map(({ id, title, value }) => (\n <RadioGroupItem\n key={id}\n value={value}\n id={`radio-group-item-${title}`}\n className={classNames?.item}\n >\n {title}\n </RadioGroupItem>\n ))}\n </RadioGroup>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\nRadio.displayName = 'Radio'\n","'use client'\n\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\n\nimport { cn } from '@/lib/utils'\nimport { ComponentPropsWithoutRef, ElementRef, forwardRef, PropsWithChildren } from 'react'\n\nexport const RadioGroup = forwardRef<\n ElementRef<typeof RadioGroupPrimitive.Root>,\n ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <RadioGroupPrimitive.Root className={className} {...props} ref={ref} />\n))\nRadioGroup.displayName = RadioGroupPrimitive.Root.displayName\n\nexport const RadioGroupItem = forwardRef<\n ElementRef<typeof RadioGroupPrimitive.Item>,\n PropsWithChildren<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>>\n>(({ className, children, ...props }, ref) => {\n return (\n <div className=\"group flex flex-row items-center gap-2\">\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cn(\n 'focus-visible:ring-ring peer aspect-square h-4 rounded-full border border-grey-10 shadow outline outline-1 outline-offset-2 outline-transparent focus:outline-none focus:outline-purple-100 focus-visible:ring-1 active:border-green-80 disabled:cursor-not-allowed disabled:opacity-50 group-hover:border-grey-20 data-[state=checked]:border-4 data-[disabled]:border-grey-20 data-[state=checked]:border-green-90 data-[disabled]:bg-grey-10 data-[state=checked]:group-hover:border-green-80',\n className\n )}\n {...props}\n />\n <label htmlFor={props.id} className=\"text-sm peer-data-[disabled]:text-grey-40\">\n {children}\n </label>\n </div>\n )\n})\nRadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName\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 { InfoIcon } from 'lucide-react'\nimport { type ComponentPropsWithoutRef } from 'react'\n\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { cn } from '@/lib/utils'\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\"> *</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","'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"],"mappings":";AAAA,SAAyB,cAAAA,mBAAkB;;;ACE3C,YAAY,yBAAyB;;;ACFrC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADAA,SAA+C,kBAAqC;AAMlF,cASE,YATF;AAJK,IAAM,aAAa,WAGxB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B,oBAAqB,0BAApB,EAAyB,WAAuB,GAAG,OAAO,KAAU,CACtE;AACD,WAAW,cAAkC,yBAAK;AAE3C,IAAM,iBAAiB,WAG5B,CAAC,EAAE,WAAW,UAAU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|
52
52
|
// src/components/ui/Button.tsx
|
|
53
53
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
54
54
|
var Button = (0, import_react.forwardRef)(
|
|
55
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
55
|
+
({ className, variant, size, asChild = false, type = "button", ...props }, ref) => {
|
|
56
56
|
const Component = asChild ? import_react_slot.Slot : "button";
|
|
57
57
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
58
|
Component,
|
|
59
59
|
{
|
|
60
60
|
className: cn(buttonVariants({ variant, size, className })),
|
|
61
|
+
type,
|
|
61
62
|
ref,
|
|
62
63
|
...props
|
|
63
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/ReadMore.tsx","../../../src/components/ui/Button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["'use client'\n\nimport { type ComponentProps, useEffect, useState } from 'react'\nimport Markdown from 'react-markdown'\n\nimport { Button } from '@/components/ui/Button'\n\nexport type ReadMoreProps = ComponentProps<'div'> & {\n text: string\n}\n\nexport function ReadMore({ text, ...props }: Readonly<ReadMoreProps>) {\n const [isExpanded, setIsExpanded] = useState(false)\n const [maxWords, setMaxWords] = useState(160)\n\n useEffect(() => {\n const updateMaxWords = () => {\n const windowWidth = window.innerWidth\n if (windowWidth <= 768) {\n setMaxWords(50)\n } else {\n setMaxWords(160)\n }\n }\n\n updateMaxWords()\n window.addEventListener('resize', updateMaxWords)\n\n return () => window.removeEventListener('resize', updateMaxWords)\n }, [])\n\n function createReadMoreText(text: string, maxWords: number, isExpanded: boolean): string {\n const words = text.split(' ')\n\n const snippet = isExpanded ? text : words.slice(0, maxWords).join(' ')\n const readMoreText = isExpanded ? '' : '...'\n return `${snippet} ${readMoreText}`\n }\n\n const toggleText = () => setIsExpanded(!isExpanded)\n\n const snippet = createReadMoreText(text, maxWords, isExpanded)\n\n return (\n <div {...props}>\n <div data-testid=\"read-more-text\" className=\"prose lg:prose-lg\">\n <Markdown>{snippet}</Markdown>\n </div>\n <Button\n type=\"button\"\n className=\"mt-2 flex items-center justify-center\"\n variant=\"link\"\n onClick={toggleText}\n >\n <p className=\"text-sm font-bold underline underline-offset-2\">\n Read {isExpanded ? 'less' : 'more'}\n </p>\n </Button>\n </div>\n )\n}\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'cva'\nimport React, { forwardRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Props for the Button component.\n * @interface ButtonProps\n * @extends {React.ButtonHTMLAttributes<HTMLButtonElement>}\n * @extends {VariantProps<typeof buttonVariants>}\n */\ninterface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /**\n * When true, the component will render its children directly without wrapping them in a button element.\n * Useful when you want to use the button styles on a different element.\n * @default false\n */\n asChild?: boolean\n}\n\n/**\n * A versatile button component that supports multiple variants and sizes.\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Primary variant with large size\n * <Button variant=\"primary\" size=\"lg\">Large Button</Button>\n *\n * // As a link\n * <Button asChild>\n * <a href=\"/somewhere\">Go somewhere</a>\n * </Button>\n * ```\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : 'button'\n\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = 'Button'\n\n/**\n * Variant definitions for the Button component using class-variance-authority.\n * Provides consistent styling across different button variations.\n */\nconst buttonVariants = cva(\n [\n 'flex',\n 'items-center',\n 'justify-center',\n 'gap-2',\n 'rounded-full',\n 'font-bold',\n 'outline-2',\n 'outline-offset-2',\n 'outline-dashed',\n 'outline-transparent',\n ],\n {\n variants: {\n variant: {\n neutral: [\n 'bg-black',\n 'text-white',\n 'hover:bg-grey-90',\n 'active:bg-grey-80',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n primary: [\n 'bg-pickle-100',\n 'text-black',\n 'hover:bg-pickle-80',\n 'active:bg-pickle-60',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n secondary: [\n 'bg-green-80',\n 'text-white',\n 'hover:bg-green-90',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n transparent: [\n 'text-white',\n 'hover:bg-green-80',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n ],\n link: [\n 'leading-tight',\n 'text-black',\n 'underline',\n 'hover:text-purple-100',\n 'focus:text-black',\n 'focus:outline-purple-100',\n 'active:text-purple-80',\n ],\n },\n size: {\n small: ['h-10', 'text-sm', 'px-4', 'py-2'],\n medium: ['h-12', 'text-base', 'px-6', 'py-3'],\n large: ['h-14', 'text-lg', 'px-8', 'py-4'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n compoundVariants: [\n {\n variant: 'link',\n size: 'small',\n class: ['h-3', 'text-xs', 'p-0'],\n },\n {\n variant: 'link',\n size: 'medium',\n class: ['h-4', 'text-sm', 'p-0'],\n },\n {\n variant: 'link',\n size: 'large',\n class: ['h-6', 'text-base', 'p-0'],\n },\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAyD;AACzD,4BAAqB;;;ACHrB,wBAAqB;AACrB,iBAAuC;AACvC,mBAAkC;;;ACFlC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADyCM;AALC,IAAM,aAAS;AAAA,EACpB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/ReadMore.tsx","../../../src/components/ui/Button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["'use client'\n\nimport { type ComponentProps, useEffect, useState } from 'react'\nimport Markdown from 'react-markdown'\n\nimport { Button } from '@/components/ui/Button'\n\nexport type ReadMoreProps = ComponentProps<'div'> & {\n text: string\n}\n\nexport function ReadMore({ text, ...props }: Readonly<ReadMoreProps>) {\n const [isExpanded, setIsExpanded] = useState(false)\n const [maxWords, setMaxWords] = useState(160)\n\n useEffect(() => {\n const updateMaxWords = () => {\n const windowWidth = window.innerWidth\n if (windowWidth <= 768) {\n setMaxWords(50)\n } else {\n setMaxWords(160)\n }\n }\n\n updateMaxWords()\n window.addEventListener('resize', updateMaxWords)\n\n return () => window.removeEventListener('resize', updateMaxWords)\n }, [])\n\n function createReadMoreText(text: string, maxWords: number, isExpanded: boolean): string {\n const words = text.split(' ')\n\n const snippet = isExpanded ? text : words.slice(0, maxWords).join(' ')\n const readMoreText = isExpanded ? '' : '...'\n return `${snippet} ${readMoreText}`\n }\n\n const toggleText = () => setIsExpanded(!isExpanded)\n\n const snippet = createReadMoreText(text, maxWords, isExpanded)\n\n return (\n <div {...props}>\n <div data-testid=\"read-more-text\" className=\"prose lg:prose-lg\">\n <Markdown>{snippet}</Markdown>\n </div>\n <Button\n type=\"button\"\n className=\"mt-2 flex items-center justify-center\"\n variant=\"link\"\n onClick={toggleText}\n >\n <p className=\"text-sm font-bold underline underline-offset-2\">\n Read {isExpanded ? 'less' : 'more'}\n </p>\n </Button>\n </div>\n )\n}\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'cva'\nimport React, { forwardRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Props for the Button component.\n * @interface ButtonProps\n * @extends {React.ButtonHTMLAttributes<HTMLButtonElement>}\n * @extends {VariantProps<typeof buttonVariants>}\n */\ninterface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /**\n * When true, the component will render its children directly without wrapping them in a button element.\n * Useful when you want to use the button styles on a different element.\n * @default false\n */\n asChild?: boolean\n}\n\n/**\n * A versatile button component that supports multiple variants and sizes.\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Primary variant with large size\n * <Button variant=\"primary\" size=\"lg\">Large Button</Button>\n *\n * // As a link\n * <Button asChild>\n * <a href=\"/somewhere\">Go somewhere</a>\n * </Button>\n * ```\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, type = 'button', ...props }, ref) => {\n const Component = asChild ? Slot : 'button'\n\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n type={type}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = 'Button'\n\n/**\n * Variant definitions for the Button component using class-variance-authority.\n * Provides consistent styling across different button variations.\n */\nconst buttonVariants = cva(\n [\n 'flex',\n 'items-center',\n 'justify-center',\n 'gap-2',\n 'rounded-full',\n 'font-bold',\n 'outline-2',\n 'outline-offset-2',\n 'outline-dashed',\n 'outline-transparent',\n ],\n {\n variants: {\n variant: {\n neutral: [\n 'bg-black',\n 'text-white',\n 'hover:bg-grey-90',\n 'active:bg-grey-80',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n primary: [\n 'bg-pickle-100',\n 'text-black',\n 'hover:bg-pickle-80',\n 'active:bg-pickle-60',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n secondary: [\n 'bg-green-80',\n 'text-white',\n 'hover:bg-green-90',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n transparent: [\n 'text-white',\n 'hover:bg-green-80',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n ],\n link: [\n 'leading-tight',\n 'text-black',\n 'underline',\n 'hover:text-purple-100',\n 'focus:text-black',\n 'focus:outline-purple-100',\n 'active:text-purple-80',\n ],\n },\n size: {\n small: ['h-10', 'text-sm', 'px-4', 'py-2'],\n medium: ['h-12', 'text-base', 'px-6', 'py-3'],\n large: ['h-14', 'text-lg', 'px-8', 'py-4'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n compoundVariants: [\n {\n variant: 'link',\n size: 'small',\n class: ['h-3', 'text-xs', 'p-0'],\n },\n {\n variant: 'link',\n size: 'medium',\n class: ['h-4', 'text-sm', 'p-0'],\n },\n {\n variant: 'link',\n size: 'large',\n class: ['h-6', 'text-base', 'p-0'],\n },\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAyD;AACzD,4BAAqB;;;ACHrB,wBAAqB;AACrB,iBAAuC;AACvC,mBAAkC;;;ACFlC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADyCM;AALC,IAAM,aAAS;AAAA,EACpB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,OAAO,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjF,UAAM,YAAY,UAAU,yBAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,QAC1D;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,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AAA,KACF;AAEJ;","names":["import_react","import_jsx_runtime","text","maxWords","isExpanded","snippet","Markdown"]}
|
|
@@ -19,12 +19,13 @@ function cn(...inputs) {
|
|
|
19
19
|
// src/components/ui/Button.tsx
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
21
|
var Button = forwardRef(
|
|
22
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
22
|
+
({ className, variant, size, asChild = false, type = "button", ...props }, ref) => {
|
|
23
23
|
const Component = asChild ? Slot : "button";
|
|
24
24
|
return /* @__PURE__ */ jsx(
|
|
25
25
|
Component,
|
|
26
26
|
{
|
|
27
27
|
className: cn(buttonVariants({ variant, size, className })),
|
|
28
|
+
type,
|
|
28
29
|
ref,
|
|
29
30
|
...props
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/ReadMore.tsx","../../../src/components/ui/Button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["'use client'\n\nimport { type ComponentProps, useEffect, useState } from 'react'\nimport Markdown from 'react-markdown'\n\nimport { Button } from '@/components/ui/Button'\n\nexport type ReadMoreProps = ComponentProps<'div'> & {\n text: string\n}\n\nexport function ReadMore({ text, ...props }: Readonly<ReadMoreProps>) {\n const [isExpanded, setIsExpanded] = useState(false)\n const [maxWords, setMaxWords] = useState(160)\n\n useEffect(() => {\n const updateMaxWords = () => {\n const windowWidth = window.innerWidth\n if (windowWidth <= 768) {\n setMaxWords(50)\n } else {\n setMaxWords(160)\n }\n }\n\n updateMaxWords()\n window.addEventListener('resize', updateMaxWords)\n\n return () => window.removeEventListener('resize', updateMaxWords)\n }, [])\n\n function createReadMoreText(text: string, maxWords: number, isExpanded: boolean): string {\n const words = text.split(' ')\n\n const snippet = isExpanded ? text : words.slice(0, maxWords).join(' ')\n const readMoreText = isExpanded ? '' : '...'\n return `${snippet} ${readMoreText}`\n }\n\n const toggleText = () => setIsExpanded(!isExpanded)\n\n const snippet = createReadMoreText(text, maxWords, isExpanded)\n\n return (\n <div {...props}>\n <div data-testid=\"read-more-text\" className=\"prose lg:prose-lg\">\n <Markdown>{snippet}</Markdown>\n </div>\n <Button\n type=\"button\"\n className=\"mt-2 flex items-center justify-center\"\n variant=\"link\"\n onClick={toggleText}\n >\n <p className=\"text-sm font-bold underline underline-offset-2\">\n Read {isExpanded ? 'less' : 'more'}\n </p>\n </Button>\n </div>\n )\n}\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'cva'\nimport React, { forwardRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Props for the Button component.\n * @interface ButtonProps\n * @extends {React.ButtonHTMLAttributes<HTMLButtonElement>}\n * @extends {VariantProps<typeof buttonVariants>}\n */\ninterface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /**\n * When true, the component will render its children directly without wrapping them in a button element.\n * Useful when you want to use the button styles on a different element.\n * @default false\n */\n asChild?: boolean\n}\n\n/**\n * A versatile button component that supports multiple variants and sizes.\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Primary variant with large size\n * <Button variant=\"primary\" size=\"lg\">Large Button</Button>\n *\n * // As a link\n * <Button asChild>\n * <a href=\"/somewhere\">Go somewhere</a>\n * </Button>\n * ```\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Component = asChild ? Slot : 'button'\n\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = 'Button'\n\n/**\n * Variant definitions for the Button component using class-variance-authority.\n * Provides consistent styling across different button variations.\n */\nconst buttonVariants = cva(\n [\n 'flex',\n 'items-center',\n 'justify-center',\n 'gap-2',\n 'rounded-full',\n 'font-bold',\n 'outline-2',\n 'outline-offset-2',\n 'outline-dashed',\n 'outline-transparent',\n ],\n {\n variants: {\n variant: {\n neutral: [\n 'bg-black',\n 'text-white',\n 'hover:bg-grey-90',\n 'active:bg-grey-80',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n primary: [\n 'bg-pickle-100',\n 'text-black',\n 'hover:bg-pickle-80',\n 'active:bg-pickle-60',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n secondary: [\n 'bg-green-80',\n 'text-white',\n 'hover:bg-green-90',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n transparent: [\n 'text-white',\n 'hover:bg-green-80',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n ],\n link: [\n 'leading-tight',\n 'text-black',\n 'underline',\n 'hover:text-purple-100',\n 'focus:text-black',\n 'focus:outline-purple-100',\n 'active:text-purple-80',\n ],\n },\n size: {\n small: ['h-10', 'text-sm', 'px-4', 'py-2'],\n medium: ['h-12', 'text-base', 'px-6', 'py-3'],\n large: ['h-14', 'text-lg', 'px-8', 'py-4'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n compoundVariants: [\n {\n variant: 'link',\n size: 'small',\n class: ['h-3', 'text-xs', 'p-0'],\n },\n {\n variant: 'link',\n size: 'medium',\n class: ['h-4', 'text-sm', 'p-0'],\n },\n {\n variant: 'link',\n size: 'large',\n class: ['h-6', 'text-base', 'p-0'],\n },\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"],"mappings":";;;AAEA,SAA8B,WAAW,gBAAgB;AACzD,OAAO,cAAc;;;ACHrB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAgB,kBAAkB;;;ACFlC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADyCM;AALC,IAAM,SAAS;AAAA,EACpB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,GAAG,MAAM,GAAG,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/ReadMore.tsx","../../../src/components/ui/Button.tsx","../../../src/lib/utils.ts"],"sourcesContent":["'use client'\n\nimport { type ComponentProps, useEffect, useState } from 'react'\nimport Markdown from 'react-markdown'\n\nimport { Button } from '@/components/ui/Button'\n\nexport type ReadMoreProps = ComponentProps<'div'> & {\n text: string\n}\n\nexport function ReadMore({ text, ...props }: Readonly<ReadMoreProps>) {\n const [isExpanded, setIsExpanded] = useState(false)\n const [maxWords, setMaxWords] = useState(160)\n\n useEffect(() => {\n const updateMaxWords = () => {\n const windowWidth = window.innerWidth\n if (windowWidth <= 768) {\n setMaxWords(50)\n } else {\n setMaxWords(160)\n }\n }\n\n updateMaxWords()\n window.addEventListener('resize', updateMaxWords)\n\n return () => window.removeEventListener('resize', updateMaxWords)\n }, [])\n\n function createReadMoreText(text: string, maxWords: number, isExpanded: boolean): string {\n const words = text.split(' ')\n\n const snippet = isExpanded ? text : words.slice(0, maxWords).join(' ')\n const readMoreText = isExpanded ? '' : '...'\n return `${snippet} ${readMoreText}`\n }\n\n const toggleText = () => setIsExpanded(!isExpanded)\n\n const snippet = createReadMoreText(text, maxWords, isExpanded)\n\n return (\n <div {...props}>\n <div data-testid=\"read-more-text\" className=\"prose lg:prose-lg\">\n <Markdown>{snippet}</Markdown>\n </div>\n <Button\n type=\"button\"\n className=\"mt-2 flex items-center justify-center\"\n variant=\"link\"\n onClick={toggleText}\n >\n <p className=\"text-sm font-bold underline underline-offset-2\">\n Read {isExpanded ? 'less' : 'more'}\n </p>\n </Button>\n </div>\n )\n}\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'cva'\nimport React, { forwardRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/**\n * Props for the Button component.\n * @interface ButtonProps\n * @extends {React.ButtonHTMLAttributes<HTMLButtonElement>}\n * @extends {VariantProps<typeof buttonVariants>}\n */\ninterface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /**\n * When true, the component will render its children directly without wrapping them in a button element.\n * Useful when you want to use the button styles on a different element.\n * @default false\n */\n asChild?: boolean\n}\n\n/**\n * A versatile button component that supports multiple variants and sizes.\n *\n * @component\n * @example\n * ```tsx\n * // Default button\n * <Button>Click me</Button>\n *\n * // Primary variant with large size\n * <Button variant=\"primary\" size=\"lg\">Large Button</Button>\n *\n * // As a link\n * <Button asChild>\n * <a href=\"/somewhere\">Go somewhere</a>\n * </Button>\n * ```\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, type = 'button', ...props }, ref) => {\n const Component = asChild ? Slot : 'button'\n\n return (\n <Component\n className={cn(buttonVariants({ variant, size, className }))}\n type={type}\n ref={ref}\n {...props}\n />\n )\n }\n)\nButton.displayName = 'Button'\n\n/**\n * Variant definitions for the Button component using class-variance-authority.\n * Provides consistent styling across different button variations.\n */\nconst buttonVariants = cva(\n [\n 'flex',\n 'items-center',\n 'justify-center',\n 'gap-2',\n 'rounded-full',\n 'font-bold',\n 'outline-2',\n 'outline-offset-2',\n 'outline-dashed',\n 'outline-transparent',\n ],\n {\n variants: {\n variant: {\n neutral: [\n 'bg-black',\n 'text-white',\n 'hover:bg-grey-90',\n 'active:bg-grey-80',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n primary: [\n 'bg-pickle-100',\n 'text-black',\n 'hover:bg-pickle-80',\n 'active:bg-pickle-60',\n 'focus:outline-purple-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n secondary: [\n 'bg-green-80',\n 'text-white',\n 'hover:bg-green-90',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n 'disabled:bg-grey-10',\n ],\n transparent: [\n 'text-white',\n 'hover:bg-green-80',\n 'active:bg-green-100',\n 'focus:outline-pickle-100',\n 'disabled:text-grey-40',\n ],\n link: [\n 'leading-tight',\n 'text-black',\n 'underline',\n 'hover:text-purple-100',\n 'focus:text-black',\n 'focus:outline-purple-100',\n 'active:text-purple-80',\n ],\n },\n size: {\n small: ['h-10', 'text-sm', 'px-4', 'py-2'],\n medium: ['h-12', 'text-base', 'px-6', 'py-3'],\n large: ['h-14', 'text-lg', 'px-8', 'py-4'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n compoundVariants: [\n {\n variant: 'link',\n size: 'small',\n class: ['h-3', 'text-xs', 'p-0'],\n },\n {\n variant: 'link',\n size: 'medium',\n class: ['h-4', 'text-sm', 'p-0'],\n },\n {\n variant: 'link',\n size: 'large',\n class: ['h-6', 'text-base', 'p-0'],\n },\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"],"mappings":";;;AAEA,SAA8B,WAAW,gBAAgB;AACzD,OAAO,cAAc;;;ACHrB,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAgB,kBAAkB;;;ACFlC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADyCM;AALC,IAAM,SAAS;AAAA,EACpB,CAAC,EAAE,WAAW,SAAS,MAAM,UAAU,OAAO,OAAO,UAAU,GAAG,MAAM,GAAG,QAAQ;AACjF,UAAM,YAAY,UAAU,OAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,QAC1D;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AA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A;AAAA,IACF;AAAA,KACF;AAEJ;","names":["jsx","text","maxWords","isExpanded","snippet"]}
|
|
@@ -155,7 +155,18 @@ var Label_default = Label;
|
|
|
155
155
|
// src/components/ui/Select.tsx
|
|
156
156
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
157
157
|
var Select = (0, import_react.forwardRef)(
|
|
158
|
-
({
|
|
158
|
+
({
|
|
159
|
+
label,
|
|
160
|
+
options,
|
|
161
|
+
placeholder,
|
|
162
|
+
multiselect,
|
|
163
|
+
description,
|
|
164
|
+
classNames,
|
|
165
|
+
error,
|
|
166
|
+
id,
|
|
167
|
+
children: footer,
|
|
168
|
+
...props
|
|
169
|
+
}, ref) => {
|
|
159
170
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
160
171
|
const [selected, setSelected] = (0, import_react.useState)([]);
|
|
161
172
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
@@ -244,28 +255,30 @@ var Select = (0, import_react.forwardRef)(
|
|
|
244
255
|
onPointerDownOutside: toggleOpen,
|
|
245
256
|
onKeyDown: closeOnEscape,
|
|
246
257
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SelectPrimitive.Viewport, { children: [
|
|
247
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime6.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
258
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
260
|
+
SelectPrimitive.Group,
|
|
261
|
+
{
|
|
262
|
+
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
263
|
+
"data-testid": "selected-labels",
|
|
264
|
+
children: chipLabels?.map(
|
|
265
|
+
(chip) => chip && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Chip_default, { size: "small", variant: "primary", children: [
|
|
266
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: chip.title }),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
268
|
+
import_lucide_react2.X,
|
|
269
|
+
{
|
|
270
|
+
size: 18,
|
|
271
|
+
"data-testid": `chip-remove-${chip.value}`,
|
|
272
|
+
className: "cursor-pointer",
|
|
273
|
+
onClick: () => handleChange(chip.value)
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] }, chip.title)
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Separator, {})
|
|
281
|
+
] }),
|
|
269
282
|
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
270
283
|
SelectPrimitive.Item,
|
|
271
284
|
{
|
|
@@ -286,7 +299,18 @@ var Select = (0, import_react.forwardRef)(
|
|
|
286
299
|
]
|
|
287
300
|
},
|
|
288
301
|
id2
|
|
289
|
-
))
|
|
302
|
+
)),
|
|
303
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
304
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Separator, {}),
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
306
|
+
SelectPrimitive.Group,
|
|
307
|
+
{
|
|
308
|
+
className: "mt-2 flex flex-row flex-wrap gap-1 px-2",
|
|
309
|
+
"data-testid": "selected-labels",
|
|
310
|
+
children: footer
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] })
|
|
290
314
|
] })
|
|
291
315
|
}
|
|
292
316
|
) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/Select.tsx","../../../src/components/primitives/separator.tsx","../../../src/lib/utils.ts","../../../src/components/ui/Chip.tsx","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/primitives/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport { CheckIcon, ChevronDownIcon, X } from 'lucide-react'\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type KeyboardEvent,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Separator } from '@/components/primitives/separator'\nimport Chip from '@/components/ui/Chip'\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange'> {\n label?: string\n value?: string | string[]\n options?: { id: string | number; value: string; title: string }[]\n placeholder?: string\n multiselect?: boolean\n description?: string\n error?: string\n classNames?: { label?: string; trigger?: string }\n onChange?: (value: string | string[]) => void\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n (\n { label, options, placeholder, multiselect, description, classNames, error, id, ...props },\n ref\n ) => {\n const { value, defaultValue, dir, className, onChange, ...rest } = props\n const [selected, setSelected] = useState<string[]>([])\n const [open, setOpen] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!value) return setSelected([])\n setSelected(Array.isArray(value) ? value : [value])\n }, [value])\n\n const toggleOpen = () => setOpen((prev) => !prev)\n const closeOnEscape = (event: KeyboardEvent) => event.key === 'Escape' && setOpen(false)\n const handleOnOpenChange = (isOpen: boolean) => (!multiselect || isOpen) && setOpen(isOpen)\n const setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n const getLabel = () =>\n selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleChange(newValue: string) {\n if (newValue === '' && !multiselect) return // Prevent clearing single select\n let newSelected: string[] = []\n setSelected((prev) => {\n newSelected = prev.includes(newValue)\n ? prev.filter((item) => item !== newValue)\n : [...prev, newValue]\n return multiselect ? newSelected : [newValue]\n })\n onChange?.(multiselect ? newSelected : newValue)\n }\n\n return (\n <div\n className={cn('flex w-full flex-col gap-1', className)}\n ref={containerRef}\n data-testid={`${(label ?? id)?.toLowerCase()}-select-element`}\n >\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n\n <SelectPrimitive.Root\n open={open}\n value={selected.join(',')}\n onOpenChange={handleOnOpenChange}\n onValueChange={multiselect ? undefined : handleChange}\n defaultValue={typeof defaultValue === 'string' ? defaultValue : undefined}\n dir={dir === 'rtl' ? 'rtl' : 'ltr'}\n {...rest}\n >\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex h-11 w-full flex-row items-center justify-between gap-3 rounded-lg border px-4 py-3 text-sm font-normal focus:outline-purple-100 disabled:bg-grey-5 data-[placeholder]:text-grey-50 data-[placeholder]:disabled:text-grey-40',\n classNames?.trigger\n )}\n >\n <span className=\"truncate\">\n <SelectPrimitive.Value\n placeholder={placeholder ?? 'Select an option'}\n aria-label={getLabel()}\n >\n {getLabel()}\n </SelectPrimitive.Value>\n </span>\n\n <ChevronDownIcon\n className=\"transform text-black group-data-[state=open]:rotate-180\"\n size=\"16\"\n />\n </SelectPrimitive.Trigger>\n\n <SelectPrimitive.Portal container={containerRef.current}>\n <SelectPrimitive.Content\n hideWhenDetached\n className=\"z-10 max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md bg-white py-2 shadow-lg\"\n position=\"popper\"\n sideOffset={4}\n onPointerDownOutside={toggleOpen}\n onKeyDown={closeOnEscape}\n >\n <SelectPrimitive.Viewport>\n {multiselect && !!chipLabels?.length && (\n <SelectPrimitive.Group\n className=\"mb-2 flex flex-row flex-wrap gap-1 px-2\"\n data-testid=\"selected-labels\"\n >\n {chipLabels?.map(\n (chip) =>\n chip && (\n <Chip key={chip.title} size=\"small\" variant=\"primary\">\n <span>{chip.title}</span>\n <X\n size={18}\n data-testid={`chip-remove-${chip.value}`}\n className=\"cursor-pointer\"\n onClick={() => handleChange(chip.value)}\n />\n </Chip>\n )\n )}\n </SelectPrimitive.Group>\n )}\n <Separator />\n {options?.map(({ id, title, value }) => (\n <SelectPrimitive.Item\n key={id}\n value={value}\n className=\"group relative cursor-pointer px-4 py-2 text-left text-sm hover:bg-purple-50 focus:bg-purple-50 focus:outline-none data-[state=checked]:bg-purple-50 data-[state=checked]:pr-10 data-[state=checked]:text-purple-100\"\n data-state={selected.includes(value) ? 'checked' : 'unchecked'}\n onKeyDown={(e) => setValueOnEnter(e, value)}\n onClick={() => handleChange(value)}\n >\n <SelectPrimitive.ItemText>{title}</SelectPrimitive.ItemText>\n <CheckIcon\n className=\"absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block\"\n size={16}\n />\n </SelectPrimitive.Item>\n ))}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\n","'use client'\r\n\r\nimport * as SeparatorPrimitive from '@radix-ui/react-separator'\r\nimport * as React from 'react'\r\n\r\nimport { cn } from '@/lib/utils'\r\n\r\nconst Separator = React.forwardRef<\r\n React.ElementRef<typeof SeparatorPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\r\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\r\n <SeparatorPrimitive.Root\r\n ref={ref}\r\n decorative={decorative}\r\n orientation={orientation}\r\n className={cn(\r\n 'shrink-0 bg-grey-10',\r\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nSeparator.displayName = SeparatorPrimitive.Root.displayName\r\n\r\nexport { Separator }\r\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 { cva, type VariantProps } from 'cva'\nimport React from 'react'\nimport { twMerge } from 'tailwind-merge'\n\ninterface ChipProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof chipVariants> {}\n\nconst Chip = ({ className, variant, size, ...props }: ChipProps) => (\n <div className={twMerge(chipVariants({ variant, size, className }))} {...props} />\n)\n\nconst chipVariants = cva(['flex', 'items-center', 'rounded-3xl', 'border', 'w-fit'], {\n variants: {\n variant: {\n neutral: ['text-grey-80', 'border-grey-10'],\n primary: ['text-purple-100', 'border-purple-20'],\n danger: ['text-pumpkin-100', 'border-pumpkin-20'],\n onboarding: ['text-green-100', 'bg-green-10', 'cursor-pointer'],\n onboardingSelected: ['text-white', 'bg-green-90', 'cursor-pointer'],\n },\n size: {\n small: ['text-sm', 'leading-5', 'px-2', 'py-1', 'gap-1.5'],\n medium: ['text-base', 'leading-6', 'px-3', 'py-2', 'gap-2'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n})\n\nexport default Chip\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 { InfoIcon } from 'lucide-react'\nimport { type ComponentPropsWithoutRef } from 'react'\n\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { cn } from '@/lib/utils'\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\"> *</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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAAiC;AACjC,IAAAA,uBAA8C;AAC9C,mBAOO;;;ACTP,yBAAoC;AACpC,YAAuB;;;ACHvB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADME;AAJF,IAAM,YAAkB,iBAGtB,CAAC,EAAE,WAAW,cAAc,cAAc,aAAa,MAAM,GAAG,MAAM,GAAG,QACzE;AAAA,EAAoB;AAAA,EAAnB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,gBAAgB,eAAe,mBAAmB;AAAA,MAClD;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,UAAU,cAAiC,wBAAK;;;AEvBhD,iBAAuC;AAEvC,IAAAC,yBAAwB;AAOtB,IAAAC,sBAAA;AADF,IAAM,OAAO,CAAC,EAAE,WAAW,SAAS,MAAM,GAAG,MAAM,MACjD,6CAAC,SAAI,eAAW,gCAAQ,aAAa,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAI,GAAG,OAAO;AAGlF,IAAM,mBAAe,gBAAI,CAAC,QAAQ,gBAAgB,eAAe,UAAU,OAAO,GAAG;AAAA,EACnF,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS,CAAC,gBAAgB,gBAAgB;AAAA,MAC1C,SAAS,CAAC,mBAAmB,kBAAkB;AAAA,MAC/C,QAAQ,CAAC,oBAAoB,mBAAmB;AAAA,MAChD,YAAY,CAAC,kBAAkB,eAAe,gBAAgB;AAAA,MAC9D,oBAAoB,CAAC,cAAc,eAAe,gBAAgB;AAAA,IACpE;AAAA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AA;AAAA;AAAA,IAChC;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;AAErB,IAAO,iBAAQ;","names":["import_lucide_react","import_tailwind_merge","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","value","id"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/Select.tsx","../../../src/components/primitives/separator.tsx","../../../src/lib/utils.ts","../../../src/components/ui/Chip.tsx","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/primitives/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport { CheckIcon, ChevronDownIcon, X } from 'lucide-react'\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type KeyboardEvent,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Separator } from '@/components/primitives/separator'\nimport Chip from '@/components/ui/Chip'\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends Omit<ComponentPropsWithoutRef<'select'>, 'value' | 'onChange'> {\n label?: string\n value?: string | string[]\n options?: { id: string | number; value: string; title: string }[]\n placeholder?: string\n multiselect?: boolean\n description?: string\n error?: string\n classNames?: { label?: string; trigger?: string }\n onChange?: (value: string | string[]) => void\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n (\n {\n label,\n options,\n placeholder,\n multiselect,\n description,\n classNames,\n error,\n id,\n children: footer,\n ...props\n },\n ref\n ) => {\n const { value, defaultValue, dir, className, onChange, ...rest } = props\n const [selected, setSelected] = useState<string[]>([])\n const [open, setOpen] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!value) return setSelected([])\n setSelected(Array.isArray(value) ? value : [value])\n }, [value])\n\n const toggleOpen = () => setOpen((prev) => !prev)\n const closeOnEscape = (event: KeyboardEvent) => event.key === 'Escape' && setOpen(false)\n const handleOnOpenChange = (isOpen: boolean) => (!multiselect || isOpen) && setOpen(isOpen)\n const setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n const getLabel = () =>\n selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleChange(newValue: string) {\n if (newValue === '' && !multiselect) return // Prevent clearing single select\n let newSelected: string[] = []\n setSelected((prev) => {\n newSelected = prev.includes(newValue)\n ? prev.filter((item) => item !== newValue)\n : [...prev, newValue]\n return multiselect ? newSelected : [newValue]\n })\n onChange?.(multiselect ? newSelected : newValue)\n }\n\n return (\n <div\n className={cn('flex w-full flex-col gap-1', className)}\n ref={containerRef}\n data-testid={`${(label ?? id)?.toLowerCase()}-select-element`}\n >\n <Label\n text={label}\n htmlFor={props.name}\n required={props.required}\n description={description}\n className={classNames?.label}\n />\n\n <SelectPrimitive.Root\n open={open}\n value={selected.join(',')}\n onOpenChange={handleOnOpenChange}\n onValueChange={multiselect ? undefined : handleChange}\n defaultValue={typeof defaultValue === 'string' ? defaultValue : undefined}\n dir={dir === 'rtl' ? 'rtl' : 'ltr'}\n {...rest}\n >\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'group flex h-11 w-full flex-row items-center justify-between gap-3 rounded-lg border px-4 py-3 text-sm font-normal focus:outline-purple-100 disabled:bg-grey-5 data-[placeholder]:text-grey-50 data-[placeholder]:disabled:text-grey-40',\n classNames?.trigger\n )}\n >\n <span className=\"truncate\">\n <SelectPrimitive.Value\n placeholder={placeholder ?? 'Select an option'}\n aria-label={getLabel()}\n >\n {getLabel()}\n </SelectPrimitive.Value>\n </span>\n\n <ChevronDownIcon\n className=\"transform text-black group-data-[state=open]:rotate-180\"\n size=\"16\"\n />\n </SelectPrimitive.Trigger>\n\n <SelectPrimitive.Portal container={containerRef.current}>\n <SelectPrimitive.Content\n hideWhenDetached\n className=\"z-10 max-h-[var(--radix-select-content-available-height)] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md bg-white py-2 shadow-lg\"\n position=\"popper\"\n sideOffset={4}\n onPointerDownOutside={toggleOpen}\n onKeyDown={closeOnEscape}\n >\n <SelectPrimitive.Viewport>\n {multiselect && !!chipLabels?.length && (\n <>\n <SelectPrimitive.Group\n className=\"mb-2 flex flex-row flex-wrap gap-1 px-2\"\n data-testid=\"selected-labels\"\n >\n {chipLabels?.map(\n (chip) =>\n chip && (\n <Chip key={chip.title} size=\"small\" variant=\"primary\">\n <span>{chip.title}</span>\n <X\n size={18}\n data-testid={`chip-remove-${chip.value}`}\n className=\"cursor-pointer\"\n onClick={() => handleChange(chip.value)}\n />\n </Chip>\n )\n )}\n </SelectPrimitive.Group>\n <Separator />\n </>\n )}\n {options?.map(({ id, title, value }) => (\n <SelectPrimitive.Item\n key={id}\n value={value}\n className=\"group relative cursor-pointer px-4 py-2 text-left text-sm hover:bg-purple-50 focus:bg-purple-50 focus:outline-none data-[state=checked]:bg-purple-50 data-[state=checked]:pr-10 data-[state=checked]:text-purple-100\"\n data-state={selected.includes(value) ? 'checked' : 'unchecked'}\n onKeyDown={(e) => setValueOnEnter(e, value)}\n onClick={() => handleChange(value)}\n >\n <SelectPrimitive.ItemText>{title}</SelectPrimitive.ItemText>\n <CheckIcon\n className=\"absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block\"\n size={16}\n />\n </SelectPrimitive.Item>\n ))}\n\n {!!footer && (\n <>\n <Separator />\n <SelectPrimitive.Group\n className=\"mt-2 flex flex-row flex-wrap gap-1 px-2\"\n data-testid=\"selected-labels\"\n >\n {footer}\n </SelectPrimitive.Group>\n </>\n )}\n </SelectPrimitive.Viewport>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n\n <ErrorMessage message={error} />\n </div>\n )\n }\n)\n\nSelect.displayName = 'Select'\n\nexport default Select\n","'use client'\r\n\r\nimport * as SeparatorPrimitive from '@radix-ui/react-separator'\r\nimport * as React from 'react'\r\n\r\nimport { cn } from '@/lib/utils'\r\n\r\nconst Separator = React.forwardRef<\r\n React.ElementRef<typeof SeparatorPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\r\n>(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (\r\n <SeparatorPrimitive.Root\r\n ref={ref}\r\n decorative={decorative}\r\n orientation={orientation}\r\n className={cn(\r\n 'shrink-0 bg-grey-10',\r\n orientation === 'horizontal' ? 'h-[1px] w-full' : 'h-full w-[1px]',\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nSeparator.displayName = SeparatorPrimitive.Root.displayName\r\n\r\nexport { Separator }\r\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 { cva, type VariantProps } from 'cva'\nimport React from 'react'\nimport { twMerge } from 'tailwind-merge'\n\ninterface ChipProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof chipVariants> {}\n\nconst Chip = ({ className, variant, size, ...props }: ChipProps) => (\n <div className={twMerge(chipVariants({ variant, size, className }))} {...props} />\n)\n\nconst chipVariants = cva(['flex', 'items-center', 'rounded-3xl', 'border', 'w-fit'], {\n variants: {\n variant: {\n neutral: ['text-grey-80', 'border-grey-10'],\n primary: ['text-purple-100', 'border-purple-20'],\n danger: ['text-pumpkin-100', 'border-pumpkin-20'],\n onboarding: ['text-green-100', 'bg-green-10', 'cursor-pointer'],\n onboardingSelected: ['text-white', 'bg-green-90', 'cursor-pointer'],\n },\n size: {\n small: ['text-sm', 'leading-5', 'px-2', 'py-1', 'gap-1.5'],\n medium: ['text-base', 'leading-6', 'px-3', 'py-2', 'gap-2'],\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'medium',\n },\n})\n\nexport default Chip\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 { InfoIcon } from 'lucide-react'\nimport { type ComponentPropsWithoutRef } from 'react'\n\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/components/primitives/tooltip'\nimport { cn } from '@/lib/utils'\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\"> *</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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAAiC;AACjC,IAAAA,uBAA8C;AAC9C,mBAOO;;;ACTP,yBAAoC;AACpC,YAAuB;;;ACHvB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADME;AAJF,IAAM,YAAkB,iBAGtB,CAAC,EAAE,WAAW,cAAc,cAAc,aAAa,MAAM,GAAG,MAAM,GAAG,QACzE;AAAA,EAAoB;AAAA,EAAnB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,gBAAgB,eAAe,mBAAmB;AAAA,MAClD;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,UAAU,cAAiC,wBAAK;;;AEvBhD,iBAAuC;AAEvC,IAAAC,yBAAwB;AAOtB,IAAAC,sBAAA;AADF,IAAM,OAAO,CAAC,EAAE,WAAW,SAAS,MAAM,GAAG,MAAM,MACjD,6CAAC,SAAI,eAAW,gCAAQ,aAAa,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAI,GAAG,OAAO;AAGlF,IAAM,mBAAe,gBAAI,CAAC,QAAQ,gBAAgB,eAAe,UAAU,OAAO,GAAG;AAAA,EACnF,UAAU;AAAA,IACR,SAAS;AAA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AAA,0BAC1C,SAAS,MAAM,aAAaA,MAAK;AAAA,0BAEjC;AAAA,yEAAiB,0BAAhB,EAA0B,iBAAM;AAAA,4BACjC;AAAA,8BAAC;AAAA;AAAA,gCACC,WAAU;AAAA,gCACV,MAAM;AAAA;AAAA,4BACR;AAAA;AAAA;AAAA,wBAXKC;AAAA,sBAYP,CACD;AAAA,sBAEA,CAAC,CAAC,UACD,8EACE;AAAA,qEAAC,aAAU;AAAA,wBACX;AAAA,0BAAiB;AAAA,0BAAhB;AAAA,4BACC,WAAU;AAAA,4BACV,eAAY;AAAA,4BAEX;AAAA;AAAA,wBACH;AAAA,yBACF;AAAA,uBAEJ;AAAA;AAAA,gBACF,GACF;AAAA;AAAA;AAAA,UACF;AAAA,UAEA,6CAAC,wBAAa,SAAS,OAAO;AAAA;AAAA;AAAA,IAChC;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;AAErB,IAAO,iBAAQ;","names":["import_lucide_react","import_tailwind_merge","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","value","id"]}
|
|
@@ -125,9 +125,20 @@ function Label({ text, required, description, className, ...props }) {
|
|
|
125
125
|
var Label_default = Label;
|
|
126
126
|
|
|
127
127
|
// src/components/ui/Select.tsx
|
|
128
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
128
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
129
129
|
var Select = forwardRef3(
|
|
130
|
-
({
|
|
130
|
+
({
|
|
131
|
+
label,
|
|
132
|
+
options,
|
|
133
|
+
placeholder,
|
|
134
|
+
multiselect,
|
|
135
|
+
description,
|
|
136
|
+
classNames,
|
|
137
|
+
error,
|
|
138
|
+
id,
|
|
139
|
+
children: footer,
|
|
140
|
+
...props
|
|
141
|
+
}, ref) => {
|
|
131
142
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
132
143
|
const [selected, setSelected] = useState([]);
|
|
133
144
|
const [open, setOpen] = useState(false);
|
|
@@ -216,28 +227,30 @@ var Select = forwardRef3(
|
|
|
216
227
|
onPointerDownOutside: toggleOpen,
|
|
217
228
|
onKeyDown: closeOnEscape,
|
|
218
229
|
children: /* @__PURE__ */ jsxs2(SelectPrimitive.Viewport, { children: [
|
|
219
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
231
|
+
/* @__PURE__ */ jsx6(
|
|
232
|
+
SelectPrimitive.Group,
|
|
233
|
+
{
|
|
234
|
+
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
235
|
+
"data-testid": "selected-labels",
|
|
236
|
+
children: chipLabels?.map(
|
|
237
|
+
(chip) => chip && /* @__PURE__ */ jsxs2(Chip_default, { size: "small", variant: "primary", children: [
|
|
238
|
+
/* @__PURE__ */ jsx6("span", { children: chip.title }),
|
|
239
|
+
/* @__PURE__ */ jsx6(
|
|
240
|
+
X,
|
|
241
|
+
{
|
|
242
|
+
size: 18,
|
|
243
|
+
"data-testid": `chip-remove-${chip.value}`,
|
|
244
|
+
className: "cursor-pointer",
|
|
245
|
+
onClick: () => handleChange(chip.value)
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] }, chip.title)
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ jsx6(Separator, {})
|
|
253
|
+
] }),
|
|
241
254
|
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs2(
|
|
242
255
|
SelectPrimitive.Item,
|
|
243
256
|
{
|
|
@@ -258,7 +271,18 @@ var Select = forwardRef3(
|
|
|
258
271
|
]
|
|
259
272
|
},
|
|
260
273
|
id2
|
|
261
|
-
))
|
|
274
|
+
)),
|
|
275
|
+
!!footer && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
276
|
+
/* @__PURE__ */ jsx6(Separator, {}),
|
|
277
|
+
/* @__PURE__ */ jsx6(
|
|
278
|
+
SelectPrimitive.Group,
|
|
279
|
+
{
|
|
280
|
+
className: "mt-2 flex flex-row flex-wrap gap-1 px-2",
|
|
281
|
+
"data-testid": "selected-labels",
|
|
282
|
+
children: footer
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] })
|
|
262
286
|
] })
|
|
263
287
|
}
|
|
264
288
|
) })
|