@dcrackel/hematournamentui 1.0.707 → 1.0.709

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 (61) hide show
  1. package/AGENTS.md +118 -118
  2. package/README.md +132 -106
  3. package/dist/HemaTournamentUI-lib.es.js +7111 -7006
  4. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  5. package/dist/hematournamentui-tailwind.css +198 -412
  6. package/package.json +10 -10
  7. package/src/index.js +2 -0
  8. package/src/mocks/getDEBouts-42Fencers.js +4 -4
  9. package/src/mocks/getDEBouts-TableOf128.js +37 -0
  10. package/src/mocks/getDEBouts-TableOf64.js +35 -0
  11. package/src/stories/Atoms/Input/BaseInput.test.js +97 -85
  12. package/src/stories/Atoms/Input/BaseInput.vue +149 -150
  13. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -0
  14. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -0
  15. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -0
  16. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +3 -2
  17. package/src/stories/Molecules/Modals/EditBoutModal/EditBoutModal.vue +1 -1
  18. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -0
  19. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -0
  20. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -0
  21. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -278
  22. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +60 -98
  23. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +103 -4
  24. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +256 -215
  25. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -92
  26. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -128
  27. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +14 -4
  28. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -20
  29. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -0
  30. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -133
  31. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +2 -2
  32. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +131 -3
  33. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +287 -89
  34. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -0
  35. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -0
  36. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -0
  37. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -0
  38. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -0
  39. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -0
  40. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +57 -0
  41. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +65 -0
  42. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +31 -29
  43. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +146 -18
  44. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +52 -2
  45. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +53 -17
  46. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +39 -0
  47. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -0
  48. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -0
  49. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +14 -0
  50. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -0
  51. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +13 -3
  52. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -172
  53. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -103
  54. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -0
  55. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -213
  56. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -0
  57. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -29
  58. package/src/stories/Organisms/Cards/TableauBoutCard/SpacingConfig.js +0 -111
  59. package/src/stories/Organisms/Containers/TableauLines/SpacingConfig.js +0 -162
  60. package/src/stories/Organisms/Containers/TableauLines/TableauLines.stories.js +0 -21
  61. package/src/stories/Organisms/Containers/TableauLines/TableauLines.vue +0 -78
