@aloudata/aloudata-design 3.0.17 → 3.0.18-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +63 -59
  2. package/dist/Alert/index.js +1 -1
  3. package/dist/Alert/index.js.map +1 -1
  4. package/dist/Avatar/component/Avatar/index.js +2 -2
  5. package/dist/Avatar/component/Avatar/index.js.map +1 -1
  6. package/dist/Avatar/component/Avatar/type.js +3 -3
  7. package/dist/Avatar/component/Avatar/type.js.map +1 -1
  8. package/dist/Badge/index.js +5 -5
  9. package/dist/Badge/index.js.map +1 -1
  10. package/dist/Breadcrumb/index.js +4 -4
  11. package/dist/Breadcrumb/index.js.map +1 -1
  12. package/dist/Button/index.js +8 -8
  13. package/dist/Button/index.js.map +1 -1
  14. package/dist/Card/index.js +1 -1
  15. package/dist/Card/index.js.map +1 -1
  16. package/dist/Checkbox/index.js +3 -3
  17. package/dist/Checkbox/index.js.map +1 -1
  18. package/dist/Collapse/index.js +1 -1
  19. package/dist/Collapse/index.js.map +1 -1
  20. package/dist/ColorPicker/ComplexColorPicker/ColorAlphaInput.js +1 -1
  21. package/dist/ColorPicker/ComplexColorPicker/ColorAlphaInput.js.map +1 -1
  22. package/dist/ColorPicker/ComplexColorPicker/ColorHsbInput.js +1 -1
  23. package/dist/ColorPicker/ComplexColorPicker/ColorHsbInput.js.map +1 -1
  24. package/dist/ColorPicker/ComplexColorPicker/ColorRgbInput.js +1 -1
  25. package/dist/ColorPicker/ComplexColorPicker/ColorRgbInput.js.map +1 -1
  26. package/dist/ColorPicker/ComplexColorPicker/index.js +2 -2
  27. package/dist/ColorPicker/ComplexColorPicker/index.js.map +1 -1
  28. package/dist/ColorPicker/index.js +11 -11
  29. package/dist/ColorPicker/index.js.map +1 -1
  30. package/dist/ColorPicker/util.d.ts +1 -1
  31. package/dist/ColorPicker/util.js.map +1 -1
  32. package/dist/DataPreviewTable/components/Body/Cell.js +2 -2
  33. package/dist/DataPreviewTable/components/Body/Cell.js.map +1 -1
  34. package/dist/DataPreviewTable/components/Body/index.js +1 -1
  35. package/dist/DataPreviewTable/components/Body/index.js.map +1 -1
  36. package/dist/DataPreviewTable/components/DragBar/index.js +1 -1
  37. package/dist/DataPreviewTable/components/DragBar/index.js.map +1 -1
  38. package/dist/DataPreviewTable/components/Header/index.js +3 -3
  39. package/dist/DataPreviewTable/components/Header/index.js.map +1 -1
  40. package/dist/DataPreviewTable/index.js +1 -1
  41. package/dist/DataPreviewTable/index.js.map +1 -1
  42. package/dist/Divider/index.js +1 -1
  43. package/dist/Divider/index.js.map +1 -1
  44. package/dist/Drawer/index.js +3 -3
  45. package/dist/Drawer/index.js.map +1 -1
  46. package/dist/Empty/image/Data.js +16 -16
  47. package/dist/Empty/image/Data.js.map +1 -1
  48. package/dist/Empty/image/User.js +16 -16
  49. package/dist/Empty/image/User.js.map +1 -1
  50. package/dist/Empty/image/WorkBook.js +17 -17
  51. package/dist/Empty/image/WorkBook.js.map +1 -1
  52. package/dist/Form/index.js +3 -3
  53. package/dist/Form/index.js.map +1 -1
  54. package/dist/Icon/components/SortAscendingOrderColor.js +1 -1
  55. package/dist/Icon/components/SortAscendingOrderColor.js.map +1 -1
  56. package/dist/Icon/components/SortDescendingOrderColor.js +1 -1
  57. package/dist/Icon/components/SortDescendingOrderColor.js.map +1 -1
  58. package/dist/Icon/components/User.js +2 -2
  59. package/dist/Icon/components/User.js.map +1 -1
  60. package/dist/Icon/components/UserGroup.js +2 -2
  61. package/dist/Icon/components/UserGroup.js.map +1 -1
  62. package/dist/Input/components/Input/index.js +3 -3
  63. package/dist/Input/components/Input/index.js.map +1 -1
  64. package/dist/Input/components/TextArea/index.js +3 -3
  65. package/dist/Input/components/TextArea/index.js.map +1 -1
  66. package/dist/InputNumber/index.js +4 -4
  67. package/dist/InputNumber/index.js.map +1 -1
  68. package/dist/LogicTree/components/LogicItem/index.js +2 -2
  69. package/dist/LogicTree/components/LogicItem/index.js.map +1 -1
  70. package/dist/MemberPicker/components/SelectedMemberTags.js +1 -1
  71. package/dist/MemberPicker/components/SelectedMemberTags.js.map +1 -1
  72. package/dist/Modal/index.js +8 -8
  73. package/dist/Modal/index.js.map +1 -1
  74. package/dist/Popconfirm/index.js +1 -1
  75. package/dist/Popconfirm/index.js.map +1 -1
  76. package/dist/Popover/index.js +2 -2
  77. package/dist/Popover/index.js.map +1 -1
  78. package/dist/Progress/index.js +1 -1
  79. package/dist/Progress/index.js.map +1 -1
  80. package/dist/RenameInput/index.js +4 -4
  81. package/dist/RenameInput/index.js.map +1 -1
  82. package/dist/Result/index.js +4 -4
  83. package/dist/Result/index.js.map +1 -1
  84. package/dist/Select/components/Suffix.js +3 -3
  85. package/dist/Select/components/Suffix.js.map +1 -1
  86. package/dist/Slider/index.js +4 -4
  87. package/dist/Slider/index.js.map +1 -1
  88. package/dist/Spin/CustomIcon/index.js +2 -2
  89. package/dist/Spin/CustomIcon/index.js.map +1 -1
  90. package/dist/StatusLight/index.js +15 -15
  91. package/dist/StatusLight/index.js.map +1 -1
  92. package/dist/Steps/components/CustomDot/index.js +9 -2
  93. package/dist/Steps/components/CustomDot/index.js.map +1 -0
  94. package/dist/Steps/components/ProcessIcon/index.d.ts +2 -1
  95. package/dist/Steps/components/ProcessIcon/index.js +33 -12
  96. package/dist/Steps/components/ProcessIcon/index.js.map +1 -1
  97. package/dist/Steps/index.js +67 -49
  98. package/dist/Steps/index.js.map +1 -1
  99. package/dist/Switch/index.js +3 -3
  100. package/dist/Switch/index.js.map +1 -1
  101. package/dist/Table/components/Header.js +3 -3
  102. package/dist/Table/components/Header.js.map +1 -1
  103. package/dist/Tabs/index.js +9 -9
  104. package/dist/Tabs/index.js.map +1 -1
  105. package/dist/Tag/index.js +11 -11
  106. package/dist/Tag/index.js.map +1 -1
  107. package/dist/TextLink/index.js +2 -2
  108. package/dist/TextLink/index.js.map +1 -1
  109. package/dist/Tooltip/index.js +3 -3
  110. package/dist/Tooltip/index.js.map +1 -1
  111. package/dist/Tour/index.js +1 -1
  112. package/dist/Tour/index.js.map +1 -1
  113. package/dist/Tree/Tree2.js +2 -2
  114. package/dist/Tree/Tree2.js.map +1 -1
  115. package/dist/Typography/index.js +1 -1
  116. package/dist/Typography/index.js.map +1 -1
  117. package/dist/User/index.js +1 -1
  118. package/dist/User/index.js.map +1 -1
  119. package/dist/Watermark/index.js +2 -1
  120. package/dist/Watermark/index.js.map +1 -1
  121. package/dist/aloudata-design.css +1 -1
  122. package/dist/index.d.ts +2 -2
  123. package/dist/index.js +11 -5
  124. package/dist/message/index.js +1 -1
  125. package/dist/message/index.js.map +1 -1
  126. package/dist/notification/index.js +5 -5
  127. package/dist/notification/index.js.map +1 -1
  128. package/dist/theme/contract/shadowGeneratorSpecification.d.ts +37 -0
  129. package/dist/theme/contract/tokenCssBridge.d.ts +60 -0
  130. package/dist/theme/contract/tokenCssBridge.js +2 -0
  131. package/dist/theme/contract/tokenOutputContract.d.ts +35 -0
  132. package/dist/theme/contract/tokenOutputContract.js +198 -0
  133. package/dist/theme/contract/tokenOutputContract.js.map +1 -0
  134. package/dist/theme/generator/acceptedColorValues.d.ts +97 -0
  135. package/dist/theme/generator/acceptedColorValues.js +2 -0
  136. package/dist/theme/generator/cssArtifactEmitter.d.ts +62 -0
  137. package/dist/theme/generator/cssArtifactEmitter.js +2 -0
  138. package/dist/theme/generator/generator.d.ts +41 -0
  139. package/dist/theme/generator/generator.js +2 -0
  140. package/dist/theme/generator/generatorDiff.d.ts +53 -0
  141. package/dist/theme/generator/generatorDiff.js +2 -0
  142. package/dist/theme/generator/generatorEmitter.d.ts +73 -0
  143. package/dist/theme/generator/generatorEmitter.js +2 -0
  144. package/dist/theme/generator/generatorMappingStrategy.d.ts +43 -0
  145. package/dist/theme/generator/generatorMappingStrategy.js +2 -0
  146. package/dist/theme/generator/generatorOutputSchema.d.ts +80 -0
  147. package/dist/theme/generator/generatorOutputSchema.js +2 -0
  148. package/dist/theme/generator/minimalAcceptedColorValues.d.ts +27 -0
  149. package/dist/theme/generator/minimalAcceptedColorValues.js +2 -0
  150. package/dist/theme/generator/valueResolver.d.ts +64 -0
  151. package/dist/theme/generator/valueResolver.js +2 -0
  152. package/dist/theme/governance/migrationMappingRegistry.d.ts +22 -0
  153. package/dist/theme/governance/migrationMappingRegistry.js +459 -0
  154. package/dist/theme/governance/migrationMappingRegistry.js.map +1 -0
  155. package/dist/theme/governance/reviewGate.d.ts +33 -0
  156. package/dist/theme/governance/reviewGate.js +116 -0
  157. package/dist/theme/governance/reviewGate.js.map +1 -0
  158. package/dist/theme/governance/validateMigrationMapping.d.ts +50 -0
  159. package/dist/theme/governance/validateMigrationMapping.js +157 -0
  160. package/dist/theme/governance/validateMigrationMapping.js.map +1 -0
  161. package/dist/theme/index.d.ts +16 -5
  162. package/dist/theme/index.js +10 -4
  163. package/dist/theme/runtime/colorValueMode/index.d.ts +5 -0
  164. package/dist/theme/runtime/colorValueMode/index.js +49 -0
  165. package/dist/theme/runtime/colorValueMode/index.js.map +1 -0
  166. package/dist/theme/runtime/colorValueMode/registry.d.ts +29 -0
  167. package/dist/theme/runtime/colorValueMode/registry.js +39 -0
  168. package/dist/theme/runtime/colorValueMode/registry.js.map +1 -0
  169. package/dist/theme/runtime/colorValueMode/v3.d.ts +98 -0
  170. package/dist/theme/runtime/colorValueMode/v3.js +230 -0
  171. package/dist/theme/runtime/colorValueMode/v3.js.map +1 -0
  172. package/dist/theme/runtime/colorValueMode.d.ts +2 -0
  173. package/dist/theme/{createTheme.js → runtime/createTheme.js} +1 -1
  174. package/dist/theme/runtime/createTheme.js.map +1 -0
  175. package/dist/theme/{defaultTheme.js → runtime/defaultTheme.js} +1 -1
  176. package/dist/theme/runtime/defaultTheme.js.map +1 -0
  177. package/dist/theme/{initAldTheme.js → runtime/initAldTheme.js} +1 -1
  178. package/dist/theme/runtime/initAldTheme.js.map +1 -0
  179. package/dist/theme/runtime/integrationController.d.ts +26 -0
  180. package/dist/theme/runtime/integrationController.js +2 -0
  181. package/dist/theme/runtime/runtimeAdapter.d.ts +31 -0
  182. package/dist/theme/runtime/runtimeAdapter.js +2 -0
  183. package/dist/theme/{themeToCssVars.js → runtime/themeToCssVars.js} +1 -1
  184. package/dist/theme/runtime/themeToCssVars.js.map +1 -0
  185. package/dist/theme/{tokenMap.js → runtime/tokenMap.js} +1 -1
  186. package/dist/theme/runtime/tokenMap.js.map +1 -0
  187. package/dist/theme/runtime/types.js +2 -0
  188. package/package.json +1 -1
  189. package/dist/theme/createTheme.js.map +0 -1
  190. package/dist/theme/defaultTheme.js.map +0 -1
  191. package/dist/theme/initAldTheme.js.map +0 -1
  192. package/dist/theme/themeToCssVars.js.map +0 -1
  193. package/dist/theme/tokenMap.js.map +0 -1
  194. /package/dist/theme/{types.js → contract/shadowGeneratorSpecification.js} +0 -0
  195. /package/dist/theme/{createTheme.d.ts → runtime/createTheme.d.ts} +0 -0
  196. /package/dist/theme/{defaultTheme.d.ts → runtime/defaultTheme.d.ts} +0 -0
  197. /package/dist/theme/{initAldTheme.d.ts → runtime/initAldTheme.d.ts} +0 -0
  198. /package/dist/theme/{themeToCssVars.d.ts → runtime/themeToCssVars.d.ts} +0 -0
  199. /package/dist/theme/{tokenMap.d.ts → runtime/tokenMap.d.ts} +0 -0
  200. /package/dist/theme/{types.d.ts → runtime/types.d.ts} +0 -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',\n `ald-input-textarea-${getSizeType(size)}`,\n isBordered &&\n 'tw-rounded-r-75 tw-border tw-border-solid tw-border-[var(--border-default)]',\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-transparent tw-px-3 tw-py-2 tw-text-sm tw-text-[var(--content-primary)] tw-outline-none\"\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(--alias-colors-icon-subtle)\" />\n </span>\n )}\n {showCount && (\n <div className=\"tw-px-2 tw-pb-1 tw-text-right tw-text-xs tw-text-[var(--content-tertiary)]\">\n {typeof showCount === 'object'\n ? showCount.formatter({ count: currentValue.length, maxLength })\n : `${currentValue.length}${maxLength ? `/${maxLength}` : ''}`}\n </div>\n )}\n </div>\n );\n});\n"],"mapp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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;KAAoC,CAAA;IAChE,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';\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',\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 && '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-sm tw-text-[var(--content-primary)] tw-outline-none\"\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-xs tw-text-[var(--content-tertiary)]\">\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,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,SAAS,YAAY,IAAI,cAAc;IACvD,CAAA;GAEJ;;EAER"}
@@ -84,7 +84,7 @@ function InputNumber(props) {
84
84
  const inputBox = /* @__PURE__ */ jsxs("div", {
85
85
  "data-testid": !hasAddon ? dataTestId : void 0,
86
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", bordered && "tw-border tw-border-solid tw-border-[var(--interaction-border-neutral-normal)]", mergedDisabled ? "ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--global-cool-gray-alpha-50)] tw-text-[var(--content-secondary)]" : "tw-bg-[var(--interaction-background-form-field)] tw-text-[var(--content-primary)] hover:tw-border-[var(--interaction-border-hover)]", !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)]", "focus-within:tw-border-[var(--interaction-border-hover)] focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-[var(--global-blue-500)]", !hasAddon && className),
87
+ className: cn("ald-input-number tw-inline-flex tw-w-[90px] tw-min-w-0 tw-items-center tw-overflow-hidden", 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)]", "focus-within:tw-border-[var(--border-brand-strong)] focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-[var(--border-brand-strong)]", !hasAddon && className),
88
88
  style: !hasAddon ? style : void 0,
