Skip to content

Commit

Permalink
rsvp
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuer committed Nov 14, 2023
1 parent 6f6c0a0 commit add3cb6
Show file tree
Hide file tree
Showing 20 changed files with 3,812 additions and 358 deletions.
427 changes: 412 additions & 15 deletions assets/css/atcb-3d.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-3d.min.css

Large diffs are not rendered by default.

432 changes: 418 additions & 14 deletions assets/css/atcb-date.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-date.min.css

Large diffs are not rendered by default.

427 changes: 413 additions & 14 deletions assets/css/atcb-flat.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-flat.min.css

Large diffs are not rendered by default.

439 changes: 424 additions & 15 deletions assets/css/atcb-neumorphism.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-neumorphism.min.css

Large diffs are not rendered by default.

433 changes: 415 additions & 18 deletions assets/css/atcb-round.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-round.min.css

Large diffs are not rendered by default.

427 changes: 412 additions & 15 deletions assets/css/atcb-text.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb-text.min.css

Large diffs are not rendered by default.

327 changes: 252 additions & 75 deletions assets/css/atcb.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/atcb.min.css

Large diffs are not rendered by default.

328 changes: 253 additions & 75 deletions demo/public/atcb.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/atcb-decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ function atcb_decorate_data_options(data) {
}

function atcb_decorate_data_style(data) {
// set inline if inlineRSVP
if (data.inlineRSVP) {
data.inline = true;
}
// set default listStyle
if (data.listStyle == null || data.listStyle == '') {
data.listStyle = 'dropdown';
Expand Down
193 changes: 130 additions & 63 deletions src/atcb-generate-pro.js

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions src/atcb-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function atcb_generate_label(host, data, parent, type, icon = false, text = '',
'click',
atcb_debounce_leading(() => {
if (oneOption) {
host.querySelector('#' + parent.id).blur();
host.querySelector('#' + parent.id)?.blur();
atcb_log_event('openSingletonLink', parent.id, data.identifier);
} else {
atcb_toggle(host, 'close');
Expand All @@ -101,7 +101,7 @@ function atcb_generate_label(host, data, parent, type, icon = false, text = '',
if (event.key === 'Enter') {
event.preventDefault();
if (oneOption) {
host.querySelector('#' + parent.id).blur();
host.querySelector('#' + parent.id)?.blur();
atcb_log_event('openSingletonLink', parent.id, data.identifier);
} else {
atcb_toggle(host, 'close');
Expand Down Expand Up @@ -162,7 +162,7 @@ function atcb_generate_label_content(data, parent, type, icon, text, oneOption)
}
}
// add icon and text label (not in the date style trigger case)
if (data.buttonStyle == 'date' && (type == 'trigger' || oneOption)) {
if (data.buttonStyle === 'date' && (type == 'trigger' || oneOption)) {
return;
}
if (icon) {
Expand Down Expand Up @@ -206,7 +206,6 @@ function atcb_generate_button(host, button, data) {
buttonTrigger.classList.add('atcb-button');
if (data.disabled) {
buttonTrigger.setAttribute('disabled', true);
buttonTrigger.style.cssText = 'opacity: .75; cursor: not-allowed; filter: brightness(95%); border-style: dashed; box-shadow: none;';
}
if (data.hideTextLabelButton) {
buttonTrigger.classList.add('atcb-no-text');
Expand All @@ -221,7 +220,7 @@ function atcb_generate_button(host, button, data) {
buttonTrigger.setAttribute('aria-expanded', false); // aria-expanded default value on button generate
buttonTriggerWrapper.append(buttonTrigger);
// generate the label incl. eventListeners
if (data.buttonStyle == 'date') {
if (data.buttonStyle === 'date') {
atcb_generate_date_button(data, buttonTrigger);
}
// if there is only 1 calendar option, we directly show this at the button, but with the trigger's label text (small exception for the date style)
Expand Down Expand Up @@ -422,21 +421,21 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
// set overlay size just to be sure
atcb_set_fullsize(bgOverlay);
// add icon
if (icon != '' && !data.hideIconModal) {
if (icon !== '' && !data.hideIconModal) {
const modalIcon = document.createElement('div');
modalIcon.classList.add('atcb-modal-icon');
modalIcon.innerHTML = atcbIcon[`${icon}`];
modal.append(modalIcon);
}
// add headline
if (headline && headline != '') {
if (headline && headline !== '') {
const modalHeadline = document.createElement('div');
modalHeadline.classList.add('atcb-modal-headline');
modalHeadline.textContent = headline;
modal.append(modalHeadline);
}
// add text content
if (content != '') {
if (content !== '') {
const modalContent = document.createElement('div');
modalContent.classList.add('atcb-modal-content');
modalContent.innerHTML = content;
Expand All @@ -461,8 +460,8 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
modalsubEventsContent.append(modalSubEventButton);
atcb_generate_date_button(data, modalSubEventButton, i);
// interaction only if not overdue and blocked
if (!data.dates[i - 1].overdue || data.pastDateHandling == 'none') {
if (i == 1 && keyboardTrigger) {
if (!data.dates[i - 1].overdue || data.pastDateHandling === 'none') {
if (i === 1 && keyboardTrigger) {
modalSubEventButton.focus();
}
modalSubEventButton.addEventListener(
Expand All @@ -476,20 +475,19 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
} else {
// if blocked, we also add styles
modalSubEventButton.setAttribute('disabled', true);
modalSubEventButton.style.cssText = 'opacity: .75; cursor: not-allowed; filter: brightness(95%); border-style: dashed; box-shadow: none;';
}
}
}
// add buttons (array of objects; attributes: href, type, label, primary(boolean), small(boolean))
if (buttons.length == 0) {
// add buttons (array of objects; attributes: href, type, label, primary(boolean), small(boolean), id)
if (buttons.length === 0) {
buttons.push({ type: 'close', label: atcb_translate_hook('close', data), small: true });
}
const modalButtons = document.createElement('div');
modalButtons.classList.add('atcb-modal-buttons');
modal.append(modalButtons);
buttons.forEach((button, index) => {
let modalButton;
if (button.href != null && button.href != '') {
if (button.href && button.href !== '') {
modalButton = document.createElement('a');
modalButton.setAttribute('target', atcbDefaultTarget);
modalButton.setAttribute('href', button.href);
Expand All @@ -498,19 +496,22 @@ function atcb_create_modal(host, data, icon = '', headline, content = '', button
modalButton = document.createElement('button');
modalButton.type = 'button';
}
if (button.id && button.id !== '') {
modalButton.id = button.id;
}
modalButton.classList.add('atcb-modal-btn');
if (button.primary) {
modalButton.classList.add('atcb-modal-btn-primary');
}
if (button.small) {
modalButton.classList.add('btn-small');
}
if (button.label == null || button.label == '') {
if (!button.label || button.label === '') {
button.label = atcb_translate_hook('modal.button.default', data);
}
modalButton.textContent = button.label;
modalButtons.append(modalButton);
if (index == 0 && subEvents.length < 2 && keyboardTrigger) {
if (index === 0 && subEvents.length < 2 && keyboardTrigger) {
modalButton.focus();
}
switch (button.type) {
Expand Down
Loading

0 comments on commit add3cb6

Please sign in to comment.