@next-degree/pickle-shared-js 0.3.27 → 0.4.31
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/app/layout.css +59 -2
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +464 -114
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +442 -92
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/ComboboxDemo.cjs +91 -52
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +84 -45
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/CounterDemo.cjs +270 -0
- package/dist/components/demos/CounterDemo.cjs.map +1 -0
- package/dist/components/demos/CounterDemo.d.cts +5 -0
- package/dist/components/demos/CounterDemo.d.ts +5 -0
- package/dist/components/demos/CounterDemo.js +238 -0
- package/dist/components/demos/CounterDemo.js.map +1 -0
- package/dist/components/demos/InputDemo.cjs +74 -35
- package/dist/components/demos/InputDemo.cjs.map +1 -1
- package/dist/components/demos/InputDemo.js +59 -30
- package/dist/components/demos/InputDemo.js.map +1 -1
- package/dist/components/demos/PlacesQueryInputDemo.cjs +341 -0
- package/dist/components/demos/PlacesQueryInputDemo.cjs.map +1 -0
- package/dist/components/demos/PlacesQueryInputDemo.d.cts +5 -0
- package/dist/components/demos/PlacesQueryInputDemo.d.ts +5 -0
- package/dist/components/demos/PlacesQueryInputDemo.js +309 -0
- package/dist/components/demos/PlacesQueryInputDemo.js.map +1 -0
- package/dist/components/demos/SelectDemo.cjs +83 -53
- package/dist/components/demos/SelectDemo.cjs.map +1 -1
- package/dist/components/demos/SelectDemo.js +73 -43
- package/dist/components/demos/SelectDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +462 -112
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +440 -90
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/primitives/command.d.cts +1 -1
- package/dist/components/primitives/command.d.ts +1 -1
- package/dist/components/primitives/tooltip.cjs +75 -0
- package/dist/components/primitives/tooltip.cjs.map +1 -0
- package/dist/components/primitives/tooltip.d.cts +9 -0
- package/dist/components/primitives/tooltip.d.ts +9 -0
- package/dist/components/primitives/tooltip.js +38 -0
- package/dist/components/primitives/tooltip.js.map +1 -0
- package/dist/components/ui/Combobox.cjs +78 -40
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.d.cts +5 -2
- package/dist/components/ui/Combobox.d.ts +5 -2
- package/dist/components/ui/Combobox.js +71 -33
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Counter.cjs +248 -0
- package/dist/components/ui/Counter.cjs.map +1 -0
- package/dist/components/ui/Counter.d.cts +28 -0
- package/dist/components/ui/Counter.d.ts +28 -0
- package/dist/components/ui/Counter.js +214 -0
- package/dist/components/ui/Counter.js.map +1 -0
- package/dist/components/ui/Input.cjs +67 -28
- package/dist/components/ui/Input.cjs.map +1 -1
- package/dist/components/ui/Input.d.cts +2 -1
- package/dist/components/ui/Input.d.ts +2 -1
- package/dist/components/ui/Input.js +54 -25
- package/dist/components/ui/Input.js.map +1 -1
- package/dist/components/ui/Label.cjs +54 -16
- package/dist/components/ui/Label.cjs.map +1 -1
- package/dist/components/ui/Label.d.cts +2 -1
- package/dist/components/ui/Label.d.ts +2 -1
- package/dist/components/ui/Label.js +44 -16
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/PlacesQueryInput.cjs +321 -0
- package/dist/components/ui/PlacesQueryInput.cjs.map +1 -0
- package/dist/components/ui/PlacesQueryInput.d.cts +18 -0
- package/dist/components/ui/PlacesQueryInput.d.ts +18 -0
- package/dist/components/ui/PlacesQueryInput.js +289 -0
- package/dist/components/ui/PlacesQueryInput.js.map +1 -0
- package/dist/components/ui/Select.cjs +75 -46
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.cts +3 -2
- package/dist/components/ui/Select.d.ts +3 -2
- package/dist/components/ui/Select.js +67 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +536 -230
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +510 -206
- package/dist/index.js.map +1 -1
- package/dist/lib/google.cjs +43 -0
- package/dist/lib/google.cjs.map +1 -0
- package/dist/lib/google.d.cts +5 -0
- package/dist/lib/google.d.ts +5 -0
- package/dist/lib/google.js +19 -0
- package/dist/lib/google.js.map +1 -0
- package/dist/styles/globals.css +59 -2
- package/dist/styles/globals.css.map +1 -1
- package/package.json +22 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/demos/SelectDemo.tsx","../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx"],"sourcesContent":["import Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className=\"m-4\">\n <h3>Select</h3>\n <div className=\"mt-2 flex max-w-sm flex-col gap-4\">\n <Select\n required\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo\n","'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 ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\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 onChange?: (value: string | string[]) => void\n classNames?: { label?: string; trigger?: string }\n error?: string\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {\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 setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\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 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 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 min-w-80 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={handleLabels()}\n >\n {handleLabels()}\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","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\"> *</span>}\n </label>\n )\n}\n\nexport default Label\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","'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-[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MACA;AAAA,QAAC;AAAA;AAAA,UACC,aAAW;AAAA,UACX,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,MAAM,OAAO,MAAM,OAAO,YAAY;AAAA,UAC9C;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,UAC3C;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,qBAAQ;","names":["import_jsx_runtime","import_tailwind_merge","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","value","id","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/demos/SelectDemo.tsx","../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx"],"sourcesContent":["import Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className=\"m-4\">\n <h3>Select</h3>\n <div className=\"mt-2 flex max-w-sm flex-col gap-4\">\n <Select\n required\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n description=\"This is a tooltip\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo\n","'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 ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\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 setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\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={handleLabels()}\n >\n {handleLabels()}\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","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\"> *</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","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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,sBAAiC;AACjC,IAAAA,uBAA8C;AAC9C,mBAOO;;;ACXP,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;A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AA,UACX,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,MAAM,OAAO,MAAM,OAAO,YAAY;AAAA,UAC9C;AAAA;AAAA,MACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,UAC3C;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,qBAAQ;","names":["import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_tailwind_merge","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","value","id","import_jsx_runtime"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
3
|
import { CheckIcon, ChevronDownIcon, X } from "lucide-react";
|
|
4
4
|
import {
|
|
5
|
-
forwardRef as
|
|
5
|
+
forwardRef as forwardRef3,
|
|
6
6
|
useEffect,
|
|
7
7
|
useRef,
|
|
8
8
|
useState
|
|
@@ -23,32 +23,60 @@ function ErrorMessage({ message, className, ...props }) {
|
|
|
23
23
|
}
|
|
24
24
|
var ErrorMessage_default = ErrorMessage;
|
|
25
25
|
|
|
26
|
+
// src/components/primitives/tooltip.tsx
|
|
27
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
28
|
+
import * as React from "react";
|
|
29
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
30
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
31
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
32
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
33
|
+
var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(
|
|
34
|
+
TooltipPrimitive.Content,
|
|
35
|
+
{
|
|
36
|
+
ref,
|
|
37
|
+
sideOffset,
|
|
38
|
+
className: cn(
|
|
39
|
+
"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",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
46
|
+
|
|
26
47
|
// src/components/ui/Label.tsx
|
|
27
|
-
import {
|
|
28
|
-
|
|
48
|
+
import { InfoIcon } from "lucide-react";
|
|
49
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
50
|
+
function Label({ text, required, description, className, ...props }) {
|
|
29
51
|
if (!text) return null;
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-row gap-1", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
"label",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props,
|
|
61
|
+
children: [
|
|
62
|
+
text,
|
|
63
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-red-600", children: "\xA0*" })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
!!description && /* @__PURE__ */ jsx3(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(InfoIcon, { className: "h-4 w-4" }) }),
|
|
69
|
+
/* @__PURE__ */ jsx3(TooltipContent, { className: "max-w-48", children: description })
|
|
70
|
+
] }) })
|
|
71
|
+
] });
|
|
44
72
|
}
|
|
45
73
|
var Label_default = Label;
|
|
46
74
|
|
|
47
75
|
// src/components/ui/Chip.tsx
|
|
48
76
|
import { cva } from "cva";
|
|
49
77
|
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
50
|
-
import { jsx as
|
|
51
|
-
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */
|
|
78
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
79
|
+
var Chip = ({ className, variant, size, ...props }) => /* @__PURE__ */ jsx4("div", { className: twMerge2(chipVariants({ variant, size, className })), ...props });
|
|
52
80
|
var chipVariants = cva(["flex", "items-center", "rounded-3xl", "border", "w-fit"], {
|
|
53
81
|
variants: {
|
|
54
82
|
variant: {
|
|
@@ -72,9 +100,9 @@ var Chip_default = Chip;
|
|
|
72
100
|
|
|
73
101
|
// src/components/primitives/separator.tsx
|
|
74
102
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
75
|
-
import * as
|
|
76
|
-
import { jsx as
|
|
77
|
-
var Separator =
|
|
103
|
+
import * as React2 from "react";
|
|
104
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
105
|
+
var Separator = React2.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
78
106
|
SeparatorPrimitive.Root,
|
|
79
107
|
{
|
|
80
108
|
ref,
|
|
@@ -91,9 +119,9 @@ var Separator = React.forwardRef(({ className, orientation = "horizontal", decor
|
|
|
91
119
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
92
120
|
|
|
93
121
|
// src/components/ui/Select.tsx
|
|
94
|
-
import { jsx as
|
|
95
|
-
var Select =
|
|
96
|
-
({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {
|
|
122
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
123
|
+
var Select = forwardRef3(
|
|
124
|
+
({ label, options, placeholder, multiselect, description, classNames, error, id, ...props }, ref) => {
|
|
97
125
|
const { value, defaultValue, dir, className, onChange, ...rest } = props;
|
|
98
126
|
const [selected, setSelected] = useState([]);
|
|
99
127
|
const [open, setOpen] = useState(false);
|
|
@@ -126,16 +154,17 @@ var Select = forwardRef2(
|
|
|
126
154
|
return /* @__PURE__ */ jsxs2(
|
|
127
155
|
"div",
|
|
128
156
|
{
|
|
129
|
-
className: cn("flex flex-col gap-1", className),
|
|
157
|
+
className: cn("flex w-full flex-col gap-1", className),
|
|
130
158
|
ref: containerRef,
|
|
131
159
|
"data-testid": `${(label ?? id)?.toLowerCase()}-select-element`,
|
|
132
160
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsx6(
|
|
134
162
|
Label_default,
|
|
135
163
|
{
|
|
136
164
|
text: label,
|
|
137
165
|
htmlFor: props.name,
|
|
138
166
|
required: props.required,
|
|
167
|
+
description,
|
|
139
168
|
className: classNames?.label
|
|
140
169
|
}
|
|
141
170
|
),
|
|
@@ -155,11 +184,11 @@ var Select = forwardRef2(
|
|
|
155
184
|
{
|
|
156
185
|
ref,
|
|
157
186
|
className: cn(
|
|
158
|
-
"group flex h-11
|
|
187
|
+
"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",
|
|
159
188
|
classNames?.trigger
|
|
160
189
|
),
|
|
161
190
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", children: /* @__PURE__ */ jsx6(
|
|
163
192
|
SelectPrimitive.Value,
|
|
164
193
|
{
|
|
165
194
|
placeholder: placeholder ?? "Select an option",
|
|
@@ -167,7 +196,7 @@ var Select = forwardRef2(
|
|
|
167
196
|
children: handleLabels()
|
|
168
197
|
}
|
|
169
198
|
) }),
|
|
170
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ jsx6(
|
|
171
200
|
ChevronDownIcon,
|
|
172
201
|
{
|
|
173
202
|
className: "transform text-black group-data-[state=open]:rotate-180",
|
|
@@ -177,7 +206,7 @@ var Select = forwardRef2(
|
|
|
177
206
|
]
|
|
178
207
|
}
|
|
179
208
|
),
|
|
180
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.Portal, { container: containerRef.current, children: /* @__PURE__ */ jsx6(
|
|
181
210
|
SelectPrimitive.Content,
|
|
182
211
|
{
|
|
183
212
|
hideWhenDetached: true,
|
|
@@ -187,15 +216,15 @@ var Select = forwardRef2(
|
|
|
187
216
|
onPointerDownOutside: toggleOpen,
|
|
188
217
|
onKeyDown: closeOnEscape,
|
|
189
218
|
children: /* @__PURE__ */ jsxs2(SelectPrimitive.Viewport, { children: [
|
|
190
|
-
multiselect && !!chipLabels?.length && /* @__PURE__ */
|
|
219
|
+
multiselect && !!chipLabels?.length && /* @__PURE__ */ jsx6(
|
|
191
220
|
SelectPrimitive.Group,
|
|
192
221
|
{
|
|
193
222
|
className: "mb-2 flex flex-row flex-wrap gap-1 px-2",
|
|
194
223
|
"data-testid": "selected-labels",
|
|
195
224
|
children: chipLabels?.map(
|
|
196
225
|
(chip) => chip && /* @__PURE__ */ jsxs2(Chip_default, { size: "small", variant: "primary", children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ jsx6("span", { children: chip.title }),
|
|
227
|
+
/* @__PURE__ */ jsx6(
|
|
199
228
|
X,
|
|
200
229
|
{
|
|
201
230
|
size: 18,
|
|
@@ -208,7 +237,7 @@ var Select = forwardRef2(
|
|
|
208
237
|
)
|
|
209
238
|
}
|
|
210
239
|
),
|
|
211
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ jsx6(Separator, {}),
|
|
212
241
|
options?.map(({ id: id2, title, value: value2 }) => /* @__PURE__ */ jsxs2(
|
|
213
242
|
SelectPrimitive.Item,
|
|
214
243
|
{
|
|
@@ -218,8 +247,8 @@ var Select = forwardRef2(
|
|
|
218
247
|
onKeyDown: (e) => setValueOnEnter(e, value2),
|
|
219
248
|
onClick: () => handleChange(value2),
|
|
220
249
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ jsx6(SelectPrimitive.ItemText, { children: title }),
|
|
251
|
+
/* @__PURE__ */ jsx6(
|
|
223
252
|
CheckIcon,
|
|
224
253
|
{
|
|
225
254
|
className: "absolute inset-y-0 right-3 my-auto hidden w-6 text-purple-100 group-data-[state=checked]:block",
|
|
@@ -236,7 +265,7 @@ var Select = forwardRef2(
|
|
|
236
265
|
]
|
|
237
266
|
}
|
|
238
267
|
),
|
|
239
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ jsx6(ErrorMessage_default, { message: error })
|
|
240
269
|
]
|
|
241
270
|
}
|
|
242
271
|
);
|
|
@@ -246,12 +275,12 @@ Select.displayName = "Select";
|
|
|
246
275
|
var Select_default = Select;
|
|
247
276
|
|
|
248
277
|
// src/components/demos/SelectDemo.tsx
|
|
249
|
-
import { jsx as
|
|
278
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
250
279
|
function SelectDemo() {
|
|
251
280
|
return /* @__PURE__ */ jsxs3("div", { className: "m-4", children: [
|
|
252
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ jsx7("h3", { children: "Select" }),
|
|
253
282
|
/* @__PURE__ */ jsxs3("div", { className: "mt-2 flex max-w-sm flex-col gap-4", children: [
|
|
254
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ jsx7(
|
|
255
284
|
Select_default,
|
|
256
285
|
{
|
|
257
286
|
required: true,
|
|
@@ -264,12 +293,13 @@ function SelectDemo() {
|
|
|
264
293
|
]
|
|
265
294
|
}
|
|
266
295
|
),
|
|
267
|
-
/* @__PURE__ */
|
|
296
|
+
/* @__PURE__ */ jsx7(
|
|
268
297
|
Select_default,
|
|
269
298
|
{
|
|
270
299
|
multiselect: true,
|
|
271
300
|
label: "Label - Multiselect",
|
|
272
301
|
placeholder: "Select an option",
|
|
302
|
+
description: "This is a tooltip",
|
|
273
303
|
options: [
|
|
274
304
|
{ id: "1", value: "1", title: "Option 1" },
|
|
275
305
|
{ id: "2", value: "2", title: "Option 2" },
|
|
@@ -284,7 +314,7 @@ function SelectDemo() {
|
|
|
284
314
|
]
|
|
285
315
|
}
|
|
286
316
|
),
|
|
287
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ jsx7(
|
|
288
318
|
Select_default,
|
|
289
319
|
{
|
|
290
320
|
disabled: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx","../../../src/components/demos/SelectDemo.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 ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\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 onChange?: (value: string | string[]) => void\n classNames?: { label?: string; trigger?: string }\n error?: string\n}\n\nconst Select = forwardRef<HTMLButtonElement, Props>(\n ({ label, options, placeholder, multiselect, classNames, error, id, ...props }, ref) => {\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 setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\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 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 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 min-w-80 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={handleLabels()}\n >\n {handleLabels()}\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","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\"> *</span>}\n </label>\n )\n}\n\nexport default Label\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","'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 Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className=\"m-4\">\n <h3>Select</h3>\n <div className=\"mt-2 flex max-w-sm flex-col gap-4\">\n <Select\n required\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo\n"],"mappings":";AAEA,YAAY,qBAAqB;AACjC,SAAS,WAAW,iBAAiB,SAAS;AAC9C;AAAA,EAEE,cAAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACXP,SAA0B,YAAY;AACtC,S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AAA,QAAC;AAAA;AAAA,UACC,aAAW;AAAA,UACX,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,MAAM,OAAO,MAAM,OAAO,YAAY;AAAA,UAC9C;AAAA;AAAA,MACF;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,UAAQ;AAAA,UACR,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,SAAS;AAAA,YACP,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,YACzC,EAAE,IAAI,KAAK,OAAO,KAAK,OAAO,WAAW;AAAA,UAC3C;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,qBAAQ;","names":["forwardRef","jsx","twMerge","jsx","jsx","jsx","jsxs","forwardRef","value","id","jsx","jsxs"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/Select.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/primitives/tooltip.tsx","../../../src/components/ui/Label.tsx","../../../src/components/ui/Chip.tsx","../../../src/components/primitives/separator.tsx","../../../src/components/demos/SelectDemo.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 ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport Chip from '@/components/ui/Chip'\nimport { Separator } from '@/components/primitives/separator'\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 setValueOnEnter = (event: KeyboardEvent, value: string) =>\n event.key === 'Enter' && handleChange(value)\n\n const chipLabels = selected\n ?.map((s) => options?.find(({ value }) => value === s))\n .filter(Boolean)\n\n function handleLabels() {\n if (multiselect) {\n return selected.map((o) => options?.find((option) => option.value === o)?.title).join(', ')\n }\n return options?.find((option) => option.value === selected.join())?.title\n }\n\n function handleOnOpenChange(isOpen: boolean) {\n if (!multiselect || isOpen) setOpen(isOpen)\n }\n\n function handleChange(newValue: string) {\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={handleLabels()}\n >\n {handleLabels()}\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","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\"> *</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","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","'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 Select from '@/components/ui/Select'\n\nfunction SelectDemo() {\n return (\n <div className=\"m-4\">\n <h3>Select</h3>\n <div className=\"mt-2 flex max-w-sm flex-col gap-4\">\n <Select\n required\n label=\"Label - Singleselect\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n <Select\n multiselect\n label=\"Label - Multiselect\"\n placeholder=\"Select an option\"\n description=\"This is a tooltip\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n { id: '4', value: '4', title: 'Option 4' },\n { id: '5', value: '5', title: 'Option 5' },\n { id: '6', value: '6', title: 'Option 6' },\n { id: '7', value: '7', title: 'Option 7' },\n { id: '8', value: '8', title: 'Option 8' },\n { id: '9', value: '9', title: 'Option 9' },\n { id: '10', value: '10', title: 'Option 10' },\n ]}\n />\n <Select\n disabled\n label=\"Label - Disabled\"\n placeholder=\"Select an option\"\n options={[\n { id: '1', value: '1', title: 'Option 1' },\n { id: '2', value: '2', title: 'Option 2' },\n { id: '3', value: '3', title: 'Option 3' },\n ]}\n />\n </div>\n </div>\n )\n}\n\nexport default SelectDemo\n"],"mappings":";AAEA,YAAY,qBAAqB;AACjC,SAAS,WAAW,iBAAiB,SAAS;AAC9C;AAAA,EAEE,cAAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACXP,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,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