@fanvue/ui 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Accordion/Accordion.cjs +29 -0
- package/dist/cjs/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/cjs/components/Accordion/AccordionContent.cjs +44 -0
- package/dist/cjs/components/Accordion/AccordionContent.cjs.map +1 -0
- package/dist/cjs/components/Accordion/AccordionItem.cjs +40 -0
- package/dist/cjs/components/Accordion/AccordionItem.cjs.map +1 -0
- package/dist/cjs/components/Accordion/AccordionTrigger.cjs +55 -0
- package/dist/cjs/components/Accordion/AccordionTrigger.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs +239 -0
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs +52 -0
- package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs +53 -0
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/AutocompleteTag.cjs +36 -0
- package/dist/cjs/components/Autocomplete/AutocompleteTag.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/constants.cjs +15 -0
- package/dist/cjs/components/Autocomplete/constants.cjs.map +1 -0
- package/dist/cjs/components/Autocomplete/useAutocomplete.cjs +284 -0
- package/dist/cjs/components/Autocomplete/useAutocomplete.cjs.map +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs +7 -7
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +68 -0
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -0
- package/dist/cjs/components/BottomNavigation/BottomNavigationAction.cjs +79 -0
- package/dist/cjs/components/BottomNavigation/BottomNavigationAction.cjs.map +1 -0
- package/dist/cjs/components/Chip/Chip.cjs +1 -8
- package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs +170 -0
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -0
- package/dist/cjs/components/Drawer/Drawer.cjs +151 -0
- package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -0
- package/dist/cjs/components/MobileStepper/MobileStepper.cjs +136 -0
- package/dist/cjs/components/MobileStepper/MobileStepper.cjs.map +1 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs +2 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/dist/cjs/index.cjs +37 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.mjs +11 -0
- package/dist/components/Accordion/Accordion.mjs.map +1 -0
- package/dist/components/Accordion/AccordionContent.mjs +26 -0
- package/dist/components/Accordion/AccordionContent.mjs.map +1 -0
- package/dist/components/Accordion/AccordionItem.mjs +22 -0
- package/dist/components/Accordion/AccordionItem.mjs.map +1 -0
- package/dist/components/Accordion/AccordionTrigger.mjs +37 -0
- package/dist/components/Accordion/AccordionTrigger.mjs.map +1 -0
- package/dist/components/Autocomplete/Autocomplete.mjs +221 -0
- package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -0
- package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs +52 -0
- package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs.map +1 -0
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +53 -0
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -0
- package/dist/components/Autocomplete/AutocompleteTag.mjs +36 -0
- package/dist/components/Autocomplete/AutocompleteTag.mjs.map +1 -0
- package/dist/components/Autocomplete/constants.mjs +15 -0
- package/dist/components/Autocomplete/constants.mjs.map +1 -0
- package/dist/components/Autocomplete/useAutocomplete.mjs +267 -0
- package/dist/components/Autocomplete/useAutocomplete.mjs.map +1 -0
- package/dist/components/Avatar/Avatar.mjs +7 -7
- package/dist/components/Avatar/Avatar.mjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.mjs +51 -0
- package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -0
- package/dist/components/BottomNavigation/BottomNavigationAction.mjs +62 -0
- package/dist/components/BottomNavigation/BottomNavigationAction.mjs.map +1 -0
- package/dist/components/Chip/Chip.mjs +1 -8
- package/dist/components/Chip/Chip.mjs.map +1 -1
- package/dist/components/Dialog/Dialog.mjs +152 -0
- package/dist/components/Dialog/Dialog.mjs.map +1 -0
- package/dist/components/Drawer/Drawer.mjs +133 -0
- package/dist/components/Drawer/Drawer.mjs.map +1 -0
- package/dist/components/MobileStepper/MobileStepper.mjs +119 -0
- package/dist/components/MobileStepper/MobileStepper.mjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.mjs +2 -0
- package/dist/components/ProgressBar/ProgressBar.mjs.map +1 -1
- package/dist/index.d.ts +510 -0
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles/theme.css +26 -0
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.cjs","sources":["../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\n\n/** Track height — `\"default\"` (12px) or `\"small\"` (6px). */\nexport type ProgressBarSize = \"default\" | \"small\";\n/** Colour mode — `\"default\"` uses red/yellow/green by value, `\"generic\"` always uses brand green, `\"neutral\"` uses a theme-aware inverse colour. */\nexport type ProgressBarVariant = \"default\" | \"generic\" | \"neutral\";\n\nexport interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Current progress value, clamped to 0–100. */\n value: number;\n /** Track height — `\"default\"` (12px) or `\"small\"` (6px). @default \"default\" */\n size?: ProgressBarSize;\n /** Colour mode — `\"default\"` is colour-coded by value, `\"generic\"` always uses brand green, `\"neutral\"` uses a theme-aware inverse colour. @default \"default\" */\n variant?: ProgressBarVariant;\n /** Title content shown at the top-left of the bar. */\n title?: React.ReactNode;\n /** Whether to display the completion percentage above the track. @default false */\n showCompletion?: boolean;\n /** Steps label shown at the top-right (e.g. `\"2/8 steps\"`). */\n stepsLabel?: React.ReactNode;\n /** Helper content at the bottom-left of the bar. */\n helperLeft?: React.ReactNode;\n /** Helper content at the bottom-right of the bar. */\n helperRight?: React.ReactNode;\n /** Icon shown at the bottom-left before the helper text. */\n leftIcon?: React.ReactNode;\n /** Accessible label for the `progressbar` role. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst TRACK_HEIGHT: Record<ProgressBarSize, string> = {\n default: \"h-3\",\n small: \"h-1.5\",\n};\n\nconst GAP: Record<ProgressBarSize, string> = {\n default: \"gap-3\",\n small: \"gap-1\",\n};\n\nfunction getDefaultBarColor(value: number): string {\n if (value >= 100) return \"bg-success-default\";\n if (value >= 40) return \"bg-warning-default\";\n return \"bg-error-default\";\n}\n\nfunction getDefaultTextColor(value: number): string {\n if (value >= 100) return \"text-success-default\";\n if (value >= 40) return \"text-warning-default\";\n return \"text-error-default\";\n}\n\nfunction resolveColors(\n variant: ProgressBarVariant,\n value: number,\n): { barColor: string; textColor: string } {\n if (variant === \"neutral\")\n return { barColor: \"bg-foreground-tertiary\", textColor: \"text-foreground-tertiary\" };\n if (variant === \"generic\")\n return { barColor: \"bg-brand-accent-default\", textColor: \"text-brand-accent-default\" };\n return { barColor: getDefaultBarColor(value), textColor: getDefaultTextColor(value) };\n}\n\n/**\n * A horizontal progress indicator with optional title, completion percentage,\n * step count, and helper text. The bar colour reflects progress when using the\n * `\"default\"` variant.\n *\n * @example\n * ```tsx\n * <ProgressBar value={65} title=\"Upload\" showCompletion />\n * ```\n */\nexport const ProgressBar = React.forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value,\n size = \"default\",\n variant = \"default\",\n title,\n showCompletion = false,\n stepsLabel,\n helperLeft,\n helperRight,\n leftIcon,\n ariaLabel,\n className,\n ...props\n },\n ref,\n ) => {\n const clampedValue = Math.min(100, Math.max(0, value));\n const isSmall = size === \"small\";\n const { barColor, textColor } = resolveColors(variant, clampedValue);\n\n const showHeader = title != null || showCompletion || stepsLabel != null;\n const showFooter = leftIcon != null || helperLeft != null || helperRight != null;\n\n return (\n <div ref={ref} className={cn(\"flex w-full flex-col\", GAP[size], className)} {...props}>\n {showHeader && (\n <div className=\"flex w-full items-end justify-between\">\n {title != null && (\n <p className=\"typography-semibold-body-sm text-foreground-default\">{title}</p>\n )}\n {showCompletion && (\n <span\n className={cn(\n textColor,\n isSmall ? \"typography-bold-heading-sm\" : \"typography-bold-heading-xl\",\n )}\n >\n {Math.round(clampedValue)}%\n </span>\n )}\n {stepsLabel != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {stepsLabel}\n </span>\n )}\n </div>\n )}\n\n <div\n role=\"progressbar\"\n aria-label={ariaLabel ?? \"Progress\"}\n aria-valuenow={clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n className={cn(\"relative w-full rounded-full bg-neutral-100\", TRACK_HEIGHT[size])}\n >\n <div\n className={cn(\n \"absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 ease-in-out\",\n barColor,\n )}\n style={{ width: `${clampedValue}%` }}\n />\n </div>\n\n {showFooter && (\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"flex items-center gap-1\">\n {leftIcon != null && (\n <span className=\"flex size-5 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n {helperLeft != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {helperLeft}\n </span>\n )}\n </div>\n {helperRight != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {helperRight}\n </span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nProgressBar.displayName = \"ProgressBar\";\n"],"names":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ProgressBar.cjs","sources":["../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\n\n/** Track height — `\"default\"` (12px) or `\"small\"` (6px). */\nexport type ProgressBarSize = \"default\" | \"small\";\n/** Colour mode — `\"default\"` uses red/yellow/green by value, `\"generic\"` always uses brand green, `\"neutral\"` uses a theme-aware inverse colour. */\nexport type ProgressBarVariant = \"default\" | \"generic\" | \"neutral\";\n\nexport interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Current progress value, clamped to 0–100. */\n value: number;\n /** Track height — `\"default\"` (12px) or `\"small\"` (6px). @default \"default\" */\n size?: ProgressBarSize;\n /** Colour mode — `\"default\"` is colour-coded by value, `\"generic\"` always uses brand green, `\"neutral\"` uses a theme-aware inverse colour. @default \"default\" */\n variant?: ProgressBarVariant;\n /** Title content shown at the top-left of the bar. */\n title?: React.ReactNode;\n /** Whether to display the completion percentage above the track. @default false */\n showCompletion?: boolean;\n /** Steps label shown at the top-right (e.g. `\"2/8 steps\"`). */\n stepsLabel?: React.ReactNode;\n /** Helper content at the bottom-left of the bar. */\n helperLeft?: React.ReactNode;\n /** Helper content at the bottom-right of the bar. */\n helperRight?: React.ReactNode;\n /** Icon shown at the bottom-left before the helper text. */\n leftIcon?: React.ReactNode;\n /** Accessible label for the `progressbar` role. @default \"Progress\" */\n ariaLabel?: string;\n /** Human-readable text alternative for the current value (e.g. \"Step 3 of 5\"). */\n ariaValueText?: string;\n}\n\nconst TRACK_HEIGHT: Record<ProgressBarSize, string> = {\n default: \"h-3\",\n small: \"h-1.5\",\n};\n\nconst GAP: Record<ProgressBarSize, string> = {\n default: \"gap-3\",\n small: \"gap-1\",\n};\n\nfunction getDefaultBarColor(value: number): string {\n if (value >= 100) return \"bg-success-default\";\n if (value >= 40) return \"bg-warning-default\";\n return \"bg-error-default\";\n}\n\nfunction getDefaultTextColor(value: number): string {\n if (value >= 100) return \"text-success-default\";\n if (value >= 40) return \"text-warning-default\";\n return \"text-error-default\";\n}\n\nfunction resolveColors(\n variant: ProgressBarVariant,\n value: number,\n): { barColor: string; textColor: string } {\n if (variant === \"neutral\")\n return { barColor: \"bg-foreground-tertiary\", textColor: \"text-foreground-tertiary\" };\n if (variant === \"generic\")\n return { barColor: \"bg-brand-accent-default\", textColor: \"text-brand-accent-default\" };\n return { barColor: getDefaultBarColor(value), textColor: getDefaultTextColor(value) };\n}\n\n/**\n * A horizontal progress indicator with optional title, completion percentage,\n * step count, and helper text. The bar colour reflects progress when using the\n * `\"default\"` variant.\n *\n * @example\n * ```tsx\n * <ProgressBar value={65} title=\"Upload\" showCompletion />\n * ```\n */\nexport const ProgressBar = React.forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value,\n size = \"default\",\n variant = \"default\",\n title,\n showCompletion = false,\n stepsLabel,\n helperLeft,\n helperRight,\n leftIcon,\n ariaLabel,\n ariaValueText,\n className,\n ...props\n },\n ref,\n ) => {\n const clampedValue = Math.min(100, Math.max(0, value));\n const isSmall = size === \"small\";\n const { barColor, textColor } = resolveColors(variant, clampedValue);\n\n const showHeader = title != null || showCompletion || stepsLabel != null;\n const showFooter = leftIcon != null || helperLeft != null || helperRight != null;\n\n return (\n <div ref={ref} className={cn(\"flex w-full flex-col\", GAP[size], className)} {...props}>\n {showHeader && (\n <div className=\"flex w-full items-end justify-between\">\n {title != null && (\n <p className=\"typography-semibold-body-sm text-foreground-default\">{title}</p>\n )}\n {showCompletion && (\n <span\n className={cn(\n textColor,\n isSmall ? \"typography-bold-heading-sm\" : \"typography-bold-heading-xl\",\n )}\n >\n {Math.round(clampedValue)}%\n </span>\n )}\n {stepsLabel != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {stepsLabel}\n </span>\n )}\n </div>\n )}\n\n <div\n role=\"progressbar\"\n aria-label={ariaLabel ?? \"Progress\"}\n aria-valuenow={clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuetext={ariaValueText}\n className={cn(\"relative w-full rounded-full bg-neutral-100\", TRACK_HEIGHT[size])}\n >\n <div\n className={cn(\n \"absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 ease-in-out\",\n barColor,\n )}\n style={{ width: `${clampedValue}%` }}\n />\n </div>\n\n {showFooter && (\n <div className=\"flex w-full items-center justify-between\">\n <div className=\"flex items-center gap-1\">\n {leftIcon != null && (\n <span className=\"flex size-5 items-center justify-center\" aria-hidden=\"true\">\n {leftIcon}\n </span>\n )}\n {helperLeft != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {helperLeft}\n </span>\n )}\n </div>\n {helperRight != null && (\n <span className=\"typography-regular-body-sm text-foreground-default\">\n {helperRight}\n </span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nProgressBar.displayName = \"ProgressBar\";\n"],"names":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,eAAgD;AAAA,EACpD,SAAS;AAAA,EACT,OAAO;AACT;AAEA,MAAM,MAAuC;AAAA,EAC3C,SAAS;AAAA,EACT,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAuB;AACjD,MAAI,SAAS,IAAK,QAAO;AACzB,MAAI,SAAS,GAAI,QAAO;AACxB,SAAO;AACT;AAEA,SAAS,oBAAoB,OAAuB;AAClD,MAAI,SAAS,IAAK,QAAO;AACzB,MAAI,SAAS,GAAI,QAAO;AACxB,SAAO;AACT;AAEA,SAAS,cACP,SACA,OACyC;AACzC,MAAI,YAAY;AACd,WAAO,EAAE,UAAU,0BAA0B,WAAW,2BAAA;AAC1D,MAAI,YAAY;AACd,WAAO,EAAE,UAAU,2BAA2B,WAAW,4BAAA;AAC3D,SAAO,EAAE,UAAU,mBAAmB,KAAK,GAAG,WAAW,oBAAoB,KAAK,EAAA;AACpF;AAYO,MAAM,cAAcA,iBAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA,OAAO;A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C,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWD,GAAAA;AAAAA,gBACT;AAAA,gBACA;AAAA,cAAA;AAAA,cAEF,OAAO,EAAE,OAAO,GAAG,YAAY,IAAA;AAAA,YAAI;AAAA,UAAA;AAAA,QACrC;AAAA,MAAA;AAAA,MAGD,cACCD,2BAAAA,KAAC,OAAA,EAAI,WAAU,4CACb,UAAA;AAAA,QAAAA,2BAAAA,KAAC,OAAA,EAAI,WAAU,2BACZ,UAAA;AAAA,UAAA,YAAY,QACXE,+BAAC,QAAA,EAAK,WAAU,2CAA0C,eAAY,QACnE,UAAA,SAAA,CACH;AAAA,UAED,cAAc,QACbA,2BAAAA,IAAC,QAAA,EAAK,WAAU,sDACb,UAAA,WAAA,CACH;AAAA,QAAA,GAEJ;AAAA,QACC,eAAe,QACdA,2BAAAA,IAAC,QAAA,EAAK,WAAU,sDACb,UAAA,YAAA,CACH;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const Accordion = require("./components/Accordion/Accordion.cjs");
|
|
5
|
+
const AccordionContent = require("./components/Accordion/AccordionContent.cjs");
|
|
6
|
+
const AccordionItem = require("./components/Accordion/AccordionItem.cjs");
|
|
7
|
+
const AccordionTrigger = require("./components/Accordion/AccordionTrigger.cjs");
|
|
4
8
|
const Alert = require("./components/Alert/Alert.cjs");
|
|
5
9
|
const AudioUpload = require("./components/AudioUpload/AudioUpload.cjs");
|
|
6
10
|
const useAudioRecorder = require("./components/AudioUpload/useAudioRecorder.cjs");
|
|
11
|
+
const Autocomplete = require("./components/Autocomplete/Autocomplete.cjs");
|
|
7
12
|
const Avatar = require("./components/Avatar/Avatar.cjs");
|
|
8
13
|
const Badge = require("./components/Badge/Badge.cjs");
|
|
14
|
+
const BottomNavigation = require("./components/BottomNavigation/BottomNavigation.cjs");
|
|
15
|
+
const BottomNavigationAction = require("./components/BottomNavigation/BottomNavigationAction.cjs");
|
|
9
16
|
const Breadcrumb = require("./components/Breadcrumb/Breadcrumb.cjs");
|
|
10
17
|
const Button = require("./components/Button/Button.cjs");
|
|
11
18
|
const Card = require("./components/Card/Card.cjs");
|
|
12
19
|
const Checkbox = require("./components/Checkbox/Checkbox.cjs");
|
|
13
20
|
const Chip = require("./components/Chip/Chip.cjs");
|
|
14
21
|
const Count = require("./components/Count/Count.cjs");
|
|
22
|
+
const Dialog = require("./components/Dialog/Dialog.cjs");
|
|
15
23
|
const Divider = require("./components/Divider/Divider.cjs");
|
|
24
|
+
const Drawer = require("./components/Drawer/Drawer.cjs");
|
|
16
25
|
const IconButton = require("./components/IconButton/IconButton.cjs");
|
|
17
26
|
const AddIcon = require("./components/Icons/AddIcon.cjs");
|
|
18
27
|
const AIIcon = require("./components/Icons/AIIcon.cjs");
|
|
@@ -134,6 +143,7 @@ const WifiOnIcon = require("./components/Icons/WifiOnIcon.cjs");
|
|
|
134
143
|
const WrenchIcon = require("./components/Icons/WrenchIcon.cjs");
|
|
135
144
|
const Loader = require("./components/Loader/Loader.cjs");
|
|
136
145
|
const Logo = require("./components/Logo/Logo.cjs");
|
|
146
|
+
const MobileStepper = require("./components/MobileStepper/MobileStepper.cjs");
|
|
137
147
|
const Pagination = require("./components/Pagination/Pagination.cjs");
|
|
138
148
|
const PasswordField = require("./components/PasswordField/PasswordField.cjs");
|
|
139
149
|
const Pill = require("./components/Pill/Pill.cjs");
|
|
@@ -157,14 +167,21 @@ const TextField = require("./components/TextField/TextField.cjs");
|
|
|
157
167
|
const Toast = require("./components/Toast/Toast.cjs");
|
|
158
168
|
const Tooltip = require("./components/Tooltip/Tooltip.cjs");
|
|
159
169
|
const cn = require("./utils/cn.cjs");
|
|
170
|
+
exports.Accordion = Accordion.Accordion;
|
|
171
|
+
exports.AccordionContent = AccordionContent.AccordionContent;
|
|
172
|
+
exports.AccordionItem = AccordionItem.AccordionItem;
|
|
173
|
+
exports.AccordionTrigger = AccordionTrigger.AccordionTrigger;
|
|
160
174
|
exports.Alert = Alert.Alert;
|
|
161
175
|
exports.AudioUpload = AudioUpload.AudioUpload;
|
|
162
176
|
exports.useAudioRecorder = useAudioRecorder.useAudioRecorder;
|
|
177
|
+
exports.Autocomplete = Autocomplete.Autocomplete;
|
|
163
178
|
exports.Avatar = Avatar.Avatar;
|
|
164
179
|
exports.AvatarFallback = Avatar.AvatarFallback;
|
|
165
180
|
exports.AvatarImage = Avatar.AvatarImage;
|
|
166
181
|
exports.AvatarRoot = Avatar.AvatarRoot;
|
|
167
182
|
exports.Badge = Badge.Badge;
|
|
183
|
+
exports.BottomNavigation = BottomNavigation.BottomNavigation;
|
|
184
|
+
exports.BottomNavigationAction = BottomNavigationAction.BottomNavigationAction;
|
|
168
185
|
exports.Breadcrumb = Breadcrumb.Breadcrumb;
|
|
169
186
|
exports.BreadcrumbItem = Breadcrumb.BreadcrumbItem;
|
|
170
187
|
exports.BreadcrumbLink = Breadcrumb.BreadcrumbLink;
|
|
@@ -181,7 +198,26 @@ exports.CardTitle = Card.CardTitle;
|
|
|
181
198
|
exports.Checkbox = Checkbox.Checkbox;
|
|
182
199
|
exports.Chip = Chip.Chip;
|
|
183
200
|
exports.Count = Count.Count;
|
|
201
|
+
exports.Dialog = Dialog.Dialog;
|
|
202
|
+
exports.DialogBody = Dialog.DialogBody;
|
|
203
|
+
exports.DialogClose = Dialog.DialogClose;
|
|
204
|
+
exports.DialogContent = Dialog.DialogContent;
|
|
205
|
+
exports.DialogDescription = Dialog.DialogDescription;
|
|
206
|
+
exports.DialogFooter = Dialog.DialogFooter;
|
|
207
|
+
exports.DialogHeader = Dialog.DialogHeader;
|
|
208
|
+
exports.DialogOverlay = Dialog.DialogOverlay;
|
|
209
|
+
exports.DialogTitle = Dialog.DialogTitle;
|
|
210
|
+
exports.DialogTrigger = Dialog.DialogTrigger;
|
|
184
211
|
exports.Divider = Divider.Divider;
|
|
212
|
+
exports.Drawer = Drawer.Drawer;
|
|
213
|
+
exports.DrawerClose = Drawer.DrawerClose;
|
|
214
|
+
exports.DrawerContent = Drawer.DrawerContent;
|
|
215
|
+
exports.DrawerDescription = Drawer.DrawerDescription;
|
|
216
|
+
exports.DrawerFooter = Drawer.DrawerFooter;
|
|
217
|
+
exports.DrawerHeader = Drawer.DrawerHeader;
|
|
218
|
+
exports.DrawerOverlay = Drawer.DrawerOverlay;
|
|
219
|
+
exports.DrawerTitle = Drawer.DrawerTitle;
|
|
220
|
+
exports.DrawerTrigger = Drawer.DrawerTrigger;
|
|
185
221
|
exports.IconButton = IconButton.IconButton;
|
|
186
222
|
exports.AddIcon = AddIcon.AddIcon;
|
|
187
223
|
exports.AIIcon = AIIcon.AIIcon;
|
|
@@ -303,6 +339,7 @@ exports.WifiOnIcon = WifiOnIcon.WifiOnIcon;
|
|
|
303
339
|
exports.WrenchIcon = WrenchIcon.WrenchIcon;
|
|
304
340
|
exports.Loader = Loader.Loader;
|
|
305
341
|
exports.Logo = Logo.Logo;
|
|
342
|
+
exports.MobileStepper = MobileStepper.MobileStepper;
|
|
306
343
|
exports.Pagination = Pagination.Pagination;
|
|
307
344
|
exports.PasswordField = PasswordField.PasswordField;
|
|
308
345
|
exports.Pill = Pill.Pill;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const Accordion = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Root, { ref, className: cn("space-y-2", className), ...props }));
|
|
7
|
+
Accordion.displayName = "Accordion";
|
|
8
|
+
export {
|
|
9
|
+
Accordion
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=Accordion.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.mjs","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link Accordion} root component. Extends Radix `Accordion.Root` props. */\nexport type AccordionProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>;\n\n/**\n * Root container for an accordion interface. Manages the expand/collapse state\n * and coordinates {@link AccordionItem}, {@link AccordionTrigger}, and {@link AccordionContent}.\n *\n * Built on Radix UI `Accordion`.\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionTrigger>Section 1</AccordionTrigger>\n * <AccordionContent>Content 1</AccordionContent>\n * </AccordionItem>\n * <AccordionItem value=\"item-2\">\n * <AccordionTrigger>Section 2</AccordionTrigger>\n * <AccordionContent>Content 2</AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nexport const Accordion = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Root>,\n AccordionProps\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Root ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n));\n\nAccordion.displayName = \"Accordion\";\n"],"names":[],"mappings":";;;;;AA2BO,MAAM,YAAY,MAAM,WAG7B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B,oBAAC,mBAAmB,MAAnB,EAAwB,KAAU,WAAW,GAAG,aAAa,SAAS,GAAI,GAAG,OAAO,CACtF;AAED,UAAU,cAAc;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const AccordionContent = React.forwardRef(({ className, children, noPadding, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
AccordionPrimitive.Content,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(
|
|
11
|
+
"overflow-hidden",
|
|
12
|
+
"typography-regular-body-md text-foreground-secondary",
|
|
13
|
+
"motion-safe:data-[state=closed]:animate-accordion-collapse",
|
|
14
|
+
"motion-safe:data-[state=open]:animate-accordion-expand",
|
|
15
|
+
!noPadding && "px-3 pb-3",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props,
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", { className: "min-w-0 overflow-wrap-anywhere", children })
|
|
20
|
+
}
|
|
21
|
+
));
|
|
22
|
+
AccordionContent.displayName = "AccordionContent";
|
|
23
|
+
export {
|
|
24
|
+
AccordionContent
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=AccordionContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionContent.mjs","sources":["../../../src/components/Accordion/AccordionContent.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link AccordionContent} panel component. */\nexport type AccordionContentProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Content\n> & {\n /** Remove the default inner padding (`px-3 pb-3`). Useful when you need custom content layout. */\n noPadding?: boolean;\n};\n\n/** Renders the collapsible content panel for an {@link AccordionItem}. Animates open and closed. */\nexport const AccordionContent = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Content>,\n AccordionContentProps\n>(({ className, children, noPadding, ...props }, ref) => (\n <AccordionPrimitive.Content\n ref={ref}\n className={cn(\n \"overflow-hidden\",\n \"typography-regular-body-md text-foreground-secondary\",\n \"motion-safe:data-[state=closed]:animate-accordion-collapse\",\n \"motion-safe:data-[state=open]:animate-accordion-expand\",\n !noPadding && \"px-3 pb-3\",\n className,\n )}\n {...props}\n >\n <div className=\"min-w-0 overflow-wrap-anywhere\">{children}</div>\n </AccordionPrimitive.Content>\n));\n\nAccordionContent.displayName = \"AccordionContent\";\n"],"names":[],"mappings":";;;;;AAaO,MAAM,mBAAmB,MAAM,WAGpC,CAAC,EAAE,WAAW,UAAU,WAAW,GAAG,SAAS,QAC/C;AAAA,EAAC,mBAAmB;AAAA,EAAnB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,CAAC,aAAa;AAAA,MACd;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAA,oBAAC,OAAA,EAAI,WAAU,kCAAkC,SAAA,CAAS;AAAA,EAAA;AAC5D,CACD;AAED,iBAAiB,cAAc;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const AccordionItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
AccordionPrimitive.Item,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(
|
|
11
|
+
"overflow-hidden rounded-xl bg-surface-container",
|
|
12
|
+
"border border-neutral-200",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
));
|
|
18
|
+
AccordionItem.displayName = "AccordionItem";
|
|
19
|
+
export {
|
|
20
|
+
AccordionItem
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=AccordionItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItem.mjs","sources":["../../../src/components/Accordion/AccordionItem.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link AccordionItem} component. */\nexport type AccordionItemProps = React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>;\n\n/** A single collapsible section within an {@link Accordion}. Contains an {@link AccordionTrigger} and {@link AccordionContent}. */\nexport const AccordionItem = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Item>,\n AccordionItemProps\n>(({ className, ...props }, ref) => (\n <AccordionPrimitive.Item\n ref={ref}\n className={cn(\n \"overflow-hidden rounded-xl bg-surface-container\",\n \"border border-neutral-200\",\n className,\n )}\n {...props}\n />\n));\n\nAccordionItem.displayName = \"AccordionItem\";\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,mBAAmB;AAAA,EAAnB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN,CACD;AAED,cAAc,cAAc;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
import { ChevronDownIcon } from "../Icons/ChevronDownIcon.mjs";
|
|
7
|
+
const AccordionTrigger = React.forwardRef(({ className, children, icon, ...props }, ref) => {
|
|
8
|
+
const showIcon = icon !== null;
|
|
9
|
+
const iconElement = icon === void 0 ? /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 text-foreground-secondary" }) : icon;
|
|
10
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
11
|
+
AccordionPrimitive.Trigger,
|
|
12
|
+
{
|
|
13
|
+
ref,
|
|
14
|
+
className: cn(
|
|
15
|
+
"flex flex-1 items-center justify-between gap-3",
|
|
16
|
+
"rounded-xl px-3 py-3",
|
|
17
|
+
"typography-semibold-body-md text-foreground-default",
|
|
18
|
+
"cursor-pointer",
|
|
19
|
+
"motion-safe:transition-colors motion-safe:duration-200 motion-safe:ease-in-out",
|
|
20
|
+
"hover:bg-neutral-100",
|
|
21
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-page",
|
|
22
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left", children }),
|
|
28
|
+
showIcon && /* @__PURE__ */ jsx("span", { className: "shrink-0 motion-safe:transition-transform motion-safe:duration-200 [[data-state=open]>&]:rotate-180", children: iconElement })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
});
|
|
33
|
+
AccordionTrigger.displayName = "AccordionTrigger";
|
|
34
|
+
export {
|
|
35
|
+
AccordionTrigger
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=AccordionTrigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionTrigger.mjs","sources":["../../../src/components/Accordion/AccordionTrigger.tsx"],"sourcesContent":["import * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\n\n/** Props for the {@link AccordionTrigger} button component. */\nexport type AccordionTriggerProps = React.ComponentPropsWithoutRef<\n typeof AccordionPrimitive.Trigger\n> & {\n /** Custom icon element. Defaults to `ChevronDownIcon`. Pass `null` to suppress the icon entirely. */\n icon?: React.ReactNode | null;\n};\n\n/** An interactive button that toggles the visibility of its associated {@link AccordionContent} panel. */\nexport const AccordionTrigger = React.forwardRef<\n React.ComponentRef<typeof AccordionPrimitive.Trigger>,\n AccordionTriggerProps\n>(({ className, children, icon, ...props }, ref) => {\n const showIcon = icon !== null;\n const iconElement =\n icon === undefined ? (\n <ChevronDownIcon className=\"size-4 shrink-0 text-foreground-secondary\" />\n ) : (\n icon\n );\n\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex flex-1 items-center justify-between gap-3\",\n \"rounded-xl px-3 py-3\",\n \"typography-semibold-body-md text-foreground-default\",\n \"cursor-pointer\",\n \"motion-safe:transition-colors motion-safe:duration-200 motion-safe:ease-in-out\",\n \"hover:bg-neutral-100\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface-page\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"min-w-0 flex-1 truncate text-left\">{children}</span>\n {showIcon && (\n <span className=\"shrink-0 motion-safe:transition-transform motion-safe:duration-200 [[data-state=open]>&]:rotate-180\">\n {iconElement}\n </span>\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n});\n\nAccordionTrigger.displayName = \"AccordionTrigger\";\n"],"names":[],"mappings":";;;;;;AAcO,MAAM,mBAAmB,MAAM,WAGpC,CAAC,EAAE,WAAW,UAAU,MAAM,GAAG,MAAA,GAAS,QAAQ;AAClD,QAAM,WAAW,SAAS;AAC1B,QAAM,cACJ,SAAS,6BACN,iBAAA,EAAgB,WAAU,6CAA4C,IAEvE;AAGJ,SACE,oBAAC,mBAAmB,QAAnB,EAA0B,WAAU,QACnC,UAAA;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,oBAAC,QAAA,EAAK,WAAU,qCAAqC,SAAA,CAAS;AAAA,QAC7D,YACC,oBAAC,QAAA,EAAK,WAAU,uGACb,UAAA,YAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,CAAC;AAED,iBAAiB,cAAc;"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Popover from "@radix-ui/react-popover";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
import { ChevronDownIcon } from "../Icons/ChevronDownIcon.mjs";
|
|
7
|
+
import { CloseIcon } from "../Icons/CloseIcon.mjs";
|
|
8
|
+
import { SpinnerIcon } from "../Icons/SpinnerIcon.mjs";
|
|
9
|
+
import { AutocompleteDropdownContent } from "./AutocompleteDropdownContent.mjs";
|
|
10
|
+
import { AutocompleteTag } from "./AutocompleteTag.mjs";
|
|
11
|
+
import { useAutocomplete } from "./useAutocomplete.mjs";
|
|
12
|
+
const CONTAINER_HEIGHT = {
|
|
13
|
+
"48": "min-h-12",
|
|
14
|
+
"40": "min-h-10",
|
|
15
|
+
"32": "min-h-8"
|
|
16
|
+
};
|
|
17
|
+
const INPUT_SIZE_CLASSES = {
|
|
18
|
+
"48": "typography-regular-body-lg",
|
|
19
|
+
"40": "typography-regular-body-lg",
|
|
20
|
+
"32": "typography-regular-body-md"
|
|
21
|
+
};
|
|
22
|
+
const PADDING_CLASSES = {
|
|
23
|
+
"48": "px-4 py-1.5 gap-3",
|
|
24
|
+
"40": "px-4 py-1 gap-3",
|
|
25
|
+
"32": "px-3 py-1 gap-2"
|
|
26
|
+
};
|
|
27
|
+
function warnMissingAccessibleName(label, ariaLabel, ariaLabelledBy) {
|
|
28
|
+
if (process.env.NODE_ENV !== "production") {
|
|
29
|
+
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
30
|
+
console.warn(
|
|
31
|
+
"Autocomplete: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const Autocomplete = React.forwardRef((props, ref) => {
|
|
37
|
+
const {
|
|
38
|
+
label,
|
|
39
|
+
"aria-label": ariaLabel,
|
|
40
|
+
"aria-labelledby": ariaLabelledby,
|
|
41
|
+
helperText,
|
|
42
|
+
size = "48",
|
|
43
|
+
error = false,
|
|
44
|
+
errorMessage,
|
|
45
|
+
placeholder,
|
|
46
|
+
leftIcon,
|
|
47
|
+
fullWidth = false,
|
|
48
|
+
disabled = false,
|
|
49
|
+
clearable = false,
|
|
50
|
+
clearAriaLabel = "Clear",
|
|
51
|
+
className,
|
|
52
|
+
loading = false,
|
|
53
|
+
loadingText,
|
|
54
|
+
emptyText = "No results",
|
|
55
|
+
renderOption,
|
|
56
|
+
renderTag
|
|
57
|
+
} = props;
|
|
58
|
+
const ac = useAutocomplete(props);
|
|
59
|
+
React.useImperativeHandle(ref, () => ac.inputRef.current);
|
|
60
|
+
warnMissingAccessibleName(label, ariaLabel, ariaLabelledby);
|
|
61
|
+
const bottomText = error && errorMessage ? errorMessage : helperText;
|
|
62
|
+
return /* @__PURE__ */ jsx(Popover.Root, { open: ac.isOpen && !disabled, onOpenChange: ac.handleOpenChange, children: /* @__PURE__ */ jsxs(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: cn("flex flex-col", fullWidth && "w-full", className),
|
|
66
|
+
"data-autocomplete-root": "",
|
|
67
|
+
"data-disabled": disabled ? "" : void 0,
|
|
68
|
+
"data-error": error ? "" : void 0,
|
|
69
|
+
children: [
|
|
70
|
+
label && /* @__PURE__ */ jsx(
|
|
71
|
+
"label",
|
|
72
|
+
{
|
|
73
|
+
htmlFor: ac.inputId,
|
|
74
|
+
className: "typography-semibold-body-sm px-1 pt-1 pb-2 text-foreground-default",
|
|
75
|
+
children: label
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(Popover.Anchor, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: cn(
|
|
82
|
+
"flex flex-wrap items-center overflow-hidden rounded-xl border bg-neutral-100 has-focus-visible:outline-none motion-safe:transition-colors",
|
|
83
|
+
error ? "border-error-default" : "border-transparent",
|
|
84
|
+
!disabled && !error && "hover:border-neutral-400",
|
|
85
|
+
ac.isOpen && !error && !disabled && "border-neutral-400",
|
|
86
|
+
CONTAINER_HEIGHT[size],
|
|
87
|
+
PADDING_CLASSES[size],
|
|
88
|
+
disabled && "opacity-50"
|
|
89
|
+
),
|
|
90
|
+
onClick: ac.handleContainerClick,
|
|
91
|
+
children: [
|
|
92
|
+
leftIcon && /* @__PURE__ */ jsx("div", { className: "flex size-5 shrink-0 items-center justify-center text-foreground-secondary", children: leftIcon }),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: [
|
|
94
|
+
ac.isMulti && ac.selectedMultiOptions.map((opt) => /* @__PURE__ */ jsx(
|
|
95
|
+
AutocompleteTag,
|
|
96
|
+
{
|
|
97
|
+
option: opt,
|
|
98
|
+
disabled,
|
|
99
|
+
onRemove: () => ac.toggleMulti(opt.value),
|
|
100
|
+
renderTag
|
|
101
|
+
},
|
|
102
|
+
opt.value
|
|
103
|
+
)),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
"input",
|
|
106
|
+
{
|
|
107
|
+
ref: ac.inputRef,
|
|
108
|
+
id: ac.inputId,
|
|
109
|
+
role: "combobox",
|
|
110
|
+
type: "text",
|
|
111
|
+
disabled,
|
|
112
|
+
"aria-expanded": ac.isOpen,
|
|
113
|
+
"aria-controls": ac.isOpen ? ac.listboxId : void 0,
|
|
114
|
+
"aria-activedescendant": ac.activeDescendantId,
|
|
115
|
+
"aria-autocomplete": "list",
|
|
116
|
+
"aria-describedby": bottomText ? ac.helperTextId : void 0,
|
|
117
|
+
"aria-invalid": error || void 0,
|
|
118
|
+
"aria-label": ariaLabel,
|
|
119
|
+
"aria-labelledby": ariaLabelledby,
|
|
120
|
+
autoComplete: "off",
|
|
121
|
+
placeholder: ac.isMulti && ac.selectedMultiValues.length > 0 ? void 0 : placeholder,
|
|
122
|
+
value: ac.displayInputValue,
|
|
123
|
+
onChange: ac.handleInputChange,
|
|
124
|
+
onKeyDown: ac.handleKeyDown,
|
|
125
|
+
onFocus: ac.handleFocus,
|
|
126
|
+
onBlur: ac.handleBlur,
|
|
127
|
+
className: cn(
|
|
128
|
+
"min-w-[40px] flex-1 truncate rounded-xl bg-transparent text-foreground-default no-underline placeholder:text-foreground-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed",
|
|
129
|
+
INPUT_SIZE_CLASSES[size]
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] }),
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
135
|
+
loading && /* @__PURE__ */ jsx(SpinnerIcon, { className: "size-4 animate-spin text-foreground-secondary" }),
|
|
136
|
+
clearable && ac.hasClearableValue && !disabled && /* @__PURE__ */ jsx(
|
|
137
|
+
"button",
|
|
138
|
+
{
|
|
139
|
+
type: "button",
|
|
140
|
+
tabIndex: -1,
|
|
141
|
+
"aria-label": clearAriaLabel,
|
|
142
|
+
className: "flex size-5 shrink-0 cursor-pointer items-center justify-center text-foreground-secondary hover:text-foreground-default active:scale-95",
|
|
143
|
+
onClick: ac.handleClear,
|
|
144
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "size-4" })
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ jsx("div", { className: "flex size-5 shrink-0 items-center justify-center text-foreground-secondary", children: /* @__PURE__ */ jsx(
|
|
148
|
+
ChevronDownIcon,
|
|
149
|
+
{
|
|
150
|
+
className: cn("size-5 transition-transform", ac.isOpen && "rotate-180")
|
|
151
|
+
}
|
|
152
|
+
) })
|
|
153
|
+
] })
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
) }),
|
|
157
|
+
/* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(
|
|
158
|
+
Popover.Content,
|
|
159
|
+
{
|
|
160
|
+
sideOffset: 4,
|
|
161
|
+
collisionPadding: 8,
|
|
162
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
163
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
164
|
+
style: { zIndex: "var(--fanvue-ui-portal-z-index, 50)" },
|
|
165
|
+
className: cn(
|
|
166
|
+
"w-(--radix-popover-trigger-width) min-w-(--radix-popper-anchor-width) overflow-hidden rounded-xl border border-neutral-200 bg-surface-page text-foreground-default shadow-[0_4px_16px_rgba(0,0,0,0.10)]",
|
|
167
|
+
"data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
168
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
169
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
170
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2"
|
|
171
|
+
),
|
|
172
|
+
children: /* @__PURE__ */ jsx(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
ref: ac.listRef,
|
|
176
|
+
id: ac.listboxId,
|
|
177
|
+
role: "listbox",
|
|
178
|
+
"aria-label": label ?? ariaLabel ?? "Options",
|
|
179
|
+
"aria-multiselectable": ac.isMulti || void 0,
|
|
180
|
+
className: "max-h-60 overflow-y-auto p-1",
|
|
181
|
+
children: /* @__PURE__ */ jsx(
|
|
182
|
+
AutocompleteDropdownContent,
|
|
183
|
+
{
|
|
184
|
+
loading,
|
|
185
|
+
loadingText,
|
|
186
|
+
emptyText,
|
|
187
|
+
visibleOptions: ac.visibleOptions,
|
|
188
|
+
listboxId: ac.listboxId,
|
|
189
|
+
activeIndex: ac.activeIndex,
|
|
190
|
+
isMulti: ac.isMulti,
|
|
191
|
+
selectedMultiValues: ac.selectedMultiValues,
|
|
192
|
+
selectedValue: ac.selectedValue,
|
|
193
|
+
onSelect: ac.handleSelect,
|
|
194
|
+
onMouseEnter: ac.setActiveIndex,
|
|
195
|
+
renderOption
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
) }),
|
|
202
|
+
bottomText && /* @__PURE__ */ jsx(
|
|
203
|
+
"p",
|
|
204
|
+
{
|
|
205
|
+
id: ac.helperTextId,
|
|
206
|
+
className: cn(
|
|
207
|
+
"typography-regular-body-sm px-2 pt-1 pb-0.5",
|
|
208
|
+
error ? "text-error-default" : "text-foreground-secondary"
|
|
209
|
+
),
|
|
210
|
+
children: bottomText
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
) });
|
|
216
|
+
});
|
|
217
|
+
Autocomplete.displayName = "Autocomplete";
|
|
218
|
+
export {
|
|
219
|
+
Autocomplete
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=Autocomplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Autocomplete.mjs","sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import * as Popover from \"@radix-ui/react-popover\";\nimport * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ChevronDownIcon } from \"../Icons/ChevronDownIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\nimport { AutocompleteDropdownContent } from \"./AutocompleteDropdownContent\";\nimport { AutocompleteTag } from \"./AutocompleteTag\";\nimport { useAutocomplete } from \"./useAutocomplete\";\n\nexport type AutocompleteSize = \"48\" | \"40\" | \"32\";\n\nexport interface AutocompleteOption {\n value: string;\n label?: string;\n disabled?: boolean;\n}\n\ninterface AutocompleteBaseProps {\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n helperText?: string;\n /** @default \"48\" */\n size?: AutocompleteSize;\n /** @default false */\n error?: boolean;\n errorMessage?: string;\n placeholder?: string;\n leftIcon?: React.ReactNode;\n /** @default false */\n fullWidth?: boolean;\n /** @default false */\n disabled?: boolean;\n /** @default false */\n clearable?: boolean;\n clearAriaLabel?: string;\n id?: string;\n className?: string;\n options: AutocompleteOption[];\n inputValue?: string;\n onInputChange?: (value: string) => void;\n filterFn?: (option: AutocompleteOption, query: string) => boolean;\n /** @default false */\n creatable?: boolean;\n creatableLabel?: (inputValue: string) => string;\n onCreate?: (inputValue: string) => void;\n /** @default false */\n loading?: boolean;\n loadingText?: string;\n emptyText?: string;\n renderOption?: (\n option: AutocompleteOption,\n state: { selected: boolean; active: boolean },\n ) => React.ReactNode;\n renderTag?: (option: AutocompleteOption, onRemove: () => void) => React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\ninterface AutocompleteSingleProps extends AutocompleteBaseProps {\n multiple?: false;\n value?: string | null;\n defaultValue?: string | null;\n onChange?: (value: string | null) => void;\n}\n\ninterface AutocompleteMultiProps extends AutocompleteBaseProps {\n multiple: true;\n value?: string[];\n defaultValue?: string[];\n onChange?: (values: string[]) => void;\n}\n\nexport type AutocompleteProps = AutocompleteSingleProps | AutocompleteMultiProps;\n\nconst CONTAINER_HEIGHT: Record<AutocompleteSize, string> = {\n \"48\": \"min-h-12\",\n \"40\": \"min-h-10\",\n \"32\": \"min-h-8\",\n};\n\nconst INPUT_SIZE_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"typography-regular-body-lg\",\n \"40\": \"typography-regular-body-lg\",\n \"32\": \"typography-regular-body-md\",\n};\n\nconst PADDING_CLASSES: Record<AutocompleteSize, string> = {\n \"48\": \"px-4 py-1.5 gap-3\",\n \"40\": \"px-4 py-1 gap-3\",\n \"32\": \"px-3 py-1 gap-2\",\n};\n\nfunction warnMissingAccessibleName(label?: string, ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"Autocomplete: no accessible name provided. Pass a `label`, `aria-label`, or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: Conditional JSX branches in the render template\nexport const Autocomplete = React.forwardRef<HTMLInputElement, AutocompleteProps>((props, ref) => {\n const {\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n helperText,\n size = \"48\",\n error = false,\n errorMessage,\n placeholder,\n leftIcon,\n fullWidth = false,\n disabled = false,\n clearable = false,\n clearAriaLabel = \"Clear\",\n className,\n loading = false,\n loadingText,\n emptyText = \"No results\",\n renderOption,\n renderTag,\n } = props;\n\n const ac = useAutocomplete(props);\n\n React.useImperativeHandle(ref, () => ac.inputRef.current as HTMLInputElement);\n\n warnMissingAccessibleName(label, ariaLabel, ariaLabelledby);\n\n const bottomText = error && errorMessage ? errorMessage : helperText;\n\n return (\n <Popover.Root open={ac.isOpen && !disabled} onOpenChange={ac.handleOpenChange}>\n <div\n className={cn(\"flex flex-col\", fullWidth && \"w-full\", className)}\n data-autocomplete-root=\"\"\n data-disabled={disabled ? \"\" : undefined}\n data-error={error ? \"\" : undefined}\n >\n {label && (\n <label\n htmlFor={ac.inputId}\n className=\"typography-semibold-body-sm px-1 pt-1 pb-2 text-foreground-default\"\n >\n {label}\n </label>\n )}\n\n <Popover.Anchor asChild>\n {/* biome-ignore lint/a11y/noStaticElementInteractions: Container delegates click to the inner input */}\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: Keyboard interaction is handled by the inner combobox input */}\n <div\n className={cn(\n \"flex flex-wrap items-center overflow-hidden rounded-xl border bg-neutral-100 has-focus-visible:outline-none motion-safe:transition-colors\",\n error ? \"border-error-default\" : \"border-transparent\",\n !disabled && !error && \"hover:border-neutral-400\",\n ac.isOpen && !error && !disabled && \"border-neutral-400\",\n CONTAINER_HEIGHT[size],\n PADDING_CLASSES[size],\n disabled && \"opacity-50\",\n )}\n onClick={ac.handleContainerClick}\n >\n {leftIcon && (\n <div className=\"flex size-5 shrink-0 items-center justify-center text-foreground-secondary\">\n {leftIcon}\n </div>\n )}\n\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1.5\">\n {ac.isMulti &&\n ac.selectedMultiOptions.map((opt) => (\n <AutocompleteTag\n key={opt.value}\n option={opt}\n disabled={disabled}\n onRemove={() => ac.toggleMulti(opt.value)}\n renderTag={renderTag}\n />\n ))}\n\n <input\n ref={ac.inputRef}\n id={ac.inputId}\n role=\"combobox\"\n type=\"text\"\n disabled={disabled}\n aria-expanded={ac.isOpen}\n aria-controls={ac.isOpen ? ac.listboxId : undefined}\n aria-activedescendant={ac.activeDescendantId}\n aria-autocomplete=\"list\"\n aria-describedby={bottomText ? ac.helperTextId : undefined}\n aria-invalid={error || undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n autoComplete=\"off\"\n placeholder={\n ac.isMulti && ac.selectedMultiValues.length > 0 ? undefined : placeholder\n }\n value={ac.displayInputValue}\n onChange={ac.handleInputChange}\n onKeyDown={ac.handleKeyDown}\n onFocus={ac.handleFocus}\n onBlur={ac.handleBlur}\n className={cn(\n \"min-w-[40px] flex-1 truncate rounded-xl bg-transparent text-foreground-default no-underline placeholder:text-foreground-secondary placeholder:opacity-40 focus:outline-none disabled:cursor-not-allowed\",\n INPUT_SIZE_CLASSES[size],\n )}\n />\n </div>\n\n <div className=\"flex shrink-0 items-center gap-1\">\n {loading && <SpinnerIcon className=\"size-4 animate-spin text-foreground-secondary\" />}\n {clearable && ac.hasClearableValue && !disabled && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={clearAriaLabel}\n className=\"flex size-5 shrink-0 cursor-pointer items-center justify-center text-foreground-secondary hover:text-foreground-default active:scale-95\"\n onClick={ac.handleClear}\n >\n <CloseIcon className=\"size-4\" />\n </button>\n )}\n <div className=\"flex size-5 shrink-0 items-center justify-center text-foreground-secondary\">\n <ChevronDownIcon\n className={cn(\"size-5 transition-transform\", ac.isOpen && \"rotate-180\")}\n />\n </div>\n </div>\n </div>\n </Popover.Anchor>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n collisionPadding={8}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onCloseAutoFocus={(e) => e.preventDefault()}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\" }}\n className={cn(\n \"w-(--radix-popover-trigger-width) min-w-(--radix-popper-anchor-width) overflow-hidden rounded-xl border border-neutral-200 bg-surface-page text-foreground-default shadow-[0_4px_16px_rgba(0,0,0,0.10)]\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2\",\n )}\n >\n <div\n ref={ac.listRef}\n id={ac.listboxId}\n role=\"listbox\"\n aria-label={label ?? ariaLabel ?? \"Options\"}\n aria-multiselectable={ac.isMulti || undefined}\n className=\"max-h-60 overflow-y-auto p-1\"\n >\n <AutocompleteDropdownContent\n loading={loading}\n loadingText={loadingText}\n emptyText={emptyText}\n visibleOptions={ac.visibleOptions}\n listboxId={ac.listboxId}\n activeIndex={ac.activeIndex}\n isMulti={ac.isMulti}\n selectedMultiValues={ac.selectedMultiValues}\n selectedValue={ac.selectedValue}\n onSelect={ac.handleSelect}\n onMouseEnter={ac.setActiveIndex}\n renderOption={renderOption}\n />\n </div>\n </Popover.Content>\n </Popover.Portal>\n\n {bottomText && (\n <p\n id={ac.helperTextId}\n className={cn(\n \"typography-regular-body-sm px-2 pt-1 pb-0.5\",\n error ? \"text-error-default\" : \"text-foreground-secondary\",\n )}\n >\n {bottomText}\n </p>\n )}\n </div>\n </Popover.Root>\n );\n});\n\nAutocomplete.displayName = \"Autocomplete\";\n"],"names":[],"mappings":";;;;;;;;;;;AA6EA,MAAM,mBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,qBAAuD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,kBAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,OAAgB,WAAoB,gBAAyB;AAC9F,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,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Z,qBAAqB,GAAG;AAAA,oBACxB,eAAe,GAAG;AAAA,oBAClB,UAAU,GAAG;AAAA,oBACb,cAAc,GAAG;AAAA,oBACjB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GAEJ;AAAA,QAEC,cACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI,GAAG;AAAA,YACP,WAAW;AAAA,cACT;AAAA,cACA,QAAQ,uBAAuB;AAAA,YAAA;AAAA,YAGhC,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,CAAC;AAED,aAAa,cAAc;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { SpinnerIcon } from "../Icons/SpinnerIcon.mjs";
|
|
4
|
+
import { AutocompleteOptionItem } from "./AutocompleteOptionItem.mjs";
|
|
5
|
+
function AutocompleteDropdownContent({
|
|
6
|
+
loading,
|
|
7
|
+
loadingText,
|
|
8
|
+
emptyText,
|
|
9
|
+
visibleOptions,
|
|
10
|
+
listboxId,
|
|
11
|
+
activeIndex,
|
|
12
|
+
isMulti,
|
|
13
|
+
selectedMultiValues,
|
|
14
|
+
selectedValue,
|
|
15
|
+
onSelect,
|
|
16
|
+
onMouseEnter,
|
|
17
|
+
renderOption
|
|
18
|
+
}) {
|
|
19
|
+
if (loading) {
|
|
20
|
+
return (
|
|
21
|
+
// biome-ignore lint/a11y/useSemanticElements: <output> is not appropriate here; using role="status" for live region announcements
|
|
22
|
+
/* @__PURE__ */ jsxs("div", { role: "status", className: "flex items-center justify-center py-4", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { className: "size-5 animate-spin text-foreground-secondary" }),
|
|
24
|
+
loadingText && /* @__PURE__ */ jsx("span", { className: "typography-regular-body-md ml-2 text-foreground-secondary", children: loadingText })
|
|
25
|
+
] })
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
if (visibleOptions.length === 0) {
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { className: "typography-regular-body-md block px-3 py-4 text-center text-foreground-secondary", children: emptyText });
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(Fragment, { children: visibleOptions.map((option, index) => {
|
|
32
|
+
const isSelected = isMulti ? selectedMultiValues.includes(option.value) : option.value === selectedValue;
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
AutocompleteOptionItem,
|
|
35
|
+
{
|
|
36
|
+
option,
|
|
37
|
+
optionId: `${listboxId}-option-${index}`,
|
|
38
|
+
index,
|
|
39
|
+
isSelected,
|
|
40
|
+
isActive: index === activeIndex,
|
|
41
|
+
onSelect: () => onSelect(option),
|
|
42
|
+
onMouseEnter: () => onMouseEnter(index),
|
|
43
|
+
renderOption
|
|
44
|
+
},
|
|
45
|
+
option.value
|
|
46
|
+
);
|
|
47
|
+
}) });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
AutocompleteDropdownContent
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=AutocompleteDropdownContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutocompleteDropdownContent.mjs","sources":["../../../src/components/Autocomplete/AutocompleteDropdownContent.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\nimport type { AutocompleteOption } from \"./Autocomplete\";\nimport { AutocompleteOptionItem } from \"./AutocompleteOptionItem\";\n\nexport function AutocompleteDropdownContent({\n loading,\n loadingText,\n emptyText,\n visibleOptions,\n listboxId,\n activeIndex,\n isMulti,\n selectedMultiValues,\n selectedValue,\n onSelect,\n onMouseEnter,\n renderOption,\n}: {\n loading: boolean;\n loadingText?: string;\n emptyText?: string;\n visibleOptions: AutocompleteOption[];\n listboxId: string;\n activeIndex: number;\n isMulti: boolean;\n selectedMultiValues: string[];\n selectedValue: string | null;\n onSelect: (option: AutocompleteOption) => void;\n onMouseEnter: (index: number) => void;\n renderOption?: (\n option: AutocompleteOption,\n state: { selected: boolean; active: boolean },\n ) => React.ReactNode;\n}) {\n if (loading) {\n return (\n // biome-ignore lint/a11y/useSemanticElements: <output> is not appropriate here; using role=\"status\" for live region announcements\n <div role=\"status\" className=\"flex items-center justify-center py-4\">\n <SpinnerIcon className=\"size-5 animate-spin text-foreground-secondary\" />\n {loadingText && (\n <span className=\"typography-regular-body-md ml-2 text-foreground-secondary\">\n {loadingText}\n </span>\n )}\n </div>\n );\n }\n\n if (visibleOptions.length === 0) {\n return (\n <div className=\"typography-regular-body-md block px-3 py-4 text-center text-foreground-secondary\">\n {emptyText}\n </div>\n );\n }\n\n return (\n <>\n {visibleOptions.map((option, index) => {\n const isSelected = isMulti\n ? selectedMultiValues.includes(option.value)\n : option.value === selectedValue;\n\n return (\n <AutocompleteOptionItem\n key={option.value}\n option={option}\n optionId={`${listboxId}-option-${index}`}\n index={index}\n isSelected={isSelected}\n isActive={index === activeIndex}\n onSelect={() => onSelect(option)}\n onMouseEnter={() => onMouseEnter(index)}\n renderOption={renderOption}\n />\n );\n })}\n </>\n );\n}\n"],"names":[],"mappings":";;;;AAKO,SAAS,4BAA4B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAgBG;AACD,MAAI,SAAS;AACX;AAAA;AAAA,MAEE,qBAAC,OAAA,EAAI,MAAK,UAAS,WAAU,yCAC3B,UAAA;AAAA,QAAA,oBAAC,aAAA,EAAY,WAAU,gDAAA,CAAgD;AAAA,QACtE,eACC,oBAAC,QAAA,EAAK,WAAU,6DACb,UAAA,YAAA,CACH;AAAA,MAAA,EAAA,CAEJ;AAAA;AAAA,EAEJ;AAEA,MAAI,eAAe,WAAW,GAAG;AAC/B,WACE,oBAAC,OAAA,EAAI,WAAU,oFACZ,UAAA,WACH;AAAA,EAEJ;AAEA,SACE,oBAAA,UAAA,EACG,UAAA,eAAe,IAAI,CAAC,QAAQ,UAAU;AACrC,UAAM,aAAa,UACf,oBAAoB,SAAS,OAAO,KAAK,IACzC,OAAO,UAAU;AAErB,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC;AAAA,QACA,UAAU,GAAG,SAAS,WAAW,KAAK;AAAA,QACtC;AAAA,QACA;AAAA,QACA,UAAU,UAAU;AAAA,QACpB,UAAU,MAAM,SAAS,MAAM;AAAA,QAC/B,cAAc,MAAM,aAAa,KAAK;AAAA,QACtC;AAAA,MAAA;AAAA,MARK,OAAO;AAAA,IAAA;AAAA,EAWlB,CAAC,EAAA,CACH;AAEJ;"}
|