@antify/ui-module 1.1.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 (46) hide show
  1. package/dist/module.d.mts +2 -0
  2. package/dist/module.d.ts +2 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +3 -0
  5. package/dist/runtime/components/AntAccordionItem.vue +1 -1
  6. package/dist/runtime/components/AntTag.vue +3 -3
  7. package/dist/runtime/components/AntToast.vue +1 -0
  8. package/dist/runtime/components/{Main.stories.mdx → Main.mdx} +3 -2
  9. package/dist/runtime/components/Main.stories.d.ts +7 -0
  10. package/dist/runtime/components/Main.stories.mjs +8 -0
  11. package/dist/runtime/components/__stories/AntAccordion.stories.mjs +13 -10
  12. package/dist/runtime/components/__stories/AntKeycap.stories.d.ts +1 -1
  13. package/dist/runtime/components/__stories/AntKeycap.stories.mjs +15 -12
  14. package/dist/runtime/components/__types/AntIcon.types.d.ts +1 -0
  15. package/dist/runtime/components/__types/AntIcon.types.mjs +1 -0
  16. package/dist/runtime/components/buttons/__stories/AntButton.stories.mjs +3 -0
  17. package/dist/runtime/components/form/AntCheckboxWidget/__stories/AntCheckbox.stories.mjs +3 -0
  18. package/dist/runtime/components/form/AntSelect.vue +4 -51
  19. package/dist/runtime/components/form/AntSwitch.vue +8 -3
  20. package/dist/runtime/components/form/AntTagInput.vue +306 -0
  21. package/dist/runtime/components/form/Elements/AntDropDown.vue +53 -23
  22. package/dist/runtime/components/form/Elements/AntField.vue +2 -2
  23. package/dist/runtime/components/form/Elements/__stories/AntBaseInput.stories.mjs +3 -0
  24. package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.d.ts +1 -0
  25. package/dist/runtime/components/form/Elements/__types/AntBaseInput.type.mjs +1 -0
  26. package/dist/runtime/components/form/__stories/AntSelect.stories.mjs +3 -0
  27. package/dist/runtime/components/form/__stories/AntSwitch.stories.mjs +3 -0
  28. package/dist/runtime/components/form/__stories/AntSwitcher.stories.mjs +3 -0
  29. package/dist/runtime/components/form/__stories/AntTagInput.stories.d.ts +9 -0
  30. package/dist/runtime/components/form/__stories/AntTagInput.stories.mjs +106 -0
  31. package/dist/runtime/components/form/__stories/AntTextarea.stories.mjs +3 -0
  32. package/dist/runtime/components/form/index.d.ts +2 -1
  33. package/dist/runtime/components/form/index.mjs +2 -0
  34. package/dist/runtime/tailwind.config.d.ts +1 -0
  35. package/dist/runtime/tailwind.config.mjs +1 -0
  36. package/dist/runtime/types/AntTag.type.d.ts +1 -2
  37. package/dist/runtime/types/AntTag.type.mjs +1 -2
  38. package/package.json +20 -21
  39. package/src/runtime/components/AntAccordionItem.vue +2 -2
  40. package/src/runtime/components/AntTag.vue +3 -3
  41. package/src/runtime/components/AntToast.vue +1 -0
  42. package/src/runtime/components/form/AntSelect.vue +4 -51
  43. package/src/runtime/components/form/AntSwitch.vue +8 -3
  44. package/src/runtime/components/form/AntTagInput.vue +306 -0
  45. package/src/runtime/components/form/Elements/AntDropDown.vue +53 -23
  46. package/src/runtime/components/form/Elements/AntField.vue +2 -2
package/dist/module.d.mts CHANGED
@@ -48,6 +48,7 @@ declare enum CollapseStrategy {
48
48
  }
49
49
 
