@getmicdrop/svelte-components 2.0.4 → 2.0.6

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 (107) hide show
  1. package/dist/components/Alert/Alert.spec.js +170 -170
  2. package/dist/components/Badges/Badge.spec.js +103 -103
  3. package/dist/components/BottomSheet/BottomSheet.spec.js +127 -127
  4. package/dist/components/Breadcrumb/Breadcrumb.spec.js +120 -120
  5. package/dist/components/Button/Button.spec.js +211 -211
  6. package/dist/components/Button/ButtonSaveDemo.spec.js +48 -48
  7. package/dist/components/Calendar/Calendar.spec.js +131 -131
  8. package/dist/components/Calendar/QuarterView.spec.js +394 -394
  9. package/dist/components/Card.spec.js +47 -47
  10. package/dist/components/CropImage/CropImage.spec.js +216 -216
  11. package/dist/components/DarkModeToggle.spec.js +357 -357
  12. package/dist/components/ErrorDisplay.spec.js +69 -69
  13. package/dist/components/FormActions.spec.js +88 -88
  14. package/dist/components/FormValidationSummary.spec.js +203 -203
  15. package/dist/components/Icons/Icon.spec.js +175 -175
  16. package/dist/components/Icons/MoreHori.spec.js +67 -67
  17. package/dist/components/Icons/WarningIcon.spec.js +30 -30
  18. package/dist/components/Input/Input.spec.js +573 -573
  19. package/dist/components/Input/MultiSelect.spec.js +257 -257
  20. package/dist/components/Input/OTPInput.spec.js +238 -238
  21. package/dist/components/Input/Select.spec.js +218 -218
  22. package/dist/components/Layout/BottomNav.spec.js +130 -130
  23. package/dist/components/Layout/Header.spec.js +203 -203
  24. package/dist/components/Modal/ConfirmationModal.spec.js +191 -191
  25. package/dist/components/Modal/Modal.spec.js +95 -95
  26. package/dist/components/Modal/ModalStateManager.spec.js +100 -100
  27. package/dist/components/PageLoader.spec.js +54 -54
  28. package/dist/components/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +173 -173
  29. package/dist/components/PlaceAutocomplete/PlaceAutocomplete.spec.js +300 -300
  30. package/dist/components/Spinner/Spinner.spec.js +75 -75
  31. package/dist/components/StatusIndicator/StatusIndicator.spec.js +129 -129
  32. package/dist/components/Toaster/Toaster.stories.svelte +1 -1
  33. package/dist/components/Toggle.spec.js +158 -158
  34. package/dist/components/ValidationError.spec.js +79 -79
  35. package/dist/components/pages/performers/AvailabilityCalendarModal.spec.js +606 -606
  36. package/dist/components/pages/performers/AvailabilityCalendarModal.svelte +4 -4
  37. package/dist/components/pages/performers/ModalShowInfo.spec.js +124 -124
  38. package/dist/components/pages/performers/ModalShowInfo.svelte +1 -1
  39. package/dist/components/pages/performers/PageBackButton.spec.js +89 -89
  40. package/dist/components/pages/performers/SectionHeader.spec.js +75 -75
  41. package/dist/components/pages/performers/ShowDetails.spec.js +166 -166
  42. package/dist/components/pages/performers/ShowItemCard.spec.js +793 -793
  43. package/dist/components/pages/performers/ShowItemCard.svelte +4 -4
  44. package/dist/components/pages/performers/SwitchOption.spec.js +127 -127
  45. package/dist/components/pages/performers/VenueInfo.spec.js +167 -167
  46. package/dist/components/pages/performers/VenueInfo.svelte +1 -1
  47. package/dist/components/pages/performers/VenueItemCard.spec.js +763 -763
  48. package/dist/components/pages/performers/VenueItemCard.svelte +4 -4
  49. package/dist/components/pages/profile/profile-form.spec.js +9 -9
  50. package/dist/components/pages/settings/tabs/CustomImageDropzone.svelte +3 -3
  51. package/dist/components/pages/shows/ShowList.spec.js +33 -33
  52. package/dist/components/pages/shows/TabContent.spec.js +90 -90
  53. package/dist/components/pages/shows/TabNavigation.spec.js +143 -143
  54. package/dist/config.js +5 -5
  55. package/dist/config.spec.js +29 -29
  56. package/dist/constants/formOptions.js +25 -25
  57. package/dist/constants/formOptions.spec.js +88 -88
  58. package/dist/index.js +111 -111
  59. package/dist/stores/auth.d.ts +9 -0
  60. package/dist/stores/auth.d.ts.map +1 -0
  61. package/dist/stores/auth.js +36 -0
  62. package/dist/stores/auth.spec.d.ts +2 -0
  63. package/dist/stores/auth.spec.d.ts.map +1 -0
  64. package/dist/stores/auth.spec.js +139 -0
  65. package/dist/stores/formDataStore.d.ts +17 -0
  66. package/dist/stores/formDataStore.d.ts.map +1 -0
  67. package/dist/stores/formDataStore.js +25 -0
  68. package/dist/stores/formDataStore.spec.d.ts +2 -0
  69. package/dist/stores/formDataStore.spec.d.ts.map +1 -0
  70. package/dist/stores/formDataStore.spec.js +257 -0
  71. package/dist/stores/formSave.d.ts +24 -0
  72. package/dist/stores/formSave.d.ts.map +1 -0
  73. package/dist/stores/formSave.js +132 -0
  74. package/dist/stores/formSave.spec.d.ts +2 -0
  75. package/dist/stores/formSave.spec.d.ts.map +1 -0
  76. package/dist/stores/formSave.spec.js +296 -0
  77. package/dist/stores/index.d.ts +1 -0
  78. package/dist/stores/index.d.ts.map +1 -0
  79. package/dist/stores/index.js +0 -0
  80. package/dist/stores/navigation.d.ts +5 -0
  81. package/dist/stores/navigation.d.ts.map +1 -0
  82. package/dist/stores/navigation.js +12 -0
  83. package/dist/stores/navigation.spec.d.ts +2 -0
  84. package/dist/stores/navigation.spec.d.ts.map +1 -0
  85. package/dist/stores/navigation.spec.js +136 -0
  86. package/dist/stores/toaster.d.ts +4 -0
  87. package/dist/stores/toaster.d.ts.map +1 -0
  88. package/dist/stores/toaster.js +13 -0
  89. package/dist/stores/toaster.spec.d.ts +2 -0
  90. package/dist/stores/toaster.spec.d.ts.map +1 -0
  91. package/dist/stores/toaster.spec.js +59 -0
  92. package/dist/telemetry.js +357 -357
  93. package/dist/telemetry.server.js +211 -211
  94. package/dist/telemetry.server.spec.js +434 -434
  95. package/dist/telemetry.spec.js +660 -660
  96. package/dist/utils/apiConfig.js +49 -49
  97. package/dist/utils/apiConfig.spec.js +118 -118
  98. package/dist/utils/greetings.js +187 -187
  99. package/dist/utils/greetings.spec.js +337 -337
  100. package/dist/utils/imageValidation.js +121 -121
  101. package/dist/utils/imageValidation.spec.js +220 -220
  102. package/dist/utils/portal.js +25 -25
  103. package/dist/utils/portal.spec.js +143 -143
  104. package/dist/utils/utils/utils.js +323 -323
  105. package/dist/utils/utils/utils.spec.js +698 -698
  106. package/dist/utils/utils.spec.js +643 -643
  107. package/package.json +1 -1
