@langchain/macaw-components 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/base.css +5 -5
  2. package/dist/catalog.json +493 -480
  3. package/dist/components/Button/constants.js +2 -2
  4. package/dist/components/Button/constants.js.map +1 -1
  5. package/dist/components/ChartTooltip/ChartTooltip.js +2 -2
  6. package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -1
  7. package/dist/components/Command/Command.js +1 -1
  8. package/dist/components/Command/Command.js.map +1 -1
  9. package/dist/components/ContextMenu/ContextMenu.js +1 -1
  10. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/components/CopyButton/CopyButton.d.ts +3 -2
  12. package/dist/components/CopyButton/CopyButton.js +5 -0
  13. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  14. package/dist/components/Dialog/index.d.ts +3 -2
  15. package/dist/components/Dialog/index.js +44 -17
  16. package/dist/components/Dialog/index.js.map +1 -1
  17. package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
  18. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  19. package/dist/components/GroupedTabs/GroupedTabs.d.ts +3 -2
  20. package/dist/components/GroupedTabs/GroupedTabs.js +3 -1
  21. package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -1
  22. package/dist/components/Input/Input.js +7 -6
  23. package/dist/components/Input/Input.js.map +1 -1
  24. package/dist/components/Input/inputStyles.js +4 -4
  25. package/dist/components/Input/inputStyles.js.map +1 -1
  26. package/dist/components/Link/Link.js +3 -3
  27. package/dist/components/Link/Link.js.map +1 -1
  28. package/dist/components/Pane/Pane.d.ts +3 -2
  29. package/dist/components/Pane/Pane.js +107 -101
  30. package/dist/components/Pane/Pane.js.map +1 -1
  31. package/dist/components/Popover/Popover.js +15 -4
  32. package/dist/components/Popover/Popover.js.map +1 -1
  33. package/dist/components/Popover/constants.d.ts +1 -1
  34. package/dist/components/Popover/constants.js +1 -1
  35. package/dist/components/Popover/constants.js.map +1 -1
  36. package/dist/components/Select/Select.d.ts +2 -1
  37. package/dist/components/Select/Select.js +5 -3
  38. package/dist/components/Select/Select.js.map +1 -1
  39. package/dist/components/Select/SelectPrimitive.js +5 -3
  40. package/dist/components/Select/SelectPrimitive.js.map +1 -1
  41. package/dist/components/Tabs/index.d.ts +3 -2
  42. package/dist/components/Tabs/index.js +3 -1
  43. package/dist/components/Tabs/index.js.map +1 -1
  44. package/dist/components/Textarea/Textarea.js +8 -8
  45. package/dist/components/Textarea/Textarea.js.map +1 -1
  46. package/dist/components/Toast/index.js +1 -1
  47. package/dist/components/Toast/index.js.map +1 -1
  48. package/dist/components/Tooltip/Tooltip.js +1 -1
  49. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  50. package/dist/components/Typeahead/TypeaheadView.js +9 -9
  51. package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
  52. package/dist/utilities.css +1 -1
  53. package/dist/utils/ModalLayerContext.d.ts +23 -0
  54. package/dist/utils/ModalLayerContext.js +92 -0
  55. package/dist/utils/ModalLayerContext.js.map +1 -0
  56. package/dist/utils/cn.js +4 -0
  57. package/dist/utils/cn.js.map +1 -1
  58. package/dist/utils/dataAttributes.d.ts +9 -0
  59. package/dist/utils/dataAttributes.js +13 -0
  60. package/dist/utils/dataAttributes.js.map +1 -0
  61. package/docs/DESIGN.md +21 -1
  62. package/docs/STYLES.md +84 -44
  63. package/package.json +2 -2
  64. package/tailwind.preset.cjs +11 -5
