@adobe-commerce/elsie 1.6.0-alpha2 → 1.6.0-alpha24
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 +3 -3
- package/src/components/Icon/Icon.tsx +29 -24
- package/src/components/MultiSelect/MultiSelect.stories.tsx +7 -5
- package/src/components/Pagination/Pagination.css +14 -5
- package/src/components/Pagination/Pagination.stories.tsx +32 -3
- package/src/components/Pagination/Pagination.tsx +28 -22
- package/src/components/Pagination/PaginationButton.tsx +46 -0
- package/src/components/Price/Price.tsx +8 -41
- package/src/components/Table/Table.css +86 -13
- package/src/components/Table/Table.stories.tsx +320 -57
- package/src/components/Table/Table.tsx +6 -2
- package/src/icons/Business.svg +3 -0
- package/src/icons/List.svg +3 -0
- package/src/icons/Quote.svg +3 -0
- package/src/icons/Structure.svg +8 -0
- package/src/icons/Team.svg +5 -0
- package/src/icons/index.ts +29 -24
- package/src/lib/aem/configs.ts +1 -1
- package/src/lib/get-price-formatter.ts +69 -0
- package/src/lib/index.ts +4 -3
package/src/icons/index.ts
CHANGED
|
@@ -1,43 +1,48 @@
|
|
|
1
1
|
export { default as Add } from './Add.svg';
|
|
2
|
+
export { default as AddressBook } from './AddressBook.svg';
|
|
2
3
|
export { default as Bulk } from './Bulk.svg';
|
|
3
4
|
export { default as Burger } from './Burger.svg';
|
|
5
|
+
export { default as Business } from './Business.svg';
|
|
6
|
+
export { default as Card } from './Card.svg';
|
|
4
7
|
export { default as Cart } from './Cart.svg';
|
|
5
8
|
export { default as Check } from './Check.svg';
|
|
9
|
+
export { default as CheckWithCircle } from './CheckWithCircle.svg';
|
|
6
10
|
export { default as ChevronDown } from './ChevronDown.svg';
|
|
7
|
-
export { default as ChevronUp } from './ChevronUp.svg';
|
|
8
11
|
export { default as ChevronRight } from './ChevronRight.svg';
|
|
12
|
+
export { default as ChevronUp } from './ChevronUp.svg';
|
|
9
13
|
export { default as Close } from './Close.svg';
|
|
14
|
+
export { default as Coupon } from './Coupon.svg';
|
|
15
|
+
export { default as Date } from './Date.svg';
|
|
16
|
+
export { default as Delivery } from './Delivery.svg';
|
|
17
|
+
export { default as Edit } from './Edit.svg';
|
|
18
|
+
export { default as EmptyBox } from './EmptyBox.svg';
|
|
19
|
+
export { default as Eye } from './Eye.svg';
|
|
20
|
+
export { default as EyeClose } from './EyeClose.svg';
|
|
21
|
+
export { default as Gift } from './Gift.svg';
|
|
22
|
+
export { default as GiftCard } from './GiftCard.svg';
|
|
10
23
|
export { default as Heart } from './Heart.svg';
|
|
24
|
+
export { default as HeartFilled } from './HeartFilled.svg';
|
|
25
|
+
export { default as InfoFilled } from './InfoFilled.svg';
|
|
26
|
+
export { default as List } from './List.svg';
|
|
27
|
+
export { default as Locker } from './Locker.svg';
|
|
11
28
|
export { default as Minus } from './Minus.svg';
|
|
29
|
+
export { default as Order } from './Order.svg';
|
|
30
|
+
export { default as OrderError } from './OrderError.svg';
|
|
31
|
+
export { default as OrderSuccess } from './OrderSuccess.svg';
|
|
32
|
+
export { default as PaymentError } from './PaymentError.svg';
|
|
12
33
|
export { default as Placeholder } from './Placeholder.svg';
|
|
13
34
|
export { default as PlaceholderFilled } from './PlaceholderFilled.svg';
|
|
35
|
+
export { default as Quote } from './Quote.svg';
|
|
14
36
|
export { default as Search } from './Search.svg';
|
|
15
37
|
export { default as SearchFilled } from './SearchFilled.svg';
|
|
16
38
|
export { default as Sort } from './Sort.svg';
|
|
17
39
|
export { default as Star } from './Star.svg';
|
|
18
|
-
export { default as
|
|
40
|
+
export { default as Structure } from './Structure.svg';
|
|
41
|
+
export { default as Team } from './Team.svg';
|
|
42
|
+
export { default as Trash } from './Trash.svg';
|
|
19
43
|
export { default as User } from './User.svg';
|
|
20
|
-
export { default as
|
|
21
|
-
export { default as Locker } from './Locker.svg';
|
|
44
|
+
export { default as View } from './View.svg';
|
|
22
45
|
export { default as Wallet } from './Wallet.svg';
|
|
23
|
-
export { default as
|
|
24
|
-
export { default as Order } from './Order.svg';
|
|
25
|
-
export { default as Delivery } from './Delivery.svg';
|
|
26
|
-
export { default as OrderError } from './OrderError.svg';
|
|
27
|
-
export { default as OrderSuccess } from './OrderSuccess.svg';
|
|
28
|
-
export { default as PaymentError } from './PaymentError.svg';
|
|
29
|
-
export { default as CheckWithCircle } from './CheckWithCircle.svg';
|
|
30
|
-
export { default as WarningWithCircle } from './WarningWithCircle.svg';
|
|
46
|
+
export { default as Warning } from './Warning.svg';
|
|
31
47
|
export { default as WarningFilled } from './WarningFilled.svg';
|
|
32
|
-
export { default as
|
|
33
|
-
export { default as HeartFilled } from './HeartFilled.svg';
|
|
34
|
-
export { default as Trash } from './Trash.svg';
|
|
35
|
-
export { default as Eye } from './Eye.svg';
|
|
36
|
-
export { default as EyeClose } from './EyeClose.svg';
|
|
37
|
-
export { default as Date } from './Date.svg';
|
|
38
|
-
export { default as AddressBook } from './AddressBook.svg';
|
|
39
|
-
export { default as EmptyBox } from './EmptyBox.svg';
|
|
40
|
-
export { default as Coupon } from './Coupon.svg';
|
|
41
|
-
export { default as Gift } from './Gift.svg';
|
|
42
|
-
export { default as GiftCard } from './GiftCard.svg';
|
|
43
|
-
export { default as Edit } from './Edit.svg';
|
|
48
|
+
export { default as WarningWithCircle } from './WarningWithCircle.svg';
|
package/src/lib/aem/configs.ts
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
import { getGlobalLocale } from '@adobe-commerce/elsie/lib';
|
|
11
|
+
|
|
12
|
+
export interface PriceFormatterOptions {
|
|
13
|
+
currency?: string | null;
|
|
14
|
+
locale?: string;
|
|
15
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Determines the effective locale to use for price formatting
|
|
20
|
+
* Priority: prop locale > global locale > browser locale > default 'en-US'
|
|
21
|
+
*/
|
|
22
|
+
export function getEffectiveLocale(locale?: string): string {
|
|
23
|
+
if (locale) {
|
|
24
|
+
return locale;
|
|
25
|
+
}
|
|
26
|
+
const globalLocale = getGlobalLocale();
|
|
27
|
+
if (globalLocale) {
|
|
28
|
+
return globalLocale;
|
|
29
|
+
}
|
|
30
|
+
// Fallback to browser locale or default
|
|
31
|
+
return process.env.LOCALE && process.env.LOCALE !== 'undefined' ? process.env.LOCALE : 'en-US';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Gets an Intl.NumberFormat instance for price formatting
|
|
36
|
+
* Uses getEffectiveLocale internally to determine the best locale
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Single price formatting
|
|
40
|
+
* const formatter = getPriceFormatter({ currency: 'USD', locale: 'en-US' });
|
|
41
|
+
* const price = formatter.format(10.99); // "$10.99"
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Bulk price formatting (more efficient)
|
|
45
|
+
* const formatter = getPriceFormatter({ currency: 'EUR', locale: 'fr-FR' });
|
|
46
|
+
* const prices = [10.99, 25.50, 99.99].map(amount => formatter.format(amount));
|
|
47
|
+
*/
|
|
48
|
+
export function getPriceFormatter(
|
|
49
|
+
options: PriceFormatterOptions = {}
|
|
50
|
+
): Intl.NumberFormat {
|
|
51
|
+
const { currency, locale, formatOptions = {} } = options;
|
|
52
|
+
const effectiveLocale = getEffectiveLocale(locale);
|
|
53
|
+
|
|
54
|
+
const params: Intl.NumberFormatOptions = {
|
|
55
|
+
style: 'currency',
|
|
56
|
+
currency: currency || 'USD',
|
|
57
|
+
// These options are needed to round to whole numbers if that's what you want.
|
|
58
|
+
minimumFractionDigits: 2, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
|
|
59
|
+
maximumFractionDigits: 2, // (causes 2500.99 to be printed as $2,501)
|
|
60
|
+
...formatOptions,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
return new Intl.NumberFormat(effectiveLocale, params);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error(`Error creating Intl.NumberFormat instance for locale ${effectiveLocale}. Falling back to en-US.`, error);
|
|
67
|
+
return new Intl.NumberFormat('en-US', params);
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/lib/index.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright 2024 Adobe
|
|
3
3
|
* All Rights Reserved.
|
|
4
4
|
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
9
|
|
|
10
10
|
export * from '@adobe-commerce/elsie/lib/form-values';
|
|
@@ -25,3 +25,4 @@ export * from '@adobe-commerce/elsie/lib/is-number';
|
|
|
25
25
|
export * from '@adobe-commerce/elsie/lib/deviceUtils';
|
|
26
26
|
export * from '@adobe-commerce/elsie/lib/get-path-value';
|
|
27
27
|
export * from '@adobe-commerce/elsie/lib/get-cookie';
|
|
28
|
+
export * from '@adobe-commerce/elsie/lib/get-price-formatter';
|