@langchain/macaw-components 1.1.1 → 1.2.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/catalog.json +491 -491
- package/dist/components/ChartCard/ChartCardSkeleton.d.ts +1 -1
- package/dist/components/ChartCard/ChartCardSkeleton.js +14 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -1
- package/dist/components/Input/inputStyles.js +2 -2
- package/dist/components/Input/inputStyles.js.map +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectPrimitive.js +3 -3
- package/dist/components/Select/SelectPrimitive.js.map +1 -1
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Typeahead/TypeaheadView.js +1 -1
- package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
- package/dist/utilities.css +1 -1
- package/dist/utils/cn.js +3 -0
- package/dist/utils/cn.js.map +1 -1
- package/docs/DESIGN.md +1 -0
- package/docs/STYLES.md +15 -7
- package/package.json +2 -2
- package/tailwind.preset.cjs +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export type ChartCardSkeletonVariant = 'bar' | 'line' | 'donut' | 'metric' | 'sparkline' | 'sankey';
|
|
2
|
+
export type ChartCardSkeletonVariant = 'bar' | 'horizontal-bar' | 'line' | 'donut' | 'metric' | 'sparkline' | 'sankey';
|
|
3
3
|
export declare const ChartCardSkeleton: ({ variant, className, style, }: {
|
|
4
4
|
variant: ChartCardSkeletonVariant;
|
|
5
5
|
className?: string;
|
|
@@ -2,6 +2,13 @@ import { cn } from "../../utils/cn.js";
|
|
|
2
2
|
import { Skeleton } from "../Skeleton/Skeleton.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region packages/components/src/components/ChartCard/ChartCardSkeleton.tsx
|
|
5
|
+
var HORIZONTAL_BAR_WIDTHS = [
|
|
6
|
+
"35%",
|
|
7
|
+
"62%",
|
|
8
|
+
"48%",
|
|
9
|
+
"78%",
|
|
10
|
+
"55%"
|
|
11
|
+
];
|
|
5
12
|
var BAR_HEIGHTS = [
|
|
6
13
|
"35%",
|
|
7
14
|
"62%",
|
|
@@ -40,6 +47,13 @@ var ChartCardSkeleton = ({ variant, className, style }) => /* @__PURE__ */ jsxs(
|
|
|
40
47
|
style: { height }
|
|
41
48
|
}, index))
|
|
42
49
|
}) }),
|
|
50
|
+
variant === "horizontal-bar" && /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "flex size-full flex-col gap-space-2 py-space-2",
|
|
52
|
+
children: HORIZONTAL_BAR_WIDTHS.map((width, index) => /* @__PURE__ */ jsx(Skeleton, {
|
|
53
|
+
className: "min-h-0 flex-1 rounded-l-none rounded-r-md motion-reduce:animate-none",
|
|
54
|
+
style: { width }
|
|
55
|
+
}, index))
|
|
56
|
+
}) }),
|
|
43
57
|
(variant === "line" || variant === "sparkline") && /* @__PURE__ */ jsx(Plot, { children: /* @__PURE__ */ jsx(Skeleton, {
|
|
44
58
|
className: "size-full rounded-none motion-reduce:animate-none",
|
|
45
59
|
style: { clipPath: "polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartCardSkeleton.js","names":[],"sources":["../../../src/components/ChartCard/ChartCardSkeleton.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Skeleton } from '../Skeleton';\n\nexport type ChartCardSkeletonVariant =\n | 'bar'\n | 'line'\n | 'donut'\n | 'metric'\n | 'sparkline'\n | 'sankey';\n\nconst BAR_HEIGHTS = ['35%', '62%', '48%', '78%', '55%', '70%', '42%'] as const;\n\nconst LegendSkeleton = () => (\n <div aria-hidden=\"true\" className=\"flex min-w-0 items-center gap-space-2\">\n <Skeleton className=\"h-4 w-20 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-24 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-16 motion-reduce:animate-none\" />\n </div>\n);\n\nconst Plot = ({ children }: { children: React.ReactNode }) => (\n <div className=\"relative min-h-0 flex-1 border-b border-l border-muted\">\n {/* Anchor percentage-sized marks to the plot even in auto-height cards. */}\n <div className=\"absolute inset-0 flex px-space-2\">{children}</div>\n </div>\n);\n\nexport const ChartCardSkeleton = ({\n variant,\n className,\n style,\n}: {\n variant: ChartCardSkeletonVariant;\n className?: string;\n style?: CSSProperties;\n}) => (\n <div\n role=\"status\"\n aria-label=\"Loading chart\"\n style={style}\n className={cn(\n 'flex min-h-[13.5rem] flex-1 flex-col gap-space-2',\n variant === 'metric' && 'min-h-0',\n className\n )}\n >\n {variant === 'bar' && (\n <Plot>\n <div className=\"flex size-full items-end gap-space-2\">\n {BAR_HEIGHTS.map((height, index) => (\n <Skeleton\n key={index}\n className=\"min-w-0 flex-1 rounded-b-none rounded-t-md motion-reduce:animate-none\"\n style={{ height }}\n />\n ))}\n </div>\n </Plot>\n )}\n {(variant === 'line' || variant === 'sparkline') && (\n <Plot>\n <Skeleton\n className=\"size-full rounded-none motion-reduce:animate-none\"\n style={{\n clipPath:\n 'polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)',\n }}\n />\n </Plot>\n )}\n {variant === 'donut' && (\n <div className=\"flex min-h-0 flex-1 items-center justify-center\">\n <div className=\"size-32 animate-pulse rounded-full border-[1.5rem] border-muted motion-reduce:animate-none\" />\n </div>\n )}\n {variant === 'sankey' && (\n <div aria-hidden=\"true\" className=\"relative min-h-0 flex-1\">\n <svg\n viewBox=\"0 0 400 192\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n fill=\"var(--bg-surface-level-3)\"\n className=\"absolute inset-0 size-full animate-pulse motion-reduce:animate-none\"\n >\n <g opacity={0.5}>\n {[0, 184].map((offset) => (\n <g key={offset} transform={`translate(${offset} 0)`}>\n <path d=\"M20 12H196V60H20Z\" />\n <path d=\"M20 60C108 60 108 108 196 108V132C108 132 108 84 20 84Z\" />\n <path d=\"M20 108C108 108 108 60 196 60V84C108 84 108 132 20 132Z\" />\n <path d=\"M20 132H196V180H20Z\" />\n </g>\n ))}\n </g>\n {[12, 196, 380].map((x) => (\n <g key={x}>\n <rect x={x} y={12} width={8} height={72} />\n <rect x={x} y={108} width={8} height={72} />\n </g>\n ))}\n </svg>\n </div>\n )}\n {variant === 'metric' && (\n <div className=\"flex min-h-0 flex-1 flex-col justify-center gap-space-2\">\n <Skeleton className=\"h-9 w-1/2 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-2/3 motion-reduce:animate-none\" />\n </div>\n )}\n {variant !== 'metric' && <LegendSkeleton />}\n </div>\n);\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ChartCardSkeleton.js","names":[],"sources":["../../../src/components/ChartCard/ChartCardSkeleton.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Skeleton } from '../Skeleton';\n\nexport type ChartCardSkeletonVariant =\n | 'bar'\n | 'horizontal-bar'\n | 'line'\n | 'donut'\n | 'metric'\n | 'sparkline'\n | 'sankey';\n\nconst HORIZONTAL_BAR_WIDTHS = ['35%', '62%', '48%', '78%', '55%'] as const;\n\nconst BAR_HEIGHTS = ['35%', '62%', '48%', '78%', '55%', '70%', '42%'] as const;\n\nconst LegendSkeleton = () => (\n <div aria-hidden=\"true\" className=\"flex min-w-0 items-center gap-space-2\">\n <Skeleton className=\"h-4 w-20 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-24 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-16 motion-reduce:animate-none\" />\n </div>\n);\n\nconst Plot = ({ children }: { children: React.ReactNode }) => (\n <div className=\"relative min-h-0 flex-1 border-b border-l border-muted\">\n {/* Anchor percentage-sized marks to the plot even in auto-height cards. */}\n <div className=\"absolute inset-0 flex px-space-2\">{children}</div>\n </div>\n);\n\nexport const ChartCardSkeleton = ({\n variant,\n className,\n style,\n}: {\n variant: ChartCardSkeletonVariant;\n className?: string;\n style?: CSSProperties;\n}) => (\n <div\n role=\"status\"\n aria-label=\"Loading chart\"\n style={style}\n className={cn(\n 'flex min-h-[13.5rem] flex-1 flex-col gap-space-2',\n variant === 'metric' && 'min-h-0',\n className\n )}\n >\n {variant === 'bar' && (\n <Plot>\n <div className=\"flex size-full items-end gap-space-2\">\n {BAR_HEIGHTS.map((height, index) => (\n <Skeleton\n key={index}\n className=\"min-w-0 flex-1 rounded-b-none rounded-t-md motion-reduce:animate-none\"\n style={{ height }}\n />\n ))}\n </div>\n </Plot>\n )}\n {variant === 'horizontal-bar' && (\n <Plot>\n <div className=\"flex size-full flex-col gap-space-2 py-space-2\">\n {HORIZONTAL_BAR_WIDTHS.map((width, index) => (\n <Skeleton\n key={index}\n className=\"min-h-0 flex-1 rounded-l-none rounded-r-md motion-reduce:animate-none\"\n style={{ width }}\n />\n ))}\n </div>\n </Plot>\n )}\n {(variant === 'line' || variant === 'sparkline') && (\n <Plot>\n <Skeleton\n className=\"size-full rounded-none motion-reduce:animate-none\"\n style={{\n clipPath:\n 'polygon(0 63%, 20% 43%, 38% 56%, 60% 26%, 78% 40%, 100% 13%, 100% 17%, 78% 44%, 60% 30%, 38% 60%, 20% 47%, 0 67%)',\n }}\n />\n </Plot>\n )}\n {variant === 'donut' && (\n <div className=\"flex min-h-0 flex-1 items-center justify-center\">\n <div className=\"size-32 animate-pulse rounded-full border-[1.5rem] border-muted motion-reduce:animate-none\" />\n </div>\n )}\n {variant === 'sankey' && (\n <div aria-hidden=\"true\" className=\"relative min-h-0 flex-1\">\n <svg\n viewBox=\"0 0 400 192\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n fill=\"var(--bg-surface-level-3)\"\n className=\"absolute inset-0 size-full animate-pulse motion-reduce:animate-none\"\n >\n <g opacity={0.5}>\n {[0, 184].map((offset) => (\n <g key={offset} transform={`translate(${offset} 0)`}>\n <path d=\"M20 12H196V60H20Z\" />\n <path d=\"M20 60C108 60 108 108 196 108V132C108 132 108 84 20 84Z\" />\n <path d=\"M20 108C108 108 108 60 196 60V84C108 84 108 132 20 132Z\" />\n <path d=\"M20 132H196V180H20Z\" />\n </g>\n ))}\n </g>\n {[12, 196, 380].map((x) => (\n <g key={x}>\n <rect x={x} y={12} width={8} height={72} />\n <rect x={x} y={108} width={8} height={72} />\n </g>\n ))}\n </svg>\n </div>\n )}\n {variant === 'metric' && (\n <div className=\"flex min-h-0 flex-1 flex-col justify-center gap-space-2\">\n <Skeleton className=\"h-9 w-1/2 motion-reduce:animate-none\" />\n <Skeleton className=\"h-4 w-2/3 motion-reduce:animate-none\" />\n </div>\n )}\n {variant !== 'metric' && <LegendSkeleton />}\n </div>\n);\n"],"mappings":";;;;AAcA,IAAM,wBAAwB;CAAC;CAAO;CAAO;CAAO;CAAO;AAAK;AAEhE,IAAM,cAAc;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;CAAO;AAAK;AAEpE,IAAM,uBACJ,qBAAC,OAAD;CAAK,eAAY;CAAO,WAAU;CAAlC,UAAA;EACE,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;EAC3D,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;EAC3D,oBAAC,UAAD,EAAU,WAAU,sCAAuC,CAAA;CACxD;;AAGP,IAAM,QAAQ,EAAE,eACd,oBAAC,OAAD;CAAK,WAAU;CAEb,UAAA,oBAAC,OAAD;EAAK,WAAU;EAAoC;CAAc,CAAA;AAC9D,CAAA;AAGP,IAAa,qBAAqB,EAChC,SACA,WACA,YAMA,qBAAC,OAAD;CACE,MAAK;CACL,cAAW;CACJ;C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,KAAK,MACnB,qBAAC,KAAD,EAAA,UAAA,CACE,oBAAC,QAAD;KAAS;KAAG,GAAG;KAAI,OAAO;KAAG,QAAQ;IAAK,CAAA,GAC1C,oBAAC,QAAD;KAAS;KAAG,GAAG;KAAK,OAAO;KAAG,QAAQ;IAAK,CAAA,CAC1C,EAAA,GAHK,CAGL,CACJ,CACE;;EACF,CAAA;EAEN,YAAY,YACX,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,UAAD,EAAU,WAAU,uCAAwC,CAAA,GAC5D,oBAAC,UAAD,EAAU,WAAU,uCAAwC,CAAA,CACzD;;EAEN,YAAY,YAAY,oBAAC,gBAAD,CAAiB,CAAA;CACvC"}
|
|
@@ -26,9 +26,9 @@ var INPUT_TEXT_CLASSES = {
|
|
|
26
26
|
function getInputContainerClasses({ size, variant, isError = false, disabled = false, className }) {
|
|
27
27
|
const outlined = variant === "outlined";
|
|
28
28
|
return cn("box-border flex w-full items-center gap-space-2 transition-[border-color,box-shadow,background-color]", CONTROL_SIZES[size].heightClassName, INPUT_HORIZONTAL_PADDING_CLASSES[size], INPUT_RADIUS_CLASSES[size], "focus-within:outline-hidden", {
|
|
29
|
-
"border border-
|
|
29
|
+
"border border-input bg-input": variant === "outlined",
|
|
30
30
|
"border border-transparent bg-input": variant === "plain"
|
|
31
|
-
}, outlined && !disabled && !isError && "[&:hover:not(:focus-within)]:border-
|
|
31
|
+
}, outlined && !disabled && !isError && "[&:hover:not(:focus-within)]:border-input-hover", !disabled && !isError && (outlined ? "focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]" : "focus-within:border-focus"), !disabled && isError && (outlined ? "border-error-strong focus-within:border-error-strong focus-within:shadow-[0_0_0_1px_var(--border-error-strong)]" : "border-error-strong focus-within:border-error-strong"), disabled && "cursor-not-allowed border-muted bg-input-disabled text-disabled", className);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Shared styling for the inner input element (unstyled, fills container).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputStyles.js","names":[],"sources":["../../../src/components/Input/inputStyles.ts"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type ControlSize } from '../../utils/componentSizes';\n\nexport type InputSize = ControlSize;\nexport type InputVariant = 'outlined' | 'plain';\n\nexport const INPUT_HORIZONTAL_PADDING_CLASSES: Record<InputSize, string> = {\n xs: 'px-space-1',\n sm: 'px-space-2',\n md: 'px-space-3',\n lg: 'px-space-3',\n};\n\nexport const INPUT_RADIUS_CLASSES: Record<InputSize, string> = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n};\n\nexport const INPUT_TEXT_CLASSES: Record<InputSize, string> = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n};\n\n/**\n * Shared styling for input containers (border, padding, rounding, variant).\n * Used by both the design system Input and CommandInput.\n */\nexport function getInputContainerClasses({\n size,\n variant,\n isError = false,\n disabled = false,\n className,\n}: {\n size: InputSize;\n variant: InputVariant;\n isError?: boolean;\n disabled?: boolean;\n className?: string;\n}) {\n const outlined = variant === 'outlined';\n return cn(\n 'box-border flex w-full items-center gap-space-2 transition-[border-color,box-shadow,background-color]',\n CONTROL_SIZES[size].heightClassName,\n INPUT_HORIZONTAL_PADDING_CLASSES[size],\n INPUT_RADIUS_CLASSES[size],\n 'focus-within:outline-hidden',\n {\n 'border border-
|
|
1
|
+
{"version":3,"file":"inputStyles.js","names":[],"sources":["../../../src/components/Input/inputStyles.ts"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type ControlSize } from '../../utils/componentSizes';\n\nexport type InputSize = ControlSize;\nexport type InputVariant = 'outlined' | 'plain';\n\nexport const INPUT_HORIZONTAL_PADDING_CLASSES: Record<InputSize, string> = {\n xs: 'px-space-1',\n sm: 'px-space-2',\n md: 'px-space-3',\n lg: 'px-space-3',\n};\n\nexport const INPUT_RADIUS_CLASSES: Record<InputSize, string> = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n};\n\nexport const INPUT_TEXT_CLASSES: Record<InputSize, string> = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n};\n\n/**\n * Shared styling for input containers (border, padding, rounding, variant).\n * Used by both the design system Input and CommandInput.\n */\nexport function getInputContainerClasses({\n size,\n variant,\n isError = false,\n disabled = false,\n className,\n}: {\n size: InputSize;\n variant: InputVariant;\n isError?: boolean;\n disabled?: boolean;\n className?: string;\n}) {\n const outlined = variant === 'outlined';\n return cn(\n 'box-border flex w-full items-center gap-space-2 transition-[border-color,box-shadow,background-color]',\n CONTROL_SIZES[size].heightClassName,\n INPUT_HORIZONTAL_PADDING_CLASSES[size],\n INPUT_RADIUS_CLASSES[size],\n 'focus-within:outline-hidden',\n {\n 'border border-input bg-input': variant === 'outlined',\n 'border border-transparent bg-input': variant === 'plain',\n },\n outlined &&\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-input-hover',\n !disabled &&\n !isError &&\n (outlined\n ? 'focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]'\n : 'focus-within:border-focus'),\n !disabled &&\n isError &&\n (outlined\n ? 'border-error-strong focus-within:border-error-strong focus-within:shadow-[0_0_0_1px_var(--border-error-strong)]'\n : 'border-error-strong focus-within:border-error-strong'),\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n className\n );\n}\n\n/**\n * Shared styling for the inner input element (unstyled, fills container).\n * Used by both the design system Input and CommandInput.\n */\nexport function getInputElementClasses({\n size,\n disabled = false,\n className,\n}: {\n size: InputSize;\n disabled?: boolean;\n className?: string;\n}) {\n return cn(\n 'min-w-0 max-w-full flex-1 border-none bg-transparent p-0 outline-hidden',\n INPUT_TEXT_CLASSES[size],\n 'placeholder:text-placeholder',\n disabled && 'cursor-not-allowed text-disabled placeholder:text-disabled',\n className\n );\n}\n\n/** Shared styling for decorator wrappers. */\nexport const DECORATOR_CLASSES = 'flex items-center text-tertiary';\n"],"mappings":";;;AAMA,IAAa,mCAA8D;CACzE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,uBAAkD;CAC7D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,qBAAgD;CAC3D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;;AAMA,SAAgB,yBAAyB,EACvC,MACA,SACA,UAAU,OACV,WAAW,OACX,aAOC;CACD,MAAM,WAAW,YAAY;CAC7B,OAAO,GACL,yGACA,cAAc,KAAK,CAAC,iBACpB,iCAAiC,OACjC,qBAAqB,OACrB,+BACA;EACE,gCAAgC,YAAY;EAC5C,sCAAsC,YAAY;CACpD,GACA,YACE,CAAC,YACD,CAAC,WACD,mDACF,CAAC,YACC,CAAC,YACA,WACG,kFACA,8BACN,CAAC,YACC,YACC,WACG,oHACA,yDACN,YACE,mEACF,SACF;AACF;;;;;AAMA,SAAgB,uBAAuB,EACrC,MACA,WAAW,OACX,aAKC;CACD,OAAO,GACL,2EACA,mBAAmB,OACnB,gCACA,YAAY,8DACZ,SACF;AACF;;AAGA,IAAa,oBAAoB"}
|
|
@@ -88,7 +88,7 @@ function OptionSelect({ value, onChange, options, groups, placeholder = "Select.
|
|
|
88
88
|
variant,
|
|
89
89
|
color: "secondary",
|
|
90
90
|
size: triggerButtonSize,
|
|
91
|
-
className: cn("box-border justify-between py-0", CONTROL_SIZES[size].heightClassName, variant === "plain" ? cn("w-auto max-w-full gap-space-1 px-space-1", disabled && "bg-disabled text-disabled dark:bg-disabled") : cn("w-full", disabled ? "border-muted bg-input-disabled text-disabled dark:bg-input-disabled" : "bg-input border-
|
|
91
|
+
className: cn("box-border justify-between py-0", CONTROL_SIZES[size].heightClassName, variant === "plain" ? cn("w-auto max-w-full gap-space-1 px-space-1", disabled && "bg-disabled text-disabled dark:bg-disabled") : cn("w-full", disabled ? "border-muted bg-input-disabled text-disabled dark:bg-input-disabled" : "bg-input border-input hover:bg-input-hover hover:border-input-hover focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none"), triggerClassName),
|
|
92
92
|
disabled,
|
|
93
93
|
"data-testid": dataTestId,
|
|
94
94
|
children: [triggerContent, /* @__PURE__ */ jsx(Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n CONTROL_SIZES,\n type ControlSize,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport {\n type DataAttributes,\n pickDataAttributes,\n} from '../../utils/dataAttributes';\nimport { Button } from '../Button';\nimport { CommandMenu } from '../Command/CommandMenu';\nimport type { CommandMenuGroup, CommandMenuItem } from '../Command/CommandMenu';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverContent, PopoverTrigger } from '../Popover';\nimport { Text } from '../Text';\n\nexport interface SelectOption<T extends string = string> {\n /** The value used for selection and filtering */\n value: T;\n /** Display label (defaults to value if not provided) */\n label?: string;\n /** Secondary description text displayed below the label */\n description?: string;\n /** Element displayed on the right side of the item (e.g. badge, shortcut) */\n rightDecorator?: ReactNode;\n /** Whether this option is disabled */\n disabled?: boolean;\n}\n\nexport interface SelectGroup<T extends string = string> {\n heading?: string;\n options: SelectOption<T>[];\n}\n\nexport type SelectSize = ControlSize;\n\nexport type SelectVariant = 'outlined' | 'plain';\n\ninterface SelectBaseProps<T extends string = string> extends DataAttributes {\n /** The currently selected value */\n value?: T;\n /** Callback when selection changes. Receives undefined when deselected. */\n onChange: (value: T | undefined) => void;\n /** Placeholder text when no value is selected */\n placeholder?: string;\n /** Placeholder text for the search input */\n searchPlaceholder?: string;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Exact trigger height: xs=20px, sm=24px, md=32px, lg=40px. */\n size?: SelectSize;\n /** Text to show when no options match the search */\n emptyText?: string;\n /** Allow deselecting the current value by clicking it again (default: false) */\n allowDeselect?: boolean;\n /** Hide the search input (default: true, search is hidden) */\n hideSearch?: boolean;\n /** Disable client-side filtering by cmdk (default: false). Set true for server-side filtering. */\n disableFilter?: boolean;\n /** Callback when the search input value changes. Useful for server-side filtering. */\n onSearchChange?: (query: string) => void;\n /** Whether more items are currently being loaded */\n loading?: boolean;\n /** Number of skeleton rows to show while loading (default: 5) */\n loadingRows?: number;\n /** Callback when the user scrolls near the end of the list. Use for infinite loading. */\n onEndReached?: () => void;\n /** Distance in pixels from the bottom to trigger onEndReached (default: 50) */\n endReachedThresholdPx?: number;\n /** Additional class name for the trigger button */\n triggerClassName?: string;\n /**\n * Trigger appearance. `outlined` (default) is a full-width form field.\n * `plain` drops the field fill and border and sizes the trigger to its\n * value, so it reads as text until hovered — for an inline setting in a row,\n * such as a member's role, where a field box would crowd it.\n */\n variant?: SelectVariant;\n /** Additional class name for the popover content */\n contentClassName?: string;\n /** Custom render function for the selected value in the trigger */\n renderValue?: (option: SelectOption<T>) => ReactNode;\n /** Custom render function for each option in the list */\n renderOption?: (option: SelectOption<T>, isSelected: boolean) => ReactNode;\n /** Side of the trigger to align the popover */\n side?: 'top' | 'bottom' | 'left' | 'right';\n /** Alignment of the popover relative to the trigger */\n align?: 'start' | 'center' | 'end';\n /** aria-label for the trigger button */\n 'aria-label'?: string;\n /** Test id for the trigger button */\n 'data-testid'?: string;\n}\n\nexport type SelectProps<T extends string = string> = SelectBaseProps<T> &\n (\n | {\n options: SelectOption<T>[];\n groups?: never;\n }\n | {\n groups: SelectGroup<T>[];\n options?: never;\n }\n ) &\n (\n | {\n /** Controlled open state */\n open: boolean;\n /** Callback when open state changes (required when `open` is provided) */\n onOpenChange: (open: boolean) => void;\n }\n | {\n open?: never;\n onOpenChange?: never;\n }\n );\n\nfunction optionToItem(opt: SelectOption): CommandMenuItem {\n return {\n value: opt.value,\n label: opt.label,\n description: opt.description,\n rightDecorator: opt.rightDecorator,\n disabled: opt.disabled,\n keywords: opt.label ? [opt.label] : undefined,\n };\n}\n\nfunction OptionSelect<T extends string = string>({\n value,\n onChange,\n options,\n groups,\n placeholder = 'Select...',\n searchPlaceholder = 'Search...',\n disabled = false,\n size = 'sm',\n emptyText = 'No results found.',\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n allowDeselect,\n hideSearch = true,\n disableFilter,\n onSearchChange,\n loading,\n loadingRows,\n onEndReached,\n endReachedThresholdPx,\n triggerClassName,\n variant = 'outlined',\n contentClassName,\n renderValue,\n renderOption,\n side,\n align = 'start',\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n ...rest\n}: SelectProps<T>) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n const setOpen = isControlled ? controlledOnOpenChange : setUncontrolledOpen;\n\n const allOptions = useMemo<SelectOption<T>[]>(\n () => (groups ? groups.flatMap((g) => g.options) : (options ?? [])),\n [groups, options]\n );\n\n const selectedOption = useMemo(\n () => allOptions.find((opt) => opt.value === value),\n [allOptions, value]\n );\n\n const handleSelect = useCallback(\n (optionValue: string) => {\n const match = allOptions.find((o) => o.value === optionValue);\n if (!match) return;\n if (allowDeselect && match.value === value) {\n onChange(undefined);\n } else {\n onChange(match.value);\n }\n setOpen(false);\n },\n [allowDeselect, value, onChange, setOpen, allOptions]\n );\n\n const items: CommandMenuItem[] = useMemo(\n () => (options ?? []).map(optionToItem),\n [options]\n );\n\n const commandGroups: CommandMenuGroup[] | undefined = useMemo(\n () =>\n groups?.map((g) => ({\n heading: g.heading,\n items: g.options.map(optionToItem),\n })),\n [groups]\n );\n\n const renderItem = renderOption\n ? (item: CommandMenuItem, isSelected: boolean) => {\n const option = allOptions.find((o) => o.value === item.value);\n return option ? renderOption(option, isSelected) : null;\n }\n : undefined;\n const searchInputSize = size === 'xs' ? 'sm' : size === 'lg' ? 'md' : size;\n const triggerButtonSize = size === 'lg' ? 'md' : size;\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n\n const commandMenuSharedProps = {\n value,\n onSelect: handleSelect,\n placeholder: searchPlaceholder,\n emptyText,\n hideSearch,\n disableFilter,\n onSearchChange,\n loading,\n loadingRows,\n onEndReached,\n endReachedThresholdPx,\n renderItem,\n inputSize: searchInputSize,\n itemRowSize,\n };\n\n const triggerContent =\n selectedOption && renderValue ? (\n renderValue(selectedOption)\n ) : (\n <Text\n as=\"span\"\n variant={triggerButtonSize}\n weight=\"normal\"\n className=\"min-w-0 truncate text-left\"\n >\n {selectedOption\n ? (selectedOption.label ?? selectedOption.value)\n : placeholder}\n </Text>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n {...pickDataAttributes(rest)}\n role=\"combobox\"\n aria-expanded={open}\n aria-label={ariaLabel ?? placeholder}\n variant={variant}\n color=\"secondary\"\n size={triggerButtonSize}\n className={cn(\n 'box-border justify-between py-0',\n CONTROL_SIZES[size].heightClassName,\n variant === 'plain'\n ? cn(\n 'w-auto max-w-full gap-space-1 px-space-1',\n // The shared disabled fill, in both themes.\n disabled && 'bg-disabled text-disabled dark:bg-disabled'\n )\n : cn(\n 'w-full',\n disabled\n ? 'border-muted bg-input-disabled text-disabled dark:bg-input-disabled'\n : 'bg-input border-muted hover:border-subtle focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none'\n ),\n triggerClassName\n )}\n disabled={disabled}\n data-testid={dataTestId}\n >\n {triggerContent}\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={disabled ? 'text-icon-disabled' : 'text-inherit'}\n weight=\"regular\"\n />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n 'w-max min-w-[var(--radix-popover-trigger-width)] max-w-[min(24rem,calc(100vw-1rem))] p-0 text-primary',\n contentClassName\n )}\n side={side}\n align={align}\n >\n {commandGroups ? (\n <CommandMenu groups={commandGroups} {...commandMenuSharedProps} />\n ) : (\n <CommandMenu items={items} {...commandMenuSharedProps} />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\nexport function Select<T extends string = string>(\n props: SelectProps<T>\n): React.ReactElement<unknown> {\n return <OptionSelect {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;;AA4HA,SAAS,aAAa,KAAoC;CACxD,OAAO;EACL,OAAO,IAAI;EACX,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,gBAAgB,IAAI;EACpB,UAAU,IAAI;EACd,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,KAAA;CACtC;AACF;AAEA,SAAS,aAAwC,EAC/C,OACA,UACA,SACA,QACA,cAAc,aACd,oBAAoB,aACpB,WAAW,OACX,OAAO,MACP,YAAY,qBACZ,MAAM,gBACN,cAAc,wBACd,eACA,aAAa,MACb,eACA,gBACA,SACA,aACA,cACA,uBACA,kBACA,UAAU,YACV,kBACA,aACA,cACA,MACA,QAAQ,SACR,cAAc,WACd,eAAe,YACf,GAAG,QACc;CACjB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,KAAK;CAC9D,MAAM,eAAe,mBAAmB,KAAA;CACxC,MAAM,OAAO,eAAe,iBAAiB;CAC7C,MAAM,UAAU,eAAe,yBAAyB;CAExD,MAAM,aAAa,cACV,SAAS,OAAO,SAAS,MAAM,EAAE,OAAO,IAAK,WAAW,CAAC,GAChE,CAAC,QAAQ,OAAO,CAClB;CAEA,MAAM,iBAAiB,cACf,WAAW,MAAM,QAAQ,IAAI,UAAU,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IAC3B,MAAK;IACL,iBAAe;IACf,cAAY,aAAa;IAChB;IACT,OAAM;IACN,MAAM;IACN,WAAW,GACT,mCACA,cAAc,KAAK,CAAC,iBACpB,YAAY,UACR,GACE,4CAEA,YAAY,4CACd,IACA,GACE,UACA,WACI,wEACA,sJACN,GACJ,gBACF;IACU;IACV,eAAa;IA1Bf,UAAA,CA4BG,gBACD,oBAAC,MAAD;KACE,eAAA;KACA,MAAM;KACN,eAAe,mBAAmB,KAAK,CAAC;KACxC,WAAW,WAAW,uBAAuB;KAC7C,QAAO;IACR,CAAA,CACK;;EACM,CAAA,GAChB,oBAAC,gBAAD;GACE,WAAW,GACT,yGACA,gBACF;GACM;GACC;GAEN,UAAA,gBACC,oBAAC,aAAD;IAAa,QAAQ;IAAe,GAAI;GAAyB,CAAA,IAEjE,oBAAC,aAAD;IAAoB;IAAO,GAAI;GAAyB,CAAA;EAE5C,CAAA,CACT;;AAEb;AAEA,SAAgB,OACd,OAC6B;CAC7B,OAAO,oBAAC,cAAD,EAAc,GAAI,MAAQ,CAAA;AACnC"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":[],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n CONTROL_SIZES,\n type ControlSize,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport {\n type DataAttributes,\n pickDataAttributes,\n} from '../../utils/dataAttributes';\nimport { Button } from '../Button';\nimport { CommandMenu } from '../Command/CommandMenu';\nimport type { CommandMenuGroup, CommandMenuItem } from '../Command/CommandMenu';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverContent, PopoverTrigger } from '../Popover';\nimport { Text } from '../Text';\n\nexport interface SelectOption<T extends string = string> {\n /** The value used for selection and filtering */\n value: T;\n /** Display label (defaults to value if not provided) */\n label?: string;\n /** Secondary description text displayed below the label */\n description?: string;\n /** Element displayed on the right side of the item (e.g. badge, shortcut) */\n rightDecorator?: ReactNode;\n /** Whether this option is disabled */\n disabled?: boolean;\n}\n\nexport interface SelectGroup<T extends string = string> {\n heading?: string;\n options: SelectOption<T>[];\n}\n\nexport type SelectSize = ControlSize;\n\nexport type SelectVariant = 'outlined' | 'plain';\n\ninterface SelectBaseProps<T extends string = string> extends DataAttributes {\n /** The currently selected value */\n value?: T;\n /** Callback when selection changes. Receives undefined when deselected. */\n onChange: (value: T | undefined) => void;\n /** Placeholder text when no value is selected */\n placeholder?: string;\n /** Placeholder text for the search input */\n searchPlaceholder?: string;\n /** Whether the select is disabled */\n disabled?: boolean;\n /** Exact trigger height: xs=20px, sm=24px, md=32px, lg=40px. */\n size?: SelectSize;\n /** Text to show when no options match the search */\n emptyText?: string;\n /** Allow deselecting the current value by clicking it again (default: false) */\n allowDeselect?: boolean;\n /** Hide the search input (default: true, search is hidden) */\n hideSearch?: boolean;\n /** Disable client-side filtering by cmdk (default: false). Set true for server-side filtering. */\n disableFilter?: boolean;\n /** Callback when the search input value changes. Useful for server-side filtering. */\n onSearchChange?: (query: string) => void;\n /** Whether more items are currently being loaded */\n loading?: boolean;\n /** Number of skeleton rows to show while loading (default: 5) */\n loadingRows?: number;\n /** Callback when the user scrolls near the end of the list. Use for infinite loading. */\n onEndReached?: () => void;\n /** Distance in pixels from the bottom to trigger onEndReached (default: 50) */\n endReachedThresholdPx?: number;\n /** Additional class name for the trigger button */\n triggerClassName?: string;\n /**\n * Trigger appearance. `outlined` (default) is a full-width form field.\n * `plain` drops the field fill and border and sizes the trigger to its\n * value, so it reads as text until hovered — for an inline setting in a row,\n * such as a member's role, where a field box would crowd it.\n */\n variant?: SelectVariant;\n /** Additional class name for the popover content */\n contentClassName?: string;\n /** Custom render function for the selected value in the trigger */\n renderValue?: (option: SelectOption<T>) => ReactNode;\n /** Custom render function for each option in the list */\n renderOption?: (option: SelectOption<T>, isSelected: boolean) => ReactNode;\n /** Side of the trigger to align the popover */\n side?: 'top' | 'bottom' | 'left' | 'right';\n /** Alignment of the popover relative to the trigger */\n align?: 'start' | 'center' | 'end';\n /** aria-label for the trigger button */\n 'aria-label'?: string;\n /** Test id for the trigger button */\n 'data-testid'?: string;\n}\n\nexport type SelectProps<T extends string = string> = SelectBaseProps<T> &\n (\n | {\n options: SelectOption<T>[];\n groups?: never;\n }\n | {\n groups: SelectGroup<T>[];\n options?: never;\n }\n ) &\n (\n | {\n /** Controlled open state */\n open: boolean;\n /** Callback when open state changes (required when `open` is provided) */\n onOpenChange: (open: boolean) => void;\n }\n | {\n open?: never;\n onOpenChange?: never;\n }\n );\n\nfunction optionToItem(opt: SelectOption): CommandMenuItem {\n return {\n value: opt.value,\n label: opt.label,\n description: opt.description,\n rightDecorator: opt.rightDecorator,\n disabled: opt.disabled,\n keywords: opt.label ? [opt.label] : undefined,\n };\n}\n\nfunction OptionSelect<T extends string = string>({\n value,\n onChange,\n options,\n groups,\n placeholder = 'Select...',\n searchPlaceholder = 'Search...',\n disabled = false,\n size = 'sm',\n emptyText = 'No results found.',\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n allowDeselect,\n hideSearch = true,\n disableFilter,\n onSearchChange,\n loading,\n loadingRows,\n onEndReached,\n endReachedThresholdPx,\n triggerClassName,\n variant = 'outlined',\n contentClassName,\n renderValue,\n renderOption,\n side,\n align = 'start',\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n ...rest\n}: SelectProps<T>) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n const setOpen = isControlled ? controlledOnOpenChange : setUncontrolledOpen;\n\n const allOptions = useMemo<SelectOption<T>[]>(\n () => (groups ? groups.flatMap((g) => g.options) : (options ?? [])),\n [groups, options]\n );\n\n const selectedOption = useMemo(\n () => allOptions.find((opt) => opt.value === value),\n [allOptions, value]\n );\n\n const handleSelect = useCallback(\n (optionValue: string) => {\n const match = allOptions.find((o) => o.value === optionValue);\n if (!match) return;\n if (allowDeselect && match.value === value) {\n onChange(undefined);\n } else {\n onChange(match.value);\n }\n setOpen(false);\n },\n [allowDeselect, value, onChange, setOpen, allOptions]\n );\n\n const items: CommandMenuItem[] = useMemo(\n () => (options ?? []).map(optionToItem),\n [options]\n );\n\n const commandGroups: CommandMenuGroup[] | undefined = useMemo(\n () =>\n groups?.map((g) => ({\n heading: g.heading,\n items: g.options.map(optionToItem),\n })),\n [groups]\n );\n\n const renderItem = renderOption\n ? (item: CommandMenuItem, isSelected: boolean) => {\n const option = allOptions.find((o) => o.value === item.value);\n return option ? renderOption(option, isSelected) : null;\n }\n : undefined;\n const searchInputSize = size === 'xs' ? 'sm' : size === 'lg' ? 'md' : size;\n const triggerButtonSize = size === 'lg' ? 'md' : size;\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n\n const commandMenuSharedProps = {\n value,\n onSelect: handleSelect,\n placeholder: searchPlaceholder,\n emptyText,\n hideSearch,\n disableFilter,\n onSearchChange,\n loading,\n loadingRows,\n onEndReached,\n endReachedThresholdPx,\n renderItem,\n inputSize: searchInputSize,\n itemRowSize,\n };\n\n const triggerContent =\n selectedOption && renderValue ? (\n renderValue(selectedOption)\n ) : (\n <Text\n as=\"span\"\n variant={triggerButtonSize}\n weight=\"normal\"\n className=\"min-w-0 truncate text-left\"\n >\n {selectedOption\n ? (selectedOption.label ?? selectedOption.value)\n : placeholder}\n </Text>\n );\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button\n {...pickDataAttributes(rest)}\n role=\"combobox\"\n aria-expanded={open}\n aria-label={ariaLabel ?? placeholder}\n variant={variant}\n color=\"secondary\"\n size={triggerButtonSize}\n className={cn(\n 'box-border justify-between py-0',\n CONTROL_SIZES[size].heightClassName,\n variant === 'plain'\n ? cn(\n 'w-auto max-w-full gap-space-1 px-space-1',\n // The shared disabled fill, in both themes.\n disabled && 'bg-disabled text-disabled dark:bg-disabled'\n )\n : cn(\n 'w-full',\n disabled\n ? 'border-muted bg-input-disabled text-disabled dark:bg-input-disabled'\n : 'bg-input border-input hover:bg-input-hover hover:border-input-hover focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none'\n ),\n triggerClassName\n )}\n disabled={disabled}\n data-testid={dataTestId}\n >\n {triggerContent}\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={disabled ? 'text-icon-disabled' : 'text-inherit'}\n weight=\"regular\"\n />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n className={cn(\n 'w-max min-w-[var(--radix-popover-trigger-width)] max-w-[min(24rem,calc(100vw-1rem))] p-0 text-primary',\n contentClassName\n )}\n side={side}\n align={align}\n >\n {commandGroups ? (\n <CommandMenu groups={commandGroups} {...commandMenuSharedProps} />\n ) : (\n <CommandMenu items={items} {...commandMenuSharedProps} />\n )}\n </PopoverContent>\n </Popover>\n );\n}\n\nexport function Select<T extends string = string>(\n props: SelectProps<T>\n): React.ReactElement<unknown> {\n return <OptionSelect {...props} />;\n}\n"],"mappings":";;;;;;;;;;;;;AA4HA,SAAS,aAAa,KAAoC;CACxD,OAAO;EACL,OAAO,IAAI;EACX,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,gBAAgB,IAAI;EACpB,UAAU,IAAI;EACd,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,KAAA;CACtC;AACF;AAEA,SAAS,aAAwC,EAC/C,OACA,UACA,SACA,QACA,cAAc,aACd,oBAAoB,aACpB,WAAW,OACX,OAAO,MACP,YAAY,qBACZ,MAAM,gBACN,cAAc,wBACd,eACA,aAAa,MACb,eACA,gBACA,SACA,aACA,cACA,uBACA,kBACA,UAAU,YACV,kBACA,aACA,cACA,MACA,QAAQ,SACR,cAAc,WACd,eAAe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Q,SAAS,OAAO,OAAO;CAiB1C;CAEA,MAAM,iBACJ,kBAAkB,cAChB,YAAY,cAAc,IAE1B,oBAAC,MAAD;EACE,IAAG;EACH,SAAS;EACT,QAAO;EACP,WAAU;EAET,UAAA,iBACI,eAAe,SAAS,eAAe,QACxC;CACA,CAAA;CAGV,OACE,qBAAC,SAAD;EAAe;EAAM,cAAc;EAAnC,UAAA,CACE,oBAAC,gBAAD;GAAgB,SAAA;GACd,UAAA,qBAAC,QAAD;IACE,GAAI,mBAAmB,IAAI;IAC3B,MAAK;IACL,iBAAe;IACf,cAAY,aAAa;IAChB;IACT,OAAM;IACN,MAAM;IACN,WAAW,GACT,mCACA,cAAc,KAAK,CAAC,iBACpB,YAAY,UACR,GACE,4CAEA,YAAY,4CACd,IACA,GACE,UACA,WACI,wEACA,gLACN,GACJ,gBACF;IACU;IACV,eAAa;IA1Bf,UAAA,CA4BG,gBACD,oBAAC,MAAD;KACE,eAAA;KACA,MAAM;KACN,eAAe,mBAAmB,KAAK,CAAC;KACxC,WAAW,WAAW,uBAAuB;KAC7C,QAAO;IACR,CAAA,CACK;;EACM,CAAA,GAChB,oBAAC,gBAAD;GACE,WAAW,GACT,yGACA,gBACF;GACM;GACC;GAEN,UAAA,gBACC,oBAAC,aAAD;IAAa,QAAQ;IAAe,GAAI;GAAyB,CAAA,IAEjE,oBAAC,aAAD;IAAoB;IAAO,GAAI;GAAyB,CAAA;EAE5C,CAAA,CACT;;AAEb;AAEA,SAAgB,OACd,OAC6B;CAC7B,OAAO,oBAAC,cAAD,EAAc,GAAI,MAAQ,CAAA;AACnC"}
|
|
@@ -24,16 +24,16 @@ var SelectRoot = (props) => {
|
|
|
24
24
|
};
|
|
25
25
|
var SelectTrigger = React$1.forwardRef(({ className, children, iconClassName, ...props }, ref) => {
|
|
26
26
|
const isError = props["aria-invalid"] === true || props["aria-invalid"] === "true";
|
|
27
|
-
const triggerStateStyles = !props.disabled && (isError ? "border-error-strong focus-visible:border-error-strong focus-visible:shadow-[0_0_0_1px_var(--border-error-strong)] focus-visible:outline-none" : "[&:enabled:hover:not(:focus-visible)]:border-
|
|
27
|
+
const triggerStateStyles = !props.disabled && (isError ? "border-error-strong focus-visible:border-error-strong focus-visible:shadow-[0_0_0_1px_var(--border-error-strong)] focus-visible:outline-none" : "[&:enabled:hover:not(:focus-visible)]:border-input-hover focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none");
|
|
28
28
|
if (props.asChild) return /* @__PURE__ */ jsx(RadixSelect.Trigger, {
|
|
29
29
|
ref,
|
|
30
|
-
className: cn("flex items-center justify-between gap-space-2 rounded-md border border-
|
|
30
|
+
className: cn("flex items-center justify-between gap-space-2 rounded-md border border-input bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1", triggerStateStyles, className),
|
|
31
31
|
...props,
|
|
32
32
|
children: props.asChild ? children : /* @__PURE__ */ jsx("span", { children })
|
|
33
33
|
});
|
|
34
34
|
return /* @__PURE__ */ jsxs(RadixSelect.Trigger, {
|
|
35
35
|
ref,
|
|
36
|
-
className: cn("flex items-center justify-between gap-space-2 rounded-md border border-
|
|
36
|
+
className: cn("flex items-center justify-between gap-space-2 rounded-md border border-input bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1", triggerStateStyles, className),
|
|
37
37
|
...props,
|
|
38
38
|
children: [children, /* @__PURE__ */ jsx(RadixSelect.Icon, {
|
|
39
39
|
asChild: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPrimitive.js","names":[],"sources":["../../../src/components/Select/SelectPrimitive.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as RadixSelect from '@radix-ui/react-select';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport {\n CaretDownIcon,\n CaretUpIcon,\n CheckIcon,\n} from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const SelectRoot: typeof RadixSelect.Root = (props) => {\n const [open = false, onOpenChange] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n return (\n <RadixSelect.Root\n {...props}\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={undefined}\n />\n );\n};\n\nexport type SelectTriggerProps = React.ComponentPropsWithoutRef<\n typeof RadixSelect.Trigger\n> & {\n iconClassName?: string;\n};\n\nexport const SelectTrigger = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Trigger>,\n SelectTriggerProps\n>(({ className, children, iconClassName, ...props }, ref) => {\n const isError =\n props['aria-invalid'] === true || props['aria-invalid'] === 'true';\n const triggerStateStyles =\n !props.disabled &&\n (isError\n ? 'border-error-strong focus-visible:border-error-strong focus-visible:shadow-[0_0_0_1px_var(--border-error-strong)] focus-visible:outline-none'\n : '[&:enabled:hover:not(:focus-visible)]:border-subtle focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none');\n\n if (props.asChild) {\n return (\n <RadixSelect.Trigger\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-space-2 rounded-md border border-muted bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1',\n triggerStateStyles,\n className\n )}\n {...props}\n >\n {props.asChild ? children : <span>{children}</span>}\n </RadixSelect.Trigger>\n );\n }\n\n return (\n <RadixSelect.Trigger\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-space-2 rounded-md border border-muted bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1',\n triggerStateStyles,\n className\n )}\n {...props}\n >\n {children}\n <RadixSelect.Icon asChild>\n <span\n aria-hidden\n className={cn('inline-flex h-4 w-4 text-icon-primary', iconClassName)}\n >\n <CaretDownIcon size=\"100%\" weight=\"regular\" />\n </span>\n </RadixSelect.Icon>\n </RadixSelect.Trigger>\n );\n});\nSelectTrigger.displayName = RadixSelect.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof RadixSelect.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <RadixSelect.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-space-1',\n className\n )}\n {...props}\n >\n <CaretUpIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = RadixSelect.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof RadixSelect.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <RadixSelect.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-space-1',\n className\n )}\n {...props}\n >\n <CaretDownIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = RadixSelect.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Content>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <RadixSelect.Portal>\n <RadixSelect.Content\n ref={ref}\n className={cn(\n 'relative max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-default bg-popover shadow-md',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n className\n )}\n position={position}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n <ZIndexProvider value={zIndex}>\n <SelectScrollUpButton />\n <RadixSelect.Viewport\n className={cn(\n 'p-space-1',\n position === 'popper' &&\n 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'\n )}\n >\n {children}\n </RadixSelect.Viewport>\n <SelectScrollDownButton />\n </ZIndexProvider>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n );\n});\nSelectContent.displayName = RadixSelect.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Label>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Label>\n>(({ className, ...props }, ref) => (\n <RadixSelect.Label\n ref={ref}\n className={cn(\n 'py-1.5 pl-space-6 pr-space-2 text-sm font-semibold',\n className\n )}\n {...props}\n />\n));\nSelectLabel.displayName = RadixSelect.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Item>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Item> & {\n checkmarkPosition?: 'left' | 'right';\n selectedIndicator?: 'checkmark' | 'background';\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(\n (\n {\n className,\n children,\n checkmarkPosition = 'left',\n selectedIndicator = 'checkmark',\n size = 'md',\n ...props\n },\n ref\n ) => (\n <RadixSelect.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default select-none items-center rounded-sm py-space-1 pr-space-2 outline-hidden focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n selectedIndicator === 'background'\n ? 'pl-space-2 data-[state=checked]:bg-selected data-[state=checked]:focus:bg-selected-hover'\n : checkmarkPosition === 'left'\n ? 'pl-space-6'\n : 'pl-space-2',\n className\n )}\n {...props}\n >\n {selectedIndicator === 'checkmark' && (\n <span\n className={cn(\n 'absolute flex h-3.5 w-3.5 items-center justify-center',\n checkmarkPosition === 'left' ? 'left-2' : 'right-2'\n )}\n >\n <RadixSelect.ItemIndicator>\n <CheckIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ItemIndicator>\n </span>\n )}\n\n <RadixSelect.ItemText>{children}</RadixSelect.ItemText>\n </RadixSelect.Item>\n )\n);\nSelectItem.displayName = RadixSelect.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Separator>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Separator>\n>(({ className, ...props }, ref) => (\n <RadixSelect.Separator\n ref={ref}\n className={cn(\n '-mx-space-1 my-space-1 h-px border-b border-subtle',\n className\n )}\n {...props}\n />\n));\nSelectSeparator.displayName = RadixSelect.Separator.displayName;\n\nexport const SelectValue = RadixSelect.Value;\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,cAAuC,UAAU;CAC5D,MAAM,CAAC,OAAO,OAAO,gBAAgB,qBAAqB;EACxD,MAAM,MAAM;EACZ,aAAa,MAAM,eAAe;EAClC,UAAU,MAAM;CAClB,CAAC;CAED,OACE,oBAAC,YAAY,MAAb;EACE,GAAI;EACE;EACQ;EACd,aAAa,KAAA;CACd,CAAA;AAEL;AAQA,IAAa,gBAAgB,QAAM,YAGhC,EAAE,WAAW,UAAU,eAAe,GAAG,SAAS,QAAQ;CAC3D,MAAM,UACJ,MAAM,oBAAoB,QAAQ,MAAM,oBAAoB;CAC9D,MAAM,qBACJ,CAAC,MAAM,a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F;CACA,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc,YAAY,UAAU;AAEpD,IAAa,cAAc,YAAY"}
|
|
1
|
+
{"version":3,"file":"SelectPrimitive.js","names":[],"sources":["../../../src/components/Select/SelectPrimitive.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport * as RadixSelect from '@radix-ui/react-select';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport {\n CaretDownIcon,\n CaretUpIcon,\n CheckIcon,\n} from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { useZIndex } from '../../utils/useZIndex';\nimport { ZIndexProvider } from '../../utils/ZIndexContext';\nimport zIndices from '../../utils/zIndices';\n\nexport const SelectRoot: typeof RadixSelect.Root = (props) => {\n const [open = false, onOpenChange] = useControllableState({\n prop: props.open,\n defaultProp: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n });\n\n return (\n <RadixSelect.Root\n {...props}\n open={open}\n onOpenChange={onOpenChange}\n defaultOpen={undefined}\n />\n );\n};\n\nexport type SelectTriggerProps = React.ComponentPropsWithoutRef<\n typeof RadixSelect.Trigger\n> & {\n iconClassName?: string;\n};\n\nexport const SelectTrigger = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Trigger>,\n SelectTriggerProps\n>(({ className, children, iconClassName, ...props }, ref) => {\n const isError =\n props['aria-invalid'] === true || props['aria-invalid'] === 'true';\n const triggerStateStyles =\n !props.disabled &&\n (isError\n ? 'border-error-strong focus-visible:border-error-strong focus-visible:shadow-[0_0_0_1px_var(--border-error-strong)] focus-visible:outline-none'\n : '[&:enabled:hover:not(:focus-visible)]:border-input-hover focus-visible:border-focus focus-visible:shadow-[0_0_0_1px_var(--border-focus)] focus-visible:outline-none');\n\n if (props.asChild) {\n return (\n <RadixSelect.Trigger\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-space-2 rounded-md border border-input bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1',\n triggerStateStyles,\n className\n )}\n {...props}\n >\n {props.asChild ? children : <span>{children}</span>}\n </RadixSelect.Trigger>\n );\n }\n\n return (\n <RadixSelect.Trigger\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-space-2 rounded-md border border-input bg-input p-1.5 px-2.5 text-sm disabled:cursor-not-allowed disabled:border-muted disabled:bg-input-disabled disabled:text-disabled enabled:data-[placeholder]:text-secondary disabled:[&_svg]:text-icon-disabled [&>span]:line-clamp-1',\n triggerStateStyles,\n className\n )}\n {...props}\n >\n {children}\n <RadixSelect.Icon asChild>\n <span\n aria-hidden\n className={cn('inline-flex h-4 w-4 text-icon-primary', iconClassName)}\n >\n <CaretDownIcon size=\"100%\" weight=\"regular\" />\n </span>\n </RadixSelect.Icon>\n </RadixSelect.Trigger>\n );\n});\nSelectTrigger.displayName = RadixSelect.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof RadixSelect.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <RadixSelect.ScrollUpButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-space-1',\n className\n )}\n {...props}\n >\n <CaretUpIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = RadixSelect.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof RadixSelect.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <RadixSelect.ScrollDownButton\n ref={ref}\n className={cn(\n 'flex cursor-default items-center justify-center py-space-1',\n className\n )}\n {...props}\n >\n <CaretDownIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = RadixSelect.ScrollDownButton.displayName;\n\nexport const SelectContent = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Content>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <RadixSelect.Portal>\n <RadixSelect.Content\n ref={ref}\n className={cn(\n 'relative max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-default bg-popover shadow-md',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n className\n )}\n position={position}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n <ZIndexProvider value={zIndex}>\n <SelectScrollUpButton />\n <RadixSelect.Viewport\n className={cn(\n 'p-space-1',\n position === 'popper' &&\n 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'\n )}\n >\n {children}\n </RadixSelect.Viewport>\n <SelectScrollDownButton />\n </ZIndexProvider>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n );\n});\nSelectContent.displayName = RadixSelect.Content.displayName;\n\nexport const SelectLabel = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Label>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Label>\n>(({ className, ...props }, ref) => (\n <RadixSelect.Label\n ref={ref}\n className={cn(\n 'py-1.5 pl-space-6 pr-space-2 text-sm font-semibold',\n className\n )}\n {...props}\n />\n));\nSelectLabel.displayName = RadixSelect.Label.displayName;\n\nexport const SelectItem = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Item>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Item> & {\n checkmarkPosition?: 'left' | 'right';\n selectedIndicator?: 'checkmark' | 'background';\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n }\n>(\n (\n {\n className,\n children,\n checkmarkPosition = 'left',\n selectedIndicator = 'checkmark',\n size = 'md',\n ...props\n },\n ref\n ) => (\n <RadixSelect.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default select-none items-center rounded-sm py-space-1 pr-space-2 outline-hidden focus:bg-elevated-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n OPTION_ROW_SIZES[size].minHeightClassName,\n size === 'sm' ? 'text-xs leading-4' : 'text-sm',\n selectedIndicator === 'background'\n ? 'pl-space-2 data-[state=checked]:bg-selected data-[state=checked]:focus:bg-selected-hover'\n : checkmarkPosition === 'left'\n ? 'pl-space-6'\n : 'pl-space-2',\n className\n )}\n {...props}\n >\n {selectedIndicator === 'checkmark' && (\n <span\n className={cn(\n 'absolute flex h-3.5 w-3.5 items-center justify-center',\n checkmarkPosition === 'left' ? 'left-2' : 'right-2'\n )}\n >\n <RadixSelect.ItemIndicator>\n <CheckIcon aria-hidden size={16} weight=\"regular\" />\n </RadixSelect.ItemIndicator>\n </span>\n )}\n\n <RadixSelect.ItemText>{children}</RadixSelect.ItemText>\n </RadixSelect.Item>\n )\n);\nSelectItem.displayName = RadixSelect.Item.displayName;\n\nexport const SelectSeparator = React.forwardRef<\n React.ElementRef<typeof RadixSelect.Separator>,\n React.ComponentPropsWithoutRef<typeof RadixSelect.Separator>\n>(({ className, ...props }, ref) => (\n <RadixSelect.Separator\n ref={ref}\n className={cn(\n '-mx-space-1 my-space-1 h-px border-b border-subtle',\n className\n )}\n {...props}\n />\n));\nSelectSeparator.displayName = RadixSelect.Separator.displayName;\n\nexport const SelectValue = RadixSelect.Value;\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,cAAuC,UAAU;CAC5D,MAAM,CAAC,OAAO,OAAO,gBAAgB,qBAAqB;EACxD,MAAM,MAAM;EACZ,aAAa,MAAM,eAAe;EAClC,UAAU,MAAM;CAClB,CAAC;CAED,OACE,oBAAC,YAAY,MAAb;EACE,GAAI;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R,oBAAC,YAAY,UAAb,EAAuB,SAA+B,CAAA,CACtC;AAEtB,CAAA,CAAA;AACA,WAAW,cAAc,YAAY,KAAK;AAE1C,IAAa,kBAAkB,QAAM,YAGlC,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,YAAY,WAAb;CACO;CACL,WAAW,GACT,sDACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc,YAAY,UAAU;AAEpD,IAAa,cAAc,YAAY"}
|
|
@@ -57,8 +57,8 @@ var Textarea = forwardRef(({ size = "lg", leftDecorator, rightDecorator, disable
|
|
|
57
57
|
"py-space-2": size === "lg"
|
|
58
58
|
},
|
|
59
59
|
"focus-within:outline-hidden",
|
|
60
|
-
"border-
|
|
61
|
-
!disabled && !isError && "[&:hover:not(:focus-within)]:border-
|
|
60
|
+
"border-input",
|
|
61
|
+
!disabled && !isError && "[&:hover:not(:focus-within)]:border-input-hover",
|
|
62
62
|
!disabled && !isError && "focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]",
|
|
63
63
|
!disabled && isError && "border-error-strong focus-within:border-error-strong focus-within:shadow-[0_0_0_1px_var(--border-error-strong)]",
|
|
64
64
|
disabled && "cursor-not-allowed border-muted bg-input-disabled text-disabled"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":[],"sources":["../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n forwardRef,\n useCallback,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES } from '../../utils/componentSizes';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport {\n INPUT_HORIZONTAL_PADDING_CLASSES,\n INPUT_RADIUS_CLASSES,\n INPUT_TEXT_CLASSES,\n} from '../Input/inputStyles';\nimport type { InputSize } from '../Input/inputStyles';\nimport { Text } from '../Text';\n\nconst DEFAULT_AUTO_RESIZE_MAX_HEIGHT_PX = 200;\n\nexport interface TextareaProps {\n /** First-row metrics. Total height remains intrinsic to rows and content. */\n size?: InputSize;\n /** Left side decorator/icon */\n leftDecorator?: ReactNode;\n /** Right side decorator/icon */\n rightDecorator?: ReactNode;\n /** Whether the textarea is disabled */\n disabled?: boolean;\n /** Whether the textarea has an error state */\n isError?: boolean;\n /** Label text displayed above the textarea */\n label?: string | ReactNode;\n /** Hint text displayed below the textarea */\n hintText?: string;\n /** Current textarea value */\n value?: string;\n /**\n * Update controlled value synchronously. Keep asynchronous persistence in\n * the owner, using useDebouncedCommit when writes must be debounced and ordered.\n */\n onChange: (value: string) => void;\n /** Placeholder text */\n placeholder?: string;\n /** Additional CSS classes */\n className?: string;\n /** Additional CSS classes applied to the inner <textarea> element */\n inputClassName?: string;\n /** Textarea ID for accessibility */\n id?: string;\n /** Whether the field is required */\n required?: boolean;\n /** Auto focus on mount */\n autoFocus?: boolean;\n /** Number of visible rows */\n rows?: number;\n /** Whether the textarea can be resized */\n resize?: 'none' | 'vertical' | 'horizontal' | 'both';\n /** When true, textarea height grows with content up to maxHeight (resize is forced to none) */\n autoResize?: boolean;\n /** Max height in px when autoResize is true (default: 200) */\n maxHeight?: number;\n /** Visual variant: default (bordered container) or plain (borderless, for embedding) */\n variant?: 'default' | 'plain';\n}\n\nexport const Textarea = forwardRef<\n HTMLTextAreaElement,\n TextareaProps &\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, keyof TextareaProps>\n>(\n (\n {\n size = 'lg',\n leftDecorator,\n rightDecorator,\n disabled = false,\n isError = false,\n label,\n hintText,\n value,\n onChange,\n placeholder,\n className,\n inputClassName,\n id,\n required = false,\n autoFocus = false,\n rows = 3,\n resize = 'vertical',\n autoResize = false,\n maxHeight = DEFAULT_AUTO_RESIZE_MAX_HEIGHT_PX,\n variant = 'default',\n 'aria-describedby': ariaDescribedBy,\n ...rest\n },\n ref\n ) => {\n const generatedId = useId();\n const textareaId = id ?? generatedId;\n const hintTextId = `${textareaId}-hint`;\n const describedBy =\n [hintText ? hintTextId : undefined, ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined;\n const [internalValue, setInternalValue] = useState(value);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n // Auto-resize: grow with content up to maxHeight.\n // Run on value change and on element resize (e.g. container width change so text wraps).\n const runAutoResize = useCallback(() => {\n const el = textareaRef.current;\n if (!el || !autoResize) return;\n el.style.height = 'auto';\n const contentHeight = Math.min(el.scrollHeight, maxHeight);\n el.style.height = `${contentHeight}px`;\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [autoResize, maxHeight]);\n\n useLayoutEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n if (!autoResize) {\n el.style.height = '';\n el.style.overflowY = '';\n return;\n }\n\n runAutoResize();\n\n const ro = new ResizeObserver(runAutoResize);\n ro.observe(el);\n return () => ro.disconnect();\n }, [autoResize, value, internalValue, runAutoResize]);\n\n const handleTextareaChange = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n const newValue = e.target.value;\n setInternalValue(newValue);\n onChange(newValue);\n };\n\n const textareaContainerClasses = cn(\n 'flex w-full gap-space-2',\n variant === 'default' && [\n 'border bg-input transition-[border-color,box-shadow,background-color]',\n CONTROL_SIZES[size].minHeightClassName,\n INPUT_HORIZONTAL_PADDING_CLASSES[size],\n INPUT_RADIUS_CLASSES[size],\n {\n 'py-px': size === 'xs',\n 'py-0.5': size === 'sm',\n 'py-space-1': size === 'md',\n 'py-space-2': size === 'lg',\n },\n 'focus-within:outline-hidden',\n 'border-muted',\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-subtle',\n !disabled &&\n !isError &&\n 'focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]',\n !disabled &&\n isError &&\n 'border-error-strong focus-within:border-error-strong focus-within:shadow-[0_0_0_1px_var(--border-error-strong)]',\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n ],\n leftDecorator || rightDecorator ? 'items-start' : 'items-center'\n );\n\n const effectiveResize = autoResize ? 'none' : resize;\n const textareaClasses = cn(\n 'max-w-full flex-1 border-none bg-transparent p-0 outline-hidden',\n INPUT_TEXT_CLASSES[size],\n 'placeholder:text-placeholder',\n disabled && 'cursor-not-allowed text-disabled placeholder:text-disabled',\n // Resize handling (autoResize forces none)\n {\n 'resize-none': effectiveResize === 'none',\n 'resize-y': effectiveResize === 'vertical',\n 'resize-x': effectiveResize === 'horizontal',\n resize: effectiveResize === 'both',\n },\n inputClassName\n );\n\n const decoratorClasses = cn(\n 'flex items-center text-tertiary',\n disabled && 'text-disabled',\n {\n 'mt-0': size === 'xs' || size === 'sm',\n 'mt-0.5': size === 'md',\n 'mt-space-1': size === 'lg',\n }\n );\n\n const labelClasses = cn(\n 'mb-space-1 block font-medium text-primary',\n disabled && 'text-disabled'\n );\n\n const hintTextClasses = cn(\n 'mt-space-1 text-xs',\n isError ? 'text-error-secondary' : 'text-tertiary'\n );\n\n const containerClasses = cn('w-full', className);\n\n return (\n <div className={containerClasses}>\n {label && (\n <Text\n as=\"label\"\n htmlFor={textareaId}\n className={labelClasses}\n variant=\"sm\"\n >\n {label}\n {required && (\n <span className=\"ml-space-1 text-error-secondary\">*</span>\n )}\n </Text>\n )}\n\n <div className={textareaContainerClasses}>\n {leftDecorator && (\n <div className={decoratorClasses}>{leftDecorator}</div>\n )}\n\n {/* eslint-disable-next-line react/forbid-elements */}\n <textarea\n ref={mergeRefs([textareaRef, ref])}\n id={textareaId}\n value={value}\n onChange={handleTextareaChange}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n autoFocus={autoFocus}\n rows={rows}\n aria-describedby={describedBy}\n aria-invalid={isError || undefined}\n className={textareaClasses}\n {...rest}\n />\n\n {rightDecorator && (\n <div className={decoratorClasses}>{rightDecorator}</div>\n )}\n </div>\n\n {hintText && (\n <Text\n id={hintTextId}\n className={hintTextClasses}\n variant=\"xs\"\n weight=\"normal\"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MACH;MACA;MACC;MACL;MACN,oBAAkB;MAClB,gBAAc,WAAW,KAAA;MACzB,WAAW;MACX,GAAI;KACL,CAAA;KAEA,kBACC,oBAAC,OAAD;MAAK,WAAW;MAAmB,UAAA;KAAoB,CAAA;IAEtD;;GAEJ,YACC,oBAAC,MAAD;IACE,IAAI;IACJ,WAAW;IACX,SAAQ;IACR,QAAO;IAEN,UAAA;GACG,CAAA;EAEL;;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
1
|
+
{"version":3,"file":"Textarea.js","names":[],"sources":["../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport {\n forwardRef,\n useCallback,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES } from '../../utils/componentSizes';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport {\n INPUT_HORIZONTAL_PADDING_CLASSES,\n INPUT_RADIUS_CLASSES,\n INPUT_TEXT_CLASSES,\n} from '../Input/inputStyles';\nimport type { InputSize } from '../Input/inputStyles';\nimport { Text } from '../Text';\n\nconst DEFAULT_AUTO_RESIZE_MAX_HEIGHT_PX = 200;\n\nexport interface TextareaProps {\n /** First-row metrics. Total height remains intrinsic to rows and content. */\n size?: InputSize;\n /** Left side decorator/icon */\n leftDecorator?: ReactNode;\n /** Right side decorator/icon */\n rightDecorator?: ReactNode;\n /** Whether the textarea is disabled */\n disabled?: boolean;\n /** Whether the textarea has an error state */\n isError?: boolean;\n /** Label text displayed above the textarea */\n label?: string | ReactNode;\n /** Hint text displayed below the textarea */\n hintText?: string;\n /** Current textarea value */\n value?: string;\n /**\n * Update controlled value synchronously. Keep asynchronous persistence in\n * the owner, using useDebouncedCommit when writes must be debounced and ordered.\n */\n onChange: (value: string) => void;\n /** Placeholder text */\n placeholder?: string;\n /** Additional CSS classes */\n className?: string;\n /** Additional CSS classes applied to the inner <textarea> element */\n inputClassName?: string;\n /** Textarea ID for accessibility */\n id?: string;\n /** Whether the field is required */\n required?: boolean;\n /** Auto focus on mount */\n autoFocus?: boolean;\n /** Number of visible rows */\n rows?: number;\n /** Whether the textarea can be resized */\n resize?: 'none' | 'vertical' | 'horizontal' | 'both';\n /** When true, textarea height grows with content up to maxHeight (resize is forced to none) */\n autoResize?: boolean;\n /** Max height in px when autoResize is true (default: 200) */\n maxHeight?: number;\n /** Visual variant: default (bordered container) or plain (borderless, for embedding) */\n variant?: 'default' | 'plain';\n}\n\nexport const Textarea = forwardRef<\n HTMLTextAreaElement,\n TextareaProps &\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, keyof TextareaProps>\n>(\n (\n {\n size = 'lg',\n leftDecorator,\n rightDecorator,\n disabled = false,\n isError = false,\n label,\n hintText,\n value,\n onChange,\n placeholder,\n className,\n inputClassName,\n id,\n required = false,\n autoFocus = false,\n rows = 3,\n resize = 'vertical',\n autoResize = false,\n maxHeight = DEFAULT_AUTO_RESIZE_MAX_HEIGHT_PX,\n variant = 'default',\n 'aria-describedby': ariaDescribedBy,\n ...rest\n },\n ref\n ) => {\n const generatedId = useId();\n const textareaId = id ?? generatedId;\n const hintTextId = `${textareaId}-hint`;\n const describedBy =\n [hintText ? hintTextId : undefined, ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined;\n const [internalValue, setInternalValue] = useState(value);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n // Auto-resize: grow with content up to maxHeight.\n // Run on value change and on element resize (e.g. container width change so text wraps).\n const runAutoResize = useCallback(() => {\n const el = textareaRef.current;\n if (!el || !autoResize) return;\n el.style.height = 'auto';\n const contentHeight = Math.min(el.scrollHeight, maxHeight);\n el.style.height = `${contentHeight}px`;\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [autoResize, maxHeight]);\n\n useLayoutEffect(() => {\n const el = textareaRef.current;\n if (!el) return;\n if (!autoResize) {\n el.style.height = '';\n el.style.overflowY = '';\n return;\n }\n\n runAutoResize();\n\n const ro = new ResizeObserver(runAutoResize);\n ro.observe(el);\n return () => ro.disconnect();\n }, [autoResize, value, internalValue, runAutoResize]);\n\n const handleTextareaChange = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n const newValue = e.target.value;\n setInternalValue(newValue);\n onChange(newValue);\n };\n\n const textareaContainerClasses = cn(\n 'flex w-full gap-space-2',\n variant === 'default' && [\n 'border bg-input transition-[border-color,box-shadow,background-color]',\n CONTROL_SIZES[size].minHeightClassName,\n INPUT_HORIZONTAL_PADDING_CLASSES[size],\n INPUT_RADIUS_CLASSES[size],\n {\n 'py-px': size === 'xs',\n 'py-0.5': size === 'sm',\n 'py-space-1': size === 'md',\n 'py-space-2': size === 'lg',\n },\n 'focus-within:outline-hidden',\n 'border-input',\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-input-hover',\n !disabled &&\n !isError &&\n 'focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]',\n !disabled &&\n isError &&\n 'border-error-strong focus-within:border-error-strong focus-within:shadow-[0_0_0_1px_var(--border-error-strong)]',\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n ],\n leftDecorator || rightDecorator ? 'items-start' : 'items-center'\n );\n\n const effectiveResize = autoResize ? 'none' : resize;\n const textareaClasses = cn(\n 'max-w-full flex-1 border-none bg-transparent p-0 outline-hidden',\n INPUT_TEXT_CLASSES[size],\n 'placeholder:text-placeholder',\n disabled && 'cursor-not-allowed text-disabled placeholder:text-disabled',\n // Resize handling (autoResize forces none)\n {\n 'resize-none': effectiveResize === 'none',\n 'resize-y': effectiveResize === 'vertical',\n 'resize-x': effectiveResize === 'horizontal',\n resize: effectiveResize === 'both',\n },\n inputClassName\n );\n\n const decoratorClasses = cn(\n 'flex items-center text-tertiary',\n disabled && 'text-disabled',\n {\n 'mt-0': size === 'xs' || size === 'sm',\n 'mt-0.5': size === 'md',\n 'mt-space-1': size === 'lg',\n }\n );\n\n const labelClasses = cn(\n 'mb-space-1 block font-medium text-primary',\n disabled && 'text-disabled'\n );\n\n const hintTextClasses = cn(\n 'mt-space-1 text-xs',\n isError ? 'text-error-secondary' : 'text-tertiary'\n );\n\n const containerClasses = cn('w-full', className);\n\n return (\n <div className={containerClasses}>\n {label && (\n <Text\n as=\"label\"\n htmlFor={textareaId}\n className={labelClasses}\n variant=\"sm\"\n >\n {label}\n {required && (\n <span className=\"ml-space-1 text-error-secondary\">*</span>\n )}\n </Text>\n )}\n\n <div className={textareaContainerClasses}>\n {leftDecorator && (\n <div className={decoratorClasses}>{leftDecorator}</div>\n )}\n\n {/* eslint-disable-next-line react/forbid-elements */}\n <textarea\n ref={mergeRefs([textareaRef, ref])}\n id={textareaId}\n value={value}\n onChange={handleTextareaChange}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n autoFocus={autoFocus}\n rows={rows}\n aria-describedby={describedBy}\n aria-invalid={isError || undefined}\n className={textareaClasses}\n {...rest}\n />\n\n {rightDecorator && (\n <div className={decoratorClasses}>{rightDecorator}</div>\n )}\n </div>\n\n {hintText && (\n <Text\n id={hintTextId}\n className={hintTextClasses}\n variant=\"xs\"\n weight=\"normal\"\n >\n {hintText}\n </Text>\n )}\n </div>\n );\n }\n);\n\nTextarea.displayName = 'Textarea';\n"],"mappings":";;;;;;;;AAqBA,IAAM,oCAAoC;AAgD1C,IAAa,WAAW,YAMpB,EACE,OAAO,MACP,eACA,gBACA,WAAW,OACX,UAAU,OACV,OACA,UACA,OACA,UACA,aACA,WACA,gBACA,IACA,WAAW,OACX,YAAY,OACZ,OAAO,GACP,SAAS,YACT,aAAa,OACb,YAAY,mCACZ,UAAU,WACV,oBAAoB,iBACpB,GAAG,QAEL,QACG;CACH,MAAM,cAAc,MAAM;CAC1B,MAAM,aAAa,MAAM;CACzB,MAAM,aAAa,GAAG,WAAW;CACjC,MAAM,cACJ,CAAC,WAAW,aAAa,KAAA,GAAW,eAAe,CAAC,CACjD,OAAO,OAAO,CAAC,CACf,KAAK,G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B;EAChC,YAAY,oBAAoB;EAChC,QAAQ,oBAAoB;CAC9B,GACA,cACF;CAEA,MAAM,mBAAmB,GACvB,mCACA,YAAY,iBACZ;EACE,QAAQ,SAAS,QAAQ,SAAS;EAClC,UAAU,SAAS;EACnB,cAAc,SAAS;CACzB,CACF;CAEA,MAAM,eAAe,GACnB,6CACA,YAAY,eACd;CAEA,MAAM,kBAAkB,GACtB,sBACA,UAAU,yBAAyB,eACrC;CAEA,MAAM,mBAAmB,GAAG,UAAU,SAAS;CAE/C,OACE,qBAAC,OAAD;EAAK,WAAW;EAAhB,UAAA;GACG,SACC,qBAAC,MAAD;IACE,IAAG;IACH,SAAS;IACT,WAAW;IACX,SAAQ;IAJV,UAAA,CAMG,OACA,YACC,oBAAC,QAAD;KAAM,WAAU;KAAkC,UAAA;IAAO,CAAA,CAEvD;;GAGR,qBAAC,OAAD;IAAK,WAAW;IAAhB,UAAA;KACG,iBACC,oBAAC,OAAD;MAAK,WAAW;MAAmB,UAAA;KAAmB,CAAA;KAIxD,oBAAC,YAAD;MACE,KAAK,UAAU,CAAC,aAAa,GAAG,CAAC;MACjC,IAAI;MACG;MACP,UAAU;MACG;MACH;MACA;MACC;MACL;MACN,oBAAkB;MAClB,gBAAc,WAAW,KAAA;MACzB,WAAW;MACX,GAAI;KACL,CAAA;KAEA,kBACC,oBAAC,OAAD;MAAK,WAAW;MAAmB,UAAA;KAAoB,CAAA;IAEtD;;GAEJ,YACC,oBAAC,MAAD;IACE,IAAI;IACJ,WAAW;IACX,SAAQ;IACR,QAAO;IAEN,UAAA;GACG,CAAA;EAEL;;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
@@ -133,7 +133,7 @@ function TypeaheadView({ root, state, ids, input, selection, list, createOption,
|
|
|
133
133
|
...root.props,
|
|
134
134
|
"data-testid": dataTestId,
|
|
135
135
|
onBlur: handleBlur,
|
|
136
|
-
className: cn("w-full cursor-text border border-
|
|
136
|
+
className: cn("w-full cursor-text border border-input bg-input text-primary transition-colors", multiple ? "flex flex-wrap items-center gap-space-1" : "flex items-center gap-space-1 overflow-hidden", !disabled && !isError && "[&:hover:not(:focus-within)]:border-input-hover focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]", controlHeightClass, multiple && {
|
|
137
137
|
"px-space-1 py-0": size === "xs",
|
|
138
138
|
"px-space-1 py-px": size === "sm",
|
|
139
139
|
"px-space-2 py-0.5": size === "md",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeaheadView.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadView.tsx"],"sourcesContent":["/* eslint-disable max-lines -- Keep the control, tag layout, and popover rendering together in this view. */\nimport type {\n FocusEvent,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n} from 'react';\nimport { useRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Command, CommandEmpty, CommandItem, CommandList } from '../Command';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverAnchor, PopoverContent } from '../Popover';\nimport { Text } from '../Text';\nimport type {\n TypeaheadListItem,\n TypeaheadMultipleValue,\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n TypeaheadTagProps,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\nimport {\n TypeaheadClearButton,\n TypeaheadCreateOption,\n TypeaheadDefaultOption,\n TypeaheadDefaultTag,\n} from './TypeaheadParts';\n\ninterface TypeaheadViewRootProps {\n ref: Ref<HTMLDivElement>;\n props: HTMLAttributes<HTMLDivElement>;\n handleBlur: (event: FocusEvent<HTMLDivElement>) => void;\n dataTestId?: string;\n className?: string;\n}\n\ninterface TypeaheadViewState {\n size: TypeaheadSize;\n disabled: boolean;\n isError: boolean;\n multiple?: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\ninterface TypeaheadViewIds {\n commandLabel: string;\n resolvedInputId: string;\n listId: string;\n selectedSummaryId: string;\n inputAriaLabel?: string;\n}\n\ninterface TypeaheadViewInputProps {\n value: string;\n onValueChange: (value: string) => void;\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;\n placeholder: string;\n leftDecorator?: ReactNode;\n showPlaceholderWithValues: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n setNode: (node: HTMLInputElement | null) => void;\n focus: () => void;\n}\n\ninterface TypeaheadViewSelectionProps<TOption> {\n selectedValues: TypeaheadMultipleValue<TOption>;\n selectedKeys: Set<string>;\n getTagProps: (params: { index: number }) => TypeaheadTagProps;\n renderTags?: (\n value: TypeaheadMultipleValue<TOption>,\n getTagProps: (params: { index: number }) => TypeaheadTagProps\n ) => ReactNode;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n showClearButton: boolean;\n clearValue: () => void;\n forcePopupIcon: boolean;\n selectedSummary?: string;\n}\n\ninterface TypeaheadViewListProps<TOption> {\n ref: Ref<HTMLDivElement>;\n items: TypeaheadListItem<TOption>[];\n emptyText: string;\n emptyState?: ReactNode;\n listFooter?: ReactNode;\n hideEmptyList: boolean;\n optionIsDisabled: (item: TypeaheadListItem<TOption>) => boolean;\n selectValue: (selected: TypeaheadSelectedValue<TOption>) => void;\n renderOption?: (\n option: TOption,\n state: TypeaheadRenderOptionState\n ) => ReactNode;\n}\n\ninterface TypeaheadViewCreateOptionProps {\n show: boolean;\n inputValue: string;\n label?: ReactNode;\n onCreate: () => void;\n}\n\ninterface TypeaheadViewProps<TOption> {\n root: TypeaheadViewRootProps;\n state: TypeaheadViewState;\n ids: TypeaheadViewIds;\n input: TypeaheadViewInputProps;\n selection: TypeaheadViewSelectionProps<TOption>;\n list: TypeaheadViewListProps<TOption>;\n createOption: TypeaheadViewCreateOptionProps;\n popoverContentRef: Ref<HTMLDivElement>;\n}\n\nconst CONTROL_RADIUS_CLASSES = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst MULTIPLE_INPUT_HEIGHT_CLASSES = {\n xs: 'h-4',\n sm: 'h-5',\n md: 'h-6',\n lg: 'h-6',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst INPUT_TEXT_CLASSES = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs leading-normal',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n} as const satisfies Record<TypeaheadSize, string>;\n\nexport function TypeaheadView<TOption>({\n root,\n state,\n ids,\n input,\n selection,\n list,\n createOption,\n popoverContentRef,\n}: TypeaheadViewProps<TOption>) {\n const controlRef = useRef<HTMLDivElement | null>(null);\n const preventInputDismiss = (event: Event) => {\n if (\n open &&\n event.target instanceof HTMLInputElement &&\n event.target.getAttribute('role') === 'combobox' &&\n controlRef.current?.contains(event.target)\n ) {\n event.preventDefault();\n }\n };\n // Escape inside the input must close this typeahead before ancestor layers\n // react to it; document-level capture listeners would otherwise dismiss the\n // enclosing dialog first.\n const handleEscapeKeyDown = (event: globalThis.KeyboardEvent) => {\n if (!open) return;\n event.preventDefault();\n setOpen(false);\n };\n const { ref: rootRef, handleBlur, dataTestId, className } = root;\n const { size, disabled, isError, multiple, open, setOpen } = state;\n const {\n commandLabel,\n resolvedInputId,\n listId,\n selectedSummaryId,\n inputAriaLabel,\n } = ids;\n const {\n value: inputValue,\n onValueChange: handleInputValueChange,\n onKeyDown: handleKeyDown,\n placeholder,\n leftDecorator,\n showPlaceholderWithValues,\n autoFocus,\n autoComplete,\n setNode: setInputNode,\n focus: focusInput,\n } = input;\n const {\n selectedValues,\n selectedKeys,\n getTagProps,\n renderTags,\n getLabel,\n getValue,\n showClearButton,\n clearValue,\n forcePopupIcon,\n selectedSummary,\n } = selection;\n const {\n ref: listRef,\n items,\n emptyText,\n emptyState,\n listFooter,\n hideEmptyList,\n optionIsDisabled,\n selectValue,\n renderOption,\n } = list;\n const hasValue = selectedValues.length > 0;\n const showEmptyState =\n items.length === 0 &&\n !createOption.show &&\n (emptyState != null || !hideEmptyList);\n const controlHeightClass = multiple\n ? CONTROL_SIZES[size].minHeightClassName\n : CONTROL_SIZES[size].heightClassName;\n const controlPaddingClass =\n size === 'xs' || size === 'sm' ? 'px-space-2' : 'px-space-3';\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n const renderedTags =\n multiple &&\n (renderTags\n ? renderTags(selectedValues, getTagProps)\n : selectedValues.map((selected, index) => {\n const tagProps = getTagProps({ index });\n return (\n <TypeaheadDefaultTag\n key={`${getValue(selected)}-${index}`}\n selected={selected}\n index={index}\n disabled={disabled}\n size={size}\n getLabel={getLabel}\n getValue={getValue}\n onRemove={tagProps.onDelete}\n />\n );\n }));\n const inputField = (\n <div\n className={cn(\n 'flex items-center gap-space-2',\n multiple ? 'min-w-0 flex-1' : 'flex-1',\n !multiple && (size === 'xs' ? 'min-w-12' : 'min-w-16')\n )}\n >\n {leftDecorator != null ? (\n <div\n className={cn(\n 'flex min-w-0 shrink items-center text-icon-tertiary',\n disabled && 'text-icon-disabled'\n )}\n >\n {leftDecorator}\n </div>\n ) : !multiple && !hasValue ? (\n <Icon\n aria-hidden\n icon={MagnifyingGlassIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={disabled ? 'text-icon-disabled' : 'text-icon-tertiary'}\n weight=\"regular\"\n />\n ) : null}\n {/*\n cmdk rewrites some of these combobox attributes as the query changes, so\n useTypeaheadDomSync re-asserts them imperatively. Keep the two attribute\n sets in sync when editing either here or in that hook.\n */}\n <CommandPrimitive.Input\n ref={setInputNode}\n id={resolvedInputId}\n value={inputValue}\n onValueChange={handleInputValueChange}\n onFocus={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={handleKeyDown}\n placeholder={\n hasValue && multiple && !showPlaceholderWithValues\n ? undefined\n : placeholder\n }\n disabled={disabled}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-invalid={isError || undefined}\n aria-describedby={multiple ? selectedSummaryId : undefined}\n aria-label={inputAriaLabel}\n className={cn(\n 'min-w-0 max-w-full border-none bg-transparent p-0 outline-hidden placeholder:text-placeholder',\n INPUT_TEXT_CLASSES[size],\n disabled &&\n 'cursor-not-allowed text-disabled placeholder:text-disabled',\n multiple\n ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], 'w-full')\n : 'h-full w-full flex-1'\n )}\n />\n </div>\n );\n const actionControls = (\n <div\n className={cn(\n 'flex shrink-0 items-center gap-space-1 text-icon-tertiary',\n multiple ? 'self-center' : 'ml-auto'\n )}\n style={{\n marginInlineEnd:\n showClearButton && !forcePopupIcon\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined,\n }}\n >\n {showClearButton && (\n <TypeaheadClearButton\n size={size}\n label={multiple ? 'Clear selections' : 'Clear selection'}\n onClick={(event) => {\n event.stopPropagation();\n clearValue();\n }}\n />\n )}\n {forcePopupIcon && (\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={cn(\n 'text-icon-tertiary transition-transform',\n disabled && 'text-icon-disabled',\n open && 'rotate-180'\n )}\n weight=\"regular\"\n />\n )}\n </div>\n );\n\n return (\n <Command\n ref={rootRef}\n shouldFilter={false}\n label={commandLabel}\n className=\"overflow-visible bg-transparent\"\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverAnchor asChild>\n <div\n ref={controlRef}\n {...root.props}\n data-testid={dataTestId}\n onBlur={handleBlur}\n className={cn(\n 'w-full cursor-text border border-muted bg-input text-primary transition-colors',\n multiple\n ? 'flex flex-wrap items-center gap-space-1'\n : 'flex items-center gap-space-1 overflow-hidden',\n !disabled &&\n 'focus-within:bg-input hover:bg-elevated-hover',\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-subtle focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]',\n controlHeightClass,\n multiple && {\n 'px-space-1 py-0': size === 'xs',\n 'px-space-1 py-px': size === 'sm',\n 'px-space-2 py-0.5': size === 'md',\n 'px-space-3 py-space-1': size === 'lg',\n },\n !multiple && controlPaddingClass,\n CONTROL_RADIUS_CLASSES[size],\n !disabled && isError && 'border-error focus-within:border-error',\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n className\n )}\n onClick={(event) => {\n root.props.onClick?.(event);\n if (!disabled) {\n focusInput();\n setOpen(true);\n }\n }}\n >\n {multiple ? (\n <>\n {renderedTags}\n <div className=\"flex min-w-16 flex-1 items-center gap-space-1\">\n {inputField}\n {actionControls}\n </div>\n </>\n ) : (\n <>\n {inputField}\n {actionControls}\n </>\n )}\n </div>\n </PopoverAnchor>\n\n {multiple && (\n <span\n id={selectedSummaryId}\n className=\"sr-only\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {selectedSummary}\n </span>\n )}\n\n <PopoverContent\n ref={popoverContentRef}\n className=\"w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-popover p-space-1 text-primary\"\n align=\"start\"\n sideOffset={4}\n onEscapeKeyDown={handleEscapeKeyDown}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={preventInputDismiss}\n onInteractOutside={preventInputDismiss}\n >\n <CommandList\n ref={listRef}\n id={listId}\n aria-label={`${commandLabel} options`}\n aria-multiselectable={multiple ? true : undefined}\n className=\"max-h-[18.75rem]\"\n >\n {showEmptyState && (\n <CommandEmpty>\n {emptyState ?? (\n <Text variant=\"sm\" color=\"secondary\">\n {emptyText}\n </Text>\n )}\n </CommandEmpty>\n )}\n\n {items.map((item) => {\n const { option } = item;\n const optionKey = getValue(option);\n const optionLabel = getLabel(option);\n const selected = selectedKeys.has(optionKey);\n const optionDisabled = optionIsDisabled(item);\n const optionState = {\n selected,\n disabled: optionDisabled,\n inputValue,\n };\n\n return (\n <CommandItem\n key={optionKey}\n value={optionKey}\n disabled={optionDisabled}\n keywords={\n isTypeaheadOption(option)\n ? [optionLabel, ...(option.keywords ?? [])]\n : [optionLabel]\n }\n onSelect={() => selectValue(option)}\n aria-checked={multiple ? selected : undefined}\n size={itemRowSize}\n className={cn(\n 'flex items-center gap-space-2 text-primary',\n optionDisabled && 'text-disabled'\n )}\n >\n {renderOption && item.source === 'option' ? (\n renderOption(option as TOption, optionState)\n ) : (\n <TypeaheadDefaultOption\n option={option}\n state={optionState}\n getLabel={getLabel}\n size={itemRowSize}\n />\n )}\n </CommandItem>\n );\n })}\n\n {createOption.show && (\n <CommandItem\n value={`__typeahead_create__${createOption.inputValue}`}\n keywords={[createOption.inputValue]}\n onSelect={createOption.onCreate}\n size={itemRowSize}\n aria-label={\n createOption.inputValue\n ? `Add ${createOption.inputValue}`\n : 'Add new'\n }\n className=\"flex items-center gap-space-2 text-primary\"\n >\n <TypeaheadCreateOption\n inputValue={createOption.inputValue}\n label={createOption.label}\n />\n </CommandItem>\n )}\n\n {listFooter}\n </CommandList>\n </PopoverContent>\n </Popover>\n </Command>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6HA,IAAM,yBAAyB;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,gCAAgC;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAgB,cAAuB,EACrC,MACA,OACA,KACA,OACA,WACA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,oBAAC,cAAD,EAAA,UACG,cACC,oBAAC,MAAD;QAAM,SAAQ;QAAK,OAAM;QACtB,UAAA;OACG,CAAA,EAEI,CAAA;OAGf,MAAM,KAAK,SAAS;QACnB,MAAM,EAAE,WAAW;QACnB,MAAM,YAAY,SAAS,MAAM;QACjC,MAAM,cAAc,SAAS,MAAM;QACnC,MAAM,WAAW,aAAa,IAAI,SAAS;QAC3C,MAAM,iBAAiB,iBAAiB,IAAI;QAC5C,MAAM,cAAc;SAClB;SACA,UAAU;SACV;QACF;QAEA,OACE,oBAAC,aAAD;SAEE,OAAO;SACP,UAAU;SACV,UACE,kBAAkB,MAAM,IACpB,CAAC,aAAa,GAAI,OAAO,YAAY,CAAC,CAAE,IACxC,CAAC,WAAW;SAElB,gBAAgB,YAAY,MAAM;SAClC,gBAAc,WAAW,WAAW,KAAA;SACpC,MAAM;SACN,WAAW,GACT,8CACA,kBAAkB,eACpB;SAEC,UAAA,gBAAgB,KAAK,WAAW,WAC/B,aAAa,QAAmB,WAAW,IAE3C,oBAAC,wBAAD;UACU;UACR,OAAO;UACG;UACV,MAAM;SACP,CAAA;QAEQ,GA1BN,SA0BM;OAEjB,CAAC;OAEA,aAAa,QACZ,oBAAC,aAAD;QACE,OAAO,uBAAuB,aAAa;QAC3C,UAAU,CAAC,aAAa,UAAU;QAClC,UAAU,aAAa;QACvB,MAAM;QACN,cACE,aAAa,aACT,OAAO,aAAa,eACpB;QAEN,WAAU;QAEV,UAAA,oBAAC,uBAAD;SACE,YAAY,aAAa;SACzB,OAAO,aAAa;QACrB,CAAA;OACU,CAAA;OAGd;MACU;;IACC,CAAA;GACT;;CACF,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"TypeaheadView.js","names":[],"sources":["../../../src/components/Typeahead/TypeaheadView.tsx"],"sourcesContent":["/* eslint-disable max-lines -- Keep the control, tag layout, and popover rendering together in this view. */\nimport type {\n FocusEvent,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n} from 'react';\nimport { useRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CaretDownIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type OptionRowSize } from '../../utils/componentSizes';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport { Command, CommandEmpty, CommandItem, CommandList } from '../Command';\nimport { Icon } from '../Icon';\nimport { Popover, PopoverAnchor, PopoverContent } from '../Popover';\nimport { Text } from '../Text';\nimport type {\n TypeaheadListItem,\n TypeaheadMultipleValue,\n TypeaheadRenderOptionState,\n TypeaheadSelectedValue,\n TypeaheadSize,\n TypeaheadTagProps,\n} from './Typeahead.types';\nimport { isTypeaheadOption } from './Typeahead.utils';\nimport {\n TypeaheadClearButton,\n TypeaheadCreateOption,\n TypeaheadDefaultOption,\n TypeaheadDefaultTag,\n} from './TypeaheadParts';\n\ninterface TypeaheadViewRootProps {\n ref: Ref<HTMLDivElement>;\n props: HTMLAttributes<HTMLDivElement>;\n handleBlur: (event: FocusEvent<HTMLDivElement>) => void;\n dataTestId?: string;\n className?: string;\n}\n\ninterface TypeaheadViewState {\n size: TypeaheadSize;\n disabled: boolean;\n isError: boolean;\n multiple?: boolean;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\ninterface TypeaheadViewIds {\n commandLabel: string;\n resolvedInputId: string;\n listId: string;\n selectedSummaryId: string;\n inputAriaLabel?: string;\n}\n\ninterface TypeaheadViewInputProps {\n value: string;\n onValueChange: (value: string) => void;\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;\n placeholder: string;\n leftDecorator?: ReactNode;\n showPlaceholderWithValues: boolean;\n autoFocus?: boolean;\n autoComplete?: string;\n setNode: (node: HTMLInputElement | null) => void;\n focus: () => void;\n}\n\ninterface TypeaheadViewSelectionProps<TOption> {\n selectedValues: TypeaheadMultipleValue<TOption>;\n selectedKeys: Set<string>;\n getTagProps: (params: { index: number }) => TypeaheadTagProps;\n renderTags?: (\n value: TypeaheadMultipleValue<TOption>,\n getTagProps: (params: { index: number }) => TypeaheadTagProps\n ) => ReactNode;\n getLabel: (option: TypeaheadSelectedValue<TOption>) => string;\n getValue: (option: TypeaheadSelectedValue<TOption>) => string;\n showClearButton: boolean;\n clearValue: () => void;\n forcePopupIcon: boolean;\n selectedSummary?: string;\n}\n\ninterface TypeaheadViewListProps<TOption> {\n ref: Ref<HTMLDivElement>;\n items: TypeaheadListItem<TOption>[];\n emptyText: string;\n emptyState?: ReactNode;\n listFooter?: ReactNode;\n hideEmptyList: boolean;\n optionIsDisabled: (item: TypeaheadListItem<TOption>) => boolean;\n selectValue: (selected: TypeaheadSelectedValue<TOption>) => void;\n renderOption?: (\n option: TOption,\n state: TypeaheadRenderOptionState\n ) => ReactNode;\n}\n\ninterface TypeaheadViewCreateOptionProps {\n show: boolean;\n inputValue: string;\n label?: ReactNode;\n onCreate: () => void;\n}\n\ninterface TypeaheadViewProps<TOption> {\n root: TypeaheadViewRootProps;\n state: TypeaheadViewState;\n ids: TypeaheadViewIds;\n input: TypeaheadViewInputProps;\n selection: TypeaheadViewSelectionProps<TOption>;\n list: TypeaheadViewListProps<TOption>;\n createOption: TypeaheadViewCreateOptionProps;\n popoverContentRef: Ref<HTMLDivElement>;\n}\n\nconst CONTROL_RADIUS_CLASSES = {\n xs: 'rounded-xs',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-md',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst MULTIPLE_INPUT_HEIGHT_CLASSES = {\n xs: 'h-4',\n sm: 'h-5',\n md: 'h-6',\n lg: 'h-6',\n} as const satisfies Record<TypeaheadSize, string>;\n\nconst INPUT_TEXT_CLASSES = {\n xs: 'text-xxs leading-[1.15]',\n sm: 'text-xs leading-normal',\n md: 'text-sm leading-normal',\n lg: 'text-sm leading-normal',\n} as const satisfies Record<TypeaheadSize, string>;\n\nexport function TypeaheadView<TOption>({\n root,\n state,\n ids,\n input,\n selection,\n list,\n createOption,\n popoverContentRef,\n}: TypeaheadViewProps<TOption>) {\n const controlRef = useRef<HTMLDivElement | null>(null);\n const preventInputDismiss = (event: Event) => {\n if (\n open &&\n event.target instanceof HTMLInputElement &&\n event.target.getAttribute('role') === 'combobox' &&\n controlRef.current?.contains(event.target)\n ) {\n event.preventDefault();\n }\n };\n // Escape inside the input must close this typeahead before ancestor layers\n // react to it; document-level capture listeners would otherwise dismiss the\n // enclosing dialog first.\n const handleEscapeKeyDown = (event: globalThis.KeyboardEvent) => {\n if (!open) return;\n event.preventDefault();\n setOpen(false);\n };\n const { ref: rootRef, handleBlur, dataTestId, className } = root;\n const { size, disabled, isError, multiple, open, setOpen } = state;\n const {\n commandLabel,\n resolvedInputId,\n listId,\n selectedSummaryId,\n inputAriaLabel,\n } = ids;\n const {\n value: inputValue,\n onValueChange: handleInputValueChange,\n onKeyDown: handleKeyDown,\n placeholder,\n leftDecorator,\n showPlaceholderWithValues,\n autoFocus,\n autoComplete,\n setNode: setInputNode,\n focus: focusInput,\n } = input;\n const {\n selectedValues,\n selectedKeys,\n getTagProps,\n renderTags,\n getLabel,\n getValue,\n showClearButton,\n clearValue,\n forcePopupIcon,\n selectedSummary,\n } = selection;\n const {\n ref: listRef,\n items,\n emptyText,\n emptyState,\n listFooter,\n hideEmptyList,\n optionIsDisabled,\n selectValue,\n renderOption,\n } = list;\n const hasValue = selectedValues.length > 0;\n const showEmptyState =\n items.length === 0 &&\n !createOption.show &&\n (emptyState != null || !hideEmptyList);\n const controlHeightClass = multiple\n ? CONTROL_SIZES[size].minHeightClassName\n : CONTROL_SIZES[size].heightClassName;\n const controlPaddingClass =\n size === 'xs' || size === 'sm' ? 'px-space-2' : 'px-space-3';\n const itemRowSize: OptionRowSize =\n size === 'xs' || size === 'sm' ? 'sm' : 'md';\n const renderedTags =\n multiple &&\n (renderTags\n ? renderTags(selectedValues, getTagProps)\n : selectedValues.map((selected, index) => {\n const tagProps = getTagProps({ index });\n return (\n <TypeaheadDefaultTag\n key={`${getValue(selected)}-${index}`}\n selected={selected}\n index={index}\n disabled={disabled}\n size={size}\n getLabel={getLabel}\n getValue={getValue}\n onRemove={tagProps.onDelete}\n />\n );\n }));\n const inputField = (\n <div\n className={cn(\n 'flex items-center gap-space-2',\n multiple ? 'min-w-0 flex-1' : 'flex-1',\n !multiple && (size === 'xs' ? 'min-w-12' : 'min-w-16')\n )}\n >\n {leftDecorator != null ? (\n <div\n className={cn(\n 'flex min-w-0 shrink items-center text-icon-tertiary',\n disabled && 'text-icon-disabled'\n )}\n >\n {leftDecorator}\n </div>\n ) : !multiple && !hasValue ? (\n <Icon\n aria-hidden\n icon={MagnifyingGlassIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={disabled ? 'text-icon-disabled' : 'text-icon-tertiary'}\n weight=\"regular\"\n />\n ) : null}\n {/*\n cmdk rewrites some of these combobox attributes as the query changes, so\n useTypeaheadDomSync re-asserts them imperatively. Keep the two attribute\n sets in sync when editing either here or in that hook.\n */}\n <CommandPrimitive.Input\n ref={setInputNode}\n id={resolvedInputId}\n value={inputValue}\n onValueChange={handleInputValueChange}\n onFocus={() => {\n if (!disabled) {\n setOpen(true);\n }\n }}\n onKeyDown={handleKeyDown}\n placeholder={\n hasValue && multiple && !showPlaceholderWithValues\n ? undefined\n : placeholder\n }\n disabled={disabled}\n autoFocus={autoFocus}\n autoComplete={autoComplete}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n aria-invalid={isError || undefined}\n aria-describedby={multiple ? selectedSummaryId : undefined}\n aria-label={inputAriaLabel}\n className={cn(\n 'min-w-0 max-w-full border-none bg-transparent p-0 outline-hidden placeholder:text-placeholder',\n INPUT_TEXT_CLASSES[size],\n disabled &&\n 'cursor-not-allowed text-disabled placeholder:text-disabled',\n multiple\n ? cn(MULTIPLE_INPUT_HEIGHT_CLASSES[size], 'w-full')\n : 'h-full w-full flex-1'\n )}\n />\n </div>\n );\n const actionControls = (\n <div\n className={cn(\n 'flex shrink-0 items-center gap-space-1 text-icon-tertiary',\n multiple ? 'self-center' : 'ml-auto'\n )}\n style={{\n marginInlineEnd:\n showClearButton && !forcePopupIcon\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined,\n }}\n >\n {showClearButton && (\n <TypeaheadClearButton\n size={size}\n label={multiple ? 'Clear selections' : 'Clear selection'}\n onClick={(event) => {\n event.stopPropagation();\n clearValue();\n }}\n />\n )}\n {forcePopupIcon && (\n <Icon\n aria-hidden\n icon={CaretDownIcon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={cn(\n 'text-icon-tertiary transition-transform',\n disabled && 'text-icon-disabled',\n open && 'rotate-180'\n )}\n weight=\"regular\"\n />\n )}\n </div>\n );\n\n return (\n <Command\n ref={rootRef}\n shouldFilter={false}\n label={commandLabel}\n className=\"overflow-visible bg-transparent\"\n >\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverAnchor asChild>\n <div\n ref={controlRef}\n {...root.props}\n data-testid={dataTestId}\n onBlur={handleBlur}\n className={cn(\n 'w-full cursor-text border border-input bg-input text-primary transition-colors',\n multiple\n ? 'flex flex-wrap items-center gap-space-1'\n : 'flex items-center gap-space-1 overflow-hidden',\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-input-hover focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]',\n controlHeightClass,\n multiple && {\n 'px-space-1 py-0': size === 'xs',\n 'px-space-1 py-px': size === 'sm',\n 'px-space-2 py-0.5': size === 'md',\n 'px-space-3 py-space-1': size === 'lg',\n },\n !multiple && controlPaddingClass,\n CONTROL_RADIUS_CLASSES[size],\n !disabled && isError && 'border-error focus-within:border-error',\n disabled &&\n 'cursor-not-allowed border-muted bg-input-disabled text-disabled',\n className\n )}\n onClick={(event) => {\n root.props.onClick?.(event);\n if (!disabled) {\n focusInput();\n setOpen(true);\n }\n }}\n >\n {multiple ? (\n <>\n {renderedTags}\n <div className=\"flex min-w-16 flex-1 items-center gap-space-1\">\n {inputField}\n {actionControls}\n </div>\n </>\n ) : (\n <>\n {inputField}\n {actionControls}\n </>\n )}\n </div>\n </PopoverAnchor>\n\n {multiple && (\n <span\n id={selectedSummaryId}\n className=\"sr-only\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {selectedSummary}\n </span>\n )}\n\n <PopoverContent\n ref={popoverContentRef}\n className=\"w-[var(--radix-popover-trigger-width)] min-w-48 max-w-[calc(100vw-1rem)] bg-popover p-space-1 text-primary\"\n align=\"start\"\n sideOffset={4}\n onEscapeKeyDown={handleEscapeKeyDown}\n onOpenAutoFocus={(event) => event.preventDefault()}\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={preventInputDismiss}\n onInteractOutside={preventInputDismiss}\n >\n <CommandList\n ref={listRef}\n id={listId}\n aria-label={`${commandLabel} options`}\n aria-multiselectable={multiple ? true : undefined}\n className=\"max-h-[18.75rem]\"\n >\n {showEmptyState && (\n <CommandEmpty>\n {emptyState ?? (\n <Text variant=\"sm\" color=\"secondary\">\n {emptyText}\n </Text>\n )}\n </CommandEmpty>\n )}\n\n {items.map((item) => {\n const { option } = item;\n const optionKey = getValue(option);\n const optionLabel = getLabel(option);\n const selected = selectedKeys.has(optionKey);\n const optionDisabled = optionIsDisabled(item);\n const optionState = {\n selected,\n disabled: optionDisabled,\n inputValue,\n };\n\n return (\n <CommandItem\n key={optionKey}\n value={optionKey}\n disabled={optionDisabled}\n keywords={\n isTypeaheadOption(option)\n ? [optionLabel, ...(option.keywords ?? [])]\n : [optionLabel]\n }\n onSelect={() => selectValue(option)}\n aria-checked={multiple ? selected : undefined}\n size={itemRowSize}\n className={cn(\n 'flex items-center gap-space-2 text-primary',\n optionDisabled && 'text-disabled'\n )}\n >\n {renderOption && item.source === 'option' ? (\n renderOption(option as TOption, optionState)\n ) : (\n <TypeaheadDefaultOption\n option={option}\n state={optionState}\n getLabel={getLabel}\n size={itemRowSize}\n />\n )}\n </CommandItem>\n );\n })}\n\n {createOption.show && (\n <CommandItem\n value={`__typeahead_create__${createOption.inputValue}`}\n keywords={[createOption.inputValue]}\n onSelect={createOption.onCreate}\n size={itemRowSize}\n aria-label={\n createOption.inputValue\n ? `Add ${createOption.inputValue}`\n : 'Add new'\n }\n className=\"flex items-center gap-space-2 text-primary\"\n >\n <TypeaheadCreateOption\n inputValue={createOption.inputValue}\n label={createOption.label}\n />\n </CommandItem>\n )}\n\n {listFooter}\n </CommandList>\n </PopoverContent>\n </Popover>\n </Command>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6HA,IAAM,yBAAyB;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,gCAAgC;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,IAAM,qBAAqB;CACzB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAgB,cAAuB,EACrC,MACA,OACA,KACA,OACA,WACA,MACA,cACA,qBAC8B;CAC9B,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,uBAAuB,UAAiB;EAC5C,IACE,QACA,MAAM,kBAAkB,oBACxB,MAAM,OAAO,aAAa,MAAM,MAAM,cACtC,WAAW,SAAS,SAAS,MAAM,MAAM,GAEzC,MAAM,eAAe;CAEzB;CAIA,MAAM,uBAAuB,UAAoC;EAC/D,IAAI,CAAC,MAAM;EACX,MAAM,eAAe;EACrB,QAAQ,KAAK;CACf;CACA,MAAM,EAAE,KAAK,SAAS,YAAY,YAAY,cAAc;CAC5D,MAAM,EAAE,MAAM,UAAU,SAAS,UAAU,MAAM,YAAY;CAC7D,MAAM,EACJ,cACA,iBACA,QACA,mBACA,mBACE;CACJ,MAAM,EACJ,OAAO,YACP,eAAe,wBACf,WAAW,eACX,aACA,eACA,2BACA,WACA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