@dev-crew-berlin/enter-js-utils 0.34.3 → 0.35.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/api-client/api-base.js +2 -20
- package/dist/api-client/index.d.ts +1 -0
- package/dist/api-client/index.js +6 -18
- package/dist/generated/api-schema.d.ts +5 -2
- package/dist/lib/result.js +2 -4
- package/dist/models/attendee.js +7 -14
- package/dist/models/checkin.js +0 -2
- package/dist/models/checkins.js +0 -7
- package/dist/models/field-group.js +0 -4
- package/dist/models/instance.js +0 -7
- package/dist/ui/button.js +0 -2
- package/dist/ui/button.stories.js +0 -2
- package/dist/ui/checkin-count-indicator.js +0 -7
- package/dist/ui/checkin-count-indicator.stories.js +0 -2
- package/dist/ui/checkin-progress-bar.stories.js +0 -2
- package/dist/ui/companion-info.stories.js +0 -8
- package/dist/ui/enter-logo.stories.js +0 -2
- package/dist/ui/form-elements/input.js +0 -2
- package/dist/ui/form-elements/input.stories.js +0 -2
- package/dist/ui/form-elements/label.js +0 -2
- package/dist/ui/form-elements/label.stories.js +0 -2
- package/dist/ui/form-elements/search-input.js +0 -2
- package/dist/ui/form-elements/search-input.stories.js +0 -2
- package/dist/ui/form-elements/segmented-control.stories.js +0 -2
- package/dist/ui/guest-card.d.ts +1 -0
- package/dist/ui/guest-card.js +11 -14
- package/dist/ui/guest-card.stories.d.ts +21 -0
- package/dist/ui/guest-card.stories.js +9 -21
- package/dist/ui/icons/add-guest-icon.stories.js +0 -2
- package/dist/ui/icons/caret-icon.stories.js +0 -2
- package/dist/ui/icons/filter-icon.stories.js +0 -2
- package/dist/ui/icons/search-icon.stories.js +0 -2
- package/dist/ui/icons/settings-icon.stories.js +0 -2
- package/dist/ui/icons/sort-list-icon.stories.js +0 -2
- package/dist/ui/tag.stories.js +0 -2
- package/package.json +3 -3
|
@@ -5,7 +5,6 @@ export default class APIBase {
|
|
|
5
5
|
this.onLogout = args.onLogout;
|
|
6
6
|
this.isLoggedIn = true;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
static async fetchResult(input, init) {
|
|
10
9
|
try {
|
|
11
10
|
const res = await fetch(input, init);
|
|
@@ -14,7 +13,6 @@ export default class APIBase {
|
|
|
14
13
|
return failure(e);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
static async fetchAccessToken(args) {
|
|
19
17
|
const body = {
|
|
20
18
|
username: args.user,
|
|
@@ -29,7 +27,6 @@ export default class APIBase {
|
|
|
29
27
|
},
|
|
30
28
|
body: new URLSearchParams(body)
|
|
31
29
|
});
|
|
32
|
-
|
|
33
30
|
if (!res.success) {
|
|
34
31
|
return failure([{
|
|
35
32
|
type: 'network-error',
|
|
@@ -37,7 +34,6 @@ export default class APIBase {
|
|
|
37
34
|
endpoint: 'authenticate'
|
|
38
35
|
}]);
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
if (res.data.status >= 300) {
|
|
42
38
|
try {
|
|
43
39
|
const error = await res.data.json();
|
|
@@ -56,11 +52,9 @@ export default class APIBase {
|
|
|
56
52
|
}]);
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
|
|
60
55
|
const payload = await res.data.json();
|
|
61
56
|
return success(payload);
|
|
62
57
|
}
|
|
63
|
-
|
|
64
58
|
async fetchFromEnter(endpoint, method, data) {
|
|
65
59
|
const body = data !== null ? JSON.stringify(data) : null;
|
|
66
60
|
const headers = {
|
|
@@ -72,7 +66,6 @@ export default class APIBase {
|
|
|
72
66
|
headers,
|
|
73
67
|
body
|
|
74
68
|
});
|
|
75
|
-
|
|
76
69
|
if (!res.success) {
|
|
77
70
|
return failure([{
|
|
78
71
|
type: 'network-error',
|
|
@@ -80,7 +73,6 @@ export default class APIBase {
|
|
|
80
73
|
endpoint
|
|
81
74
|
}]);
|
|
82
75
|
}
|
|
83
|
-
|
|
84
76
|
if (res.data.status === 401) {
|
|
85
77
|
if (this.isLoggedIn) this.logout();
|
|
86
78
|
return failure([{
|
|
@@ -89,7 +81,6 @@ export default class APIBase {
|
|
|
89
81
|
endpoint
|
|
90
82
|
}]);
|
|
91
83
|
}
|
|
92
|
-
|
|
93
84
|
if (res.data.status >= 300) {
|
|
94
85
|
try {
|
|
95
86
|
const error = await res.data.json();
|
|
@@ -107,52 +98,44 @@ export default class APIBase {
|
|
|
107
98
|
endpoint
|
|
108
99
|
}]);
|
|
109
100
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
101
|
+
}
|
|
112
102
|
|
|
103
|
+
// HTTP status 204 means no content so we can't parse it as json
|
|
113
104
|
if (res.data.status === 204) return success(null);
|
|
114
105
|
const json = await res.data.json();
|
|
115
106
|
return success(json);
|
|
116
107
|
}
|
|
117
|
-
|
|
118
108
|
async get(endpoint) {
|
|
119
109
|
const rawResponse = await this.fetchFromEnter(endpoint, 'get', undefined);
|
|
120
110
|
if (!rawResponse.success) return rawResponse;
|
|
121
111
|
return success(rawResponse.data);
|
|
122
112
|
}
|
|
123
|
-
|
|
124
113
|
async post(endpoint, data) {
|
|
125
114
|
const rawResponse = await this.fetchFromEnter(endpoint, 'post', data);
|
|
126
115
|
if (!rawResponse.success) return rawResponse;
|
|
127
116
|
return success(rawResponse.data);
|
|
128
117
|
}
|
|
129
|
-
|
|
130
118
|
async put(endpoint, data) {
|
|
131
119
|
const rawResponse = await this.fetchFromEnter(endpoint, 'put', data);
|
|
132
120
|
if (!rawResponse.success) return rawResponse;
|
|
133
121
|
return success(rawResponse.data);
|
|
134
122
|
}
|
|
135
|
-
|
|
136
123
|
async patch(endpoint, data) {
|
|
137
124
|
const rawResponse = await this.fetchFromEnter(endpoint, 'patch', data);
|
|
138
125
|
if (!rawResponse.success) return rawResponse;
|
|
139
126
|
return success(rawResponse.data);
|
|
140
127
|
}
|
|
141
|
-
|
|
142
128
|
async delete(endpoint) {
|
|
143
129
|
const rawResponse = await this.fetchFromEnter(endpoint, 'delete', undefined);
|
|
144
130
|
if (!rawResponse.success) return rawResponse;
|
|
145
131
|
return success(rawResponse.data);
|
|
146
132
|
}
|
|
147
|
-
|
|
148
133
|
async refreshToken() {
|
|
149
134
|
return this.post('/authenticate/refresh', null);
|
|
150
135
|
}
|
|
151
|
-
|
|
152
136
|
async logout() {
|
|
153
137
|
this.isLoggedIn = false;
|
|
154
138
|
this.onLogout();
|
|
155
|
-
|
|
156
139
|
try {
|
|
157
140
|
// delete token at api backend so it becomes invalid
|
|
158
141
|
await this.fetchFromEnter('/authenticate', 'delete', undefined);
|
|
@@ -160,5 +143,4 @@ export default class APIBase {
|
|
|
160
143
|
console.warn('error deleting the token in the backend, so it is still valid', e);
|
|
161
144
|
}
|
|
162
145
|
}
|
|
163
|
-
|
|
164
146
|
}
|
package/dist/api-client/index.js
CHANGED
|
@@ -9,93 +9,81 @@ export default class API extends APIBase {
|
|
|
9
9
|
if (!result.success) return result;
|
|
10
10
|
return success(result.data.map(instanceJSON => new Instance(instanceJSON)));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
async getInstance(args) {
|
|
14
13
|
const instanceName = args.instanceName;
|
|
15
14
|
const result = await this.get(`/instances/${instanceName}`);
|
|
16
15
|
if (!result.success) return result;
|
|
17
16
|
return success(new Instance(result.data));
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
async getFields(args) {
|
|
21
19
|
const instanceName = args.instanceName;
|
|
22
20
|
const result = await this.get(`/instances/${instanceName}/fields`);
|
|
23
21
|
if (!result.success) return result;
|
|
24
22
|
return success(new FieldGroups(result.data));
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
async getCheckinCounts(args) {
|
|
28
25
|
const instanceName = args.instanceName;
|
|
29
26
|
return this.get(`/instances/${instanceName}/checkin_counts`);
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
async getAttendeeList(args) {
|
|
33
29
|
const query = new URLSearchParams();
|
|
34
|
-
|
|
35
30
|
if (args.includeDeleted) {
|
|
36
31
|
query.append('include_deleted', 'true');
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
const instanceName = args.instanceName;
|
|
40
34
|
const queryString = `?${query.toString()}`;
|
|
41
35
|
const result = await this.get(`/instances/${instanceName}/attendees${queryString}`);
|
|
42
36
|
if (!result.success) return result;
|
|
43
37
|
return success(result.data.map(attendeeJSON => new Attendee(attendeeJSON)));
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
async getAttendee(args) {
|
|
40
|
+
const query = new URLSearchParams();
|
|
41
|
+
if (args.includeDeleted) {
|
|
42
|
+
query.append('include_deleted', 'true');
|
|
43
|
+
}
|
|
47
44
|
const instanceName = args.instanceName;
|
|
48
45
|
const attendeeId = args.attendeeId;
|
|
49
|
-
const
|
|
46
|
+
const queryString = `?${query.toString()}`;
|
|
47
|
+
const result = await this.get(`/instances/${instanceName}/attendees/${attendeeId}${queryString}`);
|
|
50
48
|
if (!result.success) return result;
|
|
51
49
|
return success(new Attendee(result.data));
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
async getVariableList(args) {
|
|
55
52
|
const instanceName = args.instanceName;
|
|
56
53
|
return this.get(`/instances/${instanceName}/variables`);
|
|
57
54
|
}
|
|
58
|
-
|
|
59
55
|
async getVariable(args) {
|
|
60
56
|
const instanceName = args.instanceName;
|
|
61
57
|
const variableName = args.variableName;
|
|
62
58
|
return this.get(`/instances/${instanceName}/variables/${variableName}`);
|
|
63
59
|
}
|
|
64
|
-
|
|
65
60
|
async createVariable(args) {
|
|
66
61
|
const instanceName = args.instanceName;
|
|
67
62
|
return this.post(`/instances/${instanceName}/variables`, args.variable);
|
|
68
63
|
}
|
|
69
|
-
|
|
70
64
|
async updateVariable(args) {
|
|
71
65
|
const instanceName = args.instanceName;
|
|
72
66
|
const variableName = args.variableName;
|
|
73
67
|
return this.put(`/instances/${instanceName}/variables/${variableName}`, args.update);
|
|
74
68
|
}
|
|
75
|
-
|
|
76
69
|
async deleteVariable(args) {
|
|
77
70
|
const instanceName = args.instanceName;
|
|
78
71
|
const variableName = args.variableName;
|
|
79
72
|
return this.delete(`/instances/${instanceName}/variables/${variableName}`);
|
|
80
73
|
}
|
|
81
|
-
|
|
82
74
|
async getUser() {
|
|
83
75
|
return this.get('/users/me');
|
|
84
76
|
}
|
|
85
|
-
|
|
86
77
|
async updateUser(args) {
|
|
87
78
|
return this.patch('/users/me', args);
|
|
88
79
|
}
|
|
89
|
-
|
|
90
80
|
async sendEmail(args) {
|
|
91
81
|
const instanceName = args.instanceName;
|
|
92
82
|
const attendeeId = args.attendeeId;
|
|
93
83
|
const emailName = args.emailName;
|
|
94
84
|
return this.post(`/instances/${instanceName}/attendees/${attendeeId}/emails/${emailName}/send`, null);
|
|
95
85
|
}
|
|
96
|
-
|
|
97
86
|
async createEvents(args) {
|
|
98
87
|
return this.post(`/events`, args);
|
|
99
88
|
}
|
|
100
|
-
|
|
101
89
|
}
|
|
@@ -143,6 +143,8 @@ export declare type components = {
|
|
|
143
143
|
};
|
|
144
144
|
/** Tags */
|
|
145
145
|
tags?: string[];
|
|
146
|
+
/** Deletedtags */
|
|
147
|
+
deletedTags?: string[];
|
|
146
148
|
/** Language */
|
|
147
149
|
language?: string;
|
|
148
150
|
/**
|
|
@@ -649,8 +651,6 @@ export declare type components = {
|
|
|
649
651
|
};
|
|
650
652
|
/** Class */
|
|
651
653
|
class?: string;
|
|
652
|
-
/** If */
|
|
653
|
-
if?: string;
|
|
654
654
|
/**
|
|
655
655
|
* Ismetagroup
|
|
656
656
|
* @default false
|
|
@@ -1538,6 +1538,9 @@ export declare type operations = {
|
|
|
1538
1538
|
instance_name: string;
|
|
1539
1539
|
attendee_id: string;
|
|
1540
1540
|
};
|
|
1541
|
+
query: {
|
|
1542
|
+
include_deleted?: boolean;
|
|
1543
|
+
};
|
|
1541
1544
|
};
|
|
1542
1545
|
responses: {
|
|
1543
1546
|
/** Successful Response */
|
package/dist/lib/result.js
CHANGED
|
@@ -18,7 +18,6 @@ export function asFailure(result) {
|
|
|
18
18
|
if (result.success) return undefined;
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
22
|
* Takes a list of Results and creates one single result out of it
|
|
24
23
|
*
|
|
@@ -35,16 +34,15 @@ export function combineResults(results) {
|
|
|
35
34
|
if (results.every(result => result.success)) {
|
|
36
35
|
return {
|
|
37
36
|
success: true,
|
|
38
|
-
data: results.map(
|
|
37
|
+
data: results.map(
|
|
38
|
+
// the if statement checks that every result is a success so we can force this here
|
|
39
39
|
success => asSuccess(success).data // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
40
40
|
) // also the typechecker does not resolve this so we just tell him its fine and hope there are no errors
|
|
41
|
-
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
return {
|
|
46
45
|
success: false,
|
|
47
46
|
error: results.map(result => asFailure(result)?.error).filter(failure => failure !== undefined) // the typechecker does not resolve this so we just tell him its fine and hope there are no errors
|
|
48
|
-
|
|
49
47
|
};
|
|
50
48
|
}
|
package/dist/models/attendee.js
CHANGED
|
@@ -8,13 +8,11 @@ export class Attendee {
|
|
|
8
8
|
isCompanion: false
|
|
9
9
|
};
|
|
10
10
|
deleted = false;
|
|
11
|
-
|
|
12
11
|
constructor(args) {
|
|
13
12
|
if (typeof args === 'string') {
|
|
14
13
|
this.id = args;
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
const json = args;
|
|
19
17
|
this.id = json.id;
|
|
20
18
|
this.userdata = json.userdata;
|
|
@@ -27,56 +25,52 @@ export class Attendee {
|
|
|
27
25
|
this.payment = json.payment;
|
|
28
26
|
this.deleted = json.deleted;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
toJSON() {
|
|
32
29
|
// this is exactly what js also provides out of the box
|
|
33
30
|
// but then typescript complains that there is no toJSON function
|
|
34
31
|
// so we implement it here again by hand
|
|
32
|
+
|
|
35
33
|
// convert each checkin to its json representation
|
|
36
34
|
const checkin = Object.fromEntries(new Map(Object.entries(this.checkin).map(([checkinTag, checkin]) => [checkinTag, checkin.toJSON()])));
|
|
37
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
...this,
|
|
38
37
|
time: this.time?.toISOString(),
|
|
39
38
|
checkin
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
|
|
43
41
|
getRsvpCountForTag(checkinTag) {
|
|
44
42
|
const rsvp = this.rsvp[checkinTag];
|
|
45
43
|
if (!rsvp) return 0;
|
|
46
44
|
return rsvp;
|
|
47
45
|
}
|
|
48
|
-
|
|
49
46
|
getResponseForTag(checkinTag) {
|
|
50
47
|
const rsvp = this.rsvp[checkinTag] ?? null;
|
|
51
48
|
if (rsvp === null) return 'no-response';
|
|
52
49
|
return rsvp > 0 ? 'positive-response' : 'negative-response';
|
|
53
50
|
}
|
|
54
|
-
|
|
55
51
|
getCheckinsForTag(checkinTag) {
|
|
56
52
|
return this.checkin[checkinTag] ?? new Checkins({
|
|
57
53
|
checkins: [],
|
|
58
54
|
deleted: []
|
|
59
55
|
});
|
|
60
56
|
}
|
|
61
|
-
|
|
62
57
|
getCheckinCountForTag(checkinTag) {
|
|
63
58
|
const checkins = this.checkin[checkinTag];
|
|
64
59
|
if (!checkins) return 0;
|
|
65
60
|
return checkins.getAllCheckins().length;
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
addCheckinForTag(args) {
|
|
69
63
|
const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
|
|
70
64
|
const newCheckins = new Checkins();
|
|
71
65
|
newCheckins.checkins = [args.checkin];
|
|
72
66
|
const mergedCheckins = exsitingCheckins.merge(newCheckins);
|
|
73
67
|
const newAttendee = new Attendee(this.toJSON());
|
|
74
|
-
newAttendee.checkin = {
|
|
68
|
+
newAttendee.checkin = {
|
|
69
|
+
...this.checkin,
|
|
75
70
|
[args.checkinTag]: mergedCheckins
|
|
76
71
|
};
|
|
77
72
|
return newAttendee;
|
|
78
73
|
}
|
|
79
|
-
|
|
80
74
|
deleteCheckinForTag(args) {
|
|
81
75
|
const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
|
|
82
76
|
const deletedCheckins = new Checkins({
|
|
@@ -85,14 +79,13 @@ export class Attendee {
|
|
|
85
79
|
});
|
|
86
80
|
const mergedCheckins = exsitingCheckins.merge(deletedCheckins);
|
|
87
81
|
const newAttendee = new Attendee(this.toJSON());
|
|
88
|
-
newAttendee.checkin = {
|
|
82
|
+
newAttendee.checkin = {
|
|
83
|
+
...this.checkin,
|
|
89
84
|
[args.checkinTag]: mergedCheckins
|
|
90
85
|
};
|
|
91
86
|
return newAttendee;
|
|
92
87
|
}
|
|
93
|
-
|
|
94
88
|
hasRsvp(args) {
|
|
95
89
|
return args.checkinTags.some(checkinTag => this.getResponseForTag(checkinTag) !== 'no-response');
|
|
96
90
|
}
|
|
97
|
-
|
|
98
91
|
}
|
package/dist/models/checkin.js
CHANGED
package/dist/models/checkins.js
CHANGED
|
@@ -3,35 +3,29 @@ import { Checkin } from './checkin';
|
|
|
3
3
|
export class Checkins {
|
|
4
4
|
checkins = [];
|
|
5
5
|
deleted = [];
|
|
6
|
-
|
|
7
6
|
constructor(json) {
|
|
8
7
|
// if constructor is called without params use default values
|
|
9
8
|
if (!json) return;
|
|
10
9
|
this.checkins = json.checkins.map(checkinJSON => new Checkin(checkinJSON));
|
|
11
10
|
this.deleted = json.deleted;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
toJSON() {
|
|
15
13
|
return {
|
|
16
14
|
checkins: this.checkins.map(checkin => checkin.toJSON()),
|
|
17
15
|
deleted: this.deleted
|
|
18
16
|
};
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
getAllCheckins() {
|
|
22
19
|
const mainAndOthers = [this.getMainCheckin(), ...this.getOtherCheckins()];
|
|
23
20
|
return mainAndOthers.filter(notUndefined);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
getOtherCheckins() {
|
|
27
23
|
return this.checkins.filter(c => c.main === false && !this.deleted.includes(c.id));
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
getMainCheckin() {
|
|
31
26
|
const nonDeletedCheckins = this.checkins.filter(checkin => checkin.main === true && !this.deleted.includes(checkin.id)).sort((a, b) => a.time.getTime() - b.time.getTime());
|
|
32
27
|
return nonDeletedCheckins[0];
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
merge(otherCheckin) {
|
|
36
30
|
const checkins = new Map([...this.checkins, ...otherCheckin.checkins].map(checkin => [checkin.id, checkin])).values();
|
|
37
31
|
const deleted = new Set([...this.deleted, ...otherCheckin.deleted]);
|
|
@@ -40,5 +34,4 @@ export class Checkins {
|
|
|
40
34
|
newCheckins.deleted = Array.from(deleted);
|
|
41
35
|
return newCheckins;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
}
|
|
@@ -2,11 +2,9 @@ export class FieldGroups {
|
|
|
2
2
|
constructor(json) {
|
|
3
3
|
this.groups = json;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
toJSON() {
|
|
7
6
|
return this.groups;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
getFieldLabels() {
|
|
11
9
|
return this.groups.reduce((labels, group) => {
|
|
12
10
|
return group.questions.reduce((labels, question) => {
|
|
@@ -15,11 +13,9 @@ export class FieldGroups {
|
|
|
15
13
|
}, labels);
|
|
16
14
|
}, {});
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
getLabelForField(fieldKey, language) {
|
|
20
17
|
const fieldLabel = this.getFieldLabels()[fieldKey];
|
|
21
18
|
const translatedLabel = fieldLabel === undefined || typeof fieldLabel === 'string' ? fieldLabel : fieldLabel[language];
|
|
22
19
|
return translatedLabel ?? fieldKey;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
}
|
package/dist/models/instance.js
CHANGED
|
@@ -16,7 +16,6 @@ export class Instance {
|
|
|
16
16
|
this.guestNameFields = json.guestNameFields;
|
|
17
17
|
this.tagColors = json.tagColors;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
toJSON() {
|
|
21
20
|
return {
|
|
22
21
|
name: this.name,
|
|
@@ -36,7 +35,6 @@ export class Instance {
|
|
|
36
35
|
tagColors: this.tagColors
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
|
-
|
|
40
38
|
isRegistrationClosed() {
|
|
41
39
|
const {
|
|
42
40
|
closed,
|
|
@@ -49,7 +47,6 @@ export class Instance {
|
|
|
49
47
|
if (end !== undefined && now >= end) return true;
|
|
50
48
|
return false;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
50
|
canEditRegistration() {
|
|
54
51
|
const {
|
|
55
52
|
canEdit,
|
|
@@ -60,18 +57,14 @@ export class Instance {
|
|
|
60
57
|
const now = new Date();
|
|
61
58
|
return editEnd < now;
|
|
62
59
|
}
|
|
63
|
-
|
|
64
60
|
formatName(guest) {
|
|
65
61
|
if (this.guestNameFields.length === 0) {
|
|
66
62
|
// just use the first value we can find
|
|
67
63
|
return Object.values(guest.userdata).slice(0, 1).join('');
|
|
68
64
|
}
|
|
69
|
-
|
|
70
65
|
return this.guestNameFields.map(fieldKey => guest.userdata[fieldKey] ?? '').join(' ');
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
getTagColor(tag) {
|
|
74
68
|
return this.tagColors[tag] ?? undefined;
|
|
75
69
|
}
|
|
76
|
-
|
|
77
70
|
}
|
package/dist/ui/button.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import 'styled-jsx';
|
|
7
5
|
import { theme, classNames } from '../lib';
|
|
@@ -12,12 +12,10 @@ export const CheckinCountIndicator = props => {
|
|
|
12
12
|
length: rsvpsWithoutCheckin
|
|
13
13
|
}, () => 'rsvp')];
|
|
14
14
|
const chunked = [];
|
|
15
|
-
|
|
16
15
|
for (let i = 0; i < checkinsAndRsvp.length; i += CHUNK_SIZE) {
|
|
17
16
|
const chunk = checkinsAndRsvp.slice(i, i + CHUNK_SIZE);
|
|
18
17
|
chunked.push(chunk);
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
const text = getText({
|
|
22
20
|
checkinCount,
|
|
23
21
|
rsvpCount
|
|
@@ -50,23 +48,18 @@ export const CheckinCountIndicator = props => {
|
|
|
50
48
|
dynamic: [fonts.primary, colors.enterDarkGrey, colors.enterGreen, colors.enterGreen, colors.enterError, colors.enterError]
|
|
51
49
|
}, `.checkin-count-indicator.__jsx-style-dynamic-selector{font-family:${fonts.primary};min-height:20px;}.text.__jsx-style-dynamic-selector{color:${colors.enterDarkGrey};text-transform:uppercase;font-size:10px;line-height:15px;font-weight:bold;white-space:nowrap;width:100%;margin-top:0.2em;}.text.__jsx-style-dynamic-selector:nth-child(2){width:auto;margin-top:0;}.box-wrapper.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:100px;}.box-wrapper.multiple-chunks.__jsx-style-dynamic-selector{-webkit-flex-flow:wrap;-ms-flex-flow:wrap;flex-flow:wrap;}.chunk.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-right:5px;margin-bottom:4px;width:95px;white-space:nowrap;}.chunk.__jsx-style-dynamic-selector:first-of-type.chunk.__jsx-style-dynamic-selector:last-of-type{width:auto;margin-right:2px;}.checkin.__jsx-style-dynamic-selector,.rsvp.__jsx-style-dynamic-selector,.decline-box.__jsx-style-dynamic-selector{box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:120%;width:15px;height:15px;border-radius:2px;border:3px solid ${colors.enterGreen};margin:0 4px 0 0;vertical-align:middle;color:white;}.checkin.__jsx-style-dynamic-selector{background-color:${colors.enterGreen};}.decline-box.__jsx-style-dynamic-selector{background-color:${colors.enterError};border-color:${colors.enterError};}`));
|
|
52
50
|
};
|
|
53
|
-
|
|
54
51
|
function getText(args) {
|
|
55
52
|
if (args.checkinCount === 1 && args.rsvpCount === 1) {
|
|
56
53
|
return 'checked in';
|
|
57
54
|
}
|
|
58
|
-
|
|
59
55
|
if (args.checkinCount > 0) {
|
|
60
56
|
return `${args.checkinCount} / ${args.rsvpCount} Checkins`;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
58
|
if (args.rsvpCount == 1) {
|
|
64
59
|
return 'Confirmed';
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
if (args.rsvpCount > 0) {
|
|
68
62
|
return `${args.rsvpCount} Confirmations`;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
return 'no response';
|
|
72
65
|
}
|
|
@@ -7,9 +7,7 @@ export default {
|
|
|
7
7
|
const exampleCheckin = {
|
|
8
8
|
time: new Date('2022-01-01')
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
const Template = args => /*#__PURE__*/React.createElement(CheckinCountIndicator, args);
|
|
12
|
-
|
|
13
11
|
export const SingleResponse = Template.bind({});
|
|
14
12
|
SingleResponse.args = {
|
|
15
13
|
checkins: [],
|
|
@@ -27,9 +27,7 @@ const mainGuest = new Attendee({
|
|
|
27
27
|
},
|
|
28
28
|
deleted: false
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
const Template = args => /*#__PURE__*/React.createElement(CompanionInfo, args);
|
|
32
|
-
|
|
33
31
|
export const WithMainGuestFound = Template.bind({});
|
|
34
32
|
WithMainGuestFound.args = {
|
|
35
33
|
companionStatus: {
|
|
@@ -37,11 +35,9 @@ WithMainGuestFound.args = {
|
|
|
37
35
|
mainGuestId: 'my-attendee'
|
|
38
36
|
},
|
|
39
37
|
findMainGuest: () => mainGuest,
|
|
40
|
-
|
|
41
38
|
formatName(attendee) {
|
|
42
39
|
return attendee.userdata.name?.toString() ?? '';
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
};
|
|
46
42
|
export const WithoutMainGuest = Template.bind({});
|
|
47
43
|
WithoutMainGuest.args = {
|
|
@@ -49,20 +45,16 @@ WithoutMainGuest.args = {
|
|
|
49
45
|
isCompanion: true,
|
|
50
46
|
mainGuestId: 'my-attendee'
|
|
51
47
|
},
|
|
52
|
-
|
|
53
48
|
formatName(attendee) {
|
|
54
49
|
return attendee.userdata.name?.toString() ?? '';
|
|
55
50
|
}
|
|
56
|
-
|
|
57
51
|
};
|
|
58
52
|
export const NotACompanion = Template.bind({});
|
|
59
53
|
NotACompanion.args = {
|
|
60
54
|
companionStatus: {
|
|
61
55
|
isCompanion: false
|
|
62
56
|
},
|
|
63
|
-
|
|
64
57
|
formatName(attendee) {
|
|
65
58
|
return attendee.userdata.name?.toString() ?? '';
|
|
66
59
|
}
|
|
67
|
-
|
|
68
60
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import { theme } from '../../lib';
|
|
7
5
|
import { Label } from './label';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import { theme } from '../../lib';
|
|
7
5
|
export const Label = props => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
import React, { useId } from 'react';
|
|
6
4
|
import { theme } from '../../lib';
|
|
7
5
|
import { SearchIcon } from '../icons/search-icon';
|
|
@@ -5,9 +5,7 @@ export default {
|
|
|
5
5
|
title: 'Form Elements/SearchInput',
|
|
6
6
|
component: SearchInput
|
|
7
7
|
};
|
|
8
|
-
|
|
9
8
|
const Template = args => /*#__PURE__*/React.createElement(SearchInput, args);
|
|
10
|
-
|
|
11
9
|
export const Basic = Template.bind({});
|
|
12
10
|
Basic.args = {
|
|
13
11
|
textColor: theme.colors.enterDarkGrey,
|
|
@@ -4,9 +4,7 @@ export default {
|
|
|
4
4
|
title: 'Form Elements/Segmented Control',
|
|
5
5
|
component: SegmentedControl
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
const Template = args => /*#__PURE__*/React.createElement(SegmentedControl, args);
|
|
9
|
-
|
|
10
8
|
export const Basic = Template.bind({});
|
|
11
9
|
Basic.args = {
|
|
12
10
|
segments: ['One', 'Two', 'Three'],
|
package/dist/ui/guest-card.d.ts
CHANGED
package/dist/ui/guest-card.js
CHANGED
|
@@ -7,22 +7,19 @@ import { CompanionInfo } from './companion-info';
|
|
|
7
7
|
import { Tag } from './tag';
|
|
8
8
|
export const GuestCard = props => {
|
|
9
9
|
const filterTags = props.filterTags ?? (() => true);
|
|
10
|
-
|
|
11
10
|
const tags = (props.attendee.tags || []).filter(filterTags);
|
|
12
|
-
|
|
13
11
|
const getTagColor = props.getTagColor ?? (() => undefined);
|
|
14
|
-
|
|
15
12
|
const onClick = props.onClick ? () => {
|
|
16
13
|
if (!props.onClick) return;
|
|
17
14
|
props.onClick(props.attendee.id);
|
|
18
15
|
} : undefined;
|
|
19
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: _JSXStyle.dynamic([["
|
|
17
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + (cx({
|
|
21
18
|
'guest-card-wrapper': true,
|
|
22
19
|
plain: props.plain
|
|
23
20
|
}) || "")
|
|
24
21
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: _JSXStyle.dynamic([["
|
|
22
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'tag-color-list'
|
|
26
23
|
}, tags.map(tag => [tag, getTagColor(tag)]).filter(([, tagColor]) => tagColor).map(([tag, tagColor]) => /*#__PURE__*/React.createElement("div", {
|
|
27
24
|
key: tag,
|
|
28
25
|
title: tag,
|
|
@@ -30,14 +27,14 @@ export const GuestCard = props => {
|
|
|
30
27
|
backgroundColor: tagColor,
|
|
31
28
|
height: '100%'
|
|
32
29
|
},
|
|
33
|
-
className: _JSXStyle.dynamic([["
|
|
30
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'tag-color'
|
|
34
31
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
35
32
|
onClick: onClick,
|
|
36
|
-
className: _JSXStyle.dynamic([["
|
|
33
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'guest-card'
|
|
37
34
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
className: _JSXStyle.dynamic([["
|
|
35
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]])
|
|
39
36
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
40
|
-
className: _JSXStyle.dynamic([["
|
|
37
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'name'
|
|
41
38
|
}, props.formatName(props.attendee)), /*#__PURE__*/React.createElement(CompanionInfo, {
|
|
42
39
|
companionStatus: props.attendee.companions,
|
|
43
40
|
findMainGuest: props.findMainGuest,
|
|
@@ -47,13 +44,13 @@ export const GuestCard = props => {
|
|
|
47
44
|
response: props.attendee.getResponseForTag(props.checkinTag),
|
|
48
45
|
rsvpCount: props.attendee.getRsvpCountForTag(props.checkinTag)
|
|
49
46
|
})), /*#__PURE__*/React.createElement("div", {
|
|
50
|
-
className: _JSXStyle.dynamic([["
|
|
47
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'tag-list'
|
|
51
48
|
}, tags.map(tag => /*#__PURE__*/React.createElement(Tag, {
|
|
52
49
|
key: tag
|
|
53
50
|
}, tag)), props.infoText && /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: _JSXStyle.dynamic([["
|
|
51
|
+
className: _JSXStyle.dynamic([["2947209375", [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']]]) + " " + 'info'
|
|
55
52
|
}, " ", props.infoText))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
56
|
-
id: "
|
|
57
|
-
dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary]
|
|
58
|
-
}, `.guest-card-wrapper.__jsx-style-dynamic-selector{border-radius:2px;border:1px solid ${theme.colors.enterGrey};background-color:${theme.colors.enterBackground};font-family:${theme.fonts.primary};margin:1.5em 0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;padding:1.1em 1em 0.9em;-webkit-flex:1;-ms-flex:1;flex:1;}.tag-color-list.__jsx-style-dynamic-selector{width:0.35em;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.tag-color.__jsx-style-dynamic-selector:first-child{border-top-left-radius:1px;}.tag-color.__jsx-style-dynamic-selector:last-child{border-bottom-left-radius:1px;}.plain.__jsx-style-dynamic-selector{border:none;background-color:transparent;}.name.__jsx-style-dynamic-selector{font-size:1.15em;margin:-0.1em 0 0.3em;}.tag-list.__jsx-style-dynamic-selector{max-width:40%;text-align:right;font-size:0.9em;}.info.__jsx-style-dynamic-selector{display:block;width:100%;text-align:right;}`));
|
|
53
|
+
id: "2947209375",
|
|
54
|
+
dynamic: [theme.colors.enterGrey, theme.colors.enterBackground, theme.fonts.primary, props.dense ? '0.5em 0' : '1.5em 0']
|
|
55
|
+
}, `.guest-card-wrapper.__jsx-style-dynamic-selector{border-radius:2px;border:1px solid ${theme.colors.enterGrey};background-color:${theme.colors.enterBackground};font-family:${theme.fonts.primary};margin:${props.dense ? '0.5em 0' : '1.5em 0'};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.guest-card.__jsx-style-dynamic-selector{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;padding:1.1em 1em 0.9em;-webkit-flex:1;-ms-flex:1;flex:1;}.tag-color-list.__jsx-style-dynamic-selector{width:0.35em;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.tag-color.__jsx-style-dynamic-selector:first-child{border-top-left-radius:1px;}.tag-color.__jsx-style-dynamic-selector:last-child{border-bottom-left-radius:1px;}.plain.__jsx-style-dynamic-selector{border:none;background-color:transparent;}.name.__jsx-style-dynamic-selector{font-size:1.15em;margin:-0.1em 0 0.3em;}.tag-list.__jsx-style-dynamic-selector{max-width:40%;text-align:right;font-size:0.9em;}.info.__jsx-style-dynamic-selector{display:block;width:100%;text-align:right;}`));
|
|
59
56
|
};
|
|
@@ -5,6 +5,7 @@ declare const _default: ComponentMeta<React.FunctionComponent<{
|
|
|
5
5
|
attendee: Attendee;
|
|
6
6
|
checkinTag: string;
|
|
7
7
|
plain?: boolean | undefined;
|
|
8
|
+
dense?: boolean | undefined;
|
|
8
9
|
infoText?: string | undefined;
|
|
9
10
|
formatName: (attendee: Attendee) => string;
|
|
10
11
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -17,6 +18,7 @@ export declare const WithBackground: ComponentStory<React.FunctionComponent<{
|
|
|
17
18
|
attendee: Attendee;
|
|
18
19
|
checkinTag: string;
|
|
19
20
|
plain?: boolean | undefined;
|
|
21
|
+
dense?: boolean | undefined;
|
|
20
22
|
infoText?: string | undefined;
|
|
21
23
|
formatName: (attendee: Attendee) => string;
|
|
22
24
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -28,6 +30,19 @@ export declare const Plain: ComponentStory<React.FunctionComponent<{
|
|
|
28
30
|
attendee: Attendee;
|
|
29
31
|
checkinTag: string;
|
|
30
32
|
plain?: boolean | undefined;
|
|
33
|
+
dense?: boolean | undefined;
|
|
34
|
+
infoText?: string | undefined;
|
|
35
|
+
formatName: (attendee: Attendee) => string;
|
|
36
|
+
filterTags?: ((tag: string) => boolean) | undefined;
|
|
37
|
+
getTagColor?: ((tag: string) => string | undefined) | undefined;
|
|
38
|
+
findMainGuest?: ((attendeeId: string) => Attendee | undefined) | undefined;
|
|
39
|
+
onClick?: ((attendeeId: string) => void) | undefined;
|
|
40
|
+
}>>;
|
|
41
|
+
export declare const Dense: ComponentStory<React.FunctionComponent<{
|
|
42
|
+
attendee: Attendee;
|
|
43
|
+
checkinTag: string;
|
|
44
|
+
plain?: boolean | undefined;
|
|
45
|
+
dense?: boolean | undefined;
|
|
31
46
|
infoText?: string | undefined;
|
|
32
47
|
formatName: (attendee: Attendee) => string;
|
|
33
48
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -39,6 +54,7 @@ export declare const FilteredTags: ComponentStory<React.FunctionComponent<{
|
|
|
39
54
|
attendee: Attendee;
|
|
40
55
|
checkinTag: string;
|
|
41
56
|
plain?: boolean | undefined;
|
|
57
|
+
dense?: boolean | undefined;
|
|
42
58
|
infoText?: string | undefined;
|
|
43
59
|
formatName: (attendee: Attendee) => string;
|
|
44
60
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -50,6 +66,7 @@ export declare const WithColorLabel: ComponentStory<React.FunctionComponent<{
|
|
|
50
66
|
attendee: Attendee;
|
|
51
67
|
checkinTag: string;
|
|
52
68
|
plain?: boolean | undefined;
|
|
69
|
+
dense?: boolean | undefined;
|
|
53
70
|
infoText?: string | undefined;
|
|
54
71
|
formatName: (attendee: Attendee) => string;
|
|
55
72
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -61,6 +78,7 @@ export declare const WithMultipleColorLabels: ComponentStory<React.FunctionCompo
|
|
|
61
78
|
attendee: Attendee;
|
|
62
79
|
checkinTag: string;
|
|
63
80
|
plain?: boolean | undefined;
|
|
81
|
+
dense?: boolean | undefined;
|
|
64
82
|
infoText?: string | undefined;
|
|
65
83
|
formatName: (attendee: Attendee) => string;
|
|
66
84
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -72,6 +90,7 @@ export declare const WithInfoText: ComponentStory<React.FunctionComponent<{
|
|
|
72
90
|
attendee: Attendee;
|
|
73
91
|
checkinTag: string;
|
|
74
92
|
plain?: boolean | undefined;
|
|
93
|
+
dense?: boolean | undefined;
|
|
75
94
|
infoText?: string | undefined;
|
|
76
95
|
formatName: (attendee: Attendee) => string;
|
|
77
96
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -83,6 +102,7 @@ export declare const WithCompanion: ComponentStory<React.FunctionComponent<{
|
|
|
83
102
|
attendee: Attendee;
|
|
84
103
|
checkinTag: string;
|
|
85
104
|
plain?: boolean | undefined;
|
|
105
|
+
dense?: boolean | undefined;
|
|
86
106
|
infoText?: string | undefined;
|
|
87
107
|
formatName: (attendee: Attendee) => string;
|
|
88
108
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -94,6 +114,7 @@ export declare const WithCompanionButNoMainGuestInfo: ComponentStory<React.Funct
|
|
|
94
114
|
attendee: Attendee;
|
|
95
115
|
checkinTag: string;
|
|
96
116
|
plain?: boolean | undefined;
|
|
117
|
+
dense?: boolean | undefined;
|
|
97
118
|
infoText?: string | undefined;
|
|
98
119
|
formatName: (attendee: Attendee) => string;
|
|
99
120
|
filterTags?: ((tag: string) => boolean) | undefined;
|
|
@@ -67,83 +67,75 @@ const tagColors = {
|
|
|
67
67
|
VIP: theme.colors.enterPink,
|
|
68
68
|
tester: theme.colors.enterCyan
|
|
69
69
|
};
|
|
70
|
-
|
|
71
70
|
const Template = args => /*#__PURE__*/React.createElement(GuestCard, args);
|
|
72
|
-
|
|
73
71
|
export const WithBackground = Template.bind({});
|
|
74
72
|
WithBackground.args = {
|
|
75
73
|
attendee: attendee,
|
|
76
74
|
checkinTag: 'default',
|
|
77
|
-
|
|
78
75
|
formatName(attendee) {
|
|
79
76
|
return attendee.userdata.name?.toString() ?? '';
|
|
80
77
|
}
|
|
81
|
-
|
|
82
78
|
};
|
|
83
79
|
export const Plain = Template.bind({});
|
|
84
80
|
Plain.args = {
|
|
85
81
|
plain: true,
|
|
86
82
|
attendee: attendee,
|
|
87
83
|
checkinTag: 'default',
|
|
88
|
-
|
|
89
84
|
formatName(attendee) {
|
|
90
85
|
return attendee.userdata.name?.toString() ?? '';
|
|
91
86
|
}
|
|
92
|
-
|
|
87
|
+
};
|
|
88
|
+
export const Dense = Template.bind({});
|
|
89
|
+
Dense.args = {
|
|
90
|
+
dense: true,
|
|
91
|
+
attendee: attendee,
|
|
92
|
+
checkinTag: 'default',
|
|
93
|
+
formatName(attendee) {
|
|
94
|
+
return attendee.userdata.name?.toString() ?? '';
|
|
95
|
+
}
|
|
93
96
|
};
|
|
94
97
|
export const FilteredTags = Template.bind({});
|
|
95
98
|
FilteredTags.args = {
|
|
96
99
|
attendee: attendee,
|
|
97
100
|
checkinTag: 'default',
|
|
98
|
-
|
|
99
101
|
filterTags(tag) {
|
|
100
102
|
const allowedTags = ['VIP'];
|
|
101
103
|
return allowedTags.includes(tag);
|
|
102
104
|
},
|
|
103
|
-
|
|
104
105
|
formatName(attendee) {
|
|
105
106
|
return attendee.userdata.name?.toString() ?? '';
|
|
106
107
|
}
|
|
107
|
-
|
|
108
108
|
};
|
|
109
109
|
export const WithColorLabel = Template.bind({});
|
|
110
110
|
WithColorLabel.args = {
|
|
111
111
|
attendee: attendee,
|
|
112
112
|
checkinTag: 'default',
|
|
113
|
-
|
|
114
113
|
formatName(attendee) {
|
|
115
114
|
return attendee.userdata.name?.toString() ?? '';
|
|
116
115
|
},
|
|
117
|
-
|
|
118
116
|
getTagColor(tag) {
|
|
119
117
|
return tagColors[tag] ?? undefined;
|
|
120
118
|
}
|
|
121
|
-
|
|
122
119
|
};
|
|
123
120
|
export const WithMultipleColorLabels = Template.bind({});
|
|
124
121
|
WithMultipleColorLabels.args = {
|
|
125
122
|
attendee: attendeeWithMultipleTags,
|
|
126
123
|
checkinTag: 'default',
|
|
127
|
-
|
|
128
124
|
formatName(attendee) {
|
|
129
125
|
return attendee.userdata.name?.toString() ?? '';
|
|
130
126
|
},
|
|
131
|
-
|
|
132
127
|
getTagColor(tag) {
|
|
133
128
|
return tagColors[tag] ?? undefined;
|
|
134
129
|
}
|
|
135
|
-
|
|
136
130
|
};
|
|
137
131
|
export const WithInfoText = Template.bind({});
|
|
138
132
|
WithInfoText.args = {
|
|
139
133
|
attendee: attendee,
|
|
140
134
|
checkinTag: 'default',
|
|
141
135
|
infoText: '🥦 Vegetarian',
|
|
142
|
-
|
|
143
136
|
formatName(attendee) {
|
|
144
137
|
return attendee.userdata.name?.toString() ?? '';
|
|
145
138
|
}
|
|
146
|
-
|
|
147
139
|
};
|
|
148
140
|
export const WithCompanion = Template.bind({});
|
|
149
141
|
WithCompanion.args = {
|
|
@@ -152,19 +144,15 @@ WithCompanion.args = {
|
|
|
152
144
|
findMainGuest: () => {
|
|
153
145
|
return attendee;
|
|
154
146
|
},
|
|
155
|
-
|
|
156
147
|
formatName(attendee) {
|
|
157
148
|
return attendee.userdata.name?.toString() ?? '';
|
|
158
149
|
}
|
|
159
|
-
|
|
160
150
|
};
|
|
161
151
|
export const WithCompanionButNoMainGuestInfo = Template.bind({});
|
|
162
152
|
WithCompanionButNoMainGuestInfo.args = {
|
|
163
153
|
attendee: companion,
|
|
164
154
|
checkinTag: 'default',
|
|
165
|
-
|
|
166
155
|
formatName(attendee) {
|
|
167
156
|
return attendee.userdata.name?.toString() ?? '';
|
|
168
157
|
}
|
|
169
|
-
|
|
170
158
|
};
|
|
@@ -4,9 +4,7 @@ export default {
|
|
|
4
4
|
title: 'Icons/Add Guest',
|
|
5
5
|
component: AddGuestIcon
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
const Template = args => /*#__PURE__*/React.createElement(AddGuestIcon, args);
|
|
9
|
-
|
|
10
8
|
export const Basic = Template.bind({});
|
|
11
9
|
Basic.args = {};
|
|
12
10
|
export const White = Template.bind({});
|
|
@@ -4,9 +4,7 @@ export default {
|
|
|
4
4
|
title: 'Icons/Settings',
|
|
5
5
|
component: SettingsIcon
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
const Template = args => /*#__PURE__*/React.createElement(SettingsIcon, args);
|
|
9
|
-
|
|
10
8
|
export const Basic = Template.bind({});
|
|
11
9
|
Basic.args = {};
|
|
12
10
|
export const White = Template.bind({});
|
|
@@ -4,9 +4,7 @@ export default {
|
|
|
4
4
|
title: 'Icons/Sort List',
|
|
5
5
|
component: SortListIcon
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
const Template = args => /*#__PURE__*/React.createElement(SortListIcon, args);
|
|
9
|
-
|
|
10
8
|
export const Basic = Template.bind({});
|
|
11
9
|
Basic.args = {};
|
|
12
10
|
export const White = Template.bind({});
|
package/dist/ui/tag.stories.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-crew-berlin/enter-js-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "utils such as vaildation and other helpers to work with data from the enter app",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"typescript": "^4.8.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"react": "^
|
|
70
|
-
"react-dom": "^
|
|
69
|
+
"react": "^18.1.0",
|
|
70
|
+
"react-dom": "^18.1.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"fefe": "^3.2.0",
|