@aloudata/aloudata-design 3.1.0 → 3.1.2

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 (196) hide show
  1. package/dist/AProgress/index.js +10 -0
  2. package/dist/AProgress/index.js.map +1 -1
  3. package/dist/Alert/index.js +3 -1
  4. package/dist/Alert/index.js.map +1 -1
  5. package/dist/Badge/index.js +37 -11
  6. package/dist/Badge/index.js.map +1 -1
  7. package/dist/Breadcrumb/index.js +12 -2
  8. package/dist/Breadcrumb/index.js.map +1 -1
  9. package/dist/Button/index.d.ts +1 -1
  10. package/dist/Button/index.js +20 -6
  11. package/dist/Button/index.js.map +1 -1
  12. package/dist/Card/index.js +1 -1
  13. package/dist/Card/index.js.map +1 -1
  14. package/dist/Carousel/index.js +9 -1
  15. package/dist/Carousel/index.js.map +1 -1
  16. package/dist/Checkbox/index.js +17 -2
  17. package/dist/Checkbox/index.js.map +1 -1
  18. package/dist/Checkbox/type.d.ts +10 -2
  19. package/dist/ColorPicker/index.js +112 -46
  20. package/dist/ColorPicker/index.js.map +1 -1
  21. package/dist/DataPreviewTable/components/Body/Cell.d.ts +2 -0
  22. package/dist/DataPreviewTable/components/Body/Cell.js +9 -1
  23. package/dist/DataPreviewTable/components/Body/Cell.js.map +1 -1
  24. package/dist/DataPreviewTable/components/Body/index.d.ts +1 -0
  25. package/dist/DataPreviewTable/components/Body/index.js +35 -23
  26. package/dist/DataPreviewTable/components/Body/index.js.map +1 -1
  27. package/dist/DataPreviewTable/components/Header/index.d.ts +1 -0
  28. package/dist/DataPreviewTable/components/Header/index.js +36 -28
  29. package/dist/DataPreviewTable/components/Header/index.js.map +1 -1
  30. package/dist/DataPreviewTable/index.js +19 -2
  31. package/dist/DataPreviewTable/index.js.map +1 -1
  32. package/dist/Drawer/index.d.ts +4 -0
  33. package/dist/Drawer/index.js +93 -79
  34. package/dist/Drawer/index.js.map +1 -1
  35. package/dist/Dropdown/index.d.ts +1 -1
  36. package/dist/Dropdown/index.js +64 -13
  37. package/dist/Dropdown/index.js.map +1 -1
  38. package/dist/Form/FormItemContext.d.ts +1 -1
  39. package/dist/Form/FormItemContext.js.map +1 -1
  40. package/dist/Form/index.js +50 -7
  41. package/dist/Form/index.js.map +1 -1
  42. package/dist/IconButton/index.d.ts +2 -2
  43. package/dist/IconButton/index.js +9 -3
  44. package/dist/IconButton/index.js.map +1 -1
  45. package/dist/Input/components/Input/index.js +18 -8
  46. package/dist/Input/components/Input/index.js.map +1 -1
  47. package/dist/Input/components/TextArea/index.js +18 -7
  48. package/dist/Input/components/TextArea/index.js.map +1 -1
  49. package/dist/Input/privateSemanticOwner.d.ts +2 -0
  50. package/dist/Input/privateSemanticOwner.js +1 -0
  51. package/dist/InputNumber/index.js +16 -9
  52. package/dist/InputNumber/index.js.map +1 -1
  53. package/dist/InputNumber/type.d.ts +2 -2
  54. package/dist/LogicTree/components/LogicItem/index.d.ts +2 -1
  55. package/dist/LogicTree/components/LogicItem/index.js +13 -2
  56. package/dist/LogicTree/components/LogicItem/index.js.map +1 -1
  57. package/dist/LogicTree/index.js +2 -0
  58. package/dist/LogicTree/index.js.map +1 -1
  59. package/dist/MemberPicker/components/MemberSelection.d.ts +2 -0
  60. package/dist/MemberPicker/components/MemberSelection.js +15 -13
  61. package/dist/MemberPicker/components/MemberSelection.js.map +1 -1
  62. package/dist/MemberPicker/components/MultipleOption.js +12 -0
  63. package/dist/MemberPicker/components/MultipleOption.js.map +1 -1
  64. package/dist/MemberPicker/components/Panel.d.ts +2 -0
  65. package/dist/MemberPicker/components/Panel.js +11 -1
  66. package/dist/MemberPicker/components/Panel.js.map +1 -1
  67. package/dist/MemberPicker/components/PanelWrapper.js +2 -0
  68. package/dist/MemberPicker/components/PanelWrapper.js.map +1 -1
  69. package/dist/MemberPicker/components/SelectedMemberTags.js +14 -6
  70. package/dist/MemberPicker/components/SelectedMemberTags.js.map +1 -1
  71. package/dist/MemberPicker/components/SingleOption.js +12 -0
  72. package/dist/MemberPicker/components/SingleOption.js.map +1 -1
  73. package/dist/MemberPicker/components/UserGroupSelection.d.ts +3 -1
  74. package/dist/MemberPicker/components/UserGroupSelection.js +65 -42
  75. package/dist/MemberPicker/components/UserGroupSelection.js.map +1 -1
  76. package/dist/MemberPicker/index.js +134 -108
  77. package/dist/MemberPicker/index.js.map +1 -1
  78. package/dist/Menu/index.d.ts +8 -0
  79. package/dist/Menu/index.js +33 -3
  80. package/dist/Menu/index.js.map +1 -1
  81. package/dist/Modal/index.d.ts +4 -0
  82. package/dist/Modal/index.js +55 -66
  83. package/dist/Modal/index.js.map +1 -1
  84. package/dist/OverflowCount/index.js +10 -0
  85. package/dist/OverflowCount/index.js.map +1 -1
  86. package/dist/Pagination/index.js +1 -0
  87. package/dist/Pagination/index.js.map +1 -1
  88. package/dist/Popconfirm/index.js +9 -1
  89. package/dist/Popconfirm/index.js.map +1 -1
  90. package/dist/Popover/index.js +52 -1
  91. package/dist/Popover/index.js.map +1 -1
  92. package/dist/Progress/index.js +4 -0
  93. package/dist/Progress/index.js.map +1 -1
  94. package/dist/Radio/components/Group/index.d.ts +5 -1
  95. package/dist/Radio/components/Group/index.js +7 -2
  96. package/dist/Radio/components/Group/index.js.map +1 -1
  97. package/dist/Radio/components/Radio/index.js +26 -0
  98. package/dist/Radio/components/Radio/index.js.map +1 -1
  99. package/dist/Radio/interface/radio.d.ts +7 -0
  100. package/dist/Radio/interface/radioGroup.d.ts +2 -0
  101. package/dist/RenameInput/index.js +11 -0
  102. package/dist/RenameInput/index.js.map +1 -1
  103. package/dist/Select/BaseSelect.d.ts +3 -0
  104. package/dist/Select/BaseSelect.js +229 -32
  105. package/dist/Select/BaseSelect.js.map +1 -1
  106. package/dist/Select/SelectTrigger.d.ts +2 -0
  107. package/dist/Select/SelectTrigger.js +13 -5
  108. package/dist/Select/SelectTrigger.js.map +1 -1
  109. package/dist/Select/components/OptionCollection.d.ts +41 -0
  110. package/dist/Select/components/OptionCollection.js +124 -0
  111. package/dist/Select/components/OptionCollection.js.map +1 -0
  112. package/dist/Select/index.js +45 -3
  113. package/dist/Select/index.js.map +1 -1
  114. package/dist/Select/interface.d.ts +1 -1
  115. package/dist/Skeleton/index.js +1 -1
  116. package/dist/Skeleton/index.js.map +1 -1
  117. package/dist/Spin/index.d.ts +1 -1
  118. package/dist/Spin/index.js +22 -7
  119. package/dist/Spin/index.js.map +1 -1
  120. package/dist/Switch/index.d.ts +5 -0
  121. package/dist/Switch/index.js +15 -5
  122. package/dist/Switch/index.js.map +1 -1
  123. package/dist/Table/components/Header.js +0 -1
  124. package/dist/Table/components/Header.js.map +1 -1
  125. package/dist/Table/index.js +42 -27
  126. package/dist/Table/index.js.map +1 -1
  127. package/dist/Tabs/index.js +1 -0
  128. package/dist/Tabs/index.js.map +1 -1
  129. package/dist/Tag/index.js +20 -1
  130. package/dist/Tag/index.js.map +1 -1
  131. package/dist/Tooltip/index.js +34 -5
  132. package/dist/Tooltip/index.js.map +1 -1
  133. package/dist/Tour/index.js +13 -1
  134. package/dist/Tour/index.js.map +1 -1
  135. package/dist/Tree/Tree2.js +2 -0
  136. package/dist/Tree/Tree2.js.map +1 -1
  137. package/dist/_utils/dialogAccessibility.d.ts +17 -0
  138. package/dist/_utils/dialogAccessibility.js +110 -0
  139. package/dist/_utils/dialogAccessibility.js.map +1 -0
  140. package/dist/_utils/formControlSemanticOwner.d.ts +3 -0
  141. package/dist/_utils/formControlSemanticOwner.js +17 -0
  142. package/dist/_utils/formControlSemanticOwner.js.map +1 -0
  143. package/dist/_utils/overlayCoordinator.js +1 -11
  144. package/dist/_utils/overlayCoordinator.js.map +1 -1
  145. package/dist/aloudata-design.css +1 -1
  146. package/dist/governance/semantic.d.ts +1 -0
  147. package/dist/governance/semantic.js +2 -0
  148. package/dist/governance/semantic.json +1737 -0
  149. package/dist/theme/contract/baselineResolvedTokenValueManifest.d.ts +1 -1
  150. package/dist/theme/contract/darkResolvedTokenValueManifest.d.ts +1 -1
  151. package/dist/theme/contract/tokenOutputContract.js +1 -0
  152. package/dist/theme/contract/tokenOutputContract.js.map +1 -1
  153. package/dist/theme/generator/acceptedColorValues.d.ts +2 -1
  154. package/dist/theme/generator/baselineTokenValueDelivery.d.ts +9 -1
  155. package/dist/theme/generator/minimalAcceptedColorValues.d.ts +2 -2
  156. package/dist/theme/generator/neutralSourceResolver.d.ts +28 -0
  157. package/dist/theme/generator/neutralSourceResolver.js +2 -0
  158. package/dist/theme/generator/neutralSourceValues.d.ts +28 -0
  159. package/dist/theme/generator/neutralSourceValues.js +2 -0
  160. package/dist/theme/governance/semanticGovernanceContract.d.ts +91 -0
  161. package/dist/theme/governance/semanticGovernanceContract.js +342 -0
  162. package/dist/theme/governance/semanticGovernanceContract.js.map +1 -0
  163. package/dist/theme/index.d.ts +2 -0
  164. package/dist/theme/index.js +1 -0
  165. package/dist/theme/neutralSourceContract.d.ts +3 -0
  166. package/dist/theme/neutralSourceContract.js +11 -0
  167. package/dist/theme/neutralSourceContract.js.map +1 -0
  168. package/dist/theme/runtime/colorValueMode/generated/darkBaselineDeclarations.d.ts +1 -1
  169. package/dist/theme/runtime/colorValueMode/generated/darkBaselineDeclarations.js +46 -45
  170. package/dist/theme/runtime/colorValueMode/generated/darkBaselineDeclarations.js.map +1 -1
  171. package/dist/theme/runtime/colorValueMode/generated/slateDarkDeclarations.d.ts +3 -0
  172. package/dist/theme/runtime/colorValueMode/generated/slateDarkDeclarations.js +2 -0
  173. package/dist/theme/runtime/colorValueMode/generated/slateLightDeclarations.d.ts +3 -0
  174. package/dist/theme/runtime/colorValueMode/generated/slateLightDeclarations.js +2 -0
  175. package/dist/theme/runtime/colorValueMode/generated/stoneDarkDeclarations.d.ts +3 -0
  176. package/dist/theme/runtime/colorValueMode/generated/stoneDarkDeclarations.js +2 -0
  177. package/dist/theme/runtime/colorValueMode/generated/stoneLightDeclarations.d.ts +3 -0
  178. package/dist/theme/runtime/colorValueMode/generated/stoneLightDeclarations.js +2 -0
  179. package/dist/theme/runtime/colorValueMode/generated/v3BaselineDeclarations.d.ts +1 -1
  180. package/dist/theme/runtime/colorValueMode/generated/v3BaselineDeclarations.js +42 -41
  181. package/dist/theme/runtime/colorValueMode/generated/v3BaselineDeclarations.js.map +1 -1
  182. package/dist/theme/runtime/colorValueMode/index.js +2 -12
  183. package/dist/theme/runtime/colorValueMode/index.js.map +1 -1
  184. package/dist/theme/runtime/colorValueMode/legacyNeutralCompatibility.d.ts +2 -0
  185. package/dist/theme/runtime/colorValueMode/legacyNeutralCompatibility.js +48 -0
  186. package/dist/theme/runtime/colorValueMode/legacyNeutralCompatibility.js.map +1 -0
  187. package/dist/theme/runtime/colorValueMode/registry.d.ts +1 -1
  188. package/dist/theme/runtime/colorValueMode/registry.js +2 -1
  189. package/dist/theme/runtime/colorValueMode/registry.js.map +1 -1
  190. package/dist/theme/runtime/initAldTheme.js +1 -3
  191. package/dist/theme/runtime/initAldTheme.js.map +1 -1
  192. package/dist/theme/runtime/neutralSource/index.d.ts +6 -0
  193. package/dist/theme/runtime/neutralSource/index.js +11 -0
  194. package/dist/theme/runtime/neutralSource/index.js.map +1 -0
  195. package/dist/theme/runtime/neutralSource.d.ts +2 -0
  196. package/package.json +12 -2
