@adobe-commerce/elsie 1.6.0-alpha999 → 1.6.0-beta1
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/config/jest.js +3 -3
- package/package.json +3 -3
- package/src/components/Button/Button.tsx +2 -0
- package/src/components/Field/Field.tsx +19 -14
- package/src/components/Incrementer/Incrementer.css +6 -0
- package/src/components/Incrementer/Incrementer.stories.tsx +18 -0
- package/src/components/Incrementer/Incrementer.tsx +66 -59
- package/src/components/MultiSelect/MultiSelect.css +273 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +457 -0
- package/src/components/MultiSelect/MultiSelect.tsx +763 -0
- package/src/components/MultiSelect/index.ts +11 -0
- package/src/components/Price/Price.tsx +8 -41
- package/src/components/Table/Table.css +110 -0
- package/src/components/Table/Table.stories.tsx +761 -0
- package/src/components/Table/Table.tsx +249 -0
- package/src/components/Table/index.ts +11 -0
- package/src/components/ToggleButton/ToggleButton.css +13 -1
- package/src/components/ToggleButton/ToggleButton.stories.tsx +13 -6
- package/src/components/ToggleButton/ToggleButton.tsx +4 -0
- package/src/components/index.ts +5 -3
- package/src/docs/slots.mdx +2 -0
- package/src/i18n/en_US.json +38 -0
- package/src/lib/aem/configs.ts +10 -4
- package/src/lib/get-price-formatter.ts +69 -0
- package/src/lib/index.ts +4 -3
- package/src/lib/slot.tsx +61 -5
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export * from '@adobe-commerce/elsie/components/MultiSelect/MultiSelect';
|
|
11
|
+
export { MultiSelect as default } from '@adobe-commerce/elsie/components/MultiSelect/MultiSelect';
|
|
@@ -2,14 +2,14 @@
|
|
|
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
|
import { FunctionComponent } from 'preact';
|
|
11
11
|
import { HTMLAttributes, useMemo } from 'preact/compat';
|
|
12
|
-
import { classes,
|
|
12
|
+
import { classes, getPriceFormatter } from '@adobe-commerce/elsie/lib';
|
|
13
13
|
import '@adobe-commerce/elsie/components/Price/Price.css';
|
|
14
14
|
|
|
15
15
|
export interface PriceProps
|
|
@@ -39,43 +39,10 @@ export const Price: FunctionComponent<PriceProps> = ({
|
|
|
39
39
|
size = 'small',
|
|
40
40
|
...props
|
|
41
41
|
}) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
const globalLocale = getGlobalLocale();
|
|
48
|
-
if (globalLocale) {
|
|
49
|
-
return globalLocale;
|
|
50
|
-
}
|
|
51
|
-
// Fallback to browser locale or default
|
|
52
|
-
return process.env.LOCALE && process.env.LOCALE !== 'undefined' ? process.env.LOCALE : 'en-US';
|
|
53
|
-
}, [locale]);
|
|
54
|
-
|
|
55
|
-
const formatter = useMemo(
|
|
56
|
-
() => {
|
|
57
|
-
const params: Intl.NumberFormatOptions = {
|
|
58
|
-
style: 'currency',
|
|
59
|
-
currency: currency || 'USD',
|
|
60
|
-
// These options are needed to round to whole numbers if that's what you want.
|
|
61
|
-
minimumFractionDigits: 2, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
|
|
62
|
-
maximumFractionDigits: 2, // (causes 2500.99 to be printed as $2,501)
|
|
63
|
-
...formatOptions,
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
return new Intl.NumberFormat(effectiveLocale, params);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error(`Error creating Intl.NumberFormat instance for locale ${effectiveLocale}. Falling back to en-US.`, error);
|
|
69
|
-
return new Intl.NumberFormat('en-US', params);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
[effectiveLocale, currency, formatOptions]
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const formattedAmount = useMemo(
|
|
76
|
-
() => formatter.format(amount),
|
|
77
|
-
[amount, formatter]
|
|
78
|
-
);
|
|
42
|
+
const formattedAmount = useMemo(() => {
|
|
43
|
+
const formatter = getPriceFormatter({ currency, locale, formatOptions });
|
|
44
|
+
return formatter.format(amount);
|
|
45
|
+
}, [amount, currency, locale, formatOptions]);
|
|
79
46
|
|
|
80
47
|
return (
|
|
81
48
|
<span
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
/* https://cssguidelin.es/#bem-like-naming */
|
|
11
|
+
|
|
12
|
+
.dropin-table {
|
|
13
|
+
container-type: inline-size;
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
font: var(--type-body-1-default-font);
|
|
16
|
+
letter-spacing: var(--type-body-1-default-letter-spacing);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dropin-table__table {
|
|
20
|
+
border-collapse: collapse;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dropin-table__caption {
|
|
25
|
+
font: var(--type-details-caption-1-font);
|
|
26
|
+
letter-spacing: var(--type-details-caption-1-letter-spacing);
|
|
27
|
+
text-align: left;
|
|
28
|
+
margin-bottom: var(--spacing-small);
|
|
29
|
+
caption-side: top;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dropin-table__header__cell {
|
|
33
|
+
font: var(--type-body-1-strong-font);
|
|
34
|
+
letter-spacing: var(--type-body-1-strong-letter-spacing);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dropin-table__header__cell,
|
|
38
|
+
.dropin-table__body__cell {
|
|
39
|
+
padding: var(--spacing-xsmall);
|
|
40
|
+
text-align: left;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dropin-table__header__cell--sortable {
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dropin-table__header__row {
|
|
49
|
+
border-bottom: 2px solid var(--color-neutral-400);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dropin-table__body__row {
|
|
53
|
+
border-bottom: 1px solid var(--color-neutral-400);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dropin-table__header__sort-button {
|
|
57
|
+
margin-left: var(--spacing-xsmall);
|
|
58
|
+
vertical-align: middle;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dropin-table__row-details {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.dropin-table__row-details--expanded {
|
|
66
|
+
display: table-row;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.dropin-table__row-details__cell {
|
|
70
|
+
padding: var(--spacing-small);
|
|
71
|
+
background-color: var(--color-neutral-100);
|
|
72
|
+
border-top: 1px solid var(--color-neutral-300);
|
|
73
|
+
border-bottom: 1px solid var(--color-neutral-400);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Container query for mobile layout */
|
|
77
|
+
@container (max-width: 600px) {
|
|
78
|
+
/* Mobile layout Stacked */
|
|
79
|
+
.dropin-table--mobile-layout-stacked .dropin-table__header {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dropin-table--mobile-layout-stacked .dropin-table__body__cell {
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.dropin-table--mobile-layout-stacked .dropin-table__body__cell::before {
|
|
88
|
+
content: attr(data-label);
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
display: block;
|
|
91
|
+
margin-bottom: var(--spacing-xxsmall);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dropin-table--mobile-layout-stacked .dropin-table__row-details__cell {
|
|
95
|
+
display: block;
|
|
96
|
+
padding: var(--spacing-small);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Medium (portrait tablets and large phones, 768px and up) */
|
|
101
|
+
/* @media only screen and (min-width: 768px) { } */
|
|
102
|
+
|
|
103
|
+
/* Large (landscape tablets, 1024px and up) */
|
|
104
|
+
/* @media only screen and (min-width: 1024px) { } */
|
|
105
|
+
|
|
106
|
+
/* XLarge (laptops/desktops, 1366px and up) */
|
|
107
|
+
/* @media only screen and (min-width: 1366px) { } */
|
|
108
|
+
|
|
109
|
+
/* XXlarge (large laptops and desktops, 1920px and up) */
|
|
110
|
+
/* @media only screen and (min-width: 1920px) { } */
|