@t3q-ui/design-system 1.67.1 → 1.67.3

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 (93) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/components/alertDialog.cjs +2 -2
  3. package/dist/components/alertDialog.cjs.map +1 -1
  4. package/dist/components/alertDialog.js +2 -2
  5. package/dist/components/alertDialog.js.map +1 -1
  6. package/dist/components/chatComposer.cjs +6 -6
  7. package/dist/components/chatComposer.cjs.map +1 -1
  8. package/dist/components/chatComposer.js +6 -6
  9. package/dist/components/chatComposer.js.map +1 -1
  10. package/dist/components/columnFilter/ColumnFilter.cjs +15 -25
  11. package/dist/components/columnFilter/ColumnFilter.cjs.map +1 -1
  12. package/dist/components/columnFilter/ColumnFilter.js +15 -25
  13. package/dist/components/columnFilter/ColumnFilter.js.map +1 -1
  14. package/dist/components/columnFilter/ColumnFilterPopover.cjs +1 -1
  15. package/dist/components/columnFilter/ColumnFilterPopover.cjs.map +1 -1
  16. package/dist/components/columnFilter/ColumnFilterPopover.js +1 -1
  17. package/dist/components/columnFilter/ColumnFilterPopover.js.map +1 -1
  18. package/dist/components/dialog.cjs +2 -2
  19. package/dist/components/dialog.cjs.map +1 -1
  20. package/dist/components/dialog.js +2 -2
  21. package/dist/components/dialog.js.map +1 -1
  22. package/dist/components/drawer.cjs +2 -2
  23. package/dist/components/drawer.cjs.map +1 -1
  24. package/dist/components/drawer.js +2 -2
  25. package/dist/components/drawer.js.map +1 -1
  26. package/dist/components/dropdownMenu.cjs +1 -1
  27. package/dist/components/dropdownMenu.cjs.map +1 -1
  28. package/dist/components/dropdownMenu.js +1 -1
  29. package/dist/components/dropdownMenu.js.map +1 -1
  30. package/dist/components/multiSelect/multiSelect.cjs +29 -29
  31. package/dist/components/multiSelect/multiSelect.cjs.map +1 -1
  32. package/dist/components/multiSelect/multiSelect.js +29 -29
  33. package/dist/components/multiSelect/multiSelect.js.map +1 -1
  34. package/dist/components/multiSelect/multiSelectContent.cjs +1 -1
  35. package/dist/components/multiSelect/multiSelectContent.cjs.map +1 -1
  36. package/dist/components/multiSelect/multiSelectContent.js +1 -1
  37. package/dist/components/multiSelect/multiSelectContent.js.map +1 -1
  38. package/dist/components/parameterTable/ParameterTable.cjs +12 -10
  39. package/dist/components/parameterTable/ParameterTable.cjs.map +1 -1
  40. package/dist/components/parameterTable/ParameterTable.js +12 -10
  41. package/dist/components/parameterTable/ParameterTable.js.map +1 -1
  42. package/dist/components/popover.cjs +1 -1
  43. package/dist/components/popover.cjs.map +1 -1
  44. package/dist/components/popover.js +1 -1
  45. package/dist/components/popover.js.map +1 -1
  46. package/dist/components/range/range.cjs.map +1 -1
  47. package/dist/components/range/range.js.map +1 -1
  48. package/dist/components/range/rangeSlider.cjs +9 -12
  49. package/dist/components/range/rangeSlider.cjs.map +1 -1
  50. package/dist/components/range/rangeSlider.js +9 -12
  51. package/dist/components/range/rangeSlider.js.map +1 -1
  52. package/dist/components/range/useRangeValue.cjs +10 -8
  53. package/dist/components/range/useRangeValue.cjs.map +1 -1
  54. package/dist/components/range/useRangeValue.js +10 -8
  55. package/dist/components/range/useRangeValue.js.map +1 -1
  56. package/dist/components/select/select.cjs +7 -12
  57. package/dist/components/select/select.cjs.map +1 -1
  58. package/dist/components/select/select.js +7 -12
  59. package/dist/components/select/select.js.map +1 -1
  60. package/dist/components/select/selectContent.cjs +1 -1
  61. package/dist/components/select/selectContent.cjs.map +1 -1
  62. package/dist/components/select/selectContent.js +1 -1
  63. package/dist/components/select/selectContent.js.map +1 -1
  64. package/dist/components/sidebar/index.cjs +49 -11
  65. package/dist/components/sidebar/index.cjs.map +1 -1
  66. package/dist/components/sidebar/index.js +49 -11
  67. package/dist/components/sidebar/index.js.map +1 -1
  68. package/dist/components/textArea.cjs +10 -8
  69. package/dist/components/textArea.cjs.map +1 -1
  70. package/dist/components/textArea.js +10 -8
  71. package/dist/components/textArea.js.map +1 -1
  72. package/dist/components/textField.cjs +12 -10
  73. package/dist/components/textField.cjs.map +1 -1
  74. package/dist/components/textField.js +12 -10
  75. package/dist/components/textField.js.map +1 -1
  76. package/dist/components/tooltip.cjs +1 -1
  77. package/dist/components/tooltip.cjs.map +1 -1
  78. package/dist/components/tooltip.js +1 -1
  79. package/dist/components/tooltip.js.map +1 -1
  80. package/dist/hooks/useControllableValue.cjs +45 -0
  81. package/dist/hooks/useControllableValue.cjs.map +1 -0
  82. package/dist/hooks/useControllableValue.js +28 -0
  83. package/dist/hooks/useControllableValue.js.map +1 -0
  84. package/dist/{index-Guefjty-.d.cts → index-CWvJ53EI.d.cts} +1 -1
  85. package/dist/{index-Guefjty-.d.ts → index-CWvJ53EI.d.ts} +1 -1
  86. package/dist/index.d.cts +9 -6
  87. package/dist/index.d.ts +9 -6
  88. package/dist/patterns/index.d.cts +1 -1
  89. package/dist/patterns/index.d.ts +1 -1
  90. package/dist/styles.css +11 -1
  91. package/mcp/manifests/components.json +11 -6
  92. package/package.json +1 -1
  93. package/skills/tds/reference/components.md +9 -25
