@abgov/web-components 1.0.0-alpha.175 → 1.0.0-alpha.176

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/web-components",
3
- "version": "1.0.0-alpha.175",
3
+ "version": "1.0.0-alpha.176",
4
4
  "description": "Government of Alberta - UI Web components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -10412,7 +10412,7 @@ function create_if_block$8(ctx) {
10412
10412
 
10413
10413
  let current_block_type = select_block_type(ctx);
10414
10414
  let if_block1 = current_block_type(ctx);
10415
- let if_block2 = /*_isClosable*/ ctx[8] && create_if_block_1$2(ctx);
10415
+ let if_block2 = /*_isClosable*/ ctx[9] && create_if_block_1$2(ctx);
10416
10416
 
10417
10417
  return {
10418
10418
  c() {
@@ -10468,21 +10468,22 @@ function create_if_block$8(ctx) {
10468
10468
  if_block1.m(div1, null);
10469
10469
  append(header, t2);
10470
10470
  if (if_block2) if_block2.m(header, null);
10471
+ /*header_binding*/ ctx[16](header);
10471
10472
  append(div4, t3);
10472
10473
  append(div4, div2);
10473
10474
  append(div2, goa_scrollable);
10474
- /*goa_scrollable_binding*/ ctx[15](goa_scrollable);
10475
- /*div2_binding*/ ctx[16](div2);
10475
+ /*goa_scrollable_binding*/ ctx[17](goa_scrollable);
10476
+ /*div2_binding*/ ctx[18](div2);
10476
10477
  append(div4, t4);
10477
10478
  append(div4, div3);
10478
- /*div6_binding*/ ctx[17](div6);
10479
+ /*div6_binding*/ ctx[19](div6);
10479
10480
  current = true;
10480
10481
 
10481
10482
  if (!mounted) {
10482
10483
  dispose = [
10483
- listen(div0, "click", /*close*/ ctx[11]),
10484
- listen(goa_scrollable, "_scroll", /*handleScroll*/ ctx[12]),
10485
- action_destroyer(noscroll_action = noscroll.call(null, div6, { enable: /*_isOpen*/ ctx[6] }))
10484
+ listen(div0, "click", /*close*/ ctx[12]),
10485
+ listen(goa_scrollable, "_scroll", /*handleScroll*/ ctx[13]),
10486
+ action_destroyer(noscroll_action = noscroll.call(null, div6, { enable: /*_isOpen*/ ctx[7] }))
10486
10487
  ];
10487
10488
 
10488
10489
  mounted = true;
@@ -10516,7 +10517,7 @@ function create_if_block$8(ctx) {
10516
10517
  }
10517
10518
  }
10518
10519
 
10519
- if (/*_isClosable*/ ctx[8]) {
10520
+ if (/*_isClosable*/ ctx[9]) {
10520
10521
  if (if_block2) {
10521
10522
  if_block2.p(ctx, dirty);
10522
10523
  } else {
@@ -10533,7 +10534,7 @@ function create_if_block$8(ctx) {
10533
10534
  attr(div6, "style", div6_style_value);
10534
10535
  }
10535
10536
 
10536
- if (noscroll_action && is_function(noscroll_action.update) && dirty & /*_isOpen*/ 64) noscroll_action.update.call(null, { enable: /*_isOpen*/ ctx[6] });
10537
+ if (noscroll_action && is_function(noscroll_action.update) && dirty & /*_isOpen*/ 128) noscroll_action.update.call(null, { enable: /*_isOpen*/ ctx[7] });
10537
10538
 
10538
10539
  if (!current || dirty & /*open*/ 2) {
10539
10540
  set_custom_element_data(goa_focus_trap, "active", /*open*/ ctx[1]);
@@ -10546,7 +10547,7 @@ function create_if_block$8(ctx) {
10546
10547
  if (div5_outro) div5_outro.end(1);
10547
10548
 
10548
10549
  div5_intro = create_in_transition(div5, fly, {
10549
- duration: /*_transitionTime*/ ctx[10],
10550
+ duration: /*_transitionTime*/ ctx[11],
10550
10551
  y: 200
10551
10552
  });
10552
10553
 
@@ -10555,7 +10556,7 @@ function create_if_block$8(ctx) {
10555
10556
 
10556
10557
  add_render_callback(() => {
10557
10558
  if (div6_outro) div6_outro.end(1);
10558
- div6_intro = create_in_transition(div6, fade, { duration: /*_transitionTime*/ ctx[10] });
10559
+ div6_intro = create_in_transition(div6, fade, { duration: /*_transitionTime*/ ctx[11] });
10559
10560
  div6_intro.start();
10560
10561
  });
10561
10562
 
@@ -10565,16 +10566,16 @@ function create_if_block$8(ctx) {
10565
10566
  if (div5_intro) div5_intro.invalidate();
10566
10567
 
10567
10568
  div5_outro = create_out_transition(div5, fly, {
10568
- delay: /*_transitionTime*/ ctx[10],
10569
- duration: /*_transitionTime*/ ctx[10],
10569
+ delay: /*_transitionTime*/ ctx[11],
10570
+ duration: /*_transitionTime*/ ctx[11],
10570
10571
  y: -100
10571
10572
  });
10572
10573
 
10573
10574
  if (div6_intro) div6_intro.invalidate();
10574
10575
 
10575
10576
  div6_outro = create_out_transition(div6, fade, {
10576
- delay: /*_transitionTime*/ ctx[10],
10577
- duration: /*_transitionTime*/ ctx[10]
10577
+ delay: /*_transitionTime*/ ctx[11],
10578
+ duration: /*_transitionTime*/ ctx[11]
10578
10579
  });
10579
10580
 
10580
10581
  current = false;
@@ -10584,10 +10585,11 @@ function create_if_block$8(ctx) {
10584
10585
  if (if_block0) if_block0.d();
10585
10586
  if_block1.d();
10586
10587
  if (if_block2) if_block2.d();
10587
- /*goa_scrollable_binding*/ ctx[15](null);
10588
- /*div2_binding*/ ctx[16](null);
10588
+ /*header_binding*/ ctx[16](null);
10589
+ /*goa_scrollable_binding*/ ctx[17](null);
10590
+ /*div2_binding*/ ctx[18](null);
10589
10591
  if (detaching && div5_outro) div5_outro.end();
10590
- /*div6_binding*/ ctx[17](null);
10592
+ /*div6_binding*/ ctx[19](null);
10591
10593
  if (detaching && div6_outro) div6_outro.end();
10592
10594
  mounted = false;
10593
10595
  run_all(dispose);
@@ -10595,7 +10597,7 @@ function create_if_block$8(ctx) {
10595
10597
  };
10596
10598
  }
10597
10599
 
10598
- // (116:8) {#if calloutvariant !== null}
10600
+ // (132:8) {#if calloutvariant !== null}
10599
10601
  function create_if_block_3$2(ctx) {
10600
10602
  let div;
10601
10603
  let goa_icon;
@@ -10606,7 +10608,7 @@ function create_if_block_3$2(ctx) {
10606
10608
  c() {
10607
10609
  div = element("div");
10608
10610
  goa_icon = element("goa-icon");
10609
- set_custom_element_data(goa_icon, "type", /*_iconType*/ ctx[9]);
10611
+ set_custom_element_data(goa_icon, "type", /*_iconType*/ ctx[10]);
10610
10612
 
10611
10613
  set_custom_element_data(goa_icon, "inverted", goa_icon_inverted_value = /*calloutvariant*/ ctx[3] === "important"
10612
10614
  ? "false"
@@ -10619,8 +10621,8 @@ function create_if_block_3$2(ctx) {
10619
10621
  append(div, goa_icon);
10620
10622
  },
10621
10623
  p(ctx, dirty) {
10622
- if (dirty & /*_iconType*/ 512) {
10623
- set_custom_element_data(goa_icon, "type", /*_iconType*/ ctx[9]);
10624
+ if (dirty & /*_iconType*/ 1024) {
10625
+ set_custom_element_data(goa_icon, "type", /*_iconType*/ ctx[10]);
10624
10626
  }
10625
10627
 
10626
10628
  if (dirty & /*calloutvariant*/ 8 && goa_icon_inverted_value !== (goa_icon_inverted_value = /*calloutvariant*/ ctx[3] === "important"
@@ -10639,7 +10641,7 @@ function create_if_block_3$2(ctx) {
10639
10641
  };
10640
10642
  }
10641
10643
 
10642
- // (129:14) {:else}
10644
+ // (145:14) {:else}
10643
10645
  function create_else_block$3(ctx) {
10644
10646
  let slot;
10645
10647
 
@@ -10658,7 +10660,7 @@ function create_else_block$3(ctx) {
10658
10660
  };
10659
10661
  }
10660
10662
 
10661
- // (127:14) {#if heading}
10663
+ // (143:14) {#if heading}
10662
10664
  function create_if_block_2$2(ctx) {
10663
10665
  let t;
10664
10666
 
@@ -10678,7 +10680,7 @@ function create_if_block_2$2(ctx) {
10678
10680
  };
10679
10681
  }
10680
10682
 
10681
- // (133:12) {#if _isClosable}
10683
+ // (149:12) {#if _isClosable}
10682
10684
  function create_if_block_1$2(ctx) {
10683
10685
  let div;
10684
10686
  let goa_icon_button;
@@ -10699,7 +10701,7 @@ function create_if_block_1$2(ctx) {
10699
10701
  append(div, goa_icon_button);
10700
10702
 
10701
10703
  if (!mounted) {
10702
- dispose = listen(goa_icon_button, "click", /*close*/ ctx[11]);
10704
+ dispose = listen(goa_icon_button, "click", /*close*/ ctx[12]);
10703
10705
  mounted = true;
10704
10706
  }
10705
10707
  },
@@ -10715,7 +10717,7 @@ function create_if_block_1$2(ctx) {
10715
10717
  function create_fragment$i(ctx) {
10716
10718
  let if_block_anchor;
10717
10719
  let current;
10718
- let if_block = /*_isOpen*/ ctx[6] && create_if_block$8(ctx);
10720
+ let if_block = /*_isOpen*/ ctx[7] && create_if_block$8(ctx);
10719
10721
 
10720
10722
  return {
10721
10723
  c() {
@@ -10729,11 +10731,11 @@ function create_fragment$i(ctx) {
10729
10731
  current = true;
10730
10732
  },
10731
10733
  p(ctx, [dirty]) {
10732
- if (/*_isOpen*/ ctx[6]) {
10734
+ if (/*_isOpen*/ ctx[7]) {
10733
10735
  if (if_block) {
10734
10736
  if_block.p(ctx, dirty);
10735
10737
 
10736
- if (dirty & /*_isOpen*/ 64) {
10738
+ if (dirty & /*_isOpen*/ 128) {
10737
10739
  transition_in(if_block, 1);
10738
10740
  }
10739
10741
  } else {
@@ -10785,6 +10787,7 @@ function instance$g($$self, $$props, $$invalidate) {
10785
10787
 
10786
10788
  let _contentEl = null;
10787
10789
  let _scrollEl = null;
10790
+ let _headerEl = null;
10788
10791
 
10789
10792
  // Type verification
10790
10793
  const [CALLOUT_VARIANT, validateCalloutVariant] = typeValidator("Callout variant", ["emergency", "important", "information", "success", "event"]);
@@ -10837,56 +10840,73 @@ function instance$g($$self, $$props, $$invalidate) {
10837
10840
  }
10838
10841
  }
10839
10842
 
10843
+ function getChildren() {
10844
+ const slot = _headerEl.querySelector("slot");
10845
+
10846
+ if (slot) {
10847
+ return [...slot.assignedElements()];
10848
+ } else {
10849
+ return [..._headerEl.children]; // unit tests
10850
+ }
10851
+ }
10852
+
10853
+ function header_binding($$value) {
10854
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
10855
+ _headerEl = $$value;
10856
+ (($$invalidate(6, _headerEl), $$invalidate(7, _isOpen)), $$invalidate(1, open));
10857
+ });
10858
+ }
10859
+
10840
10860
  function goa_scrollable_binding($$value) {
10841
10861
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
10842
10862
  _scrollEl = $$value;
10843
- (($$invalidate(5, _scrollEl), $$invalidate(6, _isOpen)), $$invalidate(1, open));
10863
+ (($$invalidate(5, _scrollEl), $$invalidate(7, _isOpen)), $$invalidate(1, open));
10844
10864
  });
10845
10865
  }
10846
10866
 
10847
10867
  function div2_binding($$value) {
10848
10868
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
10849
10869
  _contentEl = $$value;
10850
- (($$invalidate(4, _contentEl), $$invalidate(6, _isOpen)), $$invalidate(1, open));
10870
+ (($$invalidate(4, _contentEl), $$invalidate(7, _isOpen)), $$invalidate(1, open));
10851
10871
  });
10852
10872
  }
10853
10873
 
10854
10874
  function div6_binding($$value) {
10855
10875
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
10856
10876
  _rootEl = $$value;
10857
- (($$invalidate(7, _rootEl), $$invalidate(6, _isOpen)), $$invalidate(1, open));
10877
+ (($$invalidate(8, _rootEl), $$invalidate(7, _isOpen)), $$invalidate(1, open));
10858
10878
  });
10859
10879
  }
10860
10880
 
10861
10881
  $$self.$$set = $$props => {
10862
10882
  if ('heading' in $$props) $$invalidate(0, heading = $$props.heading);
10863
- if ('closable' in $$props) $$invalidate(13, closable = $$props.closable);
10883
+ if ('closable' in $$props) $$invalidate(14, closable = $$props.closable);
10864
10884
  if ('open' in $$props) $$invalidate(1, open = $$props.open);
10865
- if ('transition' in $$props) $$invalidate(14, transition = $$props.transition);
10885
+ if ('transition' in $$props) $$invalidate(15, transition = $$props.transition);
10866
10886
  if ('width' in $$props) $$invalidate(2, width = $$props.width);
10867
10887
  if ('calloutvariant' in $$props) $$invalidate(3, calloutvariant = $$props.calloutvariant);
10868
10888
  };
10869
10889
 
10870
10890
  $$self.$$.update = () => {
10871
- if ($$self.$$.dirty & /*closable*/ 8192) {
10891
+ if ($$self.$$.dirty & /*closable*/ 16384) {
10872
10892
  // Reactive
10873
- $$invalidate(8, _isClosable = toBoolean(closable));
10893
+ $$invalidate(9, _isClosable = toBoolean(closable));
10874
10894
  }
10875
10895
 
10876
10896
  if ($$self.$$.dirty & /*open*/ 2) {
10877
- $$invalidate(6, _isOpen = toBoolean(open));
10897
+ $$invalidate(7, _isOpen = toBoolean(open));
10878
10898
  }
10879
10899
 
10880
- if ($$self.$$.dirty & /*_isOpen*/ 64) {
10900
+ if ($$self.$$.dirty & /*_isOpen*/ 128) {
10881
10901
  if (!_isOpen) {
10882
10902
  // prevent null issues
10883
- $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(7, _rootEl = null)));
10903
+ $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(8, _rootEl = $$invalidate(6, _headerEl = null))));
10884
10904
 
10885
10905
  window.removeEventListener('keydown', onInputKeyDown);
10886
10906
  }
10887
10907
  }
10888
10908
 
10889
- if ($$self.$$.dirty & /*_isOpen, _scrollEl, _contentEl*/ 112) {
10909
+ if ($$self.$$.dirty & /*_isOpen, _scrollEl, _contentEl*/ 176) {
10890
10910
  if (_isOpen && _scrollEl && _contentEl) {
10891
10911
  const hasScroll = _scrollEl.scrollHeight > _scrollEl.offsetHeight;
10892
10912
 
@@ -10896,20 +10916,25 @@ function instance$g($$self, $$props, $$invalidate) {
10896
10916
  }
10897
10917
  }
10898
10918
 
10899
- if ($$self.$$.dirty & /*_isOpen, _contentEl*/ 80) {
10919
+ if ($$self.$$.dirty & /*_isOpen, _contentEl, _headerEl*/ 208) {
10900
10920
  if (_isOpen && _contentEl) {
10901
10921
  window.addEventListener('keydown', onInputKeyDown);
10922
+ const children = getChildren();
10923
+
10924
+ if (_headerEl.querySelector("div.modal-title").textContent || _headerEl.querySelector("div.modal-close") || children.length) {
10925
+ _headerEl.classList.add("has-content");
10926
+ }
10902
10927
  }
10903
10928
  }
10904
10929
 
10905
- if ($$self.$$.dirty & /*transition*/ 16384) {
10906
- $$invalidate(10, _transitionTime = transition === "none"
10930
+ if ($$self.$$.dirty & /*transition*/ 32768) {
10931
+ $$invalidate(11, _transitionTime = transition === "none"
10907
10932
  ? 0
10908
10933
  : transition === "slow" ? 400 : 200);
10909
10934
  }
10910
10935
 
10911
10936
  if ($$self.$$.dirty & /*calloutvariant*/ 8) {
10912
- $$invalidate(9, _iconType = calloutvariant === "emergency"
10937
+ $$invalidate(10, _iconType = calloutvariant === "emergency"
10913
10938
  ? "warning"
10914
10939
  : calloutvariant === "important"
10915
10940
  ? "alert-circle"
@@ -10928,6 +10953,7 @@ function instance$g($$self, $$props, $$invalidate) {
10928
10953
  calloutvariant,
10929
10954
  _contentEl,
10930
10955
  _scrollEl,
10956
+ _headerEl,
10931
10957
  _isOpen,
10932
10958
  _rootEl,
10933
10959
  _isClosable,
@@ -10937,6 +10963,7 @@ function instance$g($$self, $$props, $$invalidate) {
10937
10963
  handleScroll,
10938
10964
  closable,
10939
10965
  transition,
10966
+ header_binding,
10940
10967
  goa_scrollable_binding,
10941
10968
  div2_binding,
10942
10969
  div6_binding
@@ -10946,7 +10973,7 @@ function instance$g($$self, $$props, $$invalidate) {
10946
10973
  class Modal extends SvelteElement {
10947
10974
  constructor(options) {
10948
10975
  super();
10949
- this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}:host *{box-sizing:border-box}.modal{font-family:var(--goa-font-family-sans);position:fixed;inset:0;display:flex;align-items:center;justify-content:center;height:100vh;width:100%;z-index:100}.modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.2);z-index:1000}.emergency{background-color:var(--goa-color-emergency-default)}.important{background-color:var(--goa-color-warning-default)}.information{background-color:var(--goa-color-info-default)}.event{background-color:var(--goa-color-info-default)}.success{background-color:var(--goa-color-success-default)}.callout-bar{flex:0 0 3rem;text-align:center;padding-top:2rem;border-radius:4px 0px 0px 4px}.content{flex:1 1 auto;width:100%;margin:2rem}.content header{display:flex;align-items:center;margin-bottom:2rem;justify-content:space-between}.modal-pane{position:relative;background-color:#fff;z-index:1001;width:90%;display:flex;box-shadow:var(--goa-shadow-modal);border-radius:4px;border:1px solid var(--goa-color-greyscale-700)}@media(min-width: 640px){.modal-pane{width:var(--width, 60ch)}}.modal-actions ::slotted(*){padding:1.5rem 0 0}.modal-content{margin:0 -2rem;line-height:1.75rem}.modal-content ::slotted(:last-child){margin-bottom:0 !important}.modal-title{font-size:var(--goa-font-size-7);flex:0 0 auto}.scroll-top{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-middle{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1), inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-bottom{box-shadow:inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}</style>`;
10976
+ this.shadowRoot.innerHTML = `<style>:host{box-sizing:border-box;font-family:var(--goa-font-family-sans)}:host *{box-sizing:border-box}.modal{font-family:var(--goa-font-family-sans);position:fixed;inset:0;display:flex;align-items:center;justify-content:center;height:100vh;width:100%;z-index:100}.modal-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.2);z-index:1000}.emergency{background-color:var(--goa-color-emergency-default)}.important{background-color:var(--goa-color-warning-default)}.information{background-color:var(--goa-color-info-default)}.event{background-color:var(--goa-color-info-default)}.success{background-color:var(--goa-color-success-default)}.callout-bar{flex:0 0 3rem;text-align:center;padding-top:2rem;border-radius:4px 0px 0px 4px}.content{flex:1 1 auto;width:100%;margin:2rem}.content header{display:flex;justify-content:space-between}.content header.has-content{margin-bottom:2rem}.modal-pane{position:relative;background-color:#fff;z-index:1001;width:90%;display:flex;box-shadow:var(--goa-shadow-modal);border-radius:4px;border:1px solid var(--goa-color-greyscale-700)}@media(min-width: 640px){.modal-pane{width:var(--width, 60ch)}}.modal-actions ::slotted(*){padding:1.5rem 0 0}.modal-content{margin:0 -2rem;line-height:1.75rem}.modal-content ::slotted(:last-child){margin-bottom:0 !important}.modal-title{font:var(--goa-typography-heading-m)}.modal-close{padding-left:var(--goa-space-m);margin-top:var(--goa-space-2xs)}.scroll-top{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-middle{box-shadow:inset 0px -8px 6px -6px rgba(0, 0, 0, 0.1), inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}.scroll-bottom{box-shadow:inset 0px 8px 6px -6px rgba(0, 0, 0, 0.1)}</style>`;
10950
10977
 
10951
10978
  init(
10952
10979
  this,
@@ -10960,9 +10987,9 @@ class Modal extends SvelteElement {
10960
10987
  safe_not_equal,
10961
10988
  {
10962
10989
  heading: 0,
10963
- closable: 13,
10990
+ closable: 14,
10964
10991
  open: 1,
10965
- transition: 14,
10992
+ transition: 15,
10966
10993
  width: 2,
10967
10994
  calloutvariant: 3
10968
10995
  },
@@ -10995,7 +11022,7 @@ class Modal extends SvelteElement {
10995
11022
  }
10996
11023
 
10997
11024
  get closable() {
10998
- return this.$$.ctx[13];
11025
+ return this.$$.ctx[14];
10999
11026
  }
11000
11027
 
11001
11028
  set closable(closable) {
@@ -11013,7 +11040,7 @@ class Modal extends SvelteElement {
11013
11040
  }
11014
11041
 
11015
11042
  get transition() {
11016
- return this.$$.ctx[14];
11043
+ return this.$$.ctx[15];
11017
11044
  }
11018
11045
 
11019
11046
  set transition(transition) {