@abgov/web-components 1.0.0-alpha.147 → 1.0.0-alpha.148

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.147",
3
+ "version": "1.0.0-alpha.148",
4
4
  "description": "Government of Alberta - UI Web components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -883,6 +883,399 @@ var variables = '';
883
883
 
884
884
  var tokens = '';
885
885
 
886
+ function calculateMargin(mt, mr, mb, ml) {
887
+ return [
888
+ mt && `margin-top:var(--goa-space-${mt});`,
889
+ mr && `margin-right:var(--goa-space-${mr});`,
890
+ mb && `margin-bottom:var(--goa-space-${mb});`,
891
+ ml && `margin-left:var(--goa-space-${ml});`
892
+ ].join(" ");
893
+ }
894
+ function injectCss(el, rootSelector, css, media) {
895
+ const style = document.createElement("style");
896
+ const _css = Object.entries(css).map((entry) => `${entry[0]}: ${entry[1]};`).join(" ");
897
+ if (media) {
898
+ style.innerHTML = `@media (${media}) { ${rootSelector} {${_css}} }`;
899
+ } else {
900
+ style.innerHTML = `${rootSelector} {${_css}}`;
901
+ }
902
+ el.appendChild(style);
903
+ }
904
+
905
+ function toBoolean(value) {
906
+ if (value === "false") {
907
+ return false;
908
+ }
909
+ if (value === "") {
910
+ return true;
911
+ }
912
+ return !!value;
913
+ }
914
+ function fromBoolean(value) {
915
+ return value ? "true" : "false";
916
+ }
917
+ function validateRequired(componentName, props) {
918
+ Object.entries(props).forEach((prop) => {
919
+ if (!prop[1]) {
920
+ console.warn(`${componentName}: ${prop[0]} is required`);
921
+ }
922
+ });
923
+ }
924
+ function typeValidator(message, values, required = false) {
925
+ const validator = (value) => {
926
+ if (!required && !value) {
927
+ return;
928
+ }
929
+ if (!values.includes(value)) {
930
+ console.error(`[${value}] is an invalid ${message.toLowerCase()}`);
931
+ }
932
+ };
933
+ return [values, validator];
934
+ }
935
+
936
+ /* libs/web-components/src/components/accordion/Accordion.svelte generated by Svelte v3.51.0 */
937
+
938
+ function create_fragment$H(ctx) {
939
+ let div3;
940
+ let details;
941
+ let summary;
942
+ let goa_icon;
943
+ let goa_icon_fillcolor_value;
944
+ let t0;
945
+ let div1;
946
+ let span0;
947
+ let t1;
948
+ let span0_class_value;
949
+ let span0_data_testid_value;
950
+ let t2;
951
+ let span1;
952
+ let t3;
953
+ let t4;
954
+ let div0;
955
+ let summary_class_value;
956
+ let t5;
957
+ let div2;
958
+ let div3_style_value;
959
+ let mounted;
960
+ let dispose;
961
+
962
+ return {
963
+ c() {
964
+ div3 = element("div");
965
+ details = element("details");
966
+ summary = element("summary");
967
+ goa_icon = element("goa-icon");
968
+ t0 = space();
969
+ div1 = element("div");
970
+ span0 = element("span");
971
+ t1 = text(/*heading*/ ctx[0]);
972
+ t2 = space();
973
+ span1 = element("span");
974
+ t3 = text(/*secondarytext*/ ctx[1]);
975
+ t4 = space();
976
+ div0 = element("div");
977
+ div0.innerHTML = `<slot name="headingcontent"></slot>`;
978
+ t5 = space();
979
+ div2 = element("div");
980
+ div2.innerHTML = `<slot></slot>`;
981
+ this.c = noop;
982
+ set_custom_element_data(goa_icon, "type", "chevron-forward");
983
+
984
+ set_custom_element_data(goa_icon, "fillcolor", goa_icon_fillcolor_value = /*_hovering*/ ctx[8]
985
+ ? "var(--goa-color-interactive-hover)"
986
+ : "var(--goa-color-interactive-default)");
987
+
988
+ attr(span0, "class", span0_class_value = "heading heading-" + /*headingsize*/ ctx[2]);
989
+ attr(span0, "data-testid", span0_data_testid_value = `${/*testid*/ ctx[3]}-heading`);
990
+ attr(span1, "class", "secondary-text");
991
+ attr(div0, "class", "heading-content");
992
+ attr(div1, "class", "title");
993
+ attr(summary, "class", summary_class_value = `container-${/*headingsize*/ ctx[2]}`);
994
+ attr(div2, "class", "content");
995
+ details.open = /*isOpen*/ ctx[9];
996
+ attr(div3, "style", div3_style_value = calculateMargin(/*mt*/ ctx[4], /*mr*/ ctx[5], /*mb*/ ctx[6], /*ml*/ ctx[7]));
997
+
998
+ attr(div3, "class", `
999
+ goa-accordion
1000
+ `);
1001
+
1002
+ attr(div3, "data-testid", /*testid*/ ctx[3]);
1003
+ },
1004
+ m(target, anchor) {
1005
+ insert(target, div3, anchor);
1006
+ append(div3, details);
1007
+ append(details, summary);
1008
+ append(summary, goa_icon);
1009
+ append(summary, t0);
1010
+ append(summary, div1);
1011
+ append(div1, span0);
1012
+ append(span0, t1);
1013
+ append(div1, t2);
1014
+ append(div1, span1);
1015
+ append(span1, t3);
1016
+ append(div1, t4);
1017
+ append(div1, div0);
1018
+ append(details, t5);
1019
+ append(details, div2);
1020
+
1021
+ if (!mounted) {
1022
+ dispose = [
1023
+ listen(summary, "mouseover", /*mouseover_handler*/ ctx[11]),
1024
+ listen(summary, "mouseout", /*mouseout_handler*/ ctx[12]),
1025
+ listen(summary, "focus", /*focus_handler*/ ctx[13]),
1026
+ listen(summary, "blur", /*blur_handler*/ ctx[14])
1027
+ ];
1028
+
1029
+ mounted = true;
1030
+ }
1031
+ },
1032
+ p(ctx, [dirty]) {
1033
+ if (dirty & /*_hovering*/ 256 && goa_icon_fillcolor_value !== (goa_icon_fillcolor_value = /*_hovering*/ ctx[8]
1034
+ ? "var(--goa-color-interactive-hover)"
1035
+ : "var(--goa-color-interactive-default)")) {
1036
+ set_custom_element_data(goa_icon, "fillcolor", goa_icon_fillcolor_value);
1037
+ }
1038
+
1039
+ if (dirty & /*heading*/ 1) set_data(t1, /*heading*/ ctx[0]);
1040
+
1041
+ if (dirty & /*headingsize*/ 4 && span0_class_value !== (span0_class_value = "heading heading-" + /*headingsize*/ ctx[2])) {
1042
+ attr(span0, "class", span0_class_value);
1043
+ }
1044
+
1045
+ if (dirty & /*testid*/ 8 && span0_data_testid_value !== (span0_data_testid_value = `${/*testid*/ ctx[3]}-heading`)) {
1046
+ attr(span0, "data-testid", span0_data_testid_value);
1047
+ }
1048
+
1049
+ if (dirty & /*secondarytext*/ 2) set_data(t3, /*secondarytext*/ ctx[1]);
1050
+
1051
+ if (dirty & /*headingsize*/ 4 && summary_class_value !== (summary_class_value = `container-${/*headingsize*/ ctx[2]}`)) {
1052
+ attr(summary, "class", summary_class_value);
1053
+ }
1054
+
1055
+ if (dirty & /*isOpen*/ 512) {
1056
+ details.open = /*isOpen*/ ctx[9];
1057
+ }
1058
+
1059
+ 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]))) {
1060
+ attr(div3, "style", div3_style_value);
1061
+ }
1062
+
1063
+ if (dirty & /*testid*/ 8) {
1064
+ attr(div3, "data-testid", /*testid*/ ctx[3]);
1065
+ }
1066
+ },
1067
+ i: noop,
1068
+ o: noop,
1069
+ d(detaching) {
1070
+ if (detaching) detach(div3);
1071
+ mounted = false;
1072
+ run_all(dispose);
1073
+ }
1074
+ };
1075
+ }
1076
+
1077
+ function instance$B($$self, $$props, $$invalidate) {
1078
+ let isOpen;
1079
+ const [HeadingSizes, validateHeadingSize] = typeValidator("Accordion heading size", ["small", "medium"]);
1080
+ let { open = "false" } = $$props;
1081
+ let { heading = "" } = $$props;
1082
+ let { secondarytext = "" } = $$props;
1083
+ let { headingsize = "small" } = $$props;
1084
+ let { testid = "" } = $$props;
1085
+ let { mt = null } = $$props;
1086
+ let { mr = null } = $$props;
1087
+ let { mb = "xs" } = $$props;
1088
+ let { ml = null } = $$props;
1089
+ let _hovering = false;
1090
+
1091
+ onMount(() => {
1092
+ validateRequired("GoAAccordion", { heading });
1093
+ validateHeadingSize(headingsize);
1094
+ });
1095
+
1096
+ const mouseover_handler = () => $$invalidate(8, _hovering = true);
1097
+ const mouseout_handler = () => $$invalidate(8, _hovering = false);
1098
+ const focus_handler = () => $$invalidate(8, _hovering = false);
1099
+ const blur_handler = () => $$invalidate(8, _hovering = false);
1100
+
1101
+ $$self.$$set = $$props => {
1102
+ if ('open' in $$props) $$invalidate(10, open = $$props.open);
1103
+ if ('heading' in $$props) $$invalidate(0, heading = $$props.heading);
1104
+ if ('secondarytext' in $$props) $$invalidate(1, secondarytext = $$props.secondarytext);
1105
+ if ('headingsize' in $$props) $$invalidate(2, headingsize = $$props.headingsize);
1106
+ if ('testid' in $$props) $$invalidate(3, testid = $$props.testid);
1107
+ if ('mt' in $$props) $$invalidate(4, mt = $$props.mt);
1108
+ if ('mr' in $$props) $$invalidate(5, mr = $$props.mr);
1109
+ if ('mb' in $$props) $$invalidate(6, mb = $$props.mb);
1110
+ if ('ml' in $$props) $$invalidate(7, ml = $$props.ml);
1111
+ };
1112
+
1113
+ $$self.$$.update = () => {
1114
+ if ($$self.$$.dirty & /*open*/ 1024) {
1115
+ $$invalidate(9, isOpen = toBoolean(open));
1116
+ }
1117
+ };
1118
+
1119
+ return [
1120
+ heading,
1121
+ secondarytext,
1122
+ headingsize,
1123
+ testid,
1124
+ mt,
1125
+ mr,
1126
+ mb,
1127
+ ml,
1128
+ _hovering,
1129
+ isOpen,
1130
+ open,
1131
+ mouseover_handler,
1132
+ mouseout_handler,
1133
+ focus_handler,
1134
+ blur_handler
1135
+ ];
1136
+ }
1137
+
1138
+ class Accordion extends SvelteElement {
1139
+ constructor(options) {
1140
+ super();
1141
+
1142
+ this.shadowRoot.innerHTML = `<style>: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
1143
+ }.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}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}}</style>`;
1144
+
1145
+ init(
1146
+ this,
1147
+ {
1148
+ target: this.shadowRoot,
1149
+ props: attribute_to_object(this.attributes),
1150
+ customElement: true
1151
+ },
1152
+ instance$B,
1153
+ create_fragment$H,
1154
+ safe_not_equal,
1155
+ {
1156
+ open: 10,
1157
+ heading: 0,
1158
+ secondarytext: 1,
1159
+ headingsize: 2,
1160
+ testid: 3,
1161
+ mt: 4,
1162
+ mr: 5,
1163
+ mb: 6,
1164
+ ml: 7
1165
+ },
1166
+ null
1167
+ );
1168
+
1169
+ if (options) {
1170
+ if (options.target) {
1171
+ insert(options.target, this, options.anchor);
1172
+ }
1173
+
1174
+ if (options.props) {
1175
+ this.$set(options.props);
1176
+ flush();
1177
+ }
1178
+ }
1179
+ }
1180
+
1181
+ static get observedAttributes() {
1182
+ return [
1183
+ "open",
1184
+ "heading",
1185
+ "secondarytext",
1186
+ "headingsize",
1187
+ "testid",
1188
+ "mt",
1189
+ "mr",
1190
+ "mb",
1191
+ "ml"
1192
+ ];
1193
+ }
1194
+
1195
+ get open() {
1196
+ return this.$$.ctx[10];
1197
+ }
1198
+
1199
+ set open(open) {
1200
+ this.$$set({ open });
1201
+ flush();
1202
+ }
1203
+
1204
+ get heading() {
1205
+ return this.$$.ctx[0];
1206
+ }
1207
+
1208
+ set heading(heading) {
1209
+ this.$$set({ heading });
1210
+ flush();
1211
+ }
1212
+
1213
+ get secondarytext() {
1214
+ return this.$$.ctx[1];
1215
+ }
1216
+
1217
+ set secondarytext(secondarytext) {
1218
+ this.$$set({ secondarytext });
1219
+ flush();
1220
+ }
1221
+
1222
+ get headingsize() {
1223
+ return this.$$.ctx[2];
1224
+ }
1225
+
1226
+ set headingsize(headingsize) {
1227
+ this.$$set({ headingsize });
1228
+ flush();
1229
+ }
1230
+
1231
+ get testid() {
1232
+ return this.$$.ctx[3];
1233
+ }
1234
+
1235
+ set testid(testid) {
1236
+ this.$$set({ testid });
1237
+ flush();
1238
+ }
1239
+
1240
+ get mt() {
1241
+ return this.$$.ctx[4];
1242
+ }
1243
+
1244
+ set mt(mt) {
1245
+ this.$$set({ mt });
1246
+ flush();
1247
+ }
1248
+
1249
+ get mr() {
1250
+ return this.$$.ctx[5];
1251
+ }
1252
+
1253
+ set mr(mr) {
1254
+ this.$$set({ mr });
1255
+ flush();
1256
+ }
1257
+
1258
+ get mb() {
1259
+ return this.$$.ctx[6];
1260
+ }
1261
+
1262
+ set mb(mb) {
1263
+ this.$$set({ mb });
1264
+ flush();
1265
+ }
1266
+
1267
+ get ml() {
1268
+ return this.$$.ctx[7];
1269
+ }
1270
+
1271
+ set ml(ml) {
1272
+ this.$$set({ ml });
1273
+ flush();
1274
+ }
1275
+ }
1276
+
1277
+ customElements.define("goa-accordion", Accordion);
1278
+
886
1279
  /* libs/web-components/src/components/app-header/AppHeader.svelte generated by Svelte v3.51.0 */