@@ -1 +1 @@
1
- {"version":3,"file":"GroupedTabs.js","names":[],"sources":["../../../src/components/GroupedTabs/GroupedTabs.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type ControlSize } from '../../utils/componentSizes';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { Text } from '../Text';\nimport type { TooltipProps } from '../Tooltip';\nimport { Tooltip } from '../Tooltip';\n\ntype GroupedTabsSize = Exclude<ControlSize, 'lg'>;\n\nexport interface GroupedTabOption<T> {\n display?: ReactNode | ((isActive: boolean) => ReactNode);\n value: T;\n disabled?: boolean;\n tooltip?: string | ReactNode;\n tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;\n icon?: IconComponent;\n iconWeight?: IconWeight;\n leftDecorator?: ReactNode;\n rightDecorator?: ReactNode;\n className?: string;\n textClassName?: string;\n 'aria-label'?: string;\n}\n\nexport type GroupedTabsProps<T extends string | number> = {\n value: T;\n onChange: (value: T) => void;\n options: readonly GroupedTabOption<T>[];\n className?: string;\n /** Exact outer group height: xs=20px, sm=24px, md=32px. */\n size?: GroupedTabsSize;\n disabled?: boolean;\n tooltip?: string | ReactNode;\n selectionClassName?: string;\n /** Optional class for the indicator (e.g. to override top/height for custom margins) */\n indicatorClassName?: string;\n};\n\nexport const GroupedTabs = <T extends string | number>({\n value,\n onChange,\n options,\n className,\n size = 'sm',\n disabled,\n tooltip,\n selectionClassName,\n indicatorClassName,\n}: GroupedTabsProps<T>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const [clipState, setClipState] = useState<{\n path: string;\n isFirst: boolean;\n shouldAnimate: boolean;\n }>({ path: '', isFirst: true, shouldAnimate: false });\n const activeIndex = useMemo(\n () => options.findIndex((option) => option.value === value),\n [options, value]\n );\n\n const updateClipState = useCallback(\n (\n container: HTMLDivElement,\n activeButton: HTMLButtonElement,\n shouldAnimate: boolean\n ) => {\n const containerRect = container.getBoundingClientRect();\n const buttonRect = activeButton.getBoundingClientRect();\n const roundValue = size === 'xs' ? '1px' : size === 'sm' ? '2px' : '4px';\n\n const top = buttonRect.top - containerRect.top - container.clientTop;\n const bottom =\n containerRect.bottom - buttonRect.bottom - container.clientTop;\n const left = buttonRect.left - containerRect.left - container.clientLeft;\n const right =\n containerRect.right - buttonRect.right - container.clientLeft;\n\n const path = `inset(${top}px ${right}px ${bottom}px ${left}px round ${roundValue})`;\n setClipState((prev) =>\n prev.path === path\n ? prev\n : {\n path,\n isFirst: false,\n shouldAnimate: shouldAnimate && !prev.isFirst,\n }\n );\n },\n [size]\n );\n\n useEffect(() => {\n const container = containerRef.current;\n const activeButton = buttonRefs.current[activeIndex];\n if (!activeButton || !container) return;\n\n updateClipState(container, activeButton, true);\n\n const observer = new ResizeObserver(() =>\n updateClipState(container, activeButton, false)\n );\n observer.observe(container);\n observer.observe(activeButton);\n\n return () => observer.disconnect();\n }, [activeIndex, updateClipState, value]);\n\n const isActive = (option: GroupedTabOption<T>) => option.value === value;\n return (\n <Tooltip title={tooltip}>\n <div\n ref={containerRef}\n className={cn(\n 'relative box-border flex w-fit border border-subtle bg-surface-level-1 dark:border-muted',\n CONTROL_SIZES[size].heightClassName,\n size === 'md' ? 'p-0.5' : 'p-px',\n size === 'xs' ? 'gap-px' : 'gap-0.5',\n size === 'xs'\n ? 'rounded-[2px]'\n : size === 'sm'\n ? 'rounded-[3px]'\n : 'rounded-sm',\n className\n )}\n >\n {/* Clip-path animated background indicator */}\n {clipState.path && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-0 bg-surface-level-4',\n selectionClassName,\n indicatorClassName\n )}\n style={{\n clipPath: clipState.path,\n transition: clipState.shouldAnimate\n ? 'clip-path 0.25s ease-out, background-color 0.25s ease-out'\n : 'none',\n }}\n />\n )}\n\n {options.map((option, idx) => (\n <Tooltip\n key={option.value}\n title={option.tooltip}\n {...option.tooltipProps}\n >\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n ref={(el) => {\n buttonRefs.current[idx] = el;\n }}\n type=\"button\"\n aria-label={option['aria-label']}\n onClick={() => onChange(option.value)}\n disabled={option.disabled || disabled}\n className={cn(\n 'relative flex h-full items-center gap-space-1',\n 'transition-colors duration-fast',\n {\n 'rounded-xs px-space-1': size === 'xs',\n 'rounded-xs px-space-2': size === 'sm',\n 'rounded-sm px-space-2': size === 'md',\n },\n {\n 'text-primary': isActive(option),\n 'text-secondary hover:bg-surface-level-1-hover':\n !isActive(option),\n },\n (option.disabled || disabled) &&\n 'text-disabled hover:bg-transparent',\n option.className\n )}\n >\n {option.icon && (\n <option.icon\n aria-hidden\n className={size === 'xs' ? 'size-3' : 'size-4'}\n weight={option.iconWeight}\n />\n )}\n {option.leftDecorator}\n {option.display &&\n (typeof option.display === 'function' ? (\n option.display(isActive(option))\n ) : (\n <Text\n variant={size === 'xs' ? 'xs' : 'sm'}\n className={cn('font-medium', option.textClassName)}\n >\n {option.display}\n </Text>\n ))}\n {option.rightDecorator}\n </button>\n </Tooltip>\n ))}\n </div>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;AAyCA,IAAa,eAA0C,EACrD,OACA,UACA,SACA,WACA,OAAO,MACP,UACA,SACA,oBACA,yBACyB;CACzB,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,aAAa,OAAqC,CAAC,CAAC;CAC1D,MAAM,CAAC,WAAW,gBAAgB,SAI/B;EAAE,MAAM;EAAI,SAAS;EAAM,eAAe;CAAM,CAAC;CACpD,MAAM,cAAc,cACZ,QAAQ,WAAW,WAAW,OAAO,UAAU,KAAK,GAC1D,CAAC,SAAS,KAAK,CACjB;CAEA,MAAM,kBAAkB,aAEpB,WACA,cACA,kBACG;EACH,MAAM,gBAAgB,UAAU,sBAAsB;EACtD,MAAM,aAAa,aAAa,sBAAsB;EACtD,MAAM,aAAa,SAAS,OAAO,QAAQ,SAAS,OAAO,QAAQ;EAEnE,MAAM,MAAM,WAAW,MAAM,cAAc,MAAM,UAAU;EAC3D,MAAM,SACJ,cAAc,SAAS,WAAW,SAAS,UAAU;EACvD,MAAM,OAAO,WAAW,OAAO,cAAc,OAAO,UAAU;EAI9D,MAAM,OAAO,SAAS,IAAI,KAFxB,cAAc,QAAQ,WAAW,QAAQ,UAAU,WAEhB,KAAK,OAAO,KAAK,KAAK,WAAW,WAAW;EACjF,cA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C,SAAS,MAAM;KACpB,IACC,OAAO,YAAY,aAClB,sCACF,OAAO,SACT;KAxBF,UAAA;MA0BG,OAAO,QACN,oBAAC,OAAO,MAAR;OACE,eAAA;OACA,WAAW,SAAS,OAAO,WAAW;OACtC,QAAQ,OAAO;MAChB,CAAA;MAEF,OAAO;MACP,OAAO,YACL,OAAO,OAAO,YAAY,aACzB,OAAO,QAAQ,SAAS,MAAM,CAAC,IAE/B,oBAAC,MAAD;OACE,SAAS,SAAS,OAAO,OAAO;OAChC,WAAW,GAAG,eAAe,OAAO,aAAa;OAEhD,UAAA,OAAO;MACJ,CAAA;MAET,OAAO;KACF;;GACD,GApDF,OAAO,KAoDL,CACV,CACE;;CACE,CAAA;AAEb"}
1
+ {"version":3,"file":"GroupedTabs.js","names":[],"sources":["../../../src/components/GroupedTabs/GroupedTabs.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type ControlSize } from '../../utils/componentSizes';\nimport {\n type DataAttributes,\n pickDataAttributes,\n} from '../../utils/dataAttributes';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { Text } from '../Text';\nimport type { TooltipProps } from '../Tooltip';\nimport { Tooltip } from '../Tooltip';\n\ntype GroupedTabsSize = Exclude<ControlSize, 'lg'>;\n\nexport interface GroupedTabOption<T> {\n display?: ReactNode | ((isActive: boolean) => ReactNode);\n value: T;\n disabled?: boolean;\n tooltip?: string | ReactNode;\n tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;\n icon?: IconComponent;\n iconWeight?: IconWeight;\n leftDecorator?: ReactNode;\n rightDecorator?: ReactNode;\n className?: string;\n textClassName?: string;\n 'aria-label'?: string;\n}\n\nexport type GroupedTabsProps<T extends string | number> = {\n value: T;\n onChange: (value: T) => void;\n options: readonly GroupedTabOption<T>[];\n className?: string;\n /** Exact outer group height: xs=20px, sm=24px, md=32px. */\n size?: GroupedTabsSize;\n disabled?: boolean;\n tooltip?: string | ReactNode;\n selectionClassName?: string;\n /** Optional class for the indicator (e.g. to override top/height for custom margins) */\n indicatorClassName?: string;\n} & DataAttributes;\n\nexport const GroupedTabs = <T extends string | number>({\n value,\n onChange,\n options,\n className,\n size = 'sm',\n disabled,\n tooltip,\n selectionClassName,\n indicatorClassName,\n ...rest\n}: GroupedTabsProps<T>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const [clipState, setClipState] = useState<{\n path: string;\n isFirst: boolean;\n shouldAnimate: boolean;\n }>({ path: '', isFirst: true, shouldAnimate: false });\n const activeIndex = useMemo(\n () => options.findIndex((option) => option.value === value),\n [options, value]\n );\n\n const updateClipState = useCallback(\n (\n container: HTMLDivElement,\n activeButton: HTMLButtonElement,\n shouldAnimate: boolean\n ) => {\n const containerRect = container.getBoundingClientRect();\n const buttonRect = activeButton.getBoundingClientRect();\n const roundValue = size === 'xs' ? '1px' : size === 'sm' ? '2px' : '4px';\n\n const top = buttonRect.top - containerRect.top - container.clientTop;\n const bottom =\n containerRect.bottom - buttonRect.bottom - container.clientTop;\n const left = buttonRect.left - containerRect.left - container.clientLeft;\n const right =\n containerRect.right - buttonRect.right - container.clientLeft;\n\n const path = `inset(${top}px ${right}px ${bottom}px ${left}px round ${roundValue})`;\n setClipState((prev) =>\n prev.path === path\n ? prev\n : {\n path,\n isFirst: false,\n shouldAnimate: shouldAnimate && !prev.isFirst,\n }\n );\n },\n [size]\n );\n\n useEffect(() => {\n const container = containerRef.current;\n const activeButton = buttonRefs.current[activeIndex];\n if (!activeButton || !container) return;\n\n updateClipState(container, activeButton, true);\n\n const observer = new ResizeObserver(() =>\n updateClipState(container, activeButton, false)\n );\n observer.observe(container);\n observer.observe(activeButton);\n\n return () => observer.disconnect();\n }, [activeIndex, updateClipState, value]);\n\n const isActive = (option: GroupedTabOption<T>) => option.value === value;\n return (\n <Tooltip title={tooltip}>\n <div\n {...pickDataAttributes(rest)}\n ref={containerRef}\n className={cn(\n 'relative box-border flex w-fit border border-subtle bg-surface-level-1 dark:border-muted',\n CONTROL_SIZES[size].heightClassName,\n size === 'md' ? 'p-0.5' : 'p-px',\n size === 'xs' ? 'gap-px' : 'gap-0.5',\n size === 'xs'\n ? 'rounded-[2px]'\n : size === 'sm'\n ? 'rounded-[3px]'\n : 'rounded-sm',\n className\n )}\n >\n {/* Clip-path animated background indicator */}\n {clipState.path && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-0 bg-surface-level-4',\n selectionClassName,\n indicatorClassName\n )}\n style={{\n clipPath: clipState.path,\n transition: clipState.shouldAnimate\n ? 'clip-path 0.25s ease-out, background-color 0.25s ease-out'\n : 'none',\n }}\n />\n )}\n\n {options.map((option, idx) => (\n <Tooltip\n key={option.value}\n title={option.tooltip}\n {...option.tooltipProps}\n >\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n ref={(el) => {\n buttonRefs.current[idx] = el;\n }}\n type=\"button\"\n aria-label={option['aria-label']}\n onClick={() => onChange(option.value)}\n disabled={option.disabled || disabled}\n className={cn(\n 'relative flex h-full items-center gap-space-1',\n 'transition-colors duration-fast',\n {\n 'rounded-xs px-space-1': size === 'xs',\n 'rounded-xs px-space-2': size === 'sm',\n 'rounded-sm px-space-2': size === 'md',\n },\n {\n 'text-primary': isActive(option),\n 'text-secondary hover:bg-surface-level-1-hover':\n !isActive(option),\n },\n (option.disabled || disabled) &&\n 'text-disabled hover:bg-transparent',\n option.className\n )}\n >\n {option.icon && (\n <option.icon\n aria-hidden\n className={size === 'xs' ? 'size-3' : 'size-4'}\n weight={option.iconWeight}\n />\n )}\n {option.leftDecorator}\n {option.display &&\n (typeof option.display === 'function' ? (\n option.display(isActive(option))\n ) : (\n <Text\n variant={size === 'xs' ? 'xs' : 'sm'}\n className={cn('font-medium', option.textClassName)}\n >\n {option.display}\n </Text>\n ))}\n {option.rightDecorator}\n </button>\n </Tooltip>\n ))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AET,OAAO;KACF;;GACD,GApDF,OAAO,KAoDL,CACV,CACE;;CACE,CAAA;AAEb"}
@@ -33,19 +33,19 @@ function InputIconSlot({ icon, action, size, disabled }) {
33
33
  weight: "regular"
34
34
  }) : null;
35
35
  }
36
- function FileSelection({ size, fileNames, placeholder }) {
36
+ function FileSelection({ size, fileNames, placeholder, disabled }) {
37
37
  const summary = fileNames.length > 1 ? `${fileNames.length} files selected` : fileNames[0];
38
38
  const textClasses = INPUT_TEXT_CLASSES[size];
39
39
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, {
40
40
  "aria-hidden": true,
41
41
  as: "span",
42
- className: cn(textClasses, "min-w-0 flex-1 truncate", summary ? "text-primary" : "text-placeholder"),
42
+ className: cn(textClasses, "min-w-0 flex-1 truncate", summary ? "text-primary" : "text-placeholder", disabled && "text-disabled"),
43
43
  children: summary ?? placeholder ?? "No file selected"
44
44
  }), /* @__PURE__ */ jsx(Text, {
45
45
  "aria-hidden": true,
46
46
  as: "span",
47
47
  weight: "medium",
48
- className: cn(textClasses, "shrink-0 text-secondary"),
48
+ className: cn(textClasses, "shrink-0 text-secondary", disabled && "text-disabled"),
49
49
  children: "Browse"
50
50
  })] });
51
51
  }
