@getmicdrop/svelte-components 5.6.0 → 5.6.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.
- package/dist/components/Layout/__tests__/AppShell.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/AppShell.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/AppShell.test.js +95 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/ContentSection.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/ContentSection.test.js +112 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/PageContainer.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/PageContainer.test.js +133 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts +2 -0
- package/dist/components/Layout/__tests__/Responsive.test.d.ts.map +1 -0
- package/dist/components/Layout/__tests__/Responsive.test.js +123 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +41 -40
- package/dist/patterns/navigation/BottomNav.svelte +18 -8
- package/dist/patterns/navigation/BottomNav.svelte.d.ts.map +1 -1
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte +107 -107
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts +2 -2
- package/dist/primitives/Accordion/AccordionItemWrapper.test.svelte.d.ts.map +1 -1
- package/dist/primitives/Checkbox/Checkbox.svelte +3 -3
- package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts +7 -0
- package/dist/primitives/Dropdown/DropdownDivider.svelte.d.ts.map +1 -0
- package/dist/primitives/Helper/Helper.svelte +33 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts +18 -0
- package/dist/primitives/Helper/Helper.svelte.d.ts.map +1 -0
- package/dist/primitives/Input/Input.svelte +416 -417
- package/dist/primitives/Input/Input.svelte.d.ts +2 -4
- package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
- package/dist/primitives/Modal/Modal.svelte +157 -158
- package/dist/primitives/Modal/Modal.svelte.d.ts +6 -8
- package/dist/primitives/Modal/Modal.svelte.d.ts.map +1 -1
- package/dist/primitives/NumberInput/NumberInput.svelte +105 -106
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts +0 -2
- package/dist/primitives/NumberInput/NumberInput.svelte.d.ts.map +1 -1
- package/dist/primitives/Toggle.svelte +70 -71
- package/dist/primitives/Toggle.svelte.d.ts +2 -4
- package/dist/primitives/Toggle.svelte.d.ts.map +1 -1
- package/dist/primitives/Tooltip/Tooltip.svelte +83 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts +15 -0
- package/dist/primitives/Tooltip/Tooltip.svelte.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +7 -0
- package/dist/recipes/ImageUploader/ImageUploader.spec.js +6 -5
- package/dist/recipes/inputs/MultiSelect.svelte +277 -256
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts +54 -21
- package/dist/recipes/inputs/MultiSelect.svelte.d.ts.map +1 -1
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.spec.js +9 -4
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +332 -327
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts +12 -1
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte.d.ts.map +1 -1
- package/dist/stores/auth.js +8 -0
- package/dist/stores/auth.svelte.d.ts +39 -0
- package/dist/stores/auth.svelte.d.ts.map +1 -0
- package/dist/stores/auth.svelte.js +60 -0
- package/dist/stores/formDataStore.d.ts.map +1 -1
- package/dist/stores/formDataStore.js +8 -0
- package/dist/stores/formDataStore.svelte.d.ts +47 -0
- package/dist/stores/formDataStore.svelte.d.ts.map +1 -0
- package/dist/stores/formDataStore.svelte.js +84 -0
- package/dist/stores/formSave.d.ts.map +1 -1
- package/dist/stores/formSave.js +8 -0
- package/dist/stores/formSave.svelte.d.ts +33 -0
- package/dist/stores/formSave.svelte.d.ts.map +1 -0
- package/dist/stores/formSave.svelte.js +113 -0
- package/dist/stores/navigation.d.ts.map +1 -1
- package/dist/stores/navigation.js +8 -0
- package/dist/stores/navigation.svelte.d.ts +35 -0
- package/dist/stores/navigation.svelte.d.ts.map +1 -0
- package/dist/stores/navigation.svelte.js +69 -0
- package/dist/telemetry.server.spec.js +11 -8
- package/dist/telemetry.spec.js +75 -50
- package/dist/utils/imageValidation.spec.js +62 -59
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +47 -0
- package/package.json +296 -292
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/AppShell.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import AppShell from '../AppShell.svelte';
|
|
4
|
+
describe('AppShell', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders the shell container', () => {
|
|
7
|
+
const { container } = render(AppShell);
|
|
8
|
+
const shell = container.querySelector('div');
|
|
9
|
+
expect(shell).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
it('applies min-h-screen class', () => {
|
|
12
|
+
const { container } = render(AppShell);
|
|
13
|
+
const shell = container.querySelector('div');
|
|
14
|
+
expect(shell?.classList.contains('min-h-screen')).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
it('renders main element', () => {
|
|
17
|
+
const { container } = render(AppShell);
|
|
18
|
+
expect(container.querySelector('main')).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('variant prop', () => {
|
|
22
|
+
it('applies admin background by default', () => {
|
|
23
|
+
const { container } = render(AppShell);
|
|
24
|
+
const shell = container.querySelector('div');
|
|
25
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it('applies admin background for variant="admin"', () => {
|
|
28
|
+
const { container } = render(AppShell, { variant: 'admin' });
|
|
29
|
+
const shell = container.querySelector('div');
|
|
30
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it('applies performer background for variant="performer"', () => {
|
|
33
|
+
const { container } = render(AppShell, { variant: 'performer' });
|
|
34
|
+
const shell = container.querySelector('div');
|
|
35
|
+
expect(shell?.classList.contains('bg-gray-50')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it('applies public background for variant="public"', () => {
|
|
38
|
+
const { container } = render(AppShell, { variant: 'public' });
|
|
39
|
+
const shell = container.querySelector('div');
|
|
40
|
+
expect(shell?.classList.contains('bg-white')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('applies minimal background for variant="minimal"', () => {
|
|
43
|
+
const { container } = render(AppShell, { variant: 'minimal' });
|
|
44
|
+
const shell = container.querySelector('div');
|
|
45
|
+
expect(shell?.classList.contains('bg-white')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('fixedHeader prop', () => {
|
|
49
|
+
it('applies pt-16 to main when fixedHeader=true', () => {
|
|
50
|
+
const { container } = render(AppShell, { fixedHeader: true });
|
|
51
|
+
const main = container.querySelector('main');
|
|
52
|
+
expect(main?.classList.contains('pt-16')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it('does not apply pt-16 to main when fixedHeader=false', () => {
|
|
55
|
+
const { container } = render(AppShell, { fixedHeader: false });
|
|
56
|
+
const main = container.querySelector('main');
|
|
57
|
+
expect(main?.classList.contains('pt-16')).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('sidebarCollapsed prop', () => {
|
|
61
|
+
// Note: sidebar tests require the sidebar snippet to be provided
|
|
62
|
+
// These tests verify the main content margin adjusts correctly
|
|
63
|
+
it('applies transition classes to main', () => {
|
|
64
|
+
const { container } = render(AppShell);
|
|
65
|
+
const main = container.querySelector('main');
|
|
66
|
+
expect(main?.classList.contains('transition-all')).toBe(true);
|
|
67
|
+
expect(main?.classList.contains('duration-300')).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('class prop', () => {
|
|
71
|
+
it('applies custom classes to main element', () => {
|
|
72
|
+
const { container } = render(AppShell, { class: 'custom-main-class' });
|
|
73
|
+
const main = container.querySelector('main');
|
|
74
|
+
expect(main?.classList.contains('custom-main-class')).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('structural elements', () => {
|
|
78
|
+
it('does not render header when no header snippet provided', () => {
|
|
79
|
+
const { container } = render(AppShell);
|
|
80
|
+
expect(container.querySelector('header')).toBeFalsy();
|
|
81
|
+
});
|
|
82
|
+
it('does not render aside when no sidebar snippet provided', () => {
|
|
83
|
+
const { container } = render(AppShell);
|
|
84
|
+
expect(container.querySelector('aside')).toBeFalsy();
|
|
85
|
+
});
|
|
86
|
+
it('does not render nav when showBottomNav=false', () => {
|
|
87
|
+
const { container } = render(AppShell, { showBottomNav: false });
|
|
88
|
+
expect(container.querySelector('nav')).toBeFalsy();
|
|
89
|
+
});
|
|
90
|
+
it('does not render nav when no bottomNav snippet provided', () => {
|
|
91
|
+
const { container } = render(AppShell, { showBottomNav: true });
|
|
92
|
+
expect(container.querySelector('nav')).toBeFalsy();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentSection.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/ContentSection.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import ContentSection from '../ContentSection.svelte';
|
|
4
|
+
describe('ContentSection', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders a section element', () => {
|
|
7
|
+
const { container } = render(ContentSection);
|
|
8
|
+
expect(container.querySelector('section')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('applies default spacing class', () => {
|
|
11
|
+
const { container } = render(ContentSection);
|
|
12
|
+
const section = container.querySelector('section');
|
|
13
|
+
expect(section?.classList.contains('mb-6')).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
describe('title prop', () => {
|
|
17
|
+
it('renders title when provided', () => {
|
|
18
|
+
const { container } = render(ContentSection, { title: 'Test Title' });
|
|
19
|
+
expect(container.textContent).toContain('Test Title');
|
|
20
|
+
});
|
|
21
|
+
it('renders title as h2 by default', () => {
|
|
22
|
+
const { container } = render(ContentSection, { title: 'Test Title' });
|
|
23
|
+
const h2 = container.querySelector('h2');
|
|
24
|
+
expect(h2).toBeTruthy();
|
|
25
|
+
expect(h2?.textContent).toBe('Test Title');
|
|
26
|
+
});
|
|
27
|
+
it('applies title size classes', () => {
|
|
28
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'lg' });
|
|
29
|
+
const heading = container.querySelector('h2');
|
|
30
|
+
expect(heading?.classList.contains('text-xl')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('subtitle prop', () => {
|
|
34
|
+
it('renders subtitle when provided', () => {
|
|
35
|
+
const { container } = render(ContentSection, { title: 'Title', subtitle: 'Subtitle text' });
|
|
36
|
+
expect(container.textContent).toContain('Subtitle text');
|
|
37
|
+
});
|
|
38
|
+
it('applies subtitle styling', () => {
|
|
39
|
+
const { container } = render(ContentSection, { title: 'Title', subtitle: 'Subtitle' });
|
|
40
|
+
const subtitle = container.querySelector('p');
|
|
41
|
+
expect(subtitle?.classList.contains('text-sm')).toBe(true);
|
|
42
|
+
expect(subtitle?.classList.contains('text-gray-500')).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('headingLevel prop', () => {
|
|
46
|
+
it('renders h2 by default', () => {
|
|
47
|
+
const { container } = render(ContentSection, { title: 'Test' });
|
|
48
|
+
expect(container.querySelector('h2')).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
it('renders h3 when headingLevel=3', () => {
|
|
51
|
+
const { container } = render(ContentSection, { title: 'Test', headingLevel: 3 });
|
|
52
|
+
expect(container.querySelector('h3')).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('renders h4 when headingLevel=4', () => {
|
|
55
|
+
const { container } = render(ContentSection, { title: 'Test', headingLevel: 4 });
|
|
56
|
+
expect(container.querySelector('h4')).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('titleSize prop', () => {
|
|
60
|
+
it('applies text-base for titleSize="sm"', () => {
|
|
61
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'sm' });
|
|
62
|
+
const heading = container.querySelector('h2');
|
|
63
|
+
expect(heading?.classList.contains('text-base')).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
it('applies text-lg for titleSize="base"', () => {
|
|
66
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'base' });
|
|
67
|
+
const heading = container.querySelector('h2');
|
|
68
|
+
expect(heading?.classList.contains('text-lg')).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
it('applies text-xl for titleSize="lg"', () => {
|
|
71
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'lg' });
|
|
72
|
+
const heading = container.querySelector('h2');
|
|
73
|
+
expect(heading?.classList.contains('text-xl')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
it('applies text-2xl for titleSize="xl"', () => {
|
|
76
|
+
const { container } = render(ContentSection, { title: 'Test', titleSize: 'xl' });
|
|
77
|
+
const heading = container.querySelector('h2');
|
|
78
|
+
expect(heading?.classList.contains('text-2xl')).toBe(true);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe('spacing prop', () => {
|
|
82
|
+
it('applies no margin for spacing="none"', () => {
|
|
83
|
+
const { container } = render(ContentSection, { spacing: 'none' });
|
|
84
|
+
const section = container.querySelector('section');
|
|
85
|
+
expect(section?.classList.contains('mb-4')).toBe(false);
|
|
86
|
+
expect(section?.classList.contains('mb-6')).toBe(false);
|
|
87
|
+
expect(section?.classList.contains('mb-8')).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
it('applies mb-4 for spacing="sm"', () => {
|
|
90
|
+
const { container } = render(ContentSection, { spacing: 'sm' });
|
|
91
|
+
const section = container.querySelector('section');
|
|
92
|
+
expect(section?.classList.contains('mb-4')).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it('applies mb-6 for spacing="md"', () => {
|
|
95
|
+
const { container } = render(ContentSection, { spacing: 'md' });
|
|
96
|
+
const section = container.querySelector('section');
|
|
97
|
+
expect(section?.classList.contains('mb-6')).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
it('applies mb-8 for spacing="lg"', () => {
|
|
100
|
+
const { container } = render(ContentSection, { spacing: 'lg' });
|
|
101
|
+
const section = container.querySelector('section');
|
|
102
|
+
expect(section?.classList.contains('mb-8')).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('class prop', () => {
|
|
106
|
+
it('applies custom classes', () => {
|
|
107
|
+
const { container } = render(ContentSection, { class: 'custom-class' });
|
|
108
|
+
const section = container.querySelector('section');
|
|
109
|
+
expect(section?.classList.contains('custom-class')).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageContainer.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/PageContainer.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import PageContainer from '../PageContainer.svelte';
|
|
4
|
+
describe('PageContainer', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders a div element', () => {
|
|
7
|
+
const { container } = render(PageContainer);
|
|
8
|
+
expect(container.querySelector('div')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
it('applies default max-w-full class', () => {
|
|
11
|
+
const { container } = render(PageContainer);
|
|
12
|
+
const div = container.querySelector('div');
|
|
13
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('applies mx-auto for centering by default', () => {
|
|
16
|
+
const { container } = render(PageContainer);
|
|
17
|
+
const div = container.querySelector('div');
|
|
18
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('maxWidth prop', () => {
|
|
22
|
+
it('applies max-w-sm for maxWidth="sm"', () => {
|
|
23
|
+
const { container } = render(PageContainer, { maxWidth: 'sm' });
|
|
24
|
+
const div = container.querySelector('div');
|
|
25
|
+
expect(div?.classList.contains('max-w-sm')).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it('applies max-w-md for maxWidth="md"', () => {
|
|
28
|
+
const { container } = render(PageContainer, { maxWidth: 'md' });
|
|
29
|
+
const div = container.querySelector('div');
|
|
30
|
+
expect(div?.classList.contains('max-w-md')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it('applies max-w-lg for maxWidth="lg"', () => {
|
|
33
|
+
const { container } = render(PageContainer, { maxWidth: 'lg' });
|
|
34
|
+
const div = container.querySelector('div');
|
|
35
|
+
expect(div?.classList.contains('max-w-lg')).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it('applies max-w-xl for maxWidth="xl"', () => {
|
|
38
|
+
const { container } = render(PageContainer, { maxWidth: 'xl' });
|
|
39
|
+
const div = container.querySelector('div');
|
|
40
|
+
expect(div?.classList.contains('max-w-xl')).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('applies max-w-2xl for maxWidth="2xl"', () => {
|
|
43
|
+
const { container } = render(PageContainer, { maxWidth: '2xl' });
|
|
44
|
+
const div = container.querySelector('div');
|
|
45
|
+
expect(div?.classList.contains('max-w-2xl')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
it('applies max-w-4xl for maxWidth="4xl"', () => {
|
|
48
|
+
const { container } = render(PageContainer, { maxWidth: '4xl' });
|
|
49
|
+
const div = container.querySelector('div');
|
|
50
|
+
expect(div?.classList.contains('max-w-4xl')).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('applies max-w-6xl for maxWidth="6xl"', () => {
|
|
53
|
+
const { container } = render(PageContainer, { maxWidth: '6xl' });
|
|
54
|
+
const div = container.querySelector('div');
|
|
55
|
+
expect(div?.classList.contains('max-w-6xl')).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it('applies max-w-full for maxWidth="full"', () => {
|
|
58
|
+
const { container } = render(PageContainer, { maxWidth: 'full' });
|
|
59
|
+
const div = container.querySelector('div');
|
|
60
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('padding prop', () => {
|
|
64
|
+
it('applies no padding for padding="none"', () => {
|
|
65
|
+
const { container } = render(PageContainer, { padding: 'none' });
|
|
66
|
+
const div = container.querySelector('div');
|
|
67
|
+
expect(div?.classList.contains('px-4')).toBe(false);
|
|
68
|
+
expect(div?.classList.contains('py-6')).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
it('applies tight padding for padding="tight"', () => {
|
|
71
|
+
const { container } = render(PageContainer, { padding: 'tight' });
|
|
72
|
+
const div = container.querySelector('div');
|
|
73
|
+
expect(div?.classList.contains('px-2')).toBe(true);
|
|
74
|
+
expect(div?.classList.contains('py-2')).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
it('applies default padding for padding="default"', () => {
|
|
77
|
+
const { container } = render(PageContainer, { padding: 'default' });
|
|
78
|
+
const div = container.querySelector('div');
|
|
79
|
+
expect(div?.classList.contains('px-4')).toBe(true);
|
|
80
|
+
expect(div?.classList.contains('py-6')).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
it('applies spacious padding for padding="spacious"', () => {
|
|
83
|
+
const { container } = render(PageContainer, { padding: 'spacious' });
|
|
84
|
+
const div = container.querySelector('div');
|
|
85
|
+
expect(div?.classList.contains('px-4')).toBe(true);
|
|
86
|
+
expect(div?.classList.contains('py-8')).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('center prop', () => {
|
|
90
|
+
it('applies mx-auto when center=true', () => {
|
|
91
|
+
const { container } = render(PageContainer, { center: true });
|
|
92
|
+
const div = container.querySelector('div');
|
|
93
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('does not apply mx-auto when center=false', () => {
|
|
96
|
+
const { container } = render(PageContainer, { center: false });
|
|
97
|
+
const div = container.querySelector('div');
|
|
98
|
+
expect(div?.classList.contains('mx-auto')).toBe(false);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe('background prop', () => {
|
|
102
|
+
it('applies no background for background="none"', () => {
|
|
103
|
+
const { container } = render(PageContainer, { background: 'none' });
|
|
104
|
+
const div = container.querySelector('div');
|
|
105
|
+
expect(div?.classList.contains('bg-white')).toBe(false);
|
|
106
|
+
expect(div?.classList.contains('bg-gray-50')).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
it('applies white background for background="white"', () => {
|
|
109
|
+
const { container } = render(PageContainer, { background: 'white' });
|
|
110
|
+
const div = container.querySelector('div');
|
|
111
|
+
expect(div?.classList.contains('bg-white')).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
it('applies gray background for background="gray"', () => {
|
|
114
|
+
const { container } = render(PageContainer, { background: 'gray' });
|
|
115
|
+
const div = container.querySelector('div');
|
|
116
|
+
expect(div?.classList.contains('bg-gray-50')).toBe(true);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe('class prop', () => {
|
|
120
|
+
it('applies custom classes', () => {
|
|
121
|
+
const { container } = render(PageContainer, { class: 'custom-class' });
|
|
122
|
+
const div = container.querySelector('div');
|
|
123
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
it('preserves default classes when adding custom classes', () => {
|
|
126
|
+
const { container } = render(PageContainer, { class: 'custom-class' });
|
|
127
|
+
const div = container.querySelector('div');
|
|
128
|
+
expect(div?.classList.contains('max-w-full')).toBe(true);
|
|
129
|
+
expect(div?.classList.contains('mx-auto')).toBe(true);
|
|
130
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Responsive.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/Layout/__tests__/Responsive.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { render } from '@testing-library/svelte';
|
|
3
|
+
import Responsive from '../Responsive.svelte';
|
|
4
|
+
describe('Responsive', () => {
|
|
5
|
+
describe('basic rendering', () => {
|
|
6
|
+
it('renders a div element', () => {
|
|
7
|
+
const { container } = render(Responsive, { mode: 'show-mobile' });
|
|
8
|
+
expect(container.querySelector('div')).toBeTruthy();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
describe('mode="show-mobile"', () => {
|
|
12
|
+
it('applies block and lg:hidden classes', () => {
|
|
13
|
+
const { container } = render(Responsive, { mode: 'show-mobile' });
|
|
14
|
+
const div = container.querySelector('div');
|
|
15
|
+
expect(div?.classList.contains('block')).toBe(true);
|
|
16
|
+
expect(div?.classList.contains('lg:hidden')).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('respects breakpoint prop', () => {
|
|
19
|
+
const { container } = render(Responsive, { mode: 'show-mobile', breakpoint: 'md' });
|
|
20
|
+
const div = container.querySelector('div');
|
|
21
|
+
expect(div?.classList.contains('block')).toBe(true);
|
|
22
|
+
expect(div?.classList.contains('md:hidden')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('mode="show-desktop"', () => {
|
|
26
|
+
it('applies hidden and lg:block classes', () => {
|
|
27
|
+
const { container } = render(Responsive, { mode: 'show-desktop' });
|
|
28
|
+
const div = container.querySelector('div');
|
|
29
|
+
expect(div?.classList.contains('hidden')).toBe(true);
|
|
30
|
+
expect(div?.classList.contains('lg:block')).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
it('respects breakpoint prop', () => {
|
|
33
|
+
const { container } = render(Responsive, { mode: 'show-desktop', breakpoint: 'md' });
|
|
34
|
+
const div = container.querySelector('div');
|
|
35
|
+
expect(div?.classList.contains('hidden')).toBe(true);
|
|
36
|
+
expect(div?.classList.contains('md:block')).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('mode="hide-mobile"', () => {
|
|
40
|
+
it('applies hidden and lg:block classes (same as show-desktop)', () => {
|
|
41
|
+
const { container } = render(Responsive, { mode: 'hide-mobile' });
|
|
42
|
+
const div = container.querySelector('div');
|
|
43
|
+
expect(div?.classList.contains('hidden')).toBe(true);
|
|
44
|
+
expect(div?.classList.contains('lg:block')).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('mode="hide-desktop"', () => {
|
|
48
|
+
it('applies block and lg:hidden classes (same as show-mobile)', () => {
|
|
49
|
+
const { container } = render(Responsive, { mode: 'hide-desktop' });
|
|
50
|
+
const div = container.querySelector('div');
|
|
51
|
+
expect(div?.classList.contains('block')).toBe(true);
|
|
52
|
+
expect(div?.classList.contains('lg:hidden')).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('breakpoint prop', () => {
|
|
56
|
+
it('uses sm breakpoint', () => {
|
|
57
|
+
const { container } = render(Responsive, { mode: 'show-desktop', breakpoint: 'sm' });
|
|
58
|
+
const div = container.querySelector('div');
|
|
59
|
+
expect(div?.classList.contains('sm:block')).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
it('uses md breakpoint', () => {
|
|
62
|
+
const { container } = render(Responsive, { mode: 'show-desktop', breakpoint: 'md' });
|
|
63
|
+
const div = container.querySelector('div');
|
|
64
|
+
expect(div?.classList.contains('md:block')).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
it('uses lg breakpoint (default)', () => {
|
|
67
|
+
const { container } = render(Responsive, { mode: 'show-desktop', breakpoint: 'lg' });
|
|
68
|
+
const div = container.querySelector('div');
|
|
69
|
+
expect(div?.classList.contains('lg:block')).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
it('uses xl breakpoint', () => {
|
|
72
|
+
const { container } = render(Responsive, { mode: 'show-desktop', breakpoint: 'xl' });
|
|
73
|
+
const div = container.querySelector('div');
|
|
74
|
+
expect(div?.classList.contains('xl:block')).toBe(true);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('display prop', () => {
|
|
78
|
+
it('uses block display by default', () => {
|
|
79
|
+
const { container } = render(Responsive, { mode: 'show-mobile' });
|
|
80
|
+
const div = container.querySelector('div');
|
|
81
|
+
expect(div?.classList.contains('block')).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
it('uses flex display when specified', () => {
|
|
84
|
+
const { container } = render(Responsive, { mode: 'show-mobile', display: 'flex' });
|
|
85
|
+
const div = container.querySelector('div');
|
|
86
|
+
expect(div?.classList.contains('flex')).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
it('uses grid display when specified', () => {
|
|
89
|
+
const { container } = render(Responsive, { mode: 'show-mobile', display: 'grid' });
|
|
90
|
+
const div = container.querySelector('div');
|
|
91
|
+
expect(div?.classList.contains('grid')).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
it('uses inline display when specified', () => {
|
|
94
|
+
const { container } = render(Responsive, { mode: 'show-mobile', display: 'inline' });
|
|
95
|
+
const div = container.querySelector('div');
|
|
96
|
+
expect(div?.classList.contains('inline')).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
it('uses inline-block display when specified', () => {
|
|
99
|
+
const { container } = render(Responsive, { mode: 'show-mobile', display: 'inline-block' });
|
|
100
|
+
const div = container.querySelector('div');
|
|
101
|
+
expect(div?.classList.contains('inline-block')).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
it('applies display to desktop breakpoint for show-desktop mode', () => {
|
|
104
|
+
const { container } = render(Responsive, { mode: 'show-desktop', display: 'flex' });
|
|
105
|
+
const div = container.querySelector('div');
|
|
106
|
+
expect(div?.classList.contains('lg:flex')).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe('class prop', () => {
|
|
110
|
+
it('applies custom classes', () => {
|
|
111
|
+
const { container } = render(Responsive, { mode: 'show-mobile', class: 'custom-class' });
|
|
112
|
+
const div = container.querySelector('div');
|
|
113
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
it('preserves responsive classes when adding custom classes', () => {
|
|
116
|
+
const { container } = render(Responsive, { mode: 'show-mobile', class: 'custom-class' });
|
|
117
|
+
const div = container.querySelector('div');
|
|
118
|
+
expect(div?.classList.contains('block')).toBe(true);
|
|
119
|
+
expect(div?.classList.contains('lg:hidden')).toBe(true);
|
|
120
|
+
expect(div?.classList.contains('custom-class')).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export * from "./presets/index.js";
|
|
|
8
8
|
export { portal } from "./utils/portal.js";
|
|
9
9
|
export { safeSlide } from "./utils/transitions.js";
|
|
10
10
|
export { typography } from "./tokens/typography.js";
|
|
11
|
+
export { logger, configureLogger } from "./utils/logger.js";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
// =============================================================================
|
|
2
|
-
// PRIMITIVES - Pure visual components (Layer 1)
|
|
3
|
-
// =============================================================================
|
|
4
|
-
export * from './primitives/index.js';
|
|
5
|
-
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// RECIPES - Domain-agnostic compositions (Layer 2)
|
|
8
|
-
// =============================================================================
|
|
9
|
-
export * from './recipes/index.js';
|
|
10
|
-
|
|
11
|
-
// =============================================================================
|
|
12
|
-
// PATTERNS - Layout & flow components (Layer 3)
|
|
13
|
-
// =============================================================================
|
|
14
|
-
export * from './patterns/index.js';
|
|
15
|
-
|
|
16
|
-
// =============================================================================
|
|
17
|
-
// CALENDAR - Domain components (deferred migration to apps)
|
|
18
|
-
// =============================================================================
|
|
19
|
-
export * from './calendar/index.js';
|
|
20
|
-
|
|
21
|
-
// =============================================================================
|
|
22
|
-
// NON-COMPONENT EXPORTS
|
|
23
|
-
// =============================================================================
|
|
24
|
-
|
|
25
|
-
// Note: config.js and telemetry.js removed - they use import.meta.env which
|
|
26
|
-
// is Vite-specific. Apps should define their own config/telemetry locally.
|
|
27
|
-
|
|
28
|
-
// Constants
|
|
29
|
-
export * from './constants/formOptions.js';
|
|
30
|
-
export * from './constants/validation.js';
|
|
31
|
-
|
|
32
|
-
// Presets - Domain-to-color mappings for migration
|
|
33
|
-
export * from './presets/index.js';
|
|
34
|
-
|
|
35
|
-
// Utils / Actions
|
|
36
|
-
export { portal } from './utils/portal.js';
|
|
37
|
-
export { safeSlide } from './utils/transitions.js';
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// PRIMITIVES - Pure visual components (Layer 1)
|
|
3
|
+
// =============================================================================
|
|
4
|
+
export * from './primitives/index.js';
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// RECIPES - Domain-agnostic compositions (Layer 2)
|
|
8
|
+
// =============================================================================
|
|
9
|
+
export * from './recipes/index.js';
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// PATTERNS - Layout & flow components (Layer 3)
|
|
13
|
+
// =============================================================================
|
|
14
|
+
export * from './patterns/index.js';
|
|
15
|
+
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// CALENDAR - Domain components (deferred migration to apps)
|
|
18
|
+
// =============================================================================
|
|
19
|
+
export * from './calendar/index.js';
|
|
20
|
+
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// NON-COMPONENT EXPORTS
|
|
23
|
+
// =============================================================================
|
|
24
|
+
|
|
25
|
+
// Note: config.js and telemetry.js removed - they use import.meta.env which
|
|
26
|
+
// is Vite-specific. Apps should define their own config/telemetry locally.
|
|
27
|
+
|
|
28
|
+
// Constants
|
|
29
|
+
export * from './constants/formOptions.js';
|
|
30
|
+
export * from './constants/validation.js';
|
|
31
|
+
|
|
32
|
+
// Presets - Domain-to-color mappings for migration
|
|
33
|
+
export * from './presets/index.js';
|
|
34
|
+
|
|
35
|
+
// Utils / Actions
|
|
36
|
+
export { portal } from './utils/portal.js';
|
|
37
|
+
export { safeSlide } from './utils/transitions.js';
|
|
38
|
+
export { logger, configureLogger } from './utils/logger.js';
|
|
39
|
+
|
|
40
|
+
// Design Tokens
|
|
41
|
+
export { typography } from './tokens/typography.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { page } from '../../__LIB_STORES__.js';
|
|
3
3
|
import { base } from '../../__LIB_PATHS__.js';
|
|
4
|
+
import { browser } from '../../__LIB_ENVIRONMENT__.js';
|
|
5
|
+
import { onMount } from "svelte";
|
|
4
6
|
import Icon from "../../primitives/Icons/Icon.svelte";
|
|
5
7
|
import { typography } from '../../tokens/typography';
|
|
6
8
|
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
links = [],
|
|
19
21
|
}: Props = $props();
|
|
20
22
|
|
|
21
|
-
let
|
|
23
|
+
let invitationCount = $state(0);
|
|
22
24
|
|
|
23
25
|
let currentPath = $derived($page.url.pathname);
|
|
24
26
|
|
|
@@ -29,17 +31,25 @@
|
|
|
29
31
|
return path.startsWith(href);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
onMount(() => {
|
|
35
|
+
async function fetchShows() {
|
|
34
36
|
try {
|
|
35
37
|
const res = await fetch(`/api/getEventsForVenue`);
|
|
36
|
-
if (!res.ok)
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
// Silently ignore auth errors - user may not be logged in yet
|
|
40
|
+
if (res.status === 401) return;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
37
43
|
const events = await res.json();
|
|
38
|
-
|
|
44
|
+
invitationCount = events.filter((event: { acceptedState: number }) => event.acceptedState === 0).length;
|
|
39
45
|
} catch (err) {
|
|
40
|
-
|
|
46
|
+
// Silently fail - this is non-critical UI enhancement
|
|
41
47
|
}
|
|
42
|
-
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (browser) {
|
|
51
|
+
fetchShows();
|
|
52
|
+
}
|
|
43
53
|
});
|
|
44
54
|
</script>
|
|
45
55
|
|
|
@@ -56,7 +66,7 @@
|
|
|
56
66
|
>
|
|
57
67
|
<span class="bottom-nav-icon relative flex items-center justify-center transition-transform duration-150 active:scale-[0.8]">
|
|
58
68
|
<Icon name={icon} size="24" />
|
|
59
|
-
{#if label === "Shows" &&
|
|
69
|
+
{#if label === "Shows" && invitationCount > 0}
|
|
60
70
|
<span class="notification-dot absolute -top-1 -right-1 w-2 h-2 bg-red-500 rounded-full"></span>
|
|
61
71
|
{/if}
|
|
62
72
|
</span>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomNav.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/navigation/BottomNav.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomNav.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/navigation/BottomNav.svelte.ts"],"names":[],"mappings":"AAWE,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;CACnB;AAiEH,QAAA,MAAM,SAAS,2CAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|