periplo-ui 4.15.1 → 4.16.1
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/data-display/Chip/Chip.d.ts +35 -6
- package/dist/components/data-display/Chip/Chip.js +68 -18
- package/dist/components/data-display/Chip/Chip.js.map +1 -1
- package/dist/components/feedback/Dialog/Dialog.js +1 -1
- package/dist/components/feedback/Dialog/Dialog.js.map +1 -1
- package/dist/components/feedback/Skeleton/Skeleton.js +1 -1
- package/dist/components/feedback/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/inputs/Button/Button.js +1 -1
- package/dist/components/inputs/Button/Button.js.map +1 -1
- package/dist/components/inputs/Combobox/Combobox.js +2 -1
- package/dist/components/inputs/Combobox/Combobox.js.map +1 -1
- package/dist/components/inputs/Combobox/StaticComboboxList.js +1 -2
- package/dist/components/inputs/Combobox/StaticComboboxList.js.map +1 -1
- package/dist/components/inputs/Combobox/VirtualizedComboboxList.js +1 -2
- package/dist/components/inputs/Combobox/VirtualizedComboboxList.js.map +1 -1
- package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js +12 -13
- package/dist/components/inputs/InlineMultiSelect/InlineMultiSelect.js.map +1 -1
- package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js +1 -1
- package/dist/components/inputs/LazyDatePicker/LazyDatePicker.js.map +1 -1
- package/dist/components/inputs/MultiSelect/MultiSelect.js +12 -13
- package/dist/components/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/inputs/PhoneInput/PhoneInput.js +2 -1
- package/dist/components/inputs/PhoneInput/PhoneInput.js.map +1 -1
- package/dist/components/inputs/Select/Select.js +6 -5
- package/dist/components/inputs/Select/Select.js.map +1 -1
- package/dist/components/inputs/Toggle/Toggle.js +1 -1
- package/dist/components/inputs/Toggle/Toggle.js.map +1 -1
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js +7 -6
- package/dist/components/navigation/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/navigation/Sheet/Sheet.js +1 -1
- package/dist/components/navigation/Sheet/Sheet.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarMenu.js +2 -2
- package/dist/components/navigation/Sidebar/SidebarMenu.js.map +1 -1
- package/dist/components/navigation/Sidebar/SidebarUser.js +1 -1
- package/dist/components/navigation/Sidebar/SidebarUser.js.map +1 -1
- package/dist/components/navigation/Sidebar/styles.d.ts +1 -1
- package/dist/components/navigation/Sidebar/styles.js +3 -1
- package/dist/components/navigation/Sidebar/styles.js.map +1 -1
- package/dist/components/utils/Command/Command.js +8 -7
- package/dist/components/utils/Command/Command.js.map +1 -1
- package/dist/components/utils/Popover/Popover.js +2 -1
- package/dist/components/utils/Popover/Popover.js.map +1 -1
- package/dist/lib/surface.d.ts +5 -0
- package/dist/lib/surface.js +10 -0
- package/dist/lib/surface.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
type ChipVariant = 'default' | 'ghost' | 'primary' | 'secondary' | 'error' | 'success' | 'tint' | 'dashed' | 'subtle';
|
|
3
4
|
declare const chipVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "success" | "error" | "secondary" | "ghost" | "default" | null | undefined;
|
|
5
|
+
variant?: "primary" | "success" | "error" | "secondary" | "ghost" | "dashed" | "default" | "tint" | "subtle" | null | undefined;
|
|
5
6
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
7
|
rounded?: "square" | "full" | null | undefined;
|
|
7
8
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
-
|
|
9
|
+
type ChipSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
type ChipBaseProps = {
|
|
9
11
|
/**
|
|
10
12
|
* The visual style of the chip.
|
|
11
13
|
* @default default
|
|
12
14
|
*/
|
|
13
|
-
variant?:
|
|
15
|
+
variant?: ChipVariant;
|
|
14
16
|
/**
|
|
15
17
|
* The size of the chip, affecting padding and font size.
|
|
16
18
|
* @default md
|
|
17
19
|
*/
|
|
18
|
-
size?:
|
|
20
|
+
size?: ChipSize;
|
|
19
21
|
/**
|
|
20
22
|
* The roundedness of the chip, affecting the border radius.
|
|
21
23
|
* @default full
|
|
22
24
|
*/
|
|
23
25
|
rounded?: 'full' | 'square';
|
|
26
|
+
/**
|
|
27
|
+
* An optional leading icon, rendered before the chip's content (e.g. a lock or plus icon).
|
|
28
|
+
*/
|
|
29
|
+
icon?: React.ReactNode;
|
|
24
30
|
/**
|
|
25
31
|
* Optional callback for when the remove button is clicked.
|
|
26
32
|
* When provided, displays a remove button on the chip.
|
|
@@ -40,7 +46,24 @@ export type ChipProps = {
|
|
|
40
46
|
* Additional CSS classes to apply to the chip.
|
|
41
47
|
*/
|
|
42
48
|
className?: string;
|
|
43
|
-
} & React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof chipVariants>;
|
|
49
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> & VariantProps<typeof chipVariants>;
|
|
50
|
+
export type ChipProps = ChipBaseProps & ({
|
|
51
|
+
/**
|
|
52
|
+
* Wraps the chip's content in an inner, keyboard-accessible button, so it can be pressed
|
|
53
|
+
* (e.g. to open a related panel). Required to use `onClick`.
|
|
54
|
+
*/
|
|
55
|
+
pressable: true;
|
|
56
|
+
/**
|
|
57
|
+
* Click handler, fired on the inner button.
|
|
58
|
+
*/
|
|
59
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
60
|
+
} | {
|
|
61
|
+
/**
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
pressable?: false;
|
|
65
|
+
onClick?: never;
|
|
66
|
+
});
|
|
44
67
|
/**
|
|
45
68
|
* A chip component for displaying compact information with optional remove functionality.
|
|
46
69
|
*
|
|
@@ -55,12 +78,18 @@ export type ChipProps = {
|
|
|
55
78
|
* <Chip variant="primary">Primary</Chip>
|
|
56
79
|
* <Chip variant="error">Error</Chip>
|
|
57
80
|
*
|
|
81
|
+
* // With a leading icon (e.g. locked or add state)
|
|
82
|
+
* <Chip variant="tint" icon={<LockIcon size={14} />}>Locked</Chip>
|
|
83
|
+
*
|
|
84
|
+
* // Pressable, to open a related panel
|
|
85
|
+
* <Chip pressable onClick={() => console.log('pressed')}>Pressable</Chip>
|
|
86
|
+
*
|
|
58
87
|
* // Inside button context (e.g., Combobox)
|
|
59
88
|
* <Chip onRemove={() => console.log('removed')} triggerElement="span">
|
|
60
89
|
* Inside Button
|
|
61
90
|
* </Chip>
|
|
62
91
|
*/
|
|
63
|
-
declare function Chip({ className, variant, size, rounded, onRemove, triggerElement, children, ...props }: ChipProps): React.JSX.Element;
|
|
92
|
+
declare function Chip({ className, variant, size, rounded, icon, pressable, onClick, onRemove, triggerElement, children, ...props }: ChipProps): React.JSX.Element;
|
|
64
93
|
declare namespace Chip {
|
|
65
94
|
var displayName: string;
|
|
66
95
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { XIcon } from "@phosphor-icons/react/dist/ssr/X";
|
|
6
6
|
//#region src/components/data-display/Chip/Chip.tsx
|
|
7
|
-
var chipVariants = cva("inline-flex items-center border font-medium transition-colors focus
|
|
7
|
+
var chipVariants = cva("relative inline-flex items-center gap-1.5 border font-medium transition-colors has-[[data-chip-trigger]:focus-visible]:ring-2 has-[[data-chip-trigger]:focus-visible]:ring-ring has-[[data-chip-trigger]:focus-visible]:ring-offset-2", {
|
|
8
8
|
variants: {
|
|
9
9
|
/**
|
|
10
10
|
* Defines the visual style of the chip
|
|
@@ -15,15 +15,18 @@ var chipVariants = cva("inline-flex items-center border font-medium transition-c
|
|
|
15
15
|
primary: "border-transparent bg-primary text-primary-foreground",
|
|
16
16
|
secondary: "border-transparent bg-neutral-950 text-neutral-foreground",
|
|
17
17
|
error: "border-transparent bg-error-600 text-white",
|
|
18
|
-
success: "border-transparent bg-success-600 text-white"
|
|
18
|
+
success: "border-transparent bg-success-600 text-white",
|
|
19
|
+
tint: "border-primary-500 bg-background-200 text-neutral-950 has-[[data-chip-trigger]:focus-visible]:ring-primary-500",
|
|
20
|
+
dashed: "border-dashed border-primary-500 bg-white text-neutral-950 has-[[data-chip-trigger]:focus-visible]:border-solid has-[[data-chip-trigger]:focus-visible]:ring-primary-500",
|
|
21
|
+
subtle: "border-transparent bg-white text-neutral-950 has-[[data-chip-trigger]:focus-visible]:border-primary-500 has-[[data-chip-trigger]:focus-visible]:ring-primary-500"
|
|
19
22
|
},
|
|
20
23
|
/**
|
|
21
|
-
* Controls the
|
|
24
|
+
* Controls the height and font size of the chip.
|
|
22
25
|
*/
|
|
23
26
|
size: {
|
|
24
|
-
sm: "
|
|
25
|
-
md: "
|
|
26
|
-
lg: "
|
|
27
|
+
sm: "h-7 text-sm",
|
|
28
|
+
md: "h-8 text-sm",
|
|
29
|
+
lg: "h-9 text-md"
|
|
27
30
|
},
|
|
28
31
|
rounded: {
|
|
29
32
|
full: "rounded-full",
|
|
@@ -36,6 +39,37 @@ var chipVariants = cva("inline-flex items-center border font-medium transition-c
|
|
|
36
39
|
rounded: "full"
|
|
37
40
|
}
|
|
38
41
|
});
|
|
42
|
+
var CHIP_PADDING = {
|
|
43
|
+
sm: "px-2.5 py-0.5",
|
|
44
|
+
md: "px-2.5 py-1",
|
|
45
|
+
lg: "px-3 py-1"
|
|
46
|
+
};
|
|
47
|
+
var CHIP_REMOVE_SIZE = {
|
|
48
|
+
sm: "h-5 w-5",
|
|
49
|
+
md: "h-6 w-6",
|
|
50
|
+
lg: "h-7 w-7"
|
|
51
|
+
};
|
|
52
|
+
var CHIP_REMOVE_ICON_SIZE = {
|
|
53
|
+
sm: 12,
|
|
54
|
+
md: 16,
|
|
55
|
+
lg: 18
|
|
56
|
+
};
|
|
57
|
+
var CHIP_PRESSABLE_REMOVE_GAP = {
|
|
58
|
+
sm: "pr-7",
|
|
59
|
+
md: "pr-8",
|
|
60
|
+
lg: "pr-9"
|
|
61
|
+
};
|
|
62
|
+
var CHIP_PRESSABLE_HOVER = {
|
|
63
|
+
default: "[@media(hover:_hover)]:has-[:hover]:bg-neutral-200",
|
|
64
|
+
ghost: "[@media(hover:_hover)]:has-[:hover]:bg-neutral-100/50",
|
|
65
|
+
primary: "[@media(hover:_hover)]:has-[:hover]:bg-primary-700",
|
|
66
|
+
secondary: "[@media(hover:_hover)]:has-[:hover]:bg-neutral-800",
|
|
67
|
+
error: "[@media(hover:_hover)]:has-[:hover]:bg-error-800",
|
|
68
|
+
success: "[@media(hover:_hover)]:has-[:hover]:bg-success-800",
|
|
69
|
+
tint: "[@media(hover:_hover)]:has-[:hover]:bg-background-300",
|
|
70
|
+
dashed: "[@media(hover:_hover)]:has-[:hover]:bg-neutral-50",
|
|
71
|
+
subtle: "[@media(hover:_hover)]:has-[:hover]:bg-neutral-100"
|
|
72
|
+
};
|
|
39
73
|
/**
|
|
40
74
|
* A chip component for displaying compact information with optional remove functionality.
|
|
41
75
|
*
|
|
@@ -50,40 +84,56 @@ var chipVariants = cva("inline-flex items-center border font-medium transition-c
|
|
|
50
84
|
* <Chip variant="primary">Primary</Chip>
|
|
51
85
|
* <Chip variant="error">Error</Chip>
|
|
52
86
|
*
|
|
87
|
+
* // With a leading icon (e.g. locked or add state)
|
|
88
|
+
* <Chip variant="tint" icon={<LockIcon size={14} />}>Locked</Chip>
|
|
89
|
+
*
|
|
90
|
+
* // Pressable, to open a related panel
|
|
91
|
+
* <Chip pressable onClick={() => console.log('pressed')}>Pressable</Chip>
|
|
92
|
+
*
|
|
53
93
|
* // Inside button context (e.g., Combobox)
|
|
54
94
|
* <Chip onRemove={() => console.log('removed')} triggerElement="span">
|
|
55
95
|
* Inside Button
|
|
56
96
|
* </Chip>
|
|
57
97
|
*/
|
|
58
|
-
function Chip({ className, variant = "default", size = "md", rounded = "full", onRemove, triggerElement = "button", children, ...props }) {
|
|
59
|
-
const removeIconClasses = "focus-visible:ring-ring inline-flex
|
|
98
|
+
function Chip({ className, variant = "default", size = "md", rounded = "full", icon, pressable = false, onClick, onRemove, triggerElement = "button", children, ...props }) {
|
|
99
|
+
const removeIconClasses = cn("focus-visible:ring-ring inline-flex cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-black/10 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden", CHIP_REMOVE_SIZE[size]);
|
|
60
100
|
const RemoveElement = triggerElement;
|
|
101
|
+
const removeTriggerProps = triggerElement === "button" ? { type: "button" } : {
|
|
102
|
+
role: "button",
|
|
103
|
+
tabIndex: 0
|
|
104
|
+
};
|
|
105
|
+
const paddingClasses = cn(CHIP_PADDING[size], onRemove && "pr-1");
|
|
106
|
+
const pressableContentPadding = cn(CHIP_PADDING[size], onRemove && CHIP_PRESSABLE_REMOVE_GAP[size]);
|
|
61
107
|
return /* @__PURE__ */ jsxs("div", {
|
|
62
108
|
className: cn(chipVariants({
|
|
63
109
|
variant,
|
|
64
110
|
size,
|
|
65
111
|
rounded
|
|
66
|
-
}),
|
|
112
|
+
}), pressable && CHIP_PRESSABLE_HOVER[variant], !pressable && paddingClasses, className),
|
|
67
113
|
...props,
|
|
68
|
-
children: [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
114
|
+
children: [pressable ? /* @__PURE__ */ jsxs("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
"data-chip-trigger": true,
|
|
117
|
+
className: cn("inline-flex cursor-pointer items-center gap-1.5 rounded-[inherit] focus-visible:outline-hidden", pressableContentPadding),
|
|
118
|
+
onClick,
|
|
119
|
+
children: [icon, children]
|
|
120
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [icon, children] }), onRemove ? /* @__PURE__ */ jsx(RemoveElement, {
|
|
121
|
+
...removeTriggerProps,
|
|
122
|
+
onKeyDown: triggerElement === "span" ? (event) => {
|
|
73
123
|
if (event.key === "Enter" || event.key === " ") {
|
|
74
124
|
event.preventDefault();
|
|
75
125
|
onRemove(event);
|
|
76
126
|
}
|
|
77
|
-
},
|
|
127
|
+
} : void 0,
|
|
78
128
|
onMouseDown: (event) => {
|
|
79
129
|
event.preventDefault();
|
|
80
130
|
event.stopPropagation();
|
|
81
131
|
},
|
|
82
132
|
onClick: onRemove,
|
|
83
|
-
className: removeIconClasses,
|
|
133
|
+
className: cn(removeIconClasses, pressable && "absolute top-1/2 right-1 -translate-y-1/2"),
|
|
84
134
|
"aria-label": "Remove",
|
|
85
135
|
children: /* @__PURE__ */ jsx(XIcon, {
|
|
86
|
-
size:
|
|
136
|
+
size: CHIP_REMOVE_ICON_SIZE[size],
|
|
87
137
|
weight: "regular",
|
|
88
138
|
className: "shrink-0"
|
|
89
139
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","names":[],"sources":["../../../../src/components/data-display/Chip/Chip.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst chipVariants = cva(\n 'inline-flex items-center border font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',\n {\n variants: {\n /**\n * Defines the visual style of the chip\n */\n variant: {\n default: 'border-transparent bg-neutral-100 text-default-foreground',\n ghost: ' bg-transparent border border-neutral-500 text-primary-foreground',\n primary: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-neutral-950 text-neutral-foreground',\n error: 'border-transparent bg-error-600 text-white',\n success: 'border-transparent bg-success-600 text-white',\n },\n /**\n * Controls the size and padding of the chip\n */\n size: {\n sm: 'px-2.5 py-0.5 text-sm',\n md: 'px-2.5 py-1 text-sm',\n lg: 'px-3 py-1 text-md',\n },\n rounded: {\n full: 'rounded-full',\n square: 'rounded-sm',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n rounded: 'full',\n },\n },\n)\n\nexport type ChipProps = {\n /**\n * The visual style of the chip.\n * @default default\n */\n variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'error' | 'success'\n\n /**\n * The size of the chip, affecting padding and font size.\n * @default md\n */\n size?: 'sm' | 'md' | 'lg'\n\n /**\n * The roundedness of the chip, affecting the border radius.\n * @default full\n */\n rounded?: 'full' | 'square'\n\n /**\n * Optional callback for when the remove button is clicked.\n * When provided, displays a remove button on the chip.\n */\n onRemove?: (\n event:\n | React.KeyboardEvent<HTMLButtonElement | HTMLSpanElement>\n | React.MouseEvent<HTMLButtonElement | HTMLSpanElement, MouseEvent>,\n ) => void\n\n /**\n * The HTML element to use for the remove trigger.\n * Use 'span' when the chip is inside a button context to avoid nested buttons.\n * @default 'button'\n */\n triggerElement?: 'button' | 'span'\n\n /**\n * The content to display inside the chip.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS classes to apply to the chip.\n */\n className?: string\n} & React.HTMLAttributes<HTMLDivElement> &\n VariantProps<typeof chipVariants>\n\n/**\n * A chip component for displaying compact information with optional remove functionality.\n *\n * @example\n * // Basic usage\n * <Chip>Label</Chip>\n *\n * // With remove button\n * <Chip onRemove={() => console.log('removed')}>Removable</Chip>\n *\n * // Different variants\n * <Chip variant=\"primary\">Primary</Chip>\n * <Chip variant=\"error\">Error</Chip>\n *\n * // Inside button context (e.g., Combobox)\n * <Chip onRemove={() => console.log('removed')} triggerElement=\"span\">\n * Inside Button\n * </Chip>\n */\nfunction Chip({\n className,\n variant = 'default',\n size = 'md',\n rounded = 'full',\n onRemove,\n triggerElement = 'button',\n children,\n ...props\n}: ChipProps) {\n const removeIconClasses =\n 'focus-visible:ring-ring inline-flex h-6 w-6 items-center justify-center rounded-full transition-colors hover:bg-black/10 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none'\n\n const RemoveElement = triggerElement\n\n return (\n <div className={cn(chipVariants({ variant, size, rounded }), onRemove && 'gap-1.5 pr-1', className)} {...props}>\n {children}\n {onRemove ? (\n <RemoveElement\n {...(triggerElement === 'button' ? { type: 'button' as const } : {})}\n role={triggerElement === 'span' ? 'button' : undefined}\n tabIndex={triggerElement === 'span' ? 0 : undefined}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onRemove(event)\n }\n }}\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={onRemove}\n className={removeIconClasses}\n aria-label=\"Remove\"\n >\n <XIcon size={16} weight=\"regular\" className=\"shrink-0\" />\n </RemoveElement>\n ) : null}\n </div>\n )\n}\nChip.displayName = 'Chip'\n\nexport { Chip, chipVariants }\n"],"mappings":";;;;;;AAMA,IAAM,eAAe,IACnB,qIACA;CACE,UAAU;;;;EAIR,SAAS;GACP,SAAS;GACT,OAAO;GACP,SAAS;GACT,WAAW;GACX,OAAO;GACP,SAAS;EACX;;;;EAIA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,MAAM;GACN,QAAQ;EACV;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,SAAS;CACX;AACF,CACF;;;;;;;;;;;;;;;;;;;;AAqEA,SAAS,KAAK,EACZ,WACA,UAAU,WACV,OAAO,MACP,UAAU,QACV,UACA,iBAAiB,UACjB,UACA,GAAG,SACS;CACZ,MAAM,oBACJ;CAEF,MAAM,gBAAgB;CAEtB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,aAAa;GAAE;GAAS;GAAM;EAAQ,CAAC,GAAG,YAAY,gBAAgB,SAAS;EAAG,GAAI;EAAzG,UAAA,CACG,UACA,WACC,oBAAC,eAAD;GACE,GAAK,mBAAmB,WAAW,EAAE,MAAM,SAAkB,IAAI,CAAC;GAClE,MAAM,mBAAmB,SAAS,WAAW,KAAA;GAC7C,UAAU,mBAAmB,SAAS,IAAI,KAAA;GAC1C,YAAY,UAAU;IACpB,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;KAC9C,MAAM,eAAe;KACrB,SAAS,KAAK;IAChB;GACF;GACA,cAAc,UAAU;IACtB,MAAM,eAAe;IACrB,MAAM,gBAAgB;GACxB;GACA,SAAS;GACT,WAAW;GACX,cAAW;GAEX,UAAA,oBAAC,OAAD;IAAO,MAAM;IAAI,QAAO;IAAU,WAAU;GAAY,CAAA;EAC3C,CAAA,IACb,IACD;;AAET;AACA,KAAK,cAAc"}
|
|
1
|
+
{"version":3,"file":"Chip.js","names":["_Fragment"],"sources":["../../../../src/components/data-display/Chip/Chip.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype ChipVariant = 'default' | 'ghost' | 'primary' | 'secondary' | 'error' | 'success' | 'tint' | 'dashed' | 'subtle'\n\nconst chipVariants = cva(\n 'relative inline-flex items-center gap-1.5 border font-medium transition-colors has-[[data-chip-trigger]:focus-visible]:ring-2 has-[[data-chip-trigger]:focus-visible]:ring-ring has-[[data-chip-trigger]:focus-visible]:ring-offset-2',\n {\n variants: {\n /**\n * Defines the visual style of the chip\n */\n variant: {\n default: 'border-transparent bg-neutral-100 text-default-foreground',\n ghost: ' bg-transparent border border-neutral-500 text-primary-foreground',\n primary: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-neutral-950 text-neutral-foreground',\n error: 'border-transparent bg-error-600 text-white',\n success: 'border-transparent bg-success-600 text-white',\n tint: 'border-primary-500 bg-background-200 text-neutral-950 has-[[data-chip-trigger]:focus-visible]:ring-primary-500',\n dashed:\n 'border-dashed border-primary-500 bg-white text-neutral-950 has-[[data-chip-trigger]:focus-visible]:border-solid has-[[data-chip-trigger]:focus-visible]:ring-primary-500',\n subtle:\n 'border-transparent bg-white text-neutral-950 has-[[data-chip-trigger]:focus-visible]:border-primary-500 has-[[data-chip-trigger]:focus-visible]:ring-primary-500',\n },\n /**\n * Controls the height and font size of the chip.\n */\n size: {\n sm: 'h-7 text-sm',\n md: 'h-8 text-sm',\n lg: 'h-9 text-md',\n },\n rounded: {\n full: 'rounded-full',\n square: 'rounded-sm',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n rounded: 'full',\n },\n },\n)\n\ntype ChipSize = 'sm' | 'md' | 'lg'\n\nconst CHIP_PADDING: Record<ChipSize, string> = {\n sm: 'px-2.5 py-0.5',\n md: 'px-2.5 py-1',\n lg: 'px-3 py-1',\n}\n\nconst CHIP_REMOVE_SIZE: Record<ChipSize, string> = {\n sm: 'h-5 w-5',\n md: 'h-6 w-6',\n lg: 'h-7 w-7',\n}\n\nconst CHIP_REMOVE_ICON_SIZE: Record<ChipSize, number> = {\n sm: 12,\n md: 16,\n lg: 18,\n}\n\n// Reserves room, in the pressable button's own padding, for the absolutely positioned remove\n// control at this size: its diameter (CHIP_REMOVE_SIZE) plus its right-1 inset plus a label gap.\nconst CHIP_PRESSABLE_REMOVE_GAP: Record<ChipSize, string> = {\n sm: 'pr-7',\n md: 'pr-8',\n lg: 'pr-9',\n}\n\n// Keyed off :has(:hover) on the root so hovering the remove button also shows the chip's own hover state.\n// Gated behind the hover media feature (like Tailwind's own hover: variant) so a tap on a touch\n// device doesn't leave the background stuck in its \"hovered\" state until the user taps elsewhere.\nconst CHIP_PRESSABLE_HOVER: Record<ChipVariant, string> = {\n default: '[@media(hover:_hover)]:has-[:hover]:bg-neutral-200',\n ghost: '[@media(hover:_hover)]:has-[:hover]:bg-neutral-100/50',\n primary: '[@media(hover:_hover)]:has-[:hover]:bg-primary-700',\n secondary: '[@media(hover:_hover)]:has-[:hover]:bg-neutral-800',\n error: '[@media(hover:_hover)]:has-[:hover]:bg-error-800',\n success: '[@media(hover:_hover)]:has-[:hover]:bg-success-800',\n tint: '[@media(hover:_hover)]:has-[:hover]:bg-background-300',\n dashed: '[@media(hover:_hover)]:has-[:hover]:bg-neutral-50',\n subtle: '[@media(hover:_hover)]:has-[:hover]:bg-neutral-100',\n}\n\ntype ChipBaseProps = {\n /**\n * The visual style of the chip.\n * @default default\n */\n variant?: ChipVariant\n\n /**\n * The size of the chip, affecting padding and font size.\n * @default md\n */\n size?: ChipSize\n\n /**\n * The roundedness of the chip, affecting the border radius.\n * @default full\n */\n rounded?: 'full' | 'square'\n\n /**\n * An optional leading icon, rendered before the chip's content (e.g. a lock or plus icon).\n */\n icon?: React.ReactNode\n\n /**\n * Optional callback for when the remove button is clicked.\n * When provided, displays a remove button on the chip.\n */\n onRemove?: (\n event:\n | React.KeyboardEvent<HTMLButtonElement | HTMLSpanElement>\n | React.MouseEvent<HTMLButtonElement | HTMLSpanElement, MouseEvent>,\n ) => void\n\n /**\n * The HTML element to use for the remove trigger.\n * Use 'span' when the chip is inside a button context to avoid nested buttons.\n * @default 'button'\n */\n triggerElement?: 'button' | 'span'\n\n /**\n * The content to display inside the chip.\n */\n children?: React.ReactNode\n\n /**\n * Additional CSS classes to apply to the chip.\n */\n className?: string\n} & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> &\n VariantProps<typeof chipVariants>\n\nexport type ChipProps = ChipBaseProps &\n (\n | {\n /**\n * Wraps the chip's content in an inner, keyboard-accessible button, so it can be pressed\n * (e.g. to open a related panel). Required to use `onClick`.\n */\n pressable: true\n /**\n * Click handler, fired on the inner button.\n */\n onClick?: React.MouseEventHandler<HTMLElement>\n }\n | {\n /**\n * @default false\n */\n pressable?: false\n onClick?: never\n }\n )\n\n/**\n * A chip component for displaying compact information with optional remove functionality.\n *\n * @example\n * // Basic usage\n * <Chip>Label</Chip>\n *\n * // With remove button\n * <Chip onRemove={() => console.log('removed')}>Removable</Chip>\n *\n * // Different variants\n * <Chip variant=\"primary\">Primary</Chip>\n * <Chip variant=\"error\">Error</Chip>\n *\n * // With a leading icon (e.g. locked or add state)\n * <Chip variant=\"tint\" icon={<LockIcon size={14} />}>Locked</Chip>\n *\n * // Pressable, to open a related panel\n * <Chip pressable onClick={() => console.log('pressed')}>Pressable</Chip>\n *\n * // Inside button context (e.g., Combobox)\n * <Chip onRemove={() => console.log('removed')} triggerElement=\"span\">\n * Inside Button\n * </Chip>\n */\nfunction Chip({\n className,\n variant = 'default',\n size = 'md',\n rounded = 'full',\n icon,\n pressable = false,\n onClick,\n onRemove,\n triggerElement = 'button',\n children,\n ...props\n}: ChipProps) {\n const removeIconClasses = cn(\n 'focus-visible:ring-ring inline-flex cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-black/10 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',\n CHIP_REMOVE_SIZE[size],\n )\n\n const RemoveElement = triggerElement\n const removeTriggerProps =\n triggerElement === 'button' ? { type: 'button' as const } : { role: 'button' as const, tabIndex: 0 }\n\n const paddingClasses = cn(CHIP_PADDING[size], onRemove && 'pr-1')\n const pressableContentPadding = cn(CHIP_PADDING[size], onRemove && CHIP_PRESSABLE_REMOVE_GAP[size])\n\n return (\n <div\n className={cn(\n chipVariants({ variant, size, rounded }),\n pressable && CHIP_PRESSABLE_HOVER[variant],\n !pressable && paddingClasses,\n className,\n )}\n {...props}\n >\n {pressable ? (\n <button\n type=\"button\"\n data-chip-trigger\n className={cn(\n 'inline-flex cursor-pointer items-center gap-1.5 rounded-[inherit] focus-visible:outline-hidden',\n pressableContentPadding,\n )}\n onClick={onClick}\n >\n {icon}\n {children}\n </button>\n ) : (\n <>\n {icon}\n {children}\n </>\n )}\n {onRemove ? (\n <RemoveElement\n {...removeTriggerProps}\n // Native buttons already turn Enter/Space into a click; only the span fallback needs this.\n onKeyDown={\n triggerElement === 'span'\n ? (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onRemove(event)\n }\n }\n : undefined\n }\n onMouseDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={onRemove}\n className={cn(removeIconClasses, pressable && 'absolute top-1/2 right-1 -translate-y-1/2')}\n aria-label=\"Remove\"\n >\n <XIcon size={CHIP_REMOVE_ICON_SIZE[size]} weight=\"regular\" className=\"shrink-0\" />\n </RemoveElement>\n ) : null}\n </div>\n )\n}\nChip.displayName = 'Chip'\n\nexport { Chip, chipVariants }\n"],"mappings":";;;;;;AAQA,IAAM,eAAe,IACnB,yOACA;CACE,UAAU;;;;EAIR,SAAS;GACP,SAAS;GACT,OAAO;GACP,SAAS;GACT,WAAW;GACX,OAAO;GACP,SAAS;GACT,MAAM;GACN,QACE;GACF,QACE;EACJ;;;;EAIA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,SAAS;GACP,MAAM;GACN,QAAQ;EACV;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,SAAS;CACX;AACF,CACF;AAIA,IAAM,eAAyC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,mBAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,wBAAkD;CACtD,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAIA,IAAM,4BAAsD;CAC1D,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAKA,IAAM,uBAAoD;CACxD,SAAS;CACT,OAAO;CACP,SAAS;CACT,WAAW;CACX,OAAO;CACP,SAAS;CACT,MAAM;CACN,QAAQ;CACR,QAAQ;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;AAsGA,SAAS,KAAK,EACZ,WACA,UAAU,WACV,OAAO,MACP,UAAU,QACV,MACA,YAAY,OACZ,SACA,UACA,iBAAiB,UACjB,UACA,GAAG,SACS;CACZ,MAAM,oBAAoB,GACxB,iNACA,iBAAiB,KACnB;CAEA,MAAM,gBAAgB;CACtB,MAAM,qBACJ,mBAAmB,WAAW,EAAE,MAAM,SAAkB,IAAI;EAAE,MAAM;EAAmB,UAAU;CAAE;CAErG,MAAM,iBAAiB,GAAG,aAAa,OAAO,YAAY,MAAM;CAChE,MAAM,0BAA0B,GAAG,aAAa,OAAO,YAAY,0BAA0B,KAAK;CAElG,OACE,qBAAC,OAAD;EACE,WAAW,GACT,aAAa;GAAE;GAAS;GAAM;EAAQ,CAAC,GACvC,aAAa,qBAAqB,UAClC,CAAC,aAAa,gBACd,SACF;EACA,GAAI;EAPN,UAAA,CASG,YACC,qBAAC,UAAD;GACE,MAAK;GACL,qBAAA;GACA,WAAW,GACT,kGACA,uBACF;GACS;GAPX,UAAA,CASG,MACA,QACK;EAER,CAAA,IAAA,qBAAAA,UAAA,EAAA,UAAA,CACG,MACA,QACD,EAAA,CAAA,GAEH,WACC,oBAAC,eAAD;GACE,GAAI;GAEJ,WACE,mBAAmB,UACd,UAAU;IACT,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;KAC9C,MAAM,eAAe;KACrB,SAAS,KAAK;IAChB;GACF,IACA,KAAA;GAEN,cAAc,UAAU;IACtB,MAAM,eAAe;IACrB,MAAM,gBAAgB;GACxB;GACA,SAAS;GACT,WAAW,GAAG,mBAAmB,aAAa,2CAA2C;GACzF,cAAW;GAEX,UAAA,oBAAC,OAAD;IAAO,MAAM,sBAAsB;IAAO,QAAO;IAAU,WAAU;GAAY,CAAA;EACpE,CAAA,IACb,IACD;;AAET;AACA,KAAK,cAAc"}
|
|
@@ -10,7 +10,7 @@ var DialogPortal = DialogPrimitive.Portal;
|
|
|
10
10
|
var DialogClose = DialogPrimitive.Close;
|
|
11
11
|
var DialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
12
12
|
ref,
|
|
13
|
-
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-
|
|
13
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-neutral-950/32", className),
|
|
14
14
|
...props
|
|
15
15
|
}));
|
|
16
16
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["React"],"sources":["../../../../src/components/feedback/Dialog/Dialog.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n closable?: boolean\n container?: HTMLElement | null\n}\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = DialogPrimitive.Portal\n\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["React"],"sources":["../../../../src/components/feedback/Dialog/Dialog.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n closable?: boolean\n container?: HTMLElement | null\n}\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = DialogPrimitive.Portal\n\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-neutral-950/32',\n className,\n )}\n {...props}\n />\n))\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<React.ComponentRef<typeof DialogPrimitive.Content>, DialogContentProps>(\n ({ className, children, closable = true, container, ...props }, ref) => (\n <DialogPortal container={container}>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-background-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',\n className,\n )}\n onPointerDownOutside={(event) => {\n if (!closable) {\n event.preventDefault()\n }\n }}\n onEscapeKeyDown={(event) => {\n if (!closable) {\n event.preventDefault()\n }\n }}\n {...props}\n >\n {children}\n {closable ? (\n <DialogPrimitive.Close className=\"data-[state=open]:text-muted-foreground ring-offset-background focus:ring-ring data-[state=open]:bg-accent absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none\">\n <XIcon size={24} weight=\"bold\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n ) : null}\n </DialogPrimitive.Content>\n </DialogPortal>\n ),\n)\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col space-y-1.5 text-center sm:text-left', className)} {...props} />\n)\nDialogHeader.displayName = 'DialogHeader'\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />\n)\nDialogFooter.displayName = 'DialogFooter'\n\nconst DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-lg leading-none font-semibold tracking-tight', className)}\n {...props}\n />\n))\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n))\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n"],"mappings":";;;;;;AAWA,IAAM,SAAS,gBAAgB;AAE/B,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgBA,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,gKACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,gBAAgBA,QAAM,YACzB,EAAE,WAAW,UAAU,WAAW,MAAM,WAAW,GAAG,SAAS,QAC9D,qBAAC,cAAD;CAAyB;CAAzB,UAAA,CACE,oBAAC,eAAD,CAAgB,CAAA,GAChB,qBAAC,gBAAgB,SAAjB;EACO;EACL,WAAW,GACT,2VACA,SACF;EAC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
className: cn("animate-pulse rounded-
|
|
7
|
+
className: cn("animate-pulse rounded-lg bg-neutral-100", className),
|
|
8
8
|
...props
|
|
9
9
|
});
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","names":[],"sources":["../../../../src/components/feedback/Skeleton/Skeleton.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\n\nfunction Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div data-testid=\"skeleton\" className={cn('animate-pulse rounded-
|
|
1
|
+
{"version":3,"file":"Skeleton.js","names":[],"sources":["../../../../src/components/feedback/Skeleton/Skeleton.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\n\nfunction Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return <div data-testid=\"skeleton\" className={cn('animate-pulse rounded-lg bg-neutral-100', className)} {...props} />\n}\n\nexport { Skeleton }\n"],"mappings":";;;AAEA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA+C;CAC/E,OAAO,oBAAC,OAAD;EAAK,eAAY;EAAW,WAAW,GAAG,2CAA2C,SAAS;EAAG,GAAI;CAAQ,CAAA;AACtH"}
|
|
@@ -5,7 +5,7 @@ import { cva } from "class-variance-authority";
|
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/inputs/Button/Button.tsx
|
|
8
|
-
var buttonVariants = cva("inline-flex items-center justify-center gap-2 rounded-
|
|
8
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
|
|
9
9
|
variants: {
|
|
10
10
|
/**
|
|
11
11
|
* Defines the visual style of the button
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React"],"sources":["../../../../src/components/inputs/Button/Button.tsx"],"sourcesContent":["import type { Icon, IconWeight, IconProps } from '@phosphor-icons/react'\nimport { SpinnerGapIcon } from '@phosphor-icons/react/dist/ssr/SpinnerGap'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport { typographyVariants } from '../../data-display/Typography'\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 rounded-
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React"],"sources":["../../../../src/components/inputs/Button/Button.tsx"],"sourcesContent":["import type { Icon, IconWeight, IconProps } from '@phosphor-icons/react'\nimport { SpinnerGapIcon } from '@phosphor-icons/react/dist/ssr/SpinnerGap'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../../../lib/utils'\nimport { typographyVariants } from '../../data-display/Typography'\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n /**\n * Defines the visual style of the button\n */\n variant: {\n primary:\n 'bg-primary-500 text-primary-foreground hover:bg-primary-700 active:bg-primary-900 disabled:bg-background-200',\n secondary:\n 'bg-neutral-950 text-neutral-foreground hover:bg-neutral-800 active:bg-neutral-700 disabled:bg-neutral-200 disabled:text-neutral-600',\n ghost:\n 'border border-neutral-500 text-primary-foreground hover:bg-neutral-100/50 active:bg-neutral-200/50 disabled:border-neutral-500 disabled:text-neutral-500',\n 'inverse-ghost':\n 'border border-neutral-50 text-neutral-50 hover:bg-neutral/50 hover:border-neutral-50 active:bg-neutral-600/50 disabled:border-neutral-300 disabled:text-neutral-300',\n text: 'hover:bg-neutral-50 active:bg-neutral-100 text-primary-foreground disabled:text-neutral-500',\n error:\n 'bg-error text-white hover:bg-error-800 active:bg-error-900 disabled:bg-error-200 disabled:text-neutral-600',\n success:\n 'bg-success text-white hover:bg-success-800 active:bg-success-900 disabled:bg-success-200 disabled:text-neutral-600',\n input:\n 'border border-neutral-200 bg-white text-neutral-950 hover:bg-neutral-50 active:bg-neutral-100 focus-visible:border-neutral-950 disabled:bg-neutral-50 focus-visible:ring-0',\n },\n /**\n * Controls the size and padding of the button\n */\n size: {\n sm: 'h-8 px-3 text-sm',\n md: 'h-10 px-4 text-sm',\n lg: 'h-12 px-6 text-base',\n },\n },\n compoundVariants: [\n {\n variant: 'input',\n size: ['sm', 'md', 'lg'],\n className: typographyVariants({ variant: 'body-lg' }),\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n)\n\nexport type ButtonProps = {\n /**\n * The visual style of the button.\n * @default primary\n */\n variant?: 'primary' | 'secondary' | 'ghost' | 'inverse-ghost' | 'text' | 'error' | 'success'\n\n /**\n * The size of the button, affecting height, padding, and font size.\n * @default md\n */\n size?: 'sm' | 'md' | 'lg'\n\n /**\n * Icon component to display at the start of the button content.\n * Use Phosphor icons for consistent styling.\n * @example <Button StartIcon={House}>Home</Button>\n */\n StartIcon?: Icon\n\n /**\n * Icon component to display at the end of the button content.\n * Use Phosphor icons for consistent styling.\n * @example <Button EndIcon={ArrowRight}>Next</Button>\n */\n EndIcon?: Icon\n\n /**\n * When true, displays a loading spinner and disables the button.\n * The spinner replaces the StartIcon if present.\n * @default false\n */\n loading?: boolean\n\n /**\n * When true, creates a circular button with only the StartIcon visible.\n * @default false\n */\n iconOnly?: boolean\n\n /**\n * The content to display inside the button.\n * Not displayed when iconOnly is true.\n */\n children?: React.ReactNode\n\n /**\n * Custom props to pass to the icons (StartIcon, EndIcon, SpinnerGap).\n * Allows overriding size, weight, color, etc.\n */\n iconProps?: Partial<IconProps>\n} & React.ButtonHTMLAttributes<HTMLButtonElement> &\n VariantProps<typeof buttonVariants>\n\n/**\n * A versatile button component that supports multiple variants, sizes, and icon placements.\n *\n * @example\n * // Basic usage\n * <Button>Click me</Button>\n *\n * // With icon\n * <Button StartIcon={House}>Home</Button>\n *\n * // Icon only button\n * <Button StartIcon={Plus} iconOnly aria-label=\"Add item\" />\n *\n * // Loading state\n * <Button loading>Processing...</Button>\n */\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n { className, variant = 'primary', size = 'md', StartIcon, EndIcon, loading, iconOnly, iconProps = {}, ...props },\n ref,\n ) => {\n const defaultIconProps = (): { size: number; weight: IconWeight } => {\n switch (size) {\n case 'sm':\n return { size: 16, weight: 'regular' }\n case 'lg':\n return { size: 20, weight: 'regular' }\n default:\n return { size: 18, weight: 'regular' }\n }\n }\n const mergedIconProps = { ...defaultIconProps(), ...iconProps }\n const getIconOnlyClasses = () => {\n switch (size) {\n case 'sm':\n return 'h-8 w-8'\n case 'lg':\n return 'h-12 w-12'\n default:\n return 'h-10 w-10'\n }\n }\n\n return (\n <button\n className={cn(\n buttonVariants({ variant, size, className }),\n iconOnly && 'rounded-full p-0',\n iconOnly && getIconOnlyClasses(),\n className,\n )}\n ref={ref}\n disabled={loading}\n {...props}\n >\n {loading && <SpinnerGapIcon {...defaultIconProps()} className=\"animate-spin\" aria-label=\"Loading\" />}\n {StartIcon && !loading && <StartIcon {...mergedIconProps} className=\"shrink-0\" />}\n {iconOnly ? <span className=\"sr-only\">{props.children}</span> : props.children}\n {EndIcon && !iconOnly && <EndIcon {...mergedIconProps} className=\"shrink-0\" />}\n </button>\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;AAQA,IAAM,iBAAiB,IACrB,+OACA;CACE,UAAU;;;;EAIR,SAAS;GACP,SACE;GACF,WACE;GACF,OACE;GACF,iBACE;GACF,MAAM;GACN,OACE;GACF,SACE;GACF,OACE;EACJ;;;;EAIA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,kBAAkB,CAChB;EACE,SAAS;EACT,MAAM;GAAC;GAAM;GAAM;EAAI;EACvB,WAAW,mBAAmB,EAAE,SAAS,UAAU,CAAC;CACtD,CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF;;;;;;;;;;;;;;;;;AAwEA,IAAM,SAASA,QAAM,YAEjB,EAAE,WAAW,UAAU,WAAW,OAAO,MAAM,WAAW,SAAS,SAAS,UAAU,YAAY,CAAC,GAAG,GAAG,SACzG,QACG;CACH,MAAM,yBAA+D;EACnE,QAAQ,MAAR;GACE,KAAK,MACH,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;GACvC,KAAK,MACH,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;GACvC,SACE,OAAO;IAAE,MAAM;IAAI,QAAQ;GAAU;EACzC;CACF;CACA,MAAM,kBAAkB;EAAE,GAAG,iBAAiB;EAAG,GAAG;CAAU;CAC9D,MAAM,2BAA2B;EAC/B,QAAQ,MAAR;GACE,KAAK,MACH,OAAO;GACT,KAAK,MACH,OAAO;GACT,SACE,OAAO;EACX;CACF;CAEA,OACE,qBAAC,UAAD;EACE,WAAW,GACT,eAAe;GAAE;GAAS;GAAM;EAAU,CAAC,GAC3C,YAAY,oBACZ,YAAY,mBAAmB,GAC/B,SACF;EACK;EACL,UAAU;EACV,GAAI;EATN,UAAA;GAWG,WAAW,oBAAC,gBAAD;IAAgB,GAAI,iBAAiB;IAAG,WAAU;IAAe,cAAW;GAAW,CAAA;GAClG,aAAa,CAAC,WAAW,oBAAC,WAAD;IAAW,GAAI;IAAiB,WAAU;GAAY,CAAA;GAC/E,WAAW,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,MAAM;GAAe,CAAA,IAAI,MAAM;GACrE,WAAW,CAAC,YAAY,oBAAC,SAAD;IAAS,GAAI;IAAiB,WAAU;GAAY,CAAA;EACvE;;AAEZ,CACF;AACA,OAAO,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { SURFACE_LIST } from "../../../lib/surface.js";
|
|
2
3
|
import { useListScroll } from "../../../lib/useListScroll.js";
|
|
3
4
|
import { Command, CommandInput } from "../../utils/Command/Command.js";
|
|
4
5
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "../../utils/Popover/Popover.js";
|
|
@@ -85,7 +86,7 @@ var Combobox = (props) => {
|
|
|
85
86
|
onClick: handleClear
|
|
86
87
|
})]
|
|
87
88
|
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
88
|
-
className: cn("overflow-hidden p-0", contentClassName),
|
|
89
|
+
className: cn(SURFACE_LIST, "overflow-hidden p-0", contentClassName),
|
|
89
90
|
container,
|
|
90
91
|
side: "bottom",
|
|
91
92
|
align,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","names":[],"sources":["../../../../src/components/inputs/Combobox/Combobox.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport { useEffect, useRef } from 'react'\n\nimport { useListScroll } from '../../../lib/useListScroll'\nimport { cn } from '../../../lib/utils'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\n\nimport { ComboboxTrigger } from './ComboboxTrigger'\nimport { StaticComboboxList } from './StaticComboboxList'\nimport { useCombobox } from './useCombobox'\nimport { VirtualizedComboboxList } from './VirtualizedComboboxList'\n\ntype ComboboxBaseProps<T> = {\n /** Unique identifier for the combobox */\n id?: string\n /** Array of options to display in the combobox (static mode). */\n options?: Array<T>\n /** Function to get the unique identifier from an option. */\n getOptionValue: (option: T) => string\n /** Function to get the display text from an option. */\n getOptionLabel: (option: T) => string\n /** Custom render function for options. If not provided, defaults to showing a checkmark and label */\n renderOption?: (option: T, isSelected: boolean) => React.ReactNode\n /** Placeholder text shown when no option is selected */\n placeholder?: React.ReactNode\n /** Placeholder text for the search input field */\n searchPlaceholder?: string\n /** Message shown when no options match the search query */\n emptyMessage?: string\n /** Additional CSS classes to apply to the combobox trigger */\n className?: string\n /** Additional CSS classes to apply to the popover content */\n contentClassName?: string\n /** Whether the combobox is disabled */\n disabled?: boolean\n /** Maximum height of the options list. Can be any valid CSS height value */\n maxHeight?: string | number\n /** Whether to close the dropdown when an option is selected. Defaults to `true` for single select and `false` for multi-select. */\n closeOnSelect?: boolean\n /** Whether the combobox is in a loading state */\n loading?: boolean\n /** Message to show when in loading state */\n loadingPlaceholder?: string\n /** Whether the combobox has an error */\n error?: boolean | string\n /** Custom function to filter options based on search term (static mode only) */\n filterOptions?: (options: Array<T>, searchTerm: string) => Array<T>\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the selection. */\n onClear?: boolean | (() => void)\n /** Whether the selection can be cleared */\n clearable?: boolean\n /** Whether the combobox is inside a modal */\n modal?: boolean\n /** Placeholder text for the selected multiple options */\n selectedMultiplePlaceholder?: string\n /** Placeholder text for the multiple options */\n multipleOptionsPlaceholder?: string\n /** Pinned above a separator. Selecting one switches multi-select to single-select. */\n specialOptions?: Array<T>\n /** Heading for the special options group */\n specialOptionsTitle?: string\n /** Container element to position the combobox relative to. */\n container?: HTMLElement\n /** Alignment of the dropdown relative to the trigger. Defaults to 'center'. */\n align?: 'start' | 'center' | 'end'\n /** Auto-focus the search input when the dropdown opens. */\n onOpenAutoFocus?: boolean\n /** Defaults to `!!error`. */\n 'aria-invalid'?: boolean\n 'aria-describedby'?: string\n}\n\nexport type ComboboxSingleProps<T> = ComboboxBaseProps<T> & {\n virtualized?: false\n multiple?: false\n value?: string\n onChange: (value: string) => void\n /** Custom render function for the selected value display. */\n renderLabel?: (selectedOption: T) => React.ReactNode\n}\n\nexport type ComboboxMultipleProps<T> = ComboboxBaseProps<T> & {\n virtualized?: false\n multiple: true\n value?: Array<string>\n onChange: (value: Array<string>) => void\n /** Custom render function for the selected value(s) display. */\n renderLabel?: (selectedOptions: Array<T>, onRemove: (value: string) => void) => React.ReactNode\n}\n\ntype ComboboxRemoteVirtualizedProps<T> = {\n /** The accumulated, flattened list of loaded items. */\n items: Array<T>\n /** Whether more pages can be loaded. */\n hasNextPage: boolean\n /** Whether the next page is currently being fetched. */\n isFetchingNextPage: boolean\n /** Request the next page (triggered near the end of the list). */\n onLoadMore: () => void\n /** Emitted (debounced) when the search term changes. The consumer refetches. */\n onSearchChange: (search: string) => void\n}\n\n/** Pass none of `ComboboxRemoteVirtualizedProps`'s fields to virtualize the local `options`\n * list instead (filtered the same way static mode is). */\ntype ComboboxLocalVirtualizedProps = {\n items?: undefined\n hasNextPage?: undefined\n isFetchingNextPage?: undefined\n onLoadMore?: undefined\n onSearchChange?: undefined\n}\n\nexport type ComboboxVirtualizedProps<T> = ComboboxBaseProps<T> & {\n virtualized: true\n multiple?: false\n value?: string\n onChange: (value: string) => void\n /** Custom render function for the selected value display. */\n renderLabel?: (selectedOption: T) => React.ReactNode\n /** The resolved selected item, fetched independently of the list. Used for the trigger label. */\n selectedItem?: T\n /** Estimated row height (px), default: 40. */\n estimateSize?: number\n} & (ComboboxRemoteVirtualizedProps<T> | ComboboxLocalVirtualizedProps)\n\nexport type ComboboxProps<T> = ComboboxSingleProps<T> | ComboboxMultipleProps<T> | ComboboxVirtualizedProps<T>\n\n/**\n * A searchable combobox component with support for custom rendering, keyboard navigation, and search filtering.\n *\n * @example Basic usage\n * ```tsx\n * <Combobox<User>\n * options={users}\n * value={selectedUserId}\n * onChange={setSelectedUserId}\n * getOptionValue={(user) => user.id}\n * getOptionLabel={(user) => user.name}\n * />\n * ```\n */\nexport const Combobox = <T extends object>(props: ComboboxProps<T>) => {\n const {\n id,\n options = [],\n getOptionValue,\n getOptionLabel,\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n className = 'w-60',\n contentClassName,\n disabled = false,\n maxHeight = '300px',\n renderOption,\n loading = false,\n loadingPlaceholder = 'Cargando...',\n error = false,\n multiple,\n onClear,\n modal = false,\n selectedMultiplePlaceholder = 'Selected',\n multipleOptionsPlaceholder = 'Options',\n specialOptionsTitle,\n container,\n align,\n onOpenAutoFocus = false,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n } = props\n\n const searchInputRef = useRef<HTMLInputElement>(null)\n const normalizedMaxHeight = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight\n const boundedListMaxHeight = `min(${normalizedMaxHeight}, max(120px, calc(var(--radix-popover-content-available-height, 100dvh) - 68px)))`\n\n const {\n open,\n setOpen,\n searchTerm,\n setSearchTerm,\n setIsHovered,\n hasNextPage,\n loadingMore,\n isVirtualized,\n filteredOptions,\n filteredSpecialOptions,\n displayValue,\n hasValue,\n showClearButton,\n handleSelect,\n handleClear,\n loadNextPage,\n } = useCombobox(props)\n\n const singleValue = typeof props.value === 'string' && props.value ? props.value : undefined\n\n useEffect(() => {\n if (!open || !onOpenAutoFocus) return\n const timeoutId = globalThis.setTimeout(() => searchInputRef.current?.focus(), 0)\n return () => globalThis.clearTimeout(timeoutId)\n }, [open, onOpenAutoFocus])\n\n const listRef = useListScroll({\n open,\n searchTerm,\n selectedValue: isVirtualized ? undefined : singleValue,\n })\n\n const hasMultipleRenderLabel = !!(multiple && 'renderLabel' in props && props.renderLabel)\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <PopoverRoot open={open} onOpenChange={setOpen} modal={modal}>\n <div\n className={cn('relative', className)}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <PopoverTrigger\n asChild\n onPointerDown={(event) => {\n event.stopPropagation()\n if (open) {\n setOpen(false)\n event.preventDefault()\n } else {\n setOpen(true)\n }\n }}\n onClick={(event) => {\n if (event.detail === 0) return\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <ComboboxTrigger\n id={id}\n disabled={disabled}\n open={open}\n error={error}\n hasValue={hasValue}\n showClearButton={showClearButton}\n isMultilineLabel={hasMultipleRenderLabel}\n displayValue={displayValue}\n className={cn('w-full', className)}\n aria-invalid={ariaInvalid ?? (!!error || undefined)}\n aria-describedby={ariaDescribedBy}\n />\n </PopoverTrigger>\n {!!onClear && hasValue && (\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'absolute top-1/2 right-4 z-10 h-4 w-4 -translate-y-1/2 cursor-pointer transition-opacity duration-150',\n showClearButton ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onPointerDown={(event) => event.stopPropagation()}\n onClick={handleClear}\n />\n )}\n </div>\n <PopoverContent\n className={cn('overflow-hidden p-0', contentClassName)}\n container={container}\n side=\"bottom\"\n align={align}\n onOpenAutoFocus={onOpenAutoFocus ? (event) => event.preventDefault() : undefined}\n >\n <Command shouldFilter={false} defaultValue={singleValue}>\n <CommandInput\n ref={searchInputRef}\n placeholder={searchPlaceholder}\n value={searchTerm}\n onValueChange={setSearchTerm}\n />\n {isVirtualized ? (\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={filteredOptions}\n loading={loading}\n loadingPlaceholder={loadingPlaceholder}\n emptyMessage={emptyMessage}\n value={props.value as string}\n getOptionValue={getOptionValue}\n getOptionLabel={getOptionLabel}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={boundedListMaxHeight}\n hasNextPage={hasNextPage}\n loadingMore={loadingMore}\n onLoadMore={loadNextPage}\n estimateSize={'estimateSize' in props ? props.estimateSize : undefined}\n specialOptions={filteredSpecialOptions}\n specialOptionsTitle={specialOptionsTitle}\n />\n ) : (\n <StaticComboboxList\n listRef={listRef}\n filteredOptions={filteredOptions}\n loading={loading}\n loadingPlaceholder={loadingPlaceholder}\n emptyMessage={emptyMessage}\n multiple={!!multiple}\n value={props.value}\n getOptionValue={getOptionValue}\n getOptionLabel={getOptionLabel}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={boundedListMaxHeight}\n selectedMultiplePlaceholder={selectedMultiplePlaceholder}\n multipleOptionsPlaceholder={multipleOptionsPlaceholder}\n options={options}\n specialOptions={filteredSpecialOptions}\n specialOptionsTitle={specialOptionsTitle}\n />\n )}\n </Command>\n </PopoverContent>\n </PopoverRoot>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</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A,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","names":[],"sources":["../../../../src/components/inputs/Combobox/Combobox.tsx"],"sourcesContent":["import { XIcon } from '@phosphor-icons/react/dist/ssr/X'\nimport { useEffect, useRef } from 'react'\n\nimport { SURFACE_LIST } from '../../../lib/surface'\nimport { useListScroll } from '../../../lib/useListScroll'\nimport { cn } from '../../../lib/utils'\nimport { Command, CommandInput } from '../../utils/Command'\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from '../../utils/Popover'\n\nimport { ComboboxTrigger } from './ComboboxTrigger'\nimport { StaticComboboxList } from './StaticComboboxList'\nimport { useCombobox } from './useCombobox'\nimport { VirtualizedComboboxList } from './VirtualizedComboboxList'\n\ntype ComboboxBaseProps<T> = {\n /** Unique identifier for the combobox */\n id?: string\n /** Array of options to display in the combobox (static mode). */\n options?: Array<T>\n /** Function to get the unique identifier from an option. */\n getOptionValue: (option: T) => string\n /** Function to get the display text from an option. */\n getOptionLabel: (option: T) => string\n /** Custom render function for options. If not provided, defaults to showing a checkmark and label */\n renderOption?: (option: T, isSelected: boolean) => React.ReactNode\n /** Placeholder text shown when no option is selected */\n placeholder?: React.ReactNode\n /** Placeholder text for the search input field */\n searchPlaceholder?: string\n /** Message shown when no options match the search query */\n emptyMessage?: string\n /** Additional CSS classes to apply to the combobox trigger */\n className?: string\n /** Additional CSS classes to apply to the popover content */\n contentClassName?: string\n /** Whether the combobox is disabled */\n disabled?: boolean\n /** Maximum height of the options list. Can be any valid CSS height value */\n maxHeight?: string | number\n /** Whether to close the dropdown when an option is selected. Defaults to `true` for single select and `false` for multi-select. */\n closeOnSelect?: boolean\n /** Whether the combobox is in a loading state */\n loading?: boolean\n /** Message to show when in loading state */\n loadingPlaceholder?: string\n /** Whether the combobox has an error */\n error?: boolean | string\n /** Custom function to filter options based on search term (static mode only) */\n filterOptions?: (options: Array<T>, searchTerm: string) => Array<T>\n /** Callback function executed when the clear button is clicked. When provided, an X button will appear on hover to clear the selection. */\n onClear?: boolean | (() => void)\n /** Whether the selection can be cleared */\n clearable?: boolean\n /** Whether the combobox is inside a modal */\n modal?: boolean\n /** Placeholder text for the selected multiple options */\n selectedMultiplePlaceholder?: string\n /** Placeholder text for the multiple options */\n multipleOptionsPlaceholder?: string\n /** Pinned above a separator. Selecting one switches multi-select to single-select. */\n specialOptions?: Array<T>\n /** Heading for the special options group */\n specialOptionsTitle?: string\n /** Container element to position the combobox relative to. */\n container?: HTMLElement\n /** Alignment of the dropdown relative to the trigger. Defaults to 'center'. */\n align?: 'start' | 'center' | 'end'\n /** Auto-focus the search input when the dropdown opens. */\n onOpenAutoFocus?: boolean\n /** Defaults to `!!error`. */\n 'aria-invalid'?: boolean\n 'aria-describedby'?: string\n}\n\nexport type ComboboxSingleProps<T> = ComboboxBaseProps<T> & {\n virtualized?: false\n multiple?: false\n value?: string\n onChange: (value: string) => void\n /** Custom render function for the selected value display. */\n renderLabel?: (selectedOption: T) => React.ReactNode\n}\n\nexport type ComboboxMultipleProps<T> = ComboboxBaseProps<T> & {\n virtualized?: false\n multiple: true\n value?: Array<string>\n onChange: (value: Array<string>) => void\n /** Custom render function for the selected value(s) display. */\n renderLabel?: (selectedOptions: Array<T>, onRemove: (value: string) => void) => React.ReactNode\n}\n\ntype ComboboxRemoteVirtualizedProps<T> = {\n /** The accumulated, flattened list of loaded items. */\n items: Array<T>\n /** Whether more pages can be loaded. */\n hasNextPage: boolean\n /** Whether the next page is currently being fetched. */\n isFetchingNextPage: boolean\n /** Request the next page (triggered near the end of the list). */\n onLoadMore: () => void\n /** Emitted (debounced) when the search term changes. The consumer refetches. */\n onSearchChange: (search: string) => void\n}\n\n/** Pass none of `ComboboxRemoteVirtualizedProps`'s fields to virtualize the local `options`\n * list instead (filtered the same way static mode is). */\ntype ComboboxLocalVirtualizedProps = {\n items?: undefined\n hasNextPage?: undefined\n isFetchingNextPage?: undefined\n onLoadMore?: undefined\n onSearchChange?: undefined\n}\n\nexport type ComboboxVirtualizedProps<T> = ComboboxBaseProps<T> & {\n virtualized: true\n multiple?: false\n value?: string\n onChange: (value: string) => void\n /** Custom render function for the selected value display. */\n renderLabel?: (selectedOption: T) => React.ReactNode\n /** The resolved selected item, fetched independently of the list. Used for the trigger label. */\n selectedItem?: T\n /** Estimated row height (px), default: 40. */\n estimateSize?: number\n} & (ComboboxRemoteVirtualizedProps<T> | ComboboxLocalVirtualizedProps)\n\nexport type ComboboxProps<T> = ComboboxSingleProps<T> | ComboboxMultipleProps<T> | ComboboxVirtualizedProps<T>\n\n/**\n * A searchable combobox component with support for custom rendering, keyboard navigation, and search filtering.\n *\n * @example Basic usage\n * ```tsx\n * <Combobox<User>\n * options={users}\n * value={selectedUserId}\n * onChange={setSelectedUserId}\n * getOptionValue={(user) => user.id}\n * getOptionLabel={(user) => user.name}\n * />\n * ```\n */\nexport const Combobox = <T extends object>(props: ComboboxProps<T>) => {\n const {\n id,\n options = [],\n getOptionValue,\n getOptionLabel,\n searchPlaceholder = 'Search...',\n emptyMessage = 'No results found.',\n className = 'w-60',\n contentClassName,\n disabled = false,\n maxHeight = '300px',\n renderOption,\n loading = false,\n loadingPlaceholder = 'Cargando...',\n error = false,\n multiple,\n onClear,\n modal = false,\n selectedMultiplePlaceholder = 'Selected',\n multipleOptionsPlaceholder = 'Options',\n specialOptionsTitle,\n container,\n align,\n onOpenAutoFocus = false,\n 'aria-invalid': ariaInvalid,\n 'aria-describedby': ariaDescribedBy,\n } = props\n\n const searchInputRef = useRef<HTMLInputElement>(null)\n const normalizedMaxHeight = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight\n const boundedListMaxHeight = `min(${normalizedMaxHeight}, max(120px, calc(var(--radix-popover-content-available-height, 100dvh) - 68px)))`\n\n const {\n open,\n setOpen,\n searchTerm,\n setSearchTerm,\n setIsHovered,\n hasNextPage,\n loadingMore,\n isVirtualized,\n filteredOptions,\n filteredSpecialOptions,\n displayValue,\n hasValue,\n showClearButton,\n handleSelect,\n handleClear,\n loadNextPage,\n } = useCombobox(props)\n\n const singleValue = typeof props.value === 'string' && props.value ? props.value : undefined\n\n useEffect(() => {\n if (!open || !onOpenAutoFocus) return\n const timeoutId = globalThis.setTimeout(() => searchInputRef.current?.focus(), 0)\n return () => globalThis.clearTimeout(timeoutId)\n }, [open, onOpenAutoFocus])\n\n const listRef = useListScroll({\n open,\n searchTerm,\n selectedValue: isVirtualized ? undefined : singleValue,\n })\n\n const hasMultipleRenderLabel = !!(multiple && 'renderLabel' in props && props.renderLabel)\n\n return (\n <div className=\"flex w-full flex-col gap-1\">\n <PopoverRoot open={open} onOpenChange={setOpen} modal={modal}>\n <div\n className={cn('relative', className)}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n <PopoverTrigger\n asChild\n onPointerDown={(event) => {\n event.stopPropagation()\n if (open) {\n setOpen(false)\n event.preventDefault()\n } else {\n setOpen(true)\n }\n }}\n onClick={(event) => {\n if (event.detail === 0) return\n event.preventDefault()\n event.stopPropagation()\n }}\n >\n <ComboboxTrigger\n id={id}\n disabled={disabled}\n open={open}\n error={error}\n hasValue={hasValue}\n showClearButton={showClearButton}\n isMultilineLabel={hasMultipleRenderLabel}\n displayValue={displayValue}\n className={cn('w-full', className)}\n aria-invalid={ariaInvalid ?? (!!error || undefined)}\n aria-describedby={ariaDescribedBy}\n />\n </PopoverTrigger>\n {!!onClear && hasValue && (\n <XIcon\n data-testid=\"clear-button\"\n className={cn(\n 'absolute top-1/2 right-4 z-10 h-4 w-4 -translate-y-1/2 cursor-pointer transition-opacity duration-150',\n showClearButton ? 'opacity-100 hover:opacity-70' : 'opacity-0',\n )}\n onPointerDown={(event) => event.stopPropagation()}\n onClick={handleClear}\n />\n )}\n </div>\n <PopoverContent\n className={cn(SURFACE_LIST, 'overflow-hidden p-0', contentClassName)}\n container={container}\n side=\"bottom\"\n align={align}\n onOpenAutoFocus={onOpenAutoFocus ? (event) => event.preventDefault() : undefined}\n >\n <Command shouldFilter={false} defaultValue={singleValue}>\n <CommandInput\n ref={searchInputRef}\n placeholder={searchPlaceholder}\n value={searchTerm}\n onValueChange={setSearchTerm}\n />\n {isVirtualized ? (\n <VirtualizedComboboxList\n listRef={listRef}\n localOptions={filteredOptions}\n loading={loading}\n loadingPlaceholder={loadingPlaceholder}\n emptyMessage={emptyMessage}\n value={props.value as string}\n getOptionValue={getOptionValue}\n getOptionLabel={getOptionLabel}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={boundedListMaxHeight}\n hasNextPage={hasNextPage}\n loadingMore={loadingMore}\n onLoadMore={loadNextPage}\n estimateSize={'estimateSize' in props ? props.estimateSize : undefined}\n specialOptions={filteredSpecialOptions}\n specialOptionsTitle={specialOptionsTitle}\n />\n ) : (\n <StaticComboboxList\n listRef={listRef}\n filteredOptions={filteredOptions}\n loading={loading}\n loadingPlaceholder={loadingPlaceholder}\n emptyMessage={emptyMessage}\n multiple={!!multiple}\n value={props.value}\n getOptionValue={getOptionValue}\n getOptionLabel={getOptionLabel}\n handleSelect={handleSelect}\n renderOption={renderOption}\n maxHeight={boundedListMaxHeight}\n selectedMultiplePlaceholder={selectedMultiplePlaceholder}\n multipleOptionsPlaceholder={multipleOptionsPlaceholder}\n options={options}\n specialOptions={filteredSpecialOptions}\n specialOptionsTitle={specialOptionsTitle}\n />\n )}\n </Command>\n </PopoverContent>\n </PopoverRoot>\n {typeof error === 'string' && <span className=\"text-error-500 text-sm\">{error}</span>}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJA,IAAa,YAA8B,UAA4B;CACrE,MAAM,EACJ,IACA,UAAU,CAAC,GACX,gBACA,gBACA,oBAAoB,aACpB,eAAe,qBACf,YAAY,QACZ,kBACA,WAAW,OACX,YAAY,SACZ,cACA,UAAU,OACV,qBAAqB,eACrB,QAAQ,OACR,UACA,SACA,QAAQ,OACR,8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,kBAAkB;MACJ;MACd,WAAW,GAAG,UAAU,SAAS;MACjC,gBAAc,gBAAgB,CAAC,CAAC,SAAS,KAAA;MACzC,oBAAkB;KACnB,CAAA;IACa,CAAA,GACf,CAAC,CAAC,WAAW,YACZ,oBAAC,OAAD;KACE,eAAY;KACZ,WAAW,GACT,yGACA,kBAAkB,iCAAiC,WACrD;KACA,gBAAgB,UAAU,MAAM,gBAAgB;KAChD,SAAS;IACV,CAAA,CAEA;GACL,CAAA,GAAA,oBAAC,gBAAD;IACE,WAAW,GAAG,cAAc,uBAAuB,gBAAgB;IACxD;IACX,MAAK;IACE;IACP,iBAAiB,mBAAmB,UAAU,MAAM,eAAe,IAAI,KAAA;IAEvE,UAAA,qBAAC,SAAD;KAAS,cAAc;KAAO,cAAc;KAA5C,UAAA,CACE,oBAAC,cAAD;MACE,KAAK;MACL,aAAa;MACb,OAAO;MACP,eAAe;KAChB,CAAA,GACA,gBACC,oBAAC,yBAAD;MACW;MACT,cAAc;MACL;MACW;MACN;MACd,OAAO,MAAM;MACG;MACA;MACF;MACA;MACd,WAAW;MACE;MACA;MACb,YAAY;MACZ,cAAc,kBAAkB,QAAQ,MAAM,eAAe,KAAA;MAC7D,gBAAgB;MACK;KACtB,CAAA,IAED,oBAAC,oBAAD;MACW;MACQ;MACR;MACW;MACN;MACd,UAAU,CAAC,CAAC;MACZ,OAAO,MAAM;MACG;MACA;MACF;MACA;MACd,WAAW;MACkB;MACD;MACnB;MACT,gBAAgB;MACK;KACtB,CAAA,CAEI;;GACK,CAAA,CACL;EACZ,CAAA,GAAA,OAAO,UAAU,YAAY,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CACjF;;AAET"}
|
|
@@ -66,14 +66,13 @@ var StaticComboboxList = ({ filteredOptions, loading, loadingPlaceholder, emptyM
|
|
|
66
66
|
return /* @__PURE__ */ jsx(CommandItem, {
|
|
67
67
|
value: optionValue,
|
|
68
68
|
onSelect: handleSelect,
|
|
69
|
-
className: "px-3",
|
|
70
69
|
children: renderOption ? renderOption(option, selected) : /* @__PURE__ */ jsxs(Fragment, { children: [renderSelectionIndicator(), /* @__PURE__ */ jsx(ComboboxOptionWithTooltip, { label: getOptionLabel(option) })] })
|
|
71
70
|
}, optionValue);
|
|
72
71
|
};
|
|
73
72
|
return /* @__PURE__ */ jsx(CommandList, {
|
|
74
73
|
ref: listRef,
|
|
75
74
|
style: { maxHeight },
|
|
76
|
-
className: "overflow-auto overscroll-contain
|
|
75
|
+
className: "overflow-auto overscroll-contain",
|
|
77
76
|
onWheel: (event) => event.stopPropagation(),
|
|
78
77
|
children: loading ? /* @__PURE__ */ jsx("div", {
|
|
79
78
|
className: "flex items-center justify-center py-6 text-sm text-neutral-400",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/StaticComboboxList.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { useMemo } from 'react'\n\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../../utils/Command'\nimport { Checkbox } from '../Checkbox'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { StaticComboboxListProps } from './types'\n\nexport const StaticComboboxList = <T extends object>({\n filteredOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n multiple,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n selectedMultiplePlaceholder,\n multipleOptionsPlaceholder,\n options,\n specialOptions,\n specialOptionsTitle,\n listRef,\n}: StaticComboboxListProps<T>) => {\n const isArrayValue = Array.isArray(value)\n const selectedValues = useMemo(() => (multiple && isArrayValue ? value : []), [multiple, isArrayValue, value])\n\n const isOptionSelected = (optionValue: string) =>\n multiple ? selectedValues.includes(optionValue) : value === optionValue\n\n const regularOptions = useMemo(() => {\n return filteredOptions.filter(\n (option) => !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [filteredOptions, specialOptions, getOptionValue])\n\n const regularSelectedOptions = useMemo(() => {\n if (!multiple || !isArrayValue) return []\n\n return options.filter(\n (option) =>\n selectedValues.includes(getOptionValue(option)) &&\n !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [options, selectedValues, specialOptions, getOptionValue, multiple, isArrayValue])\n\n const optionsToShow = useMemo(() => {\n if (specialOptions) return regularOptions\n\n if (!multiple || !isArrayValue) return regularOptions\n\n return regularOptions.filter((option) => !selectedValues.includes(getOptionValue(option)))\n }, [regularOptions, specialOptions, selectedValues, getOptionValue, multiple, isArrayValue])\n\n const groupHeading = !specialOptions && multiple ? multipleOptionsPlaceholder : undefined\n\n const renderListOption = (option: T) => {\n const optionValue = getOptionValue(option)\n const selected = isOptionSelected(optionValue)\n\n const renderSelectionIndicator = () => {\n if (multiple) {\n return <Checkbox checked={selected} tabIndex={-1} aria-hidden className=\"pointer-events-none mr-2 shrink-0\" />\n }\n\n return (\n <span aria-hidden className=\"mr-1 flex h-6! w-6! shrink-0 items-center justify-end\">\n {selected && <CheckIcon weight=\"bold\" className=\"h-4! w-4!\" />}\n </span>\n )\n }\n\n return (\n <CommandItem key={optionValue} value={optionValue} onSelect={handleSelect}
|
|
1
|
+
{"version":3,"file":"StaticComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/StaticComboboxList.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { useMemo } from 'react'\n\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../../utils/Command'\nimport { Checkbox } from '../Checkbox'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { StaticComboboxListProps } from './types'\n\nexport const StaticComboboxList = <T extends object>({\n filteredOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n multiple,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n selectedMultiplePlaceholder,\n multipleOptionsPlaceholder,\n options,\n specialOptions,\n specialOptionsTitle,\n listRef,\n}: StaticComboboxListProps<T>) => {\n const isArrayValue = Array.isArray(value)\n const selectedValues = useMemo(() => (multiple && isArrayValue ? value : []), [multiple, isArrayValue, value])\n\n const isOptionSelected = (optionValue: string) =>\n multiple ? selectedValues.includes(optionValue) : value === optionValue\n\n const regularOptions = useMemo(() => {\n return filteredOptions.filter(\n (option) => !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [filteredOptions, specialOptions, getOptionValue])\n\n const regularSelectedOptions = useMemo(() => {\n if (!multiple || !isArrayValue) return []\n\n return options.filter(\n (option) =>\n selectedValues.includes(getOptionValue(option)) &&\n !specialOptions?.some((special) => getOptionValue(special) === getOptionValue(option)),\n )\n }, [options, selectedValues, specialOptions, getOptionValue, multiple, isArrayValue])\n\n const optionsToShow = useMemo(() => {\n if (specialOptions) return regularOptions\n\n if (!multiple || !isArrayValue) return regularOptions\n\n return regularOptions.filter((option) => !selectedValues.includes(getOptionValue(option)))\n }, [regularOptions, specialOptions, selectedValues, getOptionValue, multiple, isArrayValue])\n\n const groupHeading = !specialOptions && multiple ? multipleOptionsPlaceholder : undefined\n\n const renderListOption = (option: T) => {\n const optionValue = getOptionValue(option)\n const selected = isOptionSelected(optionValue)\n\n const renderSelectionIndicator = () => {\n if (multiple) {\n return <Checkbox checked={selected} tabIndex={-1} aria-hidden className=\"pointer-events-none mr-2 shrink-0\" />\n }\n\n return (\n <span aria-hidden className=\"mr-1 flex h-6! w-6! shrink-0 items-center justify-end\">\n {selected && <CheckIcon weight=\"bold\" className=\"h-4! w-4!\" />}\n </span>\n )\n }\n\n return (\n <CommandItem key={optionValue} value={optionValue} onSelect={handleSelect}>\n {renderOption ? (\n renderOption(option, selected)\n ) : (\n <>\n {renderSelectionIndicator()}\n <ComboboxOptionWithTooltip label={getOptionLabel(option)} />\n </>\n )}\n </CommandItem>\n )\n }\n\n return (\n <CommandList\n ref={listRef}\n style={{ maxHeight }}\n className=\"overflow-auto overscroll-contain\"\n onWheel={(event) => event.stopPropagation()}\n >\n {loading ? (\n <div className=\"flex items-center justify-center py-6 text-sm text-neutral-400\">{loadingPlaceholder}</div>\n ) : (\n <>\n {filteredOptions.length === 0 &&\n regularOptions.length === 0 &&\n (!specialOptions || specialOptions.length === 0) && <CommandEmpty>{emptyMessage}</CommandEmpty>}\n\n {specialOptions?.length ? (\n <>\n <CommandGroup heading={specialOptionsTitle}>{specialOptions.map(renderListOption)}</CommandGroup>\n\n {optionsToShow.length > 0 && <CommandSeparator className=\"mx-1\" />}\n </>\n ) : null}\n\n {!specialOptions && multiple && isArrayValue && regularSelectedOptions.length > 0 && (\n <CommandGroup heading={selectedMultiplePlaceholder}>\n {regularSelectedOptions.map(renderListOption)}\n </CommandGroup>\n )}\n\n {optionsToShow.length > 0 && (\n <CommandGroup heading={groupHeading}>{optionsToShow.map(renderListOption)}</CommandGroup>\n )}\n </>\n )}\n </CommandList>\n )\n}\n"],"mappings":";;;;;;;AASA,IAAa,sBAAwC,EACnD,iBACA,SACA,oBACA,cACA,UACA,OACA,gBACA,gBACA,cACA,cACA,WACA,6BACA,4BACA,SACA,gBACA,qBACA,cACgC;CAChC,MAAM,eAAe,MAAM,QAAQ,KAAK;CACxC,MAAM,iBAAiB,cAAe,YAAY,eAAe,QAAQ,CAAC,GAAI;EAAC;EAAU;EAAc;CAAK,CAAC;CAE7G,MAAM,oBAAoB,gBACxB,WAAW,eAAe,SAAS,WAAW,IAAI,UAAU;CAE9D,MAAM,iBAAiB,cAAc;EACnC,OAAO,gBAAgB,QACpB,WAAW,CAAC,gBAAgB,MAAM,YAAY,eAAe,OAAO,MAAM,eAAe,MAAM,CAAC,CACnG;CACF,GAAG;EAAC;EAAiB;EAAgB;CAAc,CAAC;CAEpD,MAAM,yBAAyB,cAAc;EAC3C,IAAI,CAAC,YAAY,CAAC,cAAc,OAAO,CAAC;EAExC,OAAO,Q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zG,qBAAAA,UAAA,EAAA,UAAA;GACG,gBAAgB,WAAW,KAC1B,eAAe,WAAW,MACzB,CAAC,kBAAkB,eAAe,WAAW,MAAM,oBAAC,cAAD,EAAA,UAAe,aAA2B,CAAA;GAE/F,gBAAgB,SACf,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,cAAD;IAAc,SAAS;IAAsB,UAAA,eAAe,IAAI,gBAAgB;GAAgB,CAAA,GAE/F,cAAc,SAAS,KAAK,oBAAC,kBAAD,EAAkB,WAAU,OAAQ,CAAA,CACjE,EAAA,CAAA,IACA;GAEH,CAAC,kBAAkB,YAAY,gBAAgB,uBAAuB,SAAS,KAC9E,oBAAC,cAAD;IAAc,SAAS;IACpB,UAAA,uBAAuB,IAAI,gBAAgB;GAChC,CAAA;GAGf,cAAc,SAAS,KACtB,oBAAC,cAAD;IAAc,SAAS;IAAe,UAAA,cAAc,IAAI,gBAAgB;GAAgB,CAAA;EAE1F,EAAA,CAAA;CAEO,CAAA;AAEjB"}
|
|
@@ -69,13 +69,12 @@ var VirtualizedComboboxList = ({ localOptions, loading, loadingPlaceholder, empt
|
|
|
69
69
|
return /* @__PURE__ */ jsx(CommandItem, {
|
|
70
70
|
value: optionValue,
|
|
71
71
|
onSelect: handleSelect,
|
|
72
|
-
className: "px-3",
|
|
73
72
|
children: renderOption ? renderOption(option, isSelected) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CheckIcon, { className: `mr-2 h-4 w-4 ${isSelected ? "opacity-100" : "opacity-0"}` }), /* @__PURE__ */ jsx(ComboboxOptionWithTooltip, { label: getOptionLabel(option) })] })
|
|
74
73
|
}, optionValue);
|
|
75
74
|
};
|
|
76
75
|
return /* @__PURE__ */ jsxs(CommandList, {
|
|
77
76
|
ref: parentRef,
|
|
78
|
-
className: "overflow-auto overscroll-contain
|
|
77
|
+
className: "overflow-auto overscroll-contain",
|
|
79
78
|
style: { maxHeight },
|
|
80
79
|
onWheel: (event) => event.stopPropagation(),
|
|
81
80
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/VirtualizedComboboxList.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport { useRef, useEffect, useState } from 'react'\n\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../../utils/Command'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { VirtualizedComboboxListProps } from './types'\n\nconst DEFAULT_ESTIMATED_ROW_HEIGHT = 40\n\nexport const VirtualizedComboboxList = <T extends object>({\n localOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n hasNextPage = false,\n loadingMore = false,\n onLoadMore = () => {},\n estimateSize = DEFAULT_ESTIMATED_ROW_HEIGHT,\n listRef,\n specialOptions,\n specialOptionsTitle,\n}: VirtualizedComboboxListProps<T>) => {\n const ownRef = useRef<HTMLDivElement>(null)\n const parentRef = listRef ?? ownRef\n const hasTriggeredRef = useRef(false)\n\n const totalCount = localOptions.length\n const PREFETCH_THRESHOLD = 25\n\n // scrollMargin accounts for the special group's height so scrollToIndex still centers correctly.\n const specialGroupRef = useRef<HTMLDivElement>(null)\n const [specialGroupHeight, setSpecialGroupHeight] = useState(0)\n useEffect(() => {\n setSpecialGroupHeight(specialGroupRef.current?.offsetHeight ?? 0)\n }, [specialOptions])\n\n const rowVirtualizer = useVirtualizer({\n count: totalCount,\n getScrollElement: () => parentRef.current,\n estimateSize: () => estimateSize,\n overscan: 10,\n useAnimationFrameWithResizeObserver: true,\n scrollMargin: specialGroupHeight,\n })\n\n useEffect(() => {\n hasTriggeredRef.current = false\n }, [totalCount, loadingMore])\n\n const hasCenteredRef = useRef(false)\n useEffect(() => {\n if (hasCenteredRef.current || !value) return\n const index = localOptions.findIndex((option) => getOptionValue(option) === value)\n if (index === -1) return\n hasCenteredRef.current = true\n if (!parentRef.current?.scrollTop) rowVirtualizer.scrollToIndex(index, { align: 'center' })\n }, [value, localOptions, getOptionValue, rowVirtualizer, parentRef])\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n\n useEffect(() => {\n if (virtualItems.length === 0 || !hasNextPage || loadingMore || loading || hasTriggeredRef.current) {\n return\n }\n\n const lastVisibleItem = virtualItems.at(-1)\n const itemsFromEnd = totalCount - (lastVisibleItem?.index ?? 0)\n\n if (itemsFromEnd <= PREFETCH_THRESHOLD) {\n hasTriggeredRef.current = true\n onLoadMore()\n }\n }, [virtualItems, totalCount, hasNextPage, loadingMore, loading, onLoadMore])\n\n if (loading && localOptions.length === 0) {\n return <div className=\"flex items-center justify-center py-6 text-sm text-neutral-400\">{loadingPlaceholder}</div>\n }\n\n if (localOptions.length === 0 && !specialOptions?.length && !loading && !loadingMore) {\n return <CommandEmpty>{emptyMessage}</CommandEmpty>\n }\n\n const renderOptionRow = (option: T) => {\n const optionValue = getOptionValue(option)\n const isSelected = value === optionValue\n return (\n <CommandItem key={optionValue} value={optionValue} onSelect={handleSelect}
|
|
1
|
+
{"version":3,"file":"VirtualizedComboboxList.js","names":["_Fragment"],"sources":["../../../../src/components/inputs/Combobox/VirtualizedComboboxList.tsx"],"sourcesContent":["import { CheckIcon } from '@phosphor-icons/react/dist/ssr/Check'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport { useRef, useEffect, useState } from 'react'\n\nimport { CommandEmpty, CommandGroup, CommandItem, CommandList, CommandSeparator } from '../../utils/Command'\n\nimport { ComboboxOptionWithTooltip } from './ComboboxOptionWithTooltip'\nimport type { VirtualizedComboboxListProps } from './types'\n\nconst DEFAULT_ESTIMATED_ROW_HEIGHT = 40\n\nexport const VirtualizedComboboxList = <T extends object>({\n localOptions,\n loading,\n loadingPlaceholder,\n emptyMessage,\n value,\n getOptionValue,\n getOptionLabel,\n handleSelect,\n renderOption,\n maxHeight,\n hasNextPage = false,\n loadingMore = false,\n onLoadMore = () => {},\n estimateSize = DEFAULT_ESTIMATED_ROW_HEIGHT,\n listRef,\n specialOptions,\n specialOptionsTitle,\n}: VirtualizedComboboxListProps<T>) => {\n const ownRef = useRef<HTMLDivElement>(null)\n const parentRef = listRef ?? ownRef\n const hasTriggeredRef = useRef(false)\n\n const totalCount = localOptions.length\n const PREFETCH_THRESHOLD = 25\n\n // scrollMargin accounts for the special group's height so scrollToIndex still centers correctly.\n const specialGroupRef = useRef<HTMLDivElement>(null)\n const [specialGroupHeight, setSpecialGroupHeight] = useState(0)\n useEffect(() => {\n setSpecialGroupHeight(specialGroupRef.current?.offsetHeight ?? 0)\n }, [specialOptions])\n\n const rowVirtualizer = useVirtualizer({\n count: totalCount,\n getScrollElement: () => parentRef.current,\n estimateSize: () => estimateSize,\n overscan: 10,\n useAnimationFrameWithResizeObserver: true,\n scrollMargin: specialGroupHeight,\n })\n\n useEffect(() => {\n hasTriggeredRef.current = false\n }, [totalCount, loadingMore])\n\n const hasCenteredRef = useRef(false)\n useEffect(() => {\n if (hasCenteredRef.current || !value) return\n const index = localOptions.findIndex((option) => getOptionValue(option) === value)\n if (index === -1) return\n hasCenteredRef.current = true\n if (!parentRef.current?.scrollTop) rowVirtualizer.scrollToIndex(index, { align: 'center' })\n }, [value, localOptions, getOptionValue, rowVirtualizer, parentRef])\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n\n useEffect(() => {\n if (virtualItems.length === 0 || !hasNextPage || loadingMore || loading || hasTriggeredRef.current) {\n return\n }\n\n const lastVisibleItem = virtualItems.at(-1)\n const itemsFromEnd = totalCount - (lastVisibleItem?.index ?? 0)\n\n if (itemsFromEnd <= PREFETCH_THRESHOLD) {\n hasTriggeredRef.current = true\n onLoadMore()\n }\n }, [virtualItems, totalCount, hasNextPage, loadingMore, loading, onLoadMore])\n\n if (loading && localOptions.length === 0) {\n return <div className=\"flex items-center justify-center py-6 text-sm text-neutral-400\">{loadingPlaceholder}</div>\n }\n\n if (localOptions.length === 0 && !specialOptions?.length && !loading && !loadingMore) {\n return <CommandEmpty>{emptyMessage}</CommandEmpty>\n }\n\n const renderOptionRow = (option: T) => {\n const optionValue = getOptionValue(option)\n const isSelected = value === optionValue\n return (\n <CommandItem key={optionValue} value={optionValue} onSelect={handleSelect}>\n {renderOption ? (\n renderOption(option, isSelected)\n ) : (\n <>\n <CheckIcon className={`mr-2 h-4 w-4 ${isSelected ? 'opacity-100' : 'opacity-0'}`} />\n <ComboboxOptionWithTooltip label={getOptionLabel(option)} />\n </>\n )}\n </CommandItem>\n )\n }\n\n return (\n <CommandList\n ref={parentRef}\n className=\"overflow-auto overscroll-contain\"\n style={{ maxHeight }}\n onWheel={(event) => event.stopPropagation()}\n >\n <div style={{ height: `${specialGroupHeight + rowVirtualizer.getTotalSize()}px`, position: 'relative' }}>\n {specialOptions?.length ? (\n <div ref={specialGroupRef} data-testid=\"combobox-special-group\">\n <CommandGroup heading={specialOptionsTitle}>{specialOptions.map(renderOptionRow)}</CommandGroup>\n {localOptions.length > 0 && <CommandSeparator className=\"mx-1\" />}\n </div>\n ) : null}\n\n {rowVirtualizer.getVirtualItems().map((virtualRow) => (\n <div\n key={getOptionValue(localOptions[virtualRow.index])}\n data-index={virtualRow.index}\n ref={(el) => rowVirtualizer.measureElement(el)}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n transform: `translateY(${virtualRow.start}px)`,\n }}\n >\n {renderOptionRow(localOptions[virtualRow.index])}\n </div>\n ))}\n </div>\n {loadingMore && (\n <div className=\"flex items-center justify-center py-2 text-sm text-neutral-500\">{loadingPlaceholder}</div>\n )}\n </CommandList>\n )\n}\n"],"mappings":";;;;;;;AASA,IAAM,+BAA+B;AAErC,IAAa,2BAA6C,EACxD,cACA,SACA,oBACA,cACA,OACA,gBACA,gBACA,cACA,cACA,WACA,cAAc,OACd,cAAc,OACd,mB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