89
89
  children: [prefix && /* @__PURE__ */ jsx("span", {
90
90
  className: "tw-px-2 tw-text-[var(--content-secondary)]",
@@ -95,7 +95,7 @@ function InputNumber(props) {
95
95
  type: "text",
96
96
  inputMode: "numeric",
97
97
  size: 1,
98
- className: cn("tw-min-w-0 tw-flex-1 tw-border-0 tw-bg-transparent tw-px-[7px] tw-text-inherit tw-outline-none", mergedDisabled && "tw-cursor-not-allowed tw-text-[var(--content-secondary)]"),
98
+ className: cn("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", mergedDisabled && "tw-cursor-not-allowed tw-text-[var(--content-secondary)]"),
99
99
  value: displayValue,
100
100
  onChange: handleChange,
101
101
  onBlur: handleBlur,
@@ -115,12 +115,12 @@ function InputNumber(props) {
115
115
  style,
116
116
  children: [
117
117
  addonBefore && /* @__PURE__ */ jsx("span", {
118
- className: cn("ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-r-0 tw-border-solid tw-border-[var(--interaction-border-neutral-normal)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]", size === "large" && "tw-rounded-l-[8px]", size === "small" && "tw-rounded-l-[4px]", size !== "large" && size !== "small" && "tw-rounded-l-[6px]"),
118
+ className: cn("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)]", size === "large" && "tw-rounded-l-[8px]", size === "small" && "tw-rounded-l-[4px]", size !== "large" && size !== "small" && "tw-rounded-l-[6px]"),
119
119
  children: addonBefore
120
120
  }),
121
121
  inputBox,
122
122
  addonAfter && /* @__PURE__ */ jsx("span", {
123
- className: cn("ald-input-number-addon tw-flex tw-shrink-0 tw-items-center tw-border tw-border-l-0 tw-border-solid tw-border-[var(--interaction-border-neutral-normal)] tw-bg-[var(--background-neutral-subtle)] tw-px-3 tw-text-[var(--content-secondary)]", size === "large" && "tw-rounded-r-[8px]", size === "small" && "tw-rounded-r-[4px]", size !== "large" && size !== "small" && "tw-rounded-r-[6px]"),
123
+ className: cn("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)]", size === "large" && "tw-rounded-r-[8px]", size === "small" && "tw-rounded-r-[4px]", size !== "large" && size !== "small" && "tw-rounded-r-[6px]"),
124
124
  children: addonAfter
125
125
  })
126
126
  ]
@@ -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',\n bordered &&\n 'tw-border tw-border-solid tw-border-[var(--interaction-border-neutral-normal)]',\n mergedDisabled\n ? 'ald-input-number-disabled tw-cursor-not-allowed tw-bg-[var(--global-cool-gray-alpha-50)] tw-text-[var(--content-secondary)]'\n : 'tw-bg-[var(--interaction-background-form-field)] tw-text-[var(--content-primary)] hover:tw-border-[var(--interaction-border-hover)]',\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-within:tw-border-[var(--interaction-border-hover)] focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-[var(--global-blue-500)]',\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 'tw-min-w-0 tw-flex-1 tw-border-0 tw-bg-transparent tw-px-[7px] tw-text-inherit tw-outline-none',\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(--interaction-border-neutral-normal)] 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(--interaction-border-neutral-normal)] 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,aAAY,OAAO,aAAa,CAAC;MAEj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WAAW,GACT,+OACA,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\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',\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-within:tw-border-[var(--border-brand-strong)] focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-[var(--border-brand-strong)]',\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 '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',\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,aAAY,OAAO,aAAa,CAAC;MAEjC,aAAY,GAAG;IAEhB,CAAC,aAAa,CAAC;CAElB,MAAM,QAAQ,aACX,QAAgB;EACf,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AACzC,MAAI,cAAc,OAChB,KAAI,OAAO,EAAE,QAAQ,UAAU,CAAC;AAElC,SAAO;IAET;EAAC;EAAK;EAAK;EAAU,CACtB;CAED,MAAM,cAAc,aACjB,WAA0B;EACzB,MAAM,UAAU,WAAW,OAAO,MAAM,OAA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M,gBAAgB,GACpB,SAAS,WAAW,oBACpB,SAAS,WAAW,oBACpB,SAAS,WAAW,SAAS,WAAW,mBACzC;CAED,MAAM,WACJ,qBAAC,OAAD;EACE,eAAa,CAAC,WAAW,aAAa;EACtC,cAAY,CAAC,WAAW,YAAY;EACpC,WAAW,GAIT,6FACA,YACE,sEACF,iBACI,mIACA,mHACJ,CAAC,YAAY,aACb,WACI,wDACA,eACJ,WAAW,WAAW,6CACtB,WAAW,aAAa,4CACxB,8JACA,CAAC,YAAY,UACd;EACD,OAAO,CAAC,WAAW,QAAQ;YAtB7B,CAwBG,UACC,oBAAC,QAAD;GAAM,WAAU;aACb;GACI,CAAA,EAET,oBAAC,SAAD;GACE,KAAK;GACD;GACJ,MAAK;GACL,WAAU;GAGV,MAAM;GACN,WAAW,GACT,mHACA,kBACE,2DACH;GACD,OAAO;GACP,UAAU;GACV,QAAQ;GACC;GACT,WAAW;GACX,UAAU;GACA;GACC;GACE;GACb,CAAA,CACE;;AAGR,KAAI,CAAC,SAAU,QAAO;AAEtB,QACE,qBAAC,OAAD;EACE,eAAa;EACb,cAAY;EACZ,WAAW,GAST,qEACA,aACA,eACA,kBAAkB,6BAClB,UACD;EACM;YAlBT;GAoBG,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"}
@@ -214,7 +214,7 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
214
214
  setHoverId(value.id);
215
215
  },
216
216
  size: 16,
217
- color: "#374151",
217
+ color: "var(--content-secondary)",
218
218
  className: "ald-logic-tree-node-drag-icon"
219
219
  })
220
220
  }),
@@ -275,7 +275,7 @@ function LogicItem({ value, addCondition, addRelation, changeRecordData, remove,
275
275
  setHoverId(value.id);
276
276
  },
277
277
  size: 16,
278
- color: "#374151",
278
+ color: "var(--content-secondary)",
279
279
  className: "ald-logic-tree-record-node-drag-icon"
280
280
  })
