@adobe-commerce/elsie 1.6.0-alpha999 → 1.6.0-beta2
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/Icon/Icon.tsx +29 -24
- 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 +459 -0
- package/src/components/MultiSelect/MultiSelect.tsx +763 -0
- package/src/components/MultiSelect/index.ts +11 -0
- 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 +183 -0
- package/src/components/Table/Table.stories.tsx +1024 -0
- package/src/components/Table/Table.tsx +253 -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/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 +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,253 @@
|
|
|
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 { FunctionComponent, VNode, Fragment } from 'preact';
|
|
11
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
12
|
+
import { classes, VComponent } from '@adobe-commerce/elsie/lib';
|
|
13
|
+
import {
|
|
14
|
+
Icon,
|
|
15
|
+
Button,
|
|
16
|
+
Skeleton,
|
|
17
|
+
SkeletonRow,
|
|
18
|
+
} from '@adobe-commerce/elsie/components';
|
|
19
|
+
import { useText } from '@adobe-commerce/elsie/i18n';
|
|
20
|
+
|
|
21
|
+
import '@adobe-commerce/elsie/components/Table/Table.css';
|
|
22
|
+
|
|
23
|
+
type Sortable = 'asc' | 'desc' | true;
|
|
24
|
+
|
|
25
|
+
type Column =
|
|
26
|
+
| { label: string; key: string; ariaLabel?: string; sortBy?: Sortable }
|
|
27
|
+
| {
|
|
28
|
+
label: VNode<HTMLAttributes<HTMLElement>>;
|
|
29
|
+
key: string;
|
|
30
|
+
ariaLabel: string;
|
|
31
|
+
sortBy?: Sortable;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type RowData = {
|
|
35
|
+
[key: string]: VNode | string | number | undefined;
|
|
36
|
+
_rowDetails?: VNode | string; // Special property for expandable row content
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface TableProps
|
|
40
|
+
extends Omit<HTMLAttributes<HTMLTableElement>, 'loading'> {
|
|
41
|
+
columns: Column[];
|
|
42
|
+
rowData: RowData[];
|
|
43
|
+
mobileLayout?: 'stacked' | 'none';
|
|
44
|
+
caption?: string;
|
|
45
|
+
expandedRows?: Set<number>;
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
skeletonRowCount?: number;
|
|
48
|
+
onSortChange?: (columnKey: string, direction: Sortable) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Table: FunctionComponent<TableProps> = ({
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
columns = [],
|
|
55
|
+
rowData = [],
|
|
56
|
+
mobileLayout = 'none',
|
|
57
|
+
caption,
|
|
58
|
+
expandedRows = new Set(),
|
|
59
|
+
loading = false,
|
|
60
|
+
skeletonRowCount = 10,
|
|
61
|
+
onSortChange,
|
|
62
|
+
...props
|
|
63
|
+
}) => {
|
|
64
|
+
const translations = useText({
|
|
65
|
+
sortedAscending: 'Dropin.Table.sortedAscending',
|
|
66
|
+
sortedDescending: 'Dropin.Table.sortedDescending',
|
|
67
|
+
sortBy: 'Dropin.Table.sortBy',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const handleSort = (column: Column) => {
|
|
71
|
+
if (!onSortChange) return;
|
|
72
|
+
|
|
73
|
+
// Determine next sort direction
|
|
74
|
+
let nextDirection: Sortable;
|
|
75
|
+
if (column.sortBy === true) {
|
|
76
|
+
nextDirection = 'asc';
|
|
77
|
+
} else if (column.sortBy === 'asc') {
|
|
78
|
+
nextDirection = 'desc';
|
|
79
|
+
} else {
|
|
80
|
+
nextDirection = true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
onSortChange(column.key, nextDirection);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const renderSortButton = (column: Column) => {
|
|
87
|
+
if (column.sortBy === undefined) return null;
|
|
88
|
+
const label = column.ariaLabel ?? (column.label as string);
|
|
89
|
+
|
|
90
|
+
let iconSource: string;
|
|
91
|
+
let ariaLabel: string;
|
|
92
|
+
|
|
93
|
+
if (column.sortBy === 'asc') {
|
|
94
|
+
iconSource = 'ChevronUp';
|
|
95
|
+
ariaLabel = translations.sortedAscending.replace('{label}', label);
|
|
96
|
+
} else if (column.sortBy === 'desc') {
|
|
97
|
+
iconSource = 'ChevronDown';
|
|
98
|
+
ariaLabel = translations.sortedDescending.replace('{label}', label);
|
|
99
|
+
} else {
|
|
100
|
+
// Show chevron down when sortable but not sorted
|
|
101
|
+
iconSource = 'ChevronDown';
|
|
102
|
+
ariaLabel = translations.sortBy.replace('{label}', label);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<Button
|
|
107
|
+
variant="tertiary"
|
|
108
|
+
size="medium"
|
|
109
|
+
className="dropin-table__header__sort-button"
|
|
110
|
+
icon={<Icon source={iconSource} />}
|
|
111
|
+
aria-label={ariaLabel}
|
|
112
|
+
onClick={() => handleSort(column)}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const renderSkeletonRows = () => {
|
|
118
|
+
return Array.from({ length: skeletonRowCount }, (_, rowIndex) => (
|
|
119
|
+
<tr key={`skeleton-${rowIndex}`} className="dropin-table__body__row">
|
|
120
|
+
{columns.map((column) => (
|
|
121
|
+
<td
|
|
122
|
+
key={column.key}
|
|
123
|
+
className="dropin-table__body__cell"
|
|
124
|
+
data-label={column.ariaLabel ?? column.label}
|
|
125
|
+
>
|
|
126
|
+
<Skeleton>
|
|
127
|
+
<SkeletonRow variant="row" size="small" fullWidth />
|
|
128
|
+
</Skeleton>
|
|
129
|
+
</td>
|
|
130
|
+
))}
|
|
131
|
+
</tr>
|
|
132
|
+
));
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const renderDataRows = () => {
|
|
136
|
+
return rowData.map((row, rowIndex) => {
|
|
137
|
+
const hasDetails = row._rowDetails !== undefined;
|
|
138
|
+
const isExpanded = expandedRows.has(rowIndex);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<Fragment key={rowIndex}>
|
|
142
|
+
<tr className={classes([
|
|
143
|
+
'dropin-table__body__row',
|
|
144
|
+
['dropin-table__body__row--expanded', isExpanded && hasDetails],
|
|
145
|
+
])}>
|
|
146
|
+
{columns.map((column) => {
|
|
147
|
+
const cell = row[column.key];
|
|
148
|
+
const label = column.ariaLabel ?? column.label;
|
|
149
|
+
|
|
150
|
+
if (typeof cell === 'string' || typeof cell === 'number') {
|
|
151
|
+
return (
|
|
152
|
+
<td
|
|
153
|
+
key={column.key}
|
|
154
|
+
className="dropin-table__body__cell"
|
|
155
|
+
data-label={label}
|
|
156
|
+
>
|
|
157
|
+
{cell}
|
|
158
|
+
</td>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<td
|
|
164
|
+
key={column.key}
|
|
165
|
+
className="dropin-table__body__cell"
|
|
166
|
+
data-label={label}
|
|
167
|
+
>
|
|
168
|
+
<VComponent node={cell!} />
|
|
169
|
+
</td>
|
|
170
|
+
);
|
|
171
|
+
})}
|
|
172
|
+
</tr>
|
|
173
|
+
{hasDetails && isExpanded && (
|
|
174
|
+
<tr
|
|
175
|
+
key={`${rowIndex}-details`}
|
|
176
|
+
className="dropin-table__row-details dropin-table__row-details--expanded"
|
|
177
|
+
id={`row-${rowIndex}-details`}
|
|
178
|
+
>
|
|
179
|
+
<td
|
|
180
|
+
className="dropin-table__row-details__cell"
|
|
181
|
+
colSpan={columns.length}
|
|
182
|
+
role="region"
|
|
183
|
+
aria-labelledby={`row-${rowIndex}-details`}
|
|
184
|
+
>
|
|
185
|
+
{typeof row._rowDetails === 'string' ? (
|
|
186
|
+
row._rowDetails
|
|
187
|
+
) : (
|
|
188
|
+
<VComponent node={row._rowDetails!} />
|
|
189
|
+
)}
|
|
190
|
+
</td>
|
|
191
|
+
</tr>
|
|
192
|
+
)}
|
|
193
|
+
</Fragment>
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const getAriaSort = (
|
|
199
|
+
column: Column
|
|
200
|
+
): 'none' | 'ascending' | 'descending' | 'other' | undefined => {
|
|
201
|
+
if (column.sortBy === true) return 'none';
|
|
202
|
+
if (column.sortBy === 'asc') return 'ascending';
|
|
203
|
+
if (column.sortBy === 'desc') return 'descending';
|
|
204
|
+
return undefined;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<div
|
|
209
|
+
className={classes([
|
|
210
|
+
'dropin-table',
|
|
211
|
+
`dropin-table--mobile-layout-${mobileLayout}`,
|
|
212
|
+
className,
|
|
213
|
+
])}
|
|
214
|
+
>
|
|
215
|
+
<table {...props} className="dropin-table__table">
|
|
216
|
+
{caption && (
|
|
217
|
+
<caption className="dropin-table__caption">{caption}</caption>
|
|
218
|
+
)}
|
|
219
|
+
<thead className="dropin-table__header">
|
|
220
|
+
<tr className="dropin-table__header__row">
|
|
221
|
+
{columns.map((column) => (
|
|
222
|
+
<th
|
|
223
|
+
key={column.key}
|
|
224
|
+
className={classes([
|
|
225
|
+
'dropin-table__header__cell',
|
|
226
|
+
[
|
|
227
|
+
'dropin-table__header__cell--sorted',
|
|
228
|
+
column.sortBy === 'asc' || column.sortBy === 'desc',
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
'dropin-table__header__cell--sortable',
|
|
232
|
+
column.sortBy !== undefined,
|
|
233
|
+
],
|
|
234
|
+
])}
|
|
235
|
+
aria-sort={getAriaSort(column)}
|
|
236
|
+
>
|
|
237
|
+
{column.label}
|
|
238
|
+
{renderSortButton(column)}
|
|
239
|
+
</th>
|
|
240
|
+
))}
|
|
241
|
+
</tr>
|
|
242
|
+
</thead>
|
|
243
|
+
<tbody className="dropin-table__body">
|
|
244
|
+
{loading
|
|
245
|
+
? // Render skeleton rows when loading
|
|
246
|
+
renderSkeletonRows()
|
|
247
|
+
: // Render actual data when not loading
|
|
248
|
+
renderDataRows()}
|
|
249
|
+
</tbody>
|
|
250
|
+
</table>
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
};
|
|
@@ -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/Table/Table';
|
|
11
|
+
export { Table as default } from '@adobe-commerce/elsie/components/Table/Table';
|
|
@@ -34,7 +34,19 @@
|
|
|
34
34
|
border: var(--shape-border-width-1) solid var(--color-neutral-800);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/* Disabled */
|
|
38
|
+
.dropin-toggle-button__disabled .dropin-toggle-button__actionButton {
|
|
39
|
+
cursor: default;
|
|
40
|
+
background-color: var(--color-neutral-300);
|
|
41
|
+
border: var(--shape-border-width-1) solid var(--color-neutral-500);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dropin-toggle-button__disabled .dropin-toggle-button__content {
|
|
45
|
+
color: var(--color-neutral-500);
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dropin-toggle-button:not(.dropin-toggle-button__disabled):has(input:focus-visible) {
|
|
38
50
|
outline: 0 none;
|
|
39
51
|
box-shadow: 0 0 0 var(--shape-icon-stroke-4) var(--color-neutral-400);
|
|
40
52
|
-webkit-box-shadow: 0 0 0 var(--shape-icon-stroke-4) var(--color-neutral-400);
|
|
@@ -79,6 +79,15 @@ const meta: Meta<ToggleButtonProps> = {
|
|
|
79
79
|
type: 'boolean',
|
|
80
80
|
},
|
|
81
81
|
},
|
|
82
|
+
disabled: {
|
|
83
|
+
description: 'Whether or not the Toggle button is disabled',
|
|
84
|
+
type: {
|
|
85
|
+
name: 'boolean',
|
|
86
|
+
},
|
|
87
|
+
control: {
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
82
91
|
onChange: {
|
|
83
92
|
description: 'Function to be called when the Toggle button is clicked',
|
|
84
93
|
type: {
|
|
@@ -103,11 +112,9 @@ export const ToggleButtonStory: Story = {
|
|
|
103
112
|
},
|
|
104
113
|
play: async ({ canvasElement }) => {
|
|
105
114
|
const canvas = within(canvasElement);
|
|
106
|
-
const toggleButton = document.querySelector('.dropin-toggle-button');
|
|
107
115
|
const toggleButtonInput = await canvas.findByRole('radio');
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
);
|
|
116
|
+
const toggleButton = toggleButtonInput.closest('.dropin-toggle-button');
|
|
117
|
+
const toggleButtonText = toggleButton?.querySelector('.dropin-toggle-button__content');
|
|
111
118
|
await expect(toggleButton).toHaveClass('dropin-toggle-button__selected');
|
|
112
119
|
await expect(toggleButtonText).toHaveTextContent('Toggle Button label');
|
|
113
120
|
await expect(toggleButtonInput).toBeChecked();
|
|
@@ -124,9 +131,9 @@ export const ToggleButtonNotSelected: Story = {
|
|
|
124
131
|
},
|
|
125
132
|
play: async ({ canvasElement }) => {
|
|
126
133
|
const canvas = within(canvasElement);
|
|
127
|
-
const toggleButton = document.querySelector('.dropin-toggle-button');
|
|
128
134
|
const toggleButtonInput = await canvas.findByRole('radio');
|
|
129
|
-
const
|
|
135
|
+
const toggleButton = toggleButtonInput.closest('.dropin-toggle-button');
|
|
136
|
+
const toggleButtonText = toggleButton?.querySelector('.dropin-toggle-button__content');
|
|
130
137
|
await expect(toggleButton).not.toHaveClass(
|
|
131
138
|
'dropin-toggle-button__selected'
|
|
132
139
|
);
|
|
@@ -19,6 +19,7 @@ export interface ToggleButtonProps
|
|
|
19
19
|
name: string;
|
|
20
20
|
value: string;
|
|
21
21
|
busy?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
22
23
|
icon?:
|
|
23
24
|
| VNode<HTMLAttributes<SVGSVGElement>>
|
|
24
25
|
| VNode<HTMLAttributes<HTMLImageElement>>;
|
|
@@ -31,6 +32,7 @@ export const ToggleButton: FunctionComponent<ToggleButtonProps> = ({
|
|
|
31
32
|
name,
|
|
32
33
|
value,
|
|
33
34
|
busy = false,
|
|
35
|
+
disabled = false,
|
|
34
36
|
children,
|
|
35
37
|
className,
|
|
36
38
|
icon,
|
|
@@ -45,6 +47,7 @@ export const ToggleButton: FunctionComponent<ToggleButtonProps> = ({
|
|
|
45
47
|
'dropin-toggle-button',
|
|
46
48
|
className,
|
|
47
49
|
['dropin-toggle-button__selected', selected],
|
|
50
|
+
['dropin-toggle-button__disabled', disabled],
|
|
48
51
|
])}
|
|
49
52
|
>
|
|
50
53
|
<label className="dropin-toggle-button__actionButton">
|
|
@@ -53,6 +56,7 @@ export const ToggleButton: FunctionComponent<ToggleButtonProps> = ({
|
|
|
53
56
|
name={name}
|
|
54
57
|
value={value}
|
|
55
58
|
checked={selected}
|
|
59
|
+
disabled={disabled}
|
|
56
60
|
onChange={() => onChange && onChange(value)}
|
|
57
61
|
aria-label={name}
|
|
58
62
|
busy={busy}
|
package/src/components/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/components/Skeleton';
|
|
@@ -49,3 +49,5 @@ export * from '@adobe-commerce/elsie/components/ContentGrid';
|
|
|
49
49
|
export * from '@adobe-commerce/elsie/components/Pagination';
|
|
50
50
|
export * from '@adobe-commerce/elsie/components/ProductItemCard';
|
|
51
51
|
export * from '@adobe-commerce/elsie/components/InputFile';
|
|
52
|
+
export * from '@adobe-commerce/elsie/components/Table';
|
|
53
|
+
export * from '@adobe-commerce/elsie/components/MultiSelect';
|
package/src/docs/slots.mdx
CHANGED
|
@@ -19,6 +19,7 @@ The context is defined during implementation of a drop-in and can be used to pas
|
|
|
19
19
|
- **prependChild**: A function to prepend a new HTML element to the slot's content.
|
|
20
20
|
- **appendSibling**: A function to append a new HTML element after the slot's content.
|
|
21
21
|
- **prependSibling**: A function to prepend a new HTML element **before** the slot's content.
|
|
22
|
+
- **remove**: A function to remove the slot element from the DOM.
|
|
22
23
|
- **getSlotElement**: A function to get a slot element.
|
|
23
24
|
- **onChange**: A function to listen to changes in the slot's context.
|
|
24
25
|
|
|
@@ -150,6 +151,7 @@ provider.render(MyContainer, {
|
|
|
150
151
|
// ctx.prependChild(element);
|
|
151
152
|
// ctx.appendSibling(element);
|
|
152
153
|
// ctx.prependSibling(element);
|
|
154
|
+
// ctx.remove();
|
|
153
155
|
|
|
154
156
|
// to listen and react to changes in the slot's context (lifecycle)
|
|
155
157
|
ctx.onChange((next) => {
|
package/src/i18n/en_US.json
CHANGED
|
@@ -141,6 +141,44 @@
|
|
|
141
141
|
},
|
|
142
142
|
"InputDate": {
|
|
143
143
|
"picker": "Select a date"
|
|
144
|
+
},
|
|
145
|
+
"Table": {
|
|
146
|
+
"sortedAscending": "Sort {label} ascending",
|
|
147
|
+
"sortedDescending": "Sort {label} descending",
|
|
148
|
+
"sortBy": "Sort by {label}"
|
|
149
|
+
},
|
|
150
|
+
"MultiSelect": {
|
|
151
|
+
"selectAll": "Select All",
|
|
152
|
+
"deselectAll": "Deselect All",
|
|
153
|
+
"placeholder": "Select options",
|
|
154
|
+
"noResultsText": "No options available",
|
|
155
|
+
"ariaLabel":{
|
|
156
|
+
"removed": "removed",
|
|
157
|
+
"added": "added",
|
|
158
|
+
"itemsSelected": "items selected",
|
|
159
|
+
"itemsAdded": "items added",
|
|
160
|
+
"itemsRemoved": "items removed",
|
|
161
|
+
"selectedTotal": "selected total",
|
|
162
|
+
"noResultsFor": "No results found for",
|
|
163
|
+
"optionsAvailable": "options available",
|
|
164
|
+
"dropdownExpanded": "Dropdown expanded",
|
|
165
|
+
"useArrowKeys": "Use arrow keys to navigate",
|
|
166
|
+
"removeFromSelection": "Remove",
|
|
167
|
+
"fromSelection": "from selection",
|
|
168
|
+
"selectedItem": "Selected item:",
|
|
169
|
+
"inField": " in {floatingLabel}",
|
|
170
|
+
"selectedItems": "Selected items",
|
|
171
|
+
"scrollableOptionsList": "Scrollable options list",
|
|
172
|
+
"selectOptions": "Select options",
|
|
173
|
+
"itemAction": "{label} {action}. {count} items selected.",
|
|
174
|
+
"bulkAdded": "{count} items added. {total} items selected total.",
|
|
175
|
+
"bulkRemoved": "{count} items removed. {total} items selected total.",
|
|
176
|
+
"dropdownExpandedWithOptions": "Dropdown expanded. {count} option{s} available. Use arrow keys to navigate.",
|
|
177
|
+
"selectedItemInField": "Selected item: {label} in {field}",
|
|
178
|
+
"removeFromSelectionWithText": "Remove {label} from selection. {text}",
|
|
179
|
+
"itemsSelectedDescription": "{count} item{s} selected: {labels}",
|
|
180
|
+
"noItemsSelected": "No items selected"
|
|
181
|
+
}
|
|
144
182
|
}
|
|
145
183
|
}
|
|
146
184
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path vector-effect="non-scaling-stroke" d="M14 3.25C14.9665 3.25 15.75 4.0335 15.75 5V6C15.75 6.08497 15.7422 6.16827 15.7305 6.25H21C21.9665 6.25 22.75 7.0335 22.75 8V10.6807C22.7498 11.3681 22.3487 11.9754 21.75 12.2598V19C21.75 19.9665 20.9665 20.75 20 20.75H4C3.0335 20.75 2.25 19.9665 2.25 19V12.2598C1.65126 11.9754 1.25018 11.3681 1.25 10.6807V8C1.25 7.0335 2.0335 6.25 3 6.25H8.26953C8.25783 6.16827 8.25 6.08497 8.25 6V5C8.25 4.0335 9.0335 3.25 10 3.25H14ZM14.75 13.7148V14C14.75 14.9665 13.9665 15.75 13 15.75H11C10.0335 15.75 9.25 14.9665 9.25 14V13.7148L3.75 12.6143V19C3.75 19.1381 3.86193 19.25 4 19.25H20C20.1381 19.25 20.25 19.1381 20.25 19V12.6143L14.75 13.7148ZM11 12.75C10.8619 12.75 10.75 12.8619 10.75 13V14C10.75 14.1381 10.8619 14.25 11 14.25H13C13.1381 14.25 13.25 14.1381 13.25 14V13C13.25 12.8619 13.1381 12.75 13 12.75H11ZM3 7.75C2.86193 7.75 2.75 7.86193 2.75 8V10.6807C2.75022 10.7996 2.83447 10.9024 2.95117 10.9258L9.43262 12.2207C9.71926 11.6453 10.3135 11.25 11 11.25H13C13.6862 11.25 14.2786 11.6457 14.5654 12.2207L21.0488 10.9258C21.1655 10.9024 21.2498 10.7996 21.25 10.6807V8C21.25 7.86193 21.1381 7.75 21 7.75H3ZM10 4.75C9.86193 4.75 9.75 4.86193 9.75 5V6C9.75 6.13807 9.86193 6.25 10 6.25H14C14.1381 6.25 14.25 6.13807 14.25 6V5C14.25 4.86193 14.1381 4.75 14 4.75H10Z" fill="currentColor" />
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path vector-effect="non-scaling-stroke" d="M16.8569 2C18.5138 2 19.8569 3.34315 19.8569 5V19C19.8569 20.6569 18.5138 22 16.8569 22H7.14307L6.98877 21.9961C5.45484 21.9183 4.22469 20.6883 4.14697 19.1543L4.14307 19V5C4.14307 3.39498 5.40374 2.08434 6.98877 2.00391L7.14307 2H16.8569ZM7.14307 3.5C6.31475 3.50013 5.64307 4.17165 5.64307 5V19C5.64307 19.8283 6.31475 20.4999 7.14307 20.5H16.8569C17.6854 20.5 18.3569 19.8284 18.3569 19V5C18.3569 4.17157 17.6854 3.5 16.8569 3.5H7.14307ZM7.71436 15.5713C8.10871 15.5713 8.42897 15.8909 8.4292 16.2852C8.4292 16.6796 8.10884 17 7.71436 17C7.32006 16.9998 7.00049 16.6795 7.00049 16.2852C7.00071 15.891 7.3202 15.5715 7.71436 15.5713ZM16.2866 17H9.85791V15.5H16.2866V17ZM16.2866 12.7148H9.85791V11.2148H16.2866V12.7148ZM7.71436 11.2861C8.10884 11.2861 8.4292 11.6055 8.4292 12C8.42916 12.3945 8.10882 12.7139 7.71436 12.7139C7.32008 12.7136 7.00053 12.3943 7.00049 12C7.00049 11.6057 7.32006 11.2864 7.71436 11.2861ZM7.71436 7C8.10871 7 8.42897 7.31957 8.4292 7.71387C8.4292 8.10836 8.10884 8.42871 7.71436 8.42871C7.32006 8.42848 7.00049 8.10822 7.00049 7.71387C7.00071 7.31971 7.3202 7.00023 7.71436 7ZM16.2866 8.42871H9.85791V6.92871H16.2866V8.42871Z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path vector-effect="non-scaling-stroke" d="M16.8569 2C18.5138 2 19.8569 3.34315 19.8569 5V19C19.8569 20.6569 18.5138 22 16.8569 22H7.14307L6.98877 21.9961C5.45473 21.9184 4.22469 20.6883 4.14697 19.1543L4.14307 19V5C4.14307 3.39489 5.40362 2.08421 6.98877 2.00391L7.14307 2H16.8569ZM7.14307 3.5C6.31464 3.5 5.64307 4.17157 5.64307 5V19C5.64307 19.8284 6.31464 20.5 7.14307 20.5H16.8569C17.6854 20.5 18.3569 19.8284 18.3569 19V5C18.3569 4.17157 17.6854 3.5 16.8569 3.5H7.14307ZM7.71436 17C8.10871 17 8.42897 17.3196 8.4292 17.7139C8.4292 18.1084 8.10884 18.4287 7.71436 18.4287C7.31993 18.4286 7.00049 18.1083 7.00049 17.7139C7.00071 17.3196 7.32007 17.0001 7.71436 17ZM16.2856 18.4287H9.85693V16.9287H16.2856V18.4287ZM7.71436 14.1426C8.10884 14.1426 8.4292 14.4629 8.4292 14.8574C8.42905 15.2518 8.10875 15.5713 7.71436 15.5713C7.32002 15.5712 7.00064 15.2517 7.00049 14.8574C7.00049 14.463 7.31993 14.1427 7.71436 14.1426ZM16.2856 15.5713H9.85693V14.0713H16.2856V15.5713ZM12.7856 5.6748C13.5717 5.96006 14.1792 6.66301 14.1792 7.57227H12.6792C12.6792 7.34883 12.4515 7.0362 12.0005 7.03613C11.5756 7.03613 11.3506 7.31331 11.3257 7.53223C11.333 7.54311 11.3434 7.56003 11.3608 7.58008C11.4311 7.66062 11.5467 7.75541 11.6958 7.85254C11.84 7.94645 11.9892 8.02578 12.105 8.08203C12.1617 8.10958 12.2084 8.13079 12.2397 8.14453C12.2553 8.15136 12.2679 8.15625 12.2749 8.15918C12.2781 8.16054 12.2807 8.16169 12.2817 8.16211L12.2837 8.16309C12.2851 8.16366 12.2875 8.16419 12.2896 8.16504C12.2938 8.16681 12.2993 8.16999 12.3062 8.17285C12.32 8.17866 12.3396 8.1861 12.3628 8.19629C12.4095 8.21678 12.4744 8.24686 12.5513 8.28418C12.7031 8.35794 12.911 8.46704 13.1235 8.60547C13.3312 8.74079 13.5734 8.92349 13.771 9.15039C13.963 9.37099 14.1792 9.71019 14.1792 10.1436C14.1789 11.0523 13.5713 11.753 12.7856 12.0381V12.7148H11.2856V12.0605C10.4664 11.7925 9.8221 11.0791 9.82178 10.1436H11.3218C11.3223 10.367 11.5499 10.6787 12.0005 10.6787C12.4257 10.6786 12.6498 10.4006 12.6743 10.1816C12.667 10.1709 12.657 10.1542 12.6401 10.1348C12.5699 10.0542 12.4543 9.95949 12.3052 9.8623C12.1609 9.76835 12.0118 9.68909 11.896 9.63281C11.839 9.60514 11.7916 9.58407 11.7603 9.57031L11.7192 9.55273H11.7183L11.7163 9.55176C11.715 9.55122 11.7133 9.55056 11.7114 9.5498C11.7071 9.54803 11.7008 9.5449 11.6938 9.54199C11.6801 9.53621 11.6611 9.5286 11.6382 9.51855C11.5915 9.49808 11.5265 9.46797 11.4497 9.43066C11.2978 9.35687 11.0892 9.24796 10.8765 9.10938C10.6688 8.97407 10.4266 8.7913 10.229 8.56445C10.0371 8.34398 9.82204 8.00515 9.82178 7.57227C9.82178 6.63623 10.466 5.92047 11.2856 5.65234L11.2866 5H12.7866L12.7856 5.6748Z" fill="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect vector-effect="non-scaling-stroke" x="5" y="5.28076" width="14" height="1.5" rx="0.75" fill="currentColor"/>
|
|
3
|
+
<rect vector-effect="non-scaling-stroke" x="8.27539" y="11.2192" width="14" height="1.5" rx="0.75" fill="currentColor"/>
|
|
4
|
+
<rect vector-effect="non-scaling-stroke" x="8.44922" y="17.2192" width="14" height="1.5" rx="0.75" fill="currentColor"/>
|
|
5
|
+
<circle vector-effect="non-scaling-stroke" cx="2.30078" cy="6.03076" r="0.75" fill="currentColor"/>
|
|
6
|
+
<circle vector-effect="non-scaling-stroke" cx="5.67578" cy="11.9692" r="0.75" fill="currentColor"/>
|
|
7
|
+
<circle vector-effect="non-scaling-stroke" cx="5.67578" cy="17.9692" r="0.75" fill="currentColor"/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path vector-effect="non-scaling-stroke" d="M10.6047 10.011L10.4765 10.2749C10.4093 10.4774 10.2566 10.6307 10.0551 10.7044C9.43878 10.926 8.91201 11.1763 8.49707 11.4375M13.4262 10.2442L13.2674 10.0908C13.3957 10.3608 13.6094 10.5817 13.872 10.7228C14.3816 10.8972 14.9429 11.145 15.4124 11.4375M11.8262 10.2994C11.246 10.2994 10.7085 10.011 10.3849 9.52631L10.3665 9.49563L10.3482 9.45882C9.5848 8.29306 9.21837 6.90642 9.30998 5.50751C9.35273 4.12087 10.4826 3.01033 11.8628 3.00419H11.9483C13.3347 2.92443 14.5195 3.99202 14.5989 5.37866C14.5989 5.42775 14.5989 5.4707 14.5989 5.51978C14.6844 6.89415 14.3302 8.26238 13.5851 9.41587L13.5362 9.4895C13.2003 9.98648 12.6384 10.281 12.046 10.2871H11.9483C11.9056 10.2871 11.8628 10.2933 11.8201 10.2933L11.8262 10.2994Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
3
|
+
<path vector-effect="non-scaling-stroke" d="M1.125 20.7002C1.14332 20.0069 1.21661 19.3136 1.33875 18.6325C1.47312 18.0128 2.43807 17.3134 3.92214 16.7796C4.12368 16.7059 4.27636 16.5525 4.34354 16.3501L4.47179 16.0862M7.29326 16.3194L7.13447 16.166C7.26272 16.436 7.47648 16.6569 7.73909 16.798C8.83229 17.1722 10.1637 17.884 10.3164 18.6509C10.4446 19.3258 10.5057 20.013 10.4996 20.6941M5.69325 16.3746C5.11306 16.3746 4.57562 16.0862 4.25193 15.6015L4.23361 15.5708L4.21529 15.534C3.45188 14.3683 3.08544 12.9816 3.17705 11.5827C3.2198 10.1961 4.34965 9.08553 5.72989 9.07939H5.8154C7.20175 8.99963 8.38656 10.0672 8.46596 11.4539C8.46596 11.5029 8.46596 11.5459 8.46596 11.595C8.55146 12.9693 8.19724 14.3376 7.45215 15.4911L7.40329 15.5647C7.06739 16.0617 6.50552 16.3562 5.91311 16.3623H5.8154C5.77264 16.3623 5.72989 16.3685 5.68714 16.3685L5.69325 16.3746Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
4
|
+
<path vector-effect="non-scaling-stroke" d="M13.5 20.7002C13.5183 20.0069 13.5916 19.3136 13.7138 18.6325C13.8481 18.0128 14.8131 17.3134 16.2971 16.7796C16.4987 16.7059 16.6514 16.5525 16.7185 16.3501L16.8468 16.0862M19.6683 16.3194L19.5095 16.166C19.6377 16.436 19.8515 16.6569 20.1141 16.798C21.2073 17.1722 22.5387 17.884 22.6914 18.6509C22.8196 19.3258 22.8807 20.013 22.8746 20.6941M18.0682 16.3746C17.4881 16.3746 16.9506 16.0862 16.6269 15.6015L16.6086 15.5708L16.5903 15.534C15.8269 14.3683 15.4604 12.9816 15.552 11.5827C15.5948 10.1961 16.7246 9.08553 18.1049 9.07939H18.1904C19.5767 8.99963 20.7616 10.0672 20.841 11.4539C20.841 11.5029 20.841 11.5459 20.841 11.595C20.9265 12.9693 20.5722 14.3376 19.8271 15.4911L19.7783 15.5647C19.4424 16.0617 18.8805 16.3562 18.2881 16.3623H18.1904C18.1476 16.3623 18.1049 16.3685 18.0621 16.3685L18.0682 16.3746Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
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
|
@@ -23,6 +23,7 @@ interface Config {
|
|
|
23
23
|
|
|
24
24
|
// Private state
|
|
25
25
|
let config: Config | null = null;
|
|
26
|
+
let options: { match?: (key: string) => boolean } | null = null;
|
|
26
27
|
let rootPath: string | null = null;
|
|
27
28
|
let rootConfig: ConfigRoot | null = null;
|
|
28
29
|
|
|
@@ -31,6 +32,7 @@ let rootConfig: ConfigRoot | null = null;
|
|
|
31
32
|
*/
|
|
32
33
|
function resetConfig() {
|
|
33
34
|
config = null;
|
|
35
|
+
options = null;
|
|
34
36
|
rootPath = null;
|
|
35
37
|
rootConfig = null;
|
|
36
38
|
}
|
|
@@ -40,7 +42,7 @@ function resetConfig() {
|
|
|
40
42
|
* @param {Object} [configObj=config] - The config object.
|
|
41
43
|
* @returns {string} - The root path.
|
|
42
44
|
*/
|
|
43
|
-
function getRootPath(configObj: Config | null = config): string {
|
|
45
|
+
function getRootPath(configObj: Config | null = config, optionsObj: { match?: (key: string) => boolean } | null = options): string {
|
|
44
46
|
if (!configObj) {
|
|
45
47
|
console.warn('No config found. Please call initializeConfig() first.');
|
|
46
48
|
return '/';
|
|
@@ -56,7 +58,7 @@ function getRootPath(configObj: Config | null = config): string {
|
|
|
56
58
|
.find(
|
|
57
59
|
(key) =>
|
|
58
60
|
window.location.pathname === key ||
|
|
59
|
-
window.location.pathname.startsWith(key)
|
|
61
|
+
(optionsObj?.match?.(key) ?? window.location.pathname.startsWith(key))
|
|
60
62
|
);
|
|
61
63
|
|
|
62
64
|
return value ?? '/';
|
|
@@ -126,11 +128,15 @@ function applyConfigOverrides(
|
|
|
126
128
|
|
|
127
129
|
/**
|
|
128
130
|
* Initializes the configuration system.
|
|
131
|
+
* @param {Object} configObj - The config object.
|
|
132
|
+
* @param {Object} [options] - The options object.
|
|
133
|
+
* @param {Function} [options.match] - The function to match the path to the config.
|
|
129
134
|
* @returns {Object} The initialized root configuration
|
|
130
135
|
*/
|
|
131
|
-
function initializeConfig(configObj: Config): ConfigRoot {
|
|
136
|
+
function initializeConfig(configObj: Config, optionsObj?: { match?: (key: string) => boolean }): ConfigRoot {
|
|
132
137
|
config = configObj;
|
|
133
|
-
|
|
138
|
+
options = optionsObj ?? null;
|
|
139
|
+
rootPath = getRootPath(config, { match: optionsObj?.match });
|
|
134
140
|
rootConfig = applyConfigOverrides(config, rootPath);
|
|
135
141
|
return rootConfig;
|
|
136
142
|
}
|