887
1280
 
888
1281
  function create_else_block$4(ctx) {
@@ -1146,56 +1539,6 @@ class AppHeader extends SvelteElement {
1146
1539
 
1147
1540
  customElements.define("goa-app-header", AppHeader);
1148
1541
 
1149
- function calculateMargin(mt, mr, mb, ml) {
1150
- return [
1151
- mt && `margin-top:var(--goa-space-${mt});`,
1152
- mr && `margin-right:var(--goa-space-${mr});`,
1153
- mb && `margin-bottom:var(--goa-space-${mb});`,
1154
- ml && `margin-left:var(--goa-space-${ml});`
1155
- ].join(" ");
1156
- }
1157
- function injectCss(el, rootSelector, css, media) {
1158
- const style = document.createElement("style");
1159
- const _css = Object.entries(css).map((entry) => `${entry[0]}: ${entry[1]};`).join(" ");
1160
- if (media) {
1161
- style.innerHTML = `@media (${media}) { ${rootSelector} {${_css}} }`;
1162
- } else {
1163
- style.innerHTML = `${rootSelector} {${_css}}`;
1164
- }
1165
- el.appendChild(style);
1166
- }
1167
-
1168
- function toBoolean(value) {
1169
- if (value === "false") {
1170
- return false;
1171
- }
1172
- if (value === "") {
1173
- return true;
1174
- }
1175
- return !!value;
1176
- }
1177
- function fromBoolean(value) {
1178
- return value ? "true" : "false";
1179
- }
1180
- function validateRequired(componentName, props) {
1181
- Object.entries(props).forEach((prop) => {
1182
- if (!prop[1]) {
1183
- console.warn(`${componentName}: ${prop[0]} is required`);
1184
- }
1185
- });
1186
- }
1187
- function typeValidator(message, values, required = false) {
1188
- const validator = (value) => {
1189
- if (!required && !value) {
1190
- return;
1191
- }
1192
- if (!values.includes(value)) {
1193
- console.error(`[${value}] is an invalid ${message.toLowerCase()}`);
1194
- }
1195
- };
1196
- return [values, validator];
1197
- }
1198
-
1199
1542
  /* libs/web-components/src/components/badge/Badge.svelte generated by Svelte v3.51.0 */
1200
1543
 
1201
1544
  function create_else_block$3(ctx) {