@antify/ui 4.1.36 → 4.1.38

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 (31) hide show
  1. package/dist/components/index.d.ts +3 -1
  2. package/dist/components/index.js +14 -0
  3. package/dist/components/index.mjs +4 -0
  4. package/dist/components/inputs/AntCheckbox.vue +37 -37
  5. package/dist/components/inputs/AntCountryInput.vue +366 -0
  6. package/dist/components/inputs/AntPhoneNumberInput.vue +347 -0
  7. package/dist/components/inputs/Elements/AntSelectMenu.vue +2 -0
  8. package/dist/components/inputs/__stories/AntCheckbox.stories.js +1 -1
  9. package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +1 -1
  10. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.d.ts +1 -0
  11. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.js +35 -2
  12. package/dist/components/inputs/__stories/AntCheckboxGroup.stories.mjs +39 -1
  13. package/dist/components/inputs/__stories/AntCountryInput.stories.d.ts +16 -0
  14. package/dist/components/inputs/__stories/AntCountryInput.stories.js +286 -0
  15. package/dist/components/inputs/__stories/AntCountryInput.stories.mjs +289 -0
  16. package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.d.ts +7 -0
  17. package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.js +303 -0
  18. package/dist/components/inputs/__stories/AntPhoneNumberInput.stories.mjs +305 -0
  19. package/dist/components/inputs/__types/AntCountryInput.types.d.ts +11 -0
  20. package/dist/components/inputs/__types/AntCountryInput.types.js +1 -0
  21. package/dist/components/inputs/__types/AntCountryInput.types.mjs +0 -0
  22. package/dist/components/inputs/__types/index.d.ts +1 -0
  23. package/dist/components/inputs/__types/index.js +11 -0
  24. package/dist/components/inputs/__types/index.mjs +1 -0
  25. package/dist/constants/countries.d.ts +22 -0
  26. package/dist/constants/countries.js +2009 -0
  27. package/dist/constants/countries.mjs +2185 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +11 -0
  30. package/dist/index.mjs +1 -0
  31. package/package.json +1 -1
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.summary = exports.default = exports.WithoutSearch = exports.WithoutFlags = exports.ValueKeyNumericCode = exports.Skeleton = exports.Localization = exports.GroupedMode = exports.GermanEmptyState = exports.Docs = exports.DefaultCountry = exports.DefaultByNumericCode = void 0;
7
+ var _AntCountryInput = _interopRequireDefault(require("../AntCountryInput.vue"));
8
+ var _AntField = _interopRequireDefault(require("../../../components/forms/AntField.vue"));
9
+ var _vue = require("vue");
10
+ var _enums = require("../../../enums");
11
+ var _countries = require("../../../constants/countries");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const meta = {
14
+ title: "Inputs/Country Input",
15
+ component: _AntCountryInput.default,
16
+ parameters: {
17
+ controls: {
18
+ sort: "requiredFirst"
19
+ }
20
+ },
21
+ argTypes: {
22
+ state: {
23
+ control: "select",
24
+ options: Object.values(_enums.InputState)
25
+ },
26
+ size: {
27
+ control: "select",
28
+ options: Object.values(_enums.Size)
29
+ },
30
+ grouped: {
31
+ control: {
32
+ type: "select"
33
+ },
34
+ options: Object.values(_enums.Grouped),
35
+ description: "Where is this fields position in a group"
36
+ },
37
+ locale: {
38
+ control: {
39
+ type: "select"
40
+ },
41
+ options: Object.values(_countries.Locale),
42
+ description: "Language for country labels"
43
+ },
44
+ optionValueKey: {
45
+ control: {
46
+ type: "select"
47
+ },
48
+ options: Object.values(_countries.CountryValueKey)
49
+ },
50
+ countries: {
51
+ table: {
52
+ disable: true
53
+ }
54
+ }
55
+ }
56
+ };
57
+ module.exports = meta;
58
+ const MainRender = args => ({
59
+ components: {
60
+ AntCountryInput: _AntCountryInput.default
61
+ },
62
+ setup() {
63
+ const modelValue = (0, _vue.ref)(args.modelValue);
64
+ return {
65
+ args,
66
+ modelValue
67
+ };
68
+ },
69
+ template: `
70
+ <div>
71
+ <AntCountryInput v-bind="args" v-model="modelValue" />
72
+
73
+ <div class="mt-2 text-md text-base-400">
74
+ Selected Value ({{ args.optionValueKey || 'default' }}):
75
+ <span class="text-blue-500 font-bold">{{ modelValue === null ? 'null' : modelValue }}</span>
76
+ </div>
77
+ </div>
78
+ `
79
+ });
80
+ const Docs = exports.Docs = {
81
+ render: MainRender,
82
+ args: {
83
+ modelValue: null,
84
+ searchable: true,
85
+ countries: _countries.COUNTRIES
86
+ }
87
+ };
88
+ const ValueKeyNumericCode = exports.ValueKeyNumericCode = {
89
+ render: MainRender,
90
+ args: {
91
+ ...Docs.args,
92
+ label: "Value as Numeric Code",
93
+ description: "Using the numericCode field from the data as the model value.",
94
+ optionValueKey: _countries.CountryValueKey.numericCode,
95
+ countries: _countries.COUNTRIES
96
+ }
97
+ };
98
+ const DefaultCountry = exports.DefaultCountry = {
99
+ render: MainRender,
100
+ args: {
101
+ ...Docs.args,
102
+ label: "Default Country Logic",
103
+ description: 'Preselects Germany (DE) by providing modelValue: "DE" to the component.',
104
+ modelValue: "DE"
105
+ }
106
+ };
107
+ const DefaultByNumericCode = exports.DefaultByNumericCode = {
108
+ render: MainRender,
109
+ args: {
110
+ ...Docs.args,
111
+ label: "Default by Numeric Code",
112
+ description: "Using numericCode: 33 (France) as the default value.",
113
+ optionValueKey: _countries.CountryValueKey.numericCode,
114
+ modelValue: 33
115
+ }
116
+ };
117
+ const Localization = exports.Localization = {
118
+ render: args => ({
119
+ components: {
120
+ AntCountryInput: _AntCountryInput.default
121
+ },
122
+ setup() {
123
+ const modelValue = (0, _vue.ref)("DE");
124
+ return {
125
+ args,
126
+ modelValue
127
+ };
128
+ },
129
+ template: `
130
+ <div class="flex flex-col gap-4">
131
+ <div>
132
+ <p class="text-xs text-base-400 mb-1">Current Locale: <b>{{ args.locale }}</b></p>
133
+ <AntCountryInput v-bind="args" v-model="modelValue" />
134
+ </div>
135
+
136
+ <div class="p-4 border border-dashed border-base-300 rounded-md bg-base-50">
137
+ <p class="text-sm italic text-base-500">
138
+ Try switching the <b>locale</b> control in the panel below to see labels change between
139
+ "Germany" (EN) and "Deutschland" (DE).
140
+ </p>
141
+ </div>
142
+ </div>
143
+ `
144
+ }),
145
+ args: {
146
+ ...Docs.args,
147
+ label: "Localized Selector",
148
+ locale: _countries.Locale.de,
149
+ searchPlaceholder: "Land suchen...",
150
+ description: "The labels and search logic adapt based on the provided locale."
151
+ }
152
+ };
153
+ const WithoutSearch = exports.WithoutSearch = {
154
+ render: MainRender,
155
+ args: {
156
+ ...Docs.args,
157
+ label: "No Search Field",
158
+ searchable: false
159
+ }
160
+ };
161
+ const WithoutFlags = exports.WithoutFlags = {
162
+ render: MainRender,
163
+ args: {
164
+ ...Docs.args,
165
+ label: "No Flags Mode",
166
+ showFlags: false
167
+ }
168
+ };
169
+ const GroupedMode = exports.GroupedMode = {
170
+ render: args => ({
171
+ components: {
172
+ AntCountryInput: _AntCountryInput.default,
173
+ AntField: _AntField.default
174
+ },
175
+ setup() {
176
+ const modelValue = (0, _vue.ref)(args.modelValue);
177
+ return {
178
+ args,
179
+ modelValue
180
+ };
181
+ },
182
+ template: `
183
+ <div>
184
+ <AntField
185
+ :label="args.label"
186
+ :description="args.description"
187
+ :size="args.size"
188
+ :state="args.state"
189
+ >
190
+ <div class="flex items-center">
191
+ <AntCountryInput
192
+ v-bind="args"
193
+ v-model="modelValue"
194
+ class="w-fit flex-shrink-0"
195
+ />
196
+
197
+ <div
198
+ class="flex-grow border border-l-0 p-2 text-sm text-base-400 bg-base-50 border-base-300 rounded-r-md h-[36px] flex items-center"
199
+ >
200
+ Input area...
201
+ </div>
202
+ </div>
203
+ </AntField>
204
+
205
+ <div class="mt-2 text-md text-base-400">
206
+ Value: {{ modelValue || null }}
207
+ </div>
208
+ </div>
209
+ `
210
+ }),
211
+ args: {
212
+ ...Docs.args,
213
+ label: "Grouped Mode (Phone Input Style)",
214
+ description: "When isGrouped is true, label and description must be provided by a parent AntField.",
215
+ isGrouped: true,
216
+ grouped: _enums.Grouped.left,
217
+ modelValue: "DE",
218
+ countries: _countries.COUNTRIES
219
+ }
220
+ };
221
+ const GermanEmptyState = exports.GermanEmptyState = {
222
+ render: MainRender,
223
+ args: {
224
+ ...Docs.args,
225
+ label: "German Empty State",
226
+ description: 'Custom empty state message: "Keine L\xE4nder gefunden". Open the dropdown to see it.',
227
+ searchPlaceholder: "Land suchen...",
228
+ emptyStateMessage: "Keine L\xE4nder gefunden",
229
+ countries: []
230
+ }
231
+ };
232
+ const Skeleton = exports.Skeleton = {
233
+ render: MainRender,
234
+ args: {
235
+ ...Docs.args,
236
+ skeleton: true
237
+ }
238
+ };
239
+ const summary = exports.summary = {
240
+ parameters: {
241
+ chromatic: {
242
+ disableSnapshot: false
243
+ }
244
+ },
245
+ render: args => ({
246
+ components: {
247
+ AntCountryInput: _AntCountryInput.default
248
+ },
249
+ setup() {
250
+ const val = (0, _vue.ref)("DE");
251
+ return {
252
+ args,
253
+ val,
254
+ InputState: _enums.InputState,
255
+ Size: _enums.Size,
256
+ COUNTRIES: _countries.COUNTRIES
257
+ };
258
+ },
259
+ template: `
260
+ <div class="p-4 flex flex-col gap-6">
261
+ <div class="flex flex-wrap gap-4">
262
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.base" label="Base" class="w-64"/>
263
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.info" label="Info" class="w-64"/>
264
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.success" label="Success" class="w-64"/>
265
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.warning" label="Warning" class="w-64"/>
266
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.danger" label="Danger" class="w-64"/>
267
+ </div>
268
+
269
+ <div class="flex items-end gap-4">
270
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.sm" label="Small" class="w-64"/>
271
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.md" label="Medium" class="w-64"/>
272
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.lg" label="Large" class="w-64"/>
273
+ </div>
274
+
275
+ <div class="flex gap-4">
276
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" disabled label="Disabled" class="w-64" />
277
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" readonly label="Readonly" class="w-64" />
278
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" skeleton label="Skeleton" class="w-64" />
279
+ </div>
280
+ </div>
281
+ `
282
+ }),
283
+ args: {
284
+ searchPlaceholder: "Search..."
285
+ }
286
+ };
@@ -0,0 +1,289 @@
1
+ import AntCountryInput from "../AntCountryInput.vue";
2
+ import AntField from "../../../components/forms/AntField.vue";
3
+ import {
4
+ ref
5
+ } from "vue";
6
+ import {
7
+ InputState,
8
+ Size,
9
+ Grouped
10
+ } from "../../../enums/index.mjs";
11
+ import {
12
+ COUNTRIES,
13
+ CountryValueKey,
14
+ Locale
15
+ } from "../../../constants/countries.mjs";
16
+ const meta = {
17
+ title: "Inputs/Country Input",
18
+ component: AntCountryInput,
19
+ parameters: {
20
+ controls: {
21
+ sort: "requiredFirst"
22
+ }
23
+ },
24
+ argTypes: {
25
+ state: {
26
+ control: "select",
27
+ options: Object.values(InputState)
28
+ },
29
+ size: {
30
+ control: "select",
31
+ options: Object.values(Size)
32
+ },
33
+ grouped: {
34
+ control: {
35
+ type: "select"
36
+ },
37
+ options: Object.values(Grouped),
38
+ description: "Where is this fields position in a group"
39
+ },
40
+ locale: {
41
+ control: {
42
+ type: "select"
43
+ },
44
+ options: Object.values(Locale),
45
+ description: "Language for country labels"
46
+ },
47
+ optionValueKey: {
48
+ control: {
49
+ type: "select"
50
+ },
51
+ options: Object.values(CountryValueKey)
52
+ },
53
+ countries: {
54
+ table: {
55
+ disable: true
56
+ }
57
+ }
58
+ }
59
+ };
60
+ export default meta;
61
+ const MainRender = (args) => ({
62
+ components: {
63
+ AntCountryInput
64
+ },
65
+ setup() {
66
+ const modelValue = ref(args.modelValue);
67
+ return {
68
+ args,
69
+ modelValue
70
+ };
71
+ },
72
+ template: `
73
+ <div>
74
+ <AntCountryInput v-bind="args" v-model="modelValue" />
75
+
76
+ <div class="mt-2 text-md text-base-400">
77
+ Selected Value ({{ args.optionValueKey || 'default' }}):
78
+ <span class="text-blue-500 font-bold">{{ modelValue === null ? 'null' : modelValue }}</span>
79
+ </div>
80
+ </div>
81
+ `
82
+ });
83
+ export const Docs = {
84
+ render: MainRender,
85
+ args: {
86
+ modelValue: null,
87
+ searchable: true,
88
+ countries: COUNTRIES
89
+ }
90
+ };
91
+ export const ValueKeyNumericCode = {
92
+ render: MainRender,
93
+ args: {
94
+ ...Docs.args,
95
+ label: "Value as Numeric Code",
96
+ description: "Using the numericCode field from the data as the model value.",
97
+ optionValueKey: CountryValueKey.numericCode,
98
+ countries: COUNTRIES
99
+ }
100
+ };
101
+ export const DefaultCountry = {
102
+ render: MainRender,
103
+ args: {
104
+ ...Docs.args,
105
+ label: "Default Country Logic",
106
+ description: 'Preselects Germany (DE) by providing modelValue: "DE" to the component.',
107
+ modelValue: "DE"
108
+ }
109
+ };
110
+ export const DefaultByNumericCode = {
111
+ render: MainRender,
112
+ args: {
113
+ ...Docs.args,
114
+ label: "Default by Numeric Code",
115
+ description: "Using numericCode: 33 (France) as the default value.",
116
+ optionValueKey: CountryValueKey.numericCode,
117
+ modelValue: 33
118
+ }
119
+ };
120
+ export const Localization = {
121
+ render: (args) => ({
122
+ components: {
123
+ AntCountryInput
124
+ },
125
+ setup() {
126
+ const modelValue = ref("DE");
127
+ return {
128
+ args,
129
+ modelValue
130
+ };
131
+ },
132
+ template: `
133
+ <div class="flex flex-col gap-4">
134
+ <div>
135
+ <p class="text-xs text-base-400 mb-1">Current Locale: <b>{{ args.locale }}</b></p>
136
+ <AntCountryInput v-bind="args" v-model="modelValue" />
137
+ </div>
138
+
139
+ <div class="p-4 border border-dashed border-base-300 rounded-md bg-base-50">
140
+ <p class="text-sm italic text-base-500">
141
+ Try switching the <b>locale</b> control in the panel below to see labels change between
142
+ "Germany" (EN) and "Deutschland" (DE).
143
+ </p>
144
+ </div>
145
+ </div>
146
+ `
147
+ }),
148
+ args: {
149
+ ...Docs.args,
150
+ label: "Localized Selector",
151
+ locale: Locale.de,
152
+ searchPlaceholder: "Land suchen...",
153
+ description: "The labels and search logic adapt based on the provided locale."
154
+ }
155
+ };
156
+ export const WithoutSearch = {
157
+ render: MainRender,
158
+ args: {
159
+ ...Docs.args,
160
+ label: "No Search Field",
161
+ searchable: false
162
+ }
163
+ };
164
+ export const WithoutFlags = {
165
+ render: MainRender,
166
+ args: {
167
+ ...Docs.args,
168
+ label: "No Flags Mode",
169
+ showFlags: false
170
+ }
171
+ };
172
+ export const GroupedMode = {
173
+ render: (args) => ({
174
+ components: {
175
+ AntCountryInput,
176
+ AntField
177
+ },
178
+ setup() {
179
+ const modelValue = ref(args.modelValue);
180
+ return {
181
+ args,
182
+ modelValue
183
+ };
184
+ },
185
+ template: `
186
+ <div>
187
+ <AntField
188
+ :label="args.label"
189
+ :description="args.description"
190
+ :size="args.size"
191
+ :state="args.state"
192
+ >
193
+ <div class="flex items-center">
194
+ <AntCountryInput
195
+ v-bind="args"
196
+ v-model="modelValue"
197
+ class="w-fit flex-shrink-0"
198
+ />
199
+
200
+ <div
201
+ class="flex-grow border border-l-0 p-2 text-sm text-base-400 bg-base-50 border-base-300 rounded-r-md h-[36px] flex items-center"
202
+ >
203
+ Input area...
204
+ </div>
205
+ </div>
206
+ </AntField>
207
+
208
+ <div class="mt-2 text-md text-base-400">
209
+ Value: {{ modelValue || null }}
210
+ </div>
211
+ </div>
212
+ `
213
+ }),
214
+ args: {
215
+ ...Docs.args,
216
+ label: "Grouped Mode (Phone Input Style)",
217
+ description: "When isGrouped is true, label and description must be provided by a parent AntField.",
218
+ isGrouped: true,
219
+ grouped: Grouped.left,
220
+ modelValue: "DE",
221
+ countries: COUNTRIES
222
+ }
223
+ };
224
+ export const GermanEmptyState = {
225
+ render: MainRender,
226
+ args: {
227
+ ...Docs.args,
228
+ label: "German Empty State",
229
+ description: 'Custom empty state message: "Keine L\xE4nder gefunden". Open the dropdown to see it.',
230
+ searchPlaceholder: "Land suchen...",
231
+ emptyStateMessage: "Keine L\xE4nder gefunden",
232
+ countries: []
233
+ }
234
+ };
235
+ export const Skeleton = {
236
+ render: MainRender,
237
+ args: {
238
+ ...Docs.args,
239
+ skeleton: true
240
+ }
241
+ };
242
+ export const summary = {
243
+ parameters: {
244
+ chromatic: {
245
+ disableSnapshot: false
246
+ }
247
+ },
248
+ render: (args) => ({
249
+ components: {
250
+ AntCountryInput
251
+ },
252
+ setup() {
253
+ const val = ref("DE");
254
+ return {
255
+ args,
256
+ val,
257
+ InputState,
258
+ Size,
259
+ COUNTRIES
260
+ };
261
+ },
262
+ template: `
263
+ <div class="p-4 flex flex-col gap-6">
264
+ <div class="flex flex-wrap gap-4">
265
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.base" label="Base" class="w-64"/>
266
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.info" label="Info" class="w-64"/>
267
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.success" label="Success" class="w-64"/>
268
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.warning" label="Warning" class="w-64"/>
269
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :state="InputState.danger" label="Danger" class="w-64"/>
270
+ </div>
271
+
272
+ <div class="flex items-end gap-4">
273
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.sm" label="Small" class="w-64"/>
274
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.md" label="Medium" class="w-64"/>
275
+ <AntCountryInput v-bind="args" v-model="val" :countries="COUNTRIES" :size="Size.lg" label="Large" class="w-64"/>
276
+ </div>
277
+
278
+ <div class="flex gap-4">
279
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" disabled label="Disabled" class="w-64" />
280
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" readonly label="Readonly" class="w-64" />
281
+ <AntCountryInput v-bind="args" :countries="COUNTRIES" model-value="FR" skeleton label="Skeleton" class="w-64" />
282
+ </div>
283
+ </div>
284
+ `
285
+ }),
286
+ args: {
287
+ searchPlaceholder: "Search..."
288
+ }
289
+ };
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3';
2
+ import AntPhoneNumberInput from '../AntPhoneNumberInput.vue';
3
+ declare const meta: Meta<typeof AntPhoneNumberInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof AntPhoneNumberInput>;
6
+ export declare const Default: Story;
7
+ export declare const summary: Story;