@abgov/web-components 1.0.0-alpha.199 → 1.0.0-alpha.200

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.199",
3
+ "version": "1.0.0-alpha.200",
4
4
  "description": "Government of Alberta - UI Web components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -154,6 +154,9 @@ function set_data(text, data) {
154
154
  if (text.wholeText !== data)
155
155
  text.data = data;
156
156
  }
157
+ function set_input_value(input, value) {
158
+ input.value = value == null ? '' : value;
159
+ }
157
160
  function set_style(node, key, value, important) {
158
161
  if (value === null) {
159
162
  node.style.removeProperty(key);
@@ -15059,16 +15062,15 @@ function create_fragment$b(ctx) {
15059
15062
  textarea = element("textarea");
15060
15063
  t = space();
15061
15064
  this.c = noop;
15062
- attr(textarea, "name", /*name*/ ctx[0]);
15065
+ attr(textarea, "name", /*name*/ ctx[1]);
15063
15066
  attr(textarea, "placeholder", /*placeholder*/ ctx[2]);
15064
- textarea.value = /*value*/ ctx[1];
15065
15067
  attr(textarea, "rows", /*rows*/ ctx[3]);
15066
- attr(textarea, "aria-label", textarea_aria_label_value = /*arialabel*/ ctx[6] || /*name*/ ctx[0]);
15068
+ attr(textarea, "aria-label", textarea_aria_label_value = /*arialabel*/ ctx[6] || /*name*/ ctx[1]);
15067
15069
  attr(textarea, "class", "goa-textarea");
15068
- textarea.disabled = /*isDisabled*/ ctx[12];
15069
- textarea.readOnly = /*isReadonly*/ ctx[13];
15070
+ textarea.disabled = /*isDisabled*/ ctx[13];
15071
+ textarea.readOnly = /*isReadonly*/ ctx[14];
15070
15072
  attr(textarea, "data-testid", /*testid*/ ctx[4]);
15071
- toggle_class(textarea, "error", /*isError*/ ctx[14]);
15073
+ toggle_class(textarea, "error", /*isError*/ ctx[15]);
15072
15074
  attr(div, "class", "container");
15073
15075
 
15074
15076
  attr(div, "style", div_style_value = `
@@ -15079,48 +15081,50 @@ function create_fragment$b(ctx) {
15079
15081
  m(target, anchor) {
15080
15082
  insert(target, div, anchor);
15081
15083
  append(div, textarea);
15084
+ /*textarea_binding*/ ctx[19](textarea);
15085
+ set_input_value(textarea, /*value*/ ctx[0]);
15082
15086
  append(div, t);
15083
15087
 
15084
15088
  if (!mounted) {
15085
- dispose = listen(textarea, "keyup", /*onChange*/ ctx[15]);
15089
+ dispose = listen(textarea, "input", /*textarea_input_handler*/ ctx[20]);
15086
15090
  mounted = true;
15087
15091
  }
15088
15092
  },
15089
15093
  p(ctx, [dirty]) {
15090
- if (dirty & /*name*/ 1) {
15091
- attr(textarea, "name", /*name*/ ctx[0]);
15094
+ if (dirty & /*name*/ 2) {
15095
+ attr(textarea, "name", /*name*/ ctx[1]);
15092
15096
  }
15093
15097
 
15094
15098
  if (dirty & /*placeholder*/ 4) {
15095
15099
  attr(textarea, "placeholder", /*placeholder*/ ctx[2]);
15096
15100
  }
15097
15101
 
15098
- if (dirty & /*value*/ 2) {
15099
- textarea.value = /*value*/ ctx[1];
15100
- }
15101
-
15102
15102
  if (dirty & /*rows*/ 8) {
15103
15103
  attr(textarea, "rows", /*rows*/ ctx[3]);
15104
15104
  }
15105
15105
 
15106
- if (dirty & /*arialabel, name*/ 65 && textarea_aria_label_value !== (textarea_aria_label_value = /*arialabel*/ ctx[6] || /*name*/ ctx[0])) {
15106
+ if (dirty & /*arialabel, name*/ 66 && textarea_aria_label_value !== (textarea_aria_label_value = /*arialabel*/ ctx[6] || /*name*/ ctx[1])) {
15107
15107
  attr(textarea, "aria-label", textarea_aria_label_value);
15108
15108
  }
15109
15109
 
15110
- if (dirty & /*isDisabled*/ 4096) {
15111
- textarea.disabled = /*isDisabled*/ ctx[12];
15110
+ if (dirty & /*isDisabled*/ 8192) {
15111
+ textarea.disabled = /*isDisabled*/ ctx[13];
15112
15112
  }
15113
15113
 
15114
- if (dirty & /*isReadonly*/ 8192) {
15115
- textarea.readOnly = /*isReadonly*/ ctx[13];
15114
+ if (dirty & /*isReadonly*/ 16384) {
15115
+ textarea.readOnly = /*isReadonly*/ ctx[14];
15116
15116
  }
15117
15117
 
15118
15118
  if (dirty & /*testid*/ 16) {
15119
15119
  attr(textarea, "data-testid", /*testid*/ ctx[4]);
15120
15120
  }
15121
15121
 
15122
- if (dirty & /*isError*/ 16384) {
15123
- toggle_class(textarea, "error", /*isError*/ ctx[14]);
15122
+ if (dirty & /*value*/ 1) {
15123
+ set_input_value(textarea, /*value*/ ctx[0]);
15124
+ }
15125
+
15126
+ if (dirty & /*isError*/ 32768) {
15127
+ toggle_class(textarea, "error", /*isError*/ ctx[15]);
15124
15128
  }
15125
15129
 
15126
15130
  if (dirty & /*mt, mr, mb, ml, width*/ 1952 && div_style_value !== (div_style_value = `
@@ -15134,6 +15138,7 @@ function create_fragment$b(ctx) {
15134
15138
  o: noop,
15135
15139
  d(detaching) {
15136
15140
  if (detaching) detach(div);
15141
+ /*textarea_binding*/ ctx[19](null);
15137
15142
  mounted = false;
15138
15143
  dispose();
15139
15144
  }
@@ -15159,27 +15164,23 @@ function instance$8($$self, $$props, $$invalidate) {
15159
15164
  let { mb = null } = $$props;
15160
15165
  let { ml = null } = $$props;
15161
15166
  let { maxcharcount = 0 } = $$props;
15167
+ let _textAreaEl;
15162
15168
 
15163
- // $: showCounter = toBoolean(showcounter);
15164
- function onChange(e) {
15165
- const target = e.target;
15166
- const value = target.value;
15167
- if (isDisabled) return;
15168
-
15169
- e.target.dispatchEvent(new CustomEvent("_change",
15170
- {
15171
- composed: true,
15172
- bubbles: false,
15173
- cancelable: true,
15174
- detail: { event: e, name, value }
15175
- }));
15169
+ function textarea_binding($$value) {
15170
+ binding_callbacks[$$value ? 'unshift' : 'push'](() => {
15171
+ _textAreaEl = $$value;
15172
+ $$invalidate(12, _textAreaEl);
15173
+ });
15174
+ }
15176
15175
 
15177
- e.stopPropagation();
15176
+ function textarea_input_handler() {
15177
+ value = this.value;
15178
+ $$invalidate(0, value);
15178
15179
  }
15179
15180
 
15180
15181
  $$self.$$set = $$props => {
15181
- if ('name' in $$props) $$invalidate(0, name = $$props.name);
15182
- if ('value' in $$props) $$invalidate(1, value = $$props.value);
15182
+ if ('name' in $$props) $$invalidate(1, name = $$props.name);
15183
+ if ('value' in $$props) $$invalidate(0, value = $$props.value);
15183
15184
  if ('placeholder' in $$props) $$invalidate(2, placeholder = $$props.placeholder);
15184
15185
  if ('rows' in $$props) $$invalidate(3, rows = $$props.rows);
15185
15186
  if ('testid' in $$props) $$invalidate(4, testid = $$props.testid);
@@ -15197,21 +15198,36 @@ function instance$8($$self, $$props, $$invalidate) {
15197
15198
 
15198
15199
  $$self.$$.update = () => {
15199
15200
  if ($$self.$$.dirty & /*error*/ 65536) {
15200
- $$invalidate(14, isError = toBoolean(error));
15201
+ $$invalidate(15, isError = toBoolean(error));
15201
15202
  }
15202
15203
 
15203
15204
  if ($$self.$$.dirty & /*disabled*/ 262144) {
15204
- $$invalidate(12, isDisabled = toBoolean(disabled));
15205
+ $$invalidate(13, isDisabled = toBoolean(disabled));
15205
15206
  }
15206
15207
 
15207
15208
  if ($$self.$$.dirty & /*readonly*/ 131072) {
15208
- $$invalidate(13, isReadonly = toBoolean(readonly));
15209
+ $$invalidate(14, isReadonly = toBoolean(readonly));
15210
+ }
15211
+
15212
+ if ($$self.$$.dirty & /*_textAreaEl, isDisabled, name, value*/ 12291) {
15213
+ // $: showCounter = toBoolean(showcounter);
15214
+ {
15215
+ if (_textAreaEl && !isDisabled) {
15216
+ _textAreaEl.dispatchEvent(new CustomEvent("_change",
15217
+ {
15218
+ composed: true,
15219
+ bubbles: false,
15220
+ cancelable: true,
15221
+ detail: { name, value }
15222
+ }));
15223
+ }
15224
+ }
15209
15225
  }
15210
15226
  };
15211
15227
 
15212
15228
  return [
15213
- name,
15214
15229
  value,
15230
+ name,
15215
15231
  placeholder,
15216
15232
  rows,
15217
15233
  testid,
@@ -15222,13 +15238,15 @@ function instance$8($$self, $$props, $$invalidate) {
15222
15238
  mb,
15223
15239
  ml,
15224
15240
  maxcharcount,
15241
+ _textAreaEl,
15225
15242
  isDisabled,
15226
15243
  isReadonly,
15227
15244
  isError,
15228
- onChange,
15229
15245
  error,
15230
15246
  readonly,
15231
- disabled
15247
+ disabled,
15248
+ textarea_binding,
15249
+ textarea_input_handler
15232
15250
  ];
15233
15251
  }
15234
15252
 
@@ -15250,8 +15268,8 @@ class TextArea extends SvelteElement {
15250
15268
  create_fragment$b,
15251
15269
  safe_not_equal,
15252
15270
  {
15253
- name: 0,
15254
- value: 1,
15271
+ name: 1,
15272
+ value: 0,
15255
15273
  placeholder: 2,
15256
15274
  rows: 3,
15257
15275
  testid: 4,
@@ -15302,7 +15320,7 @@ class TextArea extends SvelteElement {
15302
15320
  }
15303
15321
 
15304
15322
  get name() {
15305
- return this.$$.ctx[0];
15323
+ return this.$$.ctx[1];
15306
15324
  }
15307
15325
 
15308
15326
  set name(name) {
@@ -15311,7 +15329,7 @@ class TextArea extends SvelteElement {
15311
15329
  }
15312
15330
 
15313
15331
  get value() {
15314
- return this.$$.ctx[1];
15332
+ return this.$$.ctx[0];
15315
15333
  }
15316
15334
 
15317
15335
  set value(value) {