@antify/ui 1.0.4 → 1.2.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 (105) hide show
  1. package/dist/components/AntAccordion.vue +32 -7
  2. package/dist/components/AntAccordionItem.vue +48 -15
  3. package/dist/components/AntAlert.vue +8 -6
  4. package/dist/components/AntDropdown.vue +50 -36
  5. package/dist/components/AntIcon.vue +8 -6
  6. package/dist/components/AntKeycap.vue +22 -17
  7. package/dist/components/AntListGroup.vue +5 -3
  8. package/dist/components/AntModal.vue +17 -7
  9. package/dist/components/AntPopover.vue +118 -42
  10. package/dist/components/AntSkeleton.vue +1 -1
  11. package/dist/components/AntTooltip.vue +102 -76
  12. package/dist/components/__stories/AntAccordion.stories.d.ts +1 -0
  13. package/dist/components/__stories/AntAccordion.stories.js +73 -1
  14. package/dist/components/__stories/AntAccordion.stories.mjs +68 -0
  15. package/dist/components/__stories/AntDropdown.stories.js +27 -23
  16. package/dist/components/__stories/AntDropdown.stories.mjs +26 -22
  17. package/dist/components/__stories/AntKeycap.stories.js +13 -15
  18. package/dist/components/__stories/AntKeycap.stories.mjs +13 -13
  19. package/dist/components/__stories/AntListGroup.stories.js +1 -1
  20. package/dist/components/__stories/AntListGroup.stories.mjs +1 -1
  21. package/dist/components/__stories/AntModal.stories.js +2 -1
  22. package/dist/components/__stories/AntModal.stories.mjs +2 -1
  23. package/dist/components/__stories/AntPopover.stories.js +22 -21
  24. package/dist/components/__stories/AntPopover.stories.mjs +22 -20
  25. package/dist/components/__stories/AntTooltip.stories.d.ts +0 -10
  26. package/dist/components/__stories/AntTooltip.stories.js +32 -212
  27. package/dist/components/__stories/AntTooltip.stories.mjs +29 -193
  28. package/dist/components/__types/AntKeycap.types.d.ts +1 -0
  29. package/dist/components/__types/AntKeycap.types.js +1 -0
  30. package/dist/components/__types/AntKeycap.types.mjs +1 -0
  31. package/dist/components/buttons/AntButton.vue +41 -44
  32. package/dist/components/crud/AntCrud.vue +1 -1
  33. package/dist/components/crud/AntCrudDetailActions.vue +1 -0
  34. package/dist/components/crud/AntCrudTableFilter.vue +20 -18
  35. package/dist/components/forms/AntField.vue +7 -2
  36. package/dist/components/forms/__stories/AntField.stories.js +0 -16
  37. package/dist/components/forms/__stories/AntField.stories.mjs +2 -16
  38. package/dist/components/index.d.ts +2 -2
  39. package/dist/components/index.js +7 -7
  40. package/dist/components/index.mjs +2 -2
  41. package/dist/components/inputs/AntCheckbox.vue +25 -6
  42. package/dist/components/inputs/AntDateInput.vue +1 -1
  43. package/dist/components/inputs/AntRadio.vue +2 -1
  44. package/dist/components/inputs/AntSelect.vue +25 -22
  45. package/dist/components/inputs/AntSwitch.vue +2 -7
  46. package/dist/components/inputs/AntTagInput.vue +91 -114
  47. package/dist/components/inputs/AntTextarea.vue +7 -3
  48. package/dist/components/inputs/Elements/AntBaseInput.vue +2 -2
  49. package/dist/components/inputs/Elements/{AntDropDown.vue → AntSelectMenu.vue} +85 -40
  50. package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.d.ts +0 -1
  51. package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.js +1 -29
  52. package/dist/components/inputs/Elements/__stories/AntBaseInput.stories.mjs +0 -22
  53. package/dist/components/inputs/Elements/index.d.ts +2 -1
  54. package/dist/components/inputs/Elements/index.js +7 -0
  55. package/dist/components/inputs/Elements/index.mjs +3 -1
  56. package/dist/components/inputs/__stories/AntCheckbox.stories.d.ts +0 -1
  57. package/dist/components/inputs/__stories/AntCheckbox.stories.js +1 -43
  58. package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +0 -35
  59. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.d.ts +0 -1
  60. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.js +1 -31
  61. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +0 -28
  62. package/dist/components/inputs/__stories/AntDateInput.stories.d.ts +0 -1
  63. package/dist/components/inputs/__stories/AntDateInput.stories.js +1 -32
  64. package/dist/components/inputs/__stories/AntDateInput.stories.mjs +0 -28
  65. package/dist/components/inputs/__stories/AntNumberInput.stories.d.ts +0 -2
  66. package/dist/components/inputs/__stories/AntNumberInput.stories.js +1 -65
  67. package/dist/components/inputs/__stories/AntNumberInput.stories.mjs +1 -54
  68. package/dist/components/inputs/__stories/AntPasswordInput.stories.d.ts +0 -1
  69. package/dist/components/inputs/__stories/AntPasswordInput.stories.js +1 -35
  70. package/dist/components/inputs/__stories/AntPasswordInput.stories.mjs +0 -25
  71. package/dist/components/inputs/__stories/AntRadioGroup.stories.d.ts +0 -1
  72. package/dist/components/inputs/__stories/AntRadioGroup.stories.js +1 -47
  73. package/dist/components/inputs/__stories/AntRadioGroup.stories.mjs +0 -46
  74. package/dist/components/inputs/__stories/AntRangeSlider.stories.d.ts +0 -1
  75. package/dist/components/inputs/__stories/AntRangeSlider.stories.js +1 -33
  76. package/dist/components/inputs/__stories/AntRangeSlider.stories.mjs +1 -28
  77. package/dist/components/inputs/__stories/AntSelect.stories.d.ts +0 -1
  78. package/dist/components/inputs/__stories/AntSelect.stories.js +18 -46
  79. package/dist/components/inputs/__stories/AntSelect.stories.mjs +16 -47
  80. package/dist/components/inputs/__stories/AntSwitch.stories.d.ts +0 -1
  81. package/dist/components/inputs/__stories/AntSwitch.stories.js +1 -42
  82. package/dist/components/inputs/__stories/AntSwitch.stories.mjs +1 -37
  83. package/dist/components/inputs/__stories/AntSwitcher.stories.d.ts +0 -1
  84. package/dist/components/inputs/__stories/AntSwitcher.stories.js +1 -51
  85. package/dist/components/inputs/__stories/AntSwitcher.stories.mjs +1 -51
  86. package/dist/components/inputs/__stories/AntTagInput.stories.d.ts +0 -1
  87. package/dist/components/inputs/__stories/AntTagInput.stories.js +1 -35
  88. package/dist/components/inputs/__stories/AntTagInput.stories.mjs +0 -33
  89. package/dist/components/inputs/__stories/AntTextInput.stories.d.ts +0 -2
  90. package/dist/components/inputs/__stories/AntTextInput.stories.js +1 -107
  91. package/dist/components/inputs/__stories/AntTextInput.stories.mjs +0 -104
  92. package/dist/components/inputs/__stories/AntTextarea.stories.d.ts +0 -2
  93. package/dist/components/inputs/__stories/AntTextarea.stories.js +7 -66
  94. package/dist/components/inputs/__stories/AntTextarea.stories.mjs +6 -55
  95. package/dist/components/inputs/__stories/AntUnitInput.stories.d.ts +0 -2
  96. package/dist/components/inputs/__stories/AntUnitInput.stories.js +1 -61
  97. package/dist/components/inputs/__stories/AntUnitInput.stories.mjs +0 -53
  98. package/dist/components/table/AntTable.vue +17 -15
  99. package/dist/components/table/AntTd.vue +1 -2
  100. package/dist/components/table/__stories/AntTable.stories.js +7 -14
  101. package/dist/components/table/__stories/AntTable.stories.mjs +7 -15
  102. package/dist/components/tabs/AntTabItem.vue +16 -6
  103. package/dist/components/tabs/AntTabs.vue +8 -0
  104. package/dist/components/tabs/__types/AntTabItem.types.d.ts +1 -0
  105. package/package.json +2 -1
