@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
- exports.withValidator = exports.summary = exports.default = exports.Docs = exports.AllowCreate = void 0;
6
+ exports.summary = exports.default = exports.Docs = exports.AllowCreate = void 0;
7
7
  var _AntTagInput = _interopRequireDefault(require("../AntTagInput.vue"));
8
8
  var _vue = require("vue");
9
9
  var _enums = require("../../../enums");
10
10
  var _AntTagInput2 = require("../__types/AntTagInput.types");
11
- var _validate = require("@antify/validate");
12
11
  var _AntFormGroup = _interopRequireDefault(require("../../forms/AntFormGroup.vue"));
13
12
  var _AntFormGroupLabel = _interopRequireDefault(require("../../forms/AntFormGroupLabel.vue"));
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -49,7 +48,6 @@ const meta = {
49
48
  }
50
49
  },
51
50
  createCallback: {
52
- control: "none",
53
51
  description: "If allowCreate is true the createCallback needs to be specified. It will be called when the user creates a new tag. It should return a promise that resolves to a SelectOption.",
54
52
  table: {
55
53
  type: {
@@ -102,38 +100,6 @@ const Docs = exports.Docs = {
102
100
  options
103
101
  }
104
102
  };
105
- const withValidator = exports.withValidator = {
106
- render: args => ({
107
- components: {
108
- AntTagInput: _AntTagInput.default
109
- },
110
- setup() {
111
- const value = (0, _vue.ref)(null);
112
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val?.length <= 3 || "Max 3 tags are allowed"));
113
- return {
114
- args,
115
- value,
116
- validator,
117
- InputState: _enums.InputState
118
- };
119
- },
120
- template: `
121
- <div style="width: 360px">
122
- <AntTagInput
123
- v-model="value"
124
- v-bind="args"
125
- description="Choose max. 3 tags."
126
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
127
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
128
- @validate="(val) => validator.validate(val)"
129
- />
130
- </div>
131
- `
132
- }),
133
- args: {
134
- options
135
- }
136
- };
137
103
  const AllowCreate = exports.AllowCreate = {
138
104
  render: Docs.render,
139
105
  args: {
@@ -1,9 +1,7 @@
1
1
  import AntTagInput from "../AntTagInput.vue";
2
- import { reactive } from "vue";
3
2
  import { ref } from "vue";
4
3
  import { InputState } from "../../../enums/index.mjs";
5
4
  import { AntTagInputSize } from "../__types/AntTagInput.types.mjs";
6
- import { useFieldValidator } from "@antify/validate";
7
5
  import AntFormGroup from "../../forms/AntFormGroup.vue";
8
6
  import AntFormGroupLabel from "../../forms/AntFormGroupLabel.vue";
9
7
  const meta = {
@@ -27,7 +25,6 @@ const meta = {
27
25
  table: { defaultValue: { summary: "this.label" } }
28
26
  },
29
27
  createCallback: {
30
- control: "none",
31
28
  description: "If allowCreate is true the createCallback needs to be specified. It will be called when the user creates a new tag. It should return a promise that resolves to a SelectOption.",
32
29
  table: {
33
30
  type: {
@@ -83,36 +80,6 @@ export const Docs = {
83
80
  options
84
81
  }
85
82
  };
86
- export const withValidator = {
87
- render: (args) => ({
88
- components: { AntTagInput },
89
- setup() {
90
- const value = ref(null);
91
- const validator = reactive(useFieldValidator((val) => val?.length <= 3 || "Max 3 tags are allowed"));
92
- return {
93
- args,
94
- value,
95
- validator,
96
- InputState
97
- };
98
- },
99
- template: `
100
- <div style="width: 360px">
101
- <AntTagInput
102
- v-model="value"
103
- v-bind="args"
104
- description="Choose max. 3 tags."
105
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
106
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
107
- @validate="(val) => validator.validate(val)"
108
- />
109
- </div>
110
- `
111
- }),
112
- args: {
113
- options
114
- }
115
- };
116
83
  export const AllowCreate = {
117
84
  render: Docs.render,
118
85
  args: {
@@ -4,6 +4,4 @@ declare const meta: Meta<typeof AntTextInput>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntTextInput>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
- export declare const limited: Story;
9
7
  export declare const Summary: Story;
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.limited = exports.default = exports.Summary = exports.Docs = void 0;
6
+ module.exports = exports.Summary = exports.Docs = void 0;
7
7
  var _Size = require("../../../enums/Size.enum");
8
8
  var _AntTextInput = _interopRequireDefault(require("../AntTextInput.vue"));
9
- var _validate = require("@antify/validate");
10
9
  var _AntTextInput2 = require("../__types/AntTextInput.types");
11
10
  var _enums = require("../../../enums");
12
- var _vue = require("vue");
13
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
12
  const meta = {
15
13
  title: "Inputs/Text Input",
@@ -88,110 +86,6 @@ const Docs = exports.Docs = {
88
86
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
89
87
  }
90
88
  };
91
- const withValidator = exports.withValidator = {
92
- render: args => ({
93
- components: {
94
- AntTextInput: _AntTextInput.default
95
- },
96
- setup() {
97
- const errorValidator = (0, _vue.reactive)((0, _validate.useFieldValidator)([_validate.isRequiredRule, _validate.notBlankRule]));
98
- const warningValidator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val?.length >= 1 && val?.length <= 4 ? "It`s recommended to have a value with a length greater than 4" : true));
99
- const infoValidator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val?.length >= 5 && val?.length <= 8 ? "Way better! But if you type in 4 characters more, the value is perfect!" : true));
100
- const successValidator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val?.length >= 9 ? "Yes! The value length is big enough now" : true));
101
- const state = (0, _vue.computed)(() => {
102
- if (args.state) {
103
- return args.state;
104
- }
105
- if (errorValidator.hasErrors()) {
106
- return _enums.InputState.danger;
107
- }
108
- if (warningValidator.hasErrors()) {
109
- return _enums.InputState.warning;
110
- }
111
- if (infoValidator.hasErrors()) {
112
- return _enums.InputState.info;
113
- }
114
- if (successValidator.hasErrors()) {
115
- return _enums.InputState.success;
116
- }
117
- return void 0;
118
- });
119
- const messages = (0, _vue.computed)(() => {
120
- if (args.messages) {
121
- return args.messages;
122
- }
123
- if (errorValidator.hasErrors()) {
124
- return errorValidator.getErrors();
125
- }
126
- if (warningValidator.hasErrors()) {
127
- return warningValidator.getErrors();
128
- }
129
- if (infoValidator.hasErrors()) {
130
- return infoValidator.getErrors();
131
- }
132
- if (successValidator.hasErrors()) {
133
- return successValidator.getErrors();
134
- }
135
- return void 0;
136
- });
137
- function validate(val) {
138
- errorValidator.validate(val);
139
- warningValidator.validate(val);
140
- infoValidator.validate(val);
141
- successValidator.validate(val);
142
- }
143
- return {
144
- args,
145
- validate,
146
- state,
147
- messages,
148
- InputState: _enums.InputState
149
- };
150
- },
151
- template: `
152
- <AntTextInput
153
- v-bind="args"
154
- v-model="args.modelValue"
155
- :state="state"
156
- :messages="messages"
157
- @validate="validate"
158
- />`
159
- }),
160
- args: {
161
- modelValue: null,
162
- label: "Label",
163
- description: "Focus in the element and blur out. After that, follow the error, warning, info and success instructions"
164
- }
165
- };
166
- const limited = exports.limited = {
167
- render: args => ({
168
- components: {
169
- AntTextInput: _AntTextInput.default
170
- },
171
- setup() {
172
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([val => val.length <= 10 || "Max. 10 characters allowed"]));
173
- return {
174
- args,
175
- validator,
176
- InputState: _enums.InputState
177
- };
178
- },
179
- template: `
180
- <AntTextInput
181
- v-bind="args"
182
- v-model="args.modelValue"
183
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
184
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
185
- @validate="(val) => validator.validate(val)"
186
- />`
187
- }),
188
- args: {
189
- ...Docs.args,
190
- modelValue: "A to long value",
191
- max: 10,
192
- limiter: true
193
- }
194
- };
195
89
  const Summary = exports.Summary = {
196
90
  parameters: {
197
91
  chromatic: {
@@ -1,9 +1,7 @@
1
1
  import { Size } from "../../../enums/Size.enum.mjs";
2
2
  import AntTextInput from "../AntTextInput.vue";
3
- import { isRequiredRule, notBlankRule, useFieldValidator } from "@antify/validate";
4
3
  import { TextInputType } from "../__types/AntTextInput.types.mjs";
5
4
  import { InputState } from "../../../enums/index.mjs";
6
- import { computed, reactive } from "vue";
7
5
  const meta = {
8
6
  title: "Inputs/Text Input",
9
7
  component: AntTextInput,
@@ -51,108 +49,6 @@ export const Docs = {
51
49
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
52
50
  }
53
51
  };
54
- export const withValidator = {
55
- render: (args) => ({
56
- components: { AntTextInput },
57
- setup() {
58
- const errorValidator = reactive(useFieldValidator([isRequiredRule, notBlankRule]));
59
- const warningValidator = reactive(useFieldValidator(
60
- (val) => val?.length >= 1 && val?.length <= 4 ? "It`s recommended to have a value with a length greater than 4" : true
61
- ));
62
- const infoValidator = reactive(useFieldValidator(
63
- (val) => val?.length >= 5 && val?.length <= 8 ? "Way better! But if you type in 4 characters more, the value is perfect!" : true
64
- ));
65
- const successValidator = reactive(useFieldValidator(
66
- (val) => val?.length >= 9 ? "Yes! The value length is big enough now" : true
67
- ));
68
- const state = computed(() => {
69
- if (args.state) {
70
- return args.state;
71
- }
72
- if (errorValidator.hasErrors()) {
73
- return InputState.danger;
74
- }
75
- if (warningValidator.hasErrors()) {
76
- return InputState.warning;
77
- }
78
- if (infoValidator.hasErrors()) {
79
- return InputState.info;
80
- }
81
- if (successValidator.hasErrors()) {
82
- return InputState.success;
83
- }
84
- return void 0;
85
- });
86
- const messages = computed(() => {
87
- if (args.messages) {
88
- return args.messages;
89
- }
90
- if (errorValidator.hasErrors()) {
91
- return errorValidator.getErrors();
92
- }
93
- if (warningValidator.hasErrors()) {
94
- return warningValidator.getErrors();
95
- }
96
- if (infoValidator.hasErrors()) {
97
- return infoValidator.getErrors();
98
- }
99
- if (successValidator.hasErrors()) {
100
- return successValidator.getErrors();
101
- }
102
- return void 0;
103
- });
104
- function validate(val) {
105
- errorValidator.validate(val);
106
- warningValidator.validate(val);
107
- infoValidator.validate(val);
108
- successValidator.validate(val);
109
- }
110
- return {
111
- args,
112
- validate,
113
- state,
114
- messages,
115
- InputState
116
- };
117
- },
118
- template: `
119
- <AntTextInput
120
- v-bind="args"
121
- v-model="args.modelValue"
122
- :state="state"
123
- :messages="messages"
124
- @validate="validate"
125
- />`
126
- }),
127
- args: {
128
- modelValue: null,
129
- label: "Label",
130
- description: "Focus in the element and blur out. After that, follow the error, warning, info and success instructions"
131
- }
132
- };
133
- export const limited = {
134
- render: (args) => ({
135
- components: { AntTextInput },
136
- setup() {
137
- const validator = reactive(useFieldValidator([(val) => val.length <= 10 || "Max. 10 characters allowed"]));
138
- return { args, validator, InputState };
139
- },
140
- template: `
141
- <AntTextInput
142
- v-bind="args"
143
- v-model="args.modelValue"
144
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
145
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
146
- @validate="(val) => validator.validate(val)"
147
- />`
148
- }),
149
- args: {
150
- ...Docs.args,
151
- modelValue: "A to long value",
152
- max: 10,
153
- limiter: true
154
- }
155
- };
156
52
  export const Summary = {
157
53
  parameters: {
158
54
  chromatic: { disableSnapshot: false }
@@ -4,6 +4,4 @@ declare const meta: Meta<typeof AntTextarea>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntTextarea>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
- export declare const limited: Story;
9
7
  export declare const summary: Story;
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.summary = exports.limited = exports.default = exports.Docs = void 0;
7
- var _validate = require("@antify/validate");
6
+ exports.summary = exports.default = exports.Docs = void 0;
8
7
  var _Grouped2 = require("../../../enums/Grouped.enum");
9
8
  var _Size = require("../../../enums/Size.enum");
10
9
  var _AntTextarea = _interopRequireDefault(require("../AntTextarea.vue"));
11
10
  var _enums = require("../../../enums");
12
- var _vue = require("vue");
13
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
12
  const meta = {
15
13
  title: "Inputs/Textarea",
@@ -78,10 +76,12 @@ const Docs = exports.Docs = {
78
76
  };
79
77
  },
80
78
  template: `
81
- <AntTextarea
82
- v-bind="args"
83
- v-model="args.modelValue"
84
- />
79
+ <div class="h-screen">
80
+ <AntTextarea
81
+ v-bind="args"
82
+ v-model="args.modelValue"
83
+ />
84
+ </div>
85
85
  `
86
86
  }),
87
87
  args: {
@@ -90,65 +90,6 @@ const Docs = exports.Docs = {
90
90
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
91
91
  }
92
92
  };
93
- const withValidator = exports.withValidator = {
94
- render: args => ({
95
- components: {
96
- AntTextarea: _AntTextarea.default
97
- },
98
- setup: () => {
99
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([_validate.isRequiredRule, _validate.notBlankRule]));
100
- return {
101
- args,
102
- validator,
103
- InputState: _enums.InputState
104
- };
105
- },
106
- template: `
107
- <AntTextarea
108
- v-bind="args"
109
- v-model="args.modelValue"
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
- modelValue: null,
118
- label: "Label",
119
- description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
120
- }
121
- };
122
- const limited = exports.limited = {
123
- render: args => ({
124
- components: {
125
- AntTextarea: _AntTextarea.default
126
- },
127
- setup: () => {
128
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)(val => val?.length <= 10 || "Max. 10 characters allowed"));
129
- return {
130
- args,
131
- validator,
132
- InputState: _enums.InputState
133
- };
134
- },
135
- template: `
136
- <AntTextarea
137
- v-bind="args"
138
- v-model="args.modelValue"
139
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
140
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
141
- @validate="(val) => validator.validate(val)"
142
- />
143
- `
144
- }),
145
- args: {
146
- ...Docs.args,
147
- modelValue: "A to long value",
148
- limiter: true,
149
- max: 10
150
- }
151
- };
152
93
  const summary = exports.summary = {
153
94
  parameters: {
154
95
  chromatic: {
@@ -1,9 +1,7 @@
1
- import { isRequiredRule, notBlankRule, useFieldValidator } from "@antify/validate";
2
1
  import { Grouped as _Grouped } from "../../../enums/Grouped.enum.mjs";
3
2
  import { Size } from "../../../enums/Size.enum.mjs";
4
3
  import AntTextarea from "../AntTextarea.vue";
5
4
  import { InputState } from "../../../enums/index.mjs";
6
- import { reactive } from "vue";
7
5
  const meta = {
8
6
  title: "Inputs/Textarea",
9
7
  component: AntTextarea,
@@ -45,10 +43,12 @@ export const Docs = {
45
43
  return { args };
46
44
  },
47
45
  template: `
48
- <AntTextarea
49
- v-bind="args"
50
- v-model="args.modelValue"
51
- />
46
+ <div class="h-screen">
47
+ <AntTextarea
48
+ v-bind="args"
49
+ v-model="args.modelValue"
50
+ />
51
+ </div>
52
52
  `
53
53
  }),
54
54
  args: {
@@ -57,55 +57,6 @@ export const Docs = {
57
57
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
58
58
  }
59
59
  };
60
- export const withValidator = {
61
- render: (args) => ({
62
- components: { AntTextarea },
63
- setup: () => {
64
- const validator = reactive(useFieldValidator([isRequiredRule, notBlankRule]));
65
- return { args, validator, InputState };
66
- },
67
- template: `
68
- <AntTextarea
69
- v-bind="args"
70
- v-model="args.modelValue"
71
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
72
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
73
- @validate="val => validator.validate(val)"
74
- />
75
- `
76
- }),
77
- args: {
78
- modelValue: null,
79
- label: "Label",
80
- description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
81
- }
82
- };
83
- export const limited = {
84
- render: (args) => ({
85
- components: { AntTextarea },
86
- setup: () => {
87
- const validator = reactive(useFieldValidator(
88
- (val) => val?.length <= 10 || "Max. 10 characters allowed"
89
- ));
90
- return { args, validator, InputState };
91
- },
92
- template: `
93
- <AntTextarea
94
- v-bind="args"
95
- v-model="args.modelValue"
96
- :state="args.state ? args.state : (validator.hasErrors() ? InputState.danger : undefined)"
97
- :messages="Array.isArray(args.messages) ? args.messages : validator.getErrors()"
98
- @validate="(val) => validator.validate(val)"
99
- />
100
- `
101
- }),
102
- args: {
103
- ...Docs.args,
104
- modelValue: "A to long value",
105
- limiter: true,
106
- max: 10
107
- }
108
- };
109
60
  export const summary = {
110
61
  parameters: {
111
62
  chromatic: { disableSnapshot: false }
@@ -4,6 +4,4 @@ declare const meta: Meta<typeof AntUnitInput>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof AntUnitInput>;
6
6
  export declare const Docs: Story;
7
- export declare const withValidator: Story;
8
- export declare const Limited: Story;
9
7
  export declare const UnitAsIcon: Story;
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withValidator = exports.default = exports.UnitAsIcon = exports.Limited = exports.Docs = void 0;
6
+ module.exports = exports.UnitAsIcon = exports.Docs = void 0;
7
7
  var _Size = require("../../../enums/Size.enum");
8
8
  var _AntUnitInput = _interopRequireDefault(require("../AntUnitInput.vue"));
9
9
  var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
10
10
  var _enums = require("../../../enums");
11
- var _validate = require("@antify/validate");
12
- var _vue = require("vue");
13
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
12
  const meta = {
15
13
  title: "Inputs/Unit Input",
@@ -91,64 +89,6 @@ const Docs = exports.Docs = {
91
89
  description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
92
90
  }
93
91
  };
94
- const withValidator = exports.withValidator = {
95
- render: args => ({
96
- components: {
97
- AntUnitInput: _AntUnitInput.default
98
- },
99
- setup() {
100
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([_validate.isRequiredRule]));
101
- return {
102
- args,
103
- validator,
104
- InputState: _enums.InputState
105
- };
106
- },
107
- template: `
108
- <AntUnitInput
109
- v-bind="args"
110
- v-model="args.modelValue"
111
- :unit="args.unit"
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
- }),
117
- args: {
118
- modelValue: null,
119
- unit: "\u20AC",
120
- label: "Label",
121
- description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod"
122
- }
123
- };
124
- const Limited = exports.Limited = {
125
- render: args => ({
126
- components: {
127
- AntUnitInput: _AntUnitInput.default
128
- },
129
- setup() {
130
- const validator = (0, _vue.reactive)((0, _validate.useFieldValidator)([_validate.isRequiredRule, val => val <= 10 || "Value should not be bigger than 10", val => val <= 11 || "It should be really not bigger than 10!!!!"]));
131
- return {
132
- args,
133
- validator
134
- };
135
- },
136
- template: `
137
- <AntUnitInput
138
- v-bind="args"
139
- v-model="args.modelValue"
140
- :unit="args.unit"
141
- :errors="Array.isArray(args.errors) ? args.errors : validator.getErrors()"
142
- @validate="(val) => validator.validate(val)"
143
- />`
144
- }),
145
- args: {
146
- ...Docs.args,
147
- modelValue: 50,
148
- limiter: true,
149
- max: 10
150
- }
151
- };
152
92
  const UnitAsIcon = exports.UnitAsIcon = {
153
93
  render: Docs.render,
154
94
  args: {