@sebgroup/green-core 2.19.0 → 2.20.0-rc.20251215154321804

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.
Files changed (64) hide show
  1. package/components/badge/badge.component.d.ts +0 -23
  2. package/components/badge/badge.component.js +18 -105
  3. package/components/badge/badge.styles.js +96 -2
  4. package/components/checkbox/checkbox.component.js +24 -22
  5. package/components/checkbox/checkbox.styles.js +0 -8
  6. package/components/dropdown/dropdown.component.js +4 -1
  7. package/components/index.d.ts +2 -0
  8. package/components/index.js +2 -0
  9. package/components/input/input.styles.js +10 -1
  10. package/components/pagination/index.d.ts +1 -0
  11. package/components/pagination/index.js +1 -0
  12. package/components/pagination/pagination.component.d.ts +82 -0
  13. package/components/pagination/pagination.component.js +441 -0
  14. package/components/pagination/pagination.d.ts +2 -0
  15. package/components/pagination/pagination.js +6 -0
  16. package/components/pagination/pagination.styles.d.ts +1 -0
  17. package/components/pagination/pagination.styles.js +19 -0
  18. package/components/table/index.d.ts +2 -0
  19. package/components/table/index.js +6 -0
  20. package/components/table/table.component.d.ts +140 -0
  21. package/components/table/table.component.js +1090 -0
  22. package/components/table/table.d.ts +2 -0
  23. package/components/table/table.imports.d.ts +6 -0
  24. package/components/table/table.imports.js +63 -0
  25. package/components/table/table.js +6 -0
  26. package/components/table/table.stories.data.d.ts +53 -0
  27. package/components/table/table.stories.data.js +401 -0
  28. package/components/table/table.styles.d.ts +1 -0
  29. package/components/table/table.styles.js +788 -0
  30. package/components/table/table.types.d.ts +155 -0
  31. package/components/table/table.types.js +24 -0
  32. package/custom-elements.json +12280 -10492
  33. package/gds-element.js +1 -1
  34. package/generated/locales/da.d.ts +32 -0
  35. package/generated/locales/da.js +32 -0
  36. package/generated/locales/de.d.ts +32 -0
  37. package/generated/locales/de.js +32 -0
  38. package/generated/locales/fi.d.ts +32 -0
  39. package/generated/locales/fi.js +32 -0
  40. package/generated/locales/fr.d.ts +32 -0
  41. package/generated/locales/fr.js +32 -0
  42. package/generated/locales/it.d.ts +32 -0
  43. package/generated/locales/it.js +32 -0
  44. package/generated/locales/nl.d.ts +32 -0
  45. package/generated/locales/nl.js +32 -0
  46. package/generated/locales/no.d.ts +32 -0
  47. package/generated/locales/no.js +33 -1
  48. package/generated/locales/sv.d.ts +32 -0
  49. package/generated/locales/sv.js +32 -0
  50. package/generated/react/index.d.ts +8 -6
  51. package/generated/react/index.js +8 -6
  52. package/generated/react/input/index.d.ts +1 -1
  53. package/generated/react/pagination/index.d.ts +395 -0
  54. package/generated/react/pagination/index.js +13 -0
  55. package/generated/react/table/index.d.ts +395 -0
  56. package/generated/react/table/index.js +13 -0
  57. package/package.json +8 -1
  58. package/primitives/field-base/field-base.component.d.ts +1 -0
  59. package/primitives/field-base/field-base.component.js +8 -0
  60. package/primitives/field-base/field-base.styles.js +9 -1
  61. package/pure.d.ts +2 -0
  62. package/pure.js +2 -0
  63. package/shared-styles/rbcb-toggle.style.js +41 -12
  64. package/utils/helpers/custom-element-scoping.js +1 -1
