antdv-next 1.5.5 → 1.6.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 (164) hide show
  1. package/dist/_util/PurePanel.js +17 -14
  2. package/dist/_util/fallbackProp.d.ts +13 -0
  3. package/dist/_util/fallbackProp.js +15 -0
  4. package/dist/_util/hooks/useAllowClear.d.ts +19 -0
  5. package/dist/_util/hooks/useAllowClear.js +16 -0
  6. package/dist/_util/hooks/useMergeSemantic.js +3 -2
  7. package/dist/_util/omitUndefined.d.ts +13 -0
  8. package/dist/_util/omitUndefined.js +20 -0
  9. package/dist/_util/statusUtils.d.ts +1 -1
  10. package/dist/_util/vueNode.d.ts +2 -6
  11. package/dist/_util/wave/index.js +4 -2
  12. package/dist/_util/wave/style.d.ts +5 -1
  13. package/dist/_util/wave/useWave.d.ts +2 -1
  14. package/dist/_util/wave/useWave.js +4 -3
  15. package/dist/affix/style/index.d.ts +5 -1
  16. package/dist/alert/Alert.d.ts +6 -2
  17. package/dist/alert/Alert.js +131 -128
  18. package/dist/alert/style/index.d.ts +4 -1
  19. package/dist/alert/style/index.js +9 -6
  20. package/dist/anchor/style/index.d.ts +5 -1
  21. package/dist/antd-with-locales.esm.js +18451 -15882
  22. package/dist/antd-with-locales.js +80 -80
  23. package/dist/antd.css +1 -1
  24. package/dist/antd.esm.js +17338 -14784
  25. package/dist/antd.js +94 -94
  26. package/dist/app/style/index.d.ts +5 -1
  27. package/dist/avatar/style/index.d.ts +5 -1
  28. package/dist/badge/index.js +1 -1
  29. package/dist/badge/style/index.d.ts +5 -1
  30. package/dist/badge/style/index.js +2 -9
  31. package/dist/badge/style/ribbon.d.ts +5 -1
  32. package/dist/border-beam/style/index.d.ts +5 -1
  33. package/dist/breadcrumb/BreadcrumbItem.js +1 -1
  34. package/dist/breadcrumb/style/index.d.ts +5 -1
  35. package/dist/button/style/index.d.ts +5 -1
  36. package/dist/calendar/style/index.d.ts +4 -1
  37. package/dist/card/Card.js +1 -1
  38. package/dist/card/style/index.d.ts +5 -1
  39. package/dist/carousel/index.js +1 -1
  40. package/dist/carousel/style/index.d.ts +5 -1
  41. package/dist/carousel/style/index.js +1 -1
  42. package/dist/cascader/index.js +3 -2
  43. package/dist/cascader/style/index.d.ts +5 -1
  44. package/dist/cascader/style/panel.d.ts +5 -1
  45. package/dist/checkbox/style/index.d.ts +4 -1
  46. package/dist/collapse/Collapse.d.ts +2 -0
  47. package/dist/collapse/Collapse.js +5 -2
  48. package/dist/collapse/style/index.d.ts +4 -1
  49. package/dist/color-picker/ColorPicker.js +7 -11
  50. package/dist/color-picker/style/index.d.ts +5 -1
  51. package/dist/components.d.ts +2 -2
  52. package/dist/config-provider/context.d.ts +16 -21
  53. package/dist/config-provider/context.js +32 -38
  54. package/dist/config-provider/define.d.ts +3 -1
  55. package/dist/config-provider/hooks/useCSSVarCls.d.ts +3 -0
  56. package/dist/config-provider/hooks/useCSSVarCls.js +4 -3
  57. package/dist/config-provider/index.d.ts +2 -2
  58. package/dist/config-provider/index.js +24 -1
  59. package/dist/date-picker/generatePicker/generateRangePicker.js +10 -3
  60. package/dist/date-picker/generatePicker/generateSinglePicker.js +13 -5
  61. package/dist/date-picker/generatePicker/useComponents.d.ts +3 -3
  62. package/dist/date-picker/style/index.d.ts +5 -1
  63. package/dist/date-picker/util.d.ts +8 -12
  64. package/dist/date-picker/util.js +14 -7
  65. package/dist/descriptions/Cell.js +80 -75
  66. package/dist/descriptions/Row.js +14 -11
  67. package/dist/descriptions/hooks/useItems.d.ts +6 -6
  68. package/dist/descriptions/style/index.d.ts +5 -1
  69. package/dist/divider/style/index.d.ts +5 -1
  70. package/dist/drawer/DrawerPanel.js +6 -6
  71. package/dist/drawer/index.d.ts +0 -2
  72. package/dist/drawer/index.js +0 -1
  73. package/dist/drawer/style/index.d.ts +5 -1
  74. package/dist/dropdown/dropdown.js +2 -1
  75. package/dist/dropdown/style/index.d.ts +5 -1
  76. package/dist/empty/style/index.d.ts +5 -1
  77. package/dist/flex/index.js +1 -1
  78. package/dist/flex/style/index.d.ts +5 -1
  79. package/dist/float-button/FloatButtonGroup.js +1 -1
  80. package/dist/float-button/style/index.d.ts +5 -1
  81. package/dist/form/FormItem/index.js +36 -16
  82. package/dist/form/context.d.ts +1 -1
  83. package/dist/form/hooks/useVariant.d.ts +1 -1
  84. package/dist/form/style/index.d.ts +5 -1
  85. package/dist/grid/style/index.d.ts +5 -2
  86. package/dist/image/hooks/usePreviewConfig.d.ts +5 -5
  87. package/dist/image/style/index.d.ts +4 -1
  88. package/dist/index.d.ts +2 -2
  89. package/dist/input/style/index.d.ts +5 -2
  90. package/dist/input/style/otp.d.ts +5 -1
  91. package/dist/input/style/search.d.ts +5 -1
  92. package/dist/input/style/textarea.d.ts +5 -1
  93. package/dist/input-number/style/index.d.ts +5 -1
  94. package/dist/layout/style/index.d.ts +5 -1
  95. package/dist/layout/style/sider.d.ts +5 -1
  96. package/dist/listy/style/index.d.ts +5 -1
  97. package/dist/locale/useLocale.d.ts +1 -1
  98. package/dist/masonry/style/index.d.ts +4 -1
  99. package/dist/mentions/index.js +1 -1
  100. package/dist/mentions/style/index.d.ts +5 -1
  101. package/dist/menu/MenuItem.js +2 -1
  102. package/dist/menu/index.d.ts +2 -2
  103. package/dist/message/style/index.d.ts +5 -1
  104. package/dist/modal/style/index.d.ts +3 -1
  105. package/dist/notification/style/index.d.ts +4 -1
  106. package/dist/package.js +1 -1
  107. package/dist/pagination/style/index.d.ts +5 -1
  108. package/dist/popconfirm/style/index.d.ts +5 -1
  109. package/dist/popover/index.js +4 -3
  110. package/dist/popover/style/index.d.ts +5 -1
  111. package/dist/progress/style/index.d.ts +5 -1
  112. package/dist/qrcode/index.js +0 -21
  113. package/dist/qrcode/interface.d.ts +1 -1
  114. package/dist/qrcode/style/index.d.ts +5 -1
  115. package/dist/radio/style/index.d.ts +5 -1
  116. package/dist/rate/style/index.d.ts +5 -1
  117. package/dist/result/style/index.d.ts +5 -1
  118. package/dist/segmented/style/index.d.ts +5 -1
  119. package/dist/select/index.js +2 -2
  120. package/dist/select/style/index.d.ts +5 -1
  121. package/dist/skeleton/style/index.d.ts +5 -1
  122. package/dist/slider/style/index.d.ts +5 -1
  123. package/dist/space/Compact.d.ts +1 -1
  124. package/dist/space/style/addon.d.ts +5 -1
  125. package/dist/space/style/compact.d.ts +5 -1
  126. package/dist/space/style/index.d.ts +5 -1
  127. package/dist/spin/style/index.d.ts +5 -1
  128. package/dist/splitter/style/index.d.ts +5 -1
  129. package/dist/statistic/style/index.d.ts +5 -1
  130. package/dist/steps/style/index.d.ts +5 -1
  131. package/dist/switch/style/index.d.ts +5 -1
  132. package/dist/table/InternalTable.js +52 -48
  133. package/dist/table/hooks/useSelection.js +19 -6
  134. package/dist/table/style/index.d.ts +5 -1
  135. package/dist/table/style/selection.js +1 -1
  136. package/dist/table/util.d.ts +1 -1
  137. package/dist/tabs/style/index.d.ts +5 -1
  138. package/dist/tag/CheckableTagGroup.d.ts +2 -2
  139. package/dist/tag/hooks/useColor.d.ts +1 -1
  140. package/dist/tag/style/index.d.ts +5 -1
  141. package/dist/theme/context.js +2 -1
  142. package/dist/theme/useToken.d.ts +6 -2
  143. package/dist/theme/useToken.js +46 -14
  144. package/dist/theme/util/genStyleUtils.d.ts +13 -3
  145. package/dist/theme/util/genStyleUtils.js +42 -28
  146. package/dist/timeline/style/index.d.ts +5 -1
  147. package/dist/timeline/useItems.d.ts +2 -2
  148. package/dist/timeline/useItems.js +1 -1
  149. package/dist/tooltip/index.js +1 -1
  150. package/dist/tooltip/style/index.d.ts +2 -2
  151. package/dist/tour/style/index.d.ts +5 -1
  152. package/dist/transfer/Transfer.js +2 -0
  153. package/dist/transfer/style/index.d.ts +5 -1
  154. package/dist/tree/DirectoryTree.js +1 -1
  155. package/dist/tree/style/index.d.ts +4 -1
  156. package/dist/tree-select/index.js +1 -1
  157. package/dist/tree-select/style/index.d.ts +2 -2
  158. package/dist/typography/style/index.d.ts +5 -1
  159. package/dist/upload/style/index.d.ts +5 -1
  160. package/dist/version/token.json +1 -1
  161. package/global.d.ts +5 -0
  162. package/package.json +13 -13
  163. package/web-tags.json +4973 -2984
  164. package/web-types.json +13140 -7396
