Sha256: 69e3e71c4cc555f1b484ec8db36419d8b653203f7aea9267d4cdad292d727f6e

Contents?: true

Size: 911 Bytes

Versions: 281

Compression:

Stored size: 911 Bytes

Contents

export const showElement = (elem: HTMLElement) => {
  elem.style.display = 'block';
  const height = elem.scrollHeight + 'px'; // Get its height
  elem.style.height = height; // Update the max-height
  elem.classList.add('is-visible');
  elem.style.overflow = "hidden"
  // Once the transition is complete, remove the inline max-height so the content can scale responsively
  window.setTimeout(() => {
    elem.style.height = '';
    elem.style.overflow = "visible"
  }, 300);
};

export const hideElement = (elem: HTMLElement) => {
  elem.style.height = elem.scrollHeight + 'px';

  window.setTimeout(() => {
    elem.style.height = '0';
    elem.style.paddingTop = '0';
    elem.style.paddingBottom = '0';
    elem.style.overflow = "hidden"
  }, 1);

  // When the transition is complete, hide it
  window.setTimeout(() => {
    elem.classList.remove('is-visible');
    elem.style.overflow = ""
  }, 300);
};

Version data entries

281 entries across 281 versions & 1 rubygems

Version Path
playbook_ui-14.3.1.pre.alpha.dhhuynh2patch13743 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.4.0.pre.rc.3 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.4.0.pre.rc.2 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.1 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.4.0.pre.rc.1 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.alpha.revert3654PBNTR479removeextraspacingfromradiochildren3734 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.4.0.pre.rc.0 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.12 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.11 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.10 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.9 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.8 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.7 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.6 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.5 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.4 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.20240828cikubedbump3702 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.3.0.pre.rc.3 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts
playbook_ui-14.2.1.pre.alpha.PBNTR431fixingduplicatingtextareaclassname3689 app/pb_kits/playbook/pb_collapsible/_helper_functions.ts