@@ -20,7 +20,8 @@ var InternalIconButton = forwardRef(function(props, ref) {
20
20
  return /* @__PURE__ */ jsx(Tooltip, {
21
21
  ...tooltip,
22
22
  title: tooltip?.title,
23
- children: /* @__PURE__ */ jsx("div", {
23
+ children: /* @__PURE__ */ jsx("button", {
24
+ type: "button",
24
25
  id,
25
26
  className: cn(className, "ald-icon-button", `ald-icon-button-${getSizeType(size)}`, {
26
27
  "ald-icon-button-disabled": disabled,
@@ -31,6 +32,7 @@ var InternalIconButton = forwardRef(function(props, ref) {
31
32
  onClick: onButtonClick,
32
33
  "data-testid": dataTestid,
33
34
  "aria-label": ariaLabel,
35
+ disabled,
34
36
  children: /* @__PURE__ */ jsx("div", {
35
37
  className: "ald-icon-button-wrap",
36
38
  children: icon
@@ -53,7 +55,8 @@ var DropdownButton = forwardRef(function(props, ref) {
53
55
  }, [menu, disabled])) return /* @__PURE__ */ jsx(Tooltip, {
54
56
  ...tooltip,
55
57
  title: tooltip?.title,
56
- children: /* @__PURE__ */ jsxs("div", {
58
+ children: /* @__PURE__ */ jsxs("button", {
59
+ type: "button",
57
60
  id,
58
61
  className: cn(className, "ald-icon-button-dropdown", `ald-icon-button-${getSizeType(size)}`, {
59
62
  "ald-icon-button-disabled": disabled,
@@ -63,6 +66,7 @@ var DropdownButton = forwardRef(function(props, ref) {
63
66
  onClick: onButtonClick,
64
67
  "data-testid": dataTestid,
65
68
  "aria-label": ariaLabel,
69
+ disabled,
66
70
  children: [/* @__PURE__ */ jsx("div", {
67
71
  className: "ald-icon-button-wrap",
68
72
  children: icon
@@ -76,7 +80,8 @@ var DropdownButton = forwardRef(function(props, ref) {
76
80
  menu,
77
81
  onOpenChange,
78
82
  ...restDropdownProps,
79
- children: /* @__PURE__ */ jsxs("div", {
83
+ children: /* @__PURE__ */ jsxs("button", {
84
+ type: "button",
80
85
  id,
81
86
  className: cn(className, "ald-icon-button-dropdown", `ald-icon-button-${getSizeType(size)}`, {
82
87
  "ald-icon-button-disabled": disabled,
@@ -86,6 +91,7 @@ var DropdownButton = forwardRef(function(props, ref) {
86
91
  onClick: onButtonClick,
87
92
  "data-testid": dataTestid,
88
93
  "aria-label": ariaLabel,
94
+ disabled,
89
95
  children: [/* @__PURE__ */ jsx("div", {
90
96
  className: "ald-icon-button-wrap",
91
97
  children: icon
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import './icon-button.css';\nimport { cn } from '../lib/utils';\nimport React, { forwardRef, useMemo } from 'react';\nimport Dropdown, { IDropdownProps } from '../Dropdown/index';\nimport { FoldDownFill } from '../Icon';\nimport { TSize } from '../Input';\nimport { getSizeType } from '../Input/components/Input';\nimport Tooltip, { ITooltipProps } from '../Tooltip';\ninterface IIconButtonProps {\n icon: React.ReactNode;\n onClick?: (e: React.MouseEvent) => void;\n disabled?: boolean;\n size?: TSize;\n className?: string;\n keepFocus?: boolean;\n tooltip?: ITooltipProps;\n id?: string;\n mode?: 'light' | 'dark';\n /** 透传到底层触发器 DOM 的 data-testid,用于自动化测试定位 */\n 'data-testid'?: string;\n /** 透传到底层触发器 DOM 的 aria-label,用于可访问性与自动化测试定位 */\n 'aria-label'?: string;\n}\ntype IDropdownIconButtonProps = IIconButtonProps &\n Omit<IDropdownProps, 'children'> & {\n showArrow?: boolean;\n };\nconst InternalIconButton = forwardRef(function (\n props: IIconButtonProps,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n icon,\n onClick = () => {},\n disabled,\n size = 'middle',\n keepFocus,\n className,\n tooltip,\n id,\n mode = 'light',\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n } = props;\n const onButtonClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n onClick(e);\n };\n\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <div\n id={id}\n className={cn(\n className,\n 'ald-icon-button',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-focus': keepFocus,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n // disabled={disabled}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n </div>\n </Tooltip>\n );\n});\n\nconst DropdownButton = forwardRef(function (\n props: IDropdownIconButtonProps,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n icon,\n onClick = () => {},\n disabled,\n size = 'middle',\n menu,\n className,\n onOpenChange,\n tooltip,\n id,\n showArrow,\n mode = 'light',\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n ...restDropdownProps\n } = props;\n const onButtonClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (disabled) {\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n onClick(e);\n };\n\n const canDropdown = useMemo(() => {\n const hasMenu = menu && menu.items && menu.items.length > 0;\n return hasMenu && !disabled;\n }, [menu, disabled]);\n if (!canDropdown) {\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <div\n id={id}\n className={cn(\n className,\n 'ald-icon-button-dropdown',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n {showArrow && <FoldDownFill />}\n </div>\n </Tooltip>\n );\n }\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <Dropdown menu={menu} onOpenChange={onOpenChange} {...restDropdownProps}>\n <div\n id={id}\n className={cn(\n className,\n 'ald-icon-button-dropdown',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n {showArrow && <FoldDownFill />}\n </div>\n </Dropdown>\n </Tooltip>\n );\n});\nconst IconButton = InternalIconButton as typeof InternalIconButton & {\n dropdown: typeof DropdownButton;\n __ANT_BUTTON: boolean;\n};\nIconButton.dropdown = DropdownButton;\nIconButton.__ANT_BUTTON = true;\nexport default IconButton;\n"],"mappings":";;;;;;;;;AA2BA,IAAM,qBAAqB,WAAW,SACpC,OACA,KACA;CACA,MAAM,EACJ,MACA,gBAAgB,IAChB,UACA,OAAO,UACP,WACA,WACA,SACA,IACA,OAAO,SACP,eAAe,YACf,cAAc,cACZ;CACJ,MAAM,iBAAiB,MAAwB;AAC7C,MAAI,UAAU;AACZ,KAAE,iBAAiB;AACnB,KAAE,gBAAgB;AAClB;;AAEF,UAAQ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KACE,4BAA4B;KAC5B,wBAAwB,SAAS;KAClC,CACF;IACI;IACL,SAAS;IACT,eAAa;IACb,cAAY;cAdd,CAgBE,oBAAC,OAAD;KAAK,WAAU;eAAwB;KAAW,CAAA,EACjD,aAAa,oBAAC,MAAD,EAAgB,CAAA,CAC1B;;GACG,CAAA;EACH,CAAA;EAEZ;AACF,IAAM,aAAa;AAInB,WAAW,WAAW;AACtB,WAAW,eAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import './icon-button.css';\nimport { cn } from '../lib/utils';\nimport React, { forwardRef, useMemo } from 'react';\nimport Dropdown, { IDropdownProps } from '../Dropdown/index';\nimport { FoldDownFill } from '../Icon';\nimport { TSize } from '../Input';\nimport { getSizeType } from '../Input/components/Input';\nimport Tooltip, { ITooltipProps } from '../Tooltip';\ninterface IIconButtonProps {\n icon: React.ReactNode;\n onClick?: (e: React.MouseEvent) => void;\n disabled?: boolean;\n size?: TSize;\n className?: string;\n keepFocus?: boolean;\n tooltip?: ITooltipProps;\n id?: string;\n mode?: 'light' | 'dark';\n /** 透传到底层触发器 DOM 的 data-testid,用于自动化测试定位 */\n 'data-testid'?: string;\n /** 透传到底层触发器 DOM 的 aria-label,用于可访问性与自动化测试定位 */\n 'aria-label'?: string;\n}\ntype IDropdownIconButtonProps = IIconButtonProps &\n Omit<IDropdownProps, 'children'> & {\n showArrow?: boolean;\n };\nconst InternalIconButton = forwardRef(function (\n props: IIconButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n) {\n const {\n icon,\n onClick = () => {},\n disabled,\n size = 'middle',\n keepFocus,\n className,\n tooltip,\n id,\n mode = 'light',\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n } = props;\n const onButtonClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n onClick(e);\n };\n\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <button\n type=\"button\"\n id={id}\n className={cn(\n className,\n 'ald-icon-button',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-focus': keepFocus,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n disabled={disabled}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n </button>\n </Tooltip>\n );\n});\n\nconst DropdownButton = forwardRef(function (\n props: IDropdownIconButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n) {\n const {\n icon,\n onClick = () => {},\n disabled,\n size = 'middle',\n menu,\n className,\n onOpenChange,\n tooltip,\n id,\n showArrow,\n mode = 'light',\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n ...restDropdownProps\n } = props;\n const onButtonClick = (\n e: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n if (disabled) {\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n onClick(e);\n };\n\n const canDropdown = useMemo(() => {\n const hasMenu = menu && menu.items && menu.items.length > 0;\n return hasMenu && !disabled;\n }, [menu, disabled]);\n if (!canDropdown) {\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <button\n type=\"button\"\n id={id}\n className={cn(\n className,\n 'ald-icon-button-dropdown',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n disabled={disabled}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n {showArrow && <FoldDownFill />}\n </button>\n </Tooltip>\n );\n }\n return (\n <Tooltip {...tooltip} title={tooltip?.title}>\n <Dropdown menu={menu} onOpenChange={onOpenChange} {...restDropdownProps}>\n <button\n type=\"button\"\n id={id}\n className={cn(\n className,\n 'ald-icon-button-dropdown',\n `ald-icon-button-${getSizeType(size)}`,\n {\n 'ald-icon-button-disabled': disabled,\n 'ald-icon-button-dark': mode === 'dark',\n },\n )}\n ref={ref}\n onClick={onButtonClick}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n disabled={disabled}\n >\n <div className=\"ald-icon-button-wrap\">{icon}</div>\n {showArrow && <FoldDownFill />}\n </button>\n </Dropdown>\n </Tooltip>\n );\n});\nconst IconButton = InternalIconButton as typeof InternalIconButton & {\n dropdown: typeof DropdownButton;\n __ANT_BUTTON: boolean;\n};\nIconButton.dropdown = DropdownButton;\nIconButton.__ANT_BUTTON = true;\nexport default IconButton;\n"],"mappings":";;;;;;;;;AA2BA,IAAM,qBAAqB,WAAW,SACpC,OACA,KACA;CACA,MAAM,EACJ,MACA,gBAAgB,IAChB,UACA,OAAO,UACP,WACA,WACA,SACA,IACA,OAAO,SACP,eAAe,YACf,cAAc,cACZ;CACJ,MAAM,iBAAiB,MAAwB;AAC7C,MAAI,UAAU;AACZ,KAAE,iBAAiB;AACnB,KAAE,gBAAgB;AAClB;;AAEF,UAAQ,EAAE;;AAGZ,QACE,oBAAC,SAAD;EAAS,GAAI;EAAS,OAAO,SAAS;YACpC,oBAAC,UAAD;GACE,MAAK;GACD;GACJ,WAAW,GACT,WACA,mBACA,mBAAmB,YAAY,KAAK,IACpC;IACE,4BAA4B;IAC5B,yBAAyB;IACzB,wBAAwB,SAAS;IAClC,CACF;GACI;GACL,SAAS;GACT,eAAa;GACb,cAAY;GACF;aAEV,oBAAC,OAAD;IAAK,WAAU;cAAwB;IAAW,CAAA;GAC3C,CAAA;EACD,CAAA;EAEZ;AAEF,IAAM,iBAAiB,WAAW,SAChC,OACA,KACA;CACA,MAAM,EACJ,MACA,gBAAgB,IAChB,UACA,OAAO,UACP,MACA,WACA,cACA,SACA,IACA,WACA,OAAO,SACP,eAAe,YACf,cAAc,WACd,GAAG,sBACD;CACJ,MAAM,iBACJ,MACG;AACH,MAAI,UAAU;AACZ,KAAE,iBAAiB;AACnB,KAAE,gBAAgB;AAClB;;AAEF,UAAQ,EAAE;;AAOZ,KAAI,CAJgB,cAAc;AAEhC,SADgB,QAAQ,KAAK,SAAS,KAAK,MAAM,SAAS,KACxC,CAAC;IAClB,CAAC,MAAM,SAAS,CAAC,CAElB,QACE,oBAAC,SAAD;EAAS,GAAI;EAAS,OAAO,SAAS;YACpC,qBAAC,UAAD;GACE,MAAK;GACD;GACJ,WAAW,GACT,WACA,4BACA,mBAAmB,YAAY,KAAK,IACpC;IACE,4BAA4B;IAC5B,wBAAwB,SAAS;IAClC,CACF;GACI;GACL,SAAS;GACT,eAAa;GACb,cAAY;GACF;aAhBZ,CAkBE,oBAAC,OAAD;IAAK,WAAU;cAAwB;IAAW,CAAA,EACjD,aAAa,oBAAC,MAAD,EAAgB,CAAA,CACvB;;EACD,CAAA;AAGd,QACE,oBAAC,SAAD;EAAS,GAAI;EAAS,OAAO,SAAS;YACpC,oBAAC,UAAD;GAAgB;GAAoB;GAAc,GAAI;aACpD,qBAAC,UAAD;IACE,MAAK;IACD;IACJ,WAAW,GACT,WACA,4BACA,mBAAmB,YAAY,KAAK,IACpC;KACE,4BAA4B;KAC5B,wBAAwB,SAAS;KAClC,CACF;IACI;IACL,SAAS;IACT,eAAa;IACb,cAAY;IACF;cAhBZ,CAkBE,oBAAC,OAAD;KAAK,WAAU;eAAwB;KAAW,CAAA,EACjD,aAAa,oBAAC,MAAD,EAAgB,CAAA,CACvB;;GACA,CAAA;EACH,CAAA;EAEZ;AACF,IAAM,aAAa;AAInB,WAAW,WAAW;AACtB,WAAW,eAAe"}
@@ -3,6 +3,7 @@ import Memo from "../../../Icon/components/CloseCircleFill.js";
3
3
  import DisabledContext from "../../../ConfigProvider/DisabledContext.js";
4
4
  import SizeContext from "../../../ConfigProvider/sizeContext.js";
5
5
  import { useCompactItemContext } from "../../../Space/CompactContext.js";
6
+ import { getSemanticOwnerAriaProps } from "../../../_utils/formControlSemanticOwner.js";
6
7
  import React, { forwardRef, useContext, useRef, useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  //#region src/Input/components/Input/index.tsx
@@ -15,7 +16,7 @@ function getSizeType(sizeType) {
15
16
  return "middle";
16
17
  }
17
18
  var Input = forwardRef((props, ref) => {
18
- const { size: customSize, className, bordered = true, status, disabled, allowClear, prefix, suffix, addonBefore, addonAfter, showCount, maxLength, minLength, value: controlledValue, defaultValue, onChange, onPressEnter, onBlur, onFocus, onKeyDown, onCompositionStart, onCompositionEnd, placeholder, type, id, autoComplete = "off", autoFocus, readOnly, width, style, "data-testid": dataTestid, "aria-label": ariaLabel, ...restInputProps } = props;
19
+ const { size: customSize, className, bordered = true, status, disabled, allowClear, prefix, suffix, addonBefore, addonAfter, showCount, maxLength, minLength, value: controlledValue, defaultValue, onChange, onPressEnter, onBlur, onFocus, onKeyDown, onCompositionStart, onCompositionEnd, placeholder, type, id, autoComplete = "off", autoFocus, readOnly, width, style, "data-testid": dataTestid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-busy": ariaBusy, "aria-disabled": ariaDisabled, "aria-readonly": ariaReadonly, ...restInputProps } = props;
19
20
  const contextDisabled = useContext(DisabledContext);
20
21
  const mergedDisabled = disabled ?? contextDisabled;
21
22
  const contentSize = useContext(SizeContext);
@@ -55,12 +56,12 @@ var Input = forwardRef((props, ref) => {
55
56
  const compactClasses = compactItemClassnames ? cn(!compactItemClassnames["ald-input-compact-first-item"] && "!tw-rounded-l-none", !compactItemClassnames["ald-input-compact-last-item"] && "!tw-rounded-r-none", !compactItemClassnames["ald-input-compact-first-item"] && "-tw-ml-px") : void 0;
56
57
  return /* @__PURE__ */ jsxs("span", {
57
58
  className: cn("ald-input ant-input-affix-wrapper tw-inline-flex tw-w-full tw-items-center tw-bg-[var(--background-default)] tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out", bordered && "tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]", !mergedDisabled && [
58
- "has-[input:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
59
- "forced-colors:has-[input:focus]:tw-outline",
60
- "forced-colors:has-[input:focus]:tw-outline-2",
61
- "forced-colors:has-[input:focus]:tw-outline-offset-2",
62
- "forced-colors:has-[input:focus]:tw-outline-[Highlight]"
63
- ], focused && "ant-input-affix-wrapper-focused", focused && !status && "!tw-border-[var(--border-brand-strong)]", `ald-input-${getSizeType(size)}`, "tw-text-typography-body-dense", size === "small" && "tw-h-7", size === "large" && "tw-h-9", (size === "middle" || !size) && "tw-h-8", status === "error" && `ald-input-error tw-border-[var(--border-negative-strong)]`, status === "warning" && `ald-input-warning tw-border-[var(--border-warning-subtle)]`, mergedDisabled && "ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-on-subtle)] tw-text-[var(--content-secondary)]", compactClasses, className),
59
+ "has-[input:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
60
+ "forced-colors:has-[input:focus-visible]:tw-outline",
61
+ "forced-colors:has-[input:focus-visible]:tw-outline-2",
62
+ "forced-colors:has-[input:focus-visible]:tw-outline-offset-2",
63
+ "forced-colors:has-[input:focus-visible]:tw-outline-[Highlight]"
64
+ ], focused && "ant-input-affix-wrapper-focused", focused && !status && "!tw-border-[var(--border-brand-strong)]", `ald-input-${getSizeType(size)}`, "tw-text-typography-body-dense", size === "small" && "tw-h-[28px]", size === "large" && "tw-h-[36px]", (size === "middle" || !size) && "tw-h-[32px]", status === "error" && `ald-input-error tw-border-[var(--border-negative-strong)]`, status === "warning" && `ald-input-warning tw-border-[var(--border-warning-subtle)]`, mergedDisabled && "ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]", compactClasses, className),
64
65
  style: {
65
66
  ...style,
66
67
  width
@@ -109,7 +110,16 @@ var Input = forwardRef((props, ref) => {
109
110
  readOnly,
110
111
  spellCheck: false,
111
112
  "data-testid": dataTestid,
112
- "aria-label": ariaLabel,
113
+ ...getSemanticOwnerAriaProps({
114
+ "aria-label": ariaLabel,
115
+ "aria-labelledby": ariaLabelledBy,
116
+ "aria-describedby": ariaDescribedBy,
117
+ "aria-invalid": ariaInvalid ?? (status === "error" ? true : void 0),
118
+ "aria-required": ariaRequired,
119
+ "aria-busy": ariaBusy,
120
+ "aria-disabled": ariaDisabled,
121
+ "aria-readonly": ariaReadonly
122
+ }),
113
123
  ...restInputProps
114
124
  }),
115
125
  showClearIcon && /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/Input/components/Input/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n forwardRef,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport DisabledContext from '../../../ConfigProvider/DisabledContext';\nimport SizeContext, { SizeType } from '../../../ConfigProvider/sizeContext';\nimport { CloseCircleFill } from '../../../Icon';\nimport { cn } from '../../../lib/utils';\nimport { useCompactItemContext } from '../../../Space/CompactContext';\n\ninterface IShowCountProps {\n formatter: (args: { count: number; maxLength?: number }) => string;\n}\nexport type TSize = SizeType;\nexport type InputRef = HTMLInputElement & {\n /** antd v4 compat — points to the underlying <input> element */\n input?: HTMLInputElement | null;\n};\n\ntype ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;\n\nexport interface IInputProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'size'\n | 'prefix'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'disabled'\n | 'type'\n | 'max'\n > {\n addonAfter?: ReactNode;\n addonBefore?: ReactNode;\n size?: TSize;\n id?: string;\n prefix?: ReactNode;\n suffix?: ReactNode;\n allowClear?: boolean;\n disabled?: boolean;\n showCount?: boolean | IShowCountProps;\n maxLength?: number;\n minLength?: number;\n max?: number;\n value?: string;\n defaultValue?: string;\n onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;\n onChange?: ChangeEventHandler;\n className?: string;\n style?: React.CSSProperties;\n placeholder?: string;\n type?: string;\n bordered?: boolean;\n status?: 'error' | 'warning' | '';\n autoComplete?: string;\n autoFocus?: boolean;\n readOnly?: boolean;\n width?: number | string;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n onCompositionStart?: React.CompositionEventHandler<HTMLInputElement>;\n onCompositionEnd?: React.CompositionEventHandler<HTMLInputElement>;\n /** 透传到内部 input 元素的 data-testid,用于自动化测试定位 */\n 'data-testid'?: string;\n /** 透传到内部 input 元素的 aria-label,用于可访问性与自动化测试定位 */\n 'aria-label'?: string;\n}\n\nexport function getSizeType(sizeType: TSize): TSize {\n if (['small', 'middle', 'large'].includes(sizeType || '')) {\n return sizeType;\n }\n return 'middle';\n}\n\nconst Input = forwardRef<InputRef, IInputProps>((props, ref) => {\n const {\n size: customSize,\n className,\n bordered = true,\n status,\n disabled,\n allowClear,\n prefix,\n suffix,\n addonBefore,\n addonAfter,\n showCount,\n maxLength,\n minLength,\n value: controlledValue,\n defaultValue,\n onChange,\n onPressEnter,\n onBlur,\n onFocus,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n placeholder,\n type,\n id,\n autoComplete = 'off',\n autoFocus,\n readOnly,\n width,\n style,\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n ...restInputProps\n } = props;\n\n const contextDisabled = useContext(DisabledContext);\n const mergedDisabled = disabled ?? contextDisabled;\n\n const contentSize = useContext(SizeContext);\n const { compactSize, compactItemClassnames } =\n useCompactItemContext('ald-input');\n const size = customSize || compactSize || contentSize || 'middle';\n\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState(defaultValue ?? '');\n const currentValue = isControlled ? controlledValue ?? '' : innerValue;\n const [focused, setFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n React.useImperativeHandle(ref, () => {\n const el = inputRef.current!;\n // Expose .input for antd v4 compat (ref.current.input.focus())\n (el as InputRef).input = el;\n return el as InputRef;\n });\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setInnerValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n // 通过原生 input 事件统一触发 React onChange,确保事件契约完整且只回调一次。\n const nativeEvent = new Event('input', { bubbles: true });\n if (inputRef.current) {\n const nativeSetter = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n 'value',\n )?.set;\n nativeSetter?.call(inputRef.current, '');\n inputRef.current.dispatchEvent(nativeEvent);\n }\n if (!isControlled) setInnerValue('');\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') onPressEnter?.(e);\n onKeyDown?.(e);\n };\n\n const showClearIcon = allowClear && currentValue && !mergedDisabled;\n\n const countInfo =\n showCount && typeof showCount === 'object'\n ? showCount.formatter({\n count: currentValue.length,\n maxLength,\n })\n : showCount\n ? `${currentValue.length}${maxLength ? `/${maxLength}` : ''}`\n : null;\n\n // Build compact-mode border-radius and margin overrides\n const compactClasses = compactItemClassnames\n ? cn(\n !compactItemClassnames['ald-input-compact-first-item'] &&\n '!tw-rounded-l-none',\n !compactItemClassnames['ald-input-compact-last-item'] &&\n '!tw-rounded-r-none',\n !compactItemClassnames['ald-input-compact-first-item'] && '-tw-ml-px',\n )\n : undefined;\n\n return (\n <span\n className={cn(\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n 'ald-input ant-input-affix-wrapper tw-inline-flex tw-w-full tw-items-center tw-bg-[var(--background-default)] tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n bordered &&\n 'tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n !mergedDisabled && [\n 'has-[input:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[input:focus]:tw-outline',\n 'forced-colors:has-[input:focus]:tw-outline-2',\n 'forced-colors:has-[input:focus]:tw-outline-offset-2',\n 'forced-colors:has-[input:focus]:tw-outline-[Highlight]',\n ],\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n // 保留既有 border 状态以维持 antd 兼容;焦点由上方的 Focus State Layer 独立呈现。\n focused && 'ant-input-affix-wrapper-focused',\n focused && !status && '!tw-border-[var(--border-brand-strong)]',\n `ald-input-${getSizeType(size)}`,\n // Typography Foundation: the wrapper owns the approved Body Dense\n // context for the editable value and placeholder. Count opts into its\n // approved Caption role below.\n 'tw-text-typography-body-dense',\n // Component Geometry: height belongs to the Input envelope, not to a\n // relationship-spacing Primitive.\n size === 'small' && 'tw-h-7',\n size === 'large' && 'tw-h-9',\n (size === 'middle' || !size) && 'tw-h-8',\n status === 'error' &&\n `ald-input-error tw-border-[var(--border-negative-strong)]`,\n status === 'warning' &&\n `ald-input-warning tw-border-[var(--border-warning-subtle)]`,\n mergedDisabled &&\n 'ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-on-subtle)] tw-text-[var(--content-secondary)]',\n compactClasses,\n className,\n )}\n style={{\n ...style,\n width,\n }}\n onMouseDown={(e) => {\n // 点击 wrapper 非 input 区域时:\n // 如果 input 已聚焦 → preventDefault 防止点击 wrapper 导致丢焦\n // 如果 input 未聚焦 → 不阻止默认行为,让浏览器正常处理 blur 上一个元素\n if (e.target !== inputRef.current) {\n if (document.activeElement === inputRef.current) {\n e.preventDefault();\n }\n }\n }}\n onMouseUp={(e) => {\n // 在 mouseUp 时将焦点转发给内部 input(兼容 prefix/suffix/padding 区域的点击)\n if (e.target !== inputRef.current && inputRef.current) {\n inputRef.current.focus();\n }\n }}\n >\n {addonBefore && (\n <span className=\"ald-input-addon tw-flex tw-shrink-0 tw-items-center tw-self-stretch tw-border-r tw-border-solid tw-border-[var(--border-default)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]\">\n {addonBefore}\n </span>\n )}\n {/* antd 兼容:保留 ant-input-prefix class,消费方 CSS 可能依赖该选择器 */}\n {prefix && (\n <span className=\"ald-input-prefix ant-input-prefix tw-flex tw-shrink-0 tw-items-center tw-pl-2 tw-text-[var(--content-secondary)]\">\n {prefix}\n </span>\n )}\n {/*\n * Value Affordance and Text Containment remain Constraint-owned and\n * Blocked. These shrink guards reserve local Geometry for affordances;\n * they do not define a spacing Primitive or Mapping.\n */}\n <input\n ref={inputRef}\n id={id}\n type={type || 'text'}\n className=\"tw-min-w-0 tw-flex-1 tw-self-stretch tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-2 tw-text-[var(--content-primary)] tw-text-inherit tw-outline-none\"\n value={currentValue}\n onChange={handleChange}\n onBlur={(e) => {\n setFocused(false);\n onBlur?.(e);\n }}\n onFocus={(e) => {\n setFocused(true);\n onFocus?.(e);\n }}\n onKeyDown={handleKeyDown}\n onCompositionStart={onCompositionStart}\n onCompositionEnd={onCompositionEnd}\n disabled={mergedDisabled}\n placeholder={placeholder}\n maxLength={maxLength}\n minLength={minLength}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n readOnly={readOnly}\n spellCheck={false}\n data-testid={dataTestid}\n aria-label={ariaLabel}\n {...restInputProps}\n />\n {showClearIcon && (\n <span\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n className=\"ald-input-clear ant-input-clear-icon tw-flex tw-shrink-0 tw-cursor-pointer tw-items-center tw-pr-1\"\n onClick={handleClear}\n >\n <CloseCircleFill size={16} color=\"var(--content-secondary)\" />\n </span>\n )}\n {/* antd 兼容:保留 ant-input-suffix class,消费方 CSS 可能依赖该选择器 */}\n {suffix && (\n <span className=\"ald-input-suffix ant-input-suffix tw-flex tw-shrink-0 tw-items-center tw-pr-2 tw-text-[var(--content-secondary)]\">\n {suffix}\n </span>\n )}\n {countInfo && (\n <span className=\"ald-input-count tw-shrink-0 tw-pr-2 tw-text-[var(--content-tertiary)] tw-text-typography-caption\">\n {countInfo}\n </span>\n )}\n {addonAfter && (\n <span className=\"ald-input-addon tw-border-l tw-border-solid tw-border-[var(--border-default)] tw-px-2 tw-text-[var(--content-secondary)]\">\n {addonAfter}\n </span>\n )}\n </span>\n );\n});\n\nexport default Input;\n"],"mappings":";;;;;;;;AAyEA,SAAgB,YAAY,UAAwB;AAClD,KAAI;EAAC;EAAS;EAAU;EAAQ,CAAC,SAAS,YAAY,GAAG,CACvD,QAAO;AAET,QAAO;;AAGT,IAAM,QAAQ,YAAmC,OAAO,QAAQ;CAC9D,MAAM,EACJ,MAAM,YACN,WACA,WAAW,MACX,QACA,UACA,YACA,QACA,QACA,aACA,YACA,WACA,WACA,WACA,OAAO,iBACP,cACA,UACA,cACA,QACA,SACA,WACA,oBACA,kBACA,aACA,MACA,IACA,eAAe,OACf,WACA,UACA,OACA,OACA,eAAe,YACf,cAAc,WACd,GAAG,mBACD;CAEJ,MAAM,kBAAkB,WAAW,gBAAgB;CACnD,MAAM,iBAAiB,YAAY;CAEnC,MAAM,cAAc,WAAW,YAAY;CAC3C,MAAM,EAAE,aAAa,0BACnB,sBAAsB,YAAY;CACpC,MAAM,OAAO,cAAc,eAAe,eAAe;CAEzD,MAAM,eAAe,WAAW;CAChC,MAAM,CAAC,YAAY,iBAAiB,SAAS,gBAAgB,GAAG;CAChE,MAAM,eAAe,eAAe,mBAAmB,KAAK;CAC5D,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAC7C,MAAM,WAAW,OAAyB,KAAK;AAE/C,OAAM,oBAAoB,WAAW;EACnC,MAAM,KAAK,SAAS;AAEnB,KAAgB,QAAQ;AACzB,SAAO;GACP;CAEF,MAAM,gBAAgB,MAA2C;AAC/D,MAAI,CAAC,aAAc,eAAc,EAAE,OAAO,MAAM;AAChD,aAAW,EAAE;;CAGf,MAAM,oBAAoB;EAExB,MAAM,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,MAAM,CAAC;AACzD,MAAI,SAAS,SAAS;AAKpB,IAJqB,OAAO,yBAC1B,iBAAiB,WACjB,QACD,EAAE,MACW,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AM;AACb,gBAAW,MAAM;AACjB,cAAS,EAAE;;IAEb,UAAU,MAAM;AACd,gBAAW,KAAK;AAChB,eAAU,EAAE;;IAEd,WAAW;IACS;IACF;IAClB,UAAU;IACG;IACF;IACA;IACG;IACH;IACD;IACV,YAAY;IACZ,eAAa;IACb,cAAY;IACZ,GAAI;IACJ,CAAA;GACD,iBACC,oBAAC,QAAD;IAEE,WAAU;IACV,SAAS;cAET,oBAAC,MAAD;KAAiB,MAAM;KAAI,OAAM;KAA6B,CAAA;IACzD,CAAA;GAGR,UACC,oBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA;GAER,aACC,oBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA;GAER,cACC,oBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA;GAEJ;;EAET"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/Input/components/Input/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n forwardRef,\n useContext,\n useRef,\n useState,\n} from 'react';\nimport DisabledContext from '../../../ConfigProvider/DisabledContext';\nimport SizeContext, { SizeType } from '../../../ConfigProvider/sizeContext';\nimport { CloseCircleFill } from '../../../Icon';\nimport { cn } from '../../../lib/utils';\nimport { useCompactItemContext } from '../../../Space/CompactContext';\nimport { getSemanticOwnerAriaProps } from '../../privateSemanticOwner';\n\ninterface IShowCountProps {\n formatter: (args: { count: number; maxLength?: number }) => string;\n}\nexport type TSize = SizeType;\nexport type InputRef = HTMLInputElement & {\n /** antd v4 compat — points to the underlying <input> element */\n input?: HTMLInputElement | null;\n};\n\ntype ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;\n\nexport interface IInputProps\n extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'size'\n | 'prefix'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'disabled'\n | 'type'\n | 'max'\n > {\n addonAfter?: ReactNode;\n addonBefore?: ReactNode;\n size?: TSize;\n id?: string;\n prefix?: ReactNode;\n suffix?: ReactNode;\n allowClear?: boolean;\n disabled?: boolean;\n showCount?: boolean | IShowCountProps;\n maxLength?: number;\n minLength?: number;\n max?: number;\n value?: string;\n defaultValue?: string;\n onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;\n onChange?: ChangeEventHandler;\n className?: string;\n style?: React.CSSProperties;\n placeholder?: string;\n type?: string;\n bordered?: boolean;\n status?: 'error' | 'warning' | '';\n autoComplete?: string;\n autoFocus?: boolean;\n readOnly?: boolean;\n width?: number | string;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;\n onCompositionStart?: React.CompositionEventHandler<HTMLInputElement>;\n onCompositionEnd?: React.CompositionEventHandler<HTMLInputElement>;\n /** 透传到内部 input 元素的 data-testid,用于自动化测试定位 */\n 'data-testid'?: string;\n /** 透传到内部 input 元素的 aria-label,用于可访问性与自动化测试定位 */\n 'aria-label'?: string;\n}\n\nexport function getSizeType(sizeType: TSize): TSize {\n if (['small', 'middle', 'large'].includes(sizeType || '')) {\n return sizeType;\n }\n return 'middle';\n}\n\nconst Input = forwardRef<InputRef, IInputProps>((props, ref) => {\n const {\n size: customSize,\n className,\n bordered = true,\n status,\n disabled,\n allowClear,\n prefix,\n suffix,\n addonBefore,\n addonAfter,\n showCount,\n maxLength,\n minLength,\n value: controlledValue,\n defaultValue,\n onChange,\n onPressEnter,\n onBlur,\n onFocus,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n placeholder,\n type,\n id,\n autoComplete = 'off',\n autoFocus,\n readOnly,\n width,\n style,\n 'data-testid': dataTestid,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadonly,\n ...restInputProps\n } = props;\n\n const contextDisabled = useContext(DisabledContext);\n const mergedDisabled = disabled ?? contextDisabled;\n\n const contentSize = useContext(SizeContext);\n const { compactSize, compactItemClassnames } =\n useCompactItemContext('ald-input');\n const size = customSize || compactSize || contentSize || 'middle';\n\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState(defaultValue ?? '');\n const currentValue = isControlled ? controlledValue ?? '' : innerValue;\n const [focused, setFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n React.useImperativeHandle(ref, () => {\n const el = inputRef.current!;\n // Expose .input for antd v4 compat (ref.current.input.focus())\n (el as InputRef).input = el;\n return el as InputRef;\n });\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isControlled) setInnerValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n // 通过原生 input 事件统一触发 React onChange,确保事件契约完整且只回调一次。\n const nativeEvent = new Event('input', { bubbles: true });\n if (inputRef.current) {\n const nativeSetter = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n 'value',\n )?.set;\n nativeSetter?.call(inputRef.current, '');\n inputRef.current.dispatchEvent(nativeEvent);\n }\n if (!isControlled) setInnerValue('');\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') onPressEnter?.(e);\n onKeyDown?.(e);\n };\n\n const showClearIcon = allowClear && currentValue && !mergedDisabled;\n\n const countInfo =\n showCount && typeof showCount === 'object'\n ? showCount.formatter({\n count: currentValue.length,\n maxLength,\n })\n : showCount\n ? `${currentValue.length}${maxLength ? `/${maxLength}` : ''}`\n : null;\n\n // Build compact-mode border-radius and margin overrides\n const compactClasses = compactItemClassnames\n ? cn(\n !compactItemClassnames['ald-input-compact-first-item'] &&\n '!tw-rounded-l-none',\n !compactItemClassnames['ald-input-compact-last-item'] &&\n '!tw-rounded-r-none',\n !compactItemClassnames['ald-input-compact-first-item'] && '-tw-ml-px',\n )\n : undefined;\n\n return (\n <span\n className={cn(\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n 'ald-input ant-input-affix-wrapper tw-inline-flex tw-w-full tw-items-center tw-bg-[var(--background-default)] tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n bordered &&\n 'tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n !mergedDisabled && [\n 'has-[input:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[input:focus-visible]:tw-outline',\n 'forced-colors:has-[input:focus-visible]:tw-outline-2',\n 'forced-colors:has-[input:focus-visible]:tw-outline-offset-2',\n 'forced-colors:has-[input:focus-visible]:tw-outline-[Highlight]',\n ],\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n // 保留既有 border 状态以维持 antd 兼容;焦点由上方的 Focus State Layer 独立呈现。\n focused && 'ant-input-affix-wrapper-focused',\n focused && !status && '!tw-border-[var(--border-brand-strong)]',\n `ald-input-${getSizeType(size)}`,\n // Typography Foundation: the wrapper owns the approved Body Dense\n // context for the editable value and placeholder. Count opts into its\n // approved Caption role below.\n 'tw-text-typography-body-dense',\n // Component Geometry: height belongs to the Input envelope, not to a\n // relationship-spacing Primitive.\n size === 'small' && 'tw-h-[28px]',\n size === 'large' && 'tw-h-[36px]',\n (size === 'middle' || !size) && 'tw-h-[32px]',\n status === 'error' &&\n `ald-input-error tw-border-[var(--border-negative-strong)]`,\n status === 'warning' &&\n `ald-input-warning tw-border-[var(--border-warning-subtle)]`,\n mergedDisabled &&\n 'ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]',\n compactClasses,\n className,\n )}\n style={{\n ...style,\n width,\n }}\n onMouseDown={(e) => {\n // 点击 wrapper 非 input 区域时:\n // 如果 input 已聚焦 → preventDefault 防止点击 wrapper 导致丢焦\n // 如果 input 未聚焦 → 不阻止默认行为,让浏览器正常处理 blur 上一个元素\n if (e.target !== inputRef.current) {\n if (document.activeElement === inputRef.current) {\n e.preventDefault();\n }\n }\n }}\n onMouseUp={(e) => {\n // 在 mouseUp 时将焦点转发给内部 input(兼容 prefix/suffix/padding 区域的点击)\n if (e.target !== inputRef.current && inputRef.current) {\n inputRef.current.focus();\n }\n }}\n >\n {addonBefore && (\n <span className=\"ald-input-addon tw-flex tw-shrink-0 tw-items-center tw-self-stretch tw-border-r tw-border-solid tw-border-[var(--border-default)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]\">\n {addonBefore}\n </span>\n )}\n {/* antd 兼容:保留 ant-input-prefix class,消费方 CSS 可能依赖该选择器 */}\n {prefix && (\n <span className=\"ald-input-prefix ant-input-prefix tw-flex tw-shrink-0 tw-items-center tw-pl-2 tw-text-[var(--content-secondary)]\">\n {prefix}\n </span>\n )}\n {/*\n * Value Affordance and Text Containment remain Constraint-owned and\n * Blocked. These shrink guards reserve local Geometry for affordances;\n * they do not define a spacing Primitive or Mapping.\n */}\n <input\n ref={inputRef}\n id={id}\n type={type || 'text'}\n className=\"tw-min-w-0 tw-flex-1 tw-self-stretch tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-2 tw-text-[var(--content-primary)] tw-text-inherit tw-outline-none\"\n value={currentValue}\n onChange={handleChange}\n onBlur={(e) => {\n setFocused(false);\n onBlur?.(e);\n }}\n onFocus={(e) => {\n setFocused(true);\n onFocus?.(e);\n }}\n onKeyDown={handleKeyDown}\n onCompositionStart={onCompositionStart}\n onCompositionEnd={onCompositionEnd}\n disabled={mergedDisabled}\n placeholder={placeholder}\n maxLength={maxLength}\n minLength={minLength}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n readOnly={readOnly}\n spellCheck={false}\n data-testid={dataTestid}\n {...getSemanticOwnerAriaProps({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid':\n ariaInvalid ?? (status === 'error' ? true : undefined),\n 'aria-required': ariaRequired,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadonly,\n })}\n {...restInputProps}\n />\n {showClearIcon && (\n <span\n // antd 兼容:保留 ant-* class,消费方 CSS 可能依赖该选择器\n className=\"ald-input-clear ant-input-clear-icon tw-flex tw-shrink-0 tw-cursor-pointer tw-items-center tw-pr-1\"\n onClick={handleClear}\n >\n <CloseCircleFill size={16} color=\"var(--content-secondary)\" />\n </span>\n )}\n {/* antd 兼容:保留 ant-input-suffix class,消费方 CSS 可能依赖该选择器 */}\n {suffix && (\n <span className=\"ald-input-suffix ant-input-suffix tw-flex tw-shrink-0 tw-items-center tw-pr-2 tw-text-[var(--content-secondary)]\">\n {suffix}\n </span>\n )}\n {countInfo && (\n <span className=\"ald-input-count tw-shrink-0 tw-pr-2 tw-text-[var(--content-tertiary)] tw-text-typography-caption\">\n {countInfo}\n </span>\n )}\n {addonAfter && (\n <span className=\"ald-input-addon tw-border-l tw-border-solid tw-border-[var(--border-default)] tw-px-2 tw-text-[var(--content-secondary)]\">\n {addonAfter}\n </span>\n )}\n </span>\n );\n});\n\nexport default Input;\n"],"mappings":";;;;;;;;;AA0EA,SAAgB,YAAY,UAAwB;AAClD,KAAI;EAAC;EAAS;EAAU;EAAQ,CAAC,SAAS,YAAY,GAAG,CACvD,QAAO;AAET,QAAO;;AAGT,IAAM,QAAQ,YAAmC,OAAO,QAAQ;CAC9D,MAAM,EACJ,MAAM,YACN,WACA,WAAW,MACX,QACA,UACA,YACA,QACA,QACA,aACA,YACA,WACA,WACA,WACA,OAAO,iBACP,cACA,UACA,cACA,QACA,SACA,WACA,oBACA,kBACA,aACA,MACA,IACA,eAAe,OACf,WACA,UACA,OACA,OACA,eAAe,YACf,cAAc,WACd,mBAAmB,gBACnB,oBAAoB,iBACpB,gBAAgB,aAChB,iBAAiB,cACjB,aAAa,UACb,iBAAiB,cACjB,iBAAiB,cACjB,GAAG,mBACD;CAEJ,MAAM,kBAAkB,WAAW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GAER,aACC,oBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA;GAER,cACC,oBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA;GAEJ;;EAET"}
@@ -2,12 +2,13 @@ import { cn } from "../../../lib/utils.js";
2
2
  import Memo from "../../../Icon/components/CloseCircleFill.js";
3
3
  import DisabledContext from "../../../ConfigProvider/DisabledContext.js";
4
4
  import SizeContext from "../../../ConfigProvider/sizeContext.js";
5
+ import { getSemanticOwnerAriaProps } from "../../../_utils/formControlSemanticOwner.js";
5
6
  import { getSizeType } from "../Input/index.js";
6
7
  import React, { forwardRef, useContext, useRef, useState } from "react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  //#region src/Input/components/TextArea/index.tsx
9
10
  var TextArea_default = forwardRef((props, ref) => {
10
- const { bordered, border, size: customSize, disabled, className = "", allowClear = false, value: controlledValue, defaultValue, onChange, onPressEnter, maxLength, showCount, autoSize, placeholder, rows, onBlur, onFocus, onKeyDown, onCompositionStart, onCompositionEnd, style, ...restTextAreaProps } = props;
11
+ const { bordered, border, size: customSize, disabled, className = "", allowClear = false, value: controlledValue, defaultValue, onChange, onPressEnter, maxLength, showCount, autoSize, placeholder, rows, onBlur, onFocus, onKeyDown, onCompositionStart, onCompositionEnd, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, "aria-busy": ariaBusy, "aria-disabled": ariaDisabled, "aria-readonly": ariaReadonly, ...restTextAreaProps } = props;
11
12
  const isBordered = bordered ?? border ?? true;
12
13
  const contextDisabled = useContext(DisabledContext);
13
14
  const mergedDisabled = disabled ?? contextDisabled;
@@ -35,12 +36,12 @@ var TextArea_default = forwardRef((props, ref) => {
35
36
  return /* @__PURE__ */ jsxs("div", {
36
37
  className: cn("ald-input ald-input-textarea tw-relative tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out", `ald-input-textarea-${getSizeType(size)}`, isBordered && "tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]", !mergedDisabled && [
37
38
  "has-[textarea:focus]:!tw-border-[var(--border-brand-strong)]",
38
- "has-[textarea:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
39
- "forced-colors:has-[textarea:focus]:tw-outline",
40
- "forced-colors:has-[textarea:focus]:tw-outline-2",
41
- "forced-colors:has-[textarea:focus]:tw-outline-offset-2",
42
- "forced-colors:has-[textarea:focus]:tw-outline-[Highlight]"
43
- ], mergedDisabled && "ald-input-disabled tw-opacity-50", className),
39
+ "has-[textarea:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
40
+ "forced-colors:has-[textarea:focus-visible]:tw-outline",
41
+ "forced-colors:has-[textarea:focus-visible]:tw-outline-2",
42
+ "forced-colors:has-[textarea:focus-visible]:tw-outline-offset-2",
43
+ "forced-colors:has-[textarea:focus-visible]:tw-outline-[Highlight]"
44
+ ], mergedDisabled && "ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]", className),
44
45
  style,
45
46
  children: [
46
47
  /* @__PURE__ */ jsx("textarea", {
@@ -59,6 +60,16 @@ var TextArea_default = forwardRef((props, ref) => {
59
60
  rows: rows || (minRows ?? 3),
60
61
  spellCheck: false,
61
62
  autoComplete: "off",
63
+ ...getSemanticOwnerAriaProps({
64
+ "aria-label": ariaLabel,
65
+ "aria-labelledby": ariaLabelledBy,
66
+ "aria-describedby": ariaDescribedBy,
67
+ "aria-invalid": ariaInvalid,
68
+ "aria-required": ariaRequired,
69
+ "aria-busy": ariaBusy,
70
+ "aria-disabled": ariaDisabled,
71
+ "aria-readonly": ariaReadonly
72
+ }),
62
73
  ...restTextAreaProps,
63
74
  style: {
64
75
  minHeight: minRows ? `${minRows * 22}px` : void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/Input/components/TextArea/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useRef, useState } from 'react';\nimport DisabledContext from '../../../ConfigProvider/DisabledContext';\nimport SizeContext from '../../../ConfigProvider/sizeContext';\nimport { CloseCircleFill } from '../../../Icon';\nimport { cn } from '../../../lib/utils';\nimport { TSize, getSizeType } from '../Input';\n\nexport type TextAreaRef = HTMLTextAreaElement;\n\nexport interface ITextAreaProps\n extends Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'disabled' | 'rows'\n > {\n autoFocus?: boolean;\n allowClear?: boolean;\n autoSize?: boolean | { minRows?: number; maxRows?: number };\n defaultValue?: string;\n maxLength?: number;\n showCount?:\n | boolean\n | { formatter: (args: { count: number; maxLength?: number }) => string };\n value?: string;\n onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n onResize?: (size: { width: number; height: number }) => void;\n border?: boolean;\n bordered?: boolean;\n className?: string;\n size?: TSize;\n disabled?: boolean;\n placeholder?: string;\n rows?: number;\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;\n onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n onCompositionStart?: React.CompositionEventHandler<HTMLTextAreaElement>;\n onCompositionEnd?: React.CompositionEventHandler<HTMLTextAreaElement>;\n style?: React.CSSProperties;\n}\n\nexport default forwardRef<TextAreaRef, ITextAreaProps>((props, ref) => {\n const {\n bordered,\n border,\n size: customSize,\n disabled,\n className = '',\n allowClear = false,\n value: controlledValue,\n defaultValue,\n onChange,\n onPressEnter,\n maxLength,\n showCount,\n autoSize,\n placeholder,\n rows,\n onBlur,\n onFocus,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n style,\n ...restTextAreaProps\n } = props;\n\n const isBordered = bordered ?? border ?? true;\n\n const contextDisabled = useContext(DisabledContext);\n const mergedDisabled = disabled ?? contextDisabled;\n\n const contentSize = useContext(SizeContext);\n const size = customSize || contentSize || 'middle';\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState(defaultValue ?? '');\n const currentValue = isControlled ? controlledValue ?? '' : innerValue;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n React.useImperativeHandle(ref, () => textareaRef.current!);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setInnerValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n if (!isControlled) setInnerValue('');\n onChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLTextAreaElement>);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter') onPressEnter?.(e);\n onKeyDown?.(e);\n };\n\n const minRows = typeof autoSize === 'object' ? autoSize.minRows : undefined;\n const maxRows = typeof autoSize === 'object' ? autoSize.maxRows : undefined;\n\n return (\n <div\n className={cn(\n 'ald-input ald-input-textarea tw-relative tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n `ald-input-textarea-${getSizeType(size)}`,\n isBordered &&\n 'tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n !mergedDisabled && [\n 'has-[textarea:focus]:!tw-border-[var(--border-brand-strong)]',\n 'has-[textarea:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[textarea:focus]:tw-outline',\n 'forced-colors:has-[textarea:focus]:tw-outline-2',\n 'forced-colors:has-[textarea:focus]:tw-outline-offset-2',\n 'forced-colors:has-[textarea:focus]:tw-outline-[Highlight]',\n ],\n mergedDisabled && 'ald-input-disabled tw-opacity-50',\n className,\n )}\n style={style}\n >\n <textarea\n ref={textareaRef}\n className=\"tw-w-full tw-resize-y tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-3 tw-py-2 tw-text-[var(--content-primary)] tw-outline-none tw-text-typography-body-dense\"\n value={currentValue}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onCompositionStart={onCompositionStart}\n onCompositionEnd={onCompositionEnd}\n disabled={mergedDisabled}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows || (minRows ?? 3)}\n spellCheck={false}\n autoComplete=\"off\"\n {...restTextAreaProps}\n style={{\n minHeight: minRows ? `${minRows * 22}px` : undefined,\n maxHeight: maxRows ? `${maxRows * 22}px` : undefined,\n }}\n />\n {allowClear && currentValue && !mergedDisabled && (\n <span\n className=\"tw-absolute tw-right-2 tw-top-2 tw-cursor-pointer\"\n onClick={handleClear}\n >\n <CloseCircleFill size={16} color=\"var(--content-secondary)\" />\n </span>\n )}\n {showCount && (\n <div className=\"tw-px-2 tw-pb-1 tw-text-right tw-text-[var(--content-tertiary)] tw-text-typography-caption\">\n {typeof showCount === 'object'\n ? showCount.formatter({ count: currentValue.length, maxLength })\n : `${currentValue.length}${maxLength ? `/${maxLength}` : ''}`}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;AAyCA,IAAA,mBAAe,YAAyC,OAAO,QAAQ;CACrE,MAAM,EACJ,UACA,QACA,MAAM,YACN,UACA,YAAY,IACZ,aAAa,OACb,OAAO,iBACP,cACA,UACA,cACA,WACA,WACA,UACA,aACA,MACA,QACA,SACA,WACA,oBACA,kBACA,OACA,GAAG,sBACD;CAEJ,MAAM,aAAa,YAAY,UAAU;CAEzC,MAAM,kBAAkB,WAAW,gBAAgB;CACnD,MAAM,iBAAiB,YAAY;CAEnC,MAAM,cAAc,WAAW,YAAY;CAC3C,MAAM,OAAO,cAAc,eAAe;CAC1C,MAAM,eAAe,WAAW;CAChC,MAAM,CAAC,YAAY,iBAAiB,SAAS,gBAAgB,GAAG;CAChE,MAAM,eAAe,eAAe,mBAAmB,KAAK;CAC5D,MAAM,cAAc,OAA4B,KAAK;AAErD,OAAM,oBAAoB,WAAW,YAAY,QAAS;CAE1D,MAAM,gBAAgB,MAA8C;AAClE,MAAI,CAAC,aAAc,eAAc,EAAE,OAAO,MAAM;AAChD,aAAW,EAAE;;CAGf,MAAM,oBAAoB;AACxB,MAAI,CAAC,aAAc,eAAc,GAAG;AACpC,aAAW,EACT,QAAQ,EAAE,OAAO,IAAI,EACtB,CAA2C;;CAG9C,MAAM,iBAAiB,MAAgD;AACrE,MAAI,EAAE,QAAQ,QAAS,gBAAe,EAAE;AACxC,cAAY,EAAE;;CAGhB,MAAM,UAAU,OAAO,aAAa,WAAW,SAAS,UAAU;CAClE,MAAM,UAAU,OAAO,aAAa,WAAW,SAAS,UAAU;AAElE,QACE,qBAAC,OAAD;EACE,WAAW,GACT,gHACA,sBAAsB,YAAY,KAAK,IACvC,cACE,sFACF,CAAC,kBAAkB;GACjB;GACA;GACA;GACA;GACA;GACA;GACD,EACD,kBAAkB,oCAClB,UACD;EACM;YAjBT;GAmBE,oBAAC,YAAD;IACE,KAAK;IACL,WAAU;IACV,OAAO;IACP,UAAU;IACF;IACC;IACT,WAAW;IACS;IACF;IAClB,UAAU;IACG;IACF;IACX,MAAM,SAAS,WAAW;IAC1B,YAAY;IACZ,cAAa;IACb,GAAI;IACJ,OAAO;KACL,WAAW,UAAU,GAAG,UAAU,GAAG,MAAM;KAC3C,WAAW,UAAU,GAAG,UAAU,GAAG,MAAM;KAC5C;IACD,CAAA;GACD,cAAc,gBAAgB,CAAC,kBAC9B,oBAAC,QAAD;IACE,WAAU;IACV,SAAS;cAET,oBAAC,MAAD;KAAiB,MAAM;KAAI,OAAM;KAA6B,CAAA;IACzD,CAAA;GAER,aACC,oBAAC,OAAD;IAAK,WAAU;cACZ,OAAO,cAAc,WAClB,UAAU,UAAU;KAAE,OAAO,aAAa;KAAQ;KAAW,CAAC,GAC9D,GAAG,aAAa,SAAS,YAAY,IAAI,cAAc;IACvD,CAAA;GAEJ;;EAER"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/Input/components/TextArea/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useRef, useState } from 'react';\nimport DisabledContext from '../../../ConfigProvider/DisabledContext';\nimport SizeContext from '../../../ConfigProvider/sizeContext';\nimport { CloseCircleFill } from '../../../Icon';\nimport { cn } from '../../../lib/utils';\nimport { TSize, getSizeType } from '../Input';\nimport { getSemanticOwnerAriaProps } from '../../privateSemanticOwner';\n\nexport type TextAreaRef = HTMLTextAreaElement;\n\nexport interface ITextAreaProps\n extends Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'size' | 'value' | 'defaultValue' | 'onChange' | 'disabled' | 'rows'\n > {\n autoFocus?: boolean;\n allowClear?: boolean;\n autoSize?: boolean | { minRows?: number; maxRows?: number };\n defaultValue?: string;\n maxLength?: number;\n showCount?:\n | boolean\n | { formatter: (args: { count: number; maxLength?: number }) => string };\n value?: string;\n onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n onResize?: (size: { width: number; height: number }) => void;\n border?: boolean;\n bordered?: boolean;\n className?: string;\n size?: TSize;\n disabled?: boolean;\n placeholder?: string;\n rows?: number;\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;\n onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;\n onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;\n onCompositionStart?: React.CompositionEventHandler<HTMLTextAreaElement>;\n onCompositionEnd?: React.CompositionEventHandler<HTMLTextAreaElement>;\n style?: React.CSSProperties;\n}\n\nexport default forwardRef<TextAreaRef, ITextAreaProps>((props, ref) => {\n const {\n bordered,\n border,\n size: customSize,\n disabled,\n className = '',\n allowClear = false,\n value: controlledValue,\n defaultValue,\n onChange,\n onPressEnter,\n maxLength,\n showCount,\n autoSize,\n placeholder,\n rows,\n onBlur,\n onFocus,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n style,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadonly,\n ...restTextAreaProps\n } = props;\n\n const isBordered = bordered ?? border ?? true;\n\n const contextDisabled = useContext(DisabledContext);\n const mergedDisabled = disabled ?? contextDisabled;\n\n const contentSize = useContext(SizeContext);\n const size = customSize || contentSize || 'middle';\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState(defaultValue ?? '');\n const currentValue = isControlled ? controlledValue ?? '' : innerValue;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n React.useImperativeHandle(ref, () => textareaRef.current!);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setInnerValue(e.target.value);\n onChange?.(e);\n };\n\n const handleClear = () => {\n if (!isControlled) setInnerValue('');\n onChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLTextAreaElement>);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter') onPressEnter?.(e);\n onKeyDown?.(e);\n };\n\n const minRows = typeof autoSize === 'object' ? autoSize.minRows : undefined;\n const maxRows = typeof autoSize === 'object' ? autoSize.maxRows : undefined;\n\n return (\n <div\n className={cn(\n 'ald-input ald-input-textarea tw-relative tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n `ald-input-textarea-${getSizeType(size)}`,\n isBordered &&\n 'tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n !mergedDisabled && [\n 'has-[textarea:focus]:!tw-border-[var(--border-brand-strong)]',\n 'has-[textarea:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[textarea:focus-visible]:tw-outline',\n 'forced-colors:has-[textarea:focus-visible]:tw-outline-2',\n 'forced-colors:has-[textarea:focus-visible]:tw-outline-offset-2',\n 'forced-colors:has-[textarea:focus-visible]:tw-outline-[Highlight]',\n ],\n mergedDisabled &&\n 'ald-input-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]',\n className,\n )}\n style={style}\n >\n <textarea\n ref={textareaRef}\n className=\"tw-w-full tw-resize-y tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-3 tw-py-2 tw-text-[var(--content-primary)] tw-outline-none tw-text-typography-body-dense\"\n value={currentValue}\n onChange={handleChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n onCompositionStart={onCompositionStart}\n onCompositionEnd={onCompositionEnd}\n disabled={mergedDisabled}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows || (minRows ?? 3)}\n spellCheck={false}\n autoComplete=\"off\"\n {...getSemanticOwnerAriaProps({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadonly,\n })}\n {...restTextAreaProps}\n style={{\n minHeight: minRows ? `${minRows * 22}px` : undefined,\n maxHeight: maxRows ? `${maxRows * 22}px` : undefined,\n }}\n />\n {allowClear && currentValue && !mergedDisabled && (\n <span\n className=\"tw-absolute tw-right-2 tw-top-2 tw-cursor-pointer\"\n onClick={handleClear}\n >\n <CloseCircleFill size={16} color=\"var(--content-secondary)\" />\n </span>\n )}\n {showCount && (\n <div className=\"tw-px-2 tw-pb-1 tw-text-right tw-text-[var(--content-tertiary)] tw-text-typography-caption\">\n {typeof showCount === 'object'\n ? showCount.formatter({ count: currentValue.length, maxLength })\n : `${currentValue.length}${maxLength ? `/${maxLength}` : ''}`}\n </div>\n )}\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AA0CA,IAAA,mBAAe,YAAyC,OAAO,QAAQ;CACrE,MAAM,EACJ,UACA,QACA,MAAM,YACN,UACA,YAAY,IACZ,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ACG;IACF;IACX,MAAM,SAAS,WAAW;IAC1B,YAAY;IACZ,cAAa;IACb,GAAI,0BAA0B;KAC5B,cAAc;KACd,mBAAmB;KACnB,oBAAoB;KACpB,gBAAgB;KAChB,iBAAiB;KACjB,aAAa;KACb,iBAAiB;KACjB,iBAAiB;KAClB,CAAC;IACF,GAAI;IACJ,OAAO;KACL,WAAW,UAAU,GAAG,UAAU,GAAG,MAAM;KAC3C,WAAW,UAAU,GAAG,UAAU,GAAG,MAAM;KAC5C;IACD,CAAA;GACD,cAAc,gBAAgB,CAAC,kBAC9B,oBAAC,QAAD;IACE,WAAU;IACV,SAAS;cAET,oBAAC,MAAD;KAAiB,MAAM;KAAI,OAAM;KAA6B,CAAA;IACzD,CAAA;GAER,aACC,oBAAC,OAAD;IAAK,WAAU;cACZ,OAAO,cAAc,WAClB,UAAU,UAAU;KAAE,OAAO,aAAa;KAAQ;KAAW,CAAC,GAC9D,GAAG,aAAa,SAAS,YAAY,IAAI,cAAc;IACvD,CAAA;GAEJ;;EAER"}
@@ -0,0 +1,2 @@
1
+ export { getSemanticOwnerAriaProps } from '../_utils/formControlSemanticOwner';
2
+ export type { SemanticOwnerAriaProps } from '../_utils/formControlSemanticOwner';
@@ -0,0 +1 @@
1
+ import "../_utils/formControlSemanticOwner.js";
@@ -4,12 +4,19 @@ import SizeContext from "../ConfigProvider/sizeContext.js";
4
4
  import { useCallback, useContext, useEffect, useRef, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/InputNumber/index.tsx
7
+ function pickAriaProps(props) {
8
+ return Object.keys(props).reduce((ariaProps, key) => {
9
+ if (key.startsWith("aria-")) ariaProps[key] = props[key];
10
+ return ariaProps;
11
+ }, {});
12
+ }
7
13
  function InputNumber(props) {
8
14
  const { className, disabled: customDisabled, size: customSize, status, value: controlledValue, defaultValue, min = -Infinity, max = Infinity, step = 1, precision, onChange, onPressEnter, onBlur, onFocus, formatter, parser, prefix, addonBefore, addonAfter, placeholder, autoFocus, bordered = true, keyboard = true, readonly: readOnly, style, id, "data-testid": dataTestId, "aria-label": ariaLabel } = props;
9
15
  const contentSize = useContext(SizeContext);
10
16
  const size = customSize || contentSize || "middle";
11
17
  const disabled = useContext(DisabledContext);
12
18
  const mergedDisabled = customDisabled ?? disabled;
19
+ const nativeInputAriaProps = pickAriaProps(props);
13
20
  const isControlled = "value" in props;
14
21
  const [innerValue, setInnerValue] = useState(defaultValue ?? null);
15
22
  const currentValue = isControlled ? controlledValue : innerValue;
@@ -83,20 +90,20 @@ function InputNumber(props) {
83
90
  const radiusClasses = cn(size === "large" && "tw-rounded-[8px]", size === "small" && "tw-rounded-[4px]", size !== "large" && size !== "small" && "tw-rounded-[6px]");
84
91
  const inputBox = /* @__PURE__ */ jsxs("div", {
85
92
  "data-testid": !hasAddon ? dataTestId : void 0,
86
- "aria-label": !hasAddon ? ariaLabel : void 0,
87
- className: cn("ald-input-number tw-inline-flex tw-w-[90px] tw-min-w-0 tw-items-center tw-overflow-hidden tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out", bordered && "tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]", mergedDisabled ? "ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-on-subtle)] tw-text-[var(--content-secondary)]" : "tw-bg-[var(--background-default)] tw-text-[var(--content-primary)] hover:tw-border-[var(--border-brand-strong)]", !hasAddon && sizeClasses, hasAddon ? "tw-h-auto tw-flex-1 tw-self-stretch tw-rounded-none" : radiusClasses, status === "error" && "tw-border-[var(--border-negative-strong)]", status === "warning" && "tw-border-[var(--border-warning-subtle)]", !mergedDisabled && [
93
+ className: cn("ald-input-number tw-inline-flex tw-w-[90px] tw-min-w-0 tw-items-center tw-overflow-hidden tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out", bordered && "tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]", mergedDisabled ? "ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]" : "tw-bg-[var(--background-default)] tw-text-[var(--content-primary)] hover:tw-border-[var(--border-brand-strong)]", !hasAddon && sizeClasses, hasAddon ? "tw-h-auto tw-flex-1 tw-self-stretch tw-rounded-none" : radiusClasses, status === "error" && "tw-border-[var(--border-negative-strong)]", status === "warning" && "tw-border-[var(--border-warning-subtle)]", !mergedDisabled && [
88
94
  !status && "has-[input:focus]:!tw-border-[var(--border-brand-strong)]",
89
- "has-[input:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
90
- "forced-colors:has-[input:focus]:tw-outline",
91
- "forced-colors:has-[input:focus]:tw-outline-2",
92
- "forced-colors:has-[input:focus]:tw-outline-offset-2",
93
- "forced-colors:has-[input:focus]:tw-outline-[Highlight]"
95
+ "has-[input:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]",
96
+ "forced-colors:has-[input:focus-visible]:tw-outline",
97
+ "forced-colors:has-[input:focus-visible]:tw-outline-2",
98
+ "forced-colors:has-[input:focus-visible]:tw-outline-offset-2",
99
+ "forced-colors:has-[input:focus-visible]:tw-outline-[Highlight]"
94
100
  ], !hasAddon && className),
95
101
  style: !hasAddon ? style : void 0,
96
102
  children: [prefix && /* @__PURE__ */ jsx("span", {
97
103
  className: "tw-px-2 tw-text-[var(--content-secondary)]",
98
104
  children: prefix
99
105
  }), /* @__PURE__ */ jsx("input", {
106
+ ...nativeInputAriaProps,
100
107
  ref: inputRef,
101
108
  id,
102
109
  type: "text",
@@ -111,13 +118,13 @@ function InputNumber(props) {
111
118
  disabled: mergedDisabled,
112
119
  readOnly,
113
120
  autoFocus,
114
- placeholder
121
+ placeholder,
122
+ "aria-label": ariaLabel
115
123
  })]
116
124
  });
117
125
  if (!hasAddon) return inputBox;
118
126
  return /* @__PURE__ */ jsxs("div", {
119
127
  "data-testid": dataTestId,
120
- "aria-label": ariaLabel,
121
128
  className: cn("ald-input-number-group tw-inline-flex tw-min-w-0 tw-items-stretch", sizeClasses, radiusClasses, mergedDisabled && "ald-input-number-disabled", className),
122
129
  style,
123
130
  children: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/InputNumber/index.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport DisabledContext from '../ConfigProvider/DisabledContext';\nimport SizeContext from '../ConfigProvider/sizeContext';\nimport { cn } from '../lib/utils';\nimport { IInputNumberProps } from './type';\n\nexport default function InputNumber(props: IInputNumberProps) {\n const {\n className,\n disabled: customDisabled,\n size: customSize,\n status,\n value: controlledValue,\n defaultValue,\n min = -Infinity,\n max = Infinity,\n step = 1,\n precision,\n onChange,\n onPressEnter,\n onBlur,\n onFocus,\n formatter,\n parser,\n prefix,\n addonBefore,\n addonAfter,\n placeholder,\n autoFocus,\n bordered = true,\n keyboard = true,\n readonly: readOnly,\n style,\n id,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n } = props;\n\n const contentSize = useContext(SizeContext);\n const size = customSize || contentSize || 'middle';\n const disabled = useContext(DisabledContext);\n const mergedDisabled = customDisabled ?? disabled;\n\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState<number | null | undefined>(\n defaultValue ?? null,\n );\n const currentValue = isControlled ? controlledValue : innerValue;\n\n const [inputStr, setInputStr] = useState(\n currentValue !== null && currentValue !== undefined\n ? String(currentValue)\n : '',\n );\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (currentValue !== null && currentValue !== undefined) {\n setInputStr(String(currentValue));\n } else {\n setInputStr('');\n }\n }, [currentValue]);\n\n const clamp = useCallback(\n (val: number) => {\n let v = Math.max(min, Math.min(max, val));\n if (precision !== undefined) {\n v = Number(v.toFixed(precision));\n }\n return v;\n },\n [min, max, precision],\n );\n\n const updateValue = useCallback(\n (newVal: number | null) => {\n const clamped = newVal !== null ? clamp(newVal) : null;\n if (!isControlled) setInnerValue(clamped);\n onChange?.(clamped);\n },\n [clamp, isControlled, onChange],\n );\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const raw = e.target.value;\n setInputStr(raw);\n if (raw === '') {\n // 清空立即同步到 value,对齐 antd 行为。\n // 否则消费方\"清空后直接点确定\"(未 blur 触发 handleBlur 的 null 兜底)拿到的\n // 仍是旧值,把已清空的筛选条件错误带进 query(被 release-2.3_test 周期实例\n // 更多浮窗实测复现)。\n updateValue(null);\n return;\n }\n if (raw === '-') return;\n const parsed = parser ? parser(raw) : Number(raw);\n if (!isNaN(parsed)) {\n updateValue(parsed);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n if (inputStr === '' || inputStr === '-') {\n updateValue(null);\n setInputStr('');\n } else {\n const parsed = parser ? parser(inputStr) : Number(inputStr);\n if (!isNaN(parsed)) {\n const clamped = clamp(parsed);\n updateValue(clamped);\n setInputStr(String(clamped));\n }\n }\n onBlur?.(e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onPressEnter?.(e);\n }\n if (!keyboard) return;\n const numStep = typeof step === 'string' ? Number(step) : step;\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n updateValue(clamp((currentValue ?? 0) + numStep));\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n updateValue(clamp((currentValue ?? 0) - numStep));\n }\n };\n\n const displayValue = formatter\n ? formatter(currentValue ?? undefined, {\n userTyping: document.activeElement === inputRef.current,\n input: inputStr,\n })\n : inputStr;\n\n const hasAddon = addonBefore || addonAfter;\n\n const sizeClasses = cn(\n size === 'large' && 'ald-input-number-large tw-h-9 tw-text-base',\n size === 'small' && 'ald-input-number-small tw-h-7 tw-text-xs',\n size !== 'large' &&\n size !== 'small' &&\n 'ald-input-number-middle tw-h-8 tw-text-sm',\n );\n\n const radiusClasses = cn(\n size === 'large' && 'tw-rounded-[8px]',\n size === 'small' && 'tw-rounded-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-[6px]',\n );\n\n const inputBox = (\n <div\n data-testid={!hasAddon ? dataTestId : undefined}\n aria-label={!hasAddon ? ariaLabel : undefined}\n className={cn(\n // 默认宽度 90px 与 antd InputNumber 对齐:input 上 size={1} 会让 intrinsic\n // 宽度坍缩到 1 字符,若 wrapper 也不给宽度,整个组件在 flex / inline 上下\n // 文里就只剩 ~9px。消费方可通过 className(`w-[xxx]`)或 style 覆盖。\n 'ald-input-number tw-inline-flex tw-w-[90px] tw-min-w-0 tw-items-center tw-overflow-hidden tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n bordered &&\n 'tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n mergedDisabled\n ? 'ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-on-subtle)] tw-text-[var(--content-secondary)]'\n : 'tw-bg-[var(--background-default)] tw-text-[var(--content-primary)] hover:tw-border-[var(--border-brand-strong)]',\n !hasAddon && sizeClasses,\n hasAddon\n ? 'tw-h-auto tw-flex-1 tw-self-stretch tw-rounded-none'\n : radiusClasses,\n status === 'error' && 'tw-border-[var(--border-negative-strong)]',\n status === 'warning' && 'tw-border-[var(--border-warning-subtle)]',\n // Focus State Layer belongs to the field envelope, while the input\n // remains the native focus owner. It intentionally does not share\n // status, hover, or disabled styling and does not affect Geometry.\n !mergedDisabled && [\n !status &&\n 'has-[input:focus]:!tw-border-[var(--border-brand-strong)]',\n 'has-[input:focus]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[input:focus]:tw-outline',\n 'forced-colors:has-[input:focus]:tw-outline-2',\n 'forced-colors:has-[input:focus]:tw-outline-offset-2',\n 'forced-colors:has-[input:focus]:tw-outline-[Highlight]',\n ],\n !hasAddon && className,\n )}\n style={!hasAddon ? style : undefined}\n >\n {prefix && (\n <span className=\"tw-px-2 tw-text-[var(--content-secondary)]\">\n {prefix}\n </span>\n )}\n <input\n ref={inputRef}\n id={id}\n type=\"text\"\n inputMode=\"numeric\"\n // size=1 让 <input> 的 intrinsic 宽度坍缩到 1 个字符,\n // 在 flex 父容器中按 width / flex-1 受控,避免默认 size=20 把 inline-flex 外层撑出 ~150px 内容宽度。\n size={1}\n className={cn(\n // Typography Foundation: editable numeric content and its placeholder\n // consume the same approved Body Dense contract as Input. Prefix and\n // add-on surfaces remain outside this Typography ownership.\n 'tw-min-w-0 tw-flex-1 tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-[7px] tw-text-inherit tw-outline-none tw-text-typography-body-dense',\n mergedDisabled &&\n 'tw-cursor-not-allowed tw-text-[var(--content-secondary)]',\n )}\n value={displayValue}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n disabled={mergedDisabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n placeholder={placeholder}\n />\n </div>\n );\n\n if (!hasAddon) return inputBox;\n\n return (\n <div\n data-testid={dataTestId}\n aria-label={ariaLabel}\n className={cn(\n // 自然宽 = 内部 inputBox 默认 90px + addonBefore/After 内容宽。inline-flex\n // 让外层按内容宽呈现,不再 `tw-w-full` 强吞 flex 父级剩余空间——后者会把\n // 同 flex 行的 Slider 挤成 0 宽(看板\"图形宽度\"行只剩 thumb 圆点的根因)。\n // `tw-min-w-0` 让本身作为 flex item 时受消费方 `flex-basis` / `width`\n // 真正约束——默认 `min-width: auto = min-content` 会被内部 input(90px) +\n // addon 撑到 ~126px,覆盖消费方的 flex-basis。内部 inputBox 已 `tw-min-w-0\n // tw-overflow-hidden`,被约束后内容会按 input flex-1 收缩,不会溢出。\n // 消费方需要撑满显式加 `tw-w-full` className,需要更窄/更宽直接覆盖宽度。\n 'ald-input-number-group tw-inline-flex tw-min-w-0 tw-items-stretch',\n sizeClasses,\n radiusClasses,\n mergedDisabled && 'ald-input-number-disabled',\n className,\n )}\n style={style}\n >\n {addonBefore && (\n <span\n className={cn(\n 'ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-r-0 tw-border-solid tw-border-[var(--border-neutral-subtle)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]',\n size === 'large' && 'tw-rounded-l-[8px]',\n size === 'small' && 'tw-rounded-l-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-l-[6px]',\n )}\n >\n {addonBefore}\n </span>\n )}\n {inputBox}\n {addonAfter && (\n <span\n className={cn(\n 'ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-l-0 tw-border-solid tw-border-[var(--border-neutral-subtle)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]',\n size === 'large' && 'tw-rounded-r-[8px]',\n size === 'small' && 'tw-rounded-r-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-r-[6px]',\n )}\n >\n {addonAfter}\n </span>\n )}\n </div>\n );\n}\n\nexport type { IInputNumberProps };\n"],"mappings":";;;;;;AAYA,SAAwB,YAAY,OAA0B;CAC5D,MAAM,EACJ,WACA,UAAU,gBACV,MAAM,YACN,QACA,OAAO,iBACP,cACA,MAAM,WACN,MAAM,UACN,OAAO,GACP,WACA,UACA,cACA,QACA,SACA,WACA,QACA,QACA,aACA,YACA,aACA,WACA,WAAW,MACX,WAAW,MACX,UAAU,UACV,OACA,IACA,eAAe,YACf,cAAc,cACZ;CAEJ,MAAM,cAAc,WAAW,YAAY;CAC3C,MAAM,OAAO,cAAc,eAAe;CAC1C,MAAM,WAAW,WAAW,gBAAgB;CAC5C,MAAM,iBAAiB,kBAAkB;CAEzC,MAAM,eAAe,WAAW;CAChC,MAAM,CAAC,YAAY,iBAAiB,SAClC,gBAAgB,KACjB;CACD,MAAM,eAAe,eAAe,kBAAkB;CAEtD,MAAM,CAAC,UAAU,eAAe,SAC9B,iBAAiB,QAAQ,iBAAiB,SACtC,OAAO,aAAa,GACpB,GACL;CACD,MAAM,WAAW,OAAyB,KAAK;AAE/C,iBAAgB;AACd,MAAI,iBAAiB,QAAQ,iBAAiB,OAC5C,aAA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BACpB,SAAS,WAAW,SAAS,WAAW,qBACzC;cAEA;IACI,CAAA;GAER;GACA,cACC,oBAAC,QAAD;IACE,WAAW,GACT,mOACA,SAAS,WAAW,sBACpB,SAAS,WAAW,sBACpB,SAAS,WAAW,SAAS,WAAW,qBACzC;cAEA;IACI,CAAA;GAEL"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/InputNumber/index.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport DisabledContext from '../ConfigProvider/DisabledContext';\nimport SizeContext from '../ConfigProvider/sizeContext';\nimport { cn } from '../lib/utils';\nimport { IInputNumberProps } from './type';\n\nfunction pickAriaProps(props: IInputNumberProps): Record<string, unknown> {\n return Object.keys(props).reduce<Record<string, unknown>>(\n (ariaProps, key) => {\n if (key.startsWith('aria-')) {\n ariaProps[key] = props[key as keyof IInputNumberProps];\n }\n return ariaProps;\n },\n {},\n );\n}\n\nexport default function InputNumber(props: IInputNumberProps) {\n const {\n className,\n disabled: customDisabled,\n size: customSize,\n status,\n value: controlledValue,\n defaultValue,\n min = -Infinity,\n max = Infinity,\n step = 1,\n precision,\n onChange,\n onPressEnter,\n onBlur,\n onFocus,\n formatter,\n parser,\n prefix,\n addonBefore,\n addonAfter,\n placeholder,\n autoFocus,\n bordered = true,\n keyboard = true,\n readonly: readOnly,\n style,\n id,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n } = props;\n\n const contentSize = useContext(SizeContext);\n const size = customSize || contentSize || 'middle';\n const disabled = useContext(DisabledContext);\n const mergedDisabled = customDisabled ?? disabled;\n const nativeInputAriaProps = pickAriaProps(props);\n\n const isControlled = 'value' in props;\n const [innerValue, setInnerValue] = useState<number | null | undefined>(\n defaultValue ?? null,\n );\n const currentValue = isControlled ? controlledValue : innerValue;\n\n const [inputStr, setInputStr] = useState(\n currentValue !== null && currentValue !== undefined\n ? String(currentValue)\n : '',\n );\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (currentValue !== null && currentValue !== undefined) {\n setInputStr(String(currentValue));\n } else {\n setInputStr('');\n }\n }, [currentValue]);\n\n const clamp = useCallback(\n (val: number) => {\n let v = Math.max(min, Math.min(max, val));\n if (precision !== undefined) {\n v = Number(v.toFixed(precision));\n }\n return v;\n },\n [min, max, precision],\n );\n\n const updateValue = useCallback(\n (newVal: number | null) => {\n const clamped = newVal !== null ? clamp(newVal) : null;\n if (!isControlled) setInnerValue(clamped);\n onChange?.(clamped);\n },\n [clamp, isControlled, onChange],\n );\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const raw = e.target.value;\n setInputStr(raw);\n if (raw === '') {\n // 清空立即同步到 value,对齐 antd 行为。\n // 否则消费方\"清空后直接点确定\"(未 blur 触发 handleBlur 的 null 兜底)拿到的\n // 仍是旧值,把已清空的筛选条件错误带进 query(被 release-2.3_test 周期实例\n // 更多浮窗实测复现)。\n updateValue(null);\n return;\n }\n if (raw === '-') return;\n const parsed = parser ? parser(raw) : Number(raw);\n if (!isNaN(parsed)) {\n updateValue(parsed);\n }\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n if (inputStr === '' || inputStr === '-') {\n updateValue(null);\n setInputStr('');\n } else {\n const parsed = parser ? parser(inputStr) : Number(inputStr);\n if (!isNaN(parsed)) {\n const clamped = clamp(parsed);\n updateValue(clamped);\n setInputStr(String(clamped));\n }\n }\n onBlur?.(e);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onPressEnter?.(e);\n }\n if (!keyboard) return;\n const numStep = typeof step === 'string' ? Number(step) : step;\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n updateValue(clamp((currentValue ?? 0) + numStep));\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n updateValue(clamp((currentValue ?? 0) - numStep));\n }\n };\n\n const displayValue = formatter\n ? formatter(currentValue ?? undefined, {\n userTyping: document.activeElement === inputRef.current,\n input: inputStr,\n })\n : inputStr;\n\n const hasAddon = addonBefore || addonAfter;\n\n const sizeClasses = cn(\n size === 'large' && 'ald-input-number-large tw-h-9 tw-text-base',\n size === 'small' && 'ald-input-number-small tw-h-7 tw-text-xs',\n size !== 'large' &&\n size !== 'small' &&\n 'ald-input-number-middle tw-h-8 tw-text-sm',\n );\n\n const radiusClasses = cn(\n size === 'large' && 'tw-rounded-[8px]',\n size === 'small' && 'tw-rounded-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-[6px]',\n );\n\n const inputBox = (\n <div\n data-testid={!hasAddon ? dataTestId : undefined}\n className={cn(\n // 默认宽度 90px 与 antd InputNumber 对齐:input 上 size={1} 会让 intrinsic\n // 宽度坍缩到 1 字符,若 wrapper 也不给宽度,整个组件在 flex / inline 上下\n // 文里就只剩 ~9px。消费方可通过 className(`w-[xxx]`)或 style 覆盖。\n 'ald-input-number tw-inline-flex tw-w-[90px] tw-min-w-0 tw-items-center tw-overflow-hidden tw-transition-[border-color,box-shadow] tw-duration-150 tw-ease-out',\n bordered &&\n 'tw-border tw-border-solid tw-border-[var(--border-neutral-subtle)]',\n mergedDisabled\n ? 'ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--background-neutral-subtle)] tw-text-[var(--content-secondary)]'\n : 'tw-bg-[var(--background-default)] tw-text-[var(--content-primary)] hover:tw-border-[var(--border-brand-strong)]',\n !hasAddon && sizeClasses,\n hasAddon\n ? 'tw-h-auto tw-flex-1 tw-self-stretch tw-rounded-none'\n : radiusClasses,\n status === 'error' && 'tw-border-[var(--border-negative-strong)]',\n status === 'warning' && 'tw-border-[var(--border-warning-subtle)]',\n // Focus State Layer belongs to the field envelope, while the input\n // remains the native focus owner. It intentionally does not share\n // status, hover, or disabled styling and does not affect Geometry.\n !mergedDisabled && [\n !status &&\n 'has-[input:focus]:!tw-border-[var(--border-brand-strong)]',\n 'has-[input:focus-visible]:tw-shadow-[inset_0_0_0_1px_var(--focus-ring)]',\n 'forced-colors:has-[input:focus-visible]:tw-outline',\n 'forced-colors:has-[input:focus-visible]:tw-outline-2',\n 'forced-colors:has-[input:focus-visible]:tw-outline-offset-2',\n 'forced-colors:has-[input:focus-visible]:tw-outline-[Highlight]',\n ],\n !hasAddon && className,\n )}\n style={!hasAddon ? style : undefined}\n >\n {prefix && (\n <span className=\"tw-px-2 tw-text-[var(--content-secondary)]\">\n {prefix}\n </span>\n )}\n <input\n {...nativeInputAriaProps}\n ref={inputRef}\n id={id}\n type=\"text\"\n inputMode=\"numeric\"\n // size=1 让 <input> 的 intrinsic 宽度坍缩到 1 个字符,\n // 在 flex 父容器中按 width / flex-1 受控,避免默认 size=20 把 inline-flex 外层撑出 ~150px 内容宽度。\n size={1}\n className={cn(\n // Typography Foundation: editable numeric content and its placeholder\n // consume the same approved Body Dense contract as Input. Prefix and\n // add-on surfaces remain outside this Typography ownership.\n 'tw-min-w-0 tw-flex-1 tw-border-0 tw-bg-[var(--action-ghost-normal)] tw-px-[7px] tw-text-inherit tw-outline-none tw-text-typography-body-dense',\n mergedDisabled &&\n 'tw-cursor-not-allowed tw-text-[var(--content-secondary)]',\n )}\n value={displayValue}\n onChange={handleChange}\n onBlur={handleBlur}\n onFocus={onFocus}\n onKeyDown={handleKeyDown}\n disabled={mergedDisabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n placeholder={placeholder}\n aria-label={ariaLabel}\n />\n </div>\n );\n\n if (!hasAddon) return inputBox;\n\n return (\n <div\n data-testid={dataTestId}\n className={cn(\n // 自然宽 = 内部 inputBox 默认 90px + addonBefore/After 内容宽。inline-flex\n // 让外层按内容宽呈现,不再 `tw-w-full` 强吞 flex 父级剩余空间——后者会把\n // 同 flex 行的 Slider 挤成 0 宽(看板\"图形宽度\"行只剩 thumb 圆点的根因)。\n // `tw-min-w-0` 让本身作为 flex item 时受消费方 `flex-basis` / `width`\n // 真正约束——默认 `min-width: auto = min-content` 会被内部 input(90px) +\n // addon 撑到 ~126px,覆盖消费方的 flex-basis。内部 inputBox 已 `tw-min-w-0\n // tw-overflow-hidden`,被约束后内容会按 input flex-1 收缩,不会溢出。\n // 消费方需要撑满显式加 `tw-w-full` className,需要更窄/更宽直接覆盖宽度。\n 'ald-input-number-group tw-inline-flex tw-min-w-0 tw-items-stretch',\n sizeClasses,\n radiusClasses,\n mergedDisabled && 'ald-input-number-disabled',\n className,\n )}\n style={style}\n >\n {addonBefore && (\n <span\n className={cn(\n 'ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-r-0 tw-border-solid tw-border-[var(--border-neutral-subtle)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]',\n size === 'large' && 'tw-rounded-l-[8px]',\n size === 'small' && 'tw-rounded-l-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-l-[6px]',\n )}\n >\n {addonBefore}\n </span>\n )}\n {inputBox}\n {addonAfter && (\n <span\n className={cn(\n 'ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-l-0 tw-border-solid tw-border-[var(--border-neutral-subtle)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]',\n size === 'large' && 'tw-rounded-r-[8px]',\n size === 'small' && 'tw-rounded-r-[4px]',\n size !== 'large' && size !== 'small' && 'tw-rounded-r-[6px]',\n )}\n >\n {addonAfter}\n </span>\n )}\n </div>\n );\n}\n\nexport type { IInputNumberProps };\n"],"mappings":";;;;;;AAYA,SAAS,cAAc,OAAmD;AACxE,QAAO,OAAO,KAAK,MAAM,CAAC,QACvB,WAAW,QAAQ;AAClB,MAAI,IAAI,WAAW,QAAQ,CACzB,WAAU,OAAO,MAAM;AAEzB,SAAO;IAET,EAAE,CACH;;AAGH,SAAwB,YAAY,OAA0B;CAC5D,MAAM,EACJ,WACA,UAAU,gBACV,MAAM,YACN,QACA,OAAO,iBACP,cACA,MAAM,WACN,MAAM,UACN,OAAO,GACP,WACA,UACA,cACA,QACA,SACA,WACA,QACA,QACA,a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,OAAO,CAAC,WAAW,QAAQ;YAhC7B,CAkCG,UACC,oBAAC,QAAD;GAAM,WAAU;aACb;GACI,CAAA,EAET,oBAAC,SAAD;GACE,GAAI;GACJ,KAAK;GACD;GACJ,MAAK;GACL,WAAU;GAGV,MAAM;GACN,WAAW,GAIT,iJACA,kBACE,2DACH;GACD,OAAO;GACP,UAAU;GACV,QAAQ;GACC;GACT,WAAW;GACX,UAAU;GACA;GACC;GACE;GACb,cAAY;GACZ,CAAA,CACE;;AAGR,KAAI,CAAC,SAAU,QAAO;AAEtB,QACE,qBAAC,OAAD;EACE,eAAa;EACb,WAAW,GAST,qEACA,aACA,eACA,kBAAkB,6BAClB,UACD;EACM;YAjBT;GAmBG,eACC,oBAAC,QAAD;IACE,WAAW,GACT,mOACA,SAAS,WAAW,sBACpB,SAAS,WAAW,sBACpB,SAAS,WAAW,SAAS,WAAW,qBACzC;cAEA;IACI,CAAA;GAER;GACA,cACC,oBAAC,QAAD;IACE,WAAW,GACT,mOACA,SAAS,WAAW,sBACpB,SAAS,WAAW,sBACpB,SAAS,WAAW,SAAS,WAAW,qBACzC;cAEA;IACI,CAAA;GAEL"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export interface IInputNumberProps {
2
+ export interface IInputNumberProps extends React.AriaAttributes {
3
3
  addonBefore?: React.ReactNode;
4
4
  addonAfter?: React.ReactNode;
5
5
  autoFocus?: boolean;
@@ -42,6 +42,6 @@ export interface IInputNumberProps {
42
42
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
43
43
  /** 透传到 InputNumber 根容器的 data-testid,用于自动化测试定位 */
44
44
  'data-testid'?: string;
45
- /** 透传到 InputNumber 根容器的 aria-label,用于可访问性与自动化测试定位 */
45
+ /** 透传到内部 input 元素的 aria-label,用于可访问性与自动化测试定位 */
46
46
  'aria-label'?: string;
47
47
  }
@@ -15,6 +15,7 @@ interface IProps<T> {
15
15
  hideBottomBtn?: {
16
16
  addRelation?: boolean;
17
17
  };
18
+ level?: number;
18
19
  }
19
- export default function LogicItem<T>({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, onDragEnd, hoverId, setHoverId, isRoot, hideBottomBtn, }: IProps<T>): import("react/jsx-runtime").JSX.Element;
20
+ export default function LogicItem<T>({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, onDragEnd, hoverId, setHoverId, isRoot, hideBottomBtn, level, }: IProps<T>): import("react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -15,7 +15,7 @@ import { DragPreviewImage, useDrag, useDrop } from "react-dnd";
15
15
  //#region src/LogicTree/components/LogicItem/index.tsx
16
16
  var dargPreviewImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAYSURBVHgB7cAxAQAAAMKg9U9tCU8oAPgYBlQAAX19SpgAAAAASUVORK5CYII=";
17
17
  var TWO = 2;
18
- function LogicItem({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, onDragEnd, hoverId, setHoverId, isRoot = false, hideBottomBtn }) {
18
+ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove, changeRelation, renderCondition, onDragEnd, hoverId, setHoverId, isRoot = false, hideBottomBtn, level = 1 }) {
19
19
  const [isHoverDragBox, setIsHoverDragBox] = useState(false);
20
20
  const [firstNodeHight, setFirstNodeHight] = useState(0);
21
21
  const [lastNodeHight, setLastNodeHight] = useState(0);
@@ -136,6 +136,10 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
136
136
  const { nodes, logicType } = value;
137
137
  const verticalLineHeight = nodes.length > 1 ? `calc(100% - ${firstNodeHight / TWO}px - ${lastNodeHight / TWO}px - 42px)` : `30px`;
138
138
  return /* @__PURE__ */ jsxs("div", {
139
+ role: "treeitem",
140
+ "aria-label": `${logicType} group`,
141
+ "aria-level": level,
142
+ "aria-expanded": nodes.length > 0,
139
143
  className: cn("ald-logic-tree-logic-node", {
140
144
  "is-hover-drag-box": isHoverDragBox,
141
145
  "is-dragging": isDragging,
@@ -157,6 +161,7 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
157
161
  if (index === 0) heightRef = firstRef;
158
162
  else if (index === nodes.length - 1) heightRef = lastRef;
159
163
  return /* @__PURE__ */ jsxs("div", {
164
+ role: "group",
160
165
  className: "ald-logic-tree-node-wrap",
161
166
  ref: heightRef,
162
167
  children: [/* @__PURE__ */ jsx("div", { className: "ald-logic-tree-horizontal-line" }), /* @__PURE__ */ jsx(LogicItem, {
@@ -169,7 +174,8 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
169
174
  changeRecordData,
170
175
  hoverId,
171
176
  setHoverId,
172
- onDragEnd
177
+ onDragEnd,
178
+ level: level + 1
173
179
  }, node.id)]
174
180
  }, node.id);
175
181
  }),
@@ -219,6 +225,7 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
219
225
  })
220
226
  }),
221
227
  /* @__PURE__ */ jsx(Select_default, {
228
+ "aria-label": `${logicType} relation`,
222
229
  options: logicOptions,
223
230
  className: cn("ald-logic-tree-select-relation", { "ald-logic-tree-select-relation-en": isEn }),
224
231
  size: "small",
@@ -237,6 +244,9 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
237
244
  connect: preview,
238
245
  src: dargPreviewImg
239
246
  }), /* @__PURE__ */ jsxs("div", {
247
+ role: "treeitem",
248
+ "aria-label": "Condition",
249
+ "aria-level": level,
240
250
  className: cn("ald-logic-tree-record-node", {
241
251
  "is-hover-drag-box": isHoverDragBox,
242
252
  "is-dragging": isDragging,
@@ -284,6 +294,7 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
284
294
  children: renderCondition(value.data, { changeData: onChangeRecordData }, value.id)
285
295
  }),
286
296
  /* @__PURE__ */ jsx(IconButton, {
297
+ "aria-label": "Remove condition",
287
298
  icon: /* @__PURE__ */ jsx(Memo$2, { size: 16 }),
288
299
  size: "small",
289
300
  onClick: onRemove