@@ -3,12 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- module.exports = exports.WithoutContent = exports.Summary = exports.Multiple = exports.Docs = void 0;
6
+ module.exports = exports.Docs = void 0;
7
7
  var _AntTooltip = _interopRequireDefault(require("../AntTooltip.vue"));
8
- var _AntFormGroup = _interopRequireDefault(require("../forms/AntFormGroup.vue"));
9
- var _AntFormGroupLabel = _interopRequireDefault(require("../forms/AntFormGroupLabel.vue"));
10
- var _Position = require("../../enums/Position.enum");
11
8
  var _enums = require("../../enums");
9
+ var _AntButton = _interopRequireDefault(require("../buttons/AntButton.vue"));
10
+ var _vue = require("vue");
12
11
  var _test = require("@storybook/test");
13
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  const meta = {
@@ -20,12 +19,6 @@ const meta = {
20
19
  }
21
20
  },
22
21
  argTypes: {
23
- position: {
24
- control: {
25
- type: "select"
26
- },
27
- options: Object.values(_Position.Position)
28
- },
29
22
  state: {
30
23
  control: {
31
24
  type: "select"
@@ -38,23 +31,37 @@ module.exports = meta;
38
31
  const Docs = exports.Docs = {
39
32
  render: args => ({
40
33
  components: {
41
- AntTooltip: _AntTooltip.default
34
+ AntTooltip: _AntTooltip.default,
35
+ AntButton: _AntButton.default
42
36
  },
43
37
  setup() {
38
+ const scrollContainer = (0, _vue.ref)(void 0);
39
+ (0, _vue.onMounted)(() => {
40
+ if (scrollContainer.value) {
41
+ scrollContainer.value.scrollLeft = (scrollContainer.value.scrollWidth - scrollContainer.value.clientWidth) / 2;
42
+ scrollContainer.value.scrollTop = (scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight) / 2;
43
+ }
44
+ });
44
45
  return {
45
- args
46
+ args,
47
+ scrollContainer
46
48
  };
47
49
  },
48
50
  template: `
49
- <div class="p-32 flex justify-center items-center">
50
- <AntTooltip v-bind="args">
51
- <template #content>Lorem ipsum dolor sit <br/>amet</template>
52
- <template #default>
53
- <div class="box">Hover me</div>
54
- </template>
55
- </AntTooltip>
56
- </div>
57
- `
51
+ <div ref="scrollContainer" class="dashed h-[50vh] w-[50vw] overflow-scroll">
52
+ <div class="flex flex-grow justify-center items-center h-screen w-[1000px]">
53
+ <AntTooltip v-bind="args">
54
+ <AntButton>Hover me</AntButton>
55
+
56
+ <template #content>
57
+ <div>
58
+ Tooltip content
59
+ </div>
60
+ </template>
61
+ </AntTooltip>
62
+ </div>
63
+ </div>
64
+ `
58
65
  }),
59
66
  play: async ({
60
67
  canvasElement,
@@ -63,7 +70,7 @@ const Docs = exports.Docs = {
63
70
  const canvas = (0, _test.within)(canvasElement);
64
71
  const target = canvas.getByText("Hover me");
65
72
  function queryTooltip() {
66
- return canvas.queryByText("Lorem ipsum dolor sit amet");
73
+ return canvasElement.parentElement?.querySelector('[data-e2e="tooltip-content"]');
67
74
  }
68
75
  await step("Hover over the target and expect showing the tooltip", async () => {
69
76
  await _test.userEvent.hover(target);
@@ -73,7 +80,7 @@ const Docs = exports.Docs = {
73
80
  });
74
81
  await step("Leave hover state and expect not showing the tooltip anymore", async () => {
75
82
  await _test.userEvent.unhover(target);
76
- (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
83
+ await (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
77
84
  });
78
85
  await step("Hover over the target, wait until the tooltip is visible, click the target and expect not showing the tooltip", async () => {
79
86
  await _test.userEvent.hover(target);
@@ -81,7 +88,7 @@ const Docs = exports.Docs = {
81
88
  timeout: 600
82
89
  });
83
90
  await _test.userEvent.click(target);
84
- (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
91
+ await (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
85
92
  });
86
93
  await step("Hover over the target, click it while delay and expect not showing the tooltip", async () => {
87
94
  await _test.userEvent.hover(target);
@@ -89,195 +96,8 @@ const Docs = exports.Docs = {
89
96
  timeout: 200
90
97
  });
91
98
  await _test.userEvent.click(target);
92
- (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
93
- });
94
- },
95
- args: {
96
- delay: 600,
97
- position: _Position.Position.top
98
- }
99
- };
100
- const WithoutContent = exports.WithoutContent = {
101
- render: args => ({
102
- components: {
103
- AntTooltip: _AntTooltip.default
104
- },
105
- setup() {
106
- return {
107
- args
108
- };
109
- },
110
- template: `
111
- <div class="p-32 flex justify-center items-center">
112
- <AntTooltip v-bind="args">
113
- <div class="box">Hover me</div>
114
-
115
- <template #content></template>
116
- </AntTooltip>
117
- </div>
118
- `
119
- }),
120
- play: async ({
121
- canvasElement,
122
- step
123
- }) => {
124
- const canvas = (0, _test.within)(canvasElement);
125
- await step("Hover over the target and expect not showing the tooltip", async () => {
126
- await _test.userEvent.hover(canvas.getByText("Hover me"));
127
- await (0, _test.waitFor)(() => (0, _test.expect)(canvas.queryByText("Lorem ipsum dolor sit amet")).not.toBeInTheDocument());
99
+ await (0, _test.expect)(queryTooltip()).not.toBeInTheDocument();
128
100
  });
129
101
  },
130
102
  args: {}
131
- };
132
- const Multiple = exports.Multiple = {
133
- render: args => ({
134
- components: {
135
- AntTooltip: _AntTooltip.default
136
- },
137
- setup() {
138
- return {
139
- args
140
- };
141
- },
142
- template: `
143
- <div class="p-12 flex flex-col justify-center items-center gap-1">
144
- <div class="flex gap-1">
145
- <div
146
- v-for="row in 5"
147
- class="flex flex-col gap-1"
148
- >
149
- <AntTooltip v-for="item of 5">
150
- <div class="box">Hover me</div>
151
-
152
- <template #content>Lorem</template>
153
- </AntTooltip>
154
- </div>
155
- </div>
156
- </div>
157
- `
158
- })
159
- };
160
- const Summary = exports.Summary = {
161
- render: args => ({
162
- components: {
163
- AntTooltip: _AntTooltip.default,
164
- AntFormGroup: _AntFormGroup.default,
165
- AntFormGroupLabel: _AntFormGroupLabel.default
166
- },
167
- setup() {
168
- return {
169
- args,
170
- Position: _Position.Position,
171
- InputState: _enums.InputState
172
- };
173
- },
174
- template: `
175
- <AntFormGroup>
176
- <AntFormGroupLabel>Position</AntFormGroupLabel>
177
- <AntFormGroup direction="row" class="gap-x-32 py-16 dashed">
178
- <AntTooltip :position="Position.top">
179
- <div class="box">Hover me</div>
180
-
181
- <template #content>Lorem</template>
182
- </AntTooltip>
183
-
184
- <AntTooltip :position="Position.right">
185
- <div class="box">Hover me</div>
186
-
187
- <template #content>Lorem</template>
188
- </AntTooltip>
189
-
190
- <AntTooltip :position="Position.bottom">
191
- <div class="box">Hover me</div>
192
-
193
- <template #content>Lorem</template>
194
- </AntTooltip>
195
-
196
- <AntTooltip :position="Position.left">
197
- <div class="box">Hover me</div>
198
-
199
- <template #content>Lorem</template>
200
- </AntTooltip>
201
- </AntFormGroup>
202
-
203
- <AntFormGroupLabel>Color type</AntFormGroupLabel>
204
- <AntFormGroup direction="row" class="pb-16 dashed">
205
- <AntTooltip :position="Position.bottom" :state="InputState.base">
206
- <div class="box">Hover me</div>
207
-
208
- <template #content>Lorem</template>
209
- </AntTooltip>
210
-
211
- <AntTooltip :position="Position.bottom" :state="InputState.info">
212
- <div class="box">Hover me</div>
213
-
214
- <template #content>Lorem</template>
215
- </AntTooltip>
216
-
217
- <AntTooltip :position="Position.bottom" :state="InputState.success">
218
- <div class="box">Hover me</div>
219
-
220
- <template #content>Lorem</template>
221
- </AntTooltip>
222
-
223
- <AntTooltip :position="Position.bottom" :state="InputState.warning">
224
- <div class="box">Hover me</div>
225
-
226
- <template #content>Lorem</template>
227
- </AntTooltip>
228
-
229
- <AntTooltip :position="Position.bottom" :state="InputState.danger">
230
- <div class="box">Hover me</div>
231
-
232
- <template #content>Lorem</template>
233
- </AntTooltip>
234
- </AntFormGroup>
235
-
236
- <AntFormGroupLabel>Expanded</AntFormGroupLabel>
237
- <AntFormGroup class="p-32 dashed gap-y-16">
238
- <AntTooltip :position="Position.top" expanded>
239
- <div class="box">Hover me</div>
240
-
241
- <template #content>Lorem</template>
242
- </AntTooltip>
243
-
244
- <AntTooltip :position="Position.right" expanded>
245
- <div class="box">Hover me</div>
246
-
247
- <template #content>Lorem</template>
248
- </AntTooltip>
249
-
250
- <AntTooltip :position="Position.bottom" expanded>
251
- <div class="box">Hover me</div>
252
-
253
- <template #content>Lorem</template>
254
- </AntTooltip>
255
-
256
- <AntTooltip :position="Position.left" expanded>
257
- <div class="box">Hover me</div>
258
-
259
- <template #content>Lorem</template>
260
- </AntTooltip>
261
- </AntFormGroup>
262
- </AntFormGroup>
263
- `
264
- }),
265
- parameters: {
266
- chromatic: {
267
- disableSnapshot: false
268
- }
269
- },
270
- play: async ({
271
- canvasElement,
272
- step
273
- }) => {
274
- const canvas = (0, _test.within)(canvasElement);
275
- await step("Hover over the targets and expect showing the tooltips", async () => {
276
- const targets = canvas.getAllByText("Hover me");
277
- await Promise.all(targets.map(async target => {
278
- await _test.userEvent.hover(target);
279
- }));
280
- await (0, _test.waitFor)(() => (0, _test.expect)(canvas.queryAllByText("Lorem")).toHaveLength(targets.length));
281
- });
282
- }
283
103
  };
@@ -1,8 +1,7 @@
1
1
  import AntTooltip from "../AntTooltip.vue";
2
- import AntFormGroup from "../forms/AntFormGroup.vue";
3
- import AntFormGroupLabel from "../forms/AntFormGroupLabel.vue";
4
- import { Position } from "../../enums/Position.enum.mjs";
5
2
  import { InputState } from "../../enums/index.mjs";
3
+ import AntButton from "../buttons/AntButton.vue";
4
+ import { onMounted, ref } from "vue";
6
5
  import { expect, userEvent, waitFor, within } from "@storybook/test";
7
6
  const meta = {
8
7
  title: "Components/Tooltip",
@@ -11,10 +10,6 @@ const meta = {
11
10
  controls: { sort: "requiredFirst" }
12
11
  },
13
12
  argTypes: {
14
- position: {
15
- control: { type: "select" },
16
- options: Object.values(Position)
17
- },
18
13
  state: {
19
14
  control: { type: "select" },
20
15
  options: Object.values(InputState)
@@ -24,26 +19,38 @@ const meta = {
24
19
  export default meta;
25
20
  export const Docs = {
26
21
  render: (args) => ({
27
- components: { AntTooltip },
22
+ components: { AntTooltip, AntButton },
28
23
  setup() {
29
- return { args };
24
+ const scrollContainer = ref(void 0);
25
+ onMounted(() => {
26
+ if (scrollContainer.value) {
27
+ scrollContainer.value.scrollLeft = (scrollContainer.value.scrollWidth - scrollContainer.value.clientWidth) / 2;
28
+ scrollContainer.value.scrollTop = (scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight) / 2;
29
+ }
30
+ });
31
+ return { args, scrollContainer };
30
32
  },
31
33
  template: `
32
- <div class="p-32 flex justify-center items-center">
33
- <AntTooltip v-bind="args">
34
- <template #content>Lorem ipsum dolor sit <br/>amet</template>
35
- <template #default>
36
- <div class="box">Hover me</div>
37
- </template>
38
- </AntTooltip>
39
- </div>
40
- `
34
+ <div ref="scrollContainer" class="dashed h-[50vh] w-[50vw] overflow-scroll">
35
+ <div class="flex flex-grow justify-center items-center h-screen w-[1000px]">
36
+ <AntTooltip v-bind="args">
37
+ <AntButton>Hover me</AntButton>
38
+
39
+ <template #content>
40
+ <div>
41
+ Tooltip content
42
+ </div>
43
+ </template>
44
+ </AntTooltip>
45
+ </div>
46
+ </div>
47
+ `
41
48
  }),
42
49
  play: async ({ canvasElement, step }) => {
43
50
  const canvas = within(canvasElement);
44
51
  const target = canvas.getByText("Hover me");
45
52
  function queryTooltip() {
46
- return canvas.queryByText("Lorem ipsum dolor sit amet");
53
+ return canvasElement.parentElement?.querySelector('[data-e2e="tooltip-content"]');
47
54
  }
48
55
  await step("Hover over the target and expect showing the tooltip", async () => {
49
56
  await userEvent.hover(target);
@@ -51,191 +58,20 @@ export const Docs = {
51
58
  });
52
59
  await step("Leave hover state and expect not showing the tooltip anymore", async () => {
53
60
  await userEvent.unhover(target);
54
- expect(queryTooltip()).not.toBeInTheDocument();
61
+ await expect(queryTooltip()).not.toBeInTheDocument();
55
62
  });
56
63
  await step("Hover over the target, wait until the tooltip is visible, click the target and expect not showing the tooltip", async () => {
57
64
  await userEvent.hover(target);
58
65
  await waitFor(() => expect(queryTooltip()).toBeInTheDocument(), { timeout: 600 });
59
66
  await userEvent.click(target);
60
- expect(queryTooltip()).not.toBeInTheDocument();
67
+ await expect(queryTooltip()).not.toBeInTheDocument();
61
68
  });
62
69
  await step("Hover over the target, click it while delay and expect not showing the tooltip", async () => {
63
70
  await userEvent.hover(target);
64
71
  await waitFor(() => expect(queryTooltip()).not.toBeInTheDocument(), { timeout: 200 });
65
72
  await userEvent.click(target);
66
- expect(queryTooltip()).not.toBeInTheDocument();
67
- });
68
- },
69
- args: {
70
- delay: 600,
71
- position: Position.top
72
- }
73
- };
74
- export const WithoutContent = {
75
- render: (args) => ({
76
- components: { AntTooltip },
77
- setup() {
78
- return { args };
79
- },
80
- template: `
81
- <div class="p-32 flex justify-center items-center">
82
- <AntTooltip v-bind="args">
83
- <div class="box">Hover me</div>
84
-
85
- <template #content></template>
86
- </AntTooltip>
87
- </div>
88
- `
89
- }),
90
- play: async ({ canvasElement, step }) => {
91
- const canvas = within(canvasElement);
92
- await step("Hover over the target and expect not showing the tooltip", async () => {
93
- await userEvent.hover(canvas.getByText("Hover me"));
94
- await waitFor(() => expect(
95
- canvas.queryByText(
96
- "Lorem ipsum dolor sit amet"
97
- )
98
- ).not.toBeInTheDocument());
73
+ await expect(queryTooltip()).not.toBeInTheDocument();
99
74
  });
100
75
  },
101
76
  args: {}
102
77
  };
103
- export const Multiple = {
104
- render: (args) => ({
105
- components: { AntTooltip },
106
- setup() {
107
- return { args };
108
- },
109
- template: `
110
- <div class="p-12 flex flex-col justify-center items-center gap-1">
111
- <div class="flex gap-1">
112
- <div
113
- v-for="row in 5"
114
- class="flex flex-col gap-1"
115
- >
116
- <AntTooltip v-for="item of 5">
117
- <div class="box">Hover me</div>
118
-
119
- <template #content>Lorem</template>
120
- </AntTooltip>
121
- </div>
122
- </div>
123
- </div>
124
- `
125
- })
126
- };
127
- export const Summary = {
128
- render: (args) => ({
129
- components: {
130
- AntTooltip,
131
- AntFormGroup,
132
- AntFormGroupLabel
133
- },
134
- setup() {
135
- return { args, Position, InputState };
136
- },
137
- template: `
138
- <AntFormGroup>
139
- <AntFormGroupLabel>Position</AntFormGroupLabel>
140
- <AntFormGroup direction="row" class="gap-x-32 py-16 dashed">
141
- <AntTooltip :position="Position.top">
142
- <div class="box">Hover me</div>
143
-
144
- <template #content>Lorem</template>
145
- </AntTooltip>
146
-
147
- <AntTooltip :position="Position.right">
148
- <div class="box">Hover me</div>
149
-
150
- <template #content>Lorem</template>
151
- </AntTooltip>
152
-
153
- <AntTooltip :position="Position.bottom">
154
- <div class="box">Hover me</div>
155
-
156
- <template #content>Lorem</template>
157
- </AntTooltip>
158
-
159
- <AntTooltip :position="Position.left">
160
- <div class="box">Hover me</div>
161
-
162
- <template #content>Lorem</template>
163
- </AntTooltip>
164
- </AntFormGroup>
165
-
166
- <AntFormGroupLabel>Color type</AntFormGroupLabel>
167
- <AntFormGroup direction="row" class="pb-16 dashed">
168
- <AntTooltip :position="Position.bottom" :state="InputState.base">
169
- <div class="box">Hover me</div>
170
-
171
- <template #content>Lorem</template>
172
- </AntTooltip>
173
-
174
- <AntTooltip :position="Position.bottom" :state="InputState.info">
175
- <div class="box">Hover me</div>
176
-
177
- <template #content>Lorem</template>
178
- </AntTooltip>
179
-
180
- <AntTooltip :position="Position.bottom" :state="InputState.success">
181
- <div class="box">Hover me</div>
182
-
183
- <template #content>Lorem</template>
184
- </AntTooltip>
185
-
186
- <AntTooltip :position="Position.bottom" :state="InputState.warning">
187
- <div class="box">Hover me</div>
188
-
189
- <template #content>Lorem</template>
190
- </AntTooltip>
191
-
192
- <AntTooltip :position="Position.bottom" :state="InputState.danger">
193
- <div class="box">Hover me</div>
194
-
195
- <template #content>Lorem</template>
196
- </AntTooltip>
197
- </AntFormGroup>
198
-
199
- <AntFormGroupLabel>Expanded</AntFormGroupLabel>
200
- <AntFormGroup class="p-32 dashed gap-y-16">
201
- <AntTooltip :position="Position.top" expanded>
202
- <div class="box">Hover me</div>
203
-
204
- <template #content>Lorem</template>
205
- </AntTooltip>
206
-
207
- <AntTooltip :position="Position.right" expanded>
208
- <div class="box">Hover me</div>
209
-
210
- <template #content>Lorem</template>
211
- </AntTooltip>
212
-
213
- <AntTooltip :position="Position.bottom" expanded>
214
- <div class="box">Hover me</div>
215
-
216
- <template #content>Lorem</template>
217
- </AntTooltip>
218
-
219
- <AntTooltip :position="Position.left" expanded>
220
- <div class="box">Hover me</div>
221
-
222
- <template #content>Lorem</template>
223
- </AntTooltip>
224
- </AntFormGroup>
225
- </AntFormGroup>
226
- `
227
- }),
228
- parameters: {
229
- chromatic: { disableSnapshot: false }
230
- },
231
- play: async ({ canvasElement, step }) => {
232
- const canvas = within(canvasElement);
233
- await step("Hover over the targets and expect showing the tooltips", async () => {
234
- const targets = canvas.getAllByText("Hover me");
235
- await Promise.all(targets.map(async (target) => {
236
- await userEvent.hover(target);
237
- }));
238
- await waitFor(() => expect(canvas.queryAllByText("Lorem")).toHaveLength(targets.length));
239
- });
240
- }
241
- };
@@ -1,4 +1,5 @@
1
1
  export declare enum AntKeycapSize {
2
+ md = "md",
2
3
  sm = "sm",
3
4
  xs = "xs"
4
5
  }
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.AntKeycapSize = void 0;
7
7
  var AntKeycapSize = exports.AntKeycapSize = /* @__PURE__ */(AntKeycapSize2 => {
8
+ AntKeycapSize2["md"] = "md";
8
9
  AntKeycapSize2["sm"] = "sm";
9
10
  AntKeycapSize2["xs"] = "xs";
10
11
  return AntKeycapSize2;
@@ -1,4 +1,5 @@
1
1
  export var AntKeycapSize = /* @__PURE__ */ ((AntKeycapSize2) => {
2
+ AntKeycapSize2["md"] = "md";
2
3
  AntKeycapSize2["sm"] = "sm";
3
4
  AntKeycapSize2["xs"] = "xs";
4
5
  return AntKeycapSize2;
@@ -196,58 +196,55 @@ onMounted(() => {
196
196
  />
197
197
 
198
198
  <AntTooltip
199
- :expanded="expanded"
200
- :position="tooltipPosition"
199
+ class="w-full"
201
200
  :state="tooltipState"
202
201
  :delay="tooltipDelay"
203
202
  >
204
- <template #default>
205
- <component
206
- :is="is"
207
- :class="classes"
208
- :type="type"
209
- :to="to"
210
- :disabled="disabled || undefined"
211
- :tabindex="noFocus || hasInputState ? '-1' : '0'"
212
- @click="() => !props.readonly ? $emit('click') : null"
213
- @blur="() => !props.readonly ? $emit('blur') : null"
203
+ <component
204
+ :is="is"
205
+ :class="classes"
206
+ :type="type"
207
+ :to="to"
208
+ :disabled="disabled || undefined"
209
+ :tabindex="noFocus || hasInputState ? '-1' : '0'"
210
+ @click="() => !props.readonly ? $emit('click') : null"
211
+ @blur="() => !props.readonly ? $emit('blur') : null"
212
+ >
213
+ <AntSpinner
214
+ v-if="spinner"
215
+ :size="size"
216
+ :state="state"
217
+ :inverted="!filled"
218
+ />
219
+
220
+ <slot
221
+ v-if="!spinner"
222
+ name="icon-left"
214
223
  >
215
- <AntSpinner
216
- v-if="spinner"
217
- :size="size"
218
- :state="state"
219
- :inverted="!filled"
224
+ <AntIcon
225
+ v-if="iconLeft"
226
+ :icon="iconLeft"
227
+ :size="getIconSize"
228
+ :color="iconColor"
220
229
  />
230
+ </slot>
221
231
 
222
- <slot
223
- v-if="!spinner"
224
- name="icon-left"
225
- >
226
- <AntIcon
227
- v-if="iconLeft"
228
- :icon="iconLeft"
229
- :size="getIconSize"
230
- :color="iconColor"
231
- />
232
- </slot>
232
+ <slot
233
+ v-if="!spinner"
234
+ />
233
235
 
234
- <slot
235
- v-if="!spinner"
236
+ <slot
237
+ v-if="!spinner"
238
+ name="icon-right"
239
+ >
240
+ <AntIcon
241
+ v-if="iconRight"
242
+ :icon="iconRight"
243
+ :size="getIconSize"
244
+ :color="iconColor"
236
245
  />
237
-
238
- <slot
239
- v-if="!spinner"
240
- name="icon-right"
241
- >
242
- <AntIcon
243
- v-if="iconRight"
244
- :icon="iconRight"
245
- :size="getIconSize"
246
- :color="iconColor"
247
- />
248
- </slot>
249
- </component>
250
- </template>
246
+ </slot>
247
+ </component>
251
248
 
252
249
  <template #content>
253
250
  <slot name="tooltip-content"/>