@@ -1,121 +1,121 @@
1
- /**
2
- * Image validation utilities for file uploads
3
- *
4
- * Guidelines:
5
- * - Formats: PNG, JPG, JPEG, WebP, HEIC, HEIF
6
- * - Max dimension: 8000px (to handle phone screenshots up to 4K)
7
- * - Max file size: 20MB (we crop and optimize to 1000x1000 WebP anyway)
8
- * - Aspect ratio: Any
9
- */
10
-
11
- const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20 MB - generous since we optimize
12
- const MAX_DIMENSION = 8000; // pixels - handles 4K+ phone screenshots
13
- const ALLOWED_IMAGE_TYPES = [
14
- 'image/jpeg',
15
- 'image/jpg',
16
- 'image/png',
17
- 'image/webp',
18
- 'image/heic',
19
- 'image/heif'
20
- ];
21
-
22
- /**
23
- * Validates an image file according to upload guidelines
24
- * @param {File} file - The image file to validate
25
- * @returns {Promise<{valid: boolean, error: string|null, dimensions: {width: number, height: number}}>}
26
- */
27
- export async function validateImage(file) {
28
- // Check file type
29
- if (!ALLOWED_IMAGE_TYPES.includes(file.type.toLowerCase())) {
30
- return {
31
- valid: false,
32
- error: 'Invalid file format. Please upload PNG, JPG, WebP, or HEIC images only.',
33
- dimensions: null
34
- };
35
- }
36
-
37
- // Check file size
38
- if (file.size > MAX_FILE_SIZE) {
39
- const sizeMB = (file.size / (1024 * 1024)).toFixed(2);
40
- return {
41
- valid: false,
42
- error: `File too large (${sizeMB}MB). Maximum file size is 20MB.`,
43
- dimensions: null
44
- };
45
- }
46
-
47
- // Check dimensions
48
- try {
49
- const dimensions = await getImageDimensions(file);
50
-
51
- if (dimensions.width > MAX_DIMENSION || dimensions.height > MAX_DIMENSION) {
52
- return {
53
- valid: false,
54
- error: `Image dimensions too large (${dimensions.width}x${dimensions.height}px). Maximum dimension is ${MAX_DIMENSION}px.`,
55
- dimensions
56
- };
57
- }
58
-
59
- return {
60
- valid: true,
61
- error: null,
62
- dimensions
63
- };
64
- } catch (error) {
65
- return {
66
- valid: false,
67
- error: 'Failed to read image dimensions. Please try another file.',
68
- dimensions: null
69
- };
70
- }
71
- }
72
-
73
- /**
74
- * Gets the dimensions of an image file
75
- * @param {File} file - The image file
76
- * @returns {Promise<{width: number, height: number}>}
77
- */
78
- function getImageDimensions(file) {
79
- return new Promise((resolve, reject) => {
80
- const img = new Image();
81
- const objectUrl = URL.createObjectURL(file);
82
-
83
- img.onload = function() {
84
- URL.revokeObjectURL(objectUrl);
85
- resolve({
86
- width: this.width,
87
- height: this.height
88
- });
89
- };
90
-
91
- img.onerror = function() {
92
- URL.revokeObjectURL(objectUrl);
93
- reject(new Error('Failed to load image'));
94
- };
95
-
96
- img.src = objectUrl;
97
- });
98
- }
99
-
100
- /**
101
- * Gets the accept attribute value for file inputs
102
- * @returns {string}
103
- */
104
- export function getImageAcceptAttribute() {
105
- return 'image/png,image/jpeg,image/jpg,image/webp,image/heic,image/heif';
106
- }
107
-
108
- /**
109
- * Gets formatted error messages for display in UI
110
- * @returns {object}
111
- */
112
- export function getValidationMessages() {
113
- return {
114
- formats: 'PNG, JPG, WebP, HEIC',
115
- maxSize: '20MB',
116
- maxDimension: '8000px',
117
- aspectRatio: 'Any'
118
- };
119
- }
120
-
121
- export { MAX_FILE_SIZE, MAX_DIMENSION, ALLOWED_IMAGE_TYPES };
1
+ /**
2
+ * Image validation utilities for file uploads
3
+ *
4
+ * Guidelines:
5
+ * - Formats: PNG, JPG, JPEG, WebP, HEIC, HEIF
6
+ * - Max dimension: 8000px (to handle phone screenshots up to 4K)
7
+ * - Max file size: 20MB (we crop and optimize to 1000x1000 WebP anyway)
8
+ * - Aspect ratio: Any
9
+ */
10
+
11
+ const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20 MB - generous since we optimize
12
+ const MAX_DIMENSION = 8000; // pixels - handles 4K+ phone screenshots
13
+ const ALLOWED_IMAGE_TYPES = [
14
+ 'image/jpeg',
15
+ 'image/jpg',
16
+ 'image/png',
17
+ 'image/webp',
18
+ 'image/heic',
19
+ 'image/heif'
20
+ ];
21
+
22
+ /**
23
+ * Validates an image file according to upload guidelines
24
+ * @param {File} file - The image file to validate
25
+ * @returns {Promise<{valid: boolean, error: string|null, dimensions: {width: number, height: number}}>}
26
+ */
27
+ export async function validateImage(file) {
28
+ // Check file type
29
+ if (!ALLOWED_IMAGE_TYPES.includes(file.type.toLowerCase())) {
30
+ return {
31
+ valid: false,
32
+ error: 'Invalid file format. Please upload PNG, JPG, WebP, or HEIC images only.',
33
+ dimensions: null
34
+ };
35
+ }
36
+
37
+ // Check file size
38
+ if (file.size > MAX_FILE_SIZE) {
39
+ const sizeMB = (file.size / (1024 * 1024)).toFixed(2);
40
+ return {
41
+ valid: false,
42
+ error: `File too large (${sizeMB}MB). Maximum file size is 20MB.`,
43
+ dimensions: null
44
+ };
45
+ }
46
+
47
+ // Check dimensions
48
+ try {
49
+ const dimensions = await getImageDimensions(file);
50
+
51
+ if (dimensions.width > MAX_DIMENSION || dimensions.height > MAX_DIMENSION) {
52
+ return {
53
+ valid: false,
54
+ error: `Image dimensions too large (${dimensions.width}x${dimensions.height}px). Maximum dimension is ${MAX_DIMENSION}px.`,
55
+ dimensions
56
+ };
57
+ }
58
+
59
+ return {
60
+ valid: true,
61
+ error: null,
62
+ dimensions
63
+ };
64
+ } catch (error) {
65
+ return {
66
+ valid: false,
67
+ error: 'Failed to read image dimensions. Please try another file.',
68
+ dimensions: null
69
+ };
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Gets the dimensions of an image file
75
+ * @param {File} file - The image file
76
+ * @returns {Promise<{width: number, height: number}>}
77
+ */
78
+ function getImageDimensions(file) {
79
+ return new Promise((resolve, reject) => {
80
+ const img = new Image();
81
+ const objectUrl = URL.createObjectURL(file);
82
+
83
+ img.onload = function() {
84
+ URL.revokeObjectURL(objectUrl);
85
+ resolve({
86
+ width: this.width,
87
+ height: this.height
88
+ });
89
+ };
90
+
91
+ img.onerror = function() {
92
+ URL.revokeObjectURL(objectUrl);
93
+ reject(new Error('Failed to load image'));
94
+ };
95
+
96
+ img.src = objectUrl;
97
+ });
98
+ }
99
+
100
+ /**
101
+ * Gets the accept attribute value for file inputs
102
+ * @returns {string}
103
+ */
104
+ export function getImageAcceptAttribute() {
105
+ return 'image/png,image/jpeg,image/jpg,image/webp,image/heic,image/heif';
106
+ }
107
+
108
+ /**
109
+ * Gets formatted error messages for display in UI
110
+ * @returns {object}
111
+ */
112
+ export function getValidationMessages() {
113
+ return {
114
+ formats: 'PNG, JPG, WebP, HEIC',
115
+ maxSize: '20MB',
116
+ maxDimension: '8000px',
117
+ aspectRatio: 'Any'
118
+ };
119
+ }
120
+
121
+ export { MAX_FILE_SIZE, MAX_DIMENSION, ALLOWED_IMAGE_TYPES };