@umituz/web-design-system 5.2.0 → 5.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-design-system",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Web Design System - Tailwind v4 authored, precompiled CSS shipped. Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications.",
@@ -0,0 +1,18 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { formatCount } from '../infrastructure/utils';
3
+
4
+ describe('formatCount', () => {
5
+ it('formats with grouping separators for the locale', () => {
6
+ expect(formatCount(1234567, 'en-US')).toBe('1,234,567');
7
+ });
8
+
9
+ it('honours locale-specific separators', () => {
10
+ expect(formatCount(1234, 'tr-TR')).toBe('1.234');
11
+ expect(formatCount(1234, 'de-DE')).toBe('1.234');
12
+ });
13
+
14
+ it('keeps zero and negative values readable', () => {
15
+ expect(formatCount(0, 'en-US')).toBe('0');
16
+ expect(formatCount(-42, 'en-US')).toBe('-42');
17
+ });
18
+ });
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { uniqueId } from '../infrastructure/utils';
3
+
4
+ describe('uniqueId', () => {
5
+ it('prefixes every id', () => {
6
+ expect(uniqueId('note').startsWith('note-')).toBe(true);
7
+ });
8
+
9
+ it('never collides within a burst of calls', () => {
10
+ const ids = new Set(Array.from({ length: 500 }, () => uniqueId('x')));
11
+ expect(ids.size).toBe(500);
12
+ });
13
+
14
+ it('keeps the base36 shape', () => {
15
+ expect(uniqueId('a')).toMatch(/^a-[0-9a-z]+-[0-9a-z]{2,7}$/);
16
+ });
17
+ });
@@ -0,0 +1 @@
1
+ export const formatCount = (value: number, locale: string): string => new Intl.NumberFormat(locale).format(value);
@@ -0,0 +1,2 @@
1
+ export const uniqueId = (prefix: string): string =>
2
+ `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`;
@@ -33,6 +33,10 @@ export type { PageBounds } from './calculation.utils';
33
33
 
34
34
  export { hashSeed } from './hash.util';
35
35
 
36
+ export { formatCount } from './format.util';
37
+
38
+ export { uniqueId } from './id.util';
39
+
36
40
  export {
37
41
  currencyFractionDigits,
38
42
  formatMoney,