@abgov/web-components 1.15.0-alpha.5 → 1.15.0-alpha.6

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.15.0-alpha.5",
3
+ "version": "1.15.0-alpha.6",
4
4
  "description": "Government of Alberta - UI Web components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -1154,10 +1154,11 @@ function create_fragment$Z(ctx) {
1154
1154
  attr(span0, "data-testid", span0_data_testid_value = `${/*testid*/ ctx[3]}-heading`);
1155
1155
  attr(span1, "class", "secondary-text");
1156
1156
  attr(div0, "class", "heading-content");
1157
+ toggle_class(div0, "heading-content-top", /*_headingContentSlotChildren*/ ctx[10].length);
1157
1158
  attr(div1, "class", "title");
1158
1159
  attr(summary, "class", summary_class_value = `container-${/*headingsize*/ ctx[2]}`);
1159
1160
  attr(div2, "class", "content");
1160
- details.open = /*isOpen*/ ctx[9];
1161
+ details.open = /*isOpen*/ ctx[11];
1161
1162
  attr(div3, "style", div3_style_value = calculateMargin(/*mt*/ ctx[4], /*mr*/ ctx[5], /*mb*/ ctx[6], /*ml*/ ctx[7]));
1162
1163
 
1163
1164
  attr(div3, "class", `
@@ -1180,15 +1181,16 @@ function create_fragment$Z(ctx) {
1180
1181
  append(span1, t3);
1181
1182
  append(div1, t4);
1182
1183
  append(div1, div0);
1184
+ /*div1_binding*/ ctx[13](div1);
1183
1185
  append(details, t5);
1184
1186
  append(details, div2);
1185
1187
 
1186
1188
  if (!mounted) {
1187
1189
  dispose = [
1188
- listen(summary, "mouseover", /*mouseover_handler*/ ctx[11]),
1189
- listen(summary, "mouseout", /*mouseout_handler*/ ctx[12]),
1190
- listen(summary, "focus", /*focus_handler*/ ctx[13]),
1191
- listen(summary, "blur", /*blur_handler*/ ctx[14])
1190
+ listen(summary, "mouseover", /*mouseover_handler*/ ctx[14]),
1191
+ listen(summary, "mouseout", /*mouseout_handler*/ ctx[15]),
1192
+ listen(summary, "focus", /*focus_handler*/ ctx[16]),
1193
+ listen(summary, "blur", /*blur_handler*/ ctx[17])
1192
1194
  ];
1193
1195
 
1194
1196
  mounted = true;
@@ -1213,12 +1215,16 @@ function create_fragment$Z(ctx) {
1213
1215
 
1214
1216
  if (dirty & /*secondarytext*/ 2) set_data(t3, /*secondarytext*/ ctx[1]);
1215
1217
 
1218
+ if (dirty & /*_headingContentSlotChildren*/ 1024) {
1219
+ toggle_class(div0, "heading-content-top", /*_headingContentSlotChildren*/ ctx[10].length);
1220
+ }
1221
+
1216
1222
  if (dirty & /*headingsize*/ 4 && summary_class_value !== (summary_class_value = `container-${/*headingsize*/ ctx[2]}`)) {
1217
1223
  attr(summary, "class", summary_class_value);
1218
1224
  }
1219
1225
 
1220
- if (dirty & /*isOpen*/ 512) {
1221
- details.open = /*isOpen*/ ctx[9];
1226
+ if (dirty & /*isOpen*/ 2048) {
1227
+ details.open = /*isOpen*/ ctx[11];
1222
1228
  }
1223
1229
 
1224
1230
  if (dirty & /*mt, mr, mb, ml*/ 240 && div3_style_value !== (div3_style_value = calculateMargin(/*mt*/ ctx[4], /*mr*/ ctx[5], /*mb*/ ctx[6], /*ml*/ ctx[7]))) {
@@ -1233,6 +1239,7 @@ function create_fragment$Z(ctx) {
1233
1239
  o: noop,
1234
1240
  d(detaching) {
1235
1241
  if (detaching) detach(div3);
1242
+ /*div1_binding*/ ctx[13](null);
1236
1243
  mounted = false;
1237
1244
  run_all(dispose);
1238
1245
  }
@@ -1252,19 +1259,43 @@ function instance$T($$self, $$props, $$invalidate) {
1252
1259
  let { mb = "xs" } = $$props;
1253
1260
  let { ml = null } = $$props;
1254
1261
  let _hovering = false;
1262
+ let _titleEl = null;
1263
+ let _headingContentSlotChildren = [];
1255
1264
 
1256
1265
  onMount(() => {
1257
1266
  validateRequired("GoAAccordion", { heading });
1258
1267
  validateHeadingSize(headingsize);
1268
+ $$invalidate(10, _headingContentSlotChildren = getChildren());
1259
1269
  });
1260
1270
 
1271
+ function getChildren() {
1272
+ if (_titleEl) {
1273
+ const slot = _titleEl.querySelector("slot");
1274
+
1275
+ if (slot) {
1276
+ return [...slot.assignedElements()];
1277
+ } else {
1278
+ return [..._titleEl.children]; // unit tests
1279
+ }
1280
+ }
1281
+
1282
+ return [];
1283
+ }
1284
+
1285
+ function div1_binding($$value) {
1286
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1287
+ _titleEl = $$value;
1288
+ $$invalidate(9, _titleEl);
1289
+ });
1290
+ }
1291
+
1261
1292
  const mouseover_handler = () => $$invalidate(8, _hovering = true);
1262
1293
  const mouseout_handler = () => $$invalidate(8, _hovering = false);
1263
1294
  const focus_handler = () => $$invalidate(8, _hovering = false);
1264
1295
  const blur_handler = () => $$invalidate(8, _hovering = false);
1265
1296
 
1266
1297
  $$self.$$set = $$props => {
1267
- if ('open' in $$props) $$invalidate(10, open = $$props.open);
1298
+ if ('open' in $$props) $$invalidate(12, open = $$props.open);
1268
1299
  if ('heading' in $$props) $$invalidate(0, heading = $$props.heading);
1269
1300
  if ('secondarytext' in $$props) $$invalidate(1, secondarytext = $$props.secondarytext);
1270
1301
  if ('headingsize' in $$props) $$invalidate(2, headingsize = $$props.headingsize);
@@ -1276,8 +1307,8 @@ function instance$T($$self, $$props, $$invalidate) {
1276
1307
  };
1277
1308
 
1278
1309
  $$self.$$.update = () => {
1279
- if ($$self.$$.dirty & /*open*/ 1024) {
1280
- $$invalidate(9, isOpen = toBoolean(open));
1310
+ if ($$self.$$.dirty & /*open*/ 4096) {
1311
+ $$invalidate(11, isOpen = toBoolean(open));
1281
1312
  }
1282
1313
  };
1283
1314
 
@@ -1291,8 +1322,11 @@ function instance$T($$self, $$props, $$invalidate) {
1291
1322
  mb,
1292
1323
  ml,
1293
1324
  _hovering,
1325
+ _titleEl,
1326
+ _headingContentSlotChildren,
1294
1327
  isOpen,
1295
1328
  open,
1329
+ div1_binding,
1296
1330
  mouseover_handler,
1297
1331
  mouseout_handler,
1298
1332
  focus_handler,
@@ -1306,7 +1340,7 @@ class Accordion extends SvelteElement {
1306
1340
  const style = document.createElement('style');
1307
1341
 
1308
1342
  style.textContent = `:host{box-sizing:border-box;font-family:var(--goa-font-family-sans);font-size:var(--goa-font-size-4)}.goa-accordion,.goa-accordion *{box-sizing:border-box}summary{min-height:3.5rem;border-width:var(--goa-border-width-s);border-style:solid;border-radius:var(--goa-border-radius-m);background-color:var(--goa-color-greyscale-100);border-color:var(--goa-color-greyscale-200);color:var(--goa-color-text-default);;;padding:0.875rem 1rem 0 0;cursor:pointer;list-style:none;display:flex;align-items:flex-start;position:relative}summary.container-medium{min-height:4rem}summary::marker,summary::-webkit-details-marker{display:none}summary .title{display:flex;align-items:center;flex:1}.title span{padding-bottom:var(--goa-space-3xs, 0)}summary .heading{font:var(--goa-typography-heading-s);padding-right:1rem}summary .secondary-text{font:var(--goa-typography-body-s);line-height:1.5rem;padding-right:1rem}summary .heading-content{flex:1
1309
- }.content{border-bottom:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-left:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-right:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-bottom-left-radius:var(--goa-border-radius-m);border-bottom-right-radius:var(--goa-border-radius-m);padding:1.5rem;padding-left:3.5rem;padding-right:2rem}.content ::slotted(p:last-child){margin-bottom:0 !important}summary goa-icon{padding:0.125rem 1rem}summary.container-medium goa-icon{padding:0.375rem 1rem}details[open] goa-icon{transform:rotate(90deg)}details[open] summary{border-bottom-left-radius:var(--goa-border-radius-none);border-bottom-right-radius:var(--goa-border-radius-none)}summary:hover{background-color:var(--goa-color-greyscale-200)}summary:focus,summary:active{background-color:var(--goa-color-greyscale-100);outline:none}summary:active::before,summary:focus::before{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border:var(--goa-border-width-l) solid var(--goa-color-interactive-focus);border-radius:4px}summary .heading.heading-medium{line-height:2rem;font:var(--goa-typography-heading-m)}@media(max-width: 640px){summary{align-items:flex-start}summary .title{flex-direction:column;align-items:flex-start}}`;
1343
+ }.content{border-bottom:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-left:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-right:var(--goa-border-width-s) solid var(--goa-color-greyscale-200);border-bottom-left-radius:var(--goa-border-radius-m);border-bottom-right-radius:var(--goa-border-radius-m);padding:1.5rem;padding-left:3.5rem;padding-right:2rem}.content ::slotted(p:last-child){margin-bottom:0 !important}summary goa-icon{padding:0.125rem 1rem}summary.container-medium goa-icon{padding:0.375rem 1rem}details[open] goa-icon{transform:rotate(90deg)}details[open] summary{border-bottom-left-radius:var(--goa-border-radius-none);border-bottom-right-radius:var(--goa-border-radius-none)}summary:hover{background-color:var(--goa-color-greyscale-200)}summary:focus,summary:active{background-color:var(--goa-color-greyscale-100);outline:none}summary:active::before,summary:focus::before{content:"";position:absolute;top:-1px;right:-1px;bottom:-1px;left:-1px;border:var(--goa-border-width-l) solid var(--goa-color-interactive-focus);border-radius:4px}summary .heading.heading-medium{line-height:2rem;font:var(--goa-typography-heading-m)}@media(max-width: 640px){summary{align-items:flex-start}summary .title{flex-direction:column;align-items:flex-start;padding-bottom:0.875rem}summary .title span{padding-bottom:0}summary .heading-content.heading-content-top{margin-top:var(--goa-space-xs)}}`;
1310
1344
 
1311
1345
  this.shadowRoot.appendChild(style);
1312
1346
 
@@ -1321,7 +1355,7 @@ class Accordion extends SvelteElement {
1321
1355
  create_fragment$Z,
1322
1356
  safe_not_equal,
1323
1357
  {
1324
- open: 10,
1358
+ open: 12,
1325
1359
  heading: 0,
1326
1360
  secondarytext: 1,
1327
1361
  headingsize: 2,
@@ -1361,7 +1395,7 @@ class Accordion extends SvelteElement {
1361
1395
  }
1362
1396
 
1363
1397
  get open() {
1364
- return this.$$.ctx[10];
1398
+ return this.$$.ctx[12];
1365
1399
  }
1366
1400
 
1367
1401
  set open(open) {