@@ -1,128 +1,80 @@
1
- <!-- TableauFencerCard.vue -->
2
- <template>
3
- <section
4
- class="bg-poolSetup flex rounded-md border"
5
- @mouseover="handleHighLight(true)"
6
- @mouseout="handleHighLight(false)"
7
- :class="[width, highLighted, opacity]"
8
- >
9
- <!-- Left position -->
10
- <div class="text-center px-1 w-5 flex items-center justify-center rounded-l-md z-50" :class="[`bg-${color}`]">
11
- <BaseText :text="position" size="xs" color="neutral" />
12
- </div>
13
-
14
- <div class="flex w-full items-center">
15
- <!-- Portrait and Name/Club -->
16
- <div class="flex w-full">
17
- <div v-if="large" class="">
18
- <div v-if="!portraitURL" class="w-9 h-9 rounded-r-md bg-dropdownSelect flex items-center justify-center">
19
- <BaseText text="" size="sm" color="neutral" weight="bold" />
20
- </div>
21
- <img v-if="portraitURL" :src="portraitURL" alt="Portrait" class="w-9 h-9 rounded-r-md" />
22
- </div>
23
- <div class="flex flex-col justify-center ml-2">
24
- <BaseText
25
- :text="name"
26
- :size="large ? 'sm' : 'xs'"
27
- :weight="large ? 'bold' : 'normal'"
28
- color="quaternary"
29
- class="truncate text-nowrap overflow-hidden"
30
- />
31
- <BaseText
32
- v-if="club.length > 1 && large"
33
- color="quinary"
34
- :text="club.substring(0, 28)"
35
- size="xs"
36
- class="truncate text-nowrap overflow-hidden"
37
- />
38
- </div>
39
- </div>
40
- </div>
41
-
42
- <!-- Right position (Score) -->
43
- <div class="text-center px-1 w-5 flex items-center justify-center rounded-r-md" :class="scoreColor">
44
- <BaseText :text="fencerScore" size="xs" color="neutral" />
45
- </div>
46
- </section>
47
- </template>
48
-
49
- <script>
50
- import BaseText from '../../../Atoms/Text/BaseText.vue';
51
-
52
- export default {
53
- name: 'TableauFencerCard',
54
- emits: ['action:highLight'],
55
- components: { BaseText },
56
- props: {
57
- fencer: {
58
- type: Object,
59
- required: true
60
- },
61
- score: {
62
- type: String,
63
- required: true
64
- },
65
- position: {
66
- type: [String, Number],
67
- required: true
68
- },
69
- color: {
70
- type: String,
71
- required: true
72
- },
73
- scoreColor: {
74
- type: String,
75
- required: true
76
- },
77
- large: {
78
- type: Boolean,
79
- default: true
80
- },
81
- highLight: {
82
- type: Boolean,
83
- default: false
84
- },
85
- faded: {
86
- type: Boolean,
87
- default: false
88
- },
89
- isCountingBackwardsMaxScore: {
90
- type: Number,
91
- default: 0
92
- }
93
- },
94
- computed: {
95
- portraitURL() {
96
- const images = this.fencer.Images || [];
97
- const portrait = images.find(image => image.URL);
98
- return portrait ? portrait.URL : '';
99
- },
100
- fencerScore() {
101
- const rawScore = this.score;
102
- return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - rawScore : rawScore;
103
- },
104
- name() {
105
- //if (this.fencer.DisplayName === "BYE") return "";
106
- return this.fencer.DisplayName;
107
- },
108
- club() {
109
- if (this.fencer.DisplayName === 'BYE' || this.fencer.DisplayName === '') return '';
110
- return this.fencer.Club.Name;
111
- },
112
- width() {
113
- return this.large ? ' w-72' : ' w-40';
114
- },
115
- highLighted() {
116
- return this.highLight ? 'border-bright' : 'border-poolSetup';
117
- },
118
- opacity() {
119
- return this.faded ? 'opacity-60 shadow-md' : 'shadow-xl';
120
- }
121
- },
122
- methods: {
123
- handleHighLight(value) {
124
- this.$emit('action:highLight', value);
125
- }
126
- }
127
- };
128
- </script>
1
+ <template>
2
+ <section class="flex h-7 w-40 overflow-hidden border border-poolSetup bg-poolSetup" :class="cornerClass">
3
+ <div class="flex w-5 shrink-0 items-center justify-center px-1" :class="positionColorClass">
4
+ <BaseText :text="position" size="xs" color="neutral" />
5
+ </div>
6
+
7
+ <div class="flex min-w-0 flex-1 items-center px-2">
8
+ <BaseText :text="name" size="xs" color="quaternary" class="truncate whitespace-nowrap" />
9
+ </div>
10
+
11
+ <div class="flex w-7 shrink-0 items-center justify-center border-l border-poolSetup" :class="scoreColor">
12
+ <BaseText v-if="showScore" :text="displayedScore" size="xs" color="neutral" />
13
+ </div>
14
+ </section>
15
+ </template>
16
+
17
+ <script>
18
+ import BaseText from '../../../Atoms/Text/BaseText.vue';
19
+
20
+ const cornerClasses = {
21
+ none: '',
22
+ top: 'rounded-t',
23
+ bottom: 'rounded-b'
24
+ };
25
+
26
+ export default {
27
+ name: 'TableauFencerCard',
28
+ components: { BaseText },
29
+ props: {
30
+ fencer: {
31
+ type: Object,
32
+ required: true
33
+ },
34
+ score: {
35
+ type: String,
36
+ required: true
37
+ },
38
+ position: {
39
+ type: [String, Number],
40
+ required: true
41
+ },
42
+ color: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ scoreColor: {
47
+ type: String,
48
+ required: true
49
+ },
50
+ showScore: {
51
+ type: Boolean,
52
+ default: true
53
+ },
54
+ isCountingBackwardsMaxScore: {
55
+ type: Number,
56
+ default: 0
57
+ },
58
+ corners: {
59
+ type: String,
60
+ default: 'none',
61
+ validator: value => Object.hasOwn(cornerClasses, value)
62
+ }
63
+ },
64
+ computed: {
65
+ cornerClass() {
66
+ return cornerClasses[this.corners];
67
+ },
68
+ displayedScore() {
69
+ const score = Number(this.score || 0);
70
+ return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - score : score;
71
+ },
72
+ name() {
73
+ return String(this.fencer?.DisplayName || '');
74
+ },
75
+ positionColorClass() {
76
+ return this.color ? `bg-${this.color}` : 'bg-dropdownSelect';
77
+ }
78
+ }
79
+ };
80
+ </script>
@@ -18,9 +18,18 @@
18
18
  </div>
19
19
 
20
20
  <div class="flex flex-col w-3/4 md:w-4/12 justify-start">
