@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,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.summary = exports.default = exports.WithValidator = exports.Docs = void 0;
6
+ exports.summary = exports.default = exports.Docs = void 0;
7
7
  var _vue = require("vue");
8
8
  var _AntRadioGroup = _interopRequireDefault(require("../AntRadioGroup.vue"));
9
9
  var _enums = require("../../../enums");
10
- var _validate = require("@antify/validate");
11
10
  var _Direction = require("../../../enums/Direction.enum");
12
11
  var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
13
12
  var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
@@ -110,51 +109,6 @@ const Docs = exports.Docs = {
110
109
  radioButtons: simpleButtons
111
110
  }
112
111
  };
113
- const WithValidator = exports.WithValidator = {
114
- render: args => ({
115
- components: {
116
- AntRadioGroup: _AntRadioGroup.default
117
- },
118
- setup() {
119
- const value = (0, _vue.ref)(null);
120
- const validator = (0, _vue.ref)((0, _validate.useFieldValidator)([val => val !== "invalid-radio" || "Choose other option!"]));
121
- return {
122
- args,
123
- value,
124
- validator,
125
- InputState: _enums.InputState
126
- };
127
- },
128
- template: `
129
- <AntRadioGroup
130
- v-bind="args"
131
- v-model="value"
132
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
133
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
134
- @validate="(val) => validator.validate(val)"
135
- />
136
- `
137
- }),
138
- args: {
139
- radioButtons: [{
140
- id: "radio-1",
141
- label: "Radio 1",
142
- value: "radio-1"
143
- }, {
144
- id: "radio-2",
145
- label: "Radio 2",
146
- value: "radio-2"
147
- }, {
148
- id: "invalid-radio",
149
- label: "Invalid Radio",
150
- value: "invalid-radio"
151
- }, {
152
- id: "radio-4",
153
- label: "Radio 4",
154
- value: "radio-4"
155
- }]
156
- }
157
- };
158
112
  const summary = exports.summary = {
159
113
  parameters: {
160
114
  chromatic: {
@@ -1,7 +1,6 @@
1
1
  import { ref } from "vue";
2
2
  import AntRadioGroup from "../AntRadioGroup.vue";
3
3
  import { InputState, Size } from "../../../enums/index.mjs";
4
- import { useFieldValidator } from "@antify/validate";
5
4
  import { Direction } from "../../../enums/Direction.enum.mjs";
6
5
  import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
7
6
  import AntFormGroup from "../../forms/AntFormGroup.vue";
@@ -93,51 +92,6 @@ export const Docs = {
93
92
  radioButtons: simpleButtons
94
93
  }
95
94
  };
96
- export const WithValidator = {
97
- render: (args) => ({
98
- components: { AntRadioGroup },
99
- setup() {
100
- const value = ref(null);
101
- const validator = ref(useFieldValidator([
102
- (val) => val !== "invalid-radio" || "Choose other option!"
103
- ]));
104
- return { args, value, validator, InputState };
105
- },
106
- template: `
107
- <AntRadioGroup
108
- v-bind="args"
109
- v-model="value"
110
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
111
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
112
- @validate="(val) => validator.validate(val)"
113
- />
114
- `
115
- }),
116
- args: {
117
- radioButtons: [
118
- {
119
- id: "radio-1",
120
- label: "Radio 1",
121
- value: "radio-1"
122
- },
123
- {
124
- id: "radio-2",
125
- label: "Radio 2",
126
- value: "radio-2"
127
- },
128
- {
129
- id: "invalid-radio",
130
- label: "Invalid Radio",
131
- value: "invalid-radio"
132
- },
133
- {
134
- id: "radio-4",
135
- label: "Radio 4",
136
- value: "radio-4"
137
- }
138
- ]
139
- }
140
- };
141
95
  export const summary = {
142
96
  parameters: {
143
97
  chromatic: { disableSnapshot: false }
@@ -4,4 +4,3 @@ declare const meta: Meta<typeof AntRangeSlider>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntRangeSlider>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.default = exports.Docs = void 0;
6
+ module.exports = exports.Docs = void 0;
7
7
  var _AntRangeSlider = _interopRequireDefault(require("../AntRangeSlider.vue"));
8
8
  var _vue = require("vue");
9
9
  var _enums = require("../../../enums");
10
- var _validate = require("@antify/validate");
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  const meta = {
13
12
  title: "Inputs/Range Slider",
@@ -52,35 +51,4 @@ const Docs = exports.Docs = {
52
51
  <AntRangeSlider v-bind="args" v-model="value"/>
53
52
  `
54
53
  })
55
- };
56
- const withValidator = exports.withValidator = {
57
- render: args => ({
58
- components: {
59
- AntRangeSlider: _AntRangeSlider.default
60
- },
61
- setup() {
62
- const value = (0, _vue.ref)(1);
63
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val > 80 || "The value must be bigger than 80!"));
64
- return {
65
- args,
66
- value,
67
- validator,
68
- InputState: _enums.InputState
69
- };
70
- },
71
- template: `
72
- <AntRangeSlider
73
- v-bind="args"
74
- v-model="value"
75
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
76
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
77
- @validate="(val) => validator.validate(val)"
78
- />
79
- <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
80
- `
81
- }),
82
- args: {
83
- max: 100,
84
- description: "Lorem ipsum dolor sit amet"
85
- }
86
54
  };
@@ -1,7 +1,6 @@
1
1
  import AntRangeSlider from "../AntRangeSlider.vue";
2
- import { reactive, ref } from "vue";
2
+ import { ref } from "vue";
3
3
  import { InputState } from "../../../enums/index.mjs";
4
- import { useFieldValidator } from "@antify/validate";
5
4
  const meta = {
6
5
  title: "Inputs/Range Slider",
7
6
  component: AntRangeSlider,
@@ -39,29 +38,3 @@ export const Docs = {
39
38
  `
40
39
  })
41
40
  };
42
- export const withValidator = {
43
- render: (args) => ({
44
- components: { AntRangeSlider },
45
- setup() {
46
- const value = ref(1);
47
- const validator = reactive(useFieldValidator(
48
- (val) => val > 80 || "The value must be bigger than 80!"
49
- ));
50
- return { args, value, validator, InputState };
51
- },
52
- template: `
53
- <AntRangeSlider
54
- v-bind="args"
55
- v-model="value"
56
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
57
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
58
- @validate="(val) => validator.validate(val)"
59
- />
60
- <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
61
- `
62
- }),
63
- args: {
64
- max: 100,
65
- description: "Lorem ipsum dolor sit amet"
66
- }
67
- };
@@ -4,7 +4,6 @@ declare const meta: Meta<typeof AntSelect>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntSelect>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
7
  export declare const nullable: Story;
9
8
  export declare const skeleton: Story;
10
9
  export declare const disabled: Story;
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.ellipsisText = exports.disabled = exports.default = exports.Docs = void 0;
6
+ exports.withPlaceholder = exports.summary = exports.skeleton = exports.nullable = exports.ellipsisText = exports.disabled = exports.default = exports.Docs = void 0;
7
7
  var _Size = require("../../../enums/Size.enum");
8
8
  var _AntSelect = _interopRequireDefault(require("../AntSelect.vue"));
9
+ var _AntSelectMenu = _interopRequireDefault(require("../Elements/AntSelectMenu.vue"));
9
10
  var _vue = require("vue");
10
- var _validate = require("@antify/validate");
11
11
  var _enums = require("../../../enums");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  const meta = {
@@ -78,7 +78,8 @@ const options = [{
78
78
  const Docs = exports.Docs = {
79
79
  render: args => ({
80
80
  components: {
81
- AntSelect: _AntSelect.default
81
+ AntSelect: _AntSelect.default,
82
+ AntDropdown: _AntSelectMenu.default
82
83
  },
83
84
  setup() {
84
85
  const modelValue = (0, _vue.computed)({
@@ -87,13 +88,25 @@ const Docs = exports.Docs = {
87
88
  // @ts-ignore
88
89
  set: val => args.modelValue = val
89
90
  });
91
+ const scrollContainer = (0, _vue.ref)(void 0);
92
+ (0, _vue.onMounted)(() => {
93
+ if (scrollContainer.value) {
94
+ scrollContainer.value.scrollTop = (scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight) / 2;
95
+ }
96
+ });
90
97
  return {
91
98
  args,
92
- modelValue
99
+ modelValue,
100
+ scrollContainer
93
101
  };
94
102
  },
95
103
  template: `
96
- <AntSelect v-bind="args" v-model="modelValue"/>`
104
+ <div ref="scrollContainer" class="overflow-y-auto h-[100vh] p-2.5 dashed">
105
+ <div class="flex items-center h-[200vh]">
106
+ <AntSelect v-bind="args" v-model="modelValue"/>
107
+ </div>
108
+ </div>
109
+ `
97
110
  }),
98
111
  args: {
99
112
  modelValue: null,
@@ -102,47 +115,6 @@ const Docs = exports.Docs = {
102
115
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
103
116
  }
104
117
  };
105
- const withValidator = exports.withValidator = {
106
- render: args => ({
107
- components: {
108
- AntSelect: _AntSelect.default
109
- },
110
- setup() {
111
- const modelValue = (0, _vue.computed)({
112
- // @ts-ignore
113
- get: () => args.modelValue,
114
- // @ts-ignore
115
- set: val => args.modelValue = val
116
- });
117
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([val => val !== null || "This field should not be empty", val => val === "invalid" ? 'Value "Invalid" is not allowed' : true]));
118
- return {
119
- args,
120
- modelValue,
121
- validator,
122
- InputState: _enums.InputState
123
- };
124
- },
125
- template: `
126
- <AntSelect
127
- v-bind="args"
128
- v-model="modelValue"
129
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
130
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
131
- @validate="(val) => validator.validate(val)"
132
- />`
133
- }),
134
- args: {
135
- ...Docs.args,
136
- options: [{
137
- label: "Valid",
138
- value: "valid"
139
- }, {
140
- label: "Invalid",
141
- value: "invalid"
142
- }],
143
- nullable: true
144
- }
145
- };
146
118
  const nullable = exports.nullable = {
147
119
  render: Docs.render,
148
120
  args: {
@@ -1,7 +1,7 @@
1
1
  import { Size } from "../../../enums/Size.enum.mjs";
2
2
  import AntSelect from "../AntSelect.vue";
3
- import { computed, reactive } from "vue";
4
- import { useFieldValidator } from "@antify/validate";
3
+ import AntDropdown from "../Elements/AntSelectMenu.vue";
4
+ import { computed, onMounted, ref } from "vue";
5
5
  import { InputState } from "../../../enums/index.mjs";
6
6
  const meta = {
7
7
  title: "Inputs/Select",
@@ -55,7 +55,7 @@ const options = [
55
55
  ];
56
56
  export const Docs = {
57
57
  render: (args) => ({
58
- components: { AntSelect },
58
+ components: { AntSelect, AntDropdown },
59
59
  setup() {
60
60
  const modelValue = computed({
61
61
  // @ts-ignore
@@ -63,10 +63,21 @@ export const Docs = {
63
63
  // @ts-ignore
64
64
  set: (val) => args.modelValue = val
65
65
  });
66
- return { args, modelValue };
66
+ const scrollContainer = ref(void 0);
67
+ onMounted(() => {
68
+ if (scrollContainer.value) {
69
+ scrollContainer.value.scrollTop = (scrollContainer.value.scrollHeight - scrollContainer.value.clientHeight) / 2;
70
+ }
71
+ });
72
+ return { args, modelValue, scrollContainer };
67
73
  },
68
74
  template: `
69
- <AntSelect v-bind="args" v-model="modelValue"/>`
75
+ <div ref="scrollContainer" class="overflow-y-auto h-[100vh] p-2.5 dashed">
76
+ <div class="flex items-center h-[200vh]">
77
+ <AntSelect v-bind="args" v-model="modelValue"/>
78
+ </div>
79
+ </div>
80
+ `
70
81
  }),
71
82
  args: {
72
83
  modelValue: null,
@@ -75,48 +86,6 @@ export const Docs = {
75
86
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
76
87
  }
77
88
  };
78
- export const withValidator = {
79
- render: (args) => ({
80
- components: { AntSelect },
81
- setup() {
82
- const modelValue = computed({
83
- // @ts-ignore
84
- get: () => args.modelValue,
85
- // @ts-ignore
86
- set: (val) => args.modelValue = val
87
- });
88
- const validator = reactive(
89
- useFieldValidator([
90
- (val) => val !== null || "This field should not be empty",
91
- (val) => val === "invalid" ? 'Value "Invalid" is not allowed' : true
92
- ])
93
- );
94
- return { args, modelValue, validator, InputState };
95
- },
96
- template: `
97
- <AntSelect
98
- v-bind="args"
99
- v-model="modelValue"
100
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
101
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
102
- @validate="(val) => validator.validate(val)"
103
- />`
104
- }),
105
- args: {
106
- ...Docs.args,
107
- options: [
108
- {
109
- label: "Valid",
110
- value: "valid"
111
- },
112
- {
113
- label: "Invalid",
114
- value: "invalid"
115
- }
116
- ],
117
- nullable: true
118
- }
119
- };
120
89
  export const nullable = {
121
90
  render: Docs.render,
122
91
  args: {
@@ -4,5 +4,4 @@ declare const meta: Meta<typeof AntSwitch>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntSwitch>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
7
  export declare const Summary: Story;
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.default = exports.Summary = exports.Docs = void 0;
6
+ module.exports = exports.Summary = exports.Docs = void 0;
7
7
  var _AntSwitch = _interopRequireDefault(require("../AntSwitch.vue"));
8
8
  var _vue = require("vue");
9
9
  var _enums = require("../../../enums");
10
- var _validate = require("@antify/validate");
11
10
  var _Size = require("../../../enums/Size.enum");
12
11
  var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
13
12
  var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
@@ -49,46 +48,6 @@ const Docs = exports.Docs = {
49
48
  modelValue: false
50
49
  }
51
50
  };
52
- const withValidator = exports.withValidator = {
53
- render: args => ({
54
- components: {
55
- AntSwitch: _AntSwitch.default
56
- },
57
- setup() {
58
- const value = (0, _vue.computed)({
59
- // @ts-ignore
60
- get: () => args.modelValue,
61
- // @ts-ignore
62
- set: val => args.modelValue = val
63
- });
64
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([val => {
65
- return !val || "Switch must be off";
66
- }]));
67
- return {
68
- args,
69
- value,
70
- validator,
71
- InputState: _enums.InputState
72
- };
73
- },
74
- template: `
75
- <AntSwitch
76
- v-bind="args"
77
- v-model="value"
78
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
79
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
80
- @validate="(val) => validator.validate(val)"
81
- >
82
- Value must be false
83
- </AntSwitch>
84
-
85
- <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
86
- `
87
- }),
88
- args: {
89
- ...Docs.args
90
- }
91
- };
92
51
  const Summary = exports.Summary = {
93
52
  parameters: {
94
53
  chromatic: {
@@ -1,7 +1,6 @@
1
1
  import AntSwitch from "../AntSwitch.vue";
2
- import { computed, reactive, ref } from "vue";
2
+ import { ref } from "vue";
3
3
  import { InputState } from "../../../enums/index.mjs";
4
- import { useFieldValidator } from "@antify/validate";
5
4
  import { Size } from "../../../enums/Size.enum.mjs";
6
5
  import AntFormGroup from "../../forms/AntFormGroup.vue";
7
6
  import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
@@ -34,41 +33,6 @@ export const Docs = {
34
33
  modelValue: false
35
34
  }
36
35
  };
37
- export const withValidator = {
38
- render: (args) => ({
39
- components: { AntSwitch },
40
- setup() {
41
- const value = computed({
42
- // @ts-ignore
43
- get: () => args.modelValue,
44
- // @ts-ignore
45
- set: (val) => args.modelValue = val
46
- });
47
- const validator = reactive(useFieldValidator([
48
- (val) => {
49
- return !val || "Switch must be off";
50
- }
51
- ]));
52
- return { args, value, validator, InputState };
53
- },
54
- template: `
55
- <AntSwitch
56
- v-bind="args"
57
- v-model="value"
58
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
59
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
60
- @validate="(val) => validator.validate(val)"
61
- >
62
- Value must be false
63
- </AntSwitch>
64
-
65
- <span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
66
- `
67
- }),
68
- args: {
69
- ...Docs.args
70
- }
71
- };
72
36
  export const Summary = {
73
37
  parameters: {
74
38
  chromatic: { disableSnapshot: false }
@@ -4,5 +4,4 @@ declare const meta: Meta<typeof AntSwitcher>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntSwitcher>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
7
  export declare const Summary: Story;
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.default = exports.Summary = exports.Docs = void 0;
6
+ module.exports = exports.Summary = exports.Docs = void 0;
7
7
  var _vue = require("vue");
8
8
  var _enums = require("../../../enums");
9
- var _validate = require("@antify/validate");
10
9
  var _AntSwitcher = _interopRequireDefault(require("../AntSwitcher.vue"));
11
10
  var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
12
11
  var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
@@ -85,55 +84,6 @@ const Docs = exports.Docs = {
85
84
  modelValue: "entry-1"
86
85
  }
87
86
  };
88
- const withValidator = exports.withValidator = {
89
- render: args => ({
90
- components: {
91
- AntSwitcher: _AntSwitcher.default
92
- },
93
- setup() {
94
- const modelValue = (0, _vue.computed)({
95
- // @ts-ignore
96
- get: () => args.modelValue,
97
- // @ts-ignore
98
- set: val => args.modelValue = val
99
- });
100
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val === "entry-1" ? "Select something else" : true));
101
- return {
102
- args,
103
- modelValue,
104
- validator,
105
- InputState: _enums.InputState
106
- };
107
- },
108
- template: `
109
- <AntSwitcher
110
- v-bind="args"
111
- v-model="modelValue"
112
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
113
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
114
- @validate="(val) => validator.validate(val)"
115
- >
116
- This value should be false
117
- </AntSwitcher>
118
- `
119
- }),
120
- args: {
121
- options: [{
122
- label: "Entry 1",
123
- value: "entry-1"
124
- }, {
125
- label: "Entry 2",
126
- value: "entry-2"
127
- }, {
128
- label: "Entry 3",
129
- value: "entry-3"
130
- }, {
131
- label: "Entry 4",
132
- value: "entry-4"
133
- }],
134
- modelValue: "entry-1"
135
- }
136
- };
137
87
  const Summary = exports.Summary = {
138
88
  parameters: {
139
89
  chromatic: {
@@ -1,6 +1,5 @@
1
- import { computed, reactive, ref } from "vue";
1
+ import { computed, ref } from "vue";
2
2
  import { Size } from "../../../enums/index.mjs";
3
- import { useFieldValidator } from "@antify/validate";
4
3
  import { InputState } from "../../../enums/index.mjs";
5
4
  import AntSwitcher from "../AntSwitcher.vue";
6
5
  import AntFormGroup from "../../forms/AntFormGroup.vue";
@@ -75,55 +74,6 @@ export const Docs = {
75
74
  modelValue: "entry-1"
76
75
  }
77
76
  };
78
- export const withValidator = {
79
- render: (args) => ({
80
- components: { AntSwitcher },
81
- setup() {
82
- const modelValue = computed({
83
- // @ts-ignore
84
- get: () => args.modelValue,
85
- // @ts-ignore
86
- set: (val) => args.modelValue = val
87
- });
88
- const validator = reactive(useFieldValidator(
89
- (val) => val === "entry-1" ? "Select something else" : true
90
- ));
91
- return { args, modelValue, validator, InputState };
92
- },
93
- template: `
94
- <AntSwitcher
95
- v-bind="args"
96
- v-model="modelValue"
97
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
98
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
99
- @validate="(val) => validator.validate(val)"
100
- >
101
- This value should be false
102
- </AntSwitcher>
103
- `
104
- }),
105
- args: {
106
- options: [
107
- {
108
- label: "Entry 1",
109
- value: "entry-1"
110
- },
111
- {
112
- label: "Entry 2",
113
- value: "entry-2"
114
- },
115
- {
116
- label: "Entry 3",
117
- value: "entry-3"
118
- },
119
- {
120
- label: "Entry 4",
121
- value: "entry-4"
122
- }
123
- ],
124
- modelValue: "entry-1"
125
- }
126
- };
127
77
  export const Summary = {
128
78
  parameters: {
129
79
  chromatic: { disableSnapshot: false }
@@ -4,6 +4,5 @@ declare const meta: Meta<typeof AntTagInput>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntTagInput>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
7
  export declare const AllowCreate: Story;
9
8
  export declare const summary: Story;