@imaginario27/air-ui-utils 1.2.1 → 1.2.3

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ All notable changes to this package are documented in this file.
5
5
  Historical releases were reconstructed from git history (GitHub repository) and npm publish dates.
6
6
  Future releases will include detailed entries generated with Changesets.
7
7
 
8
+ ## 1.2.2 - 2026-04-07
9
+
10
+ Release type: patch.
11
+ Commits found in range: 1.
12
+
13
+ ### Added
14
+
15
+ 1. add formatNumberWithThousands number util ([1c66034](https://github.com/imaginario27/air-ui/commit/1c660343c4718947e43c5393af2dc079f0ed176a))
16
+
17
+ - Package: @imaginario27/air-ui-utils.
18
+
19
+ ## 1.2.1 - 2026-03-21
20
+
21
+ Release type: patch.
22
+ Commits found in range: 2.
23
+
24
+ ### Added
25
+
26
+ 1. update package versions ([c5a01a1](https://github.com/imaginario27/air-ui/commit/c5a01a186b047bceca41d6cf50d1f9da4e1aa15e))
27
+ 2. add new TagsField and RulesField components + component fixes ([c8c125e](https://github.com/imaginario27/air-ui/commit/c8c125eb110eedc16f29706778578514bc28eb4f))
28
+
29
+ - Package: @imaginario27/air-ui-utils.
30
+
8
31
  ## 1.2.0 - 2026-03-18
9
32
 
10
33
  Release type: minor.
package/nuxt.config.ts CHANGED
@@ -1,13 +1,13 @@
1
- // https://nuxt.com/docs/api/configuration/nuxt-config
2
-
3
- export default defineNuxtConfig({
4
- compatibilityDate: "2024-11-01",
5
- devtools: { enabled: false },
6
- ssr: false,
7
-
8
- imports: {
9
- dirs: [
10
- "models/**"
11
- ],
12
- },
1
+ // https://nuxt.com/docs/api/configuration/nuxt-config
2
+
3
+ export default defineNuxtConfig({
4
+ compatibilityDate: "2024-11-01",
5
+ devtools: { enabled: false },
6
+ ssr: false,
7
+
8
+ imports: {
9
+ dirs: [
10
+ "models/**"
11
+ ],
12
+ },
13
13
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imaginario27/air-ui-utils",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "author": "imaginario27",
5
5
  "type": "module",
6
6
  "homepage": "https://air-ui.netlify.app/",
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
- {
2
- // https://nuxt.com/docs/guide/concepts/typescript
3
- "extends": "./.nuxt/tsconfig.json",
4
- "compilerOptions": {
5
- "types": ["vitest/globals"],
6
- }
7
- }
1
+ {
2
+ // https://nuxt.com/docs/guide/concepts/typescript
3
+ "extends": "./.nuxt/tsconfig.json",
4
+ "compilerOptions": {
5
+ "types": ["vitest/globals"],
6
+ }
7
+ }
package/utils/counters.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { StackCounterType } from '../../air-ui-ds/models/enums/counters'
2
+
1
3
  /**
2
4
  * Returns the counter content for a stack display based on the number of items, counter type, and item limit.
3
5
  *
package/utils/data.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { SelectOption } from '../../air-ui-ds/models/types/selects'
2
+
1
3
  /**
2
4
  * Creates a delay for a specified number of milliseconds.
3
5
  *
@@ -42,7 +44,6 @@ export function getPaginatedData<T>(
42
44
  return result.slice(start, end)
43
45
  }
44
46
 
45
-
46
47
  /**
47
48
  * Converts an array of objects into SelectOption[] by mapping specified keys or transformation functions.
48
49
  *
@@ -1,5 +1,4 @@
1
1
 
2
- import { FieldError } from '../models/constants/form'
3
2
  import type {
4
3
  ArrayValidator,
5
4
  CreateRulesFieldValidatorOptions,
@@ -7,6 +6,17 @@ import type {
7
6
  RuleValidationValue,
8
7
  } from '../models/types/formValidation'
9
8
 
9
+ // Centralized error messages for form validation
10
+ const FieldError = {
11
+ REQUIRED_FIELD: 'This field is required.',
12
+ REQUIRED_EMAIL: 'Email is required.',
13
+ INVALID_EMAIL: 'Invalid email address.',
14
+ REQUIRED_OPTION: 'Please select an option.',
15
+ INVALID_DATE_RANGE: 'Start date must be before or equal to end date',
16
+ PASSWORDS_DO_NOT_MATCH: 'Passwords do not match.',
17
+ INVALID_URL: 'Invalid URL.',
18
+ }
19
+
10
20
  /**
11
21
  * Validates a field value to ensure it is not empty, null, or undefined.
12
22
  *
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Formats a number into a string with thousands separators using Intl locale rules.
3
+ *
4
+ * @param value - Number to format
5
+ * @param locale - Optional locale (default: 'es-ES')
6
+ * @returns Formatted string with thousands separators
7
+ *
8
+ * @example
9
+ * formatNumberWithThousands(1234567)
10
+ * // "1.234.567"
11
+ *
12
+ * @example
13
+ * formatNumberWithThousands(1234567.89, 'en-US')
14
+ * // "1,234,567.89"
15
+ *
16
+ * @example
17
+ * formatNumberWithThousands(1234.56, 'de-DE')
18
+ * // "1.234,56"
19
+ */
20
+ export const formatNumberWithThousands = (
21
+ value: number,
22
+ locale: string = 'en-GB'
23
+ ): string => {
24
+ if (!Number.isFinite(value)) return 'Not a valid number'
25
+
26
+ return value.toLocaleString(locale, {
27
+ minimumFractionDigits: 0,
28
+ maximumFractionDigits: 20
29
+ })
30
+ }
package/utils/pages.ts CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ import { PageTitleFormat } from '../../air-ui-ds/models/enums/pages'
3
+
2
4
  /**
3
5
  * Generates a formatted page title based on the specified format.
4
6
  *
@@ -1,8 +0,0 @@
1
- export const App = {
2
- NAME: 'AirUI',
3
- }
4
-
5
- export const AppSlug = {
6
- DOCS: 'docs',
7
- COMPONENTS: 'components',
8
- }
@@ -1,22 +0,0 @@
1
-
2
- export const FieldMaxLength = {
3
- FULLNAME: 80,
4
- LASTNAME: 80,
5
- EMAIL: 254,
6
- PHONE: 15,
7
- SUBJECT: 100,
8
- MESSAGE: 500,
9
- PASSWORD: 64,
10
- SEARCH: 80,
11
- DESCRIPTION: 400,
12
- }
13
-
14
- export const FieldError = {
15
- REQUIRED_FIELD: 'This field is required.',
16
- REQUIRED_EMAIL: 'Email is required.',
17
- INVALID_EMAIL: 'Invalid email address.',
18
- REQUIRED_OPTION: 'Please select an option.',
19
- INVALID_DATE_RANGE: 'Start date must be before or equal to end date',
20
- PASSWORDS_DO_NOT_MATCH: 'Passwords do not match.',
21
- INVALID_URL: 'Invalid URL.',
22
- }
@@ -1,4 +0,0 @@
1
- export const AppNotification = {
2
- COPIED_TO_CLIPBOARD: 'Copied to clipboard',
3
- COPIED_TO_CLIPBOARD_ERROR: 'Error copying to clipboard',
4
- }
@@ -1,4 +0,0 @@
1
- export enum StackCounterType {
2
- COUNTER = 'counter',
3
- ELLIPSIS = 'ellipsis',
4
- }
@@ -1,4 +0,0 @@
1
- export enum PageTitleFormat {
2
- FULL = 'full',
3
- SIMPLE = 'simple',
4
- }
@@ -1,6 +0,0 @@
1
- export interface HeaderConfig {
2
- field: string
3
- callback?: (value: any) => string
4
- }
5
-
6
- export type Headers = Record<string, string | HeaderConfig>
@@ -1,14 +0,0 @@
1
- export interface SelectOption {
2
- id?: string | number
3
- value: string | number
4
- text?: string
5
- icon?: any
6
- customIcon?: string
7
- userDisplayName?: string
8
- userProfileImg?: string
9
- imgUrl?: string
10
- alt?: string
11
- helpText?: string
12
- to?: string
13
- isExternal?: boolean
14
- }