21
- <button class="flex justify-start overflow-hidden text-left" type="button" @click="handleForwardToProfile">
22
- <BaseText :text="displayName" size="md" color="quaternary" weight="bold" class="text-sm md:text-xl truncate" />
23
- </button>
21
+ <div class="flex items-center justify-start gap-2 min-w-0">
22
+ <button class="min-w-0 text-left" type="button" @click="handleForwardToProfile">
23
+ <BaseText
24
+ :text="displayName"
25
+ size="md"
26
+ color="quaternary"
27
+ weight="bold"
28
+ class="text-sm md:text-xl truncate"
29
+ />
30
+ </button>
31
+ <MissingHemaRatingsId :person="person.Person" />
32
+ </div>
24
33
  <span class="w-full flex justify-start">
25
34
  <BaseText :text="clubName" size="md" color="quinary" weight="normal" class="hidden md:block" />
26
35
  <BaseText :text="clubShortName" size="xs" color="quinary" weight="normal" class="block md:hidden" />
@@ -86,10 +95,11 @@
86
95
  import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
87
96
  import BaseText from '../../../Atoms/Text/BaseText.vue';
88
97
  import BaseButton from '../../../Molecules/Buttons/BaseButton/BaseButton.vue';
98
+ import MissingHemaRatingsId from '../../../Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue';
89
99
 