@@ -1 +1 @@
1
- {"version":3,"file":"textArea.js","sources":["../../src/components/textArea.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport TextareaAutosize, { TextareaAutosizeProps } from 'react-textarea-autosize'\nimport { cva } from 'class-variance-authority'\n\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textareaContainerVariants = cva(\n [\n 'flex w-full items-start bg-transparent',\n 'rounded-small min-h-[84px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextareaProps = Omit<TextareaAutosizeProps, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n /** 수동 리사이즈 허용 */\n resize?: boolean\n}\n\n/**\n * 여러 줄 글자 입력(떠 있는 라벨·자동 높이).\n *\n * 언제 쓰나: 설명·메모·사유처럼 한 줄을 넘는 글. `minRows`·`maxRows` 로 내용만큼 늘린다.\n * 언제 안 쓰나: 한 줄 값(→ TextField), 이름-값 여러 줄(→ ParameterTable), 코드·JSON 편집(DS 밖의 코드 편집기).\n * 대신/함께: 폼에서는 `FormControl` 안에. 글자 수(\"0 / 200자\")는 `FormDescription` 에 아이콘 없이.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n resize = false,\n minRows = 3,\n maxRows,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n style,\n ...textareaProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const textareaRef = React.useRef<HTMLTextAreaElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // Controlled vs Uncontrolled hasValue tracking\n const isControlled = valueProp !== undefined\n const [internalValue, setInternalValue] = React.useState(\n defaultValue !== undefined ? String(defaultValue) : '',\n )\n const hasValue = isControlled ? String(valueProp) !== '' : internalValue !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLTextAreaElement | null) => {\n ;(textareaRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setInternalValue(e.target.value)\n onChangeProp?.(e)\n },\n [isControlled, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n return (\n <div\n data-slot='textarea'\n aria-disabled={disabled || undefined}\n className={cn(\n textareaContainerVariants({ appearance, isInvalid }),\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner textarea 가 아닌 여기에 머지한다.\n className,\n )}\n style={{\n resize: resize ? 'vertical' : 'none',\n overflow: resize ? 'hidden' : undefined,\n }}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Textarea */}\n <TextareaAutosize\n ref={composedRef}\n minRows={minRows}\n maxRows={maxRows}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? valueProp : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // maxRows 미지정(무한 auto-grow) 시 자체 스크롤바 숨김: 스크롤바가 뜨면 content 폭이 줄어\n // autosize 재측정과 어긋나 스크롤바가 고착되는 피드백 루프를 막는다(스크롤바 없으면 content 가\n // height 에 정확히 맞아 잘림 없음). maxRows 지정(바운드) 시엔 기본 overflow-y:auto 로 캡 초과분 스크롤.\n maxRows == null && 'overflow-hidden',\n // When label is down (acting as placeholder), hide textarea's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n style={{\n resize: 'none',\n ...style,\n }}\n {...textareaProps}\n />\n </div>\n )\n },\n)\nTextarea.displayName = 'Textarea'\n\nexport { Textarea }\n"],"names":[],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A;AAAA,UAIA;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,QAAQ,SAAS,aAAa;AAAA,UAC9B,UAAU,SAAS,WAAW;AAAA,QAAA;AAAA,QAI9B,UAAA;AAAA,WAAA,sBAAsB,kBACtB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAM,qBAAqB,aAAa;AAAA,cACxC;AAAA,cACA,UAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA;AAAA,UAAA;AAAA,UAKJ;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,OAAO,eAAe,YAAY;AAAA,cAClC,cAAc,CAAC,eAAe,eAAe;AAAA,cAC7C,UAAU;AAAA,cACV,SAAS;AAAA,cACT,QAAQ;AAAA,cACR,mBAAiB,WAAW,UAAU;AAAA,cACtC,iBAAe,YAAY,eAAe,OAAO;AAAA,cACjD,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA;AAAA;AAAA,gBAIA,WAAW,QAAQ;AAAA;AAAA,gBAEnB,YAAY,CAAC,YAAY,CAAC,aAAa;AAAA,cAAA;AAAA,cAEzC,OAAO;AAAA,gBACL,QAAQ;AAAA,gBACR,GAAG;AAAA,cAAA;AAAA,cAEJ,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACA,SAAS,cAAc;"}
1
+ {"version":3,"file":"textArea.js","sources":["../../src/components/textArea.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport TextareaAutosize, { TextareaAutosizeProps } from 'react-textarea-autosize'\nimport { cva } from 'class-variance-authority'\n\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useControllableValue } from '../hooks/useControllableValue'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textareaContainerVariants = cva(\n [\n 'flex w-full items-start bg-transparent',\n 'rounded-small min-h-[84px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextareaProps = Omit<TextareaAutosizeProps, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n /** 수동 리사이즈 허용 */\n resize?: boolean\n}\n\n/**\n * 여러 줄 글자 입력(떠 있는 라벨·자동 높이).\n *\n * 언제 쓰나: 설명·메모·사유처럼 한 줄을 넘는 글. `minRows`·`maxRows` 로 내용만큼 늘린다.\n * 언제 안 쓰나: 한 줄 값(→ TextField), 이름-값 여러 줄(→ ParameterTable), 코드·JSON 편집(DS 밖의 코드 편집기).\n * 대신/함께: 폼에서는 `FormControl` 안에. 글자 수(\"0 / 200자\")는 `FormDescription` 에 아이콘 없이.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n resize = false,\n minRows = 3,\n maxRows,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n style,\n ...textareaProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const textareaRef = React.useRef<HTMLTextAreaElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // 비제어일 때 네이티브 입력이 값을 들고, 훅은 떠 있는 라벨용 hasValue 만 따라간다\n const {\n value,\n setValue: trackValue,\n isControlled,\n } = useControllableValue({ value: valueProp, defaultValue, empty: '' })\n const hasValue = String(value) !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLTextAreaElement | null) => {\n ;(textareaRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLTextAreaElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n trackValue(e.target.value)\n onChangeProp?.(e)\n },\n [trackValue, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n return (\n <div\n data-slot='textarea'\n aria-disabled={disabled || undefined}\n className={cn(\n textareaContainerVariants({ appearance, isInvalid }),\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner textarea 가 아닌 여기에 머지한다.\n className,\n )}\n style={{\n resize: resize ? 'vertical' : 'none',\n overflow: resize ? 'hidden' : undefined,\n }}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Textarea */}\n <TextareaAutosize\n ref={composedRef}\n minRows={minRows}\n maxRows={maxRows}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? value : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // maxRows 미지정(무한 auto-grow) 시 자체 스크롤바 숨김: 스크롤바가 뜨면 content 폭이 줄어\n // autosize 재측정과 어긋나 스크롤바가 고착되는 피드백 루프를 막는다(스크롤바 없으면 content 가\n // height 에 정확히 맞아 잘림 없음). maxRows 지정(바운드) 시엔 기본 overflow-y:auto 로 캡 초과분 스크롤.\n maxRows == null && 'overflow-hidden',\n // When label is down (acting as placeholder), hide textarea's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n style={{\n resize: 'none',\n ...style,\n }}\n {...textareaProps}\n />\n </div>\n )\n },\n)\nTextarea.displayName = 'Textarea'\n\nexport { Textarea }\n"],"names":[],"mappings":";;;;;;;;;;AAYA,MAAM,4BAA4B;AAAA,EAChC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,YAAY;AAAA,QACV,UAAU;AAAA,UACR;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,kBAAkB;AAAA,MAChB;AAAA,QACE,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,YAAY;AAAA,MACZ,WAAW;AAAA,IAAA;AAAA,EACb;AAEJ;AAwBA,MAAM,WAAW,MAAM;AAAA,EACrB,CACE;AAAA,IACE,aAAa;AAAA,IACb;AAAA,IACA,UAAU;AAAA,IACV,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,iBACG;AACH,UAAM,cAAc,sBAAA;AACpB,UAAM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QACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AACA,SAAS,cAAc;"}
@@ -6,6 +6,7 @@ const React = require("react");
6
6
  const classVarianceAuthority = require("class-variance-authority");
7
7
  const cancelIcon = require("./_internal/cancelIcon.cjs");
8
8
  const floatingLabelOutline = require("./_internal/floatingLabelOutline.cjs");
9
+ const useControllableValue = require("../hooks/useControllableValue.cjs");
9
10
  const useFloatingLabel = require("../hooks/useFloatingLabel.cjs");
10
11
  const cn = require("../utils/cn.cjs");
11
12
  const form = require("./form.cjs");
@@ -83,11 +84,12 @@ const TextField = React__namespace.forwardRef(
83
84
  const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false;
84
85
  const inputRef = React__namespace.useRef(null);
85
86
  const [isFocused, setIsFocused] = React__namespace.useState(false);
86
- const isControlled = valueProp !== void 0;
87
- const [internalValue, setInternalValue] = React__namespace.useState(
88
- defaultValue !== void 0 ? String(defaultValue) : ""
89
- );
90
- const hasValue = isControlled ? String(valueProp) !== "" : internalValue !== "";
87
+ const {
88
+ value,
89
+ setValue: trackValue,
90
+ isControlled
91
+ } = useControllableValue.useControllableValue({ value: valueProp, defaultValue, empty: "" });
92
+ const hasValue = String(value) !== "";
91
93
  const composedRef = React__namespace.useCallback(
92
94
  (node) => {
93
95
  inputRef.current = node;
@@ -116,10 +118,10 @@ const TextField = React__namespace.forwardRef(
116
118
  const showNoneLabel = hasLabel && appearance === "none";
117
119
  const handleChange = React__namespace.useCallback(
118
120
  (e) => {
119
- if (!isControlled) setInternalValue(e.target.value);
121
+ trackValue(e.target.value);
120
122
  onChangeProp?.(e);
121
123
  },
122
- [isControlled, onChangeProp]
124
+ [trackValue, onChangeProp]
123
125
  );
124
126
  const handleFocus = React__namespace.useCallback(
125
127
  (e) => {
@@ -138,14 +140,14 @@ const TextField = React__namespace.forwardRef(
138
140
  const handleClear = React__namespace.useCallback(() => {
139
141
  const input = inputRef.current;
140
142
  if (!input) return;
141
- if (!isControlled) setInternalValue("");
143
+ trackValue("");
142
144
  const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
143
145
  if (nativeSetter) {
144
146
  nativeSetter.call(input, "");
145
147
  input.dispatchEvent(new Event("input", { bubbles: true }));
146
148
  }
147
149
  input.focus();
148
- }, [isControlled]);
150
+ }, [trackValue]);
149
151
  return /* @__PURE__ */ jsxRuntime.jsxs(
150
152
  "div",
151
153
  {
@@ -203,7 +205,7 @@ const TextField = React__namespace.forwardRef(
203
205
  ref: composedRef,
204
206
  disabled,
205
207
  readOnly,
206
- value: isControlled ? valueProp : void 0,
208
+ value: isControlled ? value : void 0,
207
209
  defaultValue: !isControlled ? defaultValue : void 0,
208
210
  onChange: handleChange,
209
211
  onFocus: handleFocus,
@@ -1 +1 @@
1
- {"version":3,"file":"textField.cjs","sources":["../../src/components/textField.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\n\nimport { CancelIcon, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS } from './_internal/cancelIcon'\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textFieldContainerVariants = cva(\n [\n 'flex w-full items-center gap-[2px] bg-transparent',\n 'rounded-small min-h-[36px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextFieldProps = Omit<React.ComponentProps<'input'>, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** Clear 버튼 표시 여부 */\n hasClearButton?: boolean\n /** 입력 필드 왼쪽 아이콘/요소 슬롯 */\n elemBeforeInput?: React.ReactNode\n /** 입력 필드 오른쪽 아이콘/요소 슬롯 */\n elemAfterInput?: React.ReactNode\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n}\n\n/**\n * 한 줄 텍스트 입력. 폼의 이름·코드·URL·숫자 같은 짧은 값에 쓴다.\n *\n * 언제 쓰나: `FormField` 안에서 `FormControl` 로 감싸 오류 상태를 받는다. 라벨은 `FormLabel` 로 두고, 독립 사용 시에만 `label`(floating) 을 쓴다.\n * 언제 안 쓰나: 여러 줄 입력(→ Textarea), 정해진 선택지(→ Select·RadioGroup), 목록 검색·필터(→ ColumnFilter·TableFilter*).\n * 대신/함께: 지우기 버튼은 `hasClearButton`, 단위·아이콘은 `elemBeforeInput`/`elemAfterInput`.\n */\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n hasClearButton,\n elemBeforeInput,\n elemAfterInput,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n ...inputProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // Controlled vs Uncontrolled hasValue tracking\n const isControlled = valueProp !== undefined\n const [internalValue, setInternalValue] = React.useState(\n defaultValue !== undefined ? String(defaultValue) : '',\n )\n const hasValue = isControlled ? String(valueProp) !== '' : internalValue !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setInternalValue(e.target.value)\n onChangeProp?.(e)\n },\n [isControlled, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n const handleClear = React.useCallback(() => {\n const input = inputRef.current\n if (!input) return\n\n if (!isControlled) setInternalValue('')\n\n // Set value via native setter to trigger React's onChange\n const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set\n if (nativeSetter) {\n nativeSetter.call(input, '')\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n input.focus()\n }, [isControlled])\n\n return (\n <div\n data-slot='text-field'\n aria-disabled={disabled || undefined}\n className={cn(\n textFieldContainerVariants({ appearance, isInvalid }),\n CLEAR_HOST_CLASS,\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner input 이 아닌 여기에 머지한다.\n className,\n )}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Left icon slot — label이 down 상태(placeholder 역할)일 때 숨김 */}\n {elemBeforeInput && (\n <span\n className={cn(\n // 아이콘은 24×24, 글자(\"개\"·\"코어\")는 줄바꿈 없이 폭이 늘어난다 — 고정 size-[24px] 는 두 글자가 두 줄로 깨졌다 (2026-10-12)\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemBeforeInput === 'string' && 'px-[2px] text-sys-text-subtle',\n hasLabel && !isFloating && 'invisible',\n )}\n >\n {elemBeforeInput}\n </span>\n )}\n\n {/* Input */}\n <input\n ref={composedRef}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? valueProp : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // When label is down (acting as placeholder), hide input's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n {...inputProps}\n />\n\n {/* Clear button — 항상 공간 확보, 값 없으면 invisible (너비 점프 방지), 값이 있으면 마우스·포커스 때만 보임 */}\n {hasClearButton && (\n <button\n type='button'\n onClick={handleClear}\n className={cn(\n 'shrink-0 flex items-center justify-center p-[2px] rounded-small hover:bg-secondary-o10 text-sys-text-subtler',\n CLEAR_REVEAL_CLASS,\n (!hasValue || disabled || readOnly) && 'invisible',\n )}\n aria-label='입력 지우기'\n tabIndex={-1}\n >\n <CancelIcon size={20} />\n </button>\n )}\n\n {/* Right icon slot */}\n {elemAfterInput && (\n <span\n className={cn(\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemAfterInput === 'string' && 'px-[2px] text-sys-text-subtle',\n )}\n >\n {elemAfterInput}\n </span>\n )}\n </div>\n )\n },\n)\nTextField.displayName = 'TextField'\n\nexport { TextField }\n"],"names":["cva","React","useFormControlContext","useFloatingLabel","jsxs","cn","CLEAR_HOST_CLASS","jsx","FloatingLabelOutline","CLEAR_REVEAL_CLASS","CancelIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAM,6BAA6BA,uBAAAA;AAAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,YAAY;AAAA,QACV,UAAU;AAAA,UACR;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,kBAAkB;AAAA,MAChB;AAAA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AU;AAAA,cAEV,UAAAF,2BAAAA,IAACG,WAAAA,YAAA,EAAW,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAKzB,kBACCH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWF,GAAAA;AAAAA,gBACT;AAAA,gBACA,OAAO,mBAAmB,YAAY;AAAA,cAAA;AAAA,cAGvC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,UAAU,cAAc;;"}
1
+ {"version":3,"file":"textField.cjs","sources":["../../src/components/textField.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\n\nimport { CancelIcon, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS } from './_internal/cancelIcon'\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useControllableValue } from '../hooks/useControllableValue'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textFieldContainerVariants = cva(\n [\n 'flex w-full items-center gap-[2px] bg-transparent',\n 'rounded-small min-h-[36px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextFieldProps = Omit<React.ComponentProps<'input'>, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** Clear 버튼 표시 여부 */\n hasClearButton?: boolean\n /** 입력 필드 왼쪽 아이콘/요소 슬롯 */\n elemBeforeInput?: React.ReactNode\n /** 입력 필드 오른쪽 아이콘/요소 슬롯 */\n elemAfterInput?: React.ReactNode\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n}\n\n/**\n * 한 줄 텍스트 입력. 폼의 이름·코드·URL·숫자 같은 짧은 값에 쓴다.\n *\n * 언제 쓰나: `FormField` 안에서 `FormControl` 로 감싸 오류 상태를 받는다. 라벨은 `FormLabel` 로 두고, 독립 사용 시에만 `label`(floating) 을 쓴다.\n * 언제 안 쓰나: 여러 줄 입력(→ Textarea), 정해진 선택지(→ Select·RadioGroup), 목록 검색·필터(→ ColumnFilter·TableFilter*).\n * 대신/함께: 지우기 버튼은 `hasClearButton`, 단위·아이콘은 `elemBeforeInput`/`elemAfterInput`.\n */\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n hasClearButton,\n elemBeforeInput,\n elemAfterInput,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n ...inputProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // 비제어일 때 네이티브 입력이 값을 들고, 훅은 라벨·지우기 버튼용 hasValue 만 따라간다\n const {\n value,\n setValue: trackValue,\n isControlled,\n } = useControllableValue({ value: valueProp, defaultValue, empty: '' })\n const hasValue = String(value) !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n trackValue(e.target.value)\n onChangeProp?.(e)\n },\n [trackValue, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n const handleClear = React.useCallback(() => {\n const input = inputRef.current\n if (!input) return\n\n trackValue('')\n\n // Set value via native setter to trigger React's onChange\n const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set\n if (nativeSetter) {\n nativeSetter.call(input, '')\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n input.focus()\n }, [trackValue])\n\n return (\n <div\n data-slot='text-field'\n aria-disabled={disabled || undefined}\n className={cn(\n textFieldContainerVariants({ appearance, isInvalid }),\n CLEAR_HOST_CLASS,\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner input 이 아닌 여기에 머지한다.\n className,\n )}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Left icon slot — label이 down 상태(placeholder 역할)일 때 숨김 */}\n {elemBeforeInput && (\n <span\n className={cn(\n // 아이콘은 24×24, 글자(\"개\"·\"코어\")는 줄바꿈 없이 폭이 늘어난다 — 고정 size-[24px] 는 두 글자가 두 줄로 깨졌다 (2026-10-12)\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemBeforeInput === 'string' && 'px-[2px] text-sys-text-subtle',\n hasLabel && !isFloating && 'invisible',\n )}\n >\n {elemBeforeInput}\n </span>\n )}\n\n {/* Input */}\n <input\n ref={composedRef}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? value : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // When label is down (acting as placeholder), hide input's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n {...inputProps}\n />\n\n {/* Clear button — 항상 공간 확보, 값 없으면 invisible (너비 점프 방지), 값이 있으면 마우스·포커스 때만 보임 */}\n {hasClearButton && (\n <button\n type='button'\n onClick={handleClear}\n className={cn(\n 'shrink-0 flex items-center justify-center p-[2px] rounded-small hover:bg-secondary-o10 text-sys-text-subtler',\n CLEAR_REVEAL_CLASS,\n (!hasValue || disabled || readOnly) && 'invisible',\n )}\n aria-label='입력 지우기'\n tabIndex={-1}\n >\n <CancelIcon size={20} />\n </button>\n )}\n\n {/* Right icon slot */}\n {elemAfterInput && (\n <span\n className={cn(\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemAfterInput === 'string' && 'px-[2px] text-sys-text-subtle',\n )}\n >\n {elemAfterInput}\n </span>\n )}\n </div>\n )\n },\n)\nTextField.displayName = 'TextField'\n\nexport { TextField }\n"],"names":["cva","React","useFormControlContext","useControllableValue","useFloatingLabel","jsxs","cn","CLEAR_HOST_CLASS","jsx","FloatingLabelOutline","CLEAR_REVEAL_CLASS","CancelIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,6BAA6BA,uBAAAA;AAAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,YAAY;AAAA,QACV,UAAU;AAAA,UACR;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,kBAAkB;AAAA,MAChB;AAAA,QACE,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,YAAY;AA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A;AAAAA,gBACT;AAAA,gBACA,OAAO,mBAAmB,YAAY;AAAA,cAAA;AAAA,cAGvC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,UAAU,cAAc;;"}
@@ -4,6 +4,7 @@ import * as React from "react";
4
4
  import { cva } from "class-variance-authority";
5
5
  import { CancelIcon, CLEAR_REVEAL_CLASS, CLEAR_HOST_CLASS } from "./_internal/cancelIcon.js";
6
6
  import { FloatingLabelOutline } from "./_internal/floatingLabelOutline.js";
7
+ import { useControllableValue } from "../hooks/useControllableValue.js";
7
8
  import { useFloatingLabel } from "../hooks/useFloatingLabel.js";
8
9
  import { cn } from "../utils/cn.js";
9
10
  import { useFormControlContext } from "./form.js";
@@ -64,11 +65,12 @@ const TextField = React.forwardRef(
64
65
  const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false;
65
66
  const inputRef = React.useRef(null);
66
67
  const [isFocused, setIsFocused] = React.useState(false);
67
- const isControlled = valueProp !== void 0;
68
- const [internalValue, setInternalValue] = React.useState(
69
- defaultValue !== void 0 ? String(defaultValue) : ""
70
- );
71
- const hasValue = isControlled ? String(valueProp) !== "" : internalValue !== "";
68
+ const {
69
+ value,
70
+ setValue: trackValue,
71
+ isControlled
72
+ } = useControllableValue({ value: valueProp, defaultValue, empty: "" });
73
+ const hasValue = String(value) !== "";
72
74
  const composedRef = React.useCallback(
73
75
  (node) => {
74
76
  inputRef.current = node;
@@ -97,10 +99,10 @@ const TextField = React.forwardRef(
97
99
  const showNoneLabel = hasLabel && appearance === "none";
98
100
  const handleChange = React.useCallback(
99
101
  (e) => {
100
- if (!isControlled) setInternalValue(e.target.value);
102
+ trackValue(e.target.value);
101
103
  onChangeProp?.(e);
102
104
  },
103
- [isControlled, onChangeProp]
105
+ [trackValue, onChangeProp]
104
106
  );
105
107
  const handleFocus = React.useCallback(
106
108
  (e) => {
@@ -119,14 +121,14 @@ const TextField = React.forwardRef(
119
121
  const handleClear = React.useCallback(() => {
120
122
  const input = inputRef.current;
121
123
  if (!input) return;
122
- if (!isControlled) setInternalValue("");
124
+ trackValue("");
123
125
  const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
124
126
  if (nativeSetter) {
125
127
  nativeSetter.call(input, "");
126
128
  input.dispatchEvent(new Event("input", { bubbles: true }));
127
129
  }
128
130
  input.focus();
129
- }, [isControlled]);
131
+ }, [trackValue]);
130
132
  return /* @__PURE__ */ jsxs(
131
133
  "div",
132
134
  {
@@ -184,7 +186,7 @@ const TextField = React.forwardRef(
184
186
  ref: composedRef,
185
187
  disabled,
186
188
  readOnly,
187
- value: isControlled ? valueProp : void 0,
189
+ value: isControlled ? value : void 0,
188
190
  defaultValue: !isControlled ? defaultValue : void 0,
189
191
  onChange: handleChange,
190
192
  onFocus: handleFocus,
@@ -1 +1 @@
1
- {"version":3,"file":"textField.js","sources":["../../src/components/textField.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\n\nimport { CancelIcon, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS } from './_internal/cancelIcon'\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textFieldContainerVariants = cva(\n [\n 'flex w-full items-center gap-[2px] bg-transparent',\n 'rounded-small min-h-[36px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextFieldProps = Omit<React.ComponentProps<'input'>, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** Clear 버튼 표시 여부 */\n hasClearButton?: boolean\n /** 입력 필드 왼쪽 아이콘/요소 슬롯 */\n elemBeforeInput?: React.ReactNode\n /** 입력 필드 오른쪽 아이콘/요소 슬롯 */\n elemAfterInput?: React.ReactNode\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n}\n\n/**\n * 한 줄 텍스트 입력. 폼의 이름·코드·URL·숫자 같은 짧은 값에 쓴다.\n *\n * 언제 쓰나: `FormField` 안에서 `FormControl` 로 감싸 오류 상태를 받는다. 라벨은 `FormLabel` 로 두고, 독립 사용 시에만 `label`(floating) 을 쓴다.\n * 언제 안 쓰나: 여러 줄 입력(→ Textarea), 정해진 선택지(→ Select·RadioGroup), 목록 검색·필터(→ ColumnFilter·TableFilter*).\n * 대신/함께: 지우기 버튼은 `hasClearButton`, 단위·아이콘은 `elemBeforeInput`/`elemAfterInput`.\n */\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n hasClearButton,\n elemBeforeInput,\n elemAfterInput,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n ...inputProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // Controlled vs Uncontrolled hasValue tracking\n const isControlled = valueProp !== undefined\n const [internalValue, setInternalValue] = React.useState(\n defaultValue !== undefined ? String(defaultValue) : '',\n )\n const hasValue = isControlled ? String(valueProp) !== '' : internalValue !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setInternalValue(e.target.value)\n onChangeProp?.(e)\n },\n [isControlled, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n const handleClear = React.useCallback(() => {\n const input = inputRef.current\n if (!input) return\n\n if (!isControlled) setInternalValue('')\n\n // Set value via native setter to trigger React's onChange\n const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set\n if (nativeSetter) {\n nativeSetter.call(input, '')\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n input.focus()\n }, [isControlled])\n\n return (\n <div\n data-slot='text-field'\n aria-disabled={disabled || undefined}\n className={cn(\n textFieldContainerVariants({ appearance, isInvalid }),\n CLEAR_HOST_CLASS,\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner input 이 아닌 여기에 머지한다.\n className,\n )}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Left icon slot — label이 down 상태(placeholder 역할)일 때 숨김 */}\n {elemBeforeInput && (\n <span\n className={cn(\n // 아이콘은 24×24, 글자(\"개\"·\"코어\")는 줄바꿈 없이 폭이 늘어난다 — 고정 size-[24px] 는 두 글자가 두 줄로 깨졌다 (2026-10-12)\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemBeforeInput === 'string' && 'px-[2px] text-sys-text-subtle',\n hasLabel && !isFloating && 'invisible',\n )}\n >\n {elemBeforeInput}\n </span>\n )}\n\n {/* Input */}\n <input\n ref={composedRef}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? valueProp : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // When label is down (acting as placeholder), hide input's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n {...inputProps}\n />\n\n {/* Clear button — 항상 공간 확보, 값 없으면 invisible (너비 점프 방지), 값이 있으면 마우스·포커스 때만 보임 */}\n {hasClearButton && (\n <button\n type='button'\n onClick={handleClear}\n className={cn(\n 'shrink-0 flex items-center justify-center p-[2px] rounded-small hover:bg-secondary-o10 text-sys-text-subtler',\n CLEAR_REVEAL_CLASS,\n (!hasValue || disabled || readOnly) && 'invisible',\n )}\n aria-label='입력 지우기'\n tabIndex={-1}\n >\n <CancelIcon size={20} />\n </button>\n )}\n\n {/* Right icon slot */}\n {elemAfterInput && (\n <span\n className={cn(\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemAfterInput === 'string' && 'px-[2px] text-sys-text-subtle',\n )}\n >\n {elemAfterInput}\n </span>\n )}\n </div>\n )\n },\n)\nTextField.displayName = 'TextField'\n\nexport { TextField }\n"],"names":[],"mappings":";;;;;;;;;AAWA,MAAM,6BAA6B;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,YAAY;AAAA,QACV,UAAU;AAAA,UACR;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,kBAAkB;AAAA,MAChB;AAAA,QACE,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA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AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,UAAU,cAAc;"}
1
+ {"version":3,"file":"textField.js","sources":["../../src/components/textField.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\n\nimport { CancelIcon, CLEAR_HOST_CLASS, CLEAR_REVEAL_CLASS } from './_internal/cancelIcon'\nimport { FloatingLabelOutline } from './_internal/floatingLabelOutline'\nimport { useControllableValue } from '../hooks/useControllableValue'\nimport { useFloatingLabel } from '../hooks/useFloatingLabel'\nimport { cn } from '../utils/cn'\nimport { useFormControlContext } from './form'\n\nconst textFieldContainerVariants = cva(\n [\n 'flex w-full items-center gap-[2px] bg-transparent',\n 'rounded-small min-h-[36px] text-base-medium text-sys-text-main',\n 'transition-colors',\n ].join(' '),\n {\n variants: {\n appearance: {\n standard: [\n 'bg-sys-background border border-sys-divider-main py-[3px] px-[5px]',\n 'hover:bg-secondary-o10',\n ].join(' '),\n none: 'bg-transparent border-none py-[4px] px-[6px]',\n },\n isInvalid: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n appearance: 'standard',\n isInvalid: true,\n class: 'border-[2px] border-danger30 py-[2px] px-[4px]',\n },\n ],\n defaultVariants: {\n appearance: 'standard',\n isInvalid: false,\n },\n },\n)\n\nexport type TextFieldProps = Omit<React.ComponentProps<'input'>, 'children'> & {\n /** @default 'standard' */\n appearance?: 'standard' | 'none'\n /** Floating label 텍스트 */\n label?: string\n /** 라벨 필수 표시 (*) */\n required?: boolean\n /** Clear 버튼 표시 여부 */\n hasClearButton?: boolean\n /** 입력 필드 왼쪽 아이콘/요소 슬롯 */\n elemBeforeInput?: React.ReactNode\n /** 입력 필드 오른쪽 아이콘/요소 슬롯 */\n elemAfterInput?: React.ReactNode\n /** 에러 상태 */\n isInvalid?: boolean\n /** 컨테이너 div에 적용할 추가 className */\n containerClassName?: string\n}\n\n/**\n * 한 줄 텍스트 입력. 폼의 이름·코드·URL·숫자 같은 짧은 값에 쓴다.\n *\n * 언제 쓰나: `FormField` 안에서 `FormControl` 로 감싸 오류 상태를 받는다. 라벨은 `FormLabel` 로 두고, 독립 사용 시에만 `label`(floating) 을 쓴다.\n * 언제 안 쓰나: 여러 줄 입력(→ Textarea), 정해진 선택지(→ Select·RadioGroup), 목록 검색·필터(→ ColumnFilter·TableFilter*).\n * 대신/함께: 지우기 버튼은 `hasClearButton`, 단위·아이콘은 `elemBeforeInput`/`elemAfterInput`.\n */\nconst TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n appearance = 'standard',\n label,\n required: requiredProp,\n hasClearButton,\n elemBeforeInput,\n elemAfterInput,\n isInvalid: isInvalidProp,\n containerClassName,\n className,\n disabled,\n readOnly,\n value: valueProp,\n defaultValue,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n ...inputProps\n },\n forwardedRef,\n ) => {\n const formControl = useFormControlContext()\n const isInvalid = isInvalidProp ?? formControl?.isInvalid ?? false\n const inputRef = React.useRef<HTMLInputElement>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n // 비제어일 때 네이티브 입력이 값을 들고, 훅은 라벨·지우기 버튼용 hasValue 만 따라간다\n const {\n value,\n setValue: trackValue,\n isControlled,\n } = useControllableValue({ value: valueProp, defaultValue, empty: '' })\n const hasValue = String(value) !== ''\n\n // Compose refs (forwarded ref + internal ref)\n const composedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef)\n (forwardedRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n },\n [forwardedRef],\n )\n\n // Floating label\n const {\n hasLabel,\n isFloating,\n isMounted,\n labelColorClass,\n borderColorClass,\n isThickBorder,\n labelId,\n } = useFloatingLabel({\n label,\n hasValue,\n isFocused,\n isInvalid: !!isInvalid,\n isDisabled: !!disabled,\n appearance,\n })\n\n const showNotchedOutline = hasLabel && appearance !== 'none'\n const showNoneLabel = hasLabel && appearance === 'none'\n\n // --- Handlers ---\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n trackValue(e.target.value)\n onChangeProp?.(e)\n },\n [trackValue, onChangeProp],\n )\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onFocusProp?.(e)\n },\n [onFocusProp],\n )\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n onBlurProp?.(e)\n },\n [onBlurProp],\n )\n\n const handleClear = React.useCallback(() => {\n const input = inputRef.current\n if (!input) return\n\n trackValue('')\n\n // Set value via native setter to trigger React's onChange\n const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set\n if (nativeSetter) {\n nativeSetter.call(input, '')\n input.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n input.focus()\n }, [trackValue])\n\n return (\n <div\n data-slot='text-field'\n aria-disabled={disabled || undefined}\n className={cn(\n textFieldContainerVariants({ appearance, isInvalid }),\n CLEAR_HOST_CLASS,\n // Focus styling (state-managed, standard appearance without notched outline only)\n isFocused &&\n !isInvalid &&\n appearance === 'standard' &&\n !showNotchedOutline &&\n 'border-[2px] border-sys-focus-ring-bold py-[2px] px-[4px]',\n // Floating label positioning\n (showNotchedOutline || showNoneLabel) && 'relative',\n // Notched outline draws border — remove container's own border\n showNotchedOutline && '!border-0 !py-[4px] !px-[6px]',\n // Disabled / cursor\n disabled ? 'cursor-not-allowed opacity-50' : 'cursor-text',\n // disabled 시 hover 배경 무력화 (div container라 :disabled 불가 → JS 조건부; none은 원래 hover bg 없음)\n disabled && appearance !== 'none' && 'hover:bg-sys-background',\n containerClassName,\n // 외부 className 은 root container 에 적용 — FormControl 의 maxWidth 가\n // 자식 className 에 inject 되는데, wrapper div 의 폭 제어가 의도이므로\n // inner input 이 아닌 여기에 머지한다.\n className,\n )}\n >\n {/* Floating label (standard: notched outline, none: inline label) */}\n {(showNotchedOutline || showNoneLabel) && (\n <FloatingLabelOutline\n mode={showNotchedOutline ? 'standard' : 'none'}\n label={label!}\n required={requiredProp}\n isFloating={isFloating}\n isMounted={isMounted}\n labelColorClass={labelColorClass}\n borderColorClass={borderColorClass}\n isThickBorder={isThickBorder}\n labelId={labelId}\n />\n )}\n\n {/* Left icon slot — label이 down 상태(placeholder 역할)일 때 숨김 */}\n {elemBeforeInput && (\n <span\n className={cn(\n // 아이콘은 24×24, 글자(\"개\"·\"코어\")는 줄바꿈 없이 폭이 늘어난다 — 고정 size-[24px] 는 두 글자가 두 줄로 깨졌다 (2026-10-12)\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemBeforeInput === 'string' && 'px-[2px] text-sys-text-subtle',\n hasLabel && !isFloating && 'invisible',\n )}\n >\n {elemBeforeInput}\n </span>\n )}\n\n {/* Input */}\n <input\n ref={composedRef}\n disabled={disabled}\n readOnly={readOnly}\n value={isControlled ? value : undefined}\n defaultValue={!isControlled ? defaultValue : undefined}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-labelledby={hasLabel ? labelId : undefined}\n aria-required={hasLabel && requiredProp ? true : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent border-none outline-none',\n 'text-base-medium text-sys-text-main',\n 'placeholder:text-sys-text-placeholder',\n 'disabled:cursor-not-allowed',\n 'px-[4px] py-[2px]',\n // When label is down (acting as placeholder), hide input's placeholder\n hasLabel && !hasValue && !isFocused && 'placeholder:text-transparent',\n )}\n {...inputProps}\n />\n\n {/* Clear button — 항상 공간 확보, 값 없으면 invisible (너비 점프 방지), 값이 있으면 마우스·포커스 때만 보임 */}\n {hasClearButton && (\n <button\n type='button'\n onClick={handleClear}\n className={cn(\n 'shrink-0 flex items-center justify-center p-[2px] rounded-small hover:bg-secondary-o10 text-sys-text-subtler',\n CLEAR_REVEAL_CLASS,\n (!hasValue || disabled || readOnly) && 'invisible',\n )}\n aria-label='입력 지우기'\n tabIndex={-1}\n >\n <CancelIcon size={20} />\n </button>\n )}\n\n {/* Right icon slot */}\n {elemAfterInput && (\n <span\n className={cn(\n 'shrink-0 flex items-center justify-center h-[24px] min-w-[24px] whitespace-nowrap',\n typeof elemAfterInput === 'string' && 'px-[2px] text-sys-text-subtle',\n )}\n >\n {elemAfterInput}\n </span>\n )}\n </div>\n )\n },\n)\nTextField.displayName = 'TextField'\n\nexport { TextField }\n"],"names":[],"mappings":";;;;;;;;;;AAYA,MAAM,6BAA6B;AAAA,EACjC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,YAAY;AAAA,QACV,UAAU;AAAA,UACR;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,MAER,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,kBAAkB;AAAA,MAChB;AAAA,QACE,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,YAAY;AAAA,MACZ,WAAW;AAAA,IAAA;AAAA,EACb;AAEJ;AA4BA,MAAM,YAAY,MAAM;AAAA,EACtB,CACE;AAAA,IACE,aAAa;AAAA,IACb;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,GAAG;AAAA,EAAA,GAEL,iBACG;AACH,UAAM,cAAc,sBAAA;AACpB,UAAM,YAAY,iBAAiB,aAAa,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7C,UAAU;AAAA,cACV,SAAS;AAAA,cACT,QAAQ;AAAA,cACR,mBAAiB,WAAW,UAAU;AAAA,cACtC,iBAAe,YAAY,eAAe,OAAO;AAAA,cACjD,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,gBAEA,YAAY,CAAC,YAAY,CAAC,aAAa;AAAA,cAAA;AAAA,cAExC,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,UAIL,kBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS;AAAA,cACT,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,iBACC,CAAC,YAAY,YAAY,aAAa;AAAA,cAAA;AAAA,cAEzC,cAAW;AAAA,cACX,UAAU;AAAA,cAEV,UAAA,oBAAC,YAAA,EAAW,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAKzB,kBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,OAAO,mBAAmB,YAAY;AAAA,cAAA;AAAA,cAGvC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,UAAU,cAAc;"}
@@ -54,7 +54,7 @@ const TooltipContent = React__namespace.forwardRef(({ className, sideOffset = 4,
54
54
  ref,
55
55
  sideOffset,
56
56
  className: cn.cn(
57
- "z-[var(--root-z-index)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
57
+ "z-[var(--z-index-tooltip)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
58
58
  className
59
59
  ),
60
60
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.cjs","sources":["../../src/components/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { isRestoringFocus } from './_internal/useRestoreFocusToOpener'\nimport { cn } from '../utils/cn'\nimport { sanitizeUserText } from '../utils/sanitizeUserText'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\n// `:focus-visible` 을 모르는 환경에서는 matches 가 던진다 — 그때는 키보드로 본다(Tooltip 을 막지 않는 쪽)\nfunction isKeyboardFocus(el: Element) {\n try {\n return el.matches(':focus-visible')\n } catch {\n return true\n }\n}\n\n/**\n * 마우스를 올리거나 포커스했을 때 뜨는 짧은 글자 설명.\n *\n * 언제 쓰나: 아이콘만 있는 버튼의 이름, 말줄임으로 잘린 글자 전체.\n * 언제 안 쓰나: 꼭 읽어야 하는 정보·오류(→ FormDescription·FormMessage·Alert), 대화형 내용(→ Popover), 터치 화면에서만 쓰는 정보(마우스를 올릴 수 없다).\n * 대신/함께: IconButton 에는 Tooltip 과 함께 `aria-label` 을 준다.\n */\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(({ className, onFocus, ...props }, ref) => (\n <TooltipPrimitive.Trigger\n type='button'\n ref={ref}\n className={cn(className)}\n {...props}\n onFocus={(e) => {\n onFocus?.(e)\n // Drawer·Dialog·AlertDialog 가 닫히며 연 버튼에 포커스를 돌려주면 Radix 가 포인터 없는 포커스로 보고 Tooltip 을 연다 —\n // 마우스로 닫았는데 Tooltip 이 다시 떠서 남는다. 그 한 번만 막는다(Radix 는 막힌 focus 를 건너뛴다).\n // 키보드(Esc)로 닫은 경우는 포커스 링과 함께 Tooltip 도 뜨는 것이 맞아 그대로 둔다\n if (isRestoringFocus() && !isKeyboardFocus(e.target)) e.preventDefault()\n }}\n />\n))\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, children, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--root-z-index)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]',\n className,\n )}\n {...props}\n >\n {sanitizeUserText(children)}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"],"names":["TooltipPrimitive","React","jsx","cn","isRestoringFocus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,kBAAkBA,4BAAiB;AAGzC,SAAS,gBAAgB,IAAa;AACpC,MAAI;AACF,WAAO,GAAG,QAAQ,gBAAgB;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,MAAM,UAAUA,4BAAiB;AAEjC,MAAM,iBAAiBC,iBAAM,WAG3B,CAAC,EAAE,WAAW,SAAS,GAAG,SAAS,QACnCC,2BAAAA;AAAAA,EAACF,4BAAiB;AAAA,EAAjB;AAAA,IACC,MAAK;AAAA,IACL;AAAA,IACA,WAAWG,GAAAA,GAAG,SAAS;AAAA,IACtB,GAAG;AAAA,IACJ,SAAS,CAAC,MAAM;AACd,gBAAU,CAAC;AAIX,UAAIC,wBAAAA,iBAAA,KAAsB,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAA;AAAA,IAC1D;AAAA,EAAA;AACF,CACD;AACD,eAAe,cAAcJ,4BAAiB,QAAQ;AAEtD,MAAM,iBAAiBC,iBAAM,WAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,UAAU,GAAG,SAAS,QACpDC,2BAAAA,IAACF,4BAAiB,QAAjB,EACC,UAAAE,2BAAAA;AAAAA,EAACF,4BAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAWG,GAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH,4CAAiB,QAAQ;AAAA,EAAA;AAC5B,GACF,CACD;AACD,eAAe,cAAcH,4BAAiB,QAAQ;;;;;"}
1
+ {"version":3,"file":"tooltip.cjs","sources":["../../src/components/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { isRestoringFocus } from './_internal/useRestoreFocusToOpener'\nimport { cn } from '../utils/cn'\nimport { sanitizeUserText } from '../utils/sanitizeUserText'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\n// `:focus-visible` 을 모르는 환경에서는 matches 가 던진다 — 그때는 키보드로 본다(Tooltip 을 막지 않는 쪽)\nfunction isKeyboardFocus(el: Element) {\n try {\n return el.matches(':focus-visible')\n } catch {\n return true\n }\n}\n\n/**\n * 마우스를 올리거나 포커스했을 때 뜨는 짧은 글자 설명.\n *\n * 언제 쓰나: 아이콘만 있는 버튼의 이름, 말줄임으로 잘린 글자 전체.\n * 언제 안 쓰나: 꼭 읽어야 하는 정보·오류(→ FormDescription·FormMessage·Alert), 대화형 내용(→ Popover), 터치 화면에서만 쓰는 정보(마우스를 올릴 수 없다).\n * 대신/함께: IconButton 에는 Tooltip 과 함께 `aria-label` 을 준다.\n */\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(({ className, onFocus, ...props }, ref) => (\n <TooltipPrimitive.Trigger\n type='button'\n ref={ref}\n className={cn(className)}\n {...props}\n onFocus={(e) => {\n onFocus?.(e)\n // Drawer·Dialog·AlertDialog 가 닫히며 연 버튼에 포커스를 돌려주면 Radix 가 포인터 없는 포커스로 보고 Tooltip 을 연다 —\n // 마우스로 닫았는데 Tooltip 이 다시 떠서 남는다. 그 한 번만 막는다(Radix 는 막힌 focus 를 건너뛴다).\n // 키보드(Esc)로 닫은 경우는 포커스 링과 함께 Tooltip 도 뜨는 것이 맞아 그대로 둔다\n if (isRestoringFocus() && !isKeyboardFocus(e.target)) e.preventDefault()\n }}\n />\n))\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, children, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--z-index-tooltip)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]',\n className,\n )}\n {...props}\n >\n {sanitizeUserText(children)}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"],"names":["TooltipPrimitive","React","jsx","cn","isRestoringFocus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,kBAAkBA,4BAAiB;AAGzC,SAAS,gBAAgB,IAAa;AACpC,MAAI;AACF,WAAO,GAAG,QAAQ,gBAAgB;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,MAAM,UAAUA,4BAAiB;AAEjC,MAAM,iBAAiBC,iBAAM,WAG3B,CAAC,EAAE,WAAW,SAAS,GAAG,SAAS,QACnCC,2BAAAA;AAAAA,EAACF,4BAAiB;AAAA,EAAjB;AAAA,IACC,MAAK;AAAA,IACL;AAAA,IACA,WAAWG,GAAAA,GAAG,SAAS;AAAA,IACtB,GAAG;AAAA,IACJ,SAAS,CAAC,MAAM;AACd,gBAAU,CAAC;AAIX,UAAIC,wBAAAA,iBAAA,KAAsB,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAA;AAAA,IAC1D;AAAA,EAAA;AACF,CACD;AACD,eAAe,cAAcJ,4BAAiB,QAAQ;AAEtD,MAAM,iBAAiBC,iBAAM,WAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,UAAU,GAAG,SAAS,QACpDC,2BAAAA,IAACF,4BAAiB,QAAjB,EACC,UAAAE,2BAAAA;AAAAA,EAACF,4BAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAWG,GAAAA;AAAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH,4CAAiB,QAAQ;AAAA,EAAA;AAC5B,GACF,CACD;AACD,eAAe,cAAcH,4BAAiB,QAAQ;;;;;"}
@@ -34,7 +34,7 @@ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, children,
34
34
  ref,
35
35
  sideOffset,
36
36
  className: cn(
37
- "z-[var(--root-z-index)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
37
+ "z-[var(--z-index-tooltip)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
38
38
  className
39
39
  ),
40
40
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../src/components/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { isRestoringFocus } from './_internal/useRestoreFocusToOpener'\nimport { cn } from '../utils/cn'\nimport { sanitizeUserText } from '../utils/sanitizeUserText'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\n// `:focus-visible` 을 모르는 환경에서는 matches 가 던진다 — 그때는 키보드로 본다(Tooltip 을 막지 않는 쪽)\nfunction isKeyboardFocus(el: Element) {\n try {\n return el.matches(':focus-visible')\n } catch {\n return true\n }\n}\n\n/**\n * 마우스를 올리거나 포커스했을 때 뜨는 짧은 글자 설명.\n *\n * 언제 쓰나: 아이콘만 있는 버튼의 이름, 말줄임으로 잘린 글자 전체.\n * 언제 안 쓰나: 꼭 읽어야 하는 정보·오류(→ FormDescription·FormMessage·Alert), 대화형 내용(→ Popover), 터치 화면에서만 쓰는 정보(마우스를 올릴 수 없다).\n * 대신/함께: IconButton 에는 Tooltip 과 함께 `aria-label` 을 준다.\n */\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(({ className, onFocus, ...props }, ref) => (\n <TooltipPrimitive.Trigger\n type='button'\n ref={ref}\n className={cn(className)}\n {...props}\n onFocus={(e) => {\n onFocus?.(e)\n // Drawer·Dialog·AlertDialog 가 닫히며 연 버튼에 포커스를 돌려주면 Radix 가 포인터 없는 포커스로 보고 Tooltip 을 연다 —\n // 마우스로 닫았는데 Tooltip 이 다시 떠서 남는다. 그 한 번만 막는다(Radix 는 막힌 focus 를 건너뛴다).\n // 키보드(Esc)로 닫은 경우는 포커스 링과 함께 Tooltip 도 뜨는 것이 맞아 그대로 둔다\n if (isRestoringFocus() && !isKeyboardFocus(e.target)) e.preventDefault()\n }}\n />\n))\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, children, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--root-z-index)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]',\n className,\n )}\n {...props}\n >\n {sanitizeUserText(children)}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,kBAAkB,iBAAiB;AAGzC,SAAS,gBAAgB,IAAa;AACpC,MAAI;AACF,WAAO,GAAG,QAAQ,gBAAgB;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,MAAM,UAAU,iBAAiB;AAEjC,MAAM,iBAAiB,MAAM,WAG3B,CAAC,EAAE,WAAW,SAAS,GAAG,SAAS,QACnC;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC,MAAK;AAAA,IACL;AAAA,IACA,WAAW,GAAG,SAAS;AAAA,IACtB,GAAG;AAAA,IACJ,SAAS,CAAC,MAAM;AACd,gBAAU,CAAC;AAIX,UAAI,iBAAA,KAAsB,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAA;AAAA,IAC1D;AAAA,EAAA;AACF,CACD;AACD,eAAe,cAAc,iBAAiB,QAAQ;AAEtD,MAAM,iBAAiB,MAAM,WAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,UAAU,GAAG,SAAS,QACpD,oBAAC,iBAAiB,QAAjB,EACC,UAAA;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH,2BAAiB,QAAQ;AAAA,EAAA;AAC5B,GACF,CACD;AACD,eAAe,cAAc,iBAAiB,QAAQ;"}
1
+ {"version":3,"file":"tooltip.js","sources":["../../src/components/tooltip.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { isRestoringFocus } from './_internal/useRestoreFocusToOpener'\nimport { cn } from '../utils/cn'\nimport { sanitizeUserText } from '../utils/sanitizeUserText'\n\nconst TooltipProvider = TooltipPrimitive.Provider\n\n// `:focus-visible` 을 모르는 환경에서는 matches 가 던진다 — 그때는 키보드로 본다(Tooltip 을 막지 않는 쪽)\nfunction isKeyboardFocus(el: Element) {\n try {\n return el.matches(':focus-visible')\n } catch {\n return true\n }\n}\n\n/**\n * 마우스를 올리거나 포커스했을 때 뜨는 짧은 글자 설명.\n *\n * 언제 쓰나: 아이콘만 있는 버튼의 이름, 말줄임으로 잘린 글자 전체.\n * 언제 안 쓰나: 꼭 읽어야 하는 정보·오류(→ FormDescription·FormMessage·Alert), 대화형 내용(→ Popover), 터치 화면에서만 쓰는 정보(마우스를 올릴 수 없다).\n * 대신/함께: IconButton 에는 Tooltip 과 함께 `aria-label` 을 준다.\n */\nconst Tooltip = TooltipPrimitive.Root\n\nconst TooltipTrigger = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Trigger>\n>(({ className, onFocus, ...props }, ref) => (\n <TooltipPrimitive.Trigger\n type='button'\n ref={ref}\n className={cn(className)}\n {...props}\n onFocus={(e) => {\n onFocus?.(e)\n // Drawer·Dialog·AlertDialog 가 닫히며 연 버튼에 포커스를 돌려주면 Radix 가 포인터 없는 포커스로 보고 Tooltip 을 연다 —\n // 마우스로 닫았는데 Tooltip 이 다시 떠서 남는다. 그 한 번만 막는다(Radix 는 막힌 focus 를 건너뛴다).\n // 키보드(Esc)로 닫은 경우는 포커스 링과 함께 Tooltip 도 뜨는 것이 맞아 그대로 둔다\n if (isRestoringFocus() && !isKeyboardFocus(e.target)) e.preventDefault()\n }}\n />\n))\nTooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, children, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--z-index-tooltip)] overflow-hidden rounded-small bg-secondary70 px-[6px] py-[4px] text-small-regular text-sys-background whitespace-pre-wrap break-keep wrap-break-word animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]',\n className,\n )}\n {...props}\n >\n {sanitizeUserText(children)}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n))\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,kBAAkB,iBAAiB;AAGzC,SAAS,gBAAgB,IAAa;AACpC,MAAI;AACF,WAAO,GAAG,QAAQ,gBAAgB;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,MAAM,UAAU,iBAAiB;AAEjC,MAAM,iBAAiB,MAAM,WAG3B,CAAC,EAAE,WAAW,SAAS,GAAG,SAAS,QACnC;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC,MAAK;AAAA,IACL;AAAA,IACA,WAAW,GAAG,SAAS;AAAA,IACtB,GAAG;AAAA,IACJ,SAAS,CAAC,MAAM;AACd,gBAAU,CAAC;AAIX,UAAI,iBAAA,KAAsB,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAA;AAAA,IAC1D;AAAA,EAAA;AACF,CACD;AACD,eAAe,cAAc,iBAAiB,QAAQ;AAEtD,MAAM,iBAAiB,MAAM,WAG3B,CAAC,EAAE,WAAW,aAAa,GAAG,UAAU,GAAG,SAAS,QACpD,oBAAC,iBAAiB,QAAjB,EACC,UAAA;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEH,2BAAiB,QAAQ;AAAA,EAAA;AAC5B,GACF,CACD;AACD,eAAe,cAAc,iBAAiB,QAAQ;"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const React = require("react");
5
+ function _interopNamespaceDefault(e) {
6
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
+ if (e) {
8
+ for (const k in e) {
9
+ if (k !== "default") {
10
+ const d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: () => e[k]
14
+ });
15
+ }
16
+ }
17
+ }
18
+ n.default = e;
19
+ return Object.freeze(n);
20
+ }
21
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
22
+ function useControllableValue({
23
+ value,
24
+ defaultValue,
25
+ empty,
26
+ onChange
27
+ }) {
28
+ const [internal, setInternal] = React__namespace.useState(
29
+ () => defaultValue !== void 0 ? defaultValue : empty
30
+ );
31
+ const [wasControlled, setWasControlled] = React__namespace.useState(value !== void 0);
32
+ if (value !== void 0 && !wasControlled) setWasControlled(true);
33
+ const isControlled = wasControlled || value !== void 0;
34
+ const current = value !== void 0 ? value : isControlled ? empty : internal;
35
+ const setValue = React__namespace.useCallback(
36
+ (next) => {
37
+ if (!isControlled) setInternal(next);
38
+ onChange?.(next);
39
+ },
40
+ [isControlled, onChange]
41
+ );
42
+ return { value: current, setValue, isControlled };
43
+ }
44
+ exports.useControllableValue = useControllableValue;
45
+ //# sourceMappingURL=useControllableValue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControllableValue.cjs","sources":["../../src/hooks/useControllableValue.ts"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nexport interface UseControllableValueOptions<V, E> {\n /** 부모가 주는 값. 한 번이라도 값이 들어오면 그때부터 제어 상태다. */\n value?: V\n /** 제어하지 않을 때의 처음 값. 없으면 `empty`. */\n defaultValue?: V\n /**\n * 값이 없을 때 보일 값(Select 는 `undefined`, MultiSelect 는 `[]`, 글 입력은 `''`, Range 는 `min`).\n * 렌더마다 새로 만들지 말고 모듈 상수나 memo 로 넘긴다 — 값 비교로 도는 effect 가 있다.\n */\n empty: E\n /** 사용자가 값을 바꿀 때 알린다. 제어 상태여도 부른다. */\n onChange?: (value: V) => void\n}\n\nexport interface UseControllableValueReturn<V, E> {\n /** 보일 값. 제어 중이면 `value`(없으면 `empty`), 아니면 내부 값. */\n value: V | E\n /** 비제어면 내부 값을 바꾸고, 어느 쪽이든 `onChange` 를 부른다. */\n setValue: (next: V) => void\n /** 지금 제어 상태인지 — 네이티브 input·Radix 에 value 와 defaultValue 중 무엇을 넘길지 고를 때 쓴다. */\n isControlled: boolean\n}\n\n/**\n * 제어/비제어를 한 곳에서 정한다.\n *\n * - `value` 를 한 번도 받지 않았으면 비제어다. 내부 값이 `defaultValue` 에서 시작해 `setValue` 로 바뀐다.\n * - `value` 를 받으면 그 값을 보인다.\n * - 받던 `value` 가 `undefined` 로 돌아가면 빈 값이다 — `defaultValue` 도 전에 고른 값도 아닌 `empty`.\n * react-hook-form `reset()` 이 필드를 `undefined` 로 되돌릴 때가 이 경우다. 이후로도 제어 상태로 남는다.\n */\nexport function useControllableValue<V, E>({\n value,\n defaultValue,\n empty,\n onChange,\n}: UseControllableValueOptions<V, E>): UseControllableValueReturn<V, E> {\n const [internal, setInternal] = React.useState<V | E>(() =>\n defaultValue !== undefined ? defaultValue : empty,\n )\n // 렌더 중 상태 갱신으로 \"한 번이라도 받았는지\"를 기억한다(ref 는 버려진 렌더에서도 남는다)\n const [wasControlled, setWasControlled] = React.useState(value !== undefined)\n if (value !== undefined && !wasControlled) setWasControlled(true)\n\n const isControlled = wasControlled || value !== undefined\n const current = value !== undefined ? value : isControlled ? empty : internal\n\n const setValue = React.useCallback(\n (next: V) => {\n if (!isControlled) setInternal(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return { value: current, setValue, isControlled }\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCO,SAAS,qBAA2B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwE;AACtE,QAAM,CAAC,UAAU,WAAW,IAAIA,iBAAM;AAAA,IAAgB,MACpD,iBAAiB,SAAY,eAAe;AAAA,EAAA;AAG9C,QAAM,CAAC,eAAe,gBAAgB,IAAIA,iBAAM,SAAS,UAAU,MAAS;AAC5E,MAAI,UAAU,UAAa,CAAC,gCAAgC,IAAI;AAEhE,QAAM,eAAe,iBAAiB,UAAU;AAChD,QAAM,UAAU,UAAU,SAAY,QAAQ,eAAe,QAAQ;AAErE,QAAM,WAAWA,iBAAM;AAAA,IACrB,CAAC,SAAY;AACX,UAAI,CAAC,aAAc,aAAY,IAAI;AACnC,iBAAW,IAAI;AAAA,IACjB;AAAA,IACA,CAAC,cAAc,QAAQ;AAAA,EAAA;AAGzB,SAAO,EAAE,OAAO,SAAS,UAAU,aAAA;AACrC;;"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ function useControllableValue({
4
+ value,
5
+ defaultValue,
6
+ empty,
7
+ onChange
8
+ }) {
9
+ const [internal, setInternal] = React.useState(
10
+ () => defaultValue !== void 0 ? defaultValue : empty
11
+ );
12
+ const [wasControlled, setWasControlled] = React.useState(value !== void 0);
13
+ if (value !== void 0 && !wasControlled) setWasControlled(true);
14
+ const isControlled = wasControlled || value !== void 0;
15
+ const current = value !== void 0 ? value : isControlled ? empty : internal;
16
+ const setValue = React.useCallback(
17
+ (next) => {
18
+ if (!isControlled) setInternal(next);
19
+ onChange?.(next);
20
+ },
21
+ [isControlled, onChange]
22
+ );
23
+ return { value: current, setValue, isControlled };
24
+ }
25
+ export {
26
+ useControllableValue
27
+ };
28
+ //# sourceMappingURL=useControllableValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useControllableValue.js","sources":["../../src/hooks/useControllableValue.ts"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nexport interface UseControllableValueOptions<V, E> {\n /** 부모가 주는 값. 한 번이라도 값이 들어오면 그때부터 제어 상태다. */\n value?: V\n /** 제어하지 않을 때의 처음 값. 없으면 `empty`. */\n defaultValue?: V\n /**\n * 값이 없을 때 보일 값(Select 는 `undefined`, MultiSelect 는 `[]`, 글 입력은 `''`, Range 는 `min`).\n * 렌더마다 새로 만들지 말고 모듈 상수나 memo 로 넘긴다 — 값 비교로 도는 effect 가 있다.\n */\n empty: E\n /** 사용자가 값을 바꿀 때 알린다. 제어 상태여도 부른다. */\n onChange?: (value: V) => void\n}\n\nexport interface UseControllableValueReturn<V, E> {\n /** 보일 값. 제어 중이면 `value`(없으면 `empty`), 아니면 내부 값. */\n value: V | E\n /** 비제어면 내부 값을 바꾸고, 어느 쪽이든 `onChange` 를 부른다. */\n setValue: (next: V) => void\n /** 지금 제어 상태인지 — 네이티브 input·Radix 에 value 와 defaultValue 중 무엇을 넘길지 고를 때 쓴다. */\n isControlled: boolean\n}\n\n/**\n * 제어/비제어를 한 곳에서 정한다.\n *\n * - `value` 를 한 번도 받지 않았으면 비제어다. 내부 값이 `defaultValue` 에서 시작해 `setValue` 로 바뀐다.\n * - `value` 를 받으면 그 값을 보인다.\n * - 받던 `value` 가 `undefined` 로 돌아가면 빈 값이다 — `defaultValue` 도 전에 고른 값도 아닌 `empty`.\n * react-hook-form `reset()` 이 필드를 `undefined` 로 되돌릴 때가 이 경우다. 이후로도 제어 상태로 남는다.\n */\nexport function useControllableValue<V, E>({\n value,\n defaultValue,\n empty,\n onChange,\n}: UseControllableValueOptions<V, E>): UseControllableValueReturn<V, E> {\n const [internal, setInternal] = React.useState<V | E>(() =>\n defaultValue !== undefined ? defaultValue : empty,\n )\n // 렌더 중 상태 갱신으로 \"한 번이라도 받았는지\"를 기억한다(ref 는 버려진 렌더에서도 남는다)\n const [wasControlled, setWasControlled] = React.useState(value !== undefined)\n if (value !== undefined && !wasControlled) setWasControlled(true)\n\n const isControlled = wasControlled || value !== undefined\n const current = value !== undefined ? value : isControlled ? empty : internal\n\n const setValue = React.useCallback(\n (next: V) => {\n if (!isControlled) setInternal(next)\n onChange?.(next)\n },\n [isControlled, onChange],\n )\n\n return { value: current, setValue, isControlled }\n}\n"],"names":[],"mappings":";;AAmCO,SAAS,qBAA2B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwE;AACtE,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM;AAAA,IAAgB,MACpD,iBAAiB,SAAY,eAAe;AAAA,EAAA;AAG9C,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,UAAU,MAAS;AAC5E,MAAI,UAAU,UAAa,CAAC,gCAAgC,IAAI;AAEhE,QAAM,eAAe,iBAAiB,UAAU;AAChD,QAAM,UAAU,UAAU,SAAY,QAAQ,eAAe,QAAQ;AAErE,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,SAAY;AACX,UAAI,CAAC,aAAc,aAAY,IAAI;AACnC,iBAAW,IAAI;AAAA,IACjB;AAAA,IACA,CAAC,cAAc,QAAQ;AAAA,EAAA;AAGzB,SAAO,EAAE,OAAO,SAAS,UAAU,aAAA;AACrC;"}
@@ -123,7 +123,7 @@ interface ChatMessageProps {
123
123
  declare function ChatMessage({ from, children, pending, streaming, error, onRetry, attachments, sources, meta, actions, copyText, onRegenerate, onFeedback, feedback, headingLevel, className, }: ChatMessageProps): react_jsx_runtime.JSX.Element;
124
124
 
125
125
  interface ChatComposerProps {
126
- /** 입력 값. 주면 제어 컴포넌트가 된다(`onValueChange` 와 함께). 없으면 내부 상태로 관리하고 전송 뒤 비운다 */
126
+ /** 입력 값. 주면 제어 컴포넌트가 된다(`onValueChange` 와 함께). 처음부터 없으면 내부 상태로 관리하고 전송 뒤 비운다. 주던 값을 `undefined` 로 바꾸면 빈 칸이 된다 */
127
127
  value?: string;
128
128
  /** 입력 값이 바뀔 때. 전송 뒤에는 빈 문자열로 불린다 */
129
129
  onValueChange?: (value: string) => void;
@@ -123,7 +123,7 @@ interface ChatMessageProps {
123
123
  declare function ChatMessage({ from, children, pending, streaming, error, onRetry, attachments, sources, meta, actions, copyText, onRegenerate, onFeedback, feedback, headingLevel, className, }: ChatMessageProps): react_jsx_runtime.JSX.Element;
124
124
 
125
125
  interface ChatComposerProps {
126
- /** 입력 값. 주면 제어 컴포넌트가 된다(`onValueChange` 와 함께). 없으면 내부 상태로 관리하고 전송 뒤 비운다 */
126
+ /** 입력 값. 주면 제어 컴포넌트가 된다(`onValueChange` 와 함께). 처음부터 없으면 내부 상태로 관리하고 전송 뒤 비운다. 주던 값을 `undefined` 로 바꾸면 빈 칸이 된다 */
127
127
  value?: string;
128
128
  /** 입력 값이 바뀔 때. 전송 뒤에는 빈 문자열로 불린다 */
129
129
  onValueChange?: (value: string) => void;
package/dist/index.d.cts CHANGED
@@ -8,8 +8,8 @@ declare namespace class_variance_authority_types {
8
8
  }
9
9
  import { VariantProps } from 'class-variance-authority';
10
10
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
11
- import { B as BadgeProps } from './index-Guefjty-.cjs';
12
- export { U as AgGridTable, X as AgGridTableType, d as BADGE_OUTLINE_ACCENT, a1 as BALANCED_FILL_MIN_WIDTH, a as Badge, c as BadgeTone, e as Button, g as ButtonProps, o as ChatAttachment, C as ChatComposer, h as ChatComposerProps, i as ChatHistory, k as ChatHistoryGroup, j as ChatHistoryItem, m as ChatHistoryProps, n as ChatMessage, q as ChatMessageProps, p as ChatSource, D as Dialog, u as DialogClose, v as DialogContent, z as DialogDescription, x as DialogFooter, w as DialogHeader, s as DialogOverlay, r as DialogPortal, y as DialogTitle, t as DialogTrigger, A as Drawer, K as DrawerBody, H as DrawerClose, I as DrawerContent, N as DrawerDescription, L as DrawerFooter, J as DrawerHeader, F as DrawerOverlay, E as DrawerPortal, M as DrawerTitle, G as DrawerTrigger, V as HeaderCheckboxRenderer, a3 as NUMBER_COLUMN_WIDTH, T as PageHeader, S as PageHeaderProps, Q as PageHeaderProvider, O as PageHeaderState, P as PageHeaderTabItem, W as RowCheckboxRenderer, Z as SORT_ICON_OFFSET_CLASS, ab as TwoLineCellRenderer, aa as TwoLineCellRendererParams, b as badgeVariants, f as buttonVariants, $ as estimateHeaderTextWidth, a9 as fitColumnsToContent, l as groupChatHistoryByDate, a8 as growColumnIds, R as usePageHeader, a2 as withBalancedFill, Y as withExplicitSortIcons, a0 as withFlexFill, a6 as withHeaderMinWidth, a4 as withNumberColumnWidth, _ as withSortIconOffset, a5 as withTypeClasses, a7 as withWidthFloor } from './index-Guefjty-.cjs';
11
+ import { B as BadgeProps } from './index-CWvJ53EI.cjs';
12
+ export { U as AgGridTable, X as AgGridTableType, d as BADGE_OUTLINE_ACCENT, a1 as BALANCED_FILL_MIN_WIDTH, a as Badge, c as BadgeTone, e as Button, g as ButtonProps, o as ChatAttachment, C as ChatComposer, h as ChatComposerProps, i as ChatHistory, k as ChatHistoryGroup, j as ChatHistoryItem, m as ChatHistoryProps, n as ChatMessage, q as ChatMessageProps, p as ChatSource, D as Dialog, u as DialogClose, v as DialogContent, z as DialogDescription, x as DialogFooter, w as DialogHeader, s as DialogOverlay, r as DialogPortal, y as DialogTitle, t as DialogTrigger, A as Drawer, K as DrawerBody, H as DrawerClose, I as DrawerContent, N as DrawerDescription, L as DrawerFooter, J as DrawerHeader, F as DrawerOverlay, E as DrawerPortal, M as DrawerTitle, G as DrawerTrigger, V as HeaderCheckboxRenderer, a3 as NUMBER_COLUMN_WIDTH, T as PageHeader, S as PageHeaderProps, Q as PageHeaderProvider, O as PageHeaderState, P as PageHeaderTabItem, W as RowCheckboxRenderer, Z as SORT_ICON_OFFSET_CLASS, ab as TwoLineCellRenderer, aa as TwoLineCellRendererParams, b as badgeVariants, f as buttonVariants, $ as estimateHeaderTextWidth, a9 as fitColumnsToContent, l as groupChatHistoryByDate, a8 as growColumnIds, R as usePageHeader, a2 as withBalancedFill, Y as withExplicitSortIcons, a0 as withFlexFill, a6 as withHeaderMinWidth, a4 as withNumberColumnWidth, _ as withSortIconOffset, a5 as withTypeClasses, a7 as withWidthFloor } from './index-CWvJ53EI.cjs';
13
13
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
14
14
  import { DayPicker, SelectSingleEventHandler, DateRange, SelectRangeEventHandler } from 'react-day-picker';
15
15
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
@@ -1402,8 +1402,9 @@ interface MultiSelectProps$1 {
1402
1402
  defaultOpen?: boolean;
1403
1403
  onOpenChange?: (open: boolean) => void;
1404
1404
  /**
1405
- * 트리거 input / Content 의 검색어가 변경될 때 호출.
1406
- * typing 외에도 토글/popup close 시 빈 문자열로 reset 될 때도 호출됨.
1405
+ * 트리거 input / Content 의 검색어가 바뀔 때 새 검색어로 부른다.
1406
+ * 입력할 때, 그리고 항목을 고른 뒤·목록이 닫힐 때 검색어가 비워지면 빈 문자열로 부른다.
1407
+ * 검색어가 그대로면 부르지 않는다 — 마운트할 때도, 부모가 다시 그려질 때도 부르지 않으므로 인라인 콜백·부모 상태 갱신을 넘겨도 된다.
1407
1408
  */
1408
1409
  onSearchChange?: (value: string) => void;
1409
1410
  disabled?: boolean;
@@ -1583,7 +1584,9 @@ declare const SidebarSection: React$1.ForwardRefExoticComponent<React$1.HTMLAttr
1583
1584
  declare const SidebarMenuItem: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLLIElement> & {
1584
1585
  icon?: string;
1585
1586
  label: string;
1587
+ /** 지금 화면의 메뉴 — 강조해 그리고 `aria-current="page"` 로 알린다 */
1586
1588
  isActive?: boolean;
1589
+ /** 자식 요소(라우터 `Link` 등 포커스를 받는 요소)가 메뉴 항목이 된다. 없으면 `<button>` 을 그린다 */
1587
1590
  asChild?: boolean;
1588
1591
  } & React$1.RefAttributes<HTMLLIElement>>;
1589
1592
  declare const SidebarFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
@@ -1620,7 +1623,7 @@ interface RangeProps {
1620
1623
  min?: number;
1621
1624
  max?: number;
1622
1625
  step?: number;
1623
- /** controlled 값 */
1626
+ /** controlled 값. 주던 값을 `undefined` 로 바꾸면 `min` 이 된다(defaultValue 로 돌아가지 않는다) */
1624
1627
  value?: number;
1625
1628
  /** uncontrolled 초기값 */
1626
1629
  defaultValue?: number;
@@ -1708,7 +1711,7 @@ interface UseRangeValueReturn {
1708
1711
  }
1709
1712
  /**
1710
1713
  * Range 합성 컴포넌트용 단일값 상태 훅.
1711
- * controlled/uncontrolled를 모두 지원하며, 커밋 시 항상 clamp/snap/정밀도 보정을 적용한다.
1714
+ * 제어/비제어는 useControllableValue 규칙을 따른다(받던 value 가 undefined 가 되면 min). 커밋 시 항상 clamp/snap/정밀도 보정을 적용한다.
1712
1715
  */
1713
1716
  declare function useRangeValue({ value, defaultValue, min, max, step, onValueChange, }: UseRangeValueOptions): UseRangeValueReturn;
1714
1717