@limetech/lime-elements 37.18.0 → 37.19.0-dev.1

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 (54) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/file-metadata-062e1135.js +58 -0
  3. package/dist/cjs/file-metadata-062e1135.js.map +1 -0
  4. package/dist/{esm/file-metadata-9a4780e2.js → cjs/icons-8ecb9740.js} +36 -50
  5. package/dist/cjs/icons-8ecb9740.js.map +1 -0
  6. package/dist/cjs/index.cjs.js +6 -0
  7. package/dist/cjs/index.cjs.js.map +1 -1
  8. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +2 -1
  9. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js.map +1 -1
  10. package/dist/cjs/limel-file.cjs.entry.js +2 -1
  11. package/dist/cjs/limel-file.cjs.entry.js.map +1 -1
  12. package/dist/collection/components/file/icon-background-colors.js +11 -0
  13. package/dist/collection/components/file/icon-background-colors.js.map +1 -1
  14. package/dist/collection/components/file/icon-fill-colors.js +11 -0
  15. package/dist/collection/components/file/icon-fill-colors.js.map +1 -1
  16. package/dist/collection/components/file/icons.js +9 -0
  17. package/dist/collection/components/file/icons.js.map +1 -1
  18. package/dist/collection/components/file/index.js +4 -0
  19. package/dist/collection/components/file/index.js.map +1 -0
  20. package/dist/collection/interface.js +3 -2
  21. package/dist/collection/interface.js.map +1 -1
  22. package/dist/esm/file-metadata-f5ba6228.js +53 -0
  23. package/dist/esm/file-metadata-f5ba6228.js.map +1 -0
  24. package/dist/{cjs/file-metadata-f259bba5.js → esm/icons-d4830de7.js} +33 -56
  25. package/dist/esm/icons-d4830de7.js.map +1 -0
  26. package/dist/esm/index.js +2 -0
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/limel-file-dropzone_2.entry.js +2 -1
  29. package/dist/esm/limel-file-dropzone_2.entry.js.map +1 -1
  30. package/dist/esm/limel-file.entry.js +2 -1
  31. package/dist/esm/limel-file.entry.js.map +1 -1
  32. package/dist/lime-elements/index.esm.js +1 -1
  33. package/dist/lime-elements/index.esm.js.map +1 -1
  34. package/dist/lime-elements/lime-elements.esm.js +1 -1
  35. package/dist/lime-elements/p-35e7a41b.js +2 -0
  36. package/dist/lime-elements/p-35e7a41b.js.map +1 -0
  37. package/dist/lime-elements/p-48b9449e.js +2 -0
  38. package/dist/lime-elements/p-48b9449e.js.map +1 -0
  39. package/dist/lime-elements/p-6c36f090.entry.js +2 -0
  40. package/dist/lime-elements/{p-fc91537a.entry.js.map → p-6c36f090.entry.js.map} +1 -1
  41. package/dist/lime-elements/p-a1ffb47f.entry.js +2 -0
  42. package/dist/lime-elements/{p-c9ffb1b4.entry.js.map → p-a1ffb47f.entry.js.map} +1 -1
  43. package/dist/types/components/file/icon-background-colors.d.ts +11 -0
  44. package/dist/types/components/file/icon-fill-colors.d.ts +11 -0
  45. package/dist/types/components/file/icons.d.ts +9 -0
  46. package/dist/types/components/file/index.d.ts +4 -0
  47. package/dist/types/interface.d.ts +3 -2
  48. package/package.json +2 -2
  49. package/dist/cjs/file-metadata-f259bba5.js.map +0 -1
  50. package/dist/esm/file-metadata-9a4780e2.js.map +0 -1
  51. package/dist/lime-elements/p-8bc1584b.js +0 -2
  52. package/dist/lime-elements/p-8bc1584b.js.map +0 -1
  53. package/dist/lime-elements/p-c9ffb1b4.entry.js +0 -2
  54. package/dist/lime-elements/p-fc91537a.entry.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [37.19.0-dev.1](https://github.com/Lundalogik/lime-elements/compare/v37.18.0...v37.19.0-dev.1) (2024-04-17)
2
+
3
+
4
+ ### Features
5
+
6
+
7
+ * export functions `getIconForFile`, `getIconFillColorForFile`, `getIconBackgroundColorForFile` ([27fb9e9](https://github.com/Lundalogik/lime-elements/commit/27fb9e9c4bdd84c40f090cf06eec63e1e7367b4c))
8
+
1
9
  ## [37.18.0](https://github.com/Lundalogik/lime-elements/compare/v37.17.3...v37.18.0) (2024-04-16)
2
10
 
3
11
 
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ const icons = require('./icons-8ecb9740.js');
4
+ const getIconProps = require('./get-icon-props-50be7440.js');
5
+
6
+ function getFileIcon(file) {
7
+ const name = getIconProps.getIconName(file.icon);
8
+ if (name) {
9
+ return name;
10
+ }
11
+ const extension = getExtension(file);
12
+ if (!extension) {
13
+ return;
14
+ }
15
+ return icons.getIconForFile(extension);
16
+ }
17
+ function getFileColor(file) {
18
+ const color = getIconProps.getIconColor(file.icon, file.iconColor);
19
+ if (color) {
20
+ return color;
21
+ }
22
+ const extension = getExtension(file);
23
+ if (!extension) {
24
+ return;
25
+ }
26
+ return icons.getIconFillColorForFile(extension);
27
+ }
28
+ function getFileBackgroundColor(file) {
29
+ const backgroundColor = getIconProps.getIconBackgroundColor(file.icon, file.iconBackgroundColor);
30
+ if (backgroundColor) {
31
+ return backgroundColor;
32
+ }
33
+ const extension = getExtension(file);
34
+ if (!extension) {
35
+ return;
36
+ }
37
+ return icons.getIconBackgroundColorForFile(extension);
38
+ }
39
+ function getFileExtensionTitle(file) {
40
+ const name = getIconProps.getIconName(file.icon);
41
+ if (name) {
42
+ return name;
43
+ }
44
+ return getExtension(file);
45
+ }
46
+ function getExtension(file) {
47
+ if (!file) {
48
+ return;
49
+ }
50
+ return file.filename.split('.').pop();
51
+ }
52
+
53
+ exports.getFileBackgroundColor = getFileBackgroundColor;
54
+ exports.getFileColor = getFileColor;
55
+ exports.getFileExtensionTitle = getFileExtensionTitle;
56
+ exports.getFileIcon = getFileIcon;
57
+
58
+ //# sourceMappingURL=file-metadata-062e1135.js.map
@@ -0,0 +1 @@
1
+ {"file":"file-metadata-062e1135.js","mappings":";;;;;SAUgB,WAAW,CAAC,IAAc;EACtC,MAAM,IAAI,GAAGA,wBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAEpC,IAAI,IAAI,EAAE;IACN,OAAO,IAAI,CAAC;GACf;EAED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groundColor","getIconBackgroundColorForFile"],"sources":["./src/util/file-metadata.ts"],"sourcesContent":["import { FileInfo } from '../global/shared-types/file.types';\nimport { getIconBackgroundColorForFile } from '../components/file/icon-background-colors';\nimport { getIconFillColorForFile } from '../components/file/icon-fill-colors';\nimport { getIconForFile } from '../components/file/icons';\nimport {\n getIconBackgroundColor,\n getIconColor,\n getIconName,\n} from '../components/icon/get-icon-props';\n\nexport function getFileIcon(file: FileInfo) {\n const name = getIconName(file.icon);\n\n if (name) {\n return name;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconForFile(extension);\n}\n\nexport function getFileColor(file: FileInfo) {\n const color = getIconColor(file.icon, file.iconColor);\n\n if (color) {\n return color;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconFillColorForFile(extension);\n}\n\nexport function getFileBackgroundColor(file: FileInfo) {\n const backgroundColor = getIconBackgroundColor(\n file.icon,\n file.iconBackgroundColor,\n );\n\n if (backgroundColor) {\n return backgroundColor;\n }\n\n const extension = getExtension(file);\n if (!extension) {\n return;\n }\n\n return getIconBackgroundColorForFile(extension);\n}\n\nexport function getFileExtensionTitle(file: FileInfo) {\n const name = getIconName(file.icon);\n\n if (name) {\n return name;\n }\n\n return getExtension(file);\n}\n\nexport function getExtension(file: FileInfo) {\n if (!file) {\n return;\n }\n\n return file.filename.split('.').pop();\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { g as getIconName, a as getIconColor, b as getIconBackgroundColor } from './get-icon-props-0b65f85e.js';
1
+ 'use strict';
2
2
 
3
3
  const DEFAULT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';
4
4
  const CALENDAR_ICON_BACKGROUND_COLOR = 'rgba(var(--color-cyan-lighter), 0.4)';
@@ -108,6 +108,17 @@ const filetypeBackgroundColorTable = {
108
108
  db: DATA_ICON_BACKGROUND_COLOR,
109
109
  dbf: DATA_ICON_BACKGROUND_COLOR,
110
110
  };
111
+ /**
112
+ * Takes a file extension as argument and returns the background color to use.
113
+ * While some file types have a fairly universally accepted icon color, like
114
+ * blue for Word documents, others are more arbitrary. This function provides
115
+ * a convention that we use at Lime. If you are using this code in your own
116
+ * project, you may or may not find this helper useful.
117
+ *
118
+ * @param extension - The file extension (without the dot).
119
+ * @returns The color to use for the icon.
120
+ * @public
121
+ */
111
122
  function getIconBackgroundColorForFile(extension) {
112
123
  return (filetypeBackgroundColorTable[extension.toLowerCase()] ||
113
124
  DEFAULT_ICON_BACKGROUND_COLOR);
@@ -221,6 +232,17 @@ const filetypeFillColorTable = {
221
232
  db: DATA_ICON_FILL_COLOR,
222
233
  dbf: DATA_ICON_FILL_COLOR,
223
234
  };
235
+ /**
236
+ * Takes a file extension as argument and returns the fill color to use.
237
+ * While some file types have a fairly universally accepted icon color, like
238
+ * blue for Word documents, others are more arbitrary. This function provides
239
+ * a convention that we use at Lime. If you are using this code in your own
240
+ * project, you may or may not find this helper useful.
241
+ *
242
+ * @param extension - The file extension (without the dot).
243
+ * @returns The color to use for the icon.
244
+ * @public
245
+ */
224
246
  function getIconFillColorForFile(extension) {
225
247
  return (filetypeFillColorTable[extension.toLowerCase()] ||
226
248
  DEFAULT_ICON_FILL_COLOR);
@@ -335,57 +357,21 @@ const filetypeIconTable = {
335
357
  db: DATA_ICON,
336
358
  dbf: DATA_ICON,
337
359
  };
360
+ /**
361
+ * Takes a file extension as argument and returns the corresponding icon name.
362
+ * Uses the names from the private icon package `lime-icons8`. If you are using
363
+ * a different icon package, this functions is probably not useful for you.
364
+ *
365
+ * @param extension - The file extension (without the dot).
366
+ * @returns The name of the icon to use.
367
+ * @public
368
+ */
338
369
  function getIconForFile(extension) {
339
370
  return filetypeIconTable[extension.toLowerCase()] || DEFAULT_ICON;
340
371
  }
341
372
 
342
- function getFileIcon(file) {
343
- const name = getIconName(file.icon);
344
- if (name) {
345
- return name;
346
- }
347
- const extension = getExtension(file);
348
- if (!extension) {
349
- return;
350
- }
351
- return getIconForFile(extension);
352
- }
353
- function getFileColor(file) {
354
- const color = getIconColor(file.icon, file.iconColor);
355
- if (color) {
356
- return color;
357
- }
358
- const extension = getExtension(file);
359
- if (!extension) {
360
- return;
361
- }
362
- return getIconFillColorForFile(extension);
363
- }
364
- function getFileBackgroundColor(file) {
365
- const backgroundColor = getIconBackgroundColor(file.icon, file.iconBackgroundColor);
366
- if (backgroundColor) {
367
- return backgroundColor;
368
- }
369
- const extension = getExtension(file);
370
- if (!extension) {
371
- return;
372
- }
373
- return getIconBackgroundColorForFile(extension);
374
- }
375
- function getFileExtensionTitle(file) {
376
- const name = getIconName(file.icon);
377
- if (name) {
378
- return name;
379
- }
380
- return getExtension(file);
381
- }
382
- function getExtension(file) {
383
- if (!file) {
384
- return;
385
- }
386
- return file.filename.split('.').pop();
387
- }
388
-
389
- export { getFileExtensionTitle as a, getFileColor as b, getFileBackgroundColor as c, getFileIcon as g };
373
+ exports.getIconBackgroundColorForFile = getIconBackgroundColorForFile;
374
+ exports.getIconFillColorForFile = getIconFillColorForFile;
375
+ exports.getIconForFile = getIconForFile;
390
376
 
391
- //# sourceMappingURL=file-metadata-9a4780e2.js.map
377
+ //# sourceMappingURL=icons-8ecb9740.js.map
@@ -0,0 +1 @@
1
+ {"file":"icons-8ecb9740.js","mappings":";;AAAA,MAAM,6BAA6B,GAAG,sCAAsC,CAAC;AAC7E,MAAM,8BAA8B,GAAG,sCAAsC,CAAC;AAC9E,MAAM,2BAA2B,GAAG,sCAAsC,CAAC;AAC3E,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AAC1E,MAAM,0BAA0B,GAAG,wCAAwC,CAAC;AAC5E,MAAM,2BAA2B,GAAG,uCAAuC,CAAC;AAC5E,MAAM,gCAAgC,GAClC,uCAAuC,CAAC;AAC5C,MAAM,0BAA0B,GAAG,qCAAqC,CAAC;AACzE,MAAM,2BAA2B,GAAG,sCAAsC,CAAC;AAC3E,MAAM,oCAAoC,GACtC,yCAAyC,CAAC;AAC9C,MAAM,6BAA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zB,EAAE,EAAE,mBAAmB;EACvB,GAAG,EAAE,mBAAmB;EACxB,MAAM,EAAE,mBAAmB;;EAG3B,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;;EAGf,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,IAAI,EAAE,UAAU;EAChB,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;EACf,GAAG,EAAE,UAAU;;EAGf,GAAG,EAAE,eAAe;EACpB,IAAI,EAAE,eAAe;EACrB,GAAG,EAAE,eAAe;;EAGpB,IAAI,EAAE,MAAM;EACZ,IAAI,EAAE,SAAS;EACf,GAAG,EAAE,SAAS;EACd,EAAE,EAAE,SAAS;EACb,GAAG,EAAE,SAAS;CACjB,CAAC;AAEF;;;;;;;;;SASgB,cAAc,CAAC,SAAiB;EAC5C,OAAO,iBAAiB,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,IAAI,YAAY,CAAC;AACtE;;;;;;","names":[],"sources":["./src/components/file/icon-background-colors.ts","./src/components/file/icon-fill-colors.ts","./src/components/file/icons.ts"],"sourcesContent":["const DEFAULT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst CALENDAR_ICON_BACKGROUND_COLOR = 'rgba(var(--color-cyan-lighter), 0.4)';\nconst EMAIL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-gray-lighter), 0.4)';\nconst HTML_ICON_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst TEXT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst EXCEL_ICON_BACKGROUND_COLOR = 'rgba(var(--color-green-lighter), 0.4)';\nconst POWERPOINT_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-coral-lighter), 0.4)';\nconst WORD_ICON_BACKGROUND_COLOR = 'rgba(var(--color-sky-lighter), 0.4)';\nconst IMAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-lime-lighter), 0.4)';\nconst VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-magenta-lighter), 0.4)';\nconst PRESENTATION_BACKGROUND_COLOR = 'rgba(var(--color-blue-lighter), 0.4)';\nconst DOCUMENT_ICON_BACKGROUND_COLOR = 'rgba(var(--color-orange-lighter), 0.4)';\nconst SPREADSHEET_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-green-lighter), 0.4)';\nconst AUDIO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-indigo-lighter), 0.4)';\nconst VIDEO_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst COMPRESSED_ICON_BACKGROUND_COLOR =\n 'rgba(var(--color-orange-lighter), 0.4)';\nconst MESSAGE_ICON_BACKGROUND_COLOR = 'rgba(var(--color-yellow-lighter), 0.4)';\nconst PDF_ICON_BACKGROUND_COLOR = 'rgba(var(--color-red-lighter), 0.4)';\nconst DATA_ICON_BACKGROUND_COLOR = 'rgba(var(--color-glaucous-lighter), 0.4)';\n\nconst filetypeBackgroundColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_BACKGROUND_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_BACKGROUND_COLOR,\n ical: CALENDAR_ICON_BACKGROUND_COLOR,\n icalendar: CALENDAR_ICON_BACKGROUND_COLOR,\n\n // Email\n ifb: CALENDAR_ICON_BACKGROUND_COLOR,\n email: EMAIL_ICON_BACKGROUND_COLOR,\n eml: EMAIL_ICON_BACKGROUND_COLOR,\n oft: EMAIL_ICON_BACKGROUND_COLOR,\n ost: EMAIL_ICON_BACKGROUND_COLOR,\n emlx: EMAIL_ICON_BACKGROUND_COLOR,\n\n // Web\n html: HTML_ICON_BACKGROUND_COLOR,\n xml: HTML_ICON_BACKGROUND_COLOR,\n\n // Editable text\n txt: TEXT_ICON_BACKGROUND_COLOR,\n rtf: TEXT_ICON_BACKGROUND_COLOR,\n\n // Editable document\n dot: WORD_ICON_BACKGROUND_COLOR,\n doc: WORD_ICON_BACKGROUND_COLOR,\n docx: WORD_ICON_BACKGROUND_COLOR,\n dotx: WORD_ICON_BACKGROUND_COLOR,\n docm: WORD_ICON_BACKGROUND_COLOR,\n dotm: WORD_ICON_BACKGROUND_COLOR,\n odt: DOCUMENT_ICON_BACKGROUND_COLOR,\n pages: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Portable document\n pdf: PDF_ICON_BACKGROUND_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_BACKGROUND_COLOR,\n pot: POWERPOINT_ICON_BACKGROUND_COLOR,\n pps: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptx: POWERPOINT_ICON_BACKGROUND_COLOR,\n pptm: POWERPOINT_ICON_BACKGROUND_COLOR,\n potx: POWERPOINT_ICON_BACKGROUND_COLOR,\n potm: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppam: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsx: POWERPOINT_ICON_BACKGROUND_COLOR,\n ppsm: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldx: POWERPOINT_ICON_BACKGROUND_COLOR,\n sldm: POWERPOINT_ICON_BACKGROUND_COLOR,\n odp: PRESENTATION_BACKGROUND_COLOR,\n key: PRESENTATION_BACKGROUND_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_BACKGROUND_COLOR,\n xlsx: EXCEL_ICON_BACKGROUND_COLOR,\n csv: DEFAULT_ICON_BACKGROUND_COLOR,\n numbers: SPREADSHEET_ICON_BACKGROUND_COLOR,\n\n // Image\n bmp: IMAGE_ICON_BACKGROUND_COLOR,\n jpg: IMAGE_ICON_BACKGROUND_COLOR,\n jpeg: IMAGE_ICON_BACKGROUND_COLOR,\n heic: IMAGE_ICON_BACKGROUND_COLOR,\n png: IMAGE_ICON_BACKGROUND_COLOR,\n gif: IMAGE_ICON_BACKGROUND_COLOR,\n\n // Editable image\n psd: PRESENTATION_BACKGROUND_COLOR,\n ai: DOCUMENT_ICON_BACKGROUND_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n svgz: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n ep: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n eps: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n sketch: VECTOR_GRAPHIC_ICON_BACKGROUND_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_BACKGROUND_COLOR,\n wav: AUDIO_ICON_BACKGROUND_COLOR,\n wma: AUDIO_ICON_BACKGROUND_COLOR,\n ogg: AUDIO_ICON_BACKGROUND_COLOR,\n\n // Video\n flv: VIDEO_ICON_BACKGROUND_COLOR,\n h264: VIDEO_ICON_BACKGROUND_COLOR,\n mov: VIDEO_ICON_BACKGROUND_COLOR,\n mp4: VIDEO_ICON_BACKGROUND_COLOR,\n mwv: VIDEO_ICON_BACKGROUND_COLOR,\n\n // Compressed:\n zip: COMPRESSED_ICON_BACKGROUND_COLOR,\n '7z': COMPRESSED_ICON_BACKGROUND_COLOR,\n rar: COMPRESSED_ICON_BACKGROUND_COLOR,\n\n // Data\n json: DATA_ICON_BACKGROUND_COLOR,\n yaml: DATA_ICON_BACKGROUND_COLOR,\n sql: DATA_ICON_BACKGROUND_COLOR,\n db: DATA_ICON_BACKGROUND_COLOR,\n dbf: DATA_ICON_BACKGROUND_COLOR,\n};\n\n/**\n * Takes a file extension as argument and returns the background color to use.\n * While some file types have a fairly universally accepted icon color, like\n * blue for Word documents, others are more arbitrary. This function provides\n * a convention that we use at Lime. If you are using this code in your own\n * project, you may or may not find this helper useful.\n *\n * @param extension - The file extension (without the dot).\n * @returns The color to use for the icon.\n * @public\n */\nexport function getIconBackgroundColorForFile(extension: string): string {\n return (\n filetypeBackgroundColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_BACKGROUND_COLOR\n );\n}\n","const DEFAULT_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst CALENDAR_ICON_FILL_COLOR = 'rgb(var(--color-cyan-dark))';\nconst EMAIL_ICON_FILL_COLOR = 'rgb(var(--color-gray-dark))';\nconst HTML_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst TEXT_ICON_FILL_COLOR = 'rgb(var(--color-yellow-darker))';\nconst EXCEL_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst POWERPOINT_ICON_FILL_COLOR = 'rgb(var(--color-coral-dark))';\nconst WORD_ICON_FILL_COLOR = 'rgb(var(--color-sky-dark))';\nconst IMAGE_ICON_FILL_COLOR = 'rgb(var(--color-lime-dark))';\nconst VECTOR_GRAPHIC_FILL_COLOR = 'rgb(var(--color-magenta-dark))';\nconst PRESENTATION_ICON_FILL_COLOR = 'rgb(var(--color-blue-dark))';\nconst DOCUMENT_ICON_FILL_COLOR = 'rgb(var(--color-orange-dark))';\nconst SPREADSHEET_ICON_FILL_COLOR = 'rgb(var(--color-green-dark))';\nconst AUDIO_ICON_FILL_COLOR = 'rgb(var(--color-indigo-dark))';\nconst VIDEO_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst COMPRESSED_ICON_FILL_COLOR = 'rgb(var(--color-brown-default))';\nconst MESSAGE_ICON_FILL_COLOR = 'rgb(var(--color-yellow-dark))';\nconst PDF_ICON_FILL_COLOR = 'rgb(var(--color-red-dark))';\nconst DATA_ICON_FILL_COLOR = 'rgb(var(--color-glaucous-dark))';\n\nconst filetypeFillColorTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON_FILL_COLOR,\n\n // Calendar\n ics: CALENDAR_ICON_FILL_COLOR,\n ical: CALENDAR_ICON_FILL_COLOR,\n icalendar: CALENDAR_ICON_FILL_COLOR,\n ifb: CALENDAR_ICON_FILL_COLOR,\n\n // Email\n email: EMAIL_ICON_FILL_COLOR,\n eml: EMAIL_ICON_FILL_COLOR,\n oft: EMAIL_ICON_FILL_COLOR,\n ost: EMAIL_ICON_FILL_COLOR,\n emlx: EMAIL_ICON_FILL_COLOR,\n\n // Web\n html: HTML_ICON_FILL_COLOR,\n xml: HTML_ICON_FILL_COLOR,\n\n // Editable text\n txt: TEXT_ICON_FILL_COLOR,\n rtf: TEXT_ICON_FILL_COLOR,\n\n // Editable document\n dot: WORD_ICON_FILL_COLOR,\n doc: WORD_ICON_FILL_COLOR,\n docx: WORD_ICON_FILL_COLOR,\n dotx: WORD_ICON_FILL_COLOR,\n docm: WORD_ICON_FILL_COLOR,\n dotm: WORD_ICON_FILL_COLOR,\n odt: DOCUMENT_ICON_FILL_COLOR,\n pages: DOCUMENT_ICON_FILL_COLOR,\n\n // Portable document\n pdf: PDF_ICON_FILL_COLOR,\n\n // Presentation\n ppt: POWERPOINT_ICON_FILL_COLOR,\n pot: POWERPOINT_ICON_FILL_COLOR,\n pps: POWERPOINT_ICON_FILL_COLOR,\n pptx: POWERPOINT_ICON_FILL_COLOR,\n pptm: POWERPOINT_ICON_FILL_COLOR,\n potx: POWERPOINT_ICON_FILL_COLOR,\n potm: POWERPOINT_ICON_FILL_COLOR,\n ppam: POWERPOINT_ICON_FILL_COLOR,\n ppsx: POWERPOINT_ICON_FILL_COLOR,\n ppsm: POWERPOINT_ICON_FILL_COLOR,\n sldx: POWERPOINT_ICON_FILL_COLOR,\n sldm: POWERPOINT_ICON_FILL_COLOR,\n odp: PRESENTATION_ICON_FILL_COLOR,\n key: PRESENTATION_ICON_FILL_COLOR,\n\n // Spreadsheet\n xls: EXCEL_ICON_FILL_COLOR,\n xlsx: EXCEL_ICON_FILL_COLOR,\n csv: DEFAULT_ICON_FILL_COLOR,\n numbers: SPREADSHEET_ICON_FILL_COLOR,\n\n // Image\n bmp: IMAGE_ICON_FILL_COLOR,\n jpg: IMAGE_ICON_FILL_COLOR,\n jpeg: IMAGE_ICON_FILL_COLOR,\n heic: IMAGE_ICON_FILL_COLOR,\n png: IMAGE_ICON_FILL_COLOR,\n gif: IMAGE_ICON_FILL_COLOR,\n\n // Editable image\n psd: PRESENTATION_ICON_FILL_COLOR,\n ai: DOCUMENT_ICON_FILL_COLOR,\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_FILL_COLOR,\n svgz: VECTOR_GRAPHIC_FILL_COLOR,\n ep: VECTOR_GRAPHIC_FILL_COLOR,\n eps: VECTOR_GRAPHIC_FILL_COLOR,\n sketch: VECTOR_GRAPHIC_FILL_COLOR,\n\n // Audio\n mp3: AUDIO_ICON_FILL_COLOR,\n wav: AUDIO_ICON_FILL_COLOR,\n wma: AUDIO_ICON_FILL_COLOR,\n ogg: AUDIO_ICON_FILL_COLOR,\n\n // Video\n flv: VIDEO_ICON_FILL_COLOR,\n h264: VIDEO_ICON_FILL_COLOR,\n mov: VIDEO_ICON_FILL_COLOR,\n mp4: VIDEO_ICON_FILL_COLOR,\n mwv: VIDEO_ICON_FILL_COLOR,\n\n // Compressed\n zip: COMPRESSED_ICON_FILL_COLOR,\n '7z': COMPRESSED_ICON_FILL_COLOR,\n rar: COMPRESSED_ICON_FILL_COLOR,\n\n // Data\n json: DATA_ICON_FILL_COLOR,\n yaml: DATA_ICON_FILL_COLOR,\n sql: DATA_ICON_FILL_COLOR,\n db: DATA_ICON_FILL_COLOR,\n dbf: DATA_ICON_FILL_COLOR,\n};\n\n/**\n * Takes a file extension as argument and returns the fill color to use.\n * While some file types have a fairly universally accepted icon color, like\n * blue for Word documents, others are more arbitrary. This function provides\n * a convention that we use at Lime. If you are using this code in your own\n * project, you may or may not find this helper useful.\n *\n * @param extension - The file extension (without the dot).\n * @returns The color to use for the icon.\n * @public\n */\nexport function getIconFillColorForFile(extension: string): string {\n return (\n filetypeFillColorTable[extension.toLowerCase()] ||\n DEFAULT_ICON_FILL_COLOR\n );\n}\n","const DEFAULT_ICON = 'file';\nconst CALENDAR_ICON = 'tear_off_calendar';\nconst EMAIL_ICON = 'email';\nconst HTML_ICON = 'internet';\nconst TEXT_ICON = 'text_box';\nconst EXCEL_ICON = 'ms_excel_copyrighted';\nconst WORD_ICON = 'ms_word_copyrighted';\nconst POWERPOINT_ICON = 'ms_powerpoint_copyrighted';\nconst IMAGE_ICON = 'picture';\nconst PHOTO_ICON = 'camera';\nconst VECTOR_GRAPHIC_ICON = 'vector';\nconst PRESENTATION_ICON = 'presentation_filled';\nconst DOCUMENT_ICON = 'overview_pages_2';\nconst SPREADSHEET_ICON = 'data_sheet';\nconst AUDIO_ICON = 'audio_wave';\nconst VIDEO_ICON = 'video_file';\nconst COMPRESSED_ICON = 'condom_package';\nconst MESSAGE_ICON = 'ms_outlook_copyrighted';\nconst DATA_ICON = 'database';\n\nconst filetypeIconTable: Record<string, string> = {\n // Message\n msg: MESSAGE_ICON,\n\n // Calendar\n ics: CALENDAR_ICON,\n ical: CALENDAR_ICON,\n icalendar: CALENDAR_ICON,\n ifb: CALENDAR_ICON,\n\n // Email\n email: EMAIL_ICON,\n eml: EMAIL_ICON,\n oft: EMAIL_ICON,\n ost: EMAIL_ICON,\n emlx: EMAIL_ICON,\n\n // Web\n html: HTML_ICON,\n xml: HTML_ICON,\n\n // Editable text\n txt: TEXT_ICON,\n rtf: TEXT_ICON,\n\n // Editable document\n dot: WORD_ICON,\n doc: WORD_ICON,\n docx: WORD_ICON,\n dotx: WORD_ICON,\n docm: WORD_ICON,\n dotm: WORD_ICON,\n odt: DOCUMENT_ICON,\n pages: DOCUMENT_ICON,\n\n // Portable document\n pdf: 'PDF_2',\n\n // Presentation\n ppt: POWERPOINT_ICON,\n pot: POWERPOINT_ICON,\n pps: POWERPOINT_ICON,\n pptx: POWERPOINT_ICON,\n pptm: POWERPOINT_ICON,\n potx: POWERPOINT_ICON,\n potm: POWERPOINT_ICON,\n ppam: POWERPOINT_ICON,\n ppsx: POWERPOINT_ICON,\n ppsm: POWERPOINT_ICON,\n sldx: POWERPOINT_ICON,\n sldm: POWERPOINT_ICON,\n odp: PRESENTATION_ICON,\n key: PRESENTATION_ICON,\n\n // Spreadsheet\n xls: EXCEL_ICON,\n xlsx: EXCEL_ICON,\n csv: SPREADSHEET_ICON,\n numbers: SPREADSHEET_ICON,\n\n // Image\n jpg: PHOTO_ICON,\n jpeg: PHOTO_ICON,\n heic: PHOTO_ICON,\n bmp: IMAGE_ICON,\n png: IMAGE_ICON,\n gif: IMAGE_ICON,\n\n // Editable image\n psd: 'adobe_photoshop_copyrighted',\n ai: 'adobe_illustrator_copyrighted',\n\n // Vector graphic\n svg: VECTOR_GRAPHIC_ICON,\n svgz: VECTOR_GRAPHIC_ICON,\n ep: VECTOR_GRAPHIC_ICON,\n eps: VECTOR_GRAPHIC_ICON,\n sketch: VECTOR_GRAPHIC_ICON,\n\n // Audio\n mp3: AUDIO_ICON,\n wav: AUDIO_ICON,\n wma: AUDIO_ICON,\n ogg: AUDIO_ICON,\n\n // Video\n avi: VIDEO_ICON,\n flv: VIDEO_ICON,\n h264: VIDEO_ICON,\n mov: VIDEO_ICON,\n mp4: VIDEO_ICON,\n mwv: VIDEO_ICON,\n\n // Compressed\n zip: COMPRESSED_ICON,\n '7z': COMPRESSED_ICON,\n rar: COMPRESSED_ICON,\n\n // Data\n json: 'json',\n yaml: DATA_ICON,\n sql: DATA_ICON,\n db: DATA_ICON,\n dbf: DATA_ICON,\n};\n\n/**\n * Takes a file extension as argument and returns the corresponding icon name.\n * Uses the names from the private icon package `lime-icons8`. If you are using\n * a different icon package, this functions is probably not useful for you.\n *\n * @param extension - The file extension (without the dot).\n * @returns The name of the icon to use.\n * @public\n */\nexport function getIconForFile(extension: string): string {\n return filetypeIconTable[extension.toLowerCase()] || DEFAULT_ICON;\n}\n"],"version":3}
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const icons = require('./icons-8ecb9740.js');
6
+
5
7
  /**
6
8
  * Represents the layout types for a form.
7
9
  * @public
@@ -54,4 +56,8 @@ exports.ColumnAggregatorType = void 0;
54
56
  ColumnAggregatorType["Count"] = "count";
55
57
  })(exports.ColumnAggregatorType || (exports.ColumnAggregatorType = {}));
56
58
 
59
+ exports.getIconBackgroundColorForFile = icons.getIconBackgroundColorForFile;
60
+ exports.getIconFillColorForFile = icons.getIconFillColorForFile;
61
+ exports.getIconForFile = icons.getIconForFile;
62
+
57
63
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"file":"index.cjs.js","mappings":";;;;AAwSA;;;;AAIYA;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBWA,sBAAc,KAAdA,sBAAc;;ACvJ1B;;;;AAIYC;AAAZ,WAAY,oBAAoB;;;;EAI5B,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,mCAAW,CAAA;;;;EAKX,uCAAe,CAAA;AACnB,CAAC,EAzBWA,4BAAoB,KAApBA,4BAAoB;;","names":["FormLayoutType","ColumnAggregatorType"],"sources":["./src/components/form/form.types.ts","./src/components/table/table.types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * Options for a layout to be used in a form\n * @public\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * Layout options for a grid layout\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * Layout options for a row layout\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * Represents the layout types for a form.\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * Represents the JSON schema with Lime specific options\n * @public\n */\nexport interface FormSchema<T extends Record<string, any> = any>\n extends JSONSchema7 {\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.1\n */\n items?: FormSchemaArrayItem<T> | Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.2\n */\n additionalItems?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against \"contains\" if at least one of its\n * elements is valid against the given schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.6\n */\n contains?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array,\n * if any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.3\n */\n required?: Array<ReplaceObjectType<T, Extract<keyof T, string>, string>>;\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this\n * object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation succeeds if, for each name that appears in both the\n * instance and as a name within this keyword's value, the child\n * instance for that name successfully validates against the\n * corresponding schema.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.4\n */\n properties?: ReplaceObjectType<\n T,\n FormSubKeySchema<T>,\n Record<string, FormSchema>\n >;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against all schemas defined by this keyword's\n * value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.1\n */\n allOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against at least one schema defined by this\n * keyword's value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.2\n */\n anyOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against exactly one schema defined by this\n * keyword's value.\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.3\n */\n oneOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"patternProperties\" MUST be an object. Each property\n * name of this object SHOULD be a valid regular expression, according\n * to the ECMA 262 regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself. Validation\n * of the primitive instance type against this keyword always succeeds.\n *\n * Validation succeeds if, for each instance name that matches any\n * regular expressions that appear as a property name in this keyword's\n * value, the child instance for that name successfully validates\n * against each schema that corresponds to a matching regular\n * expression.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.5\n */\n patternProperties?: Record<string, FormSchema>;\n\n /**\n * The value of \"additionalProperties\" MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation with \"additionalProperties\" applies only to the child\n * values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"additionalProperties\" schema.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.6\n */\n additionalProperties?: FormSchema | boolean;\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an\n * object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each property specifies a\n * dependency. Each dependency value MUST be an array or a valid JSON\n * Schema.\n *\n * If the dependency value is a subschema, and the dependency key is a\n * property in the instance, the entire instance must validate against\n * the dependency value.\n *\n * If the dependency value is an array, each element in the array, if\n * any, MUST be a string, and MUST be unique. If the dependency key is\n * a property in the instance, each of the items in the dependency value\n * must be a property that exists in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.7\n */\n dependencies?: Record<string, FormSchema | string[]>;\n\n /**\n * The value of \"propertyNames\" MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every\n * property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.8\n */\n propertyNames?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.1\n */\n if?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.2\n */\n then?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When \"if\" is present, and the instance fails to validate against its\n * subschema, then valiation succeeds against this keyword if the\n * instance successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when \"if\" is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST\n * NOT evaluate the instance against this keyword, for either validation\n * or annotation collection purposes, in such cases.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.3\n */\n else?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.4\n */\n not?: FormSchema;\n\n /**\n * The \"$defs\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n $defs?: Record<string, FormSchema>;\n\n /**\n * The \"definitions\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n definitions?: Record<string, FormSchema>;\n}\n\n/**\n * Utility type for replacing object types with a specified type\n * @public\n */\nexport type ReplaceObjectType<T, AllowedType, ElseType> = T extends any[]\n ? ElseType\n : T extends Record<string, any>\n ? AllowedType\n : ElseType;\n\n/**\n * Utility type for supporting nested sub items in arrays\n * @public\n */\nexport type FormSchemaArrayItem<T> = T extends any[]\n ? FormSchema<T[Extract<keyof T, number>]>\n : FormSchema;\n\n/**\n * Utility type for recursive properties in a schema\n * @public\n */\nexport type FormSubKeySchema<TObj> = Partial<{\n [Key in Extract<keyof TObj, any>]: FormSchema<TObj[Key]>;\n}>;\n","/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n"],"version":3}
1
+ {"file":"index.cjs.js","mappings":";;;;;;AAwSA;;;;AAIYA;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBWA,sBAAc,KAAdA,sBAAc;;ACvJ1B;;;;AAIYC;AAAZ,WAAY,oBAAoB;;;;EAI5B,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,mCAAW,CAAA;;;;EAKX,uCAAe,CAAA;AACnB,CAAC,EAzBWA,4BAAoB,KAApBA,4BAAoB;;;;;;","names":["FormLayoutType","ColumnAggregatorType"],"sources":["./src/components/form/form.types.ts","./src/components/table/table.types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * Options for a layout to be used in a form\n * @public\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * Layout options for a grid layout\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * Layout options for a row layout\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * Represents the layout types for a form.\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * Represents the JSON schema with Lime specific options\n * @public\n */\nexport interface FormSchema<T extends Record<string, any> = any>\n extends JSONSchema7 {\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.1\n */\n items?: FormSchemaArrayItem<T> | Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.2\n */\n additionalItems?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against \"contains\" if at least one of its\n * elements is valid against the given schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.6\n */\n contains?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array,\n * if any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.3\n */\n required?: Array<ReplaceObjectType<T, Extract<keyof T, string>, string>>;\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this\n * object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation succeeds if, for each name that appears in both the\n * instance and as a name within this keyword's value, the child\n * instance for that name successfully validates against the\n * corresponding schema.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.4\n */\n properties?: ReplaceObjectType<\n T,\n FormSubKeySchema<T>,\n Record<string, FormSchema>\n >;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against all schemas defined by this keyword's\n * value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.1\n */\n allOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against at least one schema defined by this\n * keyword's value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.2\n */\n anyOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against exactly one schema defined by this\n * keyword's value.\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.3\n */\n oneOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"patternProperties\" MUST be an object. Each property\n * name of this object SHOULD be a valid regular expression, according\n * to the ECMA 262 regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself. Validation\n * of the primitive instance type against this keyword always succeeds.\n *\n * Validation succeeds if, for each instance name that matches any\n * regular expressions that appear as a property name in this keyword's\n * value, the child instance for that name successfully validates\n * against each schema that corresponds to a matching regular\n * expression.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.5\n */\n patternProperties?: Record<string, FormSchema>;\n\n /**\n * The value of \"additionalProperties\" MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation with \"additionalProperties\" applies only to the child\n * values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"additionalProperties\" schema.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.6\n */\n additionalProperties?: FormSchema | boolean;\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an\n * object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each property specifies a\n * dependency. Each dependency value MUST be an array or a valid JSON\n * Schema.\n *\n * If the dependency value is a subschema, and the dependency key is a\n * property in the instance, the entire instance must validate against\n * the dependency value.\n *\n * If the dependency value is an array, each element in the array, if\n * any, MUST be a string, and MUST be unique. If the dependency key is\n * a property in the instance, each of the items in the dependency value\n * must be a property that exists in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.7\n */\n dependencies?: Record<string, FormSchema | string[]>;\n\n /**\n * The value of \"propertyNames\" MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every\n * property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.8\n */\n propertyNames?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.1\n */\n if?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.2\n */\n then?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When \"if\" is present, and the instance fails to validate against its\n * subschema, then valiation succeeds against this keyword if the\n * instance successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when \"if\" is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST\n * NOT evaluate the instance against this keyword, for either validation\n * or annotation collection purposes, in such cases.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.3\n */\n else?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.4\n */\n not?: FormSchema;\n\n /**\n * The \"$defs\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n $defs?: Record<string, FormSchema>;\n\n /**\n * The \"definitions\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n definitions?: Record<string, FormSchema>;\n}\n\n/**\n * Utility type for replacing object types with a specified type\n * @public\n */\nexport type ReplaceObjectType<T, AllowedType, ElseType> = T extends any[]\n ? ElseType\n : T extends Record<string, any>\n ? AllowedType\n : ElseType;\n\n/**\n * Utility type for supporting nested sub items in arrays\n * @public\n */\nexport type FormSchemaArrayItem<T> = T extends any[]\n ? FormSchema<T[Extract<keyof T, number>]>\n : FormSchema;\n\n/**\n * Utility type for recursive properties in a schema\n * @public\n */\nexport type FormSubKeySchema<TObj> = Partial<{\n [Key in Extract<keyof TObj, any>]: FormSchema<TObj[Key]>;\n}>;\n","/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n"],"version":3}
@@ -3,12 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d1052409.js');
6
- const fileMetadata = require('./file-metadata-f259bba5.js');
6
+ const fileMetadata = require('./file-metadata-062e1135.js');
7
7
  const _baseForOwn = require('./_baseForOwn-fc9c8906.js');
8
8
  const isArrayLike = require('./isArrayLike-ac53bdac.js');
9
9
  const _baseIteratee = require('./_baseIteratee-5f8a72f6.js');
10
10
  const isArray = require('./isArray-d188a04f.js');
11
11
  const randomString = require('./random-string-c8445652.js');
12
+ require('./icons-8ecb9740.js');
12
13
  require('./get-icon-props-50be7440.js');
13
14
  require('./_baseIsEqual-2b4442b5.js');
14
15
  require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,EAAE,IAAI,CAAC,gBAAgB,EAC/B,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACzB,EACFA,qBAAQ,CACL,EACT;GACL;EAwBO,aAAa,CAAC,KAAoB;IACtC,IACI,KAAK,CAAC,IAAI,KAAK,KAAK;MACpB,KAAK,CAAC,IAAI,KAAK,WAAW;MAC1B,KAAK,CAAC,IAAI,KAAK,OAAO,EACxB;MACE,OAAO;KACV;IAED,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;GAC3B;EAEO,iBAAiB;IACrB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;GAC1B;;;;;;;","names":["isArrayLike","baseForOwn","isArray","baseIteratee","getFileIcon","getFileExtensionTitle","getFileColor","getFileBackgroundColor","h","Host","createRandomString"],"sources":["./node_modules/lodash-es/_arrayAggregator.js","./node_modules/lodash-es/_createBaseEach.js","./node_modules/lodash-es/_baseEach.js","./node_modules/lodash-es/_baseAggregator.js","./node_modules/lodash-es/_createAggregator.js","./node_modules/lodash-es/partition.js","./src/util/files.ts","./src/components/file-dropzone/file-dropzone.scss?tag=limel-file-dropzone&encapsulation=shadow","./src/components/file-dropzone/file-dropzone.tsx","./src/components/file-input/file-input.tsx"],"sourcesContent":["/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n","import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n","import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n","import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n","import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n","import createAggregator from './_createAggregator.js';\n\n/**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\nvar partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n}, function() { return [[], []]; });\n\nexport default partition;\n","import { FileInfo } from '../global/shared-types/file.types';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nexport function createFileInfo(file: File): FileInfo {\n const limeFile: FileInfo = {\n id: crypto.randomUUID(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n limeFile.icon = {\n name: getFileIcon(limeFile),\n title: getFileExtensionTitle(limeFile),\n color: getFileColor(limeFile),\n backgroundColor: getFileBackgroundColor(limeFile),\n };\n\n return limeFile;\n}\n\nexport function isTypeAccepted(file: FileInfo, accept?: string): boolean {\n if (accept === undefined || accept === '*') {\n return true;\n }\n\n const acceptList = accept.split(',').map((raw) => raw.trim());\n\n return acceptList.some((acceptedType: string) => {\n if (acceptedType === file.contentType) {\n return true;\n }\n\n if (acceptedType.endsWith('/*')) {\n const baseType = acceptedType.split('/')[0];\n\n return file.contentType.startsWith(`${baseType}/`);\n }\n\n if (acceptedType.startsWith('.')) {\n const fileType = acceptedType.split('.')[1];\n\n return file.contentType.endsWith(`/${fileType}`);\n }\n });\n}\n",":host(limel-file-dropzone) {\n display: block;\n position: relative;\n}\n\n.has-file-to-drop {\n animation: display-drop-zone 0.6s ease forwards;\n\n box-sizing: border-box;\n isolation: isolate;\n z-index: 1;\n position: absolute;\n inset: 0.25rem;\n\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0.5rem;\n\n color: rgb(var(--contrast-700));\n\n border: 0.125rem dashed rgb(var(--color-cyan-light));\n border-radius: 0.75rem;\n}\n\n.text-helpertext {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n}\n\n.icon {\n width: clamp(2rem, 5vh, 7rem);\n}\n\n.text {\n font-size: clamp(1rem, 2vh, 1.75rem);\n}\n\n.helper-text {\n font-size: clamp(0.75rem, 1.5vh, 1rem);\n}\n\n@keyframes display-drop-zone {\n 0% {\n background-color: rgb(var(--contrast-1100), 0);\n backdrop-filter: blur(0);\n -webkit-backdrop-filter: blur(0);\n scale: 0.9;\n opacity: 0;\n }\n\n 50% {\n scale: 1;\n opacity: 1;\n }\n\n 100% {\n background-color: rgb(var(--contrast-1100), 0.8);\n backdrop-filter: blur(0.25rem);\n -webkit-backdrop-filter: blur(0.25rem);\n }\n}\n","import {\n Component,\n h,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo, isTypeAccepted } from '../../util/files';\nimport { partition } from 'lodash-es';\n\n/**\n * This component enables you to seamlessly convert any region of the user interface into\n * a file dropzone area, just by wrapping it inside the `limel-file-dropzone`.\n *\n * The file dropzone can then be used to allow end-users to upload files\n * by dragging and dropping them into the specified area, for example to trigger an upload process.\n *\n * After receiving the files, the component emits a `filesSelected` event. For unsupported\n * files (specified with the `accept` prop) a `filesRejected` event will be emitted.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-dropzone\n * @exampleComponent limel-example-file-dropzone-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-dropzone',\n shadow: true,\n styleUrl: 'file-dropzone.scss',\n})\nexport class FileDropzone {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable the file dropzone.\n */\n @Prop()\n public disabled: boolean = false;\n\n /**\n * Is displayed when the user is dragging a file over the dropzone.\n * A suitable text could for instance be \"Drop your files here\".\n */\n @Prop()\n public text: string;\n\n /**\n * Is displayed to provide supplementary information to the end users,\n * for instance, which filetypes or file sizes are accepted.\n */\n @Prop()\n public helperText?: string = '';\n\n /**\n * Sets to true when there is a file to drop\n */\n @State()\n private hasFileToDrop: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n /**\n * Emitted when files are selected but do not conform with the `accept` property specifications.\n * This can happen when the file types or formats of the selected files are not among the ones allowed by the dropzone,\n * as defined by the `accept` property.\n *\n * @see `accept` for details on how to specify acceptable file types.\n */\n @Event()\n filesRejected: EventEmitter<FileInfo[]>;\n\n public render() {\n return (\n <Host\n onDrop={this.handleDrop}\n onDragOver={this.handleDragOver}\n onDragLeave={this.handleDragLeave}\n >\n <slot />\n {this.renderOnDragLayout()}\n </Host>\n );\n }\n\n private renderOnDragLayout = () => {\n if (this.disabled || !this.hasFileToDrop) {\n return;\n }\n\n return (\n <div class=\"has-file-to-drop\">\n <limel-icon class=\"icon\" name=\"upload_2\" />\n <div class=\"text-helpertext\">\n {this.renderText()}\n {this.renderHelperText()}\n </div>\n </div>\n );\n };\n\n private renderText = () => {\n if (!this.text) {\n return;\n }\n\n return <span class=\"text\">{this.text}</span>;\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return <span class=\"helper-text\">{this.helperText}</span>;\n };\n\n private handleDrop = (event: DragEvent) => {\n event.stopPropagation();\n event.preventDefault();\n this.hasFileToDrop = false;\n\n if (this.disabled) {\n return;\n }\n\n const files: File[] = Array.from(event.dataTransfer.files);\n const fileInfos: FileInfo[] = files.map(createFileInfo);\n\n const [acceptedFileInfos, rejectedFileInfos] = partition(\n fileInfos,\n (file) => isTypeAccepted(file, this.accept),\n );\n\n if (acceptedFileInfos.length > 0) {\n this.filesSelected.emit(acceptedFileInfos);\n }\n\n if (rejectedFileInfos.length > 0) {\n this.filesRejected.emit(rejectedFileInfos);\n }\n };\n\n private handleDragOver = (event: DragEvent) => {\n this.hasFileToDrop = true;\n event.preventDefault();\n };\n\n private handleDragLeave = (event: DragEvent) => {\n this.hasFileToDrop = false;\n event.preventDefault();\n };\n}\n","import {\n h,\n Event,\n EventEmitter,\n Host,\n Component,\n Element,\n Prop,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo } from '../../util/files';\n\n/**\n * This component enables you to seamlessly transform any other clickable component that\n * generates a `click` event into a file input selector.\n *\n * To use it, just wrap any clickable component inside the `limel-file-input` component.\n * Upon reception of the `click` event this component will open the native file selection\n * dialog.\n *\n * After receiving the files, the component emits a `filesSelected` event.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-input\n * @exampleComponent limel-example-file-input-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-input',\n shadow: true,\n})\nexport class FileInput {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable file input selection.\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to enable selection of multiple files\n */\n @Prop({ reflect: true })\n public multiple: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n @Element()\n private element: HTMLLimelFileElement;\n\n private fileInput: HTMLInputElement;\n private fileInputId = createRandomString();\n\n public componentDidLoad() {\n this.fileInput = this.element.shadowRoot.getElementById(\n this.fileInputId,\n ) as HTMLInputElement;\n }\n\n public render() {\n return (\n <Host\n onClick={this.handleClick}\n onKeyUp={this.handleKeyUp}\n onKeyDown={this.handleKeyDown}\n >\n <input\n hidden={true}\n id={this.fileInputId}\n onChange={this.handleFileChange}\n type=\"file\"\n accept={this.accept}\n disabled={this.disabled}\n multiple={this.multiple}\n />\n <slot />\n </Host>\n );\n }\n\n private handleClick = (event: Event) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n\n return;\n }\n\n this.triggerFileDialog();\n\n event.stopPropagation();\n };\n\n private handleKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n if (event.code === 'Enter') {\n this.triggerFileDialog();\n }\n };\n\n private handleKeyDown(event: KeyboardEvent) {\n if (\n event.code === 'Tab' ||\n event.code === 'Backspace' ||\n event.code === 'Enter'\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private triggerFileDialog() {\n this.fileInput.click();\n }\n\n private handleFileChange = (event: Event) => {\n const files = Array.from(this.fileInput.files);\n if (files.length > 0) {\n event.stopPropagation();\n this.filesSelected.emit(files.map(createFileInfo));\n this.fileInput.value = '';\n }\n };\n}\n"],"version":3}
1
+ {"file":"limel-file-dropzone.limel-file-input.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC/D,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;AAChD;AACA,EAAE,OAAO,EAAE,KAAK,GAAG,MAAM,EAAE;AAC3B,IAAI,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACvD,GAAG;AACH,EAAE,OAAO,WAAW,CAAC;AACrB;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE;AAC7C,EAAE,OAAO,SAAS,UAAU,EAAE,QAAQ,EAAE;AACxC,IAAI,IAAI,UAAU,IAAI,IAAI,EAAE;AAC5B,MAAM,OAAO,UAAU,CAAC;AACxB,KAAK;AACL,IAAI,IAAI,CAACA,uBAAW,CAAC,UAAU,CAAC,EAAE;AAClC,MAAM,OAAO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,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CACnD,IAAI,CAAC,WAAW,CACC,CAAC;GACzB;EAEM,MAAM;IACT,QACIF,QAACC,UAAI,IACD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,IAE7BD,mBACI,MAAM,EAAE,IAAI,EACZ,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAC/B,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACzB,EACFA,qBAAQ,CACL,EACT;GACL;EAwBO,aAAa,CAAC,KAAoB;IACtC,IACI,KAAK,CAAC,IAAI,KAAK,KAAK;MACpB,KAAK,CAAC,IAAI,KAAK,WAAW;MAC1B,KAAK,CAAC,IAAI,KAAK,OAAO,EACxB;MACE,OAAO;KACV;IAED,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;GAC3B;EAEO,iBAAiB;IACrB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;GAC1B;;;;;;;","names":["isArrayLike","baseForOwn","isArray","baseIteratee","getFileIcon","getFileExtensionTitle","getFileColor","getFileBackgroundColor","h","Host","createRandomString"],"sources":["./node_modules/lodash-es/_arrayAggregator.js","./node_modules/lodash-es/_createBaseEach.js","./node_modules/lodash-es/_baseEach.js","./node_modules/lodash-es/_baseAggregator.js","./node_modules/lodash-es/_createAggregator.js","./node_modules/lodash-es/partition.js","./src/util/files.ts","./src/components/file-dropzone/file-dropzone.scss?tag=limel-file-dropzone&encapsulation=shadow","./src/components/file-dropzone/file-dropzone.tsx","./src/components/file-input/file-input.tsx"],"sourcesContent":["/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n","import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n","import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n","import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n","import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n","import createAggregator from './_createAggregator.js';\n\n/**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\nvar partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n}, function() { return [[], []]; });\n\nexport default partition;\n","import { FileInfo } from '../global/shared-types/file.types';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nexport function createFileInfo(file: File): FileInfo {\n const limeFile: FileInfo = {\n id: crypto.randomUUID(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n limeFile.icon = {\n name: getFileIcon(limeFile),\n title: getFileExtensionTitle(limeFile),\n color: getFileColor(limeFile),\n backgroundColor: getFileBackgroundColor(limeFile),\n };\n\n return limeFile;\n}\n\nexport function isTypeAccepted(file: FileInfo, accept?: string): boolean {\n if (accept === undefined || accept === '*') {\n return true;\n }\n\n const acceptList = accept.split(',').map((raw) => raw.trim());\n\n return acceptList.some((acceptedType: string) => {\n if (acceptedType === file.contentType) {\n return true;\n }\n\n if (acceptedType.endsWith('/*')) {\n const baseType = acceptedType.split('/')[0];\n\n return file.contentType.startsWith(`${baseType}/`);\n }\n\n if (acceptedType.startsWith('.')) {\n const fileType = acceptedType.split('.')[1];\n\n return file.contentType.endsWith(`/${fileType}`);\n }\n });\n}\n",":host(limel-file-dropzone) {\n display: block;\n position: relative;\n}\n\n.has-file-to-drop {\n animation: display-drop-zone 0.6s ease forwards;\n\n box-sizing: border-box;\n isolation: isolate;\n z-index: 1;\n position: absolute;\n inset: 0.25rem;\n\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0.5rem;\n\n color: rgb(var(--contrast-700));\n\n border: 0.125rem dashed rgb(var(--color-cyan-light));\n border-radius: 0.75rem;\n}\n\n.text-helpertext {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n}\n\n.icon {\n width: clamp(2rem, 5vh, 7rem);\n}\n\n.text {\n font-size: clamp(1rem, 2vh, 1.75rem);\n}\n\n.helper-text {\n font-size: clamp(0.75rem, 1.5vh, 1rem);\n}\n\n@keyframes display-drop-zone {\n 0% {\n background-color: rgb(var(--contrast-1100), 0);\n backdrop-filter: blur(0);\n -webkit-backdrop-filter: blur(0);\n scale: 0.9;\n opacity: 0;\n }\n\n 50% {\n scale: 1;\n opacity: 1;\n }\n\n 100% {\n background-color: rgb(var(--contrast-1100), 0.8);\n backdrop-filter: blur(0.25rem);\n -webkit-backdrop-filter: blur(0.25rem);\n }\n}\n","import {\n Component,\n h,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo, isTypeAccepted } from '../../util/files';\nimport { partition } from 'lodash-es';\n\n/**\n * This component enables you to seamlessly convert any region of the user interface into\n * a file dropzone area, just by wrapping it inside the `limel-file-dropzone`.\n *\n * The file dropzone can then be used to allow end-users to upload files\n * by dragging and dropping them into the specified area, for example to trigger an upload process.\n *\n * After receiving the files, the component emits a `filesSelected` event. For unsupported\n * files (specified with the `accept` prop) a `filesRejected` event will be emitted.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-dropzone\n * @exampleComponent limel-example-file-dropzone-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-dropzone',\n shadow: true,\n styleUrl: 'file-dropzone.scss',\n})\nexport class FileDropzone {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable the file dropzone.\n */\n @Prop()\n public disabled: boolean = false;\n\n /**\n * Is displayed when the user is dragging a file over the dropzone.\n * A suitable text could for instance be \"Drop your files here\".\n */\n @Prop()\n public text: string;\n\n /**\n * Is displayed to provide supplementary information to the end users,\n * for instance, which filetypes or file sizes are accepted.\n */\n @Prop()\n public helperText?: string = '';\n\n /**\n * Sets to true when there is a file to drop\n */\n @State()\n private hasFileToDrop: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n /**\n * Emitted when files are selected but do not conform with the `accept` property specifications.\n * This can happen when the file types or formats of the selected files are not among the ones allowed by the dropzone,\n * as defined by the `accept` property.\n *\n * @see `accept` for details on how to specify acceptable file types.\n */\n @Event()\n filesRejected: EventEmitter<FileInfo[]>;\n\n public render() {\n return (\n <Host\n onDrop={this.handleDrop}\n onDragOver={this.handleDragOver}\n onDragLeave={this.handleDragLeave}\n >\n <slot />\n {this.renderOnDragLayout()}\n </Host>\n );\n }\n\n private renderOnDragLayout = () => {\n if (this.disabled || !this.hasFileToDrop) {\n return;\n }\n\n return (\n <div class=\"has-file-to-drop\">\n <limel-icon class=\"icon\" name=\"upload_2\" />\n <div class=\"text-helpertext\">\n {this.renderText()}\n {this.renderHelperText()}\n </div>\n </div>\n );\n };\n\n private renderText = () => {\n if (!this.text) {\n return;\n }\n\n return <span class=\"text\">{this.text}</span>;\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return <span class=\"helper-text\">{this.helperText}</span>;\n };\n\n private handleDrop = (event: DragEvent) => {\n event.stopPropagation();\n event.preventDefault();\n this.hasFileToDrop = false;\n\n if (this.disabled) {\n return;\n }\n\n const files: File[] = Array.from(event.dataTransfer.files);\n const fileInfos: FileInfo[] = files.map(createFileInfo);\n\n const [acceptedFileInfos, rejectedFileInfos] = partition(\n fileInfos,\n (file) => isTypeAccepted(file, this.accept),\n );\n\n if (acceptedFileInfos.length > 0) {\n this.filesSelected.emit(acceptedFileInfos);\n }\n\n if (rejectedFileInfos.length > 0) {\n this.filesRejected.emit(rejectedFileInfos);\n }\n };\n\n private handleDragOver = (event: DragEvent) => {\n this.hasFileToDrop = true;\n event.preventDefault();\n };\n\n private handleDragLeave = (event: DragEvent) => {\n this.hasFileToDrop = false;\n event.preventDefault();\n };\n}\n","import {\n h,\n Event,\n EventEmitter,\n Host,\n Component,\n Element,\n Prop,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo } from '../../util/files';\n\n/**\n * This component enables you to seamlessly transform any other clickable component that\n * generates a `click` event into a file input selector.\n *\n * To use it, just wrap any clickable component inside the `limel-file-input` component.\n * Upon reception of the `click` event this component will open the native file selection\n * dialog.\n *\n * After receiving the files, the component emits a `filesSelected` event.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-input\n * @exampleComponent limel-example-file-input-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-input',\n shadow: true,\n})\nexport class FileInput {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable file input selection.\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to enable selection of multiple files\n */\n @Prop({ reflect: true })\n public multiple: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n @Element()\n private element: HTMLLimelFileElement;\n\n private fileInput: HTMLInputElement;\n private fileInputId = createRandomString();\n\n public componentDidLoad() {\n this.fileInput = this.element.shadowRoot.getElementById(\n this.fileInputId,\n ) as HTMLInputElement;\n }\n\n public render() {\n return (\n <Host\n onClick={this.handleClick}\n onKeyUp={this.handleKeyUp}\n onKeyDown={this.handleKeyDown}\n >\n <input\n hidden={true}\n id={this.fileInputId}\n onChange={this.handleFileChange}\n type=\"file\"\n accept={this.accept}\n disabled={this.disabled}\n multiple={this.multiple}\n />\n <slot />\n </Host>\n );\n }\n\n private handleClick = (event: Event) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n\n return;\n }\n\n this.triggerFileDialog();\n\n event.stopPropagation();\n };\n\n private handleKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n if (event.code === 'Enter') {\n this.triggerFileDialog();\n }\n };\n\n private handleKeyDown(event: KeyboardEvent) {\n if (\n event.code === 'Tab' ||\n event.code === 'Backspace' ||\n event.code === 'Enter'\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private triggerFileDialog() {\n this.fileInput.click();\n }\n\n private handleFileChange = (event: Event) => {\n const files = Array.from(this.fileInput.files);\n if (files.length > 0) {\n event.stopPropagation();\n this.filesSelected.emit(files.map(createFileInfo));\n this.fileInput.value = '';\n }\n };\n}\n"],"version":3}
@@ -4,7 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d1052409.js');
6
6
  const translations = require('./translations-a384b596.js');
7
- const fileMetadata = require('./file-metadata-f259bba5.js');
7
+ const fileMetadata = require('./file-metadata-062e1135.js');
8
+ require('./icons-8ecb9740.js');
8
9
  require('./get-icon-props-50be7440.js');
9
10
 
10
11
  const fileCss = "";
@@ -1 +1 @@
1
- {"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,OAAO,GAAG,EAAE;;ACYlB,MAAM,iBAAiB,GAAS;EAC5B,EAAE,EAAE,IAAI;EACR,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,IAAI;CAClB,CAAC;MAyCW,IAAI;;;;;IA2EL,mBAAc,GAAG,CAAC,KAA8B;MACpD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;M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=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n","import translate from '../../global/translations';\nimport { Chip } from '../chip-set/chip.types';\nimport { Languages } from '../date-picker/date.types';\nimport { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from '../../util/file-metadata';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n *\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n public render() {\n return (\n <limel-file-dropzone\n disabled={this.disabled || this.readonly || !!this.value}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n >\n {this.renderChipset()}\n </limel-file-dropzone>\n );\n }\n\n private handleNewFiles = (event: CustomEvent<FileInfo[]>) => {\n this.preventAndStop(event);\n this.change.emit(event.detail[0]);\n };\n\n private getChipArray(): Chip[] {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: {\n name: getFileIcon(this.value),\n title: getFileExtensionTitle(this.value),\n color: getFileColor(this.value),\n backgroundColor: getFileBackgroundColor(this.value),\n },\n href: this.value.href,\n },\n ];\n }\n\n private renderChipset() {\n const chipset = (\n <limel-chip-set\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onInteract={this.handleChipInteract}\n required={this.required}\n type=\"input\"\n value={this.getChipArray()}\n title={this.getTranslation('drag-and-drop-tips')}\n />\n );\n\n if (this.value) {\n return chipset;\n }\n\n return (\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n >\n {chipset}\n </limel-file-input>\n );\n }\n\n private handleChipSetChange = (event: CustomEvent) => {\n event.stopPropagation();\n const file = !event.detail.length ? event.detail[0] : null;\n if (!file) {\n this.change.emit(file);\n }\n };\n\n private handleChipInteract = (event: CustomEvent<Chip>) => {\n this.preventAndStop(event);\n this.interact.emit(event.detail.id);\n };\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(`file.${key}`, this.language);\n }\n}\n"],"version":3}
1
+ {"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,OAAO,GAAG,EAAE;;ACYlB,MAAM,iBAAiB,GAAS;EAC5B,EAAE,EAAE,IAAI;EACR,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,IAAI;CAClB,CAAC;MAyCW,IAAI;;;;;IA2EL,mBAAc,GAAG,CAAC,KAA8B;MACpD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;MAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC,CAAC;IAuDM,wBAAmB,GAAG,CAAC,KAAkB;MAC7C,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;MAC3D,IAAI,CAAC,IAAI,EAAE;QACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;OAC1B;KACJ,CAAC;IAEM,uBAAkB,GAAG,CAAC,KAAwB;MAClD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;MAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;KACvC,CAAC;;;oBA/HyB,KAAK;oBAML,KAAK;oBAOL,KAAK;mBAOf,KAAK;kBAME,GAAG;oBAME,IAAI;;EAc1B,MAAM;IACT,QACIA,iCACI,QAAQ,EAAE,IAAI,CAAC,QAAQ,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,CAAC,KAAK,EAAE;MACZ,OAAO,OAAO,CAAC;KAClB;IAED,QACIA,8BACI,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAEvC,OAAO,CACO,EACrB;GACL;EAeO,cAAc,CAAC,KAAY;IAC/B,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;GAC1B;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAOK,sBAAS,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GACtD;;;;;;","names":["h","getFileIcon","getFileExtensionTitle","getFileColor","getFileBackgroundColor","translate"],"sources":["./src/components/file/file.scss?tag=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n","import translate from '../../global/translations';\nimport { Chip } from '../chip-set/chip.types';\nimport { Languages } from '../date-picker/date.types';\nimport { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from '../../util/file-metadata';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n *\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n public render() {\n return (\n <limel-file-dropzone\n disabled={this.disabled || this.readonly || !!this.value}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n >\n {this.renderChipset()}\n </limel-file-dropzone>\n );\n }\n\n private handleNewFiles = (event: CustomEvent<FileInfo[]>) => {\n this.preventAndStop(event);\n this.change.emit(event.detail[0]);\n };\n\n private getChipArray(): Chip[] {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: {\n name: getFileIcon(this.value),\n title: getFileExtensionTitle(this.value),\n color: getFileColor(this.value),\n backgroundColor: getFileBackgroundColor(this.value),\n },\n href: this.value.href,\n },\n ];\n }\n\n private renderChipset() {\n const chipset = (\n <limel-chip-set\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onInteract={this.handleChipInteract}\n required={this.required}\n type=\"input\"\n value={this.getChipArray()}\n title={this.getTranslation('drag-and-drop-tips')}\n />\n );\n\n if (this.value) {\n return chipset;\n }\n\n return (\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n >\n {chipset}\n </limel-file-input>\n );\n }\n\n private handleChipSetChange = (event: CustomEvent) => {\n event.stopPropagation();\n const file = !event.detail.length ? event.detail[0] : null;\n if (!file) {\n this.change.emit(file);\n }\n };\n\n private handleChipInteract = (event: CustomEvent<Chip>) => {\n this.preventAndStop(event);\n this.interact.emit(event.detail.id);\n };\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(`file.${key}`, this.language);\n }\n}\n"],"version":3}