90
100
  export default {
91
101
  name: 'WaitlistFencerCard',
92
- components: { BaseButton, BaseIcon, BaseText },
102
+ components: { BaseButton, BaseIcon, BaseText, MissingHemaRatingsId },
93
103
  emits: ['forward:toProfile', 'move:active', 'remove:fencer'],
94
104
  props: {
95
105
  person: {
@@ -1,20 +1,31 @@
1
- import GenericImageCropper from './ImageCropper.vue';
2
-
3
- export default {
4
- title: 'Organisms/ComplexInputs/ImageCropper',
5
- component: GenericImageCropper,
6
- tags: ['autodocs'],
7
- args: {},
8
- argTypes: {
9
- personID: {
10
- control: 'number',
11
- description: 'The ID of the person for the image cropper'
12
- }
13
- }
14
- };
15
-
16
- export const Default = {
17
- args: {
18
- personID: 1
19
- }
20
- };
1
+ import GenericImageCropper from './ImageCropper.vue';
2
+
3
+ export default {
4
+ title: 'Organisms/ComplexInputs/ImageCropper',
5
+ component: GenericImageCropper,
6
+ tags: ['autodocs'],
7
+ args: { urlToImage: '', isProfile: true, disabled: false },
8
+ argTypes: {
9
+ urlToImage: { control: 'text' },
10
+ uploadImageName: { control: 'text' },
11
+ uploadServer: { control: 'text' },
12
+ imageServer: { control: 'text' },
13
+ isProfile: { control: 'boolean' },
14
+ disabled: { control: 'boolean' },
15
+ 'update:url': { action: 'update:url' },
16
+ 'update:uploading': { action: 'update:uploading' },
17
+ 'error:load': { action: 'error:load' },
18
+ 'error:upload': { action: 'error:upload' }
19
+ }
20
+ };
21
+
22
+ export const Default = {
23
+ args: {
24
+ urlToImage: '',
25
+ isProfile: true
26
+ }
27
+ };
28
+
29
+ export const Disabled = {
30
+ args: { urlToImage: '', isProfile: true, disabled: true }
31
+ };
@@ -0,0 +1,109 @@
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+ import { enableAutoUnmount, mount } from '@vue/test-utils';
3
+ import ImageCropper from './ImageCropper.vue';
4
+
5
+ enableAutoUnmount(afterEach);
6
+
7
+ const mountCropper = props =>
8
+ mount(ImageCropper, {
9
+ props: {
10
+ urlToImage: 'https://images.example/profile.png',
11
+ imageServer: 'https://images.example/',
12
+ uploadImageName: 'profile',
13
+ isProfile: true,
14
+ ...props
15
+ },
16
+ global: { stubs: { AvatarCropper: true } }
17
+ });
18
+
19
+ describe('ImageCropper upload draft events', () => {
20
+ it('emits a successful upload URL and previews it with a fresh cache key', async () => {
21
+ const wrapper = mountCropper({ uploadImageName: 'new-profile' });
22
+ wrapper.vm.handleUploading();
23
+ wrapper.vm.handleUploaded({ response: { status: 201 } });
24
+ await wrapper.vm.$nextTick();
25
+
26
+ expect(wrapper.emitted('update:url')).toEqual([['https://images.example/new-profile.png']]);
27
+ expect(wrapper.emitted('update:uploading')).toEqual([[true], [false]]);
28
+ const preview = new URL(wrapper.find('img').attributes('src'));
29
+ expect(preview.pathname).toBe('/new-profile.png');
30
+ expect(preview.searchParams.has('preview')).toBe(true);
31
+ await wrapper.setProps({ urlToImage: 'https://images.example/new-profile.png' });
32
+ expect(wrapper.find('img').attributes('src')).toBe(preview.href);
33
+ });
34
+
35
+ it('refreshes the preview even when an upload overwrites the existing URL', async () => {
36
+ const wrapper = mountCropper();
37
+ wrapper.vm.handleUploaded({ response: { status: 200 } });
38
+ await wrapper.vm.$nextTick();
39
+ expect(wrapper.find('img').attributes('src')).toContain('/profile.png?preview=');
40
+ expect(wrapper.emitted('update:url')).toEqual([['https://images.example/profile.png']]);
41
+ });
42
+
43
+ it('keeps the previous image and reports unsuccessful responses separately', () => {
44
+ const wrapper = mountCropper();
45
+ wrapper.vm.handleUploading();
46
+ wrapper.vm.handleUploaded({ response: { status: 500 } });
47
+ expect(wrapper.vm.uploading).toBe(false);
48
+ expect(wrapper.vm.localImageUrl).toBe('https://images.example/profile.png');
49
+ expect(wrapper.emitted('update:url')).toBeUndefined();
50
+ expect(wrapper.emitted('error:upload')[0][0]).toMatchObject({ message: 'Image upload failed.', status: 500 });
51
+ });
52
+
53
+ it('reports malformed upload responses without crashing or emitting an edit', () => {
54
+ const wrapper = mountCropper();
55
+ wrapper.vm.handleUploaded(undefined);
56
+ expect(wrapper.emitted('update:url')).toBeUndefined();
57
+ expect(wrapper.emitted('error:upload')).toHaveLength(1);
58
+ });
59
+
60
+ it('rejects unsafe uploaded URLs', () => {
61
+ const wrapper = mountCropper({ imageServer: 'javascript:' });
62
+ wrapper.vm.handleUploaded({ response: { status: 200 } });
63
+ expect(wrapper.emitted('update:url')).toBeUndefined();
64
+ expect(wrapper.emitted('error:upload')[0][0].message).toContain('valid image URL');
65
+ });
66
+
67
+ it('shows a placeholder on image-load failure and leaves the draft URL intact', async () => {
68
+ const wrapper = mountCropper();
69
+ await wrapper.find('img').trigger('error');
70
+ expect(wrapper.emitted('update:url')).toBeUndefined();
71
+ expect(wrapper.emitted('error:load')[0][0]).toMatchObject({ url: 'https://images.example/profile.png' });
72
+ expect(wrapper.find('img').attributes('src')).not.toBe('https://images.example/profile.png');
73
+ expect(wrapper.vm.localImageUrl).toBe('https://images.example/profile.png');
74
+ expect(wrapper.vm.showCropper).toBe(false);
75
+ });
76
+
77
+ it('reconciles authoritative URL changes after a failed preview', async () => {
78
+ const wrapper = mountCropper();
79
+ await wrapper.find('img').trigger('error');
80
+ await wrapper.setProps({ urlToImage: 'https://images.example/confirmed.png' });
81
+ expect(wrapper.find('img').attributes('src')).toBe('https://images.example/confirmed.png');
82
+ });
83
+
84
+ it('reports the cropper upload error and releases the busy state', () => {
85
+ const wrapper = mountCropper();
86
+ wrapper.vm.handleUploading();
87
+ wrapper.vm.handlerError({ type: 'upload', message: 'Upload rejected', context: { response: { status: 413 } } });
88
+ expect(wrapper.emitted('error:upload')).toEqual([[{ message: 'Upload rejected', status: 413 }]]);
89
+ expect(wrapper.vm.uploading).toBe(false);
90
+ expect(wrapper.emitted('update:url')).toBeUndefined();
91
+ });
92
+
93
+ it('reports rejected upload requests and releases the busy state', async () => {
94
+ const wrapper = mountCropper();
95
+ const response = Promise.reject(new Error('Network unavailable'));
96
+ wrapper.vm.handleUploading({ response });
97
+ await wrapper.vm.$nextTick();
98
+ expect(wrapper.vm.uploading).toBe(false);
99
+ expect(wrapper.emitted('error:upload')[0][0].message).toBe('Network unavailable');
100
+ expect(wrapper.emitted('update:url')).toBeUndefined();
101
+ });
102
+
103
+ it('disables the native image selector and guards programmatic opening', () => {
104
+ const wrapper = mountCropper({ disabled: true });
105
+ expect(wrapper.find('button').attributes('disabled')).toBeDefined();
106
+ wrapper.vm.setShowCropper();
107
+ expect(wrapper.vm.showCropper).toBe(false);
108
+ });
109
+ });