@dcrackel/hematournamentui 1.0.712 → 1.0.713
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/.prettierignore +7 -7
- package/.storybook/main.js +3 -1
- package/README.md +30 -0
- package/package.json +96 -96
- package/prettier.config.js +16 -16
- package/src/main.js +1 -1
- package/src/mocks/getDEBouts-TableOf128.js +37 -37
- package/src/mocks/getDEBouts-TableOf64.js +35 -35
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
- package/src/stories/Atoms/Input/BaseInput.vue +149 -149
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
- package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
- package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -33
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -45
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -103
- package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
- package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
- package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
- package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
- package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -29
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -46
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
- package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
- package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
- package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
- package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
- package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +123 -12
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +178 -166
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +35 -7
- package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +42 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +80 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
- package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
- package/src/stories/Util/Validations/PriceValidation.js +6 -6
- package/src/stories/Util/boutDirectorAssignment.js +46 -0
- package/src/stories/Util/registrationStatus.js +11 -11
- package/src/stories/Util/tabs.js +19 -47
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="iconName ? '' : ''">
|
|
3
|
-
<input
|
|
4
|
-
ref="input"
|
|
5
|
-
:value="internalValue"
|
|
6
|
-
:class="baseClasses"
|
|
7
|
-
:placeholder="placeholder"
|
|
8
|
-
:type="inputType"
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
:aria-invalid="invalid"
|
|
11
|
-
@input="onInput"
|
|
12
|
-
@focus="onFocus"
|
|
13
|
-
@blur="onBlur"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
const sizeClasses = {
|
|
20
|
-
xs: ' text-xs',
|
|
21
|
-
sm: ' text-sm',
|
|
22
|
-
md: ' text-md',
|
|
23
|
-
lg: ' text-lg',
|
|
24
|
-
xl: ' text-xl',
|
|
25
|
-
'2xl': ' text-2xl',
|
|
26
|
-
'3xl': ' text-3xl',
|
|
27
|
-
'4xl': ' text-4xl',
|
|
28
|
-
'5xl': ' text-5xl'
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
name: 'BaseInput',
|
|
33
|
-
emits: ['update:value'],
|
|
34
|
-
props: {
|
|
35
|
-
placeholder: {
|
|
36
|
-
type: [String, Number],
|
|
37
|
-
default: ''
|
|
38
|
-
},
|
|
39
|
-
value: {
|
|
40
|
-
type: [String, Number],
|
|
41
|
-
default: ''
|
|
42
|
-
},
|
|
43
|
-
inputType: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: 'text'
|
|
46
|
-
},
|
|
47
|
-
invalid: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
51
|
-
addBorder: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
iconName: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: ''
|
|
58
|
-
},
|
|
59
|
-
disabled: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: false
|
|
62
|
-
},
|
|
63
|
-
iconStyle: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: 'fa-solid',
|
|
66
|
-
validator: value => ['fa-solid', 'fa-regular', 'fa-light', 'fa-thing'].includes(value)
|
|
67
|
-
},
|
|
68
|
-
size: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: 'sm',
|
|
71
|
-
validator: value => ['', ' ', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'].includes(value)
|
|
72
|
-
},
|
|
73
|
-
centerInput: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
default: false
|
|
76
|
-
},
|
|
77
|
-
iconColor: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: 'primary',
|
|
80
|
-
validator: value =>
|
|
81
|
-
['neutral', 'primary', 'secondary', 'tertiary', 'quaternary', 'quinary', 'bright', 'white', 'alarm'].includes(
|
|
82
|
-
value
|
|
83
|
-
)
|
|
84
|
-
},
|
|
85
|
-
allowPercent: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
data() {
|
|
91
|
-
return {
|
|
92
|
-
internalValue: this.value,
|
|
93
|
-
currentPlaceholder: this.placeholder
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
computed: {
|
|
97
|
-
baseClasses() {
|
|
98
|
-
let classes = 'appearance-none focus:outline-none w-full text-sm rounded-lg text-quinary';
|
|
99
|
-
if (this.addBorder) {
|
|
100
|
-
classes += this.invalid ? ' border border-alarm p-2' : ' border border-dropdownSelect p-2';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (this.centerInput) classes += ' text-center';
|
|
104
|
-
|
|
105
|
-
classes += sizeClasses[this.size] || '';
|
|
106
|
-
|
|
107
|
-
return classes;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
watch: {
|
|
111
|
-
value(newValue) {
|
|
112
|
-
this.internalValue = newValue;
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
methods: {
|
|
116
|
-
onInput(event) {
|
|
117
|
-
if (this.disabled) return;
|
|
118
|
-
const input = event.target;
|
|
119
|
-
let sanitizedValue = input.value;
|
|
120
|
-
|
|
121
|
-
if (this.inputType === 'number') {
|
|
122
|
-
sanitizedValue = sanitizedValue.replace(/\D/g, '');
|
|
123
|
-
}
|
|
124
|
-
if (this.inputType === 'text') {
|
|
125
|
-
this.allowPercent
|
|
126
|
-
? (sanitizedValue = sanitizedValue.replace(/[\\'"=*<>|#$^(){}\[\]]/g, ''))
|
|
127
|
-
: (sanitizedValue = sanitizedValue.replace(/[\\'"=*<>|#$%^(){}\[\]]/g, ''));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.internalValue = sanitizedValue;
|
|
131
|
-
input.value = sanitizedValue;
|
|
132
|
-
this.$emit('update:value', sanitizedValue);
|
|
133
|
-
},
|
|
134
|
-
onFocus() {
|
|
135
|
-
this.currentPlaceholder = '';
|
|
136
|
-
},
|
|
137
|
-
onBlur() {
|
|
138
|
-
if (!this.internalValue) {
|
|
139
|
-
this.currentPlaceholder = this.placeholder;
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
focus() {
|
|
143
|
-
if (this.$refs.input) {
|
|
144
|
-
this.$refs.input.focus();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="iconName ? '' : ''">
|
|
3
|
+
<input
|
|
4
|
+
ref="input"
|
|
5
|
+
:value="internalValue"
|
|
6
|
+
:class="baseClasses"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:type="inputType"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:aria-invalid="invalid"
|
|
11
|
+
@input="onInput"
|
|
12
|
+
@focus="onFocus"
|
|
13
|
+
@blur="onBlur"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
const sizeClasses = {
|
|
20
|
+
xs: ' text-xs',
|
|
21
|
+
sm: ' text-sm',
|
|
22
|
+
md: ' text-md',
|
|
23
|
+
lg: ' text-lg',
|
|
24
|
+
xl: ' text-xl',
|
|
25
|
+
'2xl': ' text-2xl',
|
|
26
|
+
'3xl': ' text-3xl',
|
|
27
|
+
'4xl': ' text-4xl',
|
|
28
|
+
'5xl': ' text-5xl'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
name: 'BaseInput',
|
|
33
|
+
emits: ['update:value'],
|
|
34
|
+
props: {
|
|
35
|
+
placeholder: {
|
|
36
|
+
type: [String, Number],
|
|
37
|
+
default: ''
|
|
38
|
+
},
|
|
39
|
+
value: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
inputType: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'text'
|
|
46
|
+
},
|
|
47
|
+
invalid: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
addBorder: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
iconName: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
},
|
|
59
|
+
disabled: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
iconStyle: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'fa-solid',
|
|
66
|
+
validator: value => ['fa-solid', 'fa-regular', 'fa-light', 'fa-thing'].includes(value)
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'sm',
|
|
71
|
+
validator: value => ['', ' ', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl'].includes(value)
|
|
72
|
+
},
|
|
73
|
+
centerInput: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
iconColor: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'primary',
|
|
80
|
+
validator: value =>
|
|
81
|
+
['neutral', 'primary', 'secondary', 'tertiary', 'quaternary', 'quinary', 'bright', 'white', 'alarm'].includes(
|
|
82
|
+
value
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
allowPercent: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
data() {
|
|
91
|
+
return {
|
|
92
|
+
internalValue: this.value,
|
|
93
|
+
currentPlaceholder: this.placeholder
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
baseClasses() {
|
|
98
|
+
let classes = 'appearance-none focus:outline-none w-full text-sm rounded-lg text-quinary';
|
|
99
|
+
if (this.addBorder) {
|
|
100
|
+
classes += this.invalid ? ' border border-alarm p-2' : ' border border-dropdownSelect p-2';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.centerInput) classes += ' text-center';
|
|
104
|
+
|
|
105
|
+
classes += sizeClasses[this.size] || '';
|
|
106
|
+
|
|
107
|
+
return classes;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
watch: {
|
|
111
|
+
value(newValue) {
|
|
112
|
+
this.internalValue = newValue;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
methods: {
|
|
116
|
+
onInput(event) {
|
|
117
|
+
if (this.disabled) return;
|
|
118
|
+
const input = event.target;
|
|
119
|
+
let sanitizedValue = input.value;
|
|
120
|
+
|
|
121
|
+
if (this.inputType === 'number') {
|
|
122
|
+
sanitizedValue = sanitizedValue.replace(/\D/g, '');
|
|
123
|
+
}
|
|
124
|
+
if (this.inputType === 'text') {
|
|
125
|
+
this.allowPercent
|
|
126
|
+
? (sanitizedValue = sanitizedValue.replace(/[\\'"=*<>|#$^(){}\[\]]/g, ''))
|
|
127
|
+
: (sanitizedValue = sanitizedValue.replace(/[\\'"=*<>|#$%^(){}\[\]]/g, ''));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.internalValue = sanitizedValue;
|
|
131
|
+
input.value = sanitizedValue;
|
|
132
|
+
this.$emit('update:value', sanitizedValue);
|
|
133
|
+
},
|
|
134
|
+
onFocus() {
|
|
135
|
+
this.currentPlaceholder = '';
|
|
136
|
+
},
|
|
137
|
+
onBlur() {
|
|
138
|
+
if (!this.internalValue) {
|
|
139
|
+
this.currentPlaceholder = this.placeholder;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
focus() {
|
|
143
|
+
if (this.$refs.input) {
|
|
144
|
+
this.$refs.input.focus();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
</script>
|
package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import MissingHemaRatingsId from './MissingHemaRatingsId.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Molecules/Indicators/MissingHemaRatingsId',
|
|
5
|
-
component: MissingHemaRatingsId,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
args: { person: { HemaRatingsId: null } },
|
|
8
|
-
argTypes: {
|
|
9
|
-
person: { control: 'object' }
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const MissingId = {
|
|
14
|
-
args: { person: { HemaRatingsId: null } }
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const UnratedWithId = {
|
|
18
|
-
args: { person: { HemaRatingsId: 10255, HEMARatings: [] } }
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const IdFromRating = {
|
|
22
|
-
args: { person: { HEMARatings: [{ HemaRatingId: 10255, Rating: 1708.8 }] } }
|
|
23
|
-
};
|
|
1
|
+
import MissingHemaRatingsId from './MissingHemaRatingsId.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Molecules/Indicators/MissingHemaRatingsId',
|
|
5
|
+
component: MissingHemaRatingsId,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
args: { person: { HemaRatingsId: null } },
|
|
8
|
+
argTypes: {
|
|
9
|
+
person: { control: 'object' }
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const MissingId = {
|
|
14
|
+
args: { person: { HemaRatingsId: null } }
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const UnratedWithId = {
|
|
18
|
+
args: { person: { HemaRatingsId: 10255, HEMARatings: [] } }
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const IdFromRating = {
|
|
22
|
+
args: { person: { HEMARatings: [{ HemaRatingId: 10255, Rating: 1708.8 }] } }
|
|
23
|
+
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span
|
|
3
|
-
v-if="!hasHemaRatingsId"
|
|
4
|
-
role="img"
|
|
5
|
-
aria-label="Missing HEMA Ratings ID"
|
|
6
|
-
title="Missing HEMA Ratings ID"
|
|
7
|
-
data-testid="missing-hema-ratings-id"
|
|
8
|
-
class="inline-flex shrink-0 items-center justify-center text-alarm"
|
|
9
|
-
>
|
|
10
|
-
<svg class="h-6 w-6 md:h-7 md:w-7" viewBox="0 0 32 32" fill="none" aria-hidden="true">
|
|
11
|
-
<circle cx="16" cy="16" r="13" stroke="currentColor" stroke-width="2" />
|
|
12
|
-
<text x="16" y="20" text-anchor="middle" fill="currentColor" class="font-bold" font-size="11">HR</text>
|
|
13
|
-
<path d="M7 25 25 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
|
14
|
-
</svg>
|
|
15
|
-
</span>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
export default {
|
|
20
|
-
name: 'MissingHemaRatingsId',
|
|
21
|
-
props: {
|
|
22
|
-
person: {
|
|
23
|
-
type: Object,
|
|
24
|
-
default: null
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
computed: {
|
|
28
|
-
hasHemaRatingsId() {
|
|
29
|
-
const id = this.person?.HemaRatingsId ?? this.person?.HEMARatings?.[0]?.HemaRatingId;
|
|
30
|
-
const numericId = Number(id);
|
|
31
|
-
return Number.isInteger(numericId) && numericId > 0;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
v-if="!hasHemaRatingsId"
|
|
4
|
+
role="img"
|
|
5
|
+
aria-label="Missing HEMA Ratings ID"
|
|
6
|
+
title="Missing HEMA Ratings ID"
|
|
7
|
+
data-testid="missing-hema-ratings-id"
|
|
8
|
+
class="inline-flex shrink-0 items-center justify-center text-alarm"
|
|
9
|
+
>
|
|
10
|
+
<svg class="h-6 w-6 md:h-7 md:w-7" viewBox="0 0 32 32" fill="none" aria-hidden="true">
|
|
11
|
+
<circle cx="16" cy="16" r="13" stroke="currentColor" stroke-width="2" />
|
|
12
|
+
<text x="16" y="20" text-anchor="middle" fill="currentColor" class="font-bold" font-size="11">HR</text>
|
|
13
|
+
<path d="M7 25 25 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
|
14
|
+
</svg>
|
|
15
|
+
</span>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
name: 'MissingHemaRatingsId',
|
|
21
|
+
props: {
|
|
22
|
+
person: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: null
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
hasHemaRatingsId() {
|
|
29
|
+
const id = this.person?.HemaRatingsId ?? this.person?.HEMARatings?.[0]?.HemaRatingId;
|
|
30
|
+
const numericId = Number(id);
|
|
31
|
+
return Number.isInteger(numericId) && numericId > 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="statusLabel" class="inline-flex items-center gap-2 whitespace-nowrap">
|
|
3
|
-
<span class="sr-only">Registration status:</span>
|
|
4
|
-
<BaseIcon icon-name="fa-info-circle" size="xs" color="quaternary" aria-hidden="true" />
|
|
5
|
-
<BaseText :text="statusLabel" size="xs" color="quaternary" />
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
|
|
11
|
-
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
12
|
-
|
|
13
|
-
import { getRegistrationStatusLabel } from '../../../Util/registrationStatus.js';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: 'RegistrationStatus',
|
|
17
|
-
components: { BaseIcon, BaseText },
|
|
18
|
-
props: {
|
|
19
|
-
status: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: ''
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
computed: {
|
|
25
|
-
statusLabel() {
|
|
26
|
-
return getRegistrationStatusLabel(this.status);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="statusLabel" class="inline-flex items-center gap-2 whitespace-nowrap">
|
|
3
|
+
<span class="sr-only">Registration status:</span>
|
|
4
|
+
<BaseIcon icon-name="fa-info-circle" size="xs" color="quaternary" aria-hidden="true" />
|
|
5
|
+
<BaseText :text="statusLabel" size="xs" color="quaternary" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
|
|
11
|
+
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
12
|
+
|
|
13
|
+
import { getRegistrationStatusLabel } from '../../../Util/registrationStatus.js';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'RegistrationStatus',
|
|
17
|
+
components: { BaseIcon, BaseText },
|
|
18
|
+
props: {
|
|
19
|
+
status: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
statusLabel() {
|
|
26
|
+
return getRegistrationStatusLabel(this.status);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { mount, DOMWrapper } from '@vue/test-utils';
|
|
2
|
+
import { nextTick } from 'vue';
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import HoverActions from './HoverActions.vue';
|
|
5
|
+
|
|
6
|
+
const wrappers = [];
|
|
7
|
+
const actions = [
|
|
8
|
+
{ id: 'open', label: 'Open bout' },
|
|
9
|
+
{ id: 'assign-director', label: 'Assign director...', description: 'Dave Smith' }
|
|
10
|
+
];
|
|
11
|
+
const mountMenu = (props = {}) => {
|
|
12
|
+
const wrapper = mount(HoverActions, {
|
|
13
|
+
attachTo: document.body,
|
|
14
|
+
props: { actions, ...props },
|
|
15
|
+
slots: { default: '<button type="button" data-testid="pairing">Pairing</button>' }
|
|
16
|
+
});
|
|
17
|
+
wrappers.push(wrapper);
|
|
18
|
+
return wrapper;
|
|
19
|
+
};
|
|
20
|
+
const getPanel = () => new DOMWrapper(document.querySelector('[data-testid="bout-actions-menu"]'));
|
|
21
|
+
const hoverMenu = async wrapper => {
|
|
22
|
+
await wrapper.trigger('mouseenter');
|
|
23
|
+
vi.advanceTimersByTime(200);
|
|
24
|
+
await nextTick();
|
|
25
|
+
await nextTick();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
beforeEach(() => vi.useFakeTimers());
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
wrappers.splice(0).forEach(wrapper => wrapper.unmount());
|
|
31
|
+
vi.useRealTimers();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('HoverActions', () => {
|
|
35
|
+
it('waits briefly before opening and cancels a passing hover', async () => {
|
|
36
|
+
const wrapper = mountMenu();
|
|
37
|
+
await wrapper.trigger('mouseenter');
|
|
38
|
+
vi.advanceTimersByTime(100);
|
|
39
|
+
await nextTick();
|
|
40
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
41
|
+
await wrapper.trigger('mouseleave');
|
|
42
|
+
vi.advanceTimersByTime(300);
|
|
43
|
+
await nextTick();
|
|
44
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
45
|
+
await hoverMenu(wrapper);
|
|
46
|
+
expect(getPanel().text()).toContain('Assign director...');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('keeps the menu open while crossing from the pairing into it', async () => {
|
|
50
|
+
const wrapper = mountMenu();
|
|
51
|
+
await hoverMenu(wrapper);
|
|
52
|
+
await wrapper.trigger('mouseleave');
|
|
53
|
+
vi.advanceTimersByTime(70);
|
|
54
|
+
await getPanel().trigger('mouseenter');
|
|
55
|
+
vi.advanceTimersByTime(250);
|
|
56
|
+
await nextTick();
|
|
57
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).not.toBeNull();
|
|
58
|
+
await getPanel().trigger('mouseleave');
|
|
59
|
+
vi.advanceTimersByTime(150);
|
|
60
|
+
await nextTick();
|
|
61
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('supports focus, arrow navigation, and Escape without reopening', async () => {
|
|
65
|
+
const wrapper = mountMenu();
|
|
66
|
+
wrapper.get('[data-testid="pairing"]').element.focus();
|
|
67
|
+
await nextTick();
|
|
68
|
+
await wrapper.get('[data-testid="pairing"]').trigger('keydown', { key: 'ArrowDown' });
|
|
69
|
+
await nextTick();
|
|
70
|
+
expect(document.activeElement.dataset.action).toBe('open');
|
|
71
|
+
await getPanel().trigger('keydown', { key: 'ArrowDown' });
|
|
72
|
+
expect(document.activeElement.dataset.action).toBe('assign-director');
|
|
73
|
+
await getPanel().trigger('keydown', { key: 'Escape' });
|
|
74
|
+
await nextTick();
|
|
75
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
76
|
+
expect(document.activeElement).toBe(wrapper.get('[data-testid="pairing"]').element);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('emits only the chosen action and dismisses the menu', async () => {
|
|
80
|
+
const wrapper = mountMenu();
|
|
81
|
+
await hoverMenu(wrapper);
|
|
82
|
+
await getPanel().get('[data-action="assign-director"]').trigger('click');
|
|
83
|
+
expect(wrapper.emitted('action')).toEqual([['assign-director']]);
|
|
84
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('closes on a direct pairing click, outside click, or viewport scroll', async () => {
|
|
88
|
+
const wrapper = mountMenu();
|
|
89
|
+
await hoverMenu(wrapper);
|
|
90
|
+
await wrapper.get('[data-testid="pairing"]').trigger('click');
|
|
91
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
92
|
+
expect(wrapper.emitted('action')).toBeUndefined();
|
|
93
|
+
await hoverMenu(wrapper);
|
|
94
|
+
document.body.dispatchEvent(new Event('pointerdown', { bubbles: true }));
|
|
95
|
+
await nextTick();
|
|
96
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
97
|
+
await hoverMenu(wrapper);
|
|
98
|
+
window.dispatchEvent(new Event('scroll'));
|
|
99
|
+
await nextTick();
|
|
100
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('positions the panel inside the viewport and opens above a bottom pairing', async () => {
|
|
104
|
+
const wrapper = mountMenu();
|
|
105
|
+
wrapper.element.getBoundingClientRect = () => ({
|
|
106
|
+
left: window.innerWidth - 10,
|
|
107
|
+
top: window.innerHeight - 40,
|
|
108
|
+
bottom: window.innerHeight
|
|
109
|
+
});
|
|
110
|
+
await hoverMenu(wrapper);
|
|
111
|
+
getPanel().element.getBoundingClientRect = () => ({ width: 144, height: 80 });
|
|
112
|
+
wrapper.vm.positionPanel();
|
|
113
|
+
await nextTick();
|
|
114
|
+
expect(Number.parseFloat(getPanel().element.style.left)).toBe(window.innerWidth - 148);
|
|
115
|
+
expect(Number.parseFloat(getPanel().element.style.top)).toBe(window.innerHeight - 124);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('allows only one open dropdown and cleans up on unmount', async () => {
|
|
119
|
+
const first = mountMenu();
|
|
120
|
+
const second = mountMenu();
|
|
121
|
+
await hoverMenu(first);
|
|
122
|
+
await hoverMenu(second);
|
|
123
|
+
expect(first.vm.isOpen).toBe(false);
|
|
124
|
+
expect(document.querySelectorAll('[data-testid="bout-actions-menu"]')).toHaveLength(1);
|
|
125
|
+
second.unmount();
|
|
126
|
+
wrappers.pop();
|
|
127
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('removes unavailable actions as props change', async () => {
|
|
131
|
+
const wrapper = mountMenu();
|
|
132
|
+
await hoverMenu(wrapper);
|
|
133
|
+
await wrapper.setProps({ actions: [actions[0]] });
|
|
134
|
+
expect(getPanel().find('[data-action="assign-director"]').exists()).toBe(false);
|
|
135
|
+
await wrapper.setProps({ actions: [] });
|
|
136
|
+
expect(document.querySelector('[data-testid="bout-actions-menu"]')).toBeNull();
|
|
137
|
+
});
|
|
138
|
+
});
|