@@ -82,21 +82,24 @@ function genPurePanel(Component, alignPropName, postProps, defaultPrefixCls, get
82
82
  "style": mergedStyle
83
83
  }, [createVNode(Component, mergeProps(attrs, mergedProps), slots)]);
84
84
  };
85
- }, { props: {
86
- prefixCls: {
87
- type: String,
88
- required: false
89
- },
90
- style: {
91
- type: Object,
92
- required: false
85
+ }, {
86
+ props: {
87
+ prefixCls: {
88
+ type: String,
89
+ required: false
90
+ },
91
+ style: {
92
+ type: Object,
93
+ required: false
94
+ },
95
+ open: {
96
+ type: Boolean,
97
+ required: false,
98
+ default: void 0
99
+ }
93
100
  },
94
- open: {
95
- type: Boolean,
96
- required: false,
97
- default: void 0
98
- }
99
- } }));
101
+ inheritAttrs: false
102
+ }));
100
103
  }
101
104
  //#endregion
102
105
  export { genPurePanel as default, withPureRenderTheme };
@@ -0,0 +1,13 @@
1
+ //#region src/_util/fallbackProp.d.ts
2
+ /**
3
+ * Search for the first non-undefined value in the arguments and return it.
4
+ *
5
+ * ```js
6
+ * const mergedIcon = fallbackProp(propIcon, contextIcon, defaultIcon);
7
+ * ```
8
+ *
9
+ * Note: it is different from `??` operator which skips null
10
+ */
11
+ declare function fallbackProp<T>(...args: T[]): Exclude<T, undefined> | undefined;
12
+ //#endregion
13
+ export { fallbackProp as default };
@@ -0,0 +1,15 @@
1
+ //#region src/_util/fallbackProp.ts
2
+ /**
3
+ * Search for the first non-undefined value in the arguments and return it.
4
+ *
5
+ * ```js
6
+ * const mergedIcon = fallbackProp(propIcon, contextIcon, defaultIcon);
7
+ * ```
8
+ *
9
+ * Note: it is different from `??` operator which skips null
10
+ */
11
+ function fallbackProp(...args) {
12
+ return args.find((arg) => arg !== void 0);
13
+ }
14
+ //#endregion
15
+ export { fallbackProp as default };
@@ -0,0 +1,19 @@
1
+ //#region src/_util/hooks/useAllowClear.d.ts
2
+ interface AllowClearObject {
3
+ clearIcon?: any;
4
+ disabled?: boolean;
5
+ }
6
+ type AllowClear = boolean | AllowClearObject;
7
+ /** The hook never returns plain `true`: a truthy allowClear is normalized to the object form. */
8
+ type MergedAllowClear = AllowClearObject | false;
9
+ interface UseAllowClearOptions {
10
+ allowClear?: AllowClear;
11
+ clearIcon?: any;
12
+ contextAllowClear?: AllowClear;
13
+ contextClearIcon?: any;
14
+ defaultAllowClear?: boolean;
15
+ }
16
+ /** Merge component- and ConfigProvider-level `allowClear` / `clearIcon` (priority: props → context → `defaultAllowClear`). */
17
+ declare function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear }: UseAllowClearOptions): MergedAllowClear;
18
+ //#endregion
19
+ export { AllowClear, AllowClearObject, MergedAllowClear, UseAllowClearOptions, useAllowClear as default };
@@ -0,0 +1,16 @@
1
+ import { isPlainObject } from "../is.js";
2
+ import fallbackProp from "../fallbackProp.js";
3
+ import { createVNode } from "vue";
4
+ import { CloseCircleFilled } from "@antdv-next/icons";
5
+ //#region src/_util/hooks/useAllowClear.tsx
6
+ /** The hook never returns plain `true`: a truthy allowClear is normalized to the object form. */
7
+ /** Merge component- and ConfigProvider-level `allowClear` / `clearIcon` (priority: props → context → `defaultAllowClear`). */
8
+ function useAllowClear({ allowClear, clearIcon, contextAllowClear, contextClearIcon, defaultAllowClear }) {
9
+ if (!(allowClear ?? contextAllowClear ?? defaultAllowClear)) return false;
10
+ return {
11
+ clearIcon: fallbackProp(isPlainObject(allowClear) ? allowClear?.clearIcon : clearIcon, isPlainObject(contextAllowClear) ? contextAllowClear?.clearIcon : contextClearIcon, createVNode(CloseCircleFilled, null, null)),
12
+ disabled: (isPlainObject(allowClear) ? allowClear?.disabled : void 0) ?? (isPlainObject(contextAllowClear) ? contextAllowClear?.disabled : void 0)
13
+ };
14
+ }
15
+ //#endregion
16
+ export { useAllowClear as default };
@@ -62,11 +62,12 @@ function resolveStyleOrClass(value, info) {
62
62
  * @descZH 合并来自多个来源的 classNames 和 styles,当提供了 `schema` 时,必须提供嵌套的对象结构。
63
63
  */
64
64
  function useMergeSemantic(classNamesList, stylesList, info, schema) {
65
+ const resolveLazy = (value) => typeof value === "function" ? value(info.value) : value;
65
66
  const resolvedClassNamesList = computed(() => {
66
- return classNamesList.value.map((classNames) => classNames ? resolveStyleOrClass(classNames, info.value) : void 0);
67
+ return classNamesList.value.map((classNames) => classNames ? resolveLazy(classNames) : void 0);
67
68
  });
68
69
  const resolvedStylesList = computed(() => {
69
- return stylesList.value.map((styles) => styles ? resolveStyleOrClass(styles, info.value) : void 0);
70
+ return stylesList.value.map((styles) => styles ? resolveLazy(styles) : void 0);
70
71
  });
71
72
  const mergedClassNames = computed(() => useSemanticClassNames(schema?.value, ...resolvedClassNamesList.value));
72
73
  const mergedStyles = computed(() => useSemanticStyles(...resolvedStylesList.value));
@@ -0,0 +1,13 @@
1
+ //#region src/_util/omitUndefined.d.ts
2
+ /**
3
+ * Copy `obj` without the keys whose value is `undefined`.
4
+ *
5
+ * Vue materialises every declared prop on `props` (unset ones as `undefined`),
6
+ * so spreading `props` into a child forwards dozens of empty keys that the
7
+ * child then has to normalise in `initProps` / `setFullProps` on every mount.
8
+ * Boolean props in this code base default to `undefined` rather than `false`,
9
+ * so leaving an unset key out is equivalent to passing it as `undefined`.
10
+ */
11
+ declare function omitUndefined<T extends Record<string, any>>(obj: T, omitKeys?: readonly string[]): Partial<T>;
12
+ //#endregion
13
+ export { omitUndefined };
@@ -0,0 +1,20 @@
1
+ //#region src/_util/omitUndefined.ts
2
+ /**
3
+ * Copy `obj` without the keys whose value is `undefined`.
4
+ *
5
+ * Vue materialises every declared prop on `props` (unset ones as `undefined`),
6
+ * so spreading `props` into a child forwards dozens of empty keys that the
7
+ * child then has to normalise in `initProps` / `setFullProps` on every mount.
8
+ * Boolean props in this code base default to `undefined` rather than `false`,
9
+ * so leaving an unset key out is equivalent to passing it as `undefined`.
10
+ */
11
+ function omitUndefined(obj, omitKeys = []) {
12
+ const result = {};
13
+ for (const key in obj) {
14
+ const value = obj[key];
15
+ if (value !== void 0 && !omitKeys.includes(key)) result[key] = value;
16
+ }
17
+ return result;
18
+ }
19
+ //#endregion
20
+ export { omitUndefined };
@@ -3,6 +3,6 @@ import { ValidateStatus } from "../form/FormItem/index.js";
3
3
  declare const _InputStatuses: readonly ["warning", "error", "", "success", "validating"];
4
4
  type InputStatus = (typeof _InputStatuses)[number];
5
5
  declare function getStatusClassNames(prefixCls: string, status?: ValidateStatus, hasFeedback?: boolean): string;
6
- declare function getMergedStatus(contextStatus?: ValidateStatus, customStatus?: InputStatus): "" | "success" | "warning" | "error" | "validating" | undefined;
6
+ declare function getMergedStatus(contextStatus?: ValidateStatus, customStatus?: InputStatus): "" | "success" | "error" | "warning" | "validating" | undefined;
7
7
  //#endregion
8
8
  export { InputStatus, getMergedStatus, getStatusClassNames };
@@ -3,12 +3,8 @@ import { VNodeChild } from "vue";
3
3
  import { isFragment } from "@v-c/util/dist/Children/isFragment";
4
4
  //#region src/_util/vueNode.d.ts
5
5
  type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | undefined);
6
- declare function replaceElement(element: VNodeChild, replacement: VNodeChild, props?: RenderProps): string | number | boolean | void | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
- [key: string]: any;
8
- }> | import("vue").VNodeArrayChildren | null;
9
- declare function cloneElement(element: VNodeChild, props?: RenderProps): string | number | boolean | void | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
10
- [key: string]: any;
11
- }> | import("vue").VNodeArrayChildren | null;
6
+ declare function replaceElement(element: VNodeChild, replacement: VNodeChild, props?: RenderProps): VNodeChild;
7
+ declare function cloneElement(element: VNodeChild, props?: RenderProps): VNodeChild;
12
8
  declare function getVNode(node: VueNode): VNodeChild;