@@ -0,0 +1,2 @@
1
+ import { GdsTable } from './table.component';
2
+ export { GdsTable };
@@ -0,0 +1,6 @@
1
+ import { GdsBadge, GdsButton, GdsContextMenu, GdsDropdown, GdsFlex, GdsImg, GdsInput, GdsLink, GdsMenuItem, IconCrossSmall } from '../../pure';
2
+ import { GdsPagination } from '../pagination/pagination.component';
3
+ export { checkboxToggle as Checkbox } from '../../shared-styles/rbcb-toggle.template';
4
+ export { accountsFormats as FormatAccount, dateTimeFormats as FormatDate, numberFormats as FormatNumber, } from '../formatted-text/formatters';
5
+ export declare const Styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
6
+ export declare const Dependencies: (typeof GdsMenuItem | typeof GdsButton | typeof IconCrossSmall | typeof GdsFlex | typeof GdsBadge | typeof GdsLink | typeof GdsContextMenu | typeof GdsDropdown | typeof GdsImg | typeof GdsPagination | typeof GdsInput)[];
@@ -0,0 +1,63 @@
1
+ import "../../chunks/chunk.QU3DSPNU.js";
2
+ import {
3
+ GdsBadge,
4
+ GdsButton,
5
+ GdsCard,
6
+ GdsContextMenu,
7
+ GdsDropdown,
8
+ GdsFlex,
9
+ GdsImg,
10
+ GdsInput,
11
+ GdsLink,
12
+ GdsMenuItem,
13
+ GdsText,
14
+ IconCopy,
15
+ IconCrossSmall,
16
+ IconDotGridOneHorizontal,
17
+ IconMagnifyingGlass,
18
+ IconMinusSmall,
19
+ IconSort,
20
+ IconSortDown,
21
+ IconSortUp
22
+ } from "../../pure.js";
23
+ import checkboxStyles from "../../shared-styles/rbcb-toggle.style.js";
24
+ import { tokens } from "../../tokens.style.js";
25
+ import { GdsPagination } from "../pagination/pagination.component.js";
26
+ import { TableStyles } from "./table.styles.js";
27
+ import { checkboxToggle } from "../../shared-styles/rbcb-toggle.template.js";
28
+ import {
29
+ accountsFormats,
30
+ dateTimeFormats,
31
+ numberFormats
32
+ } from "../formatted-text/formatters.js";
33
+ const Styles = [tokens, checkboxStyles, TableStyles];
34
+ const Dependencies = [
35
+ GdsButton,
36
+ GdsCard,
37
+ GdsImg,
38
+ GdsContextMenu,
39
+ GdsMenuItem,
40
+ GdsDropdown,
41
+ GdsInput,
42
+ GdsPagination,
43
+ GdsText,
44
+ GdsBadge,
45
+ GdsLink,
46
+ GdsFlex,
47
+ IconCopy,
48
+ IconCrossSmall,
49
+ IconMinusSmall,
50
+ IconMagnifyingGlass,
51
+ IconSort,
52
+ IconSortDown,
53
+ IconSortUp,
54
+ IconDotGridOneHorizontal
55
+ ];
56
+ export {
57
+ checkboxToggle as Checkbox,
58
+ Dependencies,
59
+ accountsFormats as FormatAccount,
60
+ dateTimeFormats as FormatDate,
61
+ numberFormats as FormatNumber,
62
+ Styles
63
+ };
@@ -0,0 +1,6 @@
1
+ import "../../chunks/chunk.QU3DSPNU.js";
2
+ import { GdsTable } from "./table.component.js";
3
+ GdsTable.define();
4
+ export {
5
+ GdsTable
6
+ };
@@ -0,0 +1,53 @@
1
+ import { TableColumn, TableRequest, TableResponse } from './table.types';
2
+ interface UserData {
3
+ id: number;
4
+ name: string;
5
+ email: string;
6
+ role: 'Admin' | 'User' | 'Editor';
7
+ status: 'Active' | 'Inactive';
8
+ amount: number;
9
+ account: string;
10
+ lastLogin: string;
11
+ avatarUrl?: string;
12
+ department?: string;
13
+ download?: string;
14
+ }
15
+ interface FeedbackData {
16
+ id: number;
17
+ name: string;
18
+ email: string;
19
+ feedback: string;
20
+ notes: string;
21
+ status: 'Active' | 'Inactive';
22
+ department: string;
23
+ }
24
+ export declare const Users: {
25
+ Columns: TableColumn[];
26
+ Actions: {
27
+ label: string;
28
+ justify: string;
29
+ cell: {
30
+ type: string;
31
+ items: ({
32
+ label: (row: UserData) => "Activate" | "Deactivate";
33
+ divider?: undefined;
34
+ } | {
35
+ label: string;
36
+ divider?: undefined;
37
+ } | {
38
+ divider: boolean;
39
+ label: string;
40
+ })[];
41
+ };
42
+ };
43
+ Data: (request: TableRequest) => Promise<TableResponse<UserData>>;
44
+ };
45
+ export declare const Feedback: {
46
+ Columns: TableColumn[];
47
+ MultipleActions: any;
48
+ ActionLink: any;
49
+ ActionButton: any;
50
+ ActionContextMenu: any;
51
+ Data: (request: TableRequest) => Promise<TableResponse<FeedbackData>>;
52
+ };
53
+ export {};
@@ -0,0 +1,401 @@
1
+ import "../../chunks/chunk.QU3DSPNU.js";
2
+ const USERS = {
3
+ FIRST_NAMES: [
4
+ "Alexandra",
5
+ "Benjamin",
6
+ "Caroline",
7
+ "David",
8
+ "Elena",
9
+ "Fredrik"
10
+ ],
11
+ LAST_NAMES: ["Andersson", "Bergstr\xF6m", "Carlsson", "Dahlstr\xF6m", "Eriksson"],
12
+ ROLES: ["Admin", "User", "Editor"],
13
+ STATUSES: ["Active", "Inactive"],
14
+ DEPARTMENTS: ["Engineering", "Sales", "Marketing", "Support", "HR"],
15
+ COUNT: 100
16
+ };
17
+ const generateUserRecord = (index) => {
18
+ const id = index + 1;
19
+ const firstName = USERS.FIRST_NAMES[index % USERS.FIRST_NAMES.length];
20
+ const lastName = USERS.LAST_NAMES[index % USERS.LAST_NAMES.length];
21
+ return {
22
+ id,
23
+ name: `${firstName} ${lastName}`,
24
+ email: `${firstName.toLowerCase()}@domain.tld`,
25
+ role: USERS.ROLES[index % USERS.ROLES.length],
26
+ status: USERS.STATUSES[index % USERS.STATUSES.length],
27
+ department: USERS.DEPARTMENTS[index % USERS.DEPARTMENTS.length],
28
+ amount: Math.floor(Math.random() * 5e5) + 1e4,
29
+ account: `5440${String(index * 7919 % 1e7).padStart(7, "0")}`,
30
+ lastLogin: new Date(
31
+ Date.now() - Math.random() * 30 * 864e5
32
+ ).toISOString(),
33
+ avatarUrl: `https://api.dicebear.com/7.x/avataaars/svg?seed=${firstName}${lastName}`,
34
+ download: `#`
35
+ };
36
+ };
37
+ const generateUserDataset = () => Array.from({ length: USERS.COUNT }, (_, i) => generateUserRecord(i));
38
+ const userDataProvider = async (request) => {
39
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
40
+ const allData = generateUserDataset();
41
+ let processedData = [...allData];
42
+ if (request.searchQuery) {
43
+ const query = request.searchQuery.toLowerCase();
44
+ processedData = processedData.filter(
45
+ (item) => Object.values(item).some(
46
+ (value) => String(value).toLowerCase().includes(query)
47
+ )
48
+ );
49
+ }
50
+ if (request.sortColumn) {
51
+ processedData.sort((a, b) => {
52
+ const aValue = String(a[request.sortColumn]);
53
+ const bValue = String(b[request.sortColumn]);
54
+ return request.sortDirection === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
55
+ });
56
+ }
57
+ const startIndex = (request.page - 1) * request.rows;
58
+ const endIndex = startIndex + request.rows;
59
+ const paginatedData = processedData.slice(startIndex, endIndex);
60
+ return {
61
+ rows: paginatedData,
62
+ total: processedData.length
63
+ };
64
+ };
65
+ const Users = {
66
+ Columns: [
67
+ {
68
+ key: "id",
69
+ label: "ID",
70
+ sortable: false
71
+ },
72
+ {
73
+ key: "name",
74
+ label: "Name",
75
+ sortable: true,
76
+ cell: {
77
+ lead: {
78
+ type: "image",
79
+ src: (row) => row.avatarUrl,
80
+ alt: (row) => row.name,
81
+ width: "xl",
82
+ height: "xl"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ key: "email",
88
+ label: "Email",
89
+ sortable: true,
90
+ justify: "space-between",
91
+ cell: {
92
+ trail: {
93
+ type: "button",
94
+ rank: "tertiary",
95
+ value: (row) => row.email,
96
+ /* size: 'xs', */
97
+ template: "email-copy"
98
+ }
99
+ }
100
+ },
101
+ {
102
+ key: "role",
103
+ label: "Role",
104
+ sortable: true,
105
+ visible: false,
106
+ value: (row) => `${row.role.toUpperCase()} (${row.department || "N/A"})`
107
+ },
108
+ {
109
+ key: "status",
110
+ label: "Status",
111
+ sortable: true,
112
+ cell: {
113
+ value: {
114
+ type: "badge",
115
+ value: (row) => row.status,
116
+ variant: (row) => row.status === "Active" ? "positive" : "negative"
117
+ }
118
+ }
119
+ },
120
+ {
121
+ key: "department",
122
+ label: "Department",
123
+ sortable: true,
124
+ cell: {
125
+ lead: {
126
+ type: "icon",
127
+ template: "department-icon"
128
+ }
129
+ }
130
+ },
131
+ {
132
+ key: "amount",
133
+ label: "Amount",
134
+ sortable: true,
135
+ justify: "end",
136
+ cell: {
137
+ value: {
138
+ type: "formatted-number",
139
+ value: (row) => row.amount
140
+ },
141
+ trail: {
142
+ type: "badge",
143
+ value: "SEK"
144
+ }
145
+ }
146
+ },
147
+ {
148
+ key: "account",
149
+ label: "Account",
150
+ sortable: true,
151
+ cell: {
152
+ value: {
153
+ type: "formatted-account",
154
+ value: (row) => row.account,
155
+ format: "seb-account"
156
+ }
157
+ }
158
+ },
159
+ {
160
+ key: "lastLogin",
161
+ label: "Last Login",
162
+ sortable: true,
163
+ cell: {
164
+ value: {
165
+ type: "formatted-date",
166
+ value: (row) => row.lastLogin,
167
+ locale: "sv-SE",
168
+ format: "dateLong"
169
+ }
170
+ }
171
+ },
172
+ {
173
+ key: "download",
174
+ label: "Download",
175
+ cell: {
176
+ value: {
177
+ type: "link",
178
+ href: (row) => row.download,
179
+ download: true,
180
+ template: "download-image",
181
+ label: "Download file"
182
+ }
183
+ }
184
+ }
185
+ ],
186
+ Actions: {
187
+ label: "Actions",
188
+ justify: "end",
189
+ cell: {
190
+ type: "context-menu",
191
+ items: [
192
+ {
193
+ label: (row) => row.status === "Active" ? "Deactivate" : "Activate"
194
+ /* onClick: (row: UserData) => console.log('Toggle status', row), */
195
+ },
196
+ {
197
+ label: "View Details"
198
+ /* onClick: (row: UserData) => console.log('View user', row), */
199
+ },
200
+ {
201
+ label: "Edit Profile"
202
+ /* onClick: (row: UserData) => console.log('Edit user', row), */
203
+ },
204
+ {
205
+ divider: true,
206
+ label: "Delete User"
207
+ /* onClick: (row: UserData) => {
208
+ if (confirm(`Delete ${row.name}?`)) {
209
+ console.log('Delete user', row)
210
+ }
211
+ }, */
212
+ }
213
+ ]
214
+ }
215
+ },
216
+ Data: userDataProvider
217
+ };
218
+ const FEEDBACK = {
219
+ FIRST_NAMES: ["Sophie", "Marcus", "Isabella", "Johan", "Emma", "Lucas"],
220
+ LAST_NAMES: ["Str\xF6m", "Nord", "Berg", "Gren", "Holm"],
221
+ DEPARTMENTS: ["Engineering", "Sales", "Marketing", "Support", "HR"],
222
+ STATUSES: ["Active", "Inactive"],
223
+ FEEDBACK_TEXTS: [
224
+ "Excellent user experience with intuitive interface and smooth navigation.",
225
+ "Performance needs improvement when handling large datasets.",
226
+ "Documentation is comprehensive but could benefit from more code examples.",
227
+ "Outstanding accessibility features and WCAG compliance implementation.",
228
+ "Mobile experience is good but some minor UI inconsistencies observed.",
229
+ "Feature request: Please add real-time collaboration capabilities.",
230
+ "Integration with third-party APIs works seamlessly.",
231
+ "User support team is responsive and helpful.",
232
+ "Suggest adding dark mode and customizable themes.",
233
+ "Security audit results are impressive and thorough."
234
+ ],
235
+ NOTES: [
236
+ "Customer upgraded to premium plan. All features activated.",
237
+ "Q1 planning meeting scheduled for next week at 10 AM.",
238
+ "Bug fix deployed in production. Monitor system for 24 hours.",
239
+ "Account manager assigned: John Smith.",
240
+ "Scheduled maintenance window: Saturday 2-4 AM.",
241
+ "Training session completed successfully.",
242
+ "Custom integration request in progress.",
243
+ "Contract renewal due in 30 days.",
244
+ "Performance optimization completed.",
245
+ "Security certificates updated to latest version."
246
+ ],
247
+ COUNT: 50
248
+ };
249
+ const generateFeedbackRecord = (index) => {
250
+ const id = index + 1;
251
+ const firstName = FEEDBACK.FIRST_NAMES[index % FEEDBACK.FIRST_NAMES.length];
252
+ const lastName = FEEDBACK.LAST_NAMES[index % FEEDBACK.LAST_NAMES.length];
253
+ return {
254
+ id,
255
+ name: `${firstName} ${lastName}`,
256
+ email: `${firstName.toLowerCase()}.${lastName.toLowerCase()}@company.com`,
257
+ feedback: FEEDBACK.FEEDBACK_TEXTS[index % FEEDBACK.FEEDBACK_TEXTS.length],
258
+ notes: FEEDBACK.NOTES[index % FEEDBACK.NOTES.length],
259
+ status: index % 3 === 0 ? "Inactive" : "Active",
260
+ department: FEEDBACK.DEPARTMENTS[index % FEEDBACK.DEPARTMENTS.length]
261
+ };
262
+ };
263
+ const generateFeedbackDataset = () => Array.from({ length: FEEDBACK.COUNT }, (_, i) => generateFeedbackRecord(i));
264
+ const feedbackDataProvider = async (request) => {
265
+ await new Promise((resolve) => setTimeout(resolve, 800));
266
+ const allData = generateFeedbackDataset();
267
+ let processedData = [...allData];
268
+ if (request.searchQuery) {
269
+ const query = request.searchQuery.toLowerCase();
270
+ processedData = processedData.filter(
271
+ (item) => Object.values(item).some(
272
+ (value) => String(value).toLowerCase().includes(query)
273
+ )
274
+ );
275
+ }
276
+ if (request.sortColumn) {
277
+ processedData.sort((a, b) => {
278
+ const aValue = String(a[request.sortColumn]);
279
+ const bValue = String(b[request.sortColumn]);
280
+ return request.sortDirection === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
281
+ });
282
+ }
283
+ const startIndex = (request.page - 1) * request.rows;
284
+ const endIndex = startIndex + request.rows;
285
+ const paginatedData = processedData.slice(startIndex, endIndex);
286
+ return {
287
+ rows: paginatedData,
288
+ total: processedData.length
289
+ };
290
+ };
291
+ const Feedback = {
292
+ Columns: [
293
+ {
294
+ key: "name",
295
+ label: "Name",
296
+ sortable: true,
297
+ align: "start"
298
+ },
299
+ {
300
+ key: "feedback",
301
+ label: "Feedback",
302
+ width: "350px"
303
+ },
304
+ {
305
+ key: "notes",
306
+ label: "Notes",
307
+ align: "start",
308
+ width: "300px"
309
+ },
310
+ {
311
+ key: "department",
312
+ label: "Department",
313
+ align: "start",
314
+ width: "120px"
315
+ },
316
+ {
317
+ key: "status",
318
+ label: "Status",
319
+ sortable: true,
320
+ align: "start",
321
+ justify: "end",
322
+ width: "100px",
323
+ cell: {
324
+ value: {
325
+ type: "badge",
326
+ value: (row) => row.status,
327
+ variant: (row) => row.status === "Active" ? "positive" : "negative",
328
+ size: "small"
329
+ }
330
+ }
331
+ }
332
+ ],
333
+ MultipleActions: {
334
+ label: "Actions",
335
+ align: "start",
336
+ justify: "start",
337
+ cell: [
338
+ {
339
+ type: "button",
340
+ size: "xs",
341
+ template: "actions-activate"
342
+ },
343
+ {
344
+ type: "button",
345
+ size: "xs",
346
+ variant: "negative",
347
+ template: "actions-delete"
348
+ }
349
+ ]
350
+ },
351
+ ActionLink: {
352
+ label: "Actions",
353
+ align: "start",
354
+ justify: "end",
355
+ cell: [
356
+ {
357
+ type: "link",
358
+ href: "#",
359
+ label: "Link"
360
+ }
361
+ ]
362
+ },
363
+ ActionButton: {
364
+ label: "Actions",
365
+ align: "start",
366
+ justify: "start",
367
+ cell: [
368
+ {
369
+ type: "button",
370
+ label: "Link"
371
+ }
372
+ ]
373
+ },
374
+ ActionContextMenu: {
375
+ label: "Actions",
376
+ align: "start",
377
+ justify: "end",
378
+ cell: {
379
+ type: "context-menu",
380
+ items: [
381
+ {
382
+ label: "Activate"
383
+ },
384
+ {
385
+ label: "View Details"
386
+ },
387
+ {
388
+ label: "Edit Profile"
389
+ },
390
+ {
391
+ label: "Delete User"
392
+ }
393
+ ]
394
+ }
395
+ },
396
+ Data: feedbackDataProvider
397
+ };
398
+ export {
399
+ Feedback,
400
+ Users
401
+ };
@@ -0,0 +1 @@
1
+ export declare const TableStyles: import("lit").CSSResult;