281
281
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/LogicTree/components/LogicItem/index.tsx"],"sourcesContent":["import { cn } from '../../../lib/utils';\nimport _ from 'lodash';\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { DragPreviewImage, useDrag, useDrop } from 'react-dnd';\nimport { EPutPosition, TRenderCondition } from '../..';\nimport DragLightLine from '../../../Icon/components/DragLightLine';\nimport PlusIcon from '../../../Icon/components/SignLightLine';\nimport TrashLightLine from '../../../Icon/components/TrashLightLine';\nimport IconButton from '../../../IconButton';\nimport Select from '../../../Select';\nimport TextLink from '../../../TextLink';\nimport {\n ELangType,\n LocaleContext,\n getTranslator,\n} from '../../../locale/default';\nimport { ELogicType, ENodeType, TNode } from '../../type';\n\nconst dargPreviewImg =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAYSURBVHgB7cAxAQAAAMKg9U9tCU8oAPgYBlQAAX19SpgAAAAASUVORK5CYII=';\n\ninterface IProps<T> {\n value: TNode<T>;\n addCondition: (id: string) => void;\n addRelation: (id: string) => void;\n remove: (id: string) => void;\n changeRecordData: (id: string, data: T) => void;\n changeRelation: (id: string, logicType: ELogicType) => void;\n renderCondition: TRenderCondition<T>;\n onDragEnd: (\n dragId: string,\n hoverId: string,\n dropPosition: EPutPosition,\n ) => void;\n hoverId: string;\n setHoverId: (id: string) => void;\n isRoot?: boolean;\n hideBottomBtn?: {\n addRelation?: boolean;\n };\n}\n\nconst TWO = 2;\n\nexport default function LogicItem<T>({\n value,\n addCondition,\n addRelation,\n changeRecordData,\n remove,\n changeRelation,\n renderCondition,\n onDragEnd,\n hoverId,\n setHoverId,\n isRoot = false,\n hideBottomBtn,\n}: IProps<T>) {\n const [isHoverDragBox, setIsHoverDragBox] = useState(false);\n const [firstNodeHight, setFirstNodeHight] = useState(0);\n const [lastNodeHight, setLastNodeHight] = useState(0);\n const [dropPosition, setDropPosition] = useState<EPutPosition>();\n\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n\n const logicOptions = [\n {\n value: ELogicType.AND,\n label: t.LogicTree.select.and,\n },\n {\n value: ELogicType.OR,\n label: t.LogicTree.select.or,\n },\n ];\n\n const { type } = value;\n\n const ref = useRef<HTMLDivElement>(null);\n const firstResizeObserverRef = useRef<ResizeObserver | null>(null);\n const lastResizeObserverRef = useRef<ResizeObserver | null>(null);\n\n const [{ isDragging }, drag, preview] = useDrag({\n type: 'LOGIC_ITEM',\n item: { id: value.id },\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n }),\n canDrag: !isRoot && isHoverDragBox,\n });\n\n const [{ isOver, canDrop }, drop] = useDrop({\n accept: 'LOGIC_ITEM',\n hover(item: { id: string }, monitor) {\n if (!ref.current) {\n return;\n }\n const dragId = item.id;\n const hoverId = value.id;\n\n if (dragId === hoverId) {\n return;\n }\n // 检查是否为最顶层的放置目标\n if (monitor.didDrop()) {\n return;\n }\n\n // 获取鼠标位置和目标元素位置\n const hoverBoundingRect = ref.current.getBoundingClientRect();\n const hoverMiddleY =\n (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (clientOffset) {\n const hoverClientY = clientOffset.y - hoverBoundingRect.top;\n\n const dropPosition =\n hoverClientY < hoverMiddleY ? EPutPosition.TOP : EPutPosition.BOTTOM;\n\n setDropPosition(dropPosition);\n } else setDropPosition(undefined);\n },\n drop(item: { id: string }, monitor) {\n if (!ref.current) {\n return;\n }\n const dragId = item.id;\n const hoverId = value.id;\n\n if (dragId === hoverId) {\n return;\n }\n // 检查是否为最顶层的放置目标\n if (monitor.didDrop()) {\n return;\n }\n\n // 获取鼠标位置和目标元素位置\n const hoverBoundingRect = ref.current.getBoundingClientRect();\n const hoverMiddleY =\n (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (clientOffset) {\n const hoverClientY = clientOffset.y - hoverBoundingRect.top;\n\n // 确定放置位置\n const dropPosition =\n hoverClientY < hoverMiddleY ? EPutPosition.TOP : EPutPosition.BOTTOM;\n\n onDragEnd(dragId, hoverId, dropPosition);\n }\n },\n collect: (monitor) => ({\n isOver: monitor.isOver({ shallow: true }),\n canDrop: monitor.canDrop(),\n }),\n });\n\n drag(drop(ref));\n\n const isDragOver = isOver && canDrop && !isRoot;\n\n const firstRef = useCallback((node: HTMLElement | null) => {\n if (firstResizeObserverRef.current) {\n firstResizeObserverRef.current.disconnect();\n firstResizeObserverRef.current = null;\n }\n\n if (!node) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setFirstNodeHight(newHeight);\n }\n }\n });\n resizeObserver.observe(node);\n firstResizeObserverRef.current = resizeObserver;\n }, []);\n\n const lastRef = useCallback((node: HTMLElement | null) => {\n if (lastResizeObserverRef.current) {\n lastResizeObserverRef.current.disconnect();\n lastResizeObserverRef.current = null;\n }\n\n if (!node) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setLastNodeHight(newHeight);\n }\n }\n });\n resizeObserver.observe(node);\n lastResizeObserverRef.current = resizeObserver;\n }, []);\n\n const onAddCondition = () => {\n const { id } = value;\n addCondition(id);\n };\n\n const onAddRelation = () => {\n const { id } = value;\n addRelation(id);\n };\n\n const onRemove = () => {\n const { id } = value;\n remove(id);\n };\n\n const onChangeRelation = (logicType: ELogicType) => {\n const { id } = value;\n changeRelation(id, logicType);\n };\n\n const onChangeRecordData = (data: T) => {\n const { id } = value;\n changeRecordData(id, data);\n };\n\n useEffect(() => {\n return () => {\n if (firstResizeObserverRef.current) {\n firstResizeObserverRef.current.disconnect();\n firstResizeObserverRef.current = null;\n }\n if (lastResizeObserverRef.current) {\n lastResizeObserverRef.current.disconnect();\n lastResizeObserverRef.current = null;\n }\n };\n }, []);\n\n const isEn = locale === ELangType.EN;\n\n if (type === ENodeType.LOGIC) {\n const { nodes, logicType } = value;\n const verticalLineHeight =\n nodes.length > 1\n ? `calc(100% - ${firstNodeHight / TWO}px - ${\n lastNodeHight / TWO\n }px - 42px)`\n : `30px`;\n\n return (\n <div\n className={cn('ald-logic-tree-logic-node', {\n 'is-hover-drag-box': isHoverDragBox,\n 'is-dragging': isDragging,\n 'is-hover-top': isDragOver && dropPosition === EPutPosition.TOP,\n 'is-hover-bottom': isDragOver && dropPosition === EPutPosition.BOTTOM,\n })}\n onMouseMove={(e) => {\n e.stopPropagation();\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setHoverId('');\n }}\n ref={ref}\n >\n {_.map(nodes, (node, index) => {\n let heightRef = null;\n if (index === 0) {\n heightRef = firstRef;\n } else if (index === nodes.length - 1) {\n heightRef = lastRef;\n }\n\n return (\n <div\n className=\"ald-logic-tree-node-wrap\"\n key={node.id}\n ref={heightRef}\n >\n <div className=\"ald-logic-tree-horizontal-line\" />\n <LogicItem\n key={node.id}\n value={node}\n addCondition={addCondition}\n addRelation={addRelation}\n remove={remove}\n changeRelation={changeRelation}\n renderCondition={renderCondition}\n changeRecordData={changeRecordData}\n hoverId={hoverId}\n setHoverId={setHoverId}\n onDragEnd={onDragEnd}\n />\n </div>\n );\n })}\n <div className=\"ald-logic-tree-operation\">\n <div className=\"ald-logic-tree-left-bottom-dash-line\" />\n <TextLink icon={<PlusIcon size={24} />} onClick={onAddCondition}>\n {t.LogicTree.btn.addCondition}\n </TextLink>\n {!hideBottomBtn?.addRelation && (\n <TextLink icon={<PlusIcon size={24} />} onClick={onAddRelation}>\n {t.LogicTree.btn.addRelation}\n </TextLink>\n )}\n </div>\n {!!_.size(nodes) && (\n <div\n className=\"ald-logic-tree-logic-vertical-line\"\n style={{\n height: verticalLineHeight,\n top: `${firstNodeHight / TWO + 4}px`,\n }}\n />\n )}\n {!isRoot && (hoverId === value.id || isDragging) && (\n <div\n className=\"ald-logic-tree-node-drag-icon-wrapper\"\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(false);\n }}\n >\n <DragLightLine\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n size={16}\n color=\"#374151\"\n className=\"ald-logic-tree-node-drag-icon\"\n />\n </div>\n )}\n\n <Select\n options={logicOptions}\n className={cn('ald-logic-tree-select-relation', {\n 'ald-logic-tree-select-relation-en': isEn,\n })}\n size=\"small\"\n popupMatchSelectWidth={false}\n value={logicType}\n onChange={onChangeRelation}\n />\n <DragPreviewImage connect={preview} src={dargPreviewImg} />\n </div>\n );\n }\n\n return (\n <>\n <DragPreviewImage connect={preview} src={dargPreviewImg} />\n <div\n className={cn('ald-logic-tree-record-node', {\n 'is-hover-drag-box': isHoverDragBox,\n 'is-dragging': isDragging,\n 'is-hover-top': isDragOver && dropPosition === EPutPosition.TOP,\n 'is-hover-bottom': isDragOver && dropPosition === EPutPosition.BOTTOM,\n })}\n ref={ref}\n onMouseMove={(e) => {\n e.stopPropagation();\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setHoverId('');\n }}\n >\n <div\n className=\"ald-logic-tree-node-drag-icon-preview\"\n ref={preview}\n ></div>\n {(hoverId === value.id || isDragging) && (\n <div\n className=\"ald-logic-tree-record-node-drag-icon-wrapper\"\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(false);\n }}\n >\n <DragLightLine\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n size={16}\n color=\"#374151\"\n className=\"ald-logic-tree-record-node-drag-icon\"\n />\n </div>\n )}\n\n <div className=\"ald-logic-tree-render-condition-wrap\">\n {renderCondition(\n value.data,\n { changeData: onChangeRecordData },\n value.id,\n )}\n </div>\n <IconButton\n icon={<TrashLightLine size={16} />}\n size={'small'}\n onClick={onRemove}\n />\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAM,iBACJ;AAuBF,IAAM,MAAM;AAEZ,SAAwB,UAAa,EACnC,OACA,cACA,aACA,kBACA,QACA,gBACA,iBACA,WACA,SACA,YACA,SAAS,OACT,iBACY;CACZ,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,MAAM;CAC3D,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,EAAE;CACvD,MAAM,CAAC,eAAe,oBAAoB,SAAS,EAAE;CACrD,MAAM,CAAC,cAAc,mBAAmB,UAAwB;CAEhE,MAAM,EAAE,WAAW,WAAW,cAAc;CAC5C,MAAM,IAAI,cAAc,OAAO;CAE/B,MAAM,eAAe,CACnB;EACE,OAAO,WAAW;EAClB,OAAO,EAAE,UAAU,OAAO;EAC3B,EACD;EACE,OAAO,WAAW;EAClB,OAAO,EAAE,UAAU,OAAO;EAC3B,CACF;CAED,MAAM,EAAE,SAAS;CAEjB,MAAM,MAAM,OAAuB,KAAK;CACxC,MAAM,yBAAyB,OAA8B,KAAK;CAClE,MAAM,wBAAwB,OAA8B,KAAK;CAEjE,MAAM,CAAC,EAAE,cAAc,MAAM,WAAW,QAAQ;EAC9C,MAAM;EACN,MAAM,EAAE,IAAI,MAAM,IAAI;EACtB,UAAU,aAAa,EACrB,YAAY,QAAQ,YAAY,EACjC;EACD,SAAS,CAAC,UAAU;EACrB,CAAC;CAEF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BACC,MAAM,MACN,EAAE,YAAY,oBAAoB,EAClC,MAAM,GACP;IACG,CAAA;GACN,oBAAC,YAAD;IACE,MAAM,oBAAC,QAAD,EAAgB,MAAM,IAAM,CAAA;IAClC,MAAM;IACN,SAAS;IACT,CAAA;GACE;IACL,EAAA,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/LogicTree/components/LogicItem/index.tsx"],"sourcesContent":["import { cn } from '../../../lib/utils';\nimport _ from 'lodash';\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { DragPreviewImage, useDrag, useDrop } from 'react-dnd';\nimport { EPutPosition, TRenderCondition } from '../..';\nimport DragLightLine from '../../../Icon/components/DragLightLine';\nimport PlusIcon from '../../../Icon/components/SignLightLine';\nimport TrashLightLine from '../../../Icon/components/TrashLightLine';\nimport IconButton from '../../../IconButton';\nimport Select from '../../../Select';\nimport TextLink from '../../../TextLink';\nimport {\n ELangType,\n LocaleContext,\n getTranslator,\n} from '../../../locale/default';\nimport { ELogicType, ENodeType, TNode } from '../../type';\n\nconst dargPreviewImg =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAYSURBVHgB7cAxAQAAAMKg9U9tCU8oAPgYBlQAAX19SpgAAAAASUVORK5CYII=';\n\ninterface IProps<T> {\n value: TNode<T>;\n addCondition: (id: string) => void;\n addRelation: (id: string) => void;\n remove: (id: string) => void;\n changeRecordData: (id: string, data: T) => void;\n changeRelation: (id: string, logicType: ELogicType) => void;\n renderCondition: TRenderCondition<T>;\n onDragEnd: (\n dragId: string,\n hoverId: string,\n dropPosition: EPutPosition,\n ) => void;\n hoverId: string;\n setHoverId: (id: string) => void;\n isRoot?: boolean;\n hideBottomBtn?: {\n addRelation?: boolean;\n };\n}\n\nconst TWO = 2;\n\nexport default function LogicItem<T>({\n value,\n addCondition,\n addRelation,\n changeRecordData,\n remove,\n changeRelation,\n renderCondition,\n onDragEnd,\n hoverId,\n setHoverId,\n isRoot = false,\n hideBottomBtn,\n}: IProps<T>) {\n const [isHoverDragBox, setIsHoverDragBox] = useState(false);\n const [firstNodeHight, setFirstNodeHight] = useState(0);\n const [lastNodeHight, setLastNodeHight] = useState(0);\n const [dropPosition, setDropPosition] = useState<EPutPosition>();\n\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n\n const logicOptions = [\n {\n value: ELogicType.AND,\n label: t.LogicTree.select.and,\n },\n {\n value: ELogicType.OR,\n label: t.LogicTree.select.or,\n },\n ];\n\n const { type } = value;\n\n const ref = useRef<HTMLDivElement>(null);\n const firstResizeObserverRef = useRef<ResizeObserver | null>(null);\n const lastResizeObserverRef = useRef<ResizeObserver | null>(null);\n\n const [{ isDragging }, drag, preview] = useDrag({\n type: 'LOGIC_ITEM',\n item: { id: value.id },\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n }),\n canDrag: !isRoot && isHoverDragBox,\n });\n\n const [{ isOver, canDrop }, drop] = useDrop({\n accept: 'LOGIC_ITEM',\n hover(item: { id: string }, monitor) {\n if (!ref.current) {\n return;\n }\n const dragId = item.id;\n const hoverId = value.id;\n\n if (dragId === hoverId) {\n return;\n }\n // 检查是否为最顶层的放置目标\n if (monitor.didDrop()) {\n return;\n }\n\n // 获取鼠标位置和目标元素位置\n const hoverBoundingRect = ref.current.getBoundingClientRect();\n const hoverMiddleY =\n (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (clientOffset) {\n const hoverClientY = clientOffset.y - hoverBoundingRect.top;\n\n const dropPosition =\n hoverClientY < hoverMiddleY ? EPutPosition.TOP : EPutPosition.BOTTOM;\n\n setDropPosition(dropPosition);\n } else setDropPosition(undefined);\n },\n drop(item: { id: string }, monitor) {\n if (!ref.current) {\n return;\n }\n const dragId = item.id;\n const hoverId = value.id;\n\n if (dragId === hoverId) {\n return;\n }\n // 检查是否为最顶层的放置目标\n if (monitor.didDrop()) {\n return;\n }\n\n // 获取鼠标位置和目标元素位置\n const hoverBoundingRect = ref.current.getBoundingClientRect();\n const hoverMiddleY =\n (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (clientOffset) {\n const hoverClientY = clientOffset.y - hoverBoundingRect.top;\n\n // 确定放置位置\n const dropPosition =\n hoverClientY < hoverMiddleY ? EPutPosition.TOP : EPutPosition.BOTTOM;\n\n onDragEnd(dragId, hoverId, dropPosition);\n }\n },\n collect: (monitor) => ({\n isOver: monitor.isOver({ shallow: true }),\n canDrop: monitor.canDrop(),\n }),\n });\n\n drag(drop(ref));\n\n const isDragOver = isOver && canDrop && !isRoot;\n\n const firstRef = useCallback((node: HTMLElement | null) => {\n if (firstResizeObserverRef.current) {\n firstResizeObserverRef.current.disconnect();\n firstResizeObserverRef.current = null;\n }\n\n if (!node) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setFirstNodeHight(newHeight);\n }\n }\n });\n resizeObserver.observe(node);\n firstResizeObserverRef.current = resizeObserver;\n }, []);\n\n const lastRef = useCallback((node: HTMLElement | null) => {\n if (lastResizeObserverRef.current) {\n lastResizeObserverRef.current.disconnect();\n lastResizeObserverRef.current = null;\n }\n\n if (!node) return;\n\n const resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const newHeight = entry.contentRect.height;\n if (newHeight > 0) {\n setLastNodeHight(newHeight);\n }\n }\n });\n resizeObserver.observe(node);\n lastResizeObserverRef.current = resizeObserver;\n }, []);\n\n const onAddCondition = () => {\n const { id } = value;\n addCondition(id);\n };\n\n const onAddRelation = () => {\n const { id } = value;\n addRelation(id);\n };\n\n const onRemove = () => {\n const { id } = value;\n remove(id);\n };\n\n const onChangeRelation = (logicType: ELogicType) => {\n const { id } = value;\n changeRelation(id, logicType);\n };\n\n const onChangeRecordData = (data: T) => {\n const { id } = value;\n changeRecordData(id, data);\n };\n\n useEffect(() => {\n return () => {\n if (firstResizeObserverRef.current) {\n firstResizeObserverRef.current.disconnect();\n firstResizeObserverRef.current = null;\n }\n if (lastResizeObserverRef.current) {\n lastResizeObserverRef.current.disconnect();\n lastResizeObserverRef.current = null;\n }\n };\n }, []);\n\n const isEn = locale === ELangType.EN;\n\n if (type === ENodeType.LOGIC) {\n const { nodes, logicType } = value;\n const verticalLineHeight =\n nodes.length > 1\n ? `calc(100% - ${firstNodeHight / TWO}px - ${\n lastNodeHight / TWO\n }px - 42px)`\n : `30px`;\n\n return (\n <div\n className={cn('ald-logic-tree-logic-node', {\n 'is-hover-drag-box': isHoverDragBox,\n 'is-dragging': isDragging,\n 'is-hover-top': isDragOver && dropPosition === EPutPosition.TOP,\n 'is-hover-bottom': isDragOver && dropPosition === EPutPosition.BOTTOM,\n })}\n onMouseMove={(e) => {\n e.stopPropagation();\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setHoverId('');\n }}\n ref={ref}\n >\n {_.map(nodes, (node, index) => {\n let heightRef = null;\n if (index === 0) {\n heightRef = firstRef;\n } else if (index === nodes.length - 1) {\n heightRef = lastRef;\n }\n\n return (\n <div\n className=\"ald-logic-tree-node-wrap\"\n key={node.id}\n ref={heightRef}\n >\n <div className=\"ald-logic-tree-horizontal-line\" />\n <LogicItem\n key={node.id}\n value={node}\n addCondition={addCondition}\n addRelation={addRelation}\n remove={remove}\n changeRelation={changeRelation}\n renderCondition={renderCondition}\n changeRecordData={changeRecordData}\n hoverId={hoverId}\n setHoverId={setHoverId}\n onDragEnd={onDragEnd}\n />\n </div>\n );\n })}\n <div className=\"ald-logic-tree-operation\">\n <div className=\"ald-logic-tree-left-bottom-dash-line\" />\n <TextLink icon={<PlusIcon size={24} />} onClick={onAddCondition}>\n {t.LogicTree.btn.addCondition}\n </TextLink>\n {!hideBottomBtn?.addRelation && (\n <TextLink icon={<PlusIcon size={24} />} onClick={onAddRelation}>\n {t.LogicTree.btn.addRelation}\n </TextLink>\n )}\n </div>\n {!!_.size(nodes) && (\n <div\n className=\"ald-logic-tree-logic-vertical-line\"\n style={{\n height: verticalLineHeight,\n top: `${firstNodeHight / TWO + 4}px`,\n }}\n />\n )}\n {!isRoot && (hoverId === value.id || isDragging) && (\n <div\n className=\"ald-logic-tree-node-drag-icon-wrapper\"\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(false);\n }}\n >\n <DragLightLine\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n size={16}\n color=\"var(--content-secondary)\"\n className=\"ald-logic-tree-node-drag-icon\"\n />\n </div>\n )}\n\n <Select\n options={logicOptions}\n className={cn('ald-logic-tree-select-relation', {\n 'ald-logic-tree-select-relation-en': isEn,\n })}\n size=\"small\"\n popupMatchSelectWidth={false}\n value={logicType}\n onChange={onChangeRelation}\n />\n <DragPreviewImage connect={preview} src={dargPreviewImg} />\n </div>\n );\n }\n\n return (\n <>\n <DragPreviewImage connect={preview} src={dargPreviewImg} />\n <div\n className={cn('ald-logic-tree-record-node', {\n 'is-hover-drag-box': isHoverDragBox,\n 'is-dragging': isDragging,\n 'is-hover-top': isDragOver && dropPosition === EPutPosition.TOP,\n 'is-hover-bottom': isDragOver && dropPosition === EPutPosition.BOTTOM,\n })}\n ref={ref}\n onMouseMove={(e) => {\n e.stopPropagation();\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setHoverId('');\n }}\n >\n <div\n className=\"ald-logic-tree-node-drag-icon-preview\"\n ref={preview}\n ></div>\n {(hoverId === value.id || isDragging) && (\n <div\n className=\"ald-logic-tree-record-node-drag-icon-wrapper\"\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n onMouseOut={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(false);\n }}\n >\n <DragLightLine\n onMouseMove={(e) => {\n e.stopPropagation();\n setIsHoverDragBox(true);\n setHoverId(value.id);\n }}\n size={16}\n color=\"var(--content-secondary)\"\n className=\"ald-logic-tree-record-node-drag-icon\"\n />\n </div>\n )}\n\n <div className=\"ald-logic-tree-render-condition-wrap\">\n {renderCondition(\n value.data,\n { changeData: onChangeRecordData },\n value.id,\n )}\n </div>\n <IconButton\n icon={<TrashLightLine size={16} />}\n size={'small'}\n onClick={onRemove}\n />\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAM,iBACJ;AAuBF,IAAM,MAAM;AAEZ,SAAwB,UAAa,EACnC,OACA,cACA,aACA,kBACA,QACA,gBACA,iBACA,WACA,SACA,YACA,SAAS,OACT,iBACY;CACZ,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,MAAM;CAC3D,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,EAAE;CACvD,MAAM,CAAC,eAAe,oBAAoB,SAAS,EAAE;CACrD,MAAM,CAAC,cAAc,mBAAmB,UAAwB;CAEhE,MAAM,EAAE,WAAW,WAAW,cAAc;CAC5C,MAAM,IAAI,cAAc,OAAO;CAE/B,MAAM,eAAe,CACnB;EACE,OAAO,WAAW;EAClB,OAAO,EAAE,UAAU,OAAO;EAC3B,EACD;EACE,OAAO,WAAW;EAClB,OAAO,EAAE,UAAU,OAAO;EAC3B,CACF;CAED,MAAM,EAAE,SAAS;CAEjB,MAAM,MAAM,OAAuB,KAAK;CACxC,MAAM,yBAAyB,OAA8B,KAAK;CAClE,MAAM,wBAAwB,OAA8B,KAAK;CAEjE,MAAM,CAAC,EAAE,cAAc,MAAM,WAAW,QAAQ;EAC9C,MAAM;EACN,MAAM,EAAE,IAAI,MAAM,IAAI;EACtB,UAAU,aAAa,EACrB,YAAY,QAAQ,YAAY,EACjC;EACD,SAAS,CA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,OAAD;IAAK,WAAU;cACZ,gBACC,MAAM,MACN,EAAE,YAAY,oBAAoB,EAClC,MAAM,GACP;IACG,CAAA;GACN,oBAAC,YAAD;IACE,MAAM,oBAAC,QAAD,EAAgB,MAAM,IAAM,CAAA;IAClC,MAAM;IACN,SAAS;IACT,CAAA;GACE;IACL,EAAA,CAAA"}
@@ -61,7 +61,7 @@ function SelectedMemberTags(props) {
61
61
  !hasLocked && /* @__PURE__ */ jsx(Memo, {
62
62
  size: 20,
63
63
  className: "ald-member-picker-close",
64
- color: "#98A2B3",
64
+ color: "var(--content-tertiary)",
65
65
  onClick: () => {
66
66
  props.onRemove?.(user);
67
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SelectedMemberTags.js","names":[],"sources":["../../../src/MemberPicker/components/SelectedMemberTags.tsx"],"sourcesContent":["import { cn } from '../../lib/utils';\nimport _ from 'lodash';\nimport React, { ReactNode, useContext } from 'react';\nimport Badge from '../../Badge';\nimport ConfigProvider from '../../ConfigProvider';\nimport {\n IUserGroup,\n TUser,\n TUserGroupValue,\n TUserValue,\n} from '../../ConfigProvider/getUserList';\nimport { CloseMLine } from '../../Icon';\nimport ScrollArea from '../../ScrollArea';\nimport { LocaleContext, getTranslator } from '../../locale/default';\nimport { IUser } from '../interface';\nimport { getAccount, getId, getPhoto } from '../utils';\nimport { isUser } from '../utils/getUsersWithUserId';\nimport NickLabel from './NickLabel';\ninterface ISelectedMemberTagsProps {\n className?: string;\n selectedUsers: TUser;\n onRemove?: (user: IUser | IUserGroup) => void;\n width: number;\n lockedIds: Array<TUserValue | TUserGroupValue>;\n userList: TUser;\n renderSelectedTag?: (\n user: IUser | IUserGroup,\n originNode: ReactNode,\n ) => ReactNode;\n}\n\nexport default function SelectedMemberTags(props: ISelectedMemberTagsProps) {\n const {\n className,\n selectedUsers,\n width,\n lockedIds = [],\n renderSelectedTag,\n } = props;\n\n const { getMemberPickerItemMoreInfoKey } = ConfigProvider.useGetUserList();\n\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n\n return (\n <div\n className={cn(className, 'ald-member-picker-selected-member-tags-wrap')}\n >\n <div className={'ald-member-picker-has-selected'}>\n {t.MemberPicker.selectedTotal(selectedUsers.length)}\n </div>\n <ScrollArea className={'ald-member-selected-member-wrapper'}>\n <div className={'ald-member-picker-tags'} style={{ width: width - 17 }}>\n {selectedUsers.map((user) => {\n let hasLocked = false;\n\n if (user && Object.prototype.hasOwnProperty.call(user, 'groupId')) {\n const index = _.findIndex(lockedIds, {\n groupId: (user as TUserGroupValue).groupId,\n type: (user as TUserGroupValue).type,\n });\n hasLocked = index !== -1;\n } else {\n const index = _.findIndex(lockedIds, {\n userId: (user as TUserValue).userId,\n type: (user as TUserValue).type,\n });\n\n hasLocked = index !== -1;\n }\n\n const originNode = (\n <div\n className={'ald-member-picker-selected-member-tag'}\n key={getId(user)}\n >\n <div className={'ald-member-picker-selected-member-tag-user'}>\n <NickLabel\n type={user.type}\n id={getId(user)}\n name={user.name as string}\n photo={getPhoto(user)}\n account={getAccount(user)}\n addonBefore={\n user.type === 'USER' && (\n <span className=\"ald-member-picker-option-id\">\n {getMemberPickerItemMoreInfoKey\n ? getMemberPickerItemMoreInfoKey(user)\n : user.userId}\n </span>\n )\n }\n ></NickLabel>\n </div>\n {/* 如果是用户的话并且user.ban为true,则展示 已停用 Tag */}\n {isUser(user) && user.ban && (\n <Badge\n status=\"default\"\n count={t.MemberPicker.ban}\n className={'ald-member-picker-ban-badge'}\n ></Badge>\n )}\n {!hasLocked && (\n <CloseMLine\n size={20}\n className={'ald-member-picker-close'}\n color=\"#98A2B3\"\n onClick={() => {\n props.onRemove?.(user);\n }}\n />\n )}\n </div>\n );\n\n if (renderSelectedTag) {\n return renderSelectedTag(user, originNode);\n }\n\n return originNode;\n })}\n </div>\n </ScrollArea>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,SAAwB,mBAAmB,OAAiC;CAC1E,MAAM,EACJ,WACA,eACA,OACA,YAAY,E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AGR,SAAI,kBACF,QAAO,kBAAkB,MAAM,WAAW;AAG5C,YAAO;MACP;IACE,CAAA;GACK,CAAA,CACT"}
1
+ {"version":3,"file":"SelectedMemberTags.js","names":[],"sources":["../../../src/MemberPicker/components/SelectedMemberTags.tsx"],"sourcesContent":["import { cn } from '../../lib/utils';\nimport _ from 'lodash';\nimport React, { ReactNode, useContext } from 'react';\nimport Badge from '../../Badge';\nimport ConfigProvider from '../../ConfigProvider';\nimport {\n IUserGroup,\n TUser,\n TUserGroupValue,\n TUserValue,\n} from '../../ConfigProvider/getUserList';\nimport { CloseMLine } from '../../Icon';\nimport ScrollArea from '../../ScrollArea';\nimport { LocaleContext, getTranslator } from '../../locale/default';\nimport { IUser } from '../interface';\nimport { getAccount, getId, getPhoto } from '../utils';\nimport { isUser } from '../utils/getUsersWithUserId';\nimport NickLabel from './NickLabel';\ninterface ISelectedMemberTagsProps {\n className?: string;\n selectedUsers: TUser;\n onRemove?: (user: IUser | IUserGroup) => void;\n width: number;\n lockedIds: Array<TUserValue | TUserGroupValue>;\n userList: TUser;\n renderSelectedTag?: (\n user: IUser | IUserGroup,\n originNode: ReactNode,\n ) => ReactNode;\n}\n\nexport default function SelectedMemberTags(props: ISelectedMemberTagsProps) {\n const {\n className,\n selectedUsers,\n width,\n lockedIds = [],\n renderSelectedTag,\n } = props;\n\n const { getMemberPickerItemMoreInfoKey } = ConfigProvider.useGetUserList();\n\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n\n return (\n <div\n className={cn(className, 'ald-member-picker-selected-member-tags-wrap')}\n >\n <div className={'ald-member-picker-has-selected'}>\n {t.MemberPicker.selectedTotal(selectedUsers.length)}\n </div>\n <ScrollArea className={'ald-member-selected-member-wrapper'}>\n <div className={'ald-member-picker-tags'} style={{ width: width - 17 }}>\n {selectedUsers.map((user) => {\n let hasLocked = false;\n\n if (user && Object.prototype.hasOwnProperty.call(user, 'groupId')) {\n const index = _.findIndex(lockedIds, {\n groupId: (user as TUserGroupValue).groupId,\n type: (user as TUserGroupValue).type,\n });\n hasLocked = index !== -1;\n } else {\n const index = _.findIndex(lockedIds, {\n userId: (user as TUserValue).userId,\n type: (user as TUserValue).type,\n });\n\n hasLocked = index !== -1;\n }\n\n const originNode = (\n <div\n className={'ald-member-picker-selected-member-tag'}\n key={getId(user)}\n >\n <div className={'ald-member-picker-selected-member-tag-user'}>\n <NickLabel\n type={user.type}\n id={getId(user)}\n name={user.name as string}\n photo={getPhoto(user)}\n account={getAccount(user)}\n addonBefore={\n user.type === 'USER' && (\n <span className=\"ald-member-picker-option-id\">\n {getMemberPickerItemMoreInfoKey\n ? getMemberPickerItemMoreInfoKey(user)\n : user.userId}\n </span>\n )\n }\n ></NickLabel>\n </div>\n {/* 如果是用户的话并且user.ban为true,则展示 已停用 Tag */}\n {isUser(user) && user.ban && (\n <Badge\n status=\"default\"\n count={t.MemberPicker.ban}\n className={'ald-member-picker-ban-badge'}\n ></Badge>\n )}\n {!hasLocked && (\n <CloseMLine\n size={20}\n className={'ald-member-picker-close'}\n color=\"var(--content-tertiary)\"\n onClick={() => {\n props.onRemove?.(user);\n }}\n />\n )}\n </div>\n );\n\n if (renderSelectedTag) {\n return renderSelectedTag(user, originNode);\n }\n\n return originNode;\n })}\n </div>\n </ScrollArea>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,SAAwB,mBAAmB,OAAiC;CAC1E,MAAM,EACJ,WACA,eACA,OACA,YAAY,EAAE,EACd,sBACE;CAEJ,MAAM,EAAE,mCAAmC,wBAAe,gBAAgB;CAE1E,MAAM,EAAE,WAAW,WAAW,cAAc;CAC5C,MAAM,IAAI,cAAc,OAAO;AAE/B,QACE,qBAAC,OAAD;EACE,WAAW,GAAG,WAAW,8CAA8C;YADzE,CAGE,oBAAC,OAAD;GAAK,WAAW;aACb,EAAE,aAAa,cAAc,cAAc,OAAO;GAC/C,CAAA,EACN,oBAAC,oBAAD;GAAY,WAAW;aACrB,oBAAC,OAAD;IAAK,WAAW;IAA0B,OAAO,EAAE,OAAO,QAAQ,IAAI;cACnE,cAAc,KAAK,SAAS;KAC3B,IAAI,YAAY;AAEhB,SAAI,QAAQ,OAAO,UAAU,eAAe,KAAK,MAAM,UAAU,CAK/D,aAJc,EAAE,UAAU,WAAW;MACnC,SAAU,KAAyB;MACnC,MAAO,KAAyB;MACjC,CAAC,KACoB;SAOtB,aALc,EAAE,UAAU,WAAW;MACnC,QAAS,KAAoB;MAC7B,MAAO,KAAoB;MAC5B,CAAC,KAEoB;KAGxB,MAAM,aACJ,qBAAC,OAAD;MACE,WAAW;gBADb;OAIE,oBAAC,OAAD;QAAK,WAAW;kBACd,oBAAC,mBAAD;SACE,MAAM,KAAK;SACX,IAAI,MAAM,KAAK;SACf,MAAM,KAAK;SACX,OAAO,SAAS,KAAK;SACrB,SAAS,WAAW,KAAK;SACzB,aACE,KAAK,SAAS,UACZ,oBAAC,QAAD;UAAM,WAAU;oBACb,iCACG,+BAA+B,KAAK,GACpC,KAAK;UACJ,CAAA;SAGA,CAAA;QACT,CAAA;OAEL,OAAO,KAAK,IAAI,KAAK,OACpB,oBAAC,OAAD;QACE,QAAO;QACP,OAAO,EAAE,aAAa;QACtB,WAAW;QACJ,CAAA;OAEV,CAAC,aACA,oBAAC,MAAD;QACE,MAAM;QACN,WAAW;QACX,OAAM;QACN,eAAe;AACb,eAAM,WAAW,KAAK;;QAExB,CAAA;OAEA;QAtCC,MAAM,KAAK,CAsCZ;AAGR,SAAI,kBACF,QAAO,kBAAkB,MAAM,WAAW;AAG5C,YAAO;MACP;IACE,CAAA;GACK,CAAA,CACT"}
@@ -19,15 +19,15 @@ var DEFAULT_WIDTH = 552;
19
19
  var ModalTitle = ({ icon, title, subTitle }, type) => /* @__PURE__ */ jsxs("div", {
20
20
  className: "ald-modal-title-container tw-flex tw-items-center tw-gap-4",
21
21
  children: [icon && /* @__PURE__ */ jsx("div", {
22
- className: cn("ald-modal-icon-container tw-grid tw-size-10 tw-shrink-0 tw-place-items-center tw-rounded-[var(--global-grid-250)]", type === "info" && "ald-modal-cion-info-container tw-bg-[var(--action-primary-subtle-hover)]", type === "success" && "ald-modal-cion-success-container tw-bg-[var(--background-positive-muted)]", type === "warning" && "ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]", type === "warn" && "ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]", type === "error" && "ald-modal-cion-error-container tw-bg-[var(--background-negative-muted)]", type === "confirm" && "ald-modal-cion-confirm-container tw-bg-[var(--action-primary-subtle-hover)]"),
22
+ className: cn("ald-modal-icon-container tw-grid tw-size-10 tw-shrink-0 tw-place-items-center tw-rounded-[var(--global-grid-250)]", type === "info" && "ald-modal-cion-info-container tw-bg-[var(--background-informative-muted)]", type === "success" && "ald-modal-cion-success-container tw-bg-[var(--background-positive-muted)]", type === "warning" && "ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]", type === "warn" && "ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]", type === "error" && "ald-modal-cion-error-container tw-bg-[var(--background-negative-muted)]", type === "confirm" && "ald-modal-cion-confirm-container tw-bg-[var(--background-brand-muted)]"),
23
23
  children: icon
24
24
  }), /* @__PURE__ */ jsxs("div", {
25
25
  className: "ald-modal-text-container",
26
26
  children: [title && /* @__PURE__ */ jsx("div", {
27
- className: cn("ald-modal-text-title tw-text-lg tw-font-semibold tw-leading-7 tw-text-[var(--alias-colors-text-strong)]", !subTitle && "ald-modal-text-title-only tw-text-xl"),
27
+ className: cn("ald-modal-text-title tw-text-lg tw-font-semibold tw-leading-7 tw-text-[var(--content-primary)]", !subTitle && "ald-modal-text-title-only tw-text-xl"),
28
28
  children: title
29
29
  }), subTitle && /* @__PURE__ */ jsx("div", {
30
- className: "ald-modal-text-sub-title tw-mt-1 tw-text-xs tw-leading-4 tw-text-[var(--alias-colors-text-subtle)]",
30
+ className: "ald-modal-text-sub-title tw-mt-1 tw-text-xs tw-leading-4 tw-text-[var(--content-secondary)]",
31
31
  children: subTitle
32
32
  })]
33
33
  })]
@@ -49,7 +49,7 @@ function getIcon(type) {
49
49
  });
50
50
  return /* @__PURE__ */ jsx(Memo$3, {
51
51
  size: 24,
52
- color: "var(--interaction-default-normal)"
52
+ color: "var(--action-primary-normal)"
53
53
  });
54
54
  }
55
55
  function OriginModal(props) {
@@ -117,7 +117,7 @@ function OriginModal(props) {
117
117
  const renderFooter = () => {
118
118
  if (footer === null) return null;
119
119
  if (footer) return /* @__PURE__ */ jsx("div", {
120
- className: "ald-modal-footer ant-modal-footer tw-flex tw-items-center tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--global-cool-grey-100)] tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-px-6 tw-py-3 tw-text-right",
120
+ className: "ald-modal-footer ant-modal-footer tw-flex tw-items-center tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--border-default)] tw-bg-[var(--background-default)] tw-px-6 tw-py-3 tw-text-right",
121
121
  children: footer
122
122
  });
123
123
  return /* @__PURE__ */ jsxs("div", {
@@ -141,7 +141,7 @@ function OriginModal(props) {
141
141
  open,
142
142
  modal: false,
143
143
  children: /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [/* @__PURE__ */ jsx("div", {
144
- className: "ald-modal-mask tw-animate-in tw-fade-in-0 tw-fixed tw-inset-0 tw-bg-black/45",
144
+ className: "ald-modal-mask tw-animate-in tw-fade-in-0 tw-fixed tw-inset-0 tw-bg-[var(--background-inverted)] tw-opacity-45",
145
145
  style: { zIndex: maskZIndex },
146
146
  onPointerDown: () => {
147
147
  if (maskClosable) onCancel?.({});
@@ -153,7 +153,7 @@ function OriginModal(props) {
153
153
  children: /* @__PURE__ */ jsx(DialogPrimitive.Content, {
154
154
  "data-testid": dataTestId,
155
155
  "aria-label": ariaLabel,
156
- className: cn("ald-modal ant-modal tw-pointer-events-auto tw-box-border tw-flex tw-flex-col tw-overflow-hidden tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-shadow-[var(--elevation-bottom-bottom-lg)] tw-outline-none", fullscreen ? "ald-modal-fullscreen tw-fixed tw-inset-0 tw-size-full tw-rounded-none" : "tw-rounded-r-75", !fullscreen && "tw-border tw-border-solid tw-border-[var(--border-default)]", paddingLess && "ald-modal-padding-less", virtualScrollBar && "ald-modal-virtual-scroll-bar", hideHeaderBottomBorder && "ald-modal-hide-header-bottom-border", responsiveBounds && "ald-modal-responsive-bounds", className),
156
+ className: cn("ald-modal ant-modal tw-pointer-events-auto tw-box-border tw-flex tw-flex-col tw-overflow-hidden tw-bg-[var(--background-default)] tw-shadow-[var(--elevation-bottom-bottom-lg)] tw-outline-none", fullscreen ? "ald-modal-fullscreen tw-fixed tw-inset-0 tw-size-full tw-rounded-none" : "tw-rounded-r-75", !fullscreen && "tw-border tw-border-solid tw-border-[var(--border-default)]", paddingLess && "ald-modal-padding-less", virtualScrollBar && "ald-modal-virtual-scroll-bar", hideHeaderBottomBorder && "ald-modal-hide-header-bottom-border", responsiveBounds && "ald-modal-responsive-bounds", className),
157
157
  style: {
158
158
  ...fullscreen ? {} : {
159
159
  width: responsiveBounds ? responsiveBoundsStyle.width : width || DEFAULT_WIDTH,
@@ -178,7 +178,7 @@ function OriginModal(props) {
178
178
  value: nextLevel,
179
179
  children: [
180
180
  !fullscreen && /* @__PURE__ */ jsxs("div", {
181
- className: cn("ald-modal-header ant-modal-header tw-flex tw-items-start tw-justify-between tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-px-6 tw-py-4", !hideHeaderBottomBorder && "tw-border-b tw-border-solid tw-border-[var(--global-cool-grey-100)]"),
181
+ className: cn("ald-modal-header ant-modal-header tw-flex tw-items-start tw-justify-between tw-bg-[var(--background-default)] tw-px-6 tw-py-4", !hideHeaderBottomBorder && "tw-border-b tw-border-solid tw-border-[var(--border-default)]"),
182
182
  children: [/* @__PURE__ */ jsx(DialogPrimitive.Title, {
183
183
  asChild: true,
184
184
  children: /* @__PURE__ */ jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/Modal/index.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { hideOthers } from 'aria-hidden';\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createRoot } from 'react-dom/client';\nimport Button, { ButtonType, IButtonProps } from '../Button';\nimport {\n AttentionTriangleLightLine,\n CheckCircleLightLine,\n CloseLLine,\n InformationCircleLightLine,\n} from '../Icon';\nimport IconButton from '../IconButton';\nimport ScrollArea from '../ScrollArea';\nimport {\n FloatingLayerProvider,\n useFloatingLayer,\n} from '../_utils/floatingLayer';\nimport { LocaleContext, getTranslator } from '../locale/default';\nimport { cn } from '../lib/utils';\n\nexport const destroyFns: Array<() => void> = [];\n\nexport interface ModalProps {\n open?: boolean;\n onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n afterClose?: () => void;\n title?: React.ReactNode;\n subTitle?: React.ReactNode;\n icon?: React.ReactElement;\n width?: number | string;\n footer?: React.ReactNode | null;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n confirmLoading?: boolean;\n maskClosable?: boolean;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n centered?: boolean;\n destroyOnClose?: boolean;\n className?: string;\n /** Pass through to the modal content root for automated testing. */\n 'data-testid'?: string;\n /** Pass through to the modal content root for accessibility and automated testing. */\n 'aria-label'?: string;\n /** Applied to the outer wrap layer (matches antd wrapClassName behavior) */\n wrapClassName?: string;\n style?: React.CSSProperties;\n bodyStyle?: React.CSSProperties;\n zIndex?: number;\n children?: React.ReactNode;\n paddingLess?: boolean;\n virtualScrollBar?: boolean;\n hideHeaderBottomBorder?: boolean;\n responsiveBounds?: boolean;\n fullscreen?: boolean;\n keyboard?: boolean;\n afterOpenChange?: (open: boolean) => void;\n getContainer?: (() => HTMLElement) | false;\n /** @internal used by static methods to pass modal type for icon styling */\n _modalType?: string;\n}\n\nexport interface ModalFuncProps {\n title?: React.ReactNode;\n subTitle?: React.ReactNode;\n content?: React.ReactNode;\n icon?: React.ReactElement;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n onOk?: (...args: any[]) => any;\n onCancel?: (...args: any[]) => any;\n width?: number | string;\n className?: string;\n /** @deprecated Use `className` instead. Preserved for antd v4 compat. */\n wrapClassName?: string;\n closable?: boolean;\n type?: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm';\n centered?: boolean;\n maskClosable?: boolean;\n}\n\nconst DEFAULT_WIDTH = 552;\n\nconst ModalTitle = (\n { icon, title, subTitle }: Pick<ModalProps, 'icon' | 'title' | 'subTitle'>,\n type?: string,\n) => (\n <div className=\"ald-modal-title-container tw-flex tw-items-center tw-gap-4\">\n {icon && (\n <div\n className={cn(\n 'ald-modal-icon-container tw-grid tw-size-10 tw-shrink-0 tw-place-items-center tw-rounded-[var(--global-grid-250)]',\n type === 'info' &&\n 'ald-modal-cion-info-container tw-bg-[var(--action-primary-subtle-hover)]',\n type === 'success' &&\n 'ald-modal-cion-success-container tw-bg-[var(--background-positive-muted)]',\n type === 'warning' &&\n 'ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]',\n type === 'warn' &&\n 'ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]',\n type === 'error' &&\n 'ald-modal-cion-error-container tw-bg-[var(--background-negative-muted)]',\n type === 'confirm' &&\n 'ald-modal-cion-confirm-container tw-bg-[var(--action-primary-subtle-hover)]',\n )}\n >\n {icon}\n </div>\n )}\n <div className=\"ald-modal-text-container\">\n {title && (\n <div\n className={cn(\n 'ald-modal-text-title tw-text-lg tw-font-semibold tw-leading-7 tw-text-[var(--alias-colors-text-strong)]',\n !subTitle && 'ald-modal-text-title-only tw-text-xl',\n )}\n >\n {title}\n </div>\n )}\n {subTitle && (\n <div className=\"ald-modal-text-sub-title tw-mt-1 tw-text-xs tw-leading-4 tw-text-[var(--alias-colors-text-subtle)]\">\n {subTitle}\n </div>\n )}\n </div>\n </div>\n);\n\nfunction getIcon(\n type: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm',\n) {\n if (type === 'success')\n return (\n <CheckCircleLightLine\n fill=\"var(--content-inverted-primary)\"\n color=\"var(--background-positive-strong)\"\n size={24}\n />\n );\n if (type === 'error')\n return (\n <AttentionTriangleLightLine\n color=\"var(--background-negative-strong)\"\n fill=\"var(--content-inverted-primary)\"\n size={24}\n />\n );\n if (type === 'warning' || type === 'warn')\n return (\n <AttentionTriangleLightLine\n color=\"var(--background-warning-strong)\"\n size={24}\n />\n );\n return (\n <InformationCircleLightLine\n size={24}\n color=\"var(--interaction-default-normal)\"\n />\n );\n}\n\nfunction OriginModal(props: ModalProps) {\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n const {\n className,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n children,\n okType = 'primary',\n width,\n closeIcon,\n subTitle,\n okButtonProps = {},\n cancelButtonProps = {},\n okText = t.Modal.sure,\n cancelText = t.Modal.cancel,\n icon,\n title,\n paddingLess,\n responsiveBounds,\n hideHeaderBottomBorder,\n virtualScrollBar,\n style,\n maskClosable = false,\n fullscreen,\n open = false,\n onOk,\n onCancel,\n footer,\n confirmLoading,\n closable = true,\n zIndex = 1000,\n bodyStyle,\n keyboard = true,\n afterOpenChange,\n wrapClassName,\n _modalType,\n } = props;\n\n const prevOpenRef = useRef(open);\n const contentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (prevOpenRef.current !== open) {\n prevOpenRef.current = open;\n afterOpenChange?.(open);\n }\n }, [open, afterOpenChange]);\n\n // ---- modal={false} 补偿:锁定背景滚动 ----\n useEffect(() => {\n if (!open) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n return () => {\n document.body.style.overflow = prev;\n };\n }, [open]);\n\n // ---- modal={false} 补偿:aria-hidden(屏幕阅读器只感知弹窗) ----\n useEffect(() => {\n if (!open || !contentRef.current) return;\n return hideOthers(contentRef.current);\n }, [open]);\n\n // ---- modal={false} 补偿:Tab 焦点循环 ----\n useEffect(() => {\n if (!open || !contentRef.current) return;\n const container = contentRef.current;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab') return;\n const focusable = container.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled])',\n );\n if (focusable.length === 0) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (\n document.activeElement === first ||\n !container.contains(document.activeElement)\n ) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (\n document.activeElement === last ||\n !container.contains(document.activeElement)\n ) {\n e.preventDefault();\n first.focus();\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [open]);\n\n const responsiveBoundsStyle = useMemo(() => {\n if (!responsiveBounds) return {};\n return {\n width: 'calc(100% - 160px)',\n maxWidth: '1680px',\n minWidth: '1280px',\n height: 'calc(100% - 48px)',\n maxHeight: '900px',\n minHeight: '640px',\n };\n }, [responsiveBounds]);\n\n const mergedOkProps = { loading: confirmLoading, ...okButtonProps };\n const { maskZIndex, contentZIndex, nextLevel } = useFloatingLayer(zIndex);\n\n const renderFooter = () => {\n if (footer === null) return null;\n if (footer)\n return (\n // antd 兼容:antd .ant-modal-footer 使用 text-align:right 让 inline 按钮右对齐,\n // 即使消费方传入 width:100% 的子容器,内部 inline 元素仍能右对齐。\n // 此处同时使用 tw-flex tw-justify-end(flexbox 对齐)和 tw-text-right(继承式对齐)保持兼容。\n <div className=\"ald-modal-footer ant-modal-footer tw-flex tw-items-center tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--global-cool-grey-100)] tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-px-6 tw-py-3 tw-text-right\">\n {footer}\n </div>\n );\n return (\n <div className=\"ald-modal-footer ant-modal-footer tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--border-default)] tw-px-6 tw-py-4\">\n <Button\n type=\"secondary\"\n size=\"middle\"\n {...cancelButtonProps}\n onClick={onCancel}\n >\n {cancelText}\n </Button>\n <Button type={okType} size=\"middle\" {...mergedOkProps} onClick={onOk}>\n {okText}\n </Button>\n </div>\n );\n };\n\n return (\n <DialogPrimitive.Root open={open} modal={false}>\n <DialogPrimitive.Portal>\n {/* modal={false} 时 DialogPrimitive.Overlay 不渲染,用普通 div 替代 */}\n <div\n className=\"ald-modal-mask tw-animate-in tw-fade-in-0 tw-fixed tw-inset-0 tw-bg-black/45\"\n style={{ zIndex: maskZIndex }}\n onPointerDown={() => {\n if (maskClosable) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n }\n }}\n />\n {/* Centering wrapper — replaces transform centering so consumer CSS (top/left overrides) works */}\n <div\n ref={contentRef}\n className={cn(\n // antd 兼容:保留 ant-modal-wrap class,消费方 CSS 通过 wrapClassName + :global(.ant-modal) 控制弹窗宽高\n 'ald-modal-wrap ant-modal-wrap tw-pointer-events-none tw-fixed tw-inset-0 tw-flex tw-items-center tw-justify-center',\n wrapClassName,\n )}\n style={{ zIndex: contentZIndex }}\n >\n <DialogPrimitive.Content\n data-testid={dataTestId}\n aria-label={ariaLabel}\n className={cn(\n // antd 兼容:保留 ant-modal class,消费方 CSS 通过 .ant-modal 选择器控制弹窗宽高等样式\n // tw-outline-none:Radix 打开时会聚焦 Content,不抑制 outline 会渲染出蓝色焦点框\n 'ald-modal ant-modal tw-pointer-events-auto tw-box-border tw-flex tw-flex-col tw-overflow-hidden tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-shadow-[var(--elevation-bottom-bottom-lg)] tw-outline-none',\n fullscreen\n ? 'ald-modal-fullscreen tw-fixed tw-inset-0 tw-size-full tw-rounded-none'\n : 'tw-rounded-r-75',\n !fullscreen &&\n 'tw-border tw-border-solid tw-border-[var(--border-default)]',\n paddingLess && 'ald-modal-padding-less',\n virtualScrollBar && 'ald-modal-virtual-scroll-bar',\n hideHeaderBottomBorder && 'ald-modal-hide-header-bottom-border',\n responsiveBounds && 'ald-modal-responsive-bounds',\n className,\n )}\n style={{\n ...(fullscreen\n ? {}\n : {\n width: responsiveBounds\n ? responsiveBoundsStyle.width\n : width || DEFAULT_WIDTH,\n ...responsiveBoundsStyle,\n }),\n ...style,\n }}\n onEscapeKeyDown={(e) => {\n if (keyboard) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n } else {\n e.preventDefault();\n }\n }}\n onPointerDownOutside={(e) => {\n if (maskClosable) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n } else {\n e.preventDefault();\n }\n }}\n onInteractOutside={(e) => {\n if (!maskClosable) {\n e.preventDefault();\n }\n }}\n >\n {/* ant-modal-content compat wrapper — matches antd DOM nesting for consumer CSS */}\n <div className=\"ant-modal-content tw-flex tw-h-full tw-flex-col\">\n <FloatingLayerProvider value={nextLevel}>\n {!fullscreen && (\n <div\n className={cn(\n 'ald-modal-header ant-modal-header tw-flex tw-items-start tw-justify-between tw-bg-[var(--alias-colors-bg-skeleton-subtler)] tw-px-6 tw-py-4',\n !hideHeaderBottomBorder &&\n 'tw-border-b tw-border-solid tw-border-[var(--global-cool-grey-100)]',\n )}\n >\n <DialogPrimitive.Title asChild>\n <div className=\"tw-flex-1\">\n {ModalTitle({ icon, title, subTitle }, _modalType)}\n </div>\n </DialogPrimitive.Title>\n {closable && (\n <DialogPrimitive.Close asChild>\n <span className=\"ant-modal-close\" onClick={onCancel}>\n {closeIcon || (\n <IconButton\n icon={<CloseLLine size={20} />}\n size=\"middle\"\n />\n )}\n </span>\n </DialogPrimitive.Close>\n )}\n </div>\n )}\n {/* Hidden title for accessibility when fullscreen hides the header */}\n {fullscreen && (\n <DialogPrimitive.Title className=\"tw-sr-only\">\n {title}\n </DialogPrimitive.Title>\n )}\n <div\n className={cn(\n 'ald-modal-body ant-modal-body tw-flex-1 tw-text-sm tw-leading-5',\n fullscreen\n ? 'tw-h-full tw-overflow-auto tw-p-0'\n : 'tw-min-h-[130px]',\n !fullscreen &&\n (virtualScrollBar\n ? 'tw-overflow-hidden tw-p-0'\n : 'tw-overflow-auto'),\n !fullscreen &&\n !responsiveBounds &&\n !virtualScrollBar &&\n 'tw-max-h-[68vh]',\n !fullscreen &&\n !paddingLess &&\n !virtualScrollBar &&\n 'tw-p-6',\n )}\n style={bodyStyle}\n >\n {virtualScrollBar ? (\n <ScrollArea\n className=\"ald-modal-body-wrap !tw-h-auto\"\n innerClassName={cn(\n 'ald-modal-body-wrap-inner tw-max-h-[68vh]',\n paddingLess ? 'tw-p-0' : 'tw-px-[23px] tw-py-0',\n )}\n >\n {children}\n </ScrollArea>\n ) : (\n children\n )}\n </div>\n {!fullscreen && renderFooter()}\n </FloatingLayerProvider>\n </div>\n </DialogPrimitive.Content>\n </div>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n\n// Static method helper\nfunction createStaticModal(\n type: ModalFuncProps['type'],\n props: ModalFuncProps,\n) {\n const container = document.createElement('div');\n document.body.appendChild(container);\n const root = createRoot(container);\n\n let currentProps = { ...props };\n\n const destroy = () => {\n root.unmount();\n container.remove();\n const idx = destroyFns.indexOf(destroy);\n if (idx >= 0) destroyFns.splice(idx, 1);\n };\n\n const update = (newProps: Partial<ModalFuncProps>) => {\n currentProps = { ...currentProps, ...newProps };\n render(currentProps);\n };\n\n const isConfirm = type === 'confirm';\n\n const render = (p: ModalFuncProps) => {\n const handleOk = () => {\n p.onOk?.();\n destroy();\n };\n const handleCancel = () => {\n p.onCancel?.();\n destroy();\n };\n\n root.render(\n <OriginModal\n open={true}\n title={p.title}\n subTitle={p.subTitle}\n icon={p.icon || getIcon(type || 'info')}\n onOk={handleOk}\n onCancel={handleCancel}\n okText={p.okText}\n cancelText={p.cancelText}\n okButtonProps={p.okButtonProps}\n cancelButtonProps={p.cancelButtonProps}\n okType={p.okType || (isConfirm ? 'dangerous' : 'primary')}\n width={p.width || DEFAULT_WIDTH}\n className={cn('ald-modal', p.className)}\n closable={p.closable}\n maskClosable={p.maskClosable}\n _modalType={type}\n footer={\n isConfirm ? undefined : (\n <Button\n type=\"primary\"\n size=\"middle\"\n {...(p.okButtonProps || {})}\n onClick={handleOk}\n >\n {p.okText || 'OK'}\n </Button>\n )\n }\n >\n {p.content}\n </OriginModal>,\n );\n };\n\n destroyFns.push(destroy);\n render(currentProps);\n\n return { destroy, update };\n}\n\n// Attach static methods\ntype ModalFunc = (props: ModalFuncProps) => {\n destroy: () => void;\n update: (props: Partial<ModalFuncProps>) => void;\n};\n\n// ---------- useModal hook ----------\n\ninterface ModalInstance {\n id: number;\n type: ModalFuncProps['type'];\n props: ModalFuncProps;\n open: boolean;\n}\n\nexport interface ModalApiInstance {\n destroy: () => void;\n update: (newProps: Partial<ModalFuncProps>) => void;\n}\n\nexport interface ModalStaticFunctions {\n info: (props: ModalFuncProps) => ModalApiInstance;\n success: (props: ModalFuncProps) => ModalApiInstance;\n error: (props: ModalFuncProps) => ModalApiInstance;\n warning: (props: ModalFuncProps) => ModalApiInstance;\n confirm: (props: ModalFuncProps) => ModalApiInstance;\n}\n\nfunction useModal(): [ModalStaticFunctions, React.ReactElement] {\n const [modals, setModals] = useState<ModalInstance[]>([]);\n const idCounter = useRef(0);\n\n const removeModal = useCallback((id: number) => {\n setModals((prev) =>\n prev.map((m) => (m.id === id ? { ...m, open: false } : m)),\n );\n // Remove from DOM after animation\n setTimeout(() => {\n setModals((prev) => prev.filter((m) => m.id !== id));\n }, 300);\n }, []);\n\n const updateModal = useCallback(\n (id: number, newProps: Partial<ModalFuncProps>) => {\n setModals((prev) =>\n prev.map((m) =>\n m.id === id ? { ...m, props: { ...m.props, ...newProps } } : m,\n ),\n );\n },\n [],\n );\n\n const openModal = useCallback(\n (type: ModalFuncProps['type'], props: ModalFuncProps): ModalApiInstance => {\n const id = ++idCounter.current;\n const instance: ModalInstance = { id, type, props, open: true };\n setModals((prev) => [...prev, instance]);\n\n return {\n destroy: () => removeModal(id),\n update: (newProps: Partial<ModalFuncProps>) =>\n updateModal(id, newProps),\n };\n },\n [removeModal, updateModal],\n );\n\n const api = useMemo<ModalStaticFunctions>(\n () => ({\n info: (props) => openModal('info', props),\n success: (props) => openModal('success', props),\n error: (props) => openModal('error', props),\n warning: (props) => openModal('warning', props),\n confirm: (props) =>\n openModal('confirm', { ...props, type: props.type || 'confirm' }),\n }),\n [openModal],\n );\n\n const contextHolder = (\n <>\n {modals.map((m) => {\n const isConfirmType = m.type === 'confirm';\n const handleOk = () => {\n m.props.onOk?.();\n removeModal(m.id);\n };\n const handleCancel = () => {\n m.props.onCancel?.();\n removeModal(m.id);\n };\n return (\n <OriginModal\n key={m.id}\n open={m.open}\n title={m.props.title}\n subTitle={m.props.subTitle}\n icon={m.props.icon || getIcon(m.type || 'info')}\n onOk={handleOk}\n onCancel={handleCancel}\n okText={m.props.okText}\n cancelText={m.props.cancelText}\n okButtonProps={m.props.okButtonProps}\n cancelButtonProps={m.props.cancelButtonProps}\n okType={m.props.okType || (isConfirmType ? 'dangerous' : 'primary')}\n width={m.props.width || DEFAULT_WIDTH}\n className={cn('ald-modal', m.props.className)}\n closable={m.props.closable}\n maskClosable={m.props.maskClosable}\n _modalType={m.type}\n footer={\n isConfirmType ? undefined : (\n <Button\n type=\"primary\"\n size=\"middle\"\n {...(m.props.okButtonProps || {})}\n onClick={handleOk}\n >\n {m.props.okText || 'OK'}\n </Button>\n )\n }\n >\n {m.props.content}\n </OriginModal>\n );\n })}\n </>\n );\n\n return [api, contextHolder];\n}\n\n// ---------- end useModal ----------\n\nconst Modal = OriginModal as typeof OriginModal & {\n info: ModalFunc;\n success: ModalFunc;\n error: ModalFunc;\n warning: ModalFunc;\n confirm: ModalFunc;\n destroyAll: () => void;\n useModal: typeof useModal;\n config: (config: any) => void;\n};\n\nModal.info = (props) => createStaticModal('info', props);\nModal.success = (props) => createStaticModal('success', props);\nModal.error = (props) => createStaticModal('error', props);\nModal.warning = (props) => createStaticModal('warning', props);\nModal.confirm = (props) =>\n createStaticModal('confirm', { ...props, type: props.type || 'confirm' });\n\nModal.destroyAll = () => {\n while (destroyFns.length) {\n const close = destroyFns.pop();\n if (close) close();\n }\n};\n\nModal.useModal = useModal;\nModal.config = () => {};\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAa,aAAgC,EAAE;AAoE/C,IAAM,gBAAgB;AAEtB,IAAM,cACJ,EAAE,MAAM,OAAO,YACf,SAEA,qBAAC,OAAD;CAAK,WAAU;WAAf,CACG,QACC,oBAAC,OAAD;EACE,WAAW,GACT,qHACA,SAAS,UACP,4EACF,SAAS,aACP,6EACF,SAAS,aACP,4EACF,SAAS,UACP,4EACF,SAAS,WACP,2EACF,SAAS,aACP,8EACH;YAEA;EACG,CAAA,EAER,qBAAC,OAAD;EAAK,WAAU;YAAf,CACG,SACC,oBAAC,OAAD;GACE,WAAW,GACT,2GACA,CAAC,YAAY,uCACd;aAEA;GACG,CAAA,EAEP,YACC,oBAAC,OAAD;GAAK,WAAU;aACZ;GACG,CAAA,CAEJ;IACF;;AAGR,SAAS,QACP,MACA;AACA,KAAI,SAAS,UACX,QACE,oBAAC,QAAD;EACE,MAAK;EACL,OAAM;EACN,MAAM;EACN,CAAA;AAEN,KAAI,SAAS,QACX,QACE,oBAAC,MAAD;EACE,OAAM;EACN,MAAK;EACL,MAAM;EACN,CAAA;AAEN,KAAI,SAAS,aAAa,SAAS,OACjC,QACE,oBAAC,MAAD;EACE,OAAM;EACN,MAAM;EACN,CAAA;AAEN,QACE,oBAAC,QAAD;EACE,MAAM;EACN,OAAM;EACN,CAAA;;AAIN,SAAS,YAAY,OAAmB;CACtC,MAAM,EAAE,WAA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":3,"file":"index.js","names":[],"sources":["../../src/Modal/index.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { hideOthers } from 'aria-hidden';\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createRoot } from 'react-dom/client';\nimport Button, { ButtonType, IButtonProps } from '../Button';\nimport {\n AttentionTriangleLightLine,\n CheckCircleLightLine,\n CloseLLine,\n InformationCircleLightLine,\n} from '../Icon';\nimport IconButton from '../IconButton';\nimport ScrollArea from '../ScrollArea';\nimport {\n FloatingLayerProvider,\n useFloatingLayer,\n} from '../_utils/floatingLayer';\nimport { LocaleContext, getTranslator } from '../locale/default';\nimport { cn } from '../lib/utils';\n\nexport const destroyFns: Array<() => void> = [];\n\nexport interface ModalProps {\n open?: boolean;\n onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n afterClose?: () => void;\n title?: React.ReactNode;\n subTitle?: React.ReactNode;\n icon?: React.ReactElement;\n width?: number | string;\n footer?: React.ReactNode | null;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n confirmLoading?: boolean;\n maskClosable?: boolean;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n centered?: boolean;\n destroyOnClose?: boolean;\n className?: string;\n /** Pass through to the modal content root for automated testing. */\n 'data-testid'?: string;\n /** Pass through to the modal content root for accessibility and automated testing. */\n 'aria-label'?: string;\n /** Applied to the outer wrap layer (matches antd wrapClassName behavior) */\n wrapClassName?: string;\n style?: React.CSSProperties;\n bodyStyle?: React.CSSProperties;\n zIndex?: number;\n children?: React.ReactNode;\n paddingLess?: boolean;\n virtualScrollBar?: boolean;\n hideHeaderBottomBorder?: boolean;\n responsiveBounds?: boolean;\n fullscreen?: boolean;\n keyboard?: boolean;\n afterOpenChange?: (open: boolean) => void;\n getContainer?: (() => HTMLElement) | false;\n /** @internal used by static methods to pass modal type for icon styling */\n _modalType?: string;\n}\n\nexport interface ModalFuncProps {\n title?: React.ReactNode;\n subTitle?: React.ReactNode;\n content?: React.ReactNode;\n icon?: React.ReactElement;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n onOk?: (...args: any[]) => any;\n onCancel?: (...args: any[]) => any;\n width?: number | string;\n className?: string;\n /** @deprecated Use `className` instead. Preserved for antd v4 compat. */\n wrapClassName?: string;\n closable?: boolean;\n type?: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm';\n centered?: boolean;\n maskClosable?: boolean;\n}\n\nconst DEFAULT_WIDTH = 552;\n\nconst ModalTitle = (\n { icon, title, subTitle }: Pick<ModalProps, 'icon' | 'title' | 'subTitle'>,\n type?: string,\n) => (\n <div className=\"ald-modal-title-container tw-flex tw-items-center tw-gap-4\">\n {icon && (\n <div\n className={cn(\n 'ald-modal-icon-container tw-grid tw-size-10 tw-shrink-0 tw-place-items-center tw-rounded-[var(--global-grid-250)]',\n type === 'info' &&\n 'ald-modal-cion-info-container tw-bg-[var(--background-informative-muted)]',\n type === 'success' &&\n 'ald-modal-cion-success-container tw-bg-[var(--background-positive-muted)]',\n type === 'warning' &&\n 'ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]',\n type === 'warn' &&\n 'ald-modal-cion-warning-container tw-bg-[var(--background-warning-muted)]',\n type === 'error' &&\n 'ald-modal-cion-error-container tw-bg-[var(--background-negative-muted)]',\n type === 'confirm' &&\n 'ald-modal-cion-confirm-container tw-bg-[var(--background-brand-muted)]',\n )}\n >\n {icon}\n </div>\n )}\n <div className=\"ald-modal-text-container\">\n {title && (\n <div\n className={cn(\n 'ald-modal-text-title tw-text-lg tw-font-semibold tw-leading-7 tw-text-[var(--content-primary)]',\n !subTitle && 'ald-modal-text-title-only tw-text-xl',\n )}\n >\n {title}\n </div>\n )}\n {subTitle && (\n <div className=\"ald-modal-text-sub-title tw-mt-1 tw-text-xs tw-leading-4 tw-text-[var(--content-secondary)]\">\n {subTitle}\n </div>\n )}\n </div>\n </div>\n);\n\nfunction getIcon(\n type: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm',\n) {\n if (type === 'success')\n return (\n <CheckCircleLightLine\n fill=\"var(--content-inverted-primary)\"\n color=\"var(--background-positive-strong)\"\n size={24}\n />\n );\n if (type === 'error')\n return (\n <AttentionTriangleLightLine\n color=\"var(--background-negative-strong)\"\n fill=\"var(--content-inverted-primary)\"\n size={24}\n />\n );\n if (type === 'warning' || type === 'warn')\n return (\n <AttentionTriangleLightLine\n color=\"var(--background-warning-strong)\"\n size={24}\n />\n );\n return (\n <InformationCircleLightLine\n size={24}\n color=\"var(--action-primary-normal)\"\n />\n );\n}\n\nfunction OriginModal(props: ModalProps) {\n const { locale } = useContext(LocaleContext);\n const t = getTranslator(locale);\n const {\n className,\n 'data-testid': dataTestId,\n 'aria-label': ariaLabel,\n children,\n okType = 'primary',\n width,\n closeIcon,\n subTitle,\n okButtonProps = {},\n cancelButtonProps = {},\n okText = t.Modal.sure,\n cancelText = t.Modal.cancel,\n icon,\n title,\n paddingLess,\n responsiveBounds,\n hideHeaderBottomBorder,\n virtualScrollBar,\n style,\n maskClosable = false,\n fullscreen,\n open = false,\n onOk,\n onCancel,\n footer,\n confirmLoading,\n closable = true,\n zIndex = 1000,\n bodyStyle,\n keyboard = true,\n afterOpenChange,\n wrapClassName,\n _modalType,\n } = props;\n\n const prevOpenRef = useRef(open);\n const contentRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (prevOpenRef.current !== open) {\n prevOpenRef.current = open;\n afterOpenChange?.(open);\n }\n }, [open, afterOpenChange]);\n\n // ---- modal={false} 补偿:锁定背景滚动 ----\n useEffect(() => {\n if (!open) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n return () => {\n document.body.style.overflow = prev;\n };\n }, [open]);\n\n // ---- modal={false} 补偿:aria-hidden(屏幕阅读器只感知弹窗) ----\n useEffect(() => {\n if (!open || !contentRef.current) return;\n return hideOthers(contentRef.current);\n }, [open]);\n\n // ---- modal={false} 补偿:Tab 焦点循环 ----\n useEffect(() => {\n if (!open || !contentRef.current) return;\n const container = contentRef.current;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab') return;\n const focusable = container.querySelectorAll<HTMLElement>(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled])',\n );\n if (focusable.length === 0) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (\n document.activeElement === first ||\n !container.contains(document.activeElement)\n ) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (\n document.activeElement === last ||\n !container.contains(document.activeElement)\n ) {\n e.preventDefault();\n first.focus();\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [open]);\n\n const responsiveBoundsStyle = useMemo(() => {\n if (!responsiveBounds) return {};\n return {\n width: 'calc(100% - 160px)',\n maxWidth: '1680px',\n minWidth: '1280px',\n height: 'calc(100% - 48px)',\n maxHeight: '900px',\n minHeight: '640px',\n };\n }, [responsiveBounds]);\n\n const mergedOkProps = { loading: confirmLoading, ...okButtonProps };\n const { maskZIndex, contentZIndex, nextLevel } = useFloatingLayer(zIndex);\n\n const renderFooter = () => {\n if (footer === null) return null;\n if (footer)\n return (\n // antd 兼容:antd .ant-modal-footer 使用 text-align:right 让 inline 按钮右对齐,\n // 即使消费方传入 width:100% 的子容器,内部 inline 元素仍能右对齐。\n // 此处同时使用 tw-flex tw-justify-end(flexbox 对齐)和 tw-text-right(继承式对齐)保持兼容。\n <div className=\"ald-modal-footer ant-modal-footer tw-flex tw-items-center tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--border-default)] tw-bg-[var(--background-default)] tw-px-6 tw-py-3 tw-text-right\">\n {footer}\n </div>\n );\n return (\n <div className=\"ald-modal-footer ant-modal-footer tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-solid tw-border-[var(--border-default)] tw-px-6 tw-py-4\">\n <Button\n type=\"secondary\"\n size=\"middle\"\n {...cancelButtonProps}\n onClick={onCancel}\n >\n {cancelText}\n </Button>\n <Button type={okType} size=\"middle\" {...mergedOkProps} onClick={onOk}>\n {okText}\n </Button>\n </div>\n );\n };\n\n return (\n <DialogPrimitive.Root open={open} modal={false}>\n <DialogPrimitive.Portal>\n {/* modal={false} 时 DialogPrimitive.Overlay 不渲染,用普通 div 替代 */}\n <div\n className=\"ald-modal-mask tw-animate-in tw-fade-in-0 tw-fixed tw-inset-0 tw-bg-[var(--background-inverted)] tw-opacity-45\"\n style={{ zIndex: maskZIndex }}\n onPointerDown={() => {\n if (maskClosable) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n }\n }}\n />\n {/* Centering wrapper — replaces transform centering so consumer CSS (top/left overrides) works */}\n <div\n ref={contentRef}\n className={cn(\n // antd 兼容:保留 ant-modal-wrap class,消费方 CSS 通过 wrapClassName + :global(.ant-modal) 控制弹窗宽高\n 'ald-modal-wrap ant-modal-wrap tw-pointer-events-none tw-fixed tw-inset-0 tw-flex tw-items-center tw-justify-center',\n wrapClassName,\n )}\n style={{ zIndex: contentZIndex }}\n >\n <DialogPrimitive.Content\n data-testid={dataTestId}\n aria-label={ariaLabel}\n className={cn(\n // antd 兼容:保留 ant-modal class,消费方 CSS 通过 .ant-modal 选择器控制弹窗宽高等样式\n // tw-outline-none:Radix 打开时会聚焦 Content,不抑制 outline 会渲染出蓝色焦点框\n 'ald-modal ant-modal tw-pointer-events-auto tw-box-border tw-flex tw-flex-col tw-overflow-hidden tw-bg-[var(--background-default)] tw-shadow-[var(--elevation-bottom-bottom-lg)] tw-outline-none',\n fullscreen\n ? 'ald-modal-fullscreen tw-fixed tw-inset-0 tw-size-full tw-rounded-none'\n : 'tw-rounded-r-75',\n !fullscreen &&\n 'tw-border tw-border-solid tw-border-[var(--border-default)]',\n paddingLess && 'ald-modal-padding-less',\n virtualScrollBar && 'ald-modal-virtual-scroll-bar',\n hideHeaderBottomBorder && 'ald-modal-hide-header-bottom-border',\n responsiveBounds && 'ald-modal-responsive-bounds',\n className,\n )}\n style={{\n ...(fullscreen\n ? {}\n : {\n width: responsiveBounds\n ? responsiveBoundsStyle.width\n : width || DEFAULT_WIDTH,\n ...responsiveBoundsStyle,\n }),\n ...style,\n }}\n onEscapeKeyDown={(e) => {\n if (keyboard) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n } else {\n e.preventDefault();\n }\n }}\n onPointerDownOutside={(e) => {\n if (maskClosable) {\n onCancel?.({} as React.MouseEvent<HTMLButtonElement>);\n } else {\n e.preventDefault();\n }\n }}\n onInteractOutside={(e) => {\n if (!maskClosable) {\n e.preventDefault();\n }\n }}\n >\n {/* ant-modal-content compat wrapper — matches antd DOM nesting for consumer CSS */}\n <div className=\"ant-modal-content tw-flex tw-h-full tw-flex-col\">\n <FloatingLayerProvider value={nextLevel}>\n {!fullscreen && (\n <div\n className={cn(\n 'ald-modal-header ant-modal-header tw-flex tw-items-start tw-justify-between tw-bg-[var(--background-default)] tw-px-6 tw-py-4',\n !hideHeaderBottomBorder &&\n 'tw-border-b tw-border-solid tw-border-[var(--border-default)]',\n )}\n >\n <DialogPrimitive.Title asChild>\n <div className=\"tw-flex-1\">\n {ModalTitle({ icon, title, subTitle }, _modalType)}\n </div>\n </DialogPrimitive.Title>\n {closable && (\n <DialogPrimitive.Close asChild>\n <span className=\"ant-modal-close\" onClick={onCancel}>\n {closeIcon || (\n <IconButton\n icon={<CloseLLine size={20} />}\n size=\"middle\"\n />\n )}\n </span>\n </DialogPrimitive.Close>\n )}\n </div>\n )}\n {/* Hidden title for accessibility when fullscreen hides the header */}\n {fullscreen && (\n <DialogPrimitive.Title className=\"tw-sr-only\">\n {title}\n </DialogPrimitive.Title>\n )}\n <div\n className={cn(\n 'ald-modal-body ant-modal-body tw-flex-1 tw-text-sm tw-leading-5',\n fullscreen\n ? 'tw-h-full tw-overflow-auto tw-p-0'\n : 'tw-min-h-[130px]',\n !fullscreen &&\n (virtualScrollBar\n ? 'tw-overflow-hidden tw-p-0'\n : 'tw-overflow-auto'),\n !fullscreen &&\n !responsiveBounds &&\n !virtualScrollBar &&\n 'tw-max-h-[68vh]',\n !fullscreen &&\n !paddingLess &&\n !virtualScrollBar &&\n 'tw-p-6',\n )}\n style={bodyStyle}\n >\n {virtualScrollBar ? (\n <ScrollArea\n className=\"ald-modal-body-wrap !tw-h-auto\"\n innerClassName={cn(\n 'ald-modal-body-wrap-inner tw-max-h-[68vh]',\n paddingLess ? 'tw-p-0' : 'tw-px-[23px] tw-py-0',\n )}\n >\n {children}\n </ScrollArea>\n ) : (\n children\n )}\n </div>\n {!fullscreen && renderFooter()}\n </FloatingLayerProvider>\n </div>\n </DialogPrimitive.Content>\n </div>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n\n// Static method helper\nfunction createStaticModal(\n type: ModalFuncProps['type'],\n props: ModalFuncProps,\n) {\n const container = document.createElement('div');\n document.body.appendChild(container);\n const root = createRoot(container);\n\n let currentProps = { ...props };\n\n const destroy = () => {\n root.unmount();\n container.remove();\n const idx = destroyFns.indexOf(destroy);\n if (idx >= 0) destroyFns.splice(idx, 1);\n };\n\n const update = (newProps: Partial<ModalFuncProps>) => {\n currentProps = { ...currentProps, ...newProps };\n render(currentProps);\n };\n\n const isConfirm = type === 'confirm';\n\n const render = (p: ModalFuncProps) => {\n const handleOk = () => {\n p.onOk?.();\n destroy();\n };\n const handleCancel = () => {\n p.onCancel?.();\n destroy();\n };\n\n root.render(\n <OriginModal\n open={true}\n title={p.title}\n subTitle={p.subTitle}\n icon={p.icon || getIcon(type || 'info')}\n onOk={handleOk}\n onCancel={handleCancel}\n okText={p.okText}\n cancelText={p.cancelText}\n okButtonProps={p.okButtonProps}\n cancelButtonProps={p.cancelButtonProps}\n okType={p.okType || (isConfirm ? 'dangerous' : 'primary')}\n width={p.width || DEFAULT_WIDTH}\n className={cn('ald-modal', p.className)}\n closable={p.closable}\n maskClosable={p.maskClosable}\n _modalType={type}\n footer={\n isConfirm ? undefined : (\n <Button\n type=\"primary\"\n size=\"middle\"\n {...(p.okButtonProps || {})}\n onClick={handleOk}\n >\n {p.okText || 'OK'}\n </Button>\n )\n }\n >\n {p.content}\n </OriginModal>,\n );\n };\n\n destroyFns.push(destroy);\n render(currentProps);\n\n return { destroy, update };\n}\n\n// Attach static methods\ntype ModalFunc = (props: ModalFuncProps) => {\n destroy: () => void;\n update: (props: Partial<ModalFuncProps>) => void;\n};\n\n// ---------- useModal hook ----------\n\ninterface ModalInstance {\n id: number;\n type: ModalFuncProps['type'];\n props: ModalFuncProps;\n open: boolean;\n}\n\nexport interface ModalApiInstance {\n destroy: () => void;\n update: (newProps: Partial<ModalFuncProps>) => void;\n}\n\nexport interface ModalStaticFunctions {\n info: (props: ModalFuncProps) => ModalApiInstance;\n success: (props: ModalFuncProps) => ModalApiInstance;\n error: (props: ModalFuncProps) => ModalApiInstance;\n warning: (props: ModalFuncProps) => ModalApiInstance;\n confirm: (props: ModalFuncProps) => ModalApiInstance;\n}\n\nfunction useModal(): [ModalStaticFunctions, React.ReactElement] {\n const [modals, setModals] = useState<ModalInstance[]>([]);\n const idCounter = useRef(0);\n\n const removeModal = useCallback((id: number) => {\n setModals((prev) =>\n prev.map((m) => (m.id === id ? { ...m, open: false } : m)),\n );\n // Remove from DOM after animation\n setTimeout(() => {\n setModals((prev) => prev.filter((m) => m.id !== id));\n }, 300);\n }, []);\n\n const updateModal = useCallback(\n (id: number, newProps: Partial<ModalFuncProps>) => {\n setModals((prev) =>\n prev.map((m) =>\n m.id === id ? { ...m, props: { ...m.props, ...newProps } } : m,\n ),\n );\n },\n [],\n );\n\n const openModal = useCallback(\n (type: ModalFuncProps['type'], props: ModalFuncProps): ModalApiInstance => {\n const id = ++idCounter.current;\n const instance: ModalInstance = { id, type, props, open: true };\n setModals((prev) => [...prev, instance]);\n\n return {\n destroy: () => removeModal(id),\n update: (newProps: Partial<ModalFuncProps>) =>\n updateModal(id, newProps),\n };\n },\n [removeModal, updateModal],\n );\n\n const api = useMemo<ModalStaticFunctions>(\n () => ({\n info: (props) => openModal('info', props),\n success: (props) => openModal('success', props),\n error: (props) => openModal('error', props),\n warning: (props) => openModal('warning', props),\n confirm: (props) =>\n openModal('confirm', { ...props, type: props.type || 'confirm' }),\n }),\n [openModal],\n );\n\n const contextHolder = (\n <>\n {modals.map((m) => {\n const isConfirmType = m.type === 'confirm';\n const handleOk = () => {\n m.props.onOk?.();\n removeModal(m.id);\n };\n const handleCancel = () => {\n m.props.onCancel?.();\n removeModal(m.id);\n };\n return (\n <OriginModal\n key={m.id}\n open={m.open}\n title={m.props.title}\n subTitle={m.props.subTitle}\n icon={m.props.icon || getIcon(m.type || 'info')}\n onOk={handleOk}\n onCancel={handleCancel}\n okText={m.props.okText}\n cancelText={m.props.cancelText}\n okButtonProps={m.props.okButtonProps}\n cancelButtonProps={m.props.cancelButtonProps}\n okType={m.props.okType || (isConfirmType ? 'dangerous' : 'primary')}\n width={m.props.width || DEFAULT_WIDTH}\n className={cn('ald-modal', m.props.className)}\n closable={m.props.closable}\n maskClosable={m.props.maskClosable}\n _modalType={m.type}\n footer={\n isConfirmType ? undefined : (\n <Button\n type=\"primary\"\n size=\"middle\"\n {...(m.props.okButtonProps || {})}\n onClick={handleOk}\n >\n {m.props.okText || 'OK'}\n </Button>\n )\n }\n >\n {m.props.content}\n </OriginModal>\n );\n })}\n </>\n );\n\n return [api, contextHolder];\n}\n\n// ---------- end useModal ----------\n\nconst Modal = OriginModal as typeof OriginModal & {\n info: ModalFunc;\n success: ModalFunc;\n error: ModalFunc;\n warning: ModalFunc;\n confirm: ModalFunc;\n destroyAll: () => void;\n useModal: typeof useModal;\n config: (config: any) => void;\n};\n\nModal.info = (props) => createStaticModal('info', props);\nModal.success = (props) => createStaticModal('success', props);\nModal.error = (props) => createStaticModal('error', props);\nModal.warning = (props) => createStaticModal('warning', props);\nModal.confirm = (props) =>\n createStaticModal('confirm', { ...props, type: props.type || 'confirm' });\n\nModal.destroyAll = () => {\n while (destroyFns.length) {\n const close = destroyFns.pop();\n if (close) close();\n }\n};\n\nModal.useModal = useModal;\nModal.config = () => {};\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAa,aAAgC,EAAE;AAoE/C,IAAM,gBAAgB;AAEtB,IAAM,cACJ,EAAE,MAAM,OAAO,YACf,SAEA,qBAAC,OAAD;CAAK,WAAU;WAAf,CACG,QACC,oBAAC,OAAD;EACE,WAAW,GACT,qHACA,SAAS,UACP,6EACF,SAAS,aACP,6EACF,SAAS,aACP,4EACF,SAAS,UACP,4EACF,SAAS,WACP,2EACF,SAAS,aACP,yEACH;YAEA;EACG,CAAA,EAER,qBAAC,OAAD;EAAK,WAAU;YAAf,CACG,SACC,oBAAC,OAAD;GACE,WAAW,GACT,kGACA,CAAC,YAAY,uCACd;aAEA;GACG,CAAA,EAEP,YACC,oBAAC,OAAD;GAAK,WAAU;aACZ;GACG,CAAA,CAEJ;IACF;;AAGR,SAAS,QACP,MACA;AACA,KAAI,SAAS,UACX,QACE,oBAAC,QAAD;EACE,MAAK;EACL,OAAM;EACN,MAAM;EACN,CAAA;AAEN,KAAI,SAAS,QACX,QACE,oBAAC,MAAD;EACE,OAAM;EACN,MAAK;EACL,MAAM;EACN,CAAA;AAEN,KAAI,SAAS,aAAa,SAAS,OACjC,QACE,oBAAC,MAAD;EACE,OAAM;EACN,MAAM;EACN,CAAA;AAEN,QACE,oBAAC,QAAD;EACE,MAAM;EACN,OAAM;EACN,CAAA;;AAIN,SAAS,YAAY,OAAmB;CACtC,MAAM,EAAE,WAAW,WAAW,cAAc;CAC5C,MAAM,IAAI,cAAc,OAAO;CAC/B,MAAM,EACJ,WAC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tw-flex-1",
104
104
  children: [/* @__PURE__ */ jsx("div", {
105
- className: "tw-mb-2 tw-break-all tw-text-xs tw-leading-4 tw-text-[var(--alias-colors-text-default)]",
105
+ className: "tw-mb-2 tw-break-all tw-text-xs tw-leading-4 tw-text-[var(--content-primary)]",
106
106
  children: title
107
107
  }), /* @__PURE__ */ jsxs("div", {
108
108
  className: "tw-flex tw-justify-end tw-gap-2",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/Popconfirm/index.tsx"],"sourcesContent":["import * as PopoverPrimitive from '@radix-ui/react-popover';\nimport React, { useState } from 'react';\nimport Button, { ButtonType, IButtonProps } from '../Button';\nimport { AttentionTriangleFill } from '../Icon';\nimport { useFloatingPopupZIndex } from '../_utils/floatingLayer';\nimport { cn } from '../lib/utils';\n\nexport interface PopconfirmProps {\n title?: React.ReactNode;\n onConfirm?: (e?: React.MouseEvent) => void;\n onCancel?: (e?: React.MouseEvent) => void;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n icon?: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n placement?:\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'topLeft'\n | 'topRight'\n | 'bottomLeft'\n | 'bottomRight'\n | 'leftTop'\n | 'leftBottom'\n | 'rightTop'\n | 'rightBottom';\n rootClassName?: string;\n className?: string;\n overlayClassName?: string;\n getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;\n children?: React.ReactNode;\n disabled?: boolean;\n}\n\nconst sideMap: Record<string, PopoverPrimitive.PopoverContentProps['side']> = {\n top: 'top',\n bottom: 'bottom',\n left: 'left',\n right: 'right',\n topLeft: 'top',\n topRight: 'top',\n bottomLeft: 'bottom',\n bottomRight: 'bottom',\n leftTop: 'left',\n leftBottom: 'left',\n rightTop: 'right',\n rightBottom: 'right',\n};\n\nconst alignMap: Record<string, PopoverPrimitive.PopoverContentProps['align']> =\n {\n topLeft: 'start',\n topRight: 'end',\n bottomLeft: 'start',\n bottomRight: 'end',\n leftTop: 'start',\n leftBottom: 'end',\n rightTop: 'start',\n rightBottom: 'end',\n };\n\nfunction Popconfirm(props: PopconfirmProps) {\n const {\n title,\n onConfirm,\n onCancel,\n okText = 'OK',\n cancelText = 'Cancel',\n okButtonProps = {},\n cancelButtonProps = {},\n okType = 'dangerous',\n icon = (\n <AttentionTriangleFill\n size={16}\n color=\"var(--action-destructive-normal)\"\n fill=\"var(--action-inverted-normal)\"\n />\n ),\n open: controlledOpen,\n onOpenChange,\n placement = 'top',\n rootClassName,\n overlayClassName,\n getPopupContainer,\n children,\n disabled,\n } = props;\n\n const [innerOpen, setInnerOpen] = useState(false);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const getPopupContainerRef = React.useRef(getPopupContainer);\n const lastGetPopupContainerRef = React.useRef(getPopupContainer);\n const [popupContainer, setPopupContainer] = useState<\n HTMLElement | undefined\n >();\n getPopupContainerRef.current = getPopupContainer;\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : innerOpen;\n const mergedOpen = disabled ? false : isOpen;\n const updatePopupContainer = React.useCallback((node: HTMLElement | null) => {\n const nextContainer =\n node && getPopupContainerRef.current\n ? getPopupContainerRef.current(node)\n : undefined;\n setPopupContainer((prevContainer) =>\n prevContainer === nextContainer ? prevContainer : nextContainer,\n );\n }, []);\n const setTriggerNode = React.useCallback(\n (node: HTMLElement | null) => {\n if (!node) return;\n if (triggerRef.current === node) return;\n triggerRef.current = node;\n updatePopupContainer(node);\n },\n [updatePopupContainer],\n );\n\n React.useEffect(() => {\n if (lastGetPopupContainerRef.current === getPopupContainer) return;\n lastGetPopupContainerRef.current = getPopupContainer;\n updatePopupContainer(triggerRef.current);\n }, [getPopupContainer, updatePopupContainer]);\n\n const handleOpenChange = (val: boolean) => {\n if (disabled) return;\n if (!isControlled) setInnerOpen(val);\n onOpenChange?.(val);\n };\n\n const handleConfirm = (e?: React.MouseEvent) => {\n onConfirm?.(e);\n handleOpenChange(false);\n };\n\n const handleCancel = (e?: React.MouseEvent) => {\n onCancel?.(e);\n handleOpenChange(false);\n };\n\n const side = sideMap[placement] || 'top';\n const align = alignMap[placement] || 'center';\n const popupZIndex = useFloatingPopupZIndex();\n const triggerChild = React.isValidElement(children) ? (\n children\n ) : (\n <span>{children}</span>\n );\n\n return (\n <PopoverPrimitive.Root open={mergedOpen} onOpenChange={handleOpenChange}>\n <PopoverPrimitive.Trigger asChild ref={setTriggerNode}>\n {triggerChild}\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal container={popupContainer}>\n <PopoverPrimitive.Content\n side={side}\n align={align}\n sideOffset={4}\n className={cn(\n 'ald-pop-confirm tw-z-50 tw-w-[240px] tw-rounded-[6px] tw-border tw-border-solid tw-border-[var(--border-default-alpha)] tw-bg-[var(--background-default)] tw-p-3 tw-outline-none',\n rootClassName,\n overlayClassName,\n )}\n style={{\n zIndex: popupZIndex,\n boxShadow: 'var(--elevation-bottom-bottom-md)',\n }}\n >\n <div className=\"tw-flex tw-gap-2\">\n {icon && <span className=\"tw-mt-0.5 tw-shrink-0\">{icon}</span>}\n <div className=\"tw-flex-1\">\n <div className=\"tw-mb-2 tw-break-all tw-text-xs tw-leading-4 tw-text-[var(--alias-colors-text-default)]\">\n {title}\n </div>\n <div className=\"tw-flex tw-justify-end tw-gap-2\">\n <Button\n type=\"secondary\"\n size=\"small\"\n {...cancelButtonProps}\n onClick={handleCancel}\n >\n {cancelText}\n </Button>\n <Button\n type={okType}\n size=\"small\"\n {...okButtonProps}\n onClick={handleConfirm}\n >\n {okText}\n </Button>\n </div>\n </div>\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n\nexport default Popconfirm;\n"],"mappings":";;;;;;;;AAwCA,IAAM,UAAwE;CAC5E,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;CACP,S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AE7C,MAAM,oBAAoB,QAAiB;AACzC,MAAI,SAAU;AACd,MAAI,CAAC,aAAc,cAAa,IAAI;AACpC,iBAAe,IAAI;;CAGrB,MAAM,iBAAiB,MAAyB;AAC9C,cAAY,EAAE;AACd,mBAAiB,MAAM;;CAGzB,MAAM,gBAAgB,MAAyB;AAC7C,aAAW,EAAE;AACb,mBAAiB,MAAM;;CAGzB,MAAM,OAAO,QAAQ,cAAc;CACnC,MAAM,QAAQ,SAAS,cAAc;CACrC,MAAM,cAAc,wBAAwB;CAC5C,MAAM,eAAe,MAAM,eAAe,SAAS,GACjD,WAEA,oBAAC,QAAD,EAAO,UAAgB,CAAA;AAGzB,QACE,qBAAC,iBAAiB,MAAlB;EAAuB,MAAM;EAAY,cAAc;YAAvD,CACE,oBAAC,iBAAiB,SAAlB;GAA0B,SAAA;GAAQ,KAAK;aACpC;GACwB,CAAA,EAC3B,oBAAC,iBAAiB,QAAlB;GAAyB,WAAW;aAClC,oBAAC,iBAAiB,SAAlB;IACQ;IACC;IACP,YAAY;IACZ,WAAW,GACT,oLACA,eACA,iBACD;IACD,OAAO;KACL,QAAQ;KACR,WAAW;KACZ;cAED,qBAAC,OAAD;KAAK,WAAU;eAAf,CACG,QAAQ,oBAAC,QAAD;MAAM,WAAU;gBAAyB;MAAY,CAAA,EAC9D,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,oBAAC,OAAD;OAAK,WAAU;iBACZ;OACG,CAAA,EACN,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,gBAAD;QACE,MAAK;QACL,MAAK;QACL,GAAI;QACJ,SAAS;kBAER;QACM,CAAA,EACT,oBAAC,gBAAD;QACE,MAAM;QACN,MAAK;QACL,GAAI;QACJ,SAAS;kBAER;QACM,CAAA,CACL;SACF;QACF;;IACmB,CAAA;GACH,CAAA,CACJ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/Popconfirm/index.tsx"],"sourcesContent":["import * as PopoverPrimitive from '@radix-ui/react-popover';\nimport React, { useState } from 'react';\nimport Button, { ButtonType, IButtonProps } from '../Button';\nimport { AttentionTriangleFill } from '../Icon';\nimport { useFloatingPopupZIndex } from '../_utils/floatingLayer';\nimport { cn } from '../lib/utils';\n\nexport interface PopconfirmProps {\n title?: React.ReactNode;\n onConfirm?: (e?: React.MouseEvent) => void;\n onCancel?: (e?: React.MouseEvent) => void;\n okText?: React.ReactNode;\n cancelText?: React.ReactNode;\n okButtonProps?: IButtonProps;\n cancelButtonProps?: IButtonProps;\n okType?: ButtonType;\n icon?: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n placement?:\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'topLeft'\n | 'topRight'\n | 'bottomLeft'\n | 'bottomRight'\n | 'leftTop'\n | 'leftBottom'\n | 'rightTop'\n | 'rightBottom';\n rootClassName?: string;\n className?: string;\n overlayClassName?: string;\n getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;\n children?: React.ReactNode;\n disabled?: boolean;\n}\n\nconst sideMap: Record<string, PopoverPrimitive.PopoverContentProps['side']> = {\n top: 'top',\n bottom: 'bottom',\n left: 'left',\n right: 'right',\n topLeft: 'top',\n topRight: 'top',\n bottomLeft: 'bottom',\n bottomRight: 'bottom',\n leftTop: 'left',\n leftBottom: 'left',\n rightTop: 'right',\n rightBottom: 'right',\n};\n\nconst alignMap: Record<string, PopoverPrimitive.PopoverContentProps['align']> =\n {\n topLeft: 'start',\n topRight: 'end',\n bottomLeft: 'start',\n bottomRight: 'end',\n leftTop: 'start',\n leftBottom: 'end',\n rightTop: 'start',\n rightBottom: 'end',\n };\n\nfunction Popconfirm(props: PopconfirmProps) {\n const {\n title,\n onConfirm,\n onCancel,\n okText = 'OK',\n cancelText = 'Cancel',\n okButtonProps = {},\n cancelButtonProps = {},\n okType = 'dangerous',\n icon = (\n <AttentionTriangleFill\n size={16}\n color=\"var(--action-destructive-normal)\"\n fill=\"var(--action-inverted-normal)\"\n />\n ),\n open: controlledOpen,\n onOpenChange,\n placement = 'top',\n rootClassName,\n overlayClassName,\n getPopupContainer,\n children,\n disabled,\n } = props;\n\n const [innerOpen, setInnerOpen] = useState(false);\n const triggerRef = React.useRef<HTMLElement | null>(null);\n const getPopupContainerRef = React.useRef(getPopupContainer);\n const lastGetPopupContainerRef = React.useRef(getPopupContainer);\n const [popupContainer, setPopupContainer] = useState<\n HTMLElement | undefined\n >();\n getPopupContainerRef.current = getPopupContainer;\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : innerOpen;\n const mergedOpen = disabled ? false : isOpen;\n const updatePopupContainer = React.useCallback((node: HTMLElement | null) => {\n const nextContainer =\n node && getPopupContainerRef.current\n ? getPopupContainerRef.current(node)\n : undefined;\n setPopupContainer((prevContainer) =>\n prevContainer === nextContainer ? prevContainer : nextContainer,\n );\n }, []);\n const setTriggerNode = React.useCallback(\n (node: HTMLElement | null) => {\n if (!node) return;\n if (triggerRef.current === node) return;\n triggerRef.current = node;\n updatePopupContainer(node);\n },\n [updatePopupContainer],\n );\n\n React.useEffect(() => {\n if (lastGetPopupContainerRef.current === getPopupContainer) return;\n lastGetPopupContainerRef.current = getPopupContainer;\n updatePopupContainer(triggerRef.current);\n }, [getPopupContainer, updatePopupContainer]);\n\n const handleOpenChange = (val: boolean) => {\n if (disabled) return;\n if (!isControlled) setInnerOpen(val);\n onOpenChange?.(val);\n };\n\n const handleConfirm = (e?: React.MouseEvent) => {\n onConfirm?.(e);\n handleOpenChange(false);\n };\n\n const handleCancel = (e?: React.MouseEvent) => {\n onCancel?.(e);\n handleOpenChange(false);\n };\n\n const side = sideMap[placement] || 'top';\n const align = alignMap[placement] || 'center';\n const popupZIndex = useFloatingPopupZIndex();\n const triggerChild = React.isValidElement(children) ? (\n children\n ) : (\n <span>{children}</span>\n );\n\n return (\n <PopoverPrimitive.Root open={mergedOpen} onOpenChange={handleOpenChange}>\n <PopoverPrimitive.Trigger asChild ref={setTriggerNode}>\n {triggerChild}\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal container={popupContainer}>\n <PopoverPrimitive.Content\n side={side}\n align={align}\n sideOffset={4}\n className={cn(\n 'ald-pop-confirm tw-z-50 tw-w-[240px] tw-rounded-[6px] tw-border tw-border-solid tw-border-[var(--border-default-alpha)] tw-bg-[var(--background-default)] tw-p-3 tw-outline-none',\n rootClassName,\n overlayClassName,\n )}\n style={{\n zIndex: popupZIndex,\n boxShadow: 'var(--elevation-bottom-bottom-md)',\n }}\n >\n <div className=\"tw-flex tw-gap-2\">\n {icon && <span className=\"tw-mt-0.5 tw-shrink-0\">{icon}</span>}\n <div className=\"tw-flex-1\">\n <div className=\"tw-mb-2 tw-break-all tw-text-xs tw-leading-4 tw-text-[var(--content-primary)]\">\n {title}\n </div>\n <div className=\"tw-flex tw-justify-end tw-gap-2\">\n <Button\n type=\"secondary\"\n size=\"small\"\n {...cancelButtonProps}\n onClick={handleCancel}\n >\n {cancelText}\n </Button>\n <Button\n type={okType}\n size=\"small\"\n {...okButtonProps}\n onClick={handleConfirm}\n >\n {okText}\n </Button>\n </div>\n </div>\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n\nexport default Popconfirm;\n"],"mappings":";;;;;;;;AAwCA,IAAM,UAAwE;CAC5E,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;CACP,SAAS;CACT,UAAU;CACV,YAAY;CACZ,aAAa;CACb,SAAS;CACT,YAAY;CACZ,UAAU;CACV,aAAa;CACd;AAED,IAAM,WACJ;CACE,SAAS;CACT,UAAU;CACV,YAAY;CACZ,aAAa;CACb,SAAS;CACT,YAAY;CACZ,UAAU;CACV,aAAa;CACd;AAEH,SAAS,WAAW,OAAwB;CAC1C,MAAM,EACJ,OACA,WACA,UACA,SAAS,MACT,aAAa,UACb,gBAAgB,EAAE,EAClB,oBAAoB,EAAE,EACtB,SAAS,aACT,OACE,oBAAC,MAAD;EACE,MAAM;E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