13
9
  declare function checkRenderNode(node: any): any;
14
10
  declare function getTextByNode(node: any): any;
@@ -1,4 +1,5 @@
1
1
  import { useConfig } from "../../config-provider/context.js";
2
+ import { useStyleToken } from "../../theme/util/genStyleUtils.js";
2
3
  import style_default from "./style.js";
3
4
  import useWave from "./useWave.js";
4
5
  import { cloneVNode, computed, defineComponent, isVNode, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
@@ -26,9 +27,10 @@ var wave_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
26
27
  const configCtx = useConfig();
27
28
  const containerRef = shallowRef(null);
28
29
  const prefixCls = computed(() => configCtx.value.getPrefixCls("wave"));
29
- const hashId = style_default(prefixCls);
30
+ const tokenResult = useStyleToken();
31
+ const hashId = style_default(prefixCls, void 0, tokenResult);
30
32
  const colorSource = computed(() => props.colorSource);
31
- const showWave = useWave(containerRef, computed(() => classNames(prefixCls.value, hashId.value)), computed(() => props.component), colorSource);
33
+ const showWave = useWave(containerRef, computed(() => classNames(prefixCls.value, hashId.value)), computed(() => props.component), colorSource, tokenResult);
32
34
  const handleEvent = (event) => {
33
35
  const node = containerRef.value;
34
36
  if (!node) return;
@@ -1,8 +1,12 @@
1
+ import { SeedToken } from "../../theme/interface/seeds.js";
2
+ import { AliasToken } from "../../theme/interface/alias.js";
3
+ import { ComponentTokenMap } from "../../theme/interface/components.js";
1
4
  import { FullToken } from "../../theme/interface/cssinjs-utils.js";
5
+ import "../../theme/interface/index.js";
2
6
  import "../../theme/internal.js";
3
7
  //#region src/_util/wave/style.d.ts
4
8
  interface ComponentToken {}
5
9
  interface WaveToken extends FullToken<'Wave'> {}
6
- declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>) => import("vue").Ref<string, string>;
10
+ declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>, tokenResult?: import("@antdv-next/cssinjs").UseTokenReturn<ComponentTokenMap, AliasToken, SeedToken> | undefined) => import("vue").Ref<string, string>;
7
11
  //#endregion