50
50
  declare enum IconSize {
51
+ xs = "xs",
51
52
  sm = "sm",
52
53
  md = "md",
53
54
  xl3 = "3xl"
@@ -111,6 +112,7 @@ declare enum ButtonType {
111
112
  declare enum BaseInputType {
112
113
  date = "date",
113
114
  datetime = "datetime",
115
+ datetimeLocal = "datetime-local",
114
116
  email = "email",
115
117
  hidden = "hidden",
116
118
  month = "month",
package/dist/module.d.ts CHANGED
@@ -48,6 +48,7 @@ declare enum CollapseStrategy {
48
48
  }
49
49
 
50
50
  declare enum IconSize {
51
+ xs = "xs",
51
52
  sm = "sm",
52
53
  md = "md",
53
54
  xl3 = "3xl"
@@ -111,6 +112,7 @@ declare enum ButtonType {
111
112
  declare enum BaseInputType {
112
113
  date = "date",
113
114
  datetime = "datetime",
115
+ datetimeLocal = "datetime-local",
114
116
  email = "email",
115
117
  hidden = "hidden",
116
118
  month = "month",
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "ui-module",
3
3
  "configKey": "uiModule",
4
- "version": "1.1.4"
4
+ "version": "1.2.0"
5
5
  }
package/dist/module.mjs CHANGED
@@ -2,6 +2,7 @@ import defaultColors from 'tailwindcss/colors.js';
2
2
  import { defineNuxtModule, createResolver, addPlugin, addImportsDir, addComponentsDir } from '@nuxt/kit';
3
3
 
4
4
  const colors = {
5
+ "transparent": defaultColors.transparent,
5
6
  "white": defaultColors.white,
6
7
  "black": defaultColors.black,
7
8
  "neutral-50": defaultColors.slate["50"],
@@ -252,6 +253,7 @@ var CollapseStrategy = /* @__PURE__ */ ((CollapseStrategy2) => {
252
253
  })(CollapseStrategy || {});
253
254
 
254
255
  var IconSize = /* @__PURE__ */ ((IconSize2) => {
256
+ IconSize2["xs"] = "xs";
255
257
  IconSize2["sm"] = "sm";
256
258
  IconSize2["md"] = "md";
257
259
  IconSize2["xl3"] = "3xl";
@@ -296,6 +298,7 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
296
298
  var BaseInputType = /* @__PURE__ */ ((BaseInputType2) => {
297
299
  BaseInputType2["date"] = "date";
298
300
  BaseInputType2["datetime"] = "datetime";
301
+ BaseInputType2["datetimeLocal"] = "datetime-local";
299
302
  BaseInputType2["email"] = "email";
300
303
  BaseInputType2["hidden"] = "hidden";
301
304
  BaseInputType2["month"] = "month";
@@ -62,5 +62,5 @@ function onClick() {
62
62
  </template>
63
63
 
64
64
  <style scoped>
65
- .bounce-enter-active{animation:bounce .6s}.bounce-leave-active{animation:bounce .6s reverse}@keyframes bounce{0%{opacity:0;transform:translateY(-100%)}50%{opacity:1;transform:translateY(5%)}to{opacity:1;transform:translateY(0)}}.slide-enter-active{animation:slide 1s}.slide-leave-active{animation:slide 1s reverse}@keyframes slide{0%{//transform:translateY(-100%);max-height:0;opacity:0}to{//transform:translateY(0);max-height:100%;opacity:1}}
65
+ .bounce-enter-active{animation:bounce .6s}.bounce-leave-active{animation:bounce .6s reverse}@keyframes bounce{0%{opacity:0;transform:translateY(-100%)}50%{opacity:1;transform:translateY(5%)}to{opacity:1;transform:translateY(0)}}.slide-enter-active{animation:slide 1s}.slide-leave-active{animation:slide 1s reverse}
66
66
  </style>
@@ -6,6 +6,7 @@ import {handleEnumValidation} from '../handler';
6
6
  import {type IconDefinition} from '@fortawesome/free-solid-svg-icons';
7
7
  import {faCircleXmark} from '@fortawesome/free-solid-svg-icons';
8
8
 
9
+ defineEmits(['close']);
9
10
  const props = withDefaults(defineProps<{
10
11
  colorType?: TagColorType,
11
12
  size?: Size;
@@ -13,7 +14,7 @@ const props = withDefaults(defineProps<{
13
14
  dismiss?: boolean
14
15
  }>(), {
15
16
  size: Size.md,
16
- colorType: TagColorType.neutral300,
17
+ colorType: TagColorType.base,
17
18
  dismiss: false
18
19
  });
19
20
 
@@ -21,8 +22,7 @@ const classes = computed(() => {
21
22
  const variants: Record<TagColorType, string> = {
22
23
  [TagColorType.danger]: 'bg-danger-500 text-danger-500-font',
23
24
  [TagColorType.info]: 'bg-info-500 text-info-500-font',
24
- [TagColorType.neutral300]: 'bg-neutral-300 text-neutral-300-font',
25
- [TagColorType.neutral50]: 'bg-neutral-50 text-neutral-50-font',
25
+ [TagColorType.base]: 'bg-neutral-300 text-neutral-300-font',
26
26
  [TagColorType.success]: 'bg-success-500 text-success-500-font',
27
27
  [TagColorType.warning]: 'bg-warning-500 text-warning-500-font',
28
28
  };
@@ -68,6 +68,7 @@ onMounted(() => {
68
68
  <div
69
69
  :class="classes"
70
70
  data-e2e="toast"
71
+ :data-e2e-color-type="props.colorType"
71
72
  >
72
73
  <div class="inline-flex items-center justify-between w-content gap-2.5">
73
74
  <div class="inline-flex items-center gap-2.5">
@@ -1,6 +1,7 @@
1
- import { Canvas, Meta, Story } from '@storybook/addon-docs';
1
+ import { Canvas, Meta, Story } from '@storybook/blocks';
2
+ import * as MainStories from './Main.stories';
2
3
 
3
- <Meta title="Main" />
4
+ <Meta of={MainStories} />
4
5
 
5
6
  <h1>This is the storybook for Antify UI.</h1>
6
7
 
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ title: string;
3
+ };
4
+ export default _default;
5
+ export declare const Main: () => {
6
+ template: string;
7
+ };
@@ -0,0 +1,8 @@
1
+ export default {
2
+ title: "Main"
3
+ };
4
+ export const Main = () => {
5
+ return {
6
+ template: "<div>main</div>"
7
+ };
8
+ };
@@ -15,15 +15,18 @@ const meta = {
15
15
  };
16
16
  export default meta;
17
17
  export const Docs = {
18
+ parameters: {
19
+ chromatic: { disableSnapshot: false }
20
+ },
18
21
  render: (args) => ({
19
22
  components: { AntAccordion, AntAccordionItem },
20
23
  setup() {
21
24
  return { args };
22
25
  },
23
26
  template: `
24
- <div class="p-4">
25
- <AntAccordion v-bind="args"/>
26
- </div>`
27
+ <div class="p-4">
28
+ <AntAccordion v-bind="args"/>
29
+ </div>`
27
30
  }),
28
31
  args: {
29
32
  items: [
@@ -53,13 +56,13 @@ export const CustomContent = {
53
56
  return { args };
54
57
  },
55
58
  template: `
56
- <div class="p-4">
57
- <AntAccordion v-bind="args">
58
- <template #item-content="{item, index}">
59
- <div class="text-danger-500">{{ item.content }}</div>
60
- </template>
61
- </AntAccordion>
62
- </div>`
59
+ <div class="p-4">
60
+ <AntAccordion v-bind="args">
61
+ <template #item-content="{item, index}">
62
+ <div class="text-danger-500">{{ item.content }}</div>
63
+ </template>
64
+ </AntAccordion>
65
+ </div>`
63
66
  }),
64
67
  args: {
65
68
  ...Docs.args
@@ -1,5 +1,5 @@
1
1
  import AntKeycap from '../AntKeycap.vue';
2
- import { type Meta, type StoryObj } from "@storybook/vue3";
2
+ import { type Meta, type StoryObj } from '@storybook/vue3';
3
3
  declare const meta: Meta<typeof AntKeycap>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntKeycap>;
@@ -36,24 +36,27 @@ export const Icon = {
36
36
  }
37
37
  };
38
38
  export const Summary = {
39
+ parameters: {
40
+ chromatic: { disableSnapshot: false }
41
+ },
39
42
  render: (args) => ({
40
43
  components: { AntKeycap, faChevronUp, faChevronDown },
41
44
  setup() {
42
45
  return { args, faChevronUp, faChevronDown };
43
46
  },
44
47
  template: `
45
- <div class="p-4">
46
- Press
47
- <AntKeycap v-bind="args" :icon="faChevronUp"/>
48
- or
49
- <AntKeycap v-bind="args" :icon="faChevronDown"/>
50
- to navigate. Press
51
- <AntKeycap v-bind="args">ctl</AntKeycap>
52
- +
53
- <AntKeycap v-bind="args">K</AntKeycap>
54
- to search.
55
- </div>
56
- `
48
+ <div class="p-4">
49
+ Press
50
+ <AntKeycap v-bind="args" :icon="faChevronUp"/>
51
+ or
52
+ <AntKeycap v-bind="args" :icon="faChevronDown"/>
53
+ to navigate. Press
54
+ <AntKeycap v-bind="args">ctl</AntKeycap>
55
+ +
56
+ <AntKeycap v-bind="args">K</AntKeycap>
57
+ to search.
58
+ </div>
59
+ `
57
60
  }),
58
61
  args: {}
59
62
  };
@@ -1,4 +1,5 @@
1
1
  export declare enum IconSize {
2
+ xs = "xs",
2
3
  sm = "sm",
3
4
  md = "md",
4
5
  xl3 = "3xl"
@@ -1,4 +1,5 @@
1
1
  export var IconSize = /* @__PURE__ */ ((IconSize2) => {
2
+ IconSize2["xs"] = "xs";
2
3
  IconSize2["sm"] = "sm";
3
4
  IconSize2["md"] = "md";
4
5
  IconSize2["xl3"] = "3xl";
@@ -139,6 +139,9 @@ export const WithoutBorder = {
139
139
  }
140
140
  };
141
141
  export const Summary = {
142
+ parameters: {
143
+ chromatic: { disableSnapshot: false }
144
+ },
142
145
  render: (args) => ({
143
146
  components: {
144
147
  AntButton,
@@ -65,6 +65,9 @@ export const WithValidator = {
65
65
  })
66
66
  };
67
67
  export const Summary = {
68
+ parameters: {
69
+ chromatic: { disableSnapshot: false }
70
+ },
68
71
  render: (args) => ({
69
72
  components: { AntCheckbox },
70
73
  setup() {
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import AntField from './Elements/AntField.vue';
16
16
  import {type SelectOption} from './__types/AntSelect.type';
17
- import {computed, onMounted, ref, watch, nextTick} from 'vue';
17
+ import {computed, onMounted, ref} from 'vue';
18
18
  import {Size} from '../../enums/Size.enum';
19
19
  import {FieldValidator} from '@antify/validate';
20
20
  import {handleEnumValidation} from '../../handler';
@@ -164,13 +164,6 @@ onMounted(() => {
164
164
 
165
165
  focusedDropDownItem.value = _modelValue.value;
166
166
  });
167
- watch(isOpen, (val) => {
168
- nextTick(() => {
169
- if (val) {
170
- dropDownRef.value?.focus();
171
- }
172
- });
173
- });
174
167
 
175
168
  function onClickOutside() {
176
169
  if (!isOpen.value) {
@@ -181,47 +174,6 @@ function onClickOutside() {
181
174
  inputRef.value?.focus();
182
175
  }
183
176
 
184
- function onKeyDownInput(e: KeyboardEvent) {
185
- if (e.key === 'Enter') {
186
- isOpen.value = true;
187
- inputRef.value?.blur();
188
- }
189
-
190
- if (e.key === 'Escape') {
191
- isOpen.value = false;
192
- inputRef.value?.focus();
193
- }
194
-
195
- if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
196
- const index = props.options.findIndex(option => option.value === _modelValue.value);
197
- const option = props.options[index + 1];
198
-
199
- if (index === -1) {
200
- _modelValue.value = props.options[0].value;
201
- } else if (option !== undefined) {
202
- _modelValue.value = option.value;
203
- }
204
- }
205
-
206
- if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
207
- const index = props.options.findIndex(option => option.value === _modelValue.value);
208
- const option = props.options[index - 1];
209
-
210
- if (option !== undefined) {
211
- _modelValue.value = option.value;
212
- }
213
- }
214
- }
215
-
216
- function onFocusInInput() {
217
- inputRef.value?.addEventListener('keydown', onKeyDownInput);
218
- }
219
-
220
- function onFocusOutInput(e: FocusEvent) {
221
- e.preventDefault();
222
- inputRef.value?.removeEventListener('keydown', onKeyDownInput);
223
- }
224
-
225
177
  function onClickSelectInput(e: MouseEvent) {
226
178
  e.preventDefault();
227
179
 
@@ -280,9 +232,8 @@ function onClickRemoveButton() {
280
232
  ref="inputRef"
281
233
  :tabindex="disabled ? undefined : 0"
282
234
  @mousedown="onClickSelectInput"
283
- @focusin="onFocusInInput"
284
- @focusout="onFocusOutInput"
285
235
  v-bind="$attrs"
236
+ @click="inputRef?.focus()"
286
237
  >
287
238
  <div
288
239
  v-if="_modelValue === null && placeholder !== undefined"
@@ -329,6 +280,8 @@ function onClickRemoveButton() {
329
280
  :input-ref="inputRef"
330
281
  :size="size"
331
282
  :color-type="_colorType"
283
+ @select-element="(e) => _modelValue = e"
284
+ close-on-enter
332
285
  />
333
286
  </div>
334
287
 
@@ -1,12 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import AntField from './Elements/AntField.vue';
3
- import { useVModel } from '@vueuse/core';
4
3
  import { computed, type Ref } from 'vue';
5
4
  import { FieldValidator } from '@antify/validate';
6
5
  import AntSkeleton from '../AntSkeleton.vue';
7
6
  import { InputColorType, Size } from '../../enums';
8
7
 
9
- const emits = defineEmits([ 'update:modelValue' ]);
8
+ const emits = defineEmits([ 'update:modelValue', 'input' ]);
10
9
  const props = withDefaults(defineProps<{
11
10
  modelValue: boolean;
12
11
  label?: string;
@@ -23,7 +22,13 @@ const props = withDefaults(defineProps<{
23
22
  colorType: InputColorType.base
24
23
  });
25
24
 
26
- const _value = useVModel(props, 'modelValue', emits);
25
+ const _value = computed({
26
+ get: () => props.modelValue,
27
+ set: (value: boolean) => {
28
+ emits('update:modelValue', value)
29
+ emits('input', value)
30
+ }
31
+ });
27
32
  const hasAction = computed(() => (!props.skeleton && !props.readonly && !props.disabled))
28
33
  const _colorType: Ref<InputColorType> = computed(() => props.validator?.hasErrors() ? InputColorType.danger : props.colorType);
29
34