@@ -177,14 +177,15 @@ var Input = forwardRef(({ size = "lg", variant = "outlined", leftIcon, rightIcon
177
177
  onClick: isFileInput ? openFilePicker : void 0,
178
178
  children: [
179
179
  effectiveLeftDecorator && /* @__PURE__ */ jsx("div", {
180
- className: "flex items-center text-tertiary",
180
+ className: cn("flex items-center text-tertiary", disabled && "text-disabled"),
181
181
  style: { marginInlineStart: leftActionOffset },
182
182
  children: effectiveLeftDecorator
183
183
  }),
184
184
  isFileInput && /* @__PURE__ */ jsx(FileSelection, {
185
185
  size,
186
186
  fileNames: selectedFileNames,
187
- placeholder
187
+ placeholder,
188
+ disabled
188
189
  }),
189
190
  isDateInput ? /* @__PURE__ */ jsxs("div", {
190
191
  className: cn("relative flex min-w-0 flex-1 items-center", CONTROL_ICON_SIZES[size].sizeVariableClassName),
@@ -198,7 +199,7 @@ var Input = forwardRef(({ size = "lg", variant = "outlined", leftIcon, rightIcon
198
199
  })]
199
200
  }) : nativeInput,
200
201
  effectiveRightDecorator && /* @__PURE__ */ jsx("div", {
201
- className: cn("flex items-center text-tertiary", "gap-space-1"),
202
+ className: cn("flex items-center text-tertiary", "gap-space-1", disabled && "text-disabled"),
202
203
  style: { marginInlineEnd: rightActionOffset },
203
204
  children: effectiveRightDecorator
204
205
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":[],"sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\nimport { forwardRef, useEffect, useId, useRef, useState } from 'react';\n\nimport { useDebouncedCallback } from 'use-debounce';\n\nimport { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank';\nimport { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye';\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash';\nimport { PaperclipIcon } from '@phosphor-icons/react/dist/ssr/Paperclip';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport type { IconComponent } from '../../utils/icon-types';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n INPUT_TEXT_CLASSES,\n} from './inputStyles';\nimport type { InputSize } from './inputStyles';\n\nexport type InputIconAction = Pick<\n ComponentProps<typeof IconButton>,\n 'icon' | 'label' | 'disabled' | 'tooltipProps'\n> & {\n onClick: NonNullable<ComponentProps<typeof IconButton>['onClick']>;\n};\n\nexport interface InputProps {\n /** Exact outer height. The default lg tier preserves the legacy 40px field. */\n size?: InputSize;\n variant?: 'outlined' | 'plain';\n /** Decorative icon. Input owns its size and color. */\n leftIcon?: IconComponent;\n /** Decorative icon. Input owns its size and color. */\n rightIcon?: IconComponent;\n /** Plain icon button. Takes precedence over leftIcon. */\n leftAction?: InputIconAction;\n /** Plain icon button. Takes precedence over rightIcon; precedes the password toggle. */\n rightAction?: InputIconAction;\n /** Custom content; overrides leftIcon/leftAction and the default file icon. */\n leftDecorator?: ReactNode;\n /** Custom content; overrides rightIcon/rightAction. The password toggle remains last. */\n rightDecorator?: ReactNode;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Whether the input has an error state */\n isError?: boolean;\n /** Label text displayed above the input */\n label?: string | ReactNode;\n /** Hint text displayed below the input */\n hintText?: string;\n /** Current input value */\n value?: string | null;\n /** Change handler that will be debounced */\n onChange: (\n value: string,\n event?: React.ChangeEvent<HTMLInputElement>\n ) => void;\n /** Placeholder text */\n placeholder?: string;\n /**\n * Input type. Limited to the \"text-like\" native types that share this\n * component's styled-text rendering and string value contract. `password`\n * renders a masked secret field with a show/hide toggle. `date` uses the\n * browser's native date picker; its value is a `YYYY-MM-DD` string.\n * `datetime-local` uses the native date+time picker; its value is a\n * `YYYY-MM-DDTHH:mm` string in the viewer's local time. `file` is\n * uncontrolled: read the selection from `event.target.files` on the change\n * event, and scope it with `accept`/`multiple`.\n */\n type?:\n | 'text'\n | 'email'\n | 'password'\n | 'number'\n | 'url'\n | 'date'\n | 'datetime-local'\n | 'file';\n /** Debounce delay in milliseconds (default: 300). Ignored for `type=\"file\"`. */\n debounceMs?: number;\n /** Additional CSS classes */\n className?: string;\n /** Input ID for accessibility */\n id?: string;\n /** Input name for forms */\n name?: string;\n /** Whether the field is required */\n required?: boolean;\n /** Auto focus on mount */\n autoFocus?: boolean;\n /** CSS class for the input container */\n inputContainerClassName?: string;\n /**\n * Which files the picker offers, as a comma-separated list of extensions or\n * MIME types (`'.csv,.json'`, `'image/*'`). `type=\"file\"` only. The browser\n * treats this as a filter, not a guarantee — validate the selection too.\n */\n accept?: string;\n /** Whether more than one file can be picked. `type=\"file\"` only. */\n multiple?: boolean;\n}\n\nfunction InputIconSlot({\n icon,\n action,\n size,\n disabled,\n}: {\n icon?: IconComponent;\n action?: InputIconAction;\n size: InputSize;\n disabled: boolean;\n}) {\n const isDisabled = disabled || action?.disabled;\n const colorClassName = isDisabled\n ? 'text-icon-disabled'\n : 'text-icon-secondary';\n\n return action ? (\n <IconButton\n {...action}\n color=\"secondary\"\n variant=\"plain\"\n size={CONTROL_ICON_SIZES[size].buttonSize}\n className={colorClassName}\n iconWeight=\"regular\"\n disabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n />\n ) : icon ? (\n <Icon\n aria-hidden\n icon={icon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={colorClassName}\n weight=\"regular\"\n />\n ) : null;\n}\n\nfunction FileSelection({\n size,\n fileNames,\n placeholder,\n}: {\n size: InputSize;\n fileNames: string[];\n placeholder?: string;\n}) {\n const summary =\n fileNames.length > 1 ? `${fileNames.length} files selected` : fileNames[0];\n const textClasses = INPUT_TEXT_CLASSES[size];\n\n return (\n <>\n <Text\n aria-hidden\n as=\"span\"\n className={cn(\n textClasses,\n 'min-w-0 flex-1 truncate',\n summary ? 'text-primary' : 'text-placeholder'\n )}\n >\n {summary ?? placeholder ?? 'No file selected'}\n </Text>\n <Text\n aria-hidden\n as=\"span\"\n weight=\"medium\"\n className={cn(textClasses, 'shrink-0 text-secondary')}\n >\n Browse\n </Text>\n </>\n );\n}\n\nexport const Input = forwardRef<\n HTMLInputElement,\n InputProps &\n Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof InputProps>\n>(\n (\n {\n size = 'lg',\n variant = 'outlined',\n leftIcon,\n rightIcon,\n leftAction,\n rightAction,\n leftDecorator,\n rightDecorator,\n disabled = false,\n isError = false,\n label,\n hintText,\n value,\n onChange,\n placeholder,\n type = 'text',\n debounceMs = 0,\n className,\n inputContainerClassName,\n id,\n name,\n required = false,\n autoFocus = false,\n accept,\n multiple,\n 'aria-describedby': ariaDescribedBy,\n ...rest\n },\n ref\n ) => {\n const generatedId = useId();\n const inputId = id || generatedId;\n const hintTextId = `${inputId}-hint`;\n const describedBy =\n [hintText ? hintTextId : undefined, ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined;\n const shouldDebounce = debounceMs > 0;\n const isFileInput = type === 'file';\n const isPasswordInput = type === 'password';\n const isDateInput = type === 'date' || type === 'datetime-local';\n const [internalValue, setInternalValue] = useState(value);\n const [isPasswordVisible, setIsPasswordVisible] = useState(false);\n const [selectedFileNames, setSelectedFileNames] = useState<string[]>([]);\n const debouncedOnChange = useDebouncedCallback(onChange, debounceMs);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!shouldDebounce) return;\n return () => debouncedOnChange.flush();\n }, [shouldDebounce, debouncedOnChange]);\n\n // Skip the click forwarded below, which would otherwise re-enter here.\n const openFilePicker = (event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n if (\n disabled ||\n (target instanceof Element &&\n target.closest(\n 'button, a, input, select, textarea, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"true\"]'\n ))\n ) {\n return;\n }\n fileInputRef.current?.click();\n };\n\n useEffect(() => {\n if (shouldDebounce) setInternalValue(value);\n }, [shouldDebounce, value]);\n\n useEffect(() => {\n if (!isPasswordInput) {\n setIsPasswordVisible(false);\n }\n }, [isPasswordInput]);\n\n useEffect(() => {\n const form = isFileInput ? fileInputRef.current?.form : null;\n if (!form) return;\n\n const clearFileSelection = () => setSelectedFileNames([]);\n form.addEventListener('reset', clearFileSelection);\n return () => form.removeEventListener('reset', clearFileSelection);\n }, [isFileInput]);\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n if (isFileInput) {\n onChange(newValue, e);\n setSelectedFileNames(\n Array.from(e.target.files ?? []).map((file) => file.name)\n );\n return;\n }\n\n if (shouldDebounce) {\n setInternalValue(newValue);\n debouncedOnChange(newValue);\n } else {\n onChange(newValue, e);\n }\n };\n\n const inputContainerClasses = getInputContainerClasses({\n size,\n variant,\n isError,\n disabled,\n className: inputContainerClassName,\n });\n\n const inputClasses = isFileInput\n ? 'sr-only'\n : getInputElementClasses({\n size,\n disabled,\n className: cn(\n isPasswordInput && !isPasswordVisible && 'text-security',\n isDateInput && [\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:size-[var(--control-icon-size)]',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:m-0',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:p-0',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:opacity-0',\n ]\n ),\n });\n\n const effectiveLeftIcon =\n leftIcon ?? (isFileInput ? PaperclipIcon : undefined);\n const hasCustomLeftDecorator = leftDecorator != null;\n const hasCustomRightDecorator = rightDecorator != null;\n const effectiveLeftDecorator =\n leftDecorator ??\n (effectiveLeftIcon || leftAction ? (\n <InputIconSlot\n icon={effectiveLeftIcon}\n action={leftAction}\n size={size}\n disabled={disabled}\n />\n ) : null);\n const rightContent =\n rightDecorator ??\n (rightIcon || rightAction ? (\n <InputIconSlot\n icon={rightIcon}\n action={rightAction}\n size={size}\n disabled={disabled}\n />\n ) : null);\n // Offset only known edge buttons by their glyph inset, including the border.\n const leftActionOffset =\n !hasCustomLeftDecorator && leftAction\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined;\n const rightActionOffset =\n isPasswordInput || (!hasCustomRightDecorator && rightAction)\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined;\n const effectiveRightDecorator =\n rightContent || isPasswordInput ? (\n <>\n {rightContent}\n {isPasswordInput && (\n <InputIconSlot\n size={size}\n disabled={disabled}\n action={{\n icon: isPasswordVisible ? EyeSlashIcon : EyeIcon,\n label: 'toggle password visibility',\n tooltipProps: { disabled: true },\n onClick: () => setIsPasswordVisible((show) => !show),\n }}\n />\n )}\n </>\n ) : null;\n\n const nativeInput = (\n // eslint-disable-next-line react/forbid-elements\n <input\n ref={isFileInput ? mergeRefs([fileInputRef, ref]) : ref}\n id={inputId}\n name={name ?? (typeof label === 'string' ? label : undefined)}\n type={\n isPasswordInput ? (isPasswordVisible ? 'text' : 'password') : type\n }\n value={\n isFileInput\n ? undefined\n : shouldDebounce\n ? (internalValue ?? '')\n : value === null\n ? ''\n : value\n }\n onChange={handleInputChange}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n autoFocus={autoFocus}\n accept={accept}\n multiple={multiple}\n aria-describedby={describedBy}\n aria-invalid={isError || undefined}\n className={inputClasses}\n {...rest}\n />\n );\n\n return (\n <div className={cn('w-full', className)}>\n {label && (\n <Text\n as=\"label\"\n htmlFor={inputId}\n className={cn(\n 'mb-space-1 block text-sm font-medium text-primary',\n disabled && 'text-disabled'\n )}\n variant=\"xs\"\n >\n {label}\n {required && (\n <span className=\"ml-space-1 text-error-secondary\">*</span>\n )}\n </Text>\n )}\n\n <div\n className={cn(\n inputContainerClasses,\n isFileInput && !disabled && 'cursor-pointer'\n )}\n onClick={isFileInput ? openFilePicker : undefined}\n >\n {effectiveLeftDecorator && (\n <div\n className={DECORATOR_CLASSES}\n style={{ marginInlineStart: leftActionOffset }}\n >\n {effectiveLeftDecorator}\n </div>\n )}\n\n {isFileInput && (\n <FileSelection\n size={size}\n fileNames={selectedFileNames}\n placeholder={placeholder}\n />\n )}\n\n {isDateInput ? (\n <div\n className={cn(\n 'relative flex min-w-0 flex-1 items-center',\n CONTROL_ICON_SIZES[size].sizeVariableClassName\n )}\n >\n {nativeInput}\n {/* The native picker target stays interactive beneath this glyph. */}\n <span className=\"pointer-events-none absolute inset-y-0 end-0 hidden items-center supports-[selector(input::-webkit-calendar-picker-indicator)]:flex\">\n <InputIconSlot\n icon={CalendarBlankIcon}\n size={size}\n disabled={disabled}\n />\n </span>\n </div>\n ) : (\n nativeInput\n )}\n\n {effectiveRightDecorator && (\n <div\n className={cn(DECORATOR_CLASSES, 'gap-space-1')}\n style={{ marginInlineEnd: rightActionOffset }}\n >\n {effectiveRightDecorator}\n </div>\n )}\n </div>\n\n {hintText && (\n <Text\n id={hintTextId}\n className={cn(\n 'mt-space-1 text-xs',\n isError ? 'text-error-secondary' : 'text-tertiary'\n )}\n variant=\"xs\"\n weight=\"normal\"\n >\n {hintText}\n </Text>\n )}\n </div>\n );\n }\n);\n\nInput.displayName = 'Input';\n"],"mappings":";;;;;;;;;;;;;;;AA4GA,SAAS,cAAc,EACrB,MACA,QACA,MACA,YAMC;CACD,MAAM,aAAa,YAAY,QAAQ;CACvC,MAAM,iBAAiB,aACnB,uBACA;CAEJ,OAAO,SACL,oBAAC,YAAD;EACE,GAAI;EACJ,OAAM;EACN,SAAQ;EACR,MAAM,mBAAmB,KAAK,CAAC;EAC/B,WAAW;EACX,YAAW;EACX,UAAU;EACV,cAAc,UAAU,MAAM,eAAe;CAC9C,CAAA,IACC,OACF,oBAAC,MAAD;EACE,eAAA;EACM;EACN,eAAe,mBAAmB,KAAK,CAAC;EACxC,WAAW;EACX,QAAO;CACR,CAAA,IACC;AACN;AAEA,SAAS,cAAc,EACrB,MACA,WACA,eAKC;CACD,MAAM,UACJ,UAAU,SAAS,IAAI,GAAG,UAAU,OAAO,mBAAmB,UAAU;CAC1E,MAAM,cAAc,mBAAmB;CAEvC,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;EACE,eAAA;EACA,IAAG;EACH,WAAW,GACT,aACA,2BACA,UAAU,iBAAiB,kBAC7B;EAEC,UAAA,WAAW,eAAe;CACvB,CAAA,GACN,oBAAC,MAAD;EACE,eAAA;EACA,IAAG;EACH,QAAO;EACP,WAAW,GAAG,aAAa,yBAAyB;EACrD,UAAA;CAEK,CAAA,CACN,EAAA,CAAA;AAEN;AAEA,IAAa,QAAQ,YAMjB,EACE,OAAO,MACP,UAAU,YACV,UACA,WACA,YACA,aACA,eACA,gBACA,WAAW,OACX,UAAU,OACV,OAC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;MAE3C,UAAA;KACE,CAAA;IAEJ;;GAEJ,YACC,oBAAC,MAAD;IACE,IAAI;IACJ,WAAW,GACT,sBACA,UAAU,yBAAyB,eACrC;IACA,SAAQ;IACR,QAAO;IAEN,UAAA;GACG,CAAA;EAEL;;AAET,CACF;AAEA,MAAM,cAAc"}
1
+ {"version":3,"file":"Input.js","names":[],"sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\nimport { forwardRef, useEffect, useId, useRef, useState } from 'react';\n\nimport { useDebouncedCallback } from 'use-debounce';\n\nimport { CalendarBlankIcon } from '@phosphor-icons/react/dist/ssr/CalendarBlank';\nimport { EyeIcon } from '@phosphor-icons/react/dist/ssr/Eye';\nimport { EyeSlashIcon } from '@phosphor-icons/react/dist/ssr/EyeSlash';\nimport { PaperclipIcon } from '@phosphor-icons/react/dist/ssr/Paperclip';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_ICON_SIZES } from '../../utils/controlIconSizes';\nimport type { IconComponent } from '../../utils/icon-types';\nimport { mergeRefs } from '../../utils/merge-refs';\nimport { Icon } from '../Icon';\nimport { IconButton } from '../IconButton';\nimport { Text } from '../Text';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n INPUT_TEXT_CLASSES,\n} from './inputStyles';\nimport type { InputSize } from './inputStyles';\n\nexport type InputIconAction = Pick<\n ComponentProps<typeof IconButton>,\n 'icon' | 'label' | 'disabled' | 'tooltipProps'\n> & {\n onClick: NonNullable<ComponentProps<typeof IconButton>['onClick']>;\n};\n\nexport interface InputProps {\n /** Exact outer height. The default lg tier preserves the legacy 40px field. */\n size?: InputSize;\n variant?: 'outlined' | 'plain';\n /** Decorative icon. Input owns its size and color. */\n leftIcon?: IconComponent;\n /** Decorative icon. Input owns its size and color. */\n rightIcon?: IconComponent;\n /** Plain icon button. Takes precedence over leftIcon. */\n leftAction?: InputIconAction;\n /** Plain icon button. Takes precedence over rightIcon; precedes the password toggle. */\n rightAction?: InputIconAction;\n /** Custom content; overrides leftIcon/leftAction and the default file icon. */\n leftDecorator?: ReactNode;\n /** Custom content; overrides rightIcon/rightAction. The password toggle remains last. */\n rightDecorator?: ReactNode;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Whether the input has an error state */\n isError?: boolean;\n /** Label text displayed above the input */\n label?: string | ReactNode;\n /** Hint text displayed below the input */\n hintText?: string;\n /** Current input value */\n value?: string | null;\n /** Change handler that will be debounced */\n onChange: (\n value: string,\n event?: React.ChangeEvent<HTMLInputElement>\n ) => void;\n /** Placeholder text */\n placeholder?: string;\n /**\n * Input type. Limited to the \"text-like\" native types that share this\n * component's styled-text rendering and string value contract. `password`\n * renders a masked secret field with a show/hide toggle. `date` uses the\n * browser's native date picker; its value is a `YYYY-MM-DD` string.\n * `datetime-local` uses the native date+time picker; its value is a\n * `YYYY-MM-DDTHH:mm` string in the viewer's local time. `file` is\n * uncontrolled: read the selection from `event.target.files` on the change\n * event, and scope it with `accept`/`multiple`.\n */\n type?:\n | 'text'\n | 'email'\n | 'password'\n | 'number'\n | 'url'\n | 'date'\n | 'datetime-local'\n | 'file';\n /** Debounce delay in milliseconds (default: 300). Ignored for `type=\"file\"`. */\n debounceMs?: number;\n /** Additional CSS classes */\n className?: string;\n /** Input ID for accessibility */\n id?: string;\n /** Input name for forms */\n name?: string;\n /** Whether the field is required */\n required?: boolean;\n /** Auto focus on mount */\n autoFocus?: boolean;\n /** CSS class for the input container */\n inputContainerClassName?: string;\n /**\n * Which files the picker offers, as a comma-separated list of extensions or\n * MIME types (`'.csv,.json'`, `'image/*'`). `type=\"file\"` only. The browser\n * treats this as a filter, not a guarantee — validate the selection too.\n */\n accept?: string;\n /** Whether more than one file can be picked. `type=\"file\"` only. */\n multiple?: boolean;\n}\n\nfunction InputIconSlot({\n icon,\n action,\n size,\n disabled,\n}: {\n icon?: IconComponent;\n action?: InputIconAction;\n size: InputSize;\n disabled: boolean;\n}) {\n const isDisabled = disabled || action?.disabled;\n const colorClassName = isDisabled\n ? 'text-icon-disabled'\n : 'text-icon-secondary';\n\n return action ? (\n <IconButton\n {...action}\n color=\"secondary\"\n variant=\"plain\"\n size={CONTROL_ICON_SIZES[size].buttonSize}\n className={colorClassName}\n iconWeight=\"regular\"\n disabled={isDisabled}\n onMouseDown={(event) => event.preventDefault()}\n />\n ) : icon ? (\n <Icon\n aria-hidden\n icon={icon}\n iconClassName={CONTROL_ICON_SIZES[size].iconClassName}\n className={colorClassName}\n weight=\"regular\"\n />\n ) : null;\n}\n\nfunction FileSelection({\n size,\n fileNames,\n placeholder,\n disabled,\n}: {\n size: InputSize;\n fileNames: string[];\n placeholder?: string;\n disabled: boolean;\n}) {\n const summary =\n fileNames.length > 1 ? `${fileNames.length} files selected` : fileNames[0];\n const textClasses = INPUT_TEXT_CLASSES[size];\n\n return (\n <>\n <Text\n aria-hidden\n as=\"span\"\n className={cn(\n textClasses,\n 'min-w-0 flex-1 truncate',\n summary ? 'text-primary' : 'text-placeholder',\n disabled && 'text-disabled'\n )}\n >\n {summary ?? placeholder ?? 'No file selected'}\n </Text>\n <Text\n aria-hidden\n as=\"span\"\n weight=\"medium\"\n className={cn(\n textClasses,\n 'shrink-0 text-secondary',\n disabled && 'text-disabled'\n )}\n >\n Browse\n </Text>\n </>\n );\n}\n\nexport const Input = forwardRef<\n HTMLInputElement,\n InputProps &\n Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof InputProps>\n>(\n (\n {\n size = 'lg',\n variant = 'outlined',\n leftIcon,\n rightIcon,\n leftAction,\n rightAction,\n leftDecorator,\n rightDecorator,\n disabled = false,\n isError = false,\n label,\n hintText,\n value,\n onChange,\n placeholder,\n type = 'text',\n debounceMs = 0,\n className,\n inputContainerClassName,\n id,\n name,\n required = false,\n autoFocus = false,\n accept,\n multiple,\n 'aria-describedby': ariaDescribedBy,\n ...rest\n },\n ref\n ) => {\n const generatedId = useId();\n const inputId = id || generatedId;\n const hintTextId = `${inputId}-hint`;\n const describedBy =\n [hintText ? hintTextId : undefined, ariaDescribedBy]\n .filter(Boolean)\n .join(' ') || undefined;\n const shouldDebounce = debounceMs > 0;\n const isFileInput = type === 'file';\n const isPasswordInput = type === 'password';\n const isDateInput = type === 'date' || type === 'datetime-local';\n const [internalValue, setInternalValue] = useState(value);\n const [isPasswordVisible, setIsPasswordVisible] = useState(false);\n const [selectedFileNames, setSelectedFileNames] = useState<string[]>([]);\n const debouncedOnChange = useDebouncedCallback(onChange, debounceMs);\n const fileInputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (!shouldDebounce) return;\n return () => debouncedOnChange.flush();\n }, [shouldDebounce, debouncedOnChange]);\n\n // Skip the click forwarded below, which would otherwise re-enter here.\n const openFilePicker = (event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n if (\n disabled ||\n (target instanceof Element &&\n target.closest(\n 'button, a, input, select, textarea, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"true\"]'\n ))\n ) {\n return;\n }\n fileInputRef.current?.click();\n };\n\n useEffect(() => {\n if (shouldDebounce) setInternalValue(value);\n }, [shouldDebounce, value]);\n\n useEffect(() => {\n if (!isPasswordInput) {\n setIsPasswordVisible(false);\n }\n }, [isPasswordInput]);\n\n useEffect(() => {\n const form = isFileInput ? fileInputRef.current?.form : null;\n if (!form) return;\n\n const clearFileSelection = () => setSelectedFileNames([]);\n form.addEventListener('reset', clearFileSelection);\n return () => form.removeEventListener('reset', clearFileSelection);\n }, [isFileInput]);\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n if (isFileInput) {\n onChange(newValue, e);\n setSelectedFileNames(\n Array.from(e.target.files ?? []).map((file) => file.name)\n );\n return;\n }\n\n if (shouldDebounce) {\n setInternalValue(newValue);\n debouncedOnChange(newValue);\n } else {\n onChange(newValue, e);\n }\n };\n\n const inputContainerClasses = getInputContainerClasses({\n size,\n variant,\n isError,\n disabled,\n className: inputContainerClassName,\n });\n\n const inputClasses = isFileInput\n ? 'sr-only'\n : getInputElementClasses({\n size,\n disabled,\n className: cn(\n isPasswordInput && !isPasswordVisible && 'text-security',\n isDateInput && [\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:size-[var(--control-icon-size)]',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:m-0',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:p-0',\n 'supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:opacity-0',\n ]\n ),\n });\n\n const effectiveLeftIcon =\n leftIcon ?? (isFileInput ? PaperclipIcon : undefined);\n const hasCustomLeftDecorator = leftDecorator != null;\n const hasCustomRightDecorator = rightDecorator != null;\n const effectiveLeftDecorator =\n leftDecorator ??\n (effectiveLeftIcon || leftAction ? (\n <InputIconSlot\n icon={effectiveLeftIcon}\n action={leftAction}\n size={size}\n disabled={disabled}\n />\n ) : null);\n const rightContent =\n rightDecorator ??\n (rightIcon || rightAction ? (\n <InputIconSlot\n icon={rightIcon}\n action={rightAction}\n size={size}\n disabled={disabled}\n />\n ) : null);\n // Offset only known edge buttons by their glyph inset, including the border.\n const leftActionOffset =\n !hasCustomLeftDecorator && leftAction\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined;\n const rightActionOffset =\n isPasswordInput || (!hasCustomRightDecorator && rightAction)\n ? CONTROL_ICON_SIZES[size].actionOffset\n : undefined;\n const effectiveRightDecorator =\n rightContent || isPasswordInput ? (\n <>\n {rightContent}\n {isPasswordInput && (\n <InputIconSlot\n size={size}\n disabled={disabled}\n action={{\n icon: isPasswordVisible ? EyeSlashIcon : EyeIcon,\n label: 'toggle password visibility',\n tooltipProps: { disabled: true },\n onClick: () => setIsPasswordVisible((show) => !show),\n }}\n />\n )}\n </>\n ) : null;\n\n const nativeInput = (\n // eslint-disable-next-line react/forbid-elements\n <input\n ref={isFileInput ? mergeRefs([fileInputRef, ref]) : ref}\n id={inputId}\n name={name ?? (typeof label === 'string' ? label : undefined)}\n type={\n isPasswordInput ? (isPasswordVisible ? 'text' : 'password') : type\n }\n value={\n isFileInput\n ? undefined\n : shouldDebounce\n ? (internalValue ?? '')\n : value === null\n ? ''\n : value\n }\n onChange={handleInputChange}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n autoFocus={autoFocus}\n accept={accept}\n multiple={multiple}\n aria-describedby={describedBy}\n aria-invalid={isError || undefined}\n className={inputClasses}\n {...rest}\n />\n );\n\n return (\n <div className={cn('w-full', className)}>\n {label && (\n <Text\n as=\"label\"\n htmlFor={inputId}\n className={cn(\n 'mb-space-1 block text-sm font-medium text-primary',\n disabled && 'text-disabled'\n )}\n variant=\"xs\"\n >\n {label}\n {required && (\n <span className=\"ml-space-1 text-error-secondary\">*</span>\n )}\n </Text>\n )}\n\n <div\n className={cn(\n inputContainerClasses,\n isFileInput && !disabled && 'cursor-pointer'\n )}\n onClick={isFileInput ? openFilePicker : undefined}\n >\n {effectiveLeftDecorator && (\n <div\n className={cn(DECORATOR_CLASSES, disabled && 'text-disabled')}\n style={{ marginInlineStart: leftActionOffset }}\n >\n {effectiveLeftDecorator}\n </div>\n )}\n\n {isFileInput && (\n <FileSelection\n size={size}\n fileNames={selectedFileNames}\n placeholder={placeholder}\n disabled={disabled}\n />\n )}\n\n {isDateInput ? (\n <div\n className={cn(\n 'relative flex min-w-0 flex-1 items-center',\n CONTROL_ICON_SIZES[size].sizeVariableClassName\n )}\n >\n {nativeInput}\n {/* The native picker target stays interactive beneath this glyph. */}\n <span className=\"pointer-events-none absolute inset-y-0 end-0 hidden items-center supports-[selector(input::-webkit-calendar-picker-indicator)]:flex\">\n <InputIconSlot\n icon={CalendarBlankIcon}\n size={size}\n disabled={disabled}\n />\n </span>\n </div>\n ) : (\n nativeInput\n )}\n\n {effectiveRightDecorator && (\n <div\n className={cn(\n DECORATOR_CLASSES,\n 'gap-space-1',\n disabled && 'text-disabled'\n )}\n style={{ marginInlineEnd: rightActionOffset }}\n >\n {effectiveRightDecorator}\n </div>\n )}\n </div>\n\n {hintText && (\n <Text\n id={hintTextId}\n className={cn(\n 'mt-space-1 text-xs',\n isError ? 'text-error-secondary' : 'text-tertiary'\n )}\n variant=\"xs\"\n weight=\"normal\"\n >\n {hintText}\n </Text>\n )}\n </div>\n );\n }\n);\n\nInput.displayName = 'Input';\n"],"mappings":";;;;;;;;;;;;;;;AA4GA,SAAS,cAAc,EACrB,MACA,QACA,MACA,YAMC;CACD,MAAM,aAAa,YAAY,QAAQ;CACvC,MAAM,iBAAiB,aACnB,uBACA;CAEJ,OAAO,SACL,oBAAC,YAAD;EACE,GAAI;EACJ,OAAM;EACN,SAAQ;EACR,MAAM,mBAAmB,KAAK,CAAC;EAC/B,WAAW;EACX,YAAW;EACX,UAAU;EACV,cAAc,UAAU,MAAM,eAAe;CAC9C,CAAA,IACC,OACF,oBAAC,MAAD;EACE,eAAA;EACM;EACN,eAAe,mBAAmB,KAAK,CAAC;EACxC,WAAW;EACX,QAAO;CACR,CAAA,IACC;AACN;AAEA,SAAS,cAAc,EACrB,MACA,WACA,aACA,YAMC;CACD,MAAM,UACJ,UAAU,SAAS,IAAI,GAAG,UAAU,OAAO,mBAAmB,UAAU;CAC1E,MAAM,cAAc,mBAAmB;CAEvC,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;EACE,eAAA;EACA,IAAG;EACH,WAAW,GACT,aACA,2BACA,UAAU,iBAAiB,oBAC3B,YAAY,eACd;EAEC,UAAA,WAAW,eAAe;CACvB,CAAA,GACN,oBAAC,MAAD;EACE,eAAA;EACA,IAAG;EACH,QAAO;EACP,WAAW,GACT,aACA,2BACA,YAAY,eACd;EACD,UAAA;CAEK,CAAA,CACN,EAAA,CAAA;AAEN;AAEA,IAAa,QAAQ,YAMjB,EACE,OAAO,MACP,UAAU,YACV,UACA,WACA,YACA,aACA,eACA,gBACA,WAAW,OACX,UAAU,OACV,OACA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eACd;MACA,OAAO,EAAE,iBAAiB,kBAAkB;MAE3C,UAAA;KACE,CAAA;IAEJ;;GAEJ,YACC,oBAAC,MAAD;IACE,IAAI;IACJ,WAAW,GACT,sBACA,UAAU,yBAAyB,eACrC;IACA,SAAQ;IACR,QAAO;IAEN,UAAA;GACG,CAAA;EAEL;;AAET,CACF;AAEA,MAAM,cAAc"}
@@ -26,16 +26,16 @@ 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-subtle bg-transparent": variant === "outlined",
30
- "border border-transparent bg-surface-level-3": variant === "plain"
31
- }, outlined && !disabled && !isError && "[&:hover:not(:focus-within)]:border-default", !isError && (outlined ? "focus-within:border-focus focus-within:shadow-[0_0_0_1px_var(--border-focus)]" : "focus-within:border-focus"), 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 bg-disabled opacity-50", className);
29
+ "border border-muted bg-input": variant === "outlined",
30
+ "border border-transparent bg-input": variant === "plain"
31
+ }, outlined && !disabled && !isError && "[&:hover:not(:focus-within)]:border-subtle", !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).
35
35
  * Used by both the design system Input and CommandInput.
36
36
  */
37
37
  function getInputElementClasses({ size, disabled = false, className }) {
38
- return cn("min-w-0 max-w-full flex-1 border-none bg-transparent p-0 outline-hidden", INPUT_TEXT_CLASSES[size], "placeholder:text-placeholder", disabled && "cursor-not-allowed", className);
38
+ return cn("min-w-0 max-w-full flex-1 border-none bg-transparent p-0 outline-hidden", INPUT_TEXT_CLASSES[size], "placeholder:text-placeholder", disabled && "cursor-not-allowed text-disabled placeholder:text-disabled", className);
39
39
  }
40
40
  /** Shared styling for decorator wrappers. */
41
41
  var DECORATOR_CLASSES = "flex items-center text-tertiary";
@@ -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-subtle bg-transparent': variant === 'outlined',\n 'border border-transparent bg-surface-level-3': variant === 'plain',\n },\n outlined &&\n !disabled &&\n !isError &&\n '[&:hover:not(:focus-within)]:border-default',\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 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 && 'cursor-not-allowed bg-disabled opacity-50',\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',\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,uCAAuC,YAAY;EACnD,gDAAgD,YAAY;CAC9D,GACA,YACE,CAAC,YACD,CAAC,WACD,+CACF,CAAC,YACE,WACG,kFACA,8BACN,YACG,WACG,oHACA,yDACN,YAAY,6CACZ,SACF;AACF;;;;;AAMA,SAAgB,uBAAuB,EACrC,MACA,WAAW,OACX,aAKC;CACD,OAAO,GACL,2EACA,mBAAmB,OACnB,gCACA,YAAY,sBACZ,SACF;AACF;;AAGA,IAAa,oBAAoB"}
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-muted 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-subtle',\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,8CACF,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"}
@@ -9,16 +9,16 @@ var TextContent = (children, leftDecorator, rightDecorator, iconWeight) => {
9
9
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
10
10
  LeftIcon && /* @__PURE__ */ jsx(LeftIcon, {
11
11
  "aria-hidden": true,
12
- className: "h-[1em] w-[1em] flex-shrink-0 text-link dark:text-brand-secondary dark:group-hover:text-brand-primary",
12
+ className: "h-[1em] w-[1em] flex-shrink-0 text-link dark:text-link dark:group-hover:text-link-hover",
13
13
  weight: iconWeight
14
14
  }),
15
15
  /* @__PURE__ */ jsx("span", {
16
- className: "text-link underline-offset-2 hover:text-link-hover hover:underline hover:decoration-ls-neutral-300 hover:decoration-1 dark:text-brand-secondary dark:hover:text-brand-primary dark:hover:decoration-ls-neutral-400",
16
+ className: "text-link underline-offset-2 hover:text-link-hover hover:underline hover:decoration-ls-neutral-300 hover:decoration-1 dark:text-link dark:hover:text-link-hover dark:hover:decoration-ls-neutral-400",
17
17
  children
18
18
  }),
19
19
  RightIcon && /* @__PURE__ */ jsx(RightIcon, {
20
20
  "aria-hidden": true,
21
- className: "h-[1em] w-[1em] flex-shrink-0 text-link dark:text-brand-secondary dark:group-hover:text-brand-primary",
21
+ className: "h-[1em] w-[1em] flex-shrink-0 text-link dark:text-link dark:group-hover:text-link-hover",
22
22
  weight: iconWeight
23
23
  })
24
24
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","names":[],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import {\n cloneElement,\n forwardRef,\n isValidElement,\n type AnchorHTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../utils/cn';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { textVariantClasses } from '../Text';\nimport type { TextProps } from '../Text';\n\ntype LinkRenderElement = ReactElement<{\n children?: ReactNode;\n className?: string;\n [key: string]: unknown;\n}>;\n\ntype LinkProps = {\n /** Typography size — mirrors <Text> styles */\n variant?: TextProps['variant'];\n leftDecorator?: IconComponent;\n rightDecorator?: IconComponent;\n /** Phosphor weight used for decorator icons. */\n iconWeight?: IconWeight;\n} & (\n | (AnchorHTMLAttributes<HTMLAnchorElement> & {\n /** Render a native anchor with this URL. */\n href: string;\n as?: never;\n })\n | (Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {\n /**\n * Render link styling through a routing framework's anchor component.\n * For example: `as={<RouterLink to=\"/runs\" />}`.\n */\n as: LinkRenderElement;\n href?: never;\n })\n);\n\nconst TextContent = (\n children: React.ReactNode,\n leftDecorator: IconComponent | undefined,\n rightDecorator: IconComponent | undefined,\n iconWeight: IconWeight | undefined\n) => {\n const LeftIcon = leftDecorator;\n const RightIcon = rightDecorator;\n return (\n <>\n {LeftIcon && (\n <LeftIcon\n aria-hidden\n className=\"h-[1em] w-[1em] flex-shrink-0 text-link dark:text-brand-secondary dark:group-hover:text-brand-primary\"\n weight={iconWeight}\n />\n )}\n <span className=\"text-link underline-offset-2 hover:text-link-hover hover:underline hover:decoration-ls-neutral-300 hover:decoration-1 dark:text-brand-secondary dark:hover:text-brand-primary dark:hover:decoration-ls-neutral-400\">\n {children}\n </span>\n {RightIcon && (\n <RightIcon\n aria-hidden\n className=\"h-[1em] w-[1em] flex-shrink-0 text-link dark:text-brand-secondary dark:group-hover:text-brand-primary\"\n weight={iconWeight}\n />\n )}\n </>\n );\n};\n\nconst Link = forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n variant = 'body',\n leftDecorator,\n rightDecorator,\n iconWeight,\n className,\n children,\n as,\n ...props\n },\n ref\n ) => {\n const containerClass = cn(\n 'group inline-flex items-center gap-[2px]',\n textVariantClasses[variant],\n className\n );\n\n const content = TextContent(\n children,\n leftDecorator,\n rightDecorator,\n iconWeight\n );\n\n if (as) {\n if (!isValidElement(as)) return null;\n\n return cloneElement(as, {\n ...props,\n ref,\n className: cn(as.props.className, containerClass),\n children: content,\n });\n }\n\n const { href, ...anchorProps } = props;\n return (\n // eslint-disable-next-line react/forbid-elements\n <a ref={ref} href={href} className={containerClass} {...anchorProps}>\n {content}\n </a>\n );\n }\n);\n\nLink.displayName = 'Link';\n\nexport { Link };\nexport type { LinkProps };\n"],"mappings":";;;;;AA2CA,IAAM,eACJ,UACA,eACA,gBACA,eACG;CACH,MAAM,WAAW;CACjB,MAAM,YAAY;CAClB,OACE,qBAAA,YAAA,EAAA,UAAA;EACG,YACC,oBAAC,UAAD;GACE,eAAA;GACA,WAAU;GACV,QAAQ;EACT,CAAA;EAEH,oBAAC,QAAD;GAAM,WAAU;GACb;EACG,CAAA;EACL,aACC,oBAAC,WAAD;GACE,eAAA;GACA,WAAU;GACV,QAAQ;EACT,CAAA;CAEH,EAAA,CAAA;AAEN;AAEA,IAAM,OAAO,YAET,EACE,UAAU,QACV,eACA,gBACA,YACA,WACA,UACA,IACA,GAAG,SAEL,QACG;CACH,MAAM,iBAAiB,GACrB,4CACA,mBAAmB,UACnB,SACF;CAEA,MAAM,UAAU,YACd,UACA,eACA,gBACA,UACF;CAEA,IAAI,IAAI;EACN,IAAI,CAAC,eAAe,EAAE,GAAG,OAAO;EAEhC,OAAO,aAAa,IAAI;GACtB,GAAG;GACH;GACA,WAAW,GAAG,GAAG,MAAM,WAAW,cAAc;GAChD,UAAU;EACZ,CAAC;CACH;CAEA,MAAM,EAAE,MAAM,GAAG,gBAAgB;CACjC,OAEE,oBAAC,KAAD;EAAQ;EAAW;EAAM,WAAW;EAAgB,GAAI;EACrD,UAAA;CACA,CAAA;AAEP,CACF;AAEA,KAAK,cAAc"}
1
+ {"version":3,"file":"Link.js","names":[],"sources":["../../../src/components/Link/Link.tsx"],"sourcesContent":["import {\n cloneElement,\n forwardRef,\n isValidElement,\n type AnchorHTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cn } from '../../utils/cn';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { textVariantClasses } from '../Text';\nimport type { TextProps } from '../Text';\n\ntype LinkRenderElement = ReactElement<{\n children?: ReactNode;\n className?: string;\n [key: string]: unknown;\n}>;\n\ntype LinkProps = {\n /** Typography size — mirrors <Text> styles */\n variant?: TextProps['variant'];\n leftDecorator?: IconComponent;\n rightDecorator?: IconComponent;\n /** Phosphor weight used for decorator icons. */\n iconWeight?: IconWeight;\n} & (\n | (AnchorHTMLAttributes<HTMLAnchorElement> & {\n /** Render a native anchor with this URL. */\n href: string;\n as?: never;\n })\n | (Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {\n /**\n * Render link styling through a routing framework's anchor component.\n * For example: `as={<RouterLink to=\"/runs\" />}`.\n */\n as: LinkRenderElement;\n href?: never;\n })\n );\n\nconst TextContent = (\n children: React.ReactNode,\n leftDecorator: IconComponent | undefined,\n rightDecorator: IconComponent | undefined,\n iconWeight: IconWeight | undefined\n) => {\n const LeftIcon = leftDecorator;\n const RightIcon = rightDecorator;\n return (\n <>\n {LeftIcon && (\n <LeftIcon\n aria-hidden\n className=\"h-[1em] w-[1em] flex-shrink-0 text-link dark:text-link dark:group-hover:text-link-hover\"\n weight={iconWeight}\n />\n )}\n <span className=\"text-link underline-offset-2 hover:text-link-hover hover:underline hover:decoration-ls-neutral-300 hover:decoration-1 dark:text-link dark:hover:text-link-hover dark:hover:decoration-ls-neutral-400\">\n {children}\n </span>\n {RightIcon && (\n <RightIcon\n aria-hidden\n className=\"h-[1em] w-[1em] flex-shrink-0 text-link dark:text-link dark:group-hover:text-link-hover\"\n weight={iconWeight}\n />\n )}\n </>\n );\n};\n\nconst Link = forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n variant = 'body',\n leftDecorator,\n rightDecorator,\n iconWeight,\n className,\n children,\n as,\n ...props\n },\n ref\n ) => {\n const containerClass = cn(\n 'group inline-flex items-center gap-[2px]',\n textVariantClasses[variant],\n className\n );\n\n const content = TextContent(\n children,\n leftDecorator,\n rightDecorator,\n iconWeight\n );\n\n if (as) {\n if (!isValidElement(as)) return null;\n\n return cloneElement(as, {\n ...props,\n ref,\n className: cn(as.props.className, containerClass),\n children: content,\n });\n }\n\n const { href, ...anchorProps } = props;\n return (\n // eslint-disable-next-line react/forbid-elements\n <a ref={ref} href={href} className={containerClass} {...anchorProps}>\n {content}\n </a>\n );\n }\n);\n\nLink.displayName = 'Link';\n\nexport { Link };\nexport type { LinkProps };\n"],"mappings":";;;;;AA2CA,IAAM,eACJ,UACA,eACA,gBACA,eACG;CACH,MAAM,WAAW;CACjB,MAAM,YAAY;CAClB,OACE,qBAAA,YAAA,EAAA,UAAA;EACG,YACC,oBAAC,UAAD;GACE,eAAA;GACA,WAAU;GACV,QAAQ;EACT,CAAA;EAEH,oBAAC,QAAD;GAAM,WAAU;GACb;EACG,CAAA;EACL,aACC,oBAAC,WAAD;GACE,eAAA;GACA,WAAU;GACV,QAAQ;EACT,CAAA;CAEH,EAAA,CAAA;AAEN;AAEA,IAAM,OAAO,YAET,EACE,UAAU,QACV,eACA,gBACA,YACA,WACA,UACA,IACA,GAAG,SAEL,QACG;CACH,MAAM,iBAAiB,GACrB,4CACA,mBAAmB,UACnB,SACF;CAEA,MAAM,UAAU,YACd,UACA,eACA,gBACA,UACF;CAEA,IAAI,IAAI;EACN,IAAI,CAAC,eAAe,EAAE,GAAG,OAAO;EAEhC,OAAO,aAAa,IAAI;GACtB,GAAG;GACH;GACA,WAAW,GAAG,GAAG,MAAM,WAAW,cAAc;GAChD,UAAU;EACZ,CAAC;CACH;CAEA,MAAM,EAAE,MAAM,GAAG,gBAAgB;CACjC,OAEE,oBAAC,KAAD;EAAQ;EAAW;EAAM,WAAW;EAAgB,GAAI;EACrD,UAAA;CACA,CAAA;AAEP,CACF;AAEA,KAAK,cAAc"}
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
- interface CorePaneProps {
2
+ import { type DataAttributes } from '../../utils/dataAttributes.js';
3
+ interface CorePaneProps extends DataAttributes {
3
4
  open: boolean;
4
5
  animation?: boolean;
5
6
  onClose: () => void;
@@ -25,5 +26,5 @@ export interface PaneProps extends CorePaneProps {
25
26
  onBack?: () => void;
26
27
  scrollRef?: React.RefObject<HTMLDivElement | null>;
27
28
  }
28
- export declare function Pane({ open, animation, onClose, onBack, title, description, children, className, noBackArrow, headerClassName, titleClassName, descriptionClassName, topBarRightElement, dialogStyle, transparentBackdrop, scrollRef, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex, }: PaneProps): import("react").JSX.Element;
29
+ export declare function Pane({ open, animation, onClose, onBack, title, description, children, className, noBackArrow, headerClassName, titleClassName, descriptionClassName, topBarRightElement, dialogStyle, transparentBackdrop, scrollRef, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex, ...rest }: PaneProps): import("react").JSX.Element;
29
30
  export {};
@@ -5,7 +5,9 @@ import { useZIndex } from "../../utils/useZIndex.js";
5
5
  import { ZIndexProvider } from "../../utils/ZIndexContext.js";
6
6
  import { IconButton } from "../IconButton/IconButton.js";
7
7
  import { CaretDoubleRightIcon } from "../../icons/PaddedPhosphorIcons.js";
8
+ import { pickDataAttributes } from "../../utils/dataAttributes.js";
8
9
  import { mergeRefs } from "../../utils/merge-refs.js";
10
+ import { ModalLayerProvider, useCurrentModalLayer, useModalLayer } from "../../utils/ModalLayerContext.js";
9
11
  import { DialogContainerContext } from "../Dialog/index.js";
10
12
  import { ScrollParentContext, useScrollParent } from "../../utils/VirtuosoCustomScrollParentContext/useScrollParent.js";
11
13
  import { ScrollParentProvider } from "../../utils/VirtuosoCustomScrollParentContext/index.js";
@@ -16,32 +18,38 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
18
  import * as RadixDialog from "@radix-ui/react-dialog";
17
19
  //#region packages/components/src/components/Pane/Pane.tsx
18
20
  var PaneDepth = createContext(1);
19
- function PlainPane({ open, animation, onClose, children, dialogStyle, transparentBackdrop, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex }) {
21
+ function PlainPane({ open, animation, onClose, children, dialogStyle, transparentBackdrop, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex: paneZIndex, ...rest }) {
20
22
  const depth = useContext(PaneDepth);
23
+ const layer = useCurrentModalLayer();
21
24
  const scrollParentRef = useScrollParent();
22
- const [showConfirmModal, setShowConfirmModal] = useState(false);
23
25
  const [contentNode, setContentNode] = useState(null);
24
- const paneZIndex = useZIndex(zIndex ?? zIndices.pane);
25
- const handleRequestClose = () => {
26
- if (requireConfirmationOnClose) setShowConfirmModal(true);
27
- else onClose();
28
- };
29
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RadixDialog.Root, {
30
- open,
26
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(RadixDialog.Root, {
27
+ open: open && !layer?.suspended,
31
28
  onOpenChange: (o) => {
32
- if (!o) handleRequestClose();
29
+ if (!o) onClose();
33
30
  },
34
- children: /* @__PURE__ */ jsx(RadixDialog.Portal, { children: /* @__PURE__ */ jsx(RadixDialog.Overlay, {
35
- "data-pane-interaction-boundary": true,
36
- className: cn("fixed inset-0 bg-overlay", animation && "data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none", transparentBackdrop ? "bg-transparent" : ""),
37
- style: { zIndex: paneZIndex },
38
- children: /* @__PURE__ */ jsx(RadixDialog.Content, {
31
+ children: /* @__PURE__ */ jsxs(RadixDialog.Portal, {
32
+ forceMount: open || void 0,
33
+ children: [/* @__PURE__ */ jsx(RadixDialog.Overlay, {
34
+ forceMount: open || void 0,
35
+ "data-pane-interaction-boundary": true,
36
+ className: cn("fixed inset-0 bg-overlay", animation && "data-[state=open]:animate-overlay-in data-[state=closed]:animate-overlay-out motion-reduce:animate-none", transparentBackdrop ? "bg-transparent" : ""),
37
+ style: {
38
+ zIndex: paneZIndex,
39
+ ...!transparentBackdrop && layer?.backdropStyle,
40
+ display: layer?.suspended ? "none" : void 0
41
+ }
42
+ }), /* @__PURE__ */ jsx(RadixDialog.Content, {
43
+ ...pickDataAttributes(rest),
44
+ forceMount: open || void 0,
39
45
  ref: mergeRefs([scrollParentRef, setContentNode]),
40
- className: cn("relative flex h-[100vh] flex-col items-stretch overflow-y-auto bg-elevated shadow-lg", "focus:outline-hidden focus-visible:outline-hidden", animation && "data-[state=open]:animate-slide-left data-[state=closed]:animate-slide-right motion-reduce:animate-none"),
46
+ className: cn("fixed inset-0 flex h-[100vh] flex-col items-stretch overflow-y-auto bg-elevated shadow-lg", "focus:outline-hidden focus-visible:outline-hidden", animation && "data-[state=open]:animate-slide-left data-[state=closed]:animate-slide-right motion-reduce:animate-none"),
41
47
  style: {
42
48
  marginLeft: `${depth * 5}rem`,
43
49
  marginRight: `var(--polly-chat-width, 0px)`,
44
- ...dialogStyle
50
+ ...dialogStyle,
51
+ zIndex: paneZIndex + 1,
52
+ display: layer?.suspended ? "none" : void 0
45
53
  },
46
54
  onScroll: (e) => handleScroll?.(e.nativeEvent),
47
55
  onOpenAutoFocus: (e) => {
@@ -54,7 +62,7 @@ function PlainPane({ open, animation, onClose, children, dialogStyle, transparen
54
62
  if (e.defaultPrevented) return;
55
63
  if (requireConfirmationOnClose) {
56
64
  e.preventDefault();
57
- setShowConfirmModal(true);
65
+ onClose();
58
66
  }
59
67
  },
60
68
  onPointerDownOutside: preventInteractOutside ? (e) => {
@@ -64,7 +72,7 @@ function PlainPane({ open, animation, onClose, children, dialogStyle, transparen
64
72
  e.preventDefault();
65
73
  } : void 0,
66
74
  children: /* @__PURE__ */ jsx(ZIndexProvider, {
67
- value: paneZIndex,
75
+ value: paneZIndex + 1,
68
76
  children: /* @__PURE__ */ jsx(DialogContainerContext.Provider, {
69
77
  value: contentNode,
70
78
  children: /* @__PURE__ */ jsx(TopBarPaneSlot.Context, { children: /* @__PURE__ */ jsx(PaneDepth.Provider, {
@@ -73,93 +81,91 @@ function PlainPane({ open, animation, onClose, children, dialogStyle, transparen
73
81
  }) })
74
82
  })
75
83
  })
76
- })
77
- }) })
78
- }), /* @__PURE__ */ jsx(UnsavedChangesDialog, {
79
- isOpen: showConfirmModal,
80
- onClose: () => setShowConfirmModal(false),
81
- onDiscard: () => {
82
- setShowConfirmModal(false);
83
- onClose();
84
- },
85
- title: "Unsaved Changes",
86
- description: "You may have unsaved changes. Are you sure you want to exit?",
87
- discardCopy: "Exit"
88
- })] });
84
+ })]
85
+ })
86
+ }) });
89
87
  }
90
- function Pane({ open, animation = true, onClose, onBack, title, description, children, className, noBackArrow, headerClassName, titleClassName, descriptionClassName, topBarRightElement, dialogStyle, transparentBackdrop, scrollRef, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex }) {
88
+ function Pane({ open, animation = true, onClose, onBack, title, description, children, className, noBackArrow, headerClassName, titleClassName, descriptionClassName, topBarRightElement, dialogStyle, transparentBackdrop, scrollRef, handleScroll, preventInteractOutside, onEscapeKeyDown, requireConfirmationOnClose, zIndex, ...rest }) {
89
+ const layer = useModalLayer(open);
90
+ const paneZIndex = useZIndex(layer.zIndex ?? zIndex ?? zIndices.pane);
91
91
  const [showConfirmModal, setShowConfirmModal] = useState(false);
92
- const handleCloseClick = () => {
93
- if (onBack) onBack();
94
- else if (requireConfirmationOnClose) setShowConfirmModal(true);
92
+ const requestClose = () => {
93
+ if (requireConfirmationOnClose) setShowConfirmModal(true);
95
94
  else onClose();
96
95
  };
97
- const paneComponent = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(PlainPane, {
98
- open,
99
- animation,
100
- onClose,
101
- dialogStyle,
102
- transparentBackdrop,
103
- handleScroll,
104
- preventInteractOutside,
105
- onEscapeKeyDown,
106
- requireConfirmationOnClose,
107
- zIndex,
108
- children: [/* @__PURE__ */ jsxs("header", {
109
- className: cn("sticky top-0 flex items-center gap-space-1 border-b border-b-subtle bg-elevated py-1.5 pl-[10px] pr-space-4", headerClassName),
110
- "data-testid": `pane-header-${title}`,
111
- style: { zIndex: zIndices.paneHeader },
112
- children: [
113
- !noBackArrow && /* @__PURE__ */ jsx(IconButton, {
114
- label: "Close",
115
- icon: CaretDoubleRightIcon,
116
- onClick: handleCloseClick,
117
- variant: "plain",
118
- size: "sm",
119
- iconClassName: "size-5 text-quaternary"
120
- }),
121
- /* @__PURE__ */ jsxs("div", {
122
- className: "flex min-w-0 flex-col gap-space-1",
123
- children: [/* @__PURE__ */ jsx(RadixDialog.Title, {
124
- asChild: true,
125
- children: /* @__PURE__ */ jsx(Text, {
126
- as: "h2",
127
- variant: "h3",
128
- color: "secondary",
129
- className: cn("min-w-0", titleClassName),
130
- children: title
131
- })
132
- }), description && /* @__PURE__ */ jsx(RadixDialog.Description, {
133
- asChild: true,
134
- children: /* @__PURE__ */ jsx(Text, {
135
- as: "p",
136
- variant: "sm",
137
- color: "tertiary",
138
- className: descriptionClassName,
139
- children: description
140
- })
141
- })]
142
- }),
143
- /* @__PURE__ */ jsxs("div", {
144
- className: "flex min-w-0 flex-1 items-center justify-end gap-space-2",
145
- children: [topBarRightElement, /* @__PURE__ */ jsx(TopBarPaneSlot.Slot, { className: "flex items-center gap-space-2 empty:hidden" })]
146
- })
147
- ]
148
- }), /* @__PURE__ */ jsx("div", {
149
- className: cn("flex-1 pb-space-8 pl-space-7 pr-space-4 pt-space-4", className),
150
- children
96
+ const paneComponent = /* @__PURE__ */ jsxs(ModalLayerProvider, {
97
+ layer,
98
+ children: [/* @__PURE__ */ jsxs(PlainPane, {
99
+ ...pickDataAttributes(rest),
100
+ open,
101
+ animation,
102
+ onClose: requestClose,
103
+ dialogStyle,
104
+ transparentBackdrop,
105
+ handleScroll,
106
+ preventInteractOutside,
107
+ onEscapeKeyDown,
108
+ requireConfirmationOnClose,
109
+ zIndex: paneZIndex,
110
+ children: [/* @__PURE__ */ jsxs("header", {
111
+ className: cn("sticky top-0 flex items-center gap-space-1 border-b border-b-subtle bg-elevated py-1.5 pl-[10px] pr-space-4", headerClassName),
112
+ "data-testid": `pane-header-${title}`,
113
+ style: { zIndex: zIndices.paneHeader },
114
+ children: [
115
+ !noBackArrow && /* @__PURE__ */ jsx(IconButton, {
116
+ label: "Close",
117
+ icon: CaretDoubleRightIcon,
118
+ onClick: onBack ?? requestClose,
119
+ variant: "plain",
120
+ size: "sm",
121
+ iconClassName: "size-5 text-quaternary"
122
+ }),
123
+ /* @__PURE__ */ jsxs("div", {
124
+ className: "flex min-w-0 flex-col gap-space-1",
125
+ children: [/* @__PURE__ */ jsx(RadixDialog.Title, {
126
+ asChild: true,
127
+ children: /* @__PURE__ */ jsx(Text, {
128
+ as: "h2",
129
+ variant: "h3",
130
+ color: "secondary",
131
+ className: cn("min-w-0", titleClassName),
132
+ children: title
133
+ })
134
+ }), description && /* @__PURE__ */ jsx(RadixDialog.Description, {
135
+ asChild: true,
136
+ children: /* @__PURE__ */ jsx(Text, {
137
+ as: "p",
138
+ variant: "sm",
139
+ color: "tertiary",
140
+ className: descriptionClassName,
141
+ children: description
142
+ })
143
+ })]
144
+ }),
145
+ /* @__PURE__ */ jsxs("div", {
146
+ className: "flex min-w-0 flex-1 items-center justify-end gap-space-2",
147
+ children: [topBarRightElement, /* @__PURE__ */ jsx(TopBarPaneSlot.Slot, { className: "flex items-center gap-space-2 empty:hidden" })]
148
+ })
149
+ ]
150
+ }), /* @__PURE__ */ jsx("div", {
151
+ className: cn("flex-1 pb-space-8 pl-space-7 pr-space-4 pt-space-4", className),
152
+ children
153
+ })]
154
+ }), /* @__PURE__ */ jsx(ZIndexProvider, {
155
+ value: paneZIndex + 1,
156
+ children: /* @__PURE__ */ jsx(UnsavedChangesDialog, {
157
+ isOpen: showConfirmModal,
158
+ onClose: () => setShowConfirmModal(false),
159
+ onDiscard: () => {
160
+ setShowConfirmModal(false);
161
+ onClose();
162
+ },
163
+ title: "Unsaved Changes",
164
+ description: "You may have unsaved changes. Are you sure you want to exit?",
165
+ discardCopy: "Exit"
166
+ })
151
167
  })]
152
- }), !onBack && /* @__PURE__ */ jsx(UnsavedChangesDialog, {
153
- isOpen: showConfirmModal,
154
- onClose: () => setShowConfirmModal(false),
155
- onDiscard: () => {
156
- setShowConfirmModal(false);
157
- onClose();
158
- },
159
- title: "Unsaved Changes",
160
- description: "You may have unsaved changes. Are you sure you want to exit?",
161
- discardCopy: "Exit"
162
- })] });
168
+ });
163
169
  return scrollRef ? /* @__PURE__ */ jsx(ScrollParentContext.Provider, {
164
170
  value: scrollRef,
165
171
  children: paneComponent