@abgov/react-components 4.0.0-alpha.136 → 4.0.0-alpha.137

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/react-components",
3
- "version": "4.0.0-alpha.136",
3
+ "version": "4.0.0-alpha.137",
4
4
  "description": "Government of Alberta - UI components for React",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -12812,7 +12812,7 @@ function create_if_block$8(ctx) {
12812
12812
  let if_block1 = current_block_type(ctx);
12813
12813
  let if_block2 =
12814
12814
  /*_isClosable*/
12815
- ctx[8] && create_if_block_1$2(ctx);
12815
+ ctx[9] && create_if_block_1$2(ctx);
12816
12816
  return {
12817
12817
  c() {
12818
12818
  goa_focus_trap = element("goa-focus-trap");
@@ -12874,31 +12874,34 @@ function create_if_block$8(ctx) {
12874
12874
  if_block1.m(div1, null);
12875
12875
  append(header, t2);
12876
12876
  if (if_block2) if_block2.m(header, null);
12877
+ /*header_binding*/
12878
+
12879
+ ctx[16](header);
12877
12880
  append(div4, t3);
12878
12881
  append(div4, div2);
12879
12882
  append(div2, goa_scrollable);
12880
12883
  /*goa_scrollable_binding*/
12881
12884
 
12882
- ctx[15](goa_scrollable);
12885
+ ctx[17](goa_scrollable);
12883
12886
  /*div2_binding*/
12884
12887
 
12885
- ctx[16](div2);
12888
+ ctx[18](div2);
12886
12889
  append(div4, t4);
12887
12890
  append(div4, div3);
12888
12891
  /*div6_binding*/
12889
12892
 
12890
- ctx[17](div6);
12893
+ ctx[19](div6);
12891
12894
  current = true;
12892
12895
 
12893
12896
  if (!mounted) {
12894
12897
  dispose = [listen(div0, "click",
12895
12898
  /*close*/
12896
- ctx[11]), listen(goa_scrollable, "_scroll",
12899
+ ctx[12]), listen(goa_scrollable, "_scroll",
12897
12900
  /*handleScroll*/
12898
- ctx[12]), action_destroyer(noscroll_action = noscroll.call(null, div6, {
12901
+ ctx[13]), action_destroyer(noscroll_action = noscroll.call(null, div6, {
12899
12902
  enable:
12900
12903
  /*_isOpen*/
12901
- ctx[6]
12904
+ ctx[7]
12902
12905
  }))];
12903
12906
  mounted = true;
12904
12907
  }
@@ -12936,7 +12939,7 @@ function create_if_block$8(ctx) {
12936
12939
 
12937
12940
  if (
12938
12941
  /*_isClosable*/
12939
- ctx[8]) {
12942
+ ctx[9]) {
12940
12943
  if (if_block2) {
12941
12944
  if_block2.p(ctx, dirty);
12942
12945
  } else {
@@ -12961,10 +12964,10 @@ function create_if_block$8(ctx) {
12961
12964
 
12962
12965
  if (noscroll_action && is_function(noscroll_action.update) && dirty &
12963
12966
  /*_isOpen*/
12964
- 64) noscroll_action.update.call(null, {
12967
+ 128) noscroll_action.update.call(null, {
12965
12968
  enable:
12966
12969
  /*_isOpen*/
12967
- ctx[6]
12970
+ ctx[7]
12968
12971
  });
12969
12972
 
12970
12973
  if (!current || dirty &
@@ -12983,7 +12986,7 @@ function create_if_block$8(ctx) {
12983
12986
  div5_intro = create_in_transition(div5, fly, {
12984
12987
  duration:
12985
12988
  /*_transitionTime*/
12986
- ctx[10],
12989
+ ctx[11],
12987
12990
  y: 200
12988
12991
  });
12989
12992
  div5_intro.start();
@@ -12993,7 +12996,7 @@ function create_if_block$8(ctx) {
12993
12996
  div6_intro = create_in_transition(div6, fade, {
12994
12997
  duration:
12995
12998
  /*_transitionTime*/
12996
- ctx[10]
12999
+ ctx[11]
12997
13000
  });
12998
13001
  div6_intro.start();
12999
13002
  });
@@ -13005,20 +13008,20 @@ function create_if_block$8(ctx) {
13005
13008
  div5_outro = create_out_transition(div5, fly, {
13006
13009
  delay:
13007
13010
  /*_transitionTime*/
13008
- ctx[10],
13011
+ ctx[11],
13009
13012
  duration:
13010
13013
  /*_transitionTime*/
13011
- ctx[10],
13014
+ ctx[11],
13012
13015
  y: -100
13013
13016
  });
13014
13017
  if (div6_intro) div6_intro.invalidate();
13015
13018
  div6_outro = create_out_transition(div6, fade, {
13016
13019
  delay:
13017
13020
  /*_transitionTime*/
13018
- ctx[10],
13021
+ ctx[11],
13019
13022
  duration:
13020
13023
  /*_transitionTime*/
13021
- ctx[10]
13024
+ ctx[11]
13022
13025
  });
13023
13026
  current = false;
13024
13027
  },
@@ -13028,23 +13031,26 @@ function create_if_block$8(ctx) {
13028
13031
  if (if_block0) if_block0.d();
13029
13032
  if_block1.d();
13030
13033
  if (if_block2) if_block2.d();
13034
+ /*header_binding*/
13035
+
13036
+ ctx[16](null);
13031
13037
  /*goa_scrollable_binding*/
13032
13038
 
13033
- ctx[15](null);
13039
+ ctx[17](null);
13034
13040
  /*div2_binding*/
13035
13041
 
13036
- ctx[16](null);
13042
+ ctx[18](null);
13037
13043
  if (detaching && div5_outro) div5_outro.end();
13038
13044
  /*div6_binding*/
13039
13045
 
13040
- ctx[17](null);
13046
+ ctx[19](null);
13041
13047
  if (detaching && div6_outro) div6_outro.end();
13042
13048
  mounted = false;
13043
13049
  run_all(dispose);
13044
13050
  }
13045
13051
 
13046
13052
  };
13047
- } // (116:8) {#if calloutvariant !== null}
13053
+ } // (132:8) {#if calloutvariant !== null}
13048
13054
 
13049
13055
 
13050
13056
  function create_if_block_3$2(ctx) {
@@ -13058,7 +13064,7 @@ function create_if_block_3$2(ctx) {
13058
13064
  goa_icon = element("goa-icon");
13059
13065
  set_custom_element_data(goa_icon, "type",
13060
13066
  /*_iconType*/
13061
- ctx[9]);
13067
+ ctx[10]);
13062
13068
  set_custom_element_data(goa_icon, "inverted", goa_icon_inverted_value =
13063
13069
  /*calloutvariant*/
13064
13070
  ctx[3] === "important" ? "false" : "true");
@@ -13075,10 +13081,10 @@ function create_if_block_3$2(ctx) {
13075
13081
  p(ctx, dirty) {
13076
13082
  if (dirty &
13077
13083
  /*_iconType*/
13078
- 512) {
13084
+ 1024) {
13079
13085
  set_custom_element_data(goa_icon, "type",
13080
13086
  /*_iconType*/
13081
- ctx[9]);
13087
+ ctx[10]);
13082
13088
  }
13083
13089
 
13084
13090
  if (dirty &
@@ -13103,7 +13109,7 @@ function create_if_block_3$2(ctx) {
13103
13109
  }
13104
13110
 
13105
13111
  };
13106
- } // (129:14) {:else}
13112
+ } // (145:14) {:else}
13107
13113
 
13108
13114
 
13109
13115
  function create_else_block$3(ctx) {
@@ -13125,7 +13131,7 @@ function create_else_block$3(ctx) {
13125
13131
  }
13126
13132
 
13127
13133
  };
13128
- } // (127:14) {#if heading}
13134
+ } // (143:14) {#if heading}
13129
13135
 
13130
13136
 
13131
13137
  function create_if_block_2$2(ctx) {
@@ -13154,7 +13160,7 @@ function create_if_block_2$2(ctx) {
13154
13160
  }
13155
13161
 
13156
13162
  };
13157
- } // (133:12) {#if _isClosable}
13163
+ } // (149:12) {#if _isClosable}
13158
13164
 
13159
13165
 
13160
13166
  function create_if_block_1$2(ctx) {
@@ -13179,7 +13185,7 @@ function create_if_block_1$2(ctx) {
13179
13185
  if (!mounted) {
13180
13186
  dispose = listen(goa_icon_button, "click",
13181
13187
  /*close*/
13182
- ctx[11]);
13188
+ ctx[12]);
13183
13189
  mounted = true;
13184
13190
  }
13185
13191
  },
@@ -13200,7 +13206,7 @@ function create_fragment$i(ctx) {
13200
13206
  let current;
13201
13207
  let if_block =
13202
13208
  /*_isOpen*/
13203
- ctx[6] && create_if_block$8(ctx);
13209
+ ctx[7] && create_if_block$8(ctx);
13204
13210
  return {
13205
13211
  c() {
13206
13212
  if (if_block) if_block.c();
@@ -13217,13 +13223,13 @@ function create_fragment$i(ctx) {
13217
13223
  p(ctx, [dirty]) {
13218
13224
  if (
13219
13225
  /*_isOpen*/
13220
- ctx[6]) {
13226
+ ctx[7]) {
13221
13227
  if (if_block) {
13222
13228
  if_block.p(ctx, dirty);
13223
13229
 
13224
13230
  if (dirty &
13225
13231
  /*_isOpen*/
13226
- 64) {
13232
+ 128) {
13227
13233
  transition_in(if_block, 1);
13228
13234
  }
13229
13235
  } else {
@@ -13290,7 +13296,8 @@ function instance$g($$self, $$props, $$invalidate) {
13290
13296
 
13291
13297
  let _rootEl = null;
13292
13298
  let _contentEl = null;
13293
- let _scrollEl = null; // Type verification
13299
+ let _scrollEl = null;
13300
+ let _headerEl = null; // Type verification
13294
13301
 
13295
13302
  const [CALLOUT_VARIANT, validateCalloutVariant] = typeValidator("Callout variant", ["emergency", "important", "information", "success", "event"]);
13296
13303
  const [Transitions, validateTransition] = typeValidator("Modal transition", ["fast", "slow", "none"]); // Hooks
@@ -13339,32 +13346,49 @@ function instance$g($$self, $$props, $$invalidate) {
13339
13346
  }
13340
13347
  }
13341
13348
 
13349
+ function getChildren() {
13350
+ const slot = _headerEl.querySelector("slot");
13351
+
13352
+ if (slot) {
13353
+ return [...slot.assignedElements()];
13354
+ } else {
13355
+ return [..._headerEl.children]; // unit tests
13356
+ }
13357
+ }
13358
+
13359
+ function header_binding($$value) {
13360
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13361
+ _headerEl = $$value;
13362
+ ($$invalidate(6, _headerEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13363
+ });
13364
+ }
13365
+
13342
13366
  function goa_scrollable_binding($$value) {
13343
13367
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13344
13368
  _scrollEl = $$value;
13345
- ($$invalidate(5, _scrollEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13369
+ ($$invalidate(5, _scrollEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13346
13370
  });
13347
13371
  }
13348
13372
 
13349
13373
  function div2_binding($$value) {
13350
13374
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13351
13375
  _contentEl = $$value;
13352
- ($$invalidate(4, _contentEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13376
+ ($$invalidate(4, _contentEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13353
13377
  });
13354
13378
  }
13355
13379
 
13356
13380
  function div6_binding($$value) {
13357
13381
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13358
13382
  _rootEl = $$value;
13359
- ($$invalidate(7, _rootEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13383
+ ($$invalidate(8, _rootEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13360
13384
  });
13361
13385
  }
13362
13386
 
13363
13387
  $$self.$$set = $$props => {
13364
13388
  if ('heading' in $$props) $$invalidate(0, heading = $$props.heading);
13365
- if ('closable' in $$props) $$invalidate(13, closable = $$props.closable);
13389
+ if ('closable' in $$props) $$invalidate(14, closable = $$props.closable);
13366
13390
  if ('open' in $$props) $$invalidate(1, open = $$props.open);
13367
- if ('transition' in $$props) $$invalidate(14, transition = $$props.transition);
13391
+ if ('transition' in $$props) $$invalidate(15, transition = $$props.transition);
13368
13392
  if ('width' in $$props) $$invalidate(2, width = $$props.width);
13369
13393
  if ('calloutvariant' in $$props) $$invalidate(3, calloutvariant = $$props.calloutvariant);
13370
13394
  };
@@ -13372,30 +13396,30 @@ function instance$g($$self, $$props, $$invalidate) {
13372
13396
  $$self.$$.update = () => {
13373
13397
  if ($$self.$$.dirty &
13374
13398
  /*closable*/
13375
- 8192) {
13399
+ 16384) {
13376
13400
  // Reactive
13377
- $$invalidate(8, _isClosable = toBoolean(closable));
13401
+ $$invalidate(9, _isClosable = toBoolean(closable));
13378
13402
  }
13379
13403
 
13380
13404
  if ($$self.$$.dirty &
13381
13405
  /*open*/
13382
13406
  2) {
13383
- $$invalidate(6, _isOpen = toBoolean(open));
13407
+ $$invalidate(7, _isOpen = toBoolean(open));
13384
13408
  }
13385
13409
 
13386
13410
  if ($$self.$$.dirty &
13387
13411
  /*_isOpen*/
13388
- 64) {
13412
+ 128) {
13389
13413
  if (!_isOpen) {
13390
13414
  // prevent null issues
13391
- $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(7, _rootEl = null)));
13415
+ $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(8, _rootEl = $$invalidate(6, _headerEl = null))));
13392
13416
  window.removeEventListener('keydown', onInputKeyDown);
13393
13417
  }
13394
13418
  }
13395
13419
 
13396
13420
  if ($$self.$$.dirty &
13397
13421
  /*_isOpen, _scrollEl, _contentEl*/
13398
- 112) {
13422
+ 176) {
13399
13423
  if (_isOpen && _scrollEl && _contentEl) {
13400
13424
  const hasScroll = _scrollEl.scrollHeight > _scrollEl.offsetHeight;
13401
13425
 
@@ -13406,42 +13430,47 @@ function instance$g($$self, $$props, $$invalidate) {
13406
13430
  }
13407
13431
 
13408
13432
  if ($$self.$$.dirty &
13409
- /*_isOpen, _contentEl*/
13410
- 80) {
13433
+ /*_isOpen, _contentEl, _headerEl*/
13434
+ 208) {
13411
13435
  if (_isOpen && _contentEl) {
13412
13436
  window.addEventListener('keydown', onInputKeyDown);
13437
+ const children = getChildren();
13438
+
13439
+ if (_headerEl.querySelector("div.modal-title").textContent || _headerEl.querySelector("div.modal-close") || children.length) {
13440
+ _headerEl.classList.add("has-content");
13441
+ }
13413
13442
  }
13414
13443
  }
13415
13444
 
13416
13445
  if ($$self.$$.dirty &
13417
13446
  /*transition*/
13418
- 16384) {
13419
- $$invalidate(10, _transitionTime = transition === "none" ? 0 : transition === "slow" ? 400 : 200);
13447
+ 32768) {
13448
+ $$invalidate(11, _transitionTime = transition === "none" ? 0 : transition === "slow" ? 400 : 200);
13420
13449
  }
13421
13450
 
13422
13451
  if ($$self.$$.dirty &
13423
13452
  /*calloutvariant*/
13424
13453
  8) {
13425
- $$invalidate(9, _iconType = calloutvariant === "emergency" ? "warning" : calloutvariant === "important" ? "alert-circle" : calloutvariant === "information" ? "information-circle" : calloutvariant === "success" ? "checkmark-circle" : calloutvariant === "event" ? "calendar" : "");
13454
+ $$invalidate(10, _iconType = calloutvariant === "emergency" ? "warning" : calloutvariant === "important" ? "alert-circle" : calloutvariant === "information" ? "information-circle" : calloutvariant === "success" ? "checkmark-circle" : calloutvariant === "event" ? "calendar" : "");
13426
13455
  }
13427
13456
  };
13428
13457
 
13429
- return [heading, open, width, calloutvariant, _contentEl, _scrollEl, _isOpen, _rootEl, _isClosable, _iconType, _transitionTime, close, handleScroll, closable, transition, goa_scrollable_binding, div2_binding, div6_binding];
13458
+ return [heading, open, width, calloutvariant, _contentEl, _scrollEl, _headerEl, _isOpen, _rootEl, _isClosable, _iconType, _transitionTime, close, handleScroll, closable, transition, header_binding, goa_scrollable_binding, div2_binding, div6_binding];
13430
13459
  }
13431
13460
 
13432
13461
  class Modal extends SvelteElement {
13433
13462
  constructor(options) {
13434
13463
  super();
13435
- 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>`;
13464
+ 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>`;
13436
13465
  init(this, {
13437
13466
  target: this.shadowRoot,
13438
13467
  props: attribute_to_object(this.attributes),
13439
13468
  customElement: true
13440
13469
  }, instance$g, create_fragment$i, safe_not_equal, {
13441
13470
  heading: 0,
13442
- closable: 13,
13471
+ closable: 14,
13443
13472
  open: 1,
13444
- transition: 14,
13473
+ transition: 15,
13445
13474
  width: 2,
13446
13475
  calloutvariant: 3
13447
13476
  }, null);
@@ -13474,7 +13503,7 @@ class Modal extends SvelteElement {
13474
13503
  }
13475
13504
 
13476
13505
  get closable() {
13477
- return this.$$.ctx[13];
13506
+ return this.$$.ctx[14];
13478
13507
  }
13479
13508
 
13480
13509
  set closable(closable) {
@@ -13496,7 +13525,7 @@ class Modal extends SvelteElement {
13496
13525
  }
13497
13526
 
13498
13527
  get transition() {
13499
- return this.$$.ctx[14];
13528
+ return this.$$.ctx[15];
13500
13529
  }
13501
13530
 
13502
13531
  set transition(transition) {
@@ -12858,7 +12858,7 @@
12858
12858
  let if_block1 = current_block_type(ctx);
12859
12859
  let if_block2 =
12860
12860
  /*_isClosable*/
12861
- ctx[8] && create_if_block_1$2(ctx);
12861
+ ctx[9] && create_if_block_1$2(ctx);
12862
12862
  return {
12863
12863
  c() {
12864
12864
  goa_focus_trap = element("goa-focus-trap");
@@ -12920,31 +12920,34 @@
12920
12920
  if_block1.m(div1, null);
12921
12921
  append(header, t2);
12922
12922
  if (if_block2) if_block2.m(header, null);
12923
+ /*header_binding*/
12924
+
12925
+ ctx[16](header);
12923
12926
  append(div4, t3);
12924
12927
  append(div4, div2);
12925
12928
  append(div2, goa_scrollable);
12926
12929
  /*goa_scrollable_binding*/
12927
12930
 
12928
- ctx[15](goa_scrollable);
12931
+ ctx[17](goa_scrollable);
12929
12932
  /*div2_binding*/
12930
12933
 
12931
- ctx[16](div2);
12934
+ ctx[18](div2);
12932
12935
  append(div4, t4);
12933
12936
  append(div4, div3);
12934
12937
  /*div6_binding*/
12935
12938
 
12936
- ctx[17](div6);
12939
+ ctx[19](div6);
12937
12940
  current = true;
12938
12941
 
12939
12942
  if (!mounted) {
12940
12943
  dispose = [listen(div0, "click",
12941
12944
  /*close*/
12942
- ctx[11]), listen(goa_scrollable, "_scroll",
12945
+ ctx[12]), listen(goa_scrollable, "_scroll",
12943
12946
  /*handleScroll*/
12944
- ctx[12]), action_destroyer(noscroll_action = noscroll.call(null, div6, {
12947
+ ctx[13]), action_destroyer(noscroll_action = noscroll.call(null, div6, {
12945
12948
  enable:
12946
12949
  /*_isOpen*/
12947
- ctx[6]
12950
+ ctx[7]
12948
12951
  }))];
12949
12952
  mounted = true;
12950
12953
  }
@@ -12982,7 +12985,7 @@
12982
12985
 
12983
12986
  if (
12984
12987
  /*_isClosable*/
12985
- ctx[8]) {
12988
+ ctx[9]) {
12986
12989
  if (if_block2) {
12987
12990
  if_block2.p(ctx, dirty);
12988
12991
  } else {
@@ -13007,10 +13010,10 @@
13007
13010
 
13008
13011
  if (noscroll_action && is_function(noscroll_action.update) && dirty &
13009
13012
  /*_isOpen*/
13010
- 64) noscroll_action.update.call(null, {
13013
+ 128) noscroll_action.update.call(null, {
13011
13014
  enable:
13012
13015
  /*_isOpen*/
13013
- ctx[6]
13016
+ ctx[7]
13014
13017
  });
13015
13018
 
13016
13019
  if (!current || dirty &
@@ -13029,7 +13032,7 @@
13029
13032
  div5_intro = create_in_transition(div5, fly, {
13030
13033
  duration:
13031
13034
  /*_transitionTime*/
13032
- ctx[10],
13035
+ ctx[11],
13033
13036
  y: 200
13034
13037
  });
13035
13038
  div5_intro.start();
@@ -13039,7 +13042,7 @@
13039
13042
  div6_intro = create_in_transition(div6, fade, {
13040
13043
  duration:
13041
13044
  /*_transitionTime*/
13042
- ctx[10]
13045
+ ctx[11]
13043
13046
  });
13044
13047
  div6_intro.start();
13045
13048
  });
@@ -13051,20 +13054,20 @@
13051
13054
  div5_outro = create_out_transition(div5, fly, {
13052
13055
  delay:
13053
13056
  /*_transitionTime*/
13054
- ctx[10],
13057
+ ctx[11],
13055
13058
  duration:
13056
13059
  /*_transitionTime*/
13057
- ctx[10],
13060
+ ctx[11],
13058
13061
  y: -100
13059
13062
  });
13060
13063
  if (div6_intro) div6_intro.invalidate();
13061
13064
  div6_outro = create_out_transition(div6, fade, {
13062
13065
  delay:
13063
13066
  /*_transitionTime*/
13064
- ctx[10],
13067
+ ctx[11],
13065
13068
  duration:
13066
13069
  /*_transitionTime*/
13067
- ctx[10]
13070
+ ctx[11]
13068
13071
  });
13069
13072
  current = false;
13070
13073
  },
@@ -13074,23 +13077,26 @@
13074
13077
  if (if_block0) if_block0.d();
13075
13078
  if_block1.d();
13076
13079
  if (if_block2) if_block2.d();
13080
+ /*header_binding*/
13081
+
13082
+ ctx[16](null);
13077
13083
  /*goa_scrollable_binding*/
13078
13084
 
13079
- ctx[15](null);
13085
+ ctx[17](null);
13080
13086
  /*div2_binding*/
13081
13087
 
13082
- ctx[16](null);
13088
+ ctx[18](null);
13083
13089
  if (detaching && div5_outro) div5_outro.end();
13084
13090
  /*div6_binding*/
13085
13091
 
13086
- ctx[17](null);
13092
+ ctx[19](null);
13087
13093
  if (detaching && div6_outro) div6_outro.end();
13088
13094
  mounted = false;
13089
13095
  run_all(dispose);
13090
13096
  }
13091
13097
 
13092
13098
  };
13093
- } // (116:8) {#if calloutvariant !== null}
13099
+ } // (132:8) {#if calloutvariant !== null}
13094
13100
 
13095
13101
 
13096
13102
  function create_if_block_3$2(ctx) {
@@ -13104,7 +13110,7 @@
13104
13110
  goa_icon = element("goa-icon");
13105
13111
  set_custom_element_data(goa_icon, "type",
13106
13112
  /*_iconType*/
13107
- ctx[9]);
13113
+ ctx[10]);
13108
13114
  set_custom_element_data(goa_icon, "inverted", goa_icon_inverted_value =
13109
13115
  /*calloutvariant*/
13110
13116
  ctx[3] === "important" ? "false" : "true");
@@ -13121,10 +13127,10 @@
13121
13127
  p(ctx, dirty) {
13122
13128
  if (dirty &
13123
13129
  /*_iconType*/
13124
- 512) {
13130
+ 1024) {
13125
13131
  set_custom_element_data(goa_icon, "type",
13126
13132
  /*_iconType*/
13127
- ctx[9]);
13133
+ ctx[10]);
13128
13134
  }
13129
13135
 
13130
13136
  if (dirty &
@@ -13149,7 +13155,7 @@
13149
13155
  }
13150
13156
 
13151
13157
  };
13152
- } // (129:14) {:else}
13158
+ } // (145:14) {:else}
13153
13159
 
13154
13160
 
13155
13161
  function create_else_block$3(ctx) {
@@ -13171,7 +13177,7 @@
13171
13177
  }
13172
13178
 
13173
13179
  };
13174
- } // (127:14) {#if heading}
13180
+ } // (143:14) {#if heading}
13175
13181
 
13176
13182
 
13177
13183
  function create_if_block_2$2(ctx) {
@@ -13200,7 +13206,7 @@
13200
13206
  }
13201
13207
 
13202
13208
  };
13203
- } // (133:12) {#if _isClosable}
13209
+ } // (149:12) {#if _isClosable}
13204
13210
 
13205
13211
 
13206
13212
  function create_if_block_1$2(ctx) {
@@ -13225,7 +13231,7 @@
13225
13231
  if (!mounted) {
13226
13232
  dispose = listen(goa_icon_button, "click",
13227
13233
  /*close*/
13228
- ctx[11]);
13234
+ ctx[12]);
13229
13235
  mounted = true;
13230
13236
  }
13231
13237
  },
@@ -13246,7 +13252,7 @@
13246
13252
  let current;
13247
13253
  let if_block =
13248
13254
  /*_isOpen*/
13249
- ctx[6] && create_if_block$8(ctx);
13255
+ ctx[7] && create_if_block$8(ctx);
13250
13256
  return {
13251
13257
  c() {
13252
13258
  if (if_block) if_block.c();
@@ -13263,13 +13269,13 @@
13263
13269
  p(ctx, [dirty]) {
13264
13270
  if (
13265
13271
  /*_isOpen*/
13266
- ctx[6]) {
13272
+ ctx[7]) {
13267
13273
  if (if_block) {
13268
13274
  if_block.p(ctx, dirty);
13269
13275
 
13270
13276
  if (dirty &
13271
13277
  /*_isOpen*/
13272
- 64) {
13278
+ 128) {
13273
13279
  transition_in(if_block, 1);
13274
13280
  }
13275
13281
  } else {
@@ -13336,7 +13342,8 @@
13336
13342
 
13337
13343
  let _rootEl = null;
13338
13344
  let _contentEl = null;
13339
- let _scrollEl = null; // Type verification
13345
+ let _scrollEl = null;
13346
+ let _headerEl = null; // Type verification
13340
13347
 
13341
13348
  const [CALLOUT_VARIANT, validateCalloutVariant] = typeValidator("Callout variant", ["emergency", "important", "information", "success", "event"]);
13342
13349
  const [Transitions, validateTransition] = typeValidator("Modal transition", ["fast", "slow", "none"]); // Hooks
@@ -13385,32 +13392,49 @@
13385
13392
  }
13386
13393
  }
13387
13394
 
13395
+ function getChildren() {
13396
+ const slot = _headerEl.querySelector("slot");
13397
+
13398
+ if (slot) {
13399
+ return [...slot.assignedElements()];
13400
+ } else {
13401
+ return [..._headerEl.children]; // unit tests
13402
+ }
13403
+ }
13404
+
13405
+ function header_binding($$value) {
13406
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13407
+ _headerEl = $$value;
13408
+ ($$invalidate(6, _headerEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13409
+ });
13410
+ }
13411
+
13388
13412
  function goa_scrollable_binding($$value) {
13389
13413
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13390
13414
  _scrollEl = $$value;
13391
- ($$invalidate(5, _scrollEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13415
+ ($$invalidate(5, _scrollEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13392
13416
  });
13393
13417
  }
13394
13418
 
13395
13419
  function div2_binding($$value) {
13396
13420
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13397
13421
  _contentEl = $$value;
13398
- ($$invalidate(4, _contentEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13422
+ ($$invalidate(4, _contentEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13399
13423
  });
13400
13424
  }
13401
13425
 
13402
13426
  function div6_binding($$value) {
13403
13427
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
13404
13428
  _rootEl = $$value;
13405
- ($$invalidate(7, _rootEl), $$invalidate(6, _isOpen)), $$invalidate(1, open);
13429
+ ($$invalidate(8, _rootEl), $$invalidate(7, _isOpen)), $$invalidate(1, open);
13406
13430
  });
13407
13431
  }
13408
13432
 
13409
13433
  $$self.$$set = $$props => {
13410
13434
  if ('heading' in $$props) $$invalidate(0, heading = $$props.heading);
13411
- if ('closable' in $$props) $$invalidate(13, closable = $$props.closable);
13435
+ if ('closable' in $$props) $$invalidate(14, closable = $$props.closable);
13412
13436
  if ('open' in $$props) $$invalidate(1, open = $$props.open);
13413
- if ('transition' in $$props) $$invalidate(14, transition = $$props.transition);
13437
+ if ('transition' in $$props) $$invalidate(15, transition = $$props.transition);
13414
13438
  if ('width' in $$props) $$invalidate(2, width = $$props.width);
13415
13439
  if ('calloutvariant' in $$props) $$invalidate(3, calloutvariant = $$props.calloutvariant);
13416
13440
  };
@@ -13418,30 +13442,30 @@
13418
13442
  $$self.$$.update = () => {
13419
13443
  if ($$self.$$.dirty &
13420
13444
  /*closable*/
13421
- 8192) {
13445
+ 16384) {
13422
13446
  // Reactive
13423
- $$invalidate(8, _isClosable = toBoolean(closable));
13447
+ $$invalidate(9, _isClosable = toBoolean(closable));
13424
13448
  }
13425
13449
 
13426
13450
  if ($$self.$$.dirty &
13427
13451
  /*open*/
13428
13452
  2) {
13429
- $$invalidate(6, _isOpen = toBoolean(open));
13453
+ $$invalidate(7, _isOpen = toBoolean(open));
13430
13454
  }
13431
13455
 
13432
13456
  if ($$self.$$.dirty &
13433
13457
  /*_isOpen*/
13434
- 64) {
13458
+ 128) {
13435
13459
  if (!_isOpen) {
13436
13460
  // prevent null issues
13437
- $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(7, _rootEl = null)));
13461
+ $$invalidate(4, _contentEl = $$invalidate(5, _scrollEl = $$invalidate(8, _rootEl = $$invalidate(6, _headerEl = null))));
13438
13462
  window.removeEventListener('keydown', onInputKeyDown);
13439
13463
  }
13440
13464
  }
13441
13465
 
13442
13466
  if ($$self.$$.dirty &
13443
13467
  /*_isOpen, _scrollEl, _contentEl*/
13444
- 112) {
13468
+ 176) {
13445
13469
  if (_isOpen && _scrollEl && _contentEl) {
13446
13470
  const hasScroll = _scrollEl.scrollHeight > _scrollEl.offsetHeight;
13447
13471
 
@@ -13452,42 +13476,47 @@
13452
13476
  }
13453
13477
 
13454
13478
  if ($$self.$$.dirty &
13455
- /*_isOpen, _contentEl*/
13456
- 80) {
13479
+ /*_isOpen, _contentEl, _headerEl*/
13480
+ 208) {
13457
13481
  if (_isOpen && _contentEl) {
13458
13482
  window.addEventListener('keydown', onInputKeyDown);
13483
+ const children = getChildren();
13484
+
13485
+ if (_headerEl.querySelector("div.modal-title").textContent || _headerEl.querySelector("div.modal-close") || children.length) {
13486
+ _headerEl.classList.add("has-content");
13487
+ }
13459
13488
  }
13460
13489
  }
13461
13490
 
13462
13491
  if ($$self.$$.dirty &
13463
13492
  /*transition*/
13464
- 16384) {
13465
- $$invalidate(10, _transitionTime = transition === "none" ? 0 : transition === "slow" ? 400 : 200);
13493
+ 32768) {
13494
+ $$invalidate(11, _transitionTime = transition === "none" ? 0 : transition === "slow" ? 400 : 200);
13466
13495
  }
13467
13496
 
13468
13497
  if ($$self.$$.dirty &
13469
13498
  /*calloutvariant*/
13470
13499
  8) {
13471
- $$invalidate(9, _iconType = calloutvariant === "emergency" ? "warning" : calloutvariant === "important" ? "alert-circle" : calloutvariant === "information" ? "information-circle" : calloutvariant === "success" ? "checkmark-circle" : calloutvariant === "event" ? "calendar" : "");
13500
+ $$invalidate(10, _iconType = calloutvariant === "emergency" ? "warning" : calloutvariant === "important" ? "alert-circle" : calloutvariant === "information" ? "information-circle" : calloutvariant === "success" ? "checkmark-circle" : calloutvariant === "event" ? "calendar" : "");
13472
13501
  }
13473
13502
  };
13474
13503
 
13475
- return [heading, open, width, calloutvariant, _contentEl, _scrollEl, _isOpen, _rootEl, _isClosable, _iconType, _transitionTime, close, handleScroll, closable, transition, goa_scrollable_binding, div2_binding, div6_binding];
13504
+ return [heading, open, width, calloutvariant, _contentEl, _scrollEl, _headerEl, _isOpen, _rootEl, _isClosable, _iconType, _transitionTime, close, handleScroll, closable, transition, header_binding, goa_scrollable_binding, div2_binding, div6_binding];
13476
13505
  }
13477
13506
 
13478
13507
  class Modal extends SvelteElement {
13479
13508
  constructor(options) {
13480
13509
  super();
13481
- 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>`;
13510
+ 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>`;
13482
13511
  init(this, {
13483
13512
  target: this.shadowRoot,
13484
13513
  props: attribute_to_object(this.attributes),
13485
13514
  customElement: true
13486
13515
  }, instance$g, create_fragment$i, safe_not_equal, {
13487
13516
  heading: 0,
13488
- closable: 13,
13517
+ closable: 14,
13489
13518
  open: 1,
13490
- transition: 14,
13519
+ transition: 15,
13491
13520
  width: 2,
13492
13521
  calloutvariant: 3
13493
13522
  }, null);
@@ -13520,7 +13549,7 @@
13520
13549
  }
13521
13550
 
13522
13551
  get closable() {
13523
- return this.$$.ctx[13];
13552
+ return this.$$.ctx[14];
13524
13553
  }
13525
13554
 
13526
13555
  set closable(closable) {
@@ -13542,7 +13571,7 @@
13542
13571
  }
13543
13572
 
13544
13573
  get transition() {
13545
- return this.$$.ctx[14];
13574
+ return this.$$.ctx[15];
13546
13575
  }
13547
13576
 
13548
13577
  set transition(transition) {