8
12
  export { ComponentToken, WaveToken, _default as default };
@@ -1,7 +1,8 @@
1
+ import { StyleTokenResult } from "../../theme/util/genStyleUtils.js";
1
2
  import { ShowWave, WaveComponent } from "./interface.js";
2
3
  import { WaveProps } from "./index.js";
3
4
  import { Ref } from "vue";
4
5
  //#region src/_util/wave/useWave.d.ts
5
- declare function useWave(nodeRef: Ref<HTMLElement | null | undefined>, className: string | Ref<string>, component?: WaveComponent | Ref<WaveComponent | undefined>, colorSource?: Ref<WaveProps['colorSource']>): ShowWave;
6
+ declare function useWave(nodeRef: Ref<HTMLElement | null | undefined>, className: string | Ref<string>, component?: WaveComponent | Ref<WaveComponent | undefined>, colorSource?: Ref<WaveProps['colorSource']>, tokenResult?: StyleTokenResult): ShowWave;
6
7
  //#endregion
7
8
  export { useWave as default };
@@ -1,13 +1,14 @@
1
1
  import { useConfig } from "../../config-provider/context.js";
2
- import useToken from "../../theme/useToken.js";
2
+ import { useStyleToken } from "../../theme/util/genStyleUtils.js";
3
3
  import { TARGET_CLS } from "./interface.js";
4
4
  import showWaveEffect from "./WaveEffect.js";
5
5
  import { onBeforeUnmount, ref, unref } from "vue";
6
6
  import raf from "@v-c/util/dist/raf";
7
7
  //#region src/_util/wave/useWave.ts
8
- function useWave(nodeRef, className, component, colorSource) {
8
+ function useWave(nodeRef, className, component, colorSource, tokenResult = useStyleToken()) {
9
9
  const configCtx = useConfig();
10
- const [, token, hashId] = useToken();
10
+ const token = tokenResult.realToken;
11
+ const hashId = tokenResult.hashId;
11
12
  const showWave = (event) => {
12
13
  const node = nodeRef.value;
13
14
  if (!node) return;
@@ -1,4 +1,8 @@
1
+ import { SeedToken } from "../../theme/interface/seeds.js";
2
+ import { AliasToken } from "../../theme/interface/alias.js";
3
+ import { ComponentTokenMap } from "../../theme/interface/components.js";
1
4
  import { GetDefaultToken } from "../../theme/interface/cssinjs-utils.js";
5
+ import "../../theme/interface/index.js";
2
6
  import "../../theme/internal.js";
3
7
  //#region src/affix/style/index.d.ts
4
8
  interface ComponentToken {
@@ -9,6 +13,6 @@ interface ComponentToken {
9
13
  zIndexPopup: number;
10
14
  }
11
15
  declare const prepareComponentToken: GetDefaultToken<'Affix'>;
12
- declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>) => readonly [import("vue").Ref<string, string>, import("vue").ComputedRef<string | undefined>];
16
+ declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>, tokenResult?: import("@antdv-next/cssinjs").UseTokenReturn<ComponentTokenMap, AliasToken, SeedToken> | undefined) => readonly [import("vue").Ref<string, string>, import("vue").ComputedRef<string | undefined>];
13
17
  //#endregion
14
18
  export { ComponentToken, _default as default, prepareComponentToken };
@@ -27,6 +27,10 @@ interface AlertSemanticType {
27
27
  }
28
28
  type AlertClassNamesType = SemanticType<AlertProps, AlertSemanticType['classes']>;
29
29
  type AlertStylesType = SemanticType<AlertProps, AlertSemanticType['styles']>;
30
+ type AlertClosableType = boolean | (Exclude<ClosableType, boolean> & {
31
+ onClose?: (e?: MouseEvent) => void;
32
+ afterClose?: () => void;
33
+ });
30
34
  type AlertVariant = 'filled' | 'outlined';
31
35
  interface AlertProps extends ComponentBaseProps, AlertEmitsProps {
32
36
  /** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
@@ -38,7 +42,7 @@ interface AlertProps extends ComponentBaseProps, AlertEmitsProps {
38
42
  */
39
43
  variant?: AlertVariant;
40
44
  /** Whether Alert can be closed */
41
- closable?: ClosableType;
45
+ closable?: AlertClosableType;
42
46
  /** Content of Alert */
43
47
  title?: VueNode;
44
48
  /**
@@ -84,4 +88,4 @@ interface AlertEmitsProps {
84
88
  }
85
89
  declare const Alert: import("vue").DefineSetupFnComponent<AlertProps, AlertEmits, SlotsType<AlertSlots>, AlertProps, import("vue").PublicProps>;
86
90
  //#endregion
87
- export { AlertClassNamesType, AlertEmits, AlertEmitsProps, AlertProps, AlertSemanticType, AlertSlots, AlertStylesType, AlertVariant, Alert as default };
91
+ export { AlertClassNamesType, AlertClosableType, AlertEmits, AlertEmitsProps, AlertProps, AlertSemanticType, AlertSlots, AlertStylesType, AlertVariant, Alert as default };
@@ -1,12 +1,13 @@
1
1
  import { useComponentBaseConfig } from "../config-provider/context.js";
2
2
  import { getAttrStyleAndClass, pureAttrs, useMergeSemanticNoRef } from "../_util/hooks/useMergeSemantic.js";
3
- import { getSlotPropFn, getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
3
+ import { getSlotPropsFnRun, toPropsRefs as toPropsRefs$1 } from "../_util/tools.js";
4
4
  import { isRenderable } from "../_util/is.js";
5
5
  import style_default from "./style/index.js";
6
6
  import { Transition, computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef } from "vue";
7
7
  import { classNames, clsx } from "@v-c/util";
8
8
  import { filterEmpty } from "@v-c/util/dist/props-util";
9
9
  import { CheckCircleFilled, CloseCircleFilled, CloseOutlined, ExclamationCircleFilled, InfoCircleFilled } from "@antdv-next/icons";
10
+ import pickAttrs from "@v-c/util/dist/pickAttrs";
10
11
  //#region src/alert/Alert.tsx
11
12
  const alertDefaultProps = { showIcon: void 0 };
12
13
  const IconNode = /* @__PURE__ */ defineComponent((props, { attrs }) => {
@@ -25,135 +26,132 @@ const IconNode = /* @__PURE__ */ defineComponent((props, { attrs }) => {
25
26
  warning: warningIcon ?? createVNode(ExclamationCircleFilled, null, null)
26
27
  };
27
28
  return createVNode("span", {
28
- "class": clsx(`${props.prefixCls}-icon`, className),
29
+ "class": className,
29
30
  "style": style
30
31
  }, [icon ?? iconMapFilled[type]]);
31
32
  };
32
- }, { props: {
33
- type: {
34
- type: String,
35
- required: true
36
- },
37
- icon: {
38
- type: [
39
- Function,
40
- String,
41
- Number,
42
- null,
43
- Object,
44
- Boolean
45
- ],
46
- required: false,
47
- default: void 0
48
- },
49
- prefixCls: {
50
- type: String,
51
- required: true
52
- },
53
- description: {
54
- type: [
55
- Function,
56
- String,
57
- Number,
58
- null,
59
- Object,
60
- Boolean
61
- ],
62
- required: true
63
- },
64
- successIcon: {
65
- type: [
66
- Function,
67
- String,
68
- Number,
69
- null,
70
- Object,
71
- Boolean
72
- ],
73
- required: false,
74
- default: void 0
75
- },
76
- infoIcon: {
77
- type: [
78
- Function,
79
- String,
80
- Number,
81
- null,
82
- Object,
83
- Boolean
84
- ],
85
- required: false,
86
- default: void 0
87
- },
88
- warningIcon: {
89
- type: [
90
- Function,
91
- String,
92
- Number,
93
- null,
94
- Object,
95
- Boolean
96
- ],
97
- required: false,
98
- default: void 0
33
+ }, {
34
+ props: {
35
+ type: {
36
+ type: String,
37
+ required: true
38
+ },
39
+ icon: {
40
+ type: [
41
+ Function,
42
+ String,
43
+ Number,
44
+ null,
45
+ Object,
46
+ Boolean
47
+ ],
48
+ required: false,
49
+ default: void 0
50
+ },
51
+ successIcon: {
52
+ type: [
53
+ Function,
54
+ String,
55
+ Number,
56
+ null,
57
+ Object,
58
+ Boolean
59
+ ],
60
+ required: false,
61
+ default: void 0
62
+ },
63
+ infoIcon: {
64
+ type: [
65
+ Function,
66
+ String,
67
+ Number,
68
+ null,
69
+ Object,
70
+ Boolean
71
+ ],
72
+ required: false,
73
+ default: void 0
74
+ },
75
+ warningIcon: {
76
+ type: [
77
+ Function,
78
+ String,
79
+ Number,
80
+ null,
81
+ Object,
82
+ Boolean
83
+ ],
84
+ required: false,
85
+ default: void 0
86
+ },
87
+ errorIcon: {
88
+ type: [
89
+ Function,
90
+ String,
91
+ Number,
92
+ null,
93
+ Object,
94
+ Boolean
95
+ ],
96
+ required: false,
97
+ default: void 0
98
+ }
99
99
  },
100
- errorIcon: {
101
- type: [
102
- Function,
103
- String,
104
- Number,
105
- null,
106
- Object,
107
- Boolean
108
- ],
109
- required: false,
110
- default: void 0
111
- }
112
- } });
100
+ inheritAttrs: false
101
+ });
113
102
  const CloseIconNode = /* @__PURE__ */ defineComponent((props, { slots, attrs }) => {
114
103
  return () => {
115
- const { isClosable, prefixCls, handleClose, ariaProps } = props;
104
+ const { isClosable, disabled, prefixCls, handleClose, ariaProps } = props;
116
105
  const { className, style } = getAttrStyleAndClass(attrs);
117
- const closeIcon = getSlotPropsFnRun(slots, props, "closeIcon");
118
- const mergedCloseIcon = !closeIcon ? createVNode(CloseOutlined, null, null) : closeIcon;
106
+ const closeIcon = getSlotPropsFnRun(slots, props, "closeIcon", false);
107
+ const mergedCloseIcon = closeIcon === true || closeIcon === void 0 ? createVNode(CloseOutlined, null, null) : closeIcon;
119
108
  return isClosable ? createVNode("button", mergeProps({
120
109
  "type": "button",
110
+ "disabled": disabled,
121
111
  "onClick": handleClose,
122
112
  "class": clsx(`${prefixCls}-close-icon`, className),
123
- "tabindex": 0,
124
113
  "style": style
125
114
  }, ariaProps), [mergedCloseIcon]) : null;
126
115
  };
127
- }, { props: {
128
- isClosable: {
129
- type: Boolean,
130
- required: true
131
- },
132
- prefixCls: {
133
- type: String,
134
- required: true
135
- },
136
- closeIcon: {
137
- type: [
138
- Function,
139
- String,
140
- Number,
141
- null,
142
- Object,
143
- Boolean
144
- ],
145
- required: true
146
- },
147
- handleClose: {
148
- type: Function,
149
- required: true
116
+ }, {
117
+ props: {
118
+ isClosable: {
119
+ type: Boolean,
120
+ required: true
121
+ },
122
+ disabled: {
123
+ type: Boolean,
124
+ required: false,
125
+ default: void 0
126
+ },
127
+ prefixCls: {
128
+ type: String,
129
+ required: true
130
+ },
131
+ closeIcon: {
132
+ type: [
133
+ Function,
134
+ String,
135
+ Number,
136
+ null,
137
+ Object,
138
+ Boolean
139
+ ],
140
+ required: false,
141
+ default: void 0
142
+ },
143
+ handleClose: {
144
+ type: Function,
145
+ required: true
146
+ },
147
+ ariaProps: {
148
+ type: Object,
149
+ required: true
150
+ }
150
151
  },
151
- ariaProps: {
152
- type: Object,
153
- required: true
154
- }
155
- } });
156
- const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) => {
152
+ inheritAttrs: false
153
+ });
154
+ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs, expose }) => {
157
155
  const { closable: contextClosable, closeIcon: contextCloseIcon, class: contextClassName, style: contextStyle, classes: contextClassNames, styles: contextStyles, direction, prefixCls, successIcon, errorIcon, infoIcon, warningIcon, variant: contextVariant } = useComponentBaseConfig("alert", props, [
158
156
  "closable",
159
157
  "closeIcon",
@@ -166,10 +164,13 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
166
164
  const { classes, styles } = toPropsRefs$1(props, "classes", "styles");
167
165
  const closed = shallowRef(false);
168
166
  const internalRef = shallowRef();
167
+ expose({ nativeElement: internalRef });
169
168
  const [hashId, cssVarCls] = style_default(prefixCls);
170
169
  const handleClose = (e) => {
171
170
  closed.value = true;
172
- emit("close", e);
171
+ const closable = props.closable;
172
+ if (typeof closable === "object" && closable?.onClose) closable.onClose(e);
173
+ else emit("close", e);
173
174
  };
174
175
  const type = computed(() => {
175
176
  if (props.type) return props.type;
@@ -222,19 +223,19 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
222
223
  [`${prefixCls.value}-rtl`]: direction.value === "rtl"
223
224
  }, contextClassName.value, className, rootClass, mergedClassNames.root, cssVarCls.value, hashId.value);
224
225
  const mergedCloseIconFn = () => {
225
- if (typeof closable === "object" && closable.closeIcon) return closable.closeIcon;
226
- const closeIcon = getSlotPropFn(slots, props, "closeIcon");
227
- if (closeIcon) return closeIcon;
228
- if (typeof contextClosable.value === "object" && contextClosable.value) return contextClosable.value;
226
+ if (typeof closable === "object" && closable?.closeIcon) return closable.closeIcon;
227
+ const closeIcon = getSlotPropsFnRun(slots, props, "closeIcon", false);
228
+ if (closeIcon !== void 0) return closeIcon;
229
+ if (typeof contextClosable.value === "object" && contextClosable.value?.closeIcon) return contextClosable.value.closeIcon;
229
230
  return contextCloseIcon.value;
230
231
  };
231
232
  const mergedCloseIcon = mergedCloseIconFn();
232
233
  const mergedAriaPropsFn = () => {
233
234
  const merged = closable ?? contextClosable.value;
234
- if (typeof merged === "object") {
235
- const { closeIcon: _, ...ariaProps } = merged;
236
- return ariaProps;
237
- }
235
+ if (typeof merged === "object" && merged) return pickAttrs(merged, {
236
+ aria: true,
237
+ data: true
238
+ });
238
239
  return {};
239
240
  };
240
241
  const mergedAriaProps = mergedAriaPropsFn();
@@ -245,7 +246,10 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
245
246
  "leaveActiveClass": `${prefixCls.value}-motion-leave ${prefixCls.value}-motion-leave-active`,
246
247
  "leaveToClass": `${prefixCls.value}-motion-leave ${prefixCls.value}-motion-leave-active`,
247
248
  "onBeforeLeave": handleBeforeLeave,
248
- "onAfterLeave": () => props?.afterClose?.()
249
+ "onAfterLeave": () => {
250
+ if (typeof closable === "object" && closable?.afterClose) closable.afterClose();
251
+ else props?.afterClose?.();
252
+ }
249
253
  }, { default: () => [!closed.value ? createVNode("div", mergeProps({
250
254
  "id": props.id,
251
255
  "ref": internalRef,
@@ -255,11 +259,9 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
255
259
  "style": [mergedStyles.root, style]
256
260
  }, pureAttrs(attrs)), [
257
261
  isShowIcon ? createVNode(IconNode, {
258
- "class": mergedClassNames.icon,
262
+ "class": clsx(`${prefixCls.value}-icon`, mergedClassNames.icon),
259
263
  "style": mergedStyles.icon,
260
- "description": description,
261
264
  "icon": icon,
262
- "prefixCls": prefixCls.value,
263
265
  "type": type.value,
264
266
  "successIcon": successIcon.value,
265
267
  "infoIcon": infoIcon.value,
@@ -284,6 +286,7 @@ const Alert = /* @__PURE__ */ defineComponent((props, { slots, emit, attrs }) =>
284
286
  "class": mergedClassNames.close,
285
287
  "style": mergedStyles.close,
286
288
  "isClosable": isClosable,
289
+ "disabled": typeof closable === "object" ? closable?.disabled : void 0,
287
290
  "prefixCls": prefixCls.value,
288
291
  "ariaProps": mergedAriaProps,
289
292
  "handleClose": handleClose,
@@ -1,3 +1,6 @@
1
+ import { SeedToken } from "../../theme/interface/seeds.js";
2
+ import { AliasToken } from "../../theme/interface/alias.js";
3
+ import { ComponentTokenMap } from "../../theme/interface/components.js";
1
4
  import { FullToken, GetDefaultToken } from "../../theme/interface/cssinjs-utils.js";
2
5
  import { GenerateStyle } from "../../theme/interface/index.js";
3
6
  import "../../theme/internal.js";
@@ -31,6 +34,6 @@ declare const genBaseStyle: GenerateStyle<AlertToken, CSSObject>;
31
34
  declare const genTypeStyle: GenerateStyle<AlertToken, CSSObject>;
32
35
  declare const genActionStyle: GenerateStyle<AlertToken, CSSObject>;
33
36
  declare const prepareComponentToken: GetDefaultToken<'Alert'>;
34
- declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>) => readonly [import("vue").Ref<string, string>, import("vue").ComputedRef<string | undefined>];
37
+ declare const _default: (prefixCls: import("vue").Ref<string>, rootCls?: import("vue").Ref<string | undefined>, tokenResult?: import("@antdv-next/cssinjs").UseTokenReturn<ComponentTokenMap, AliasToken, SeedToken> | undefined) => readonly [import("vue").Ref<string, string>, import("vue").ComputedRef<string | undefined>];
35
38
  //#endregion
36
39
  export { ComponentToken, _default as default, genActionStyle, genBaseStyle, genTypeStyle, prepareComponentToken };