@iroco/ui 0.20.0 → 0.21.0

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/lib/index.mjs CHANGED
@@ -645,7 +645,7 @@ function create_if_block_2$1(ctx) {
645
645
  return {
646
646
  c() {
647
647
  label_1 = element("label");
648
- t = text(/*label*/ ctx[2]);
648
+ t = text(/*label*/ ctx[3]);
649
649
  attr(label_1, "class", "iroco-ui-label svelte-1r94s7");
650
650
  attr(label_1, "for", /*id*/ ctx[1]);
651
651
  },
@@ -654,7 +654,7 @@ function create_if_block_2$1(ctx) {
654
654
  append(label_1, t);
655
655
  },
656
656
  p(ctx, dirty) {
657
- if (dirty & /*label*/ 4) set_data(t, /*label*/ ctx[2]);
657
+ if (dirty & /*label*/ 8) set_data(t, /*label*/ ctx[3]);
658
658
 
659
659
  if (dirty & /*id*/ 2) {
660
660
  attr(label_1, "for", /*id*/ ctx[1]);
@@ -666,12 +666,12 @@ function create_if_block_2$1(ctx) {
666
666
  };
667
667
  }
668
668
 
669
- // (41:1) {#if error != null}
669
+ // (43:1) {#if error != null}
670
670
  function create_if_block$4(ctx) {
671
671
  let p;
672
672
 
673
673
  function select_block_type(ctx, dirty) {
674
- if (/*htmlError*/ ctx[5]) return create_if_block_1$2;
674
+ if (/*htmlError*/ ctx[6]) return create_if_block_1$2;
675
675
  return create_else_block$2;
676
676
  }
677
677
 
@@ -709,9 +709,9 @@ function create_if_block$4(ctx) {
709
709
  };
710
710
  }
711
711
 
712
- // (45:3) {:else}
712
+ // (47:3) {:else}
713
713
  function create_else_block$2(ctx) {
714
- let t_value = (/*error*/ ctx[4] !== null ? /*error*/ ctx[4] : "") + "";
714
+ let t_value = (/*error*/ ctx[5] !== null ? /*error*/ ctx[5] : "") + "";
715
715
  let t;
716
716
 
717
717
  return {
@@ -722,7 +722,7 @@ function create_else_block$2(ctx) {
722
722
  insert(target, t, anchor);
723
723
  },
724
724
  p(ctx, dirty) {
725
- if (dirty & /*error*/ 16 && t_value !== (t_value = (/*error*/ ctx[4] !== null ? /*error*/ ctx[4] : "") + "")) set_data(t, t_value);
725
+ if (dirty & /*error*/ 32 && t_value !== (t_value = (/*error*/ ctx[5] !== null ? /*error*/ ctx[5] : "") + "")) set_data(t, t_value);
726
726
  },
727
727
  d(detaching) {
728
728
  if (detaching) detach(t);
@@ -730,10 +730,10 @@ function create_else_block$2(ctx) {
730
730
  };
731
731
  }
732
732
 
733
- // (43:3) {#if htmlError}
733
+ // (45:3) {#if htmlError}
734
734
  function create_if_block_1$2(ctx) {
735
735
  let html_tag;
736
- let raw_value = (/*error*/ ctx[4] !== null ? /*error*/ ctx[4] : "") + "";
736
+ let raw_value = (/*error*/ ctx[5] !== null ? /*error*/ ctx[5] : "") + "";
737
737
  let html_anchor;
738
738
 
739
739
  return {
@@ -746,7 +746,7 @@ function create_if_block_1$2(ctx) {
746
746
  insert(target, html_anchor, anchor);
747
747
  },
748
748
  p(ctx, dirty) {
749
- if (dirty & /*error*/ 16 && raw_value !== (raw_value = (/*error*/ ctx[4] !== null ? /*error*/ ctx[4] : "") + "")) html_tag.p(raw_value);
749
+ if (dirty & /*error*/ 32 && raw_value !== (raw_value = (/*error*/ ctx[5] !== null ? /*error*/ ctx[5] : "") + "")) html_tag.p(raw_value);
750
750
  },
751
751
  d(detaching) {
752
752
  if (detaching) detach(html_anchor);
@@ -762,8 +762,8 @@ function create_fragment$h(ctx) {
762
762
  let t1;
763
763
  let mounted;
764
764
  let dispose;
765
- let if_block0 = /*label*/ ctx[2] && create_if_block_2$1(ctx);
766
- let if_block1 = /*error*/ ctx[4] != null && create_if_block$4(ctx);
765
+ let if_block0 = /*label*/ ctx[3] && create_if_block_2$1(ctx);
766
+ let if_block1 = /*error*/ ctx[5] != null && create_if_block$4(ctx);
767
767
 
768
768
  return {
769
769
  c() {
@@ -775,12 +775,13 @@ function create_fragment$h(ctx) {
775
775
  if (if_block1) if_block1.c();
776
776
  attr(input, "id", /*id*/ ctx[1]);
777
777
  attr(input, "type", "text");
778
- attr(input, "placeholder", /*placeholder*/ ctx[3]);
779
- input.readOnly = /*readonly*/ ctx[8];
778
+ attr(input, "name", /*name*/ ctx[2]);
779
+ attr(input, "placeholder", /*placeholder*/ ctx[4]);
780
+ input.readOnly = /*readonly*/ ctx[9];
780
781
  attr(input, "class", "svelte-1r94s7");
781
- toggle_class(input, "border", /*border*/ ctx[9]);
782
- toggle_class(input, "error", /*error*/ ctx[4] !== null);
783
- toggle_class(input, "readonlyInput", /*readonly*/ ctx[8] == true);
782
+ toggle_class(input, "border", /*border*/ ctx[10]);
783
+ toggle_class(input, "error", /*error*/ ctx[5] !== null);
784
+ toggle_class(input, "readonlyInput", /*readonly*/ ctx[9] == true);
784
785
  attr(div, "class", "iroco-ui-input svelte-1r94s7");
785
786
  },
786
787
  m(target, anchor) {
@@ -794,15 +795,15 @@ function create_fragment$h(ctx) {
794
795
 
795
796
  if (!mounted) {
796
797
  dispose = [
797
- listen(input, "input", /*input_handler*/ ctx[13]),
798
- listen(input, "input", /*input_input_handler*/ ctx[14]),
798
+ listen(input, "input", /*input_handler*/ ctx[14]),
799
+ listen(input, "input", /*input_input_handler*/ ctx[15]),
799
800
  listen(input, "focus", function () {
800
- if (is_function(/*onFocus*/ ctx[6])) /*onFocus*/ ctx[6].apply(this, arguments);
801
+ if (is_function(/*onFocus*/ ctx[7])) /*onFocus*/ ctx[7].apply(this, arguments);
801
802
  }),
802
803
  listen(input, "blur", function () {
803
- if (is_function(/*onBlur*/ ctx[7])) /*onBlur*/ ctx[7].apply(this, arguments);
804
+ if (is_function(/*onBlur*/ ctx[8])) /*onBlur*/ ctx[8].apply(this, arguments);
804
805
  }),
805
- action_destroyer(/*typeAction*/ ctx[10].call(null, input))
806
+ action_destroyer(/*typeAction*/ ctx[11].call(null, input))
806
807
  ];
807
808
 
808
809
  mounted = true;
@@ -811,7 +812,7 @@ function create_fragment$h(ctx) {
811
812
  p(new_ctx, [dirty]) {
812
813
  ctx = new_ctx;
813
814
 
814
- if (/*label*/ ctx[2]) {
815
+ if (/*label*/ ctx[3]) {
815
816
  if (if_block0) {
816
817
  if_block0.p(ctx, dirty);
817
818
  } else {
@@ -828,31 +829,35 @@ function create_fragment$h(ctx) {
828
829
  attr(input, "id", /*id*/ ctx[1]);
829
830
  }
830
831
 
831
- if (dirty & /*placeholder*/ 8) {
832
- attr(input, "placeholder", /*placeholder*/ ctx[3]);
832
+ if (dirty & /*name*/ 4) {
833
+ attr(input, "name", /*name*/ ctx[2]);
834
+ }
835
+
836
+ if (dirty & /*placeholder*/ 16) {
837
+ attr(input, "placeholder", /*placeholder*/ ctx[4]);
833
838
  }
834
839
 
835
- if (dirty & /*readonly*/ 256) {
836
- input.readOnly = /*readonly*/ ctx[8];
840
+ if (dirty & /*readonly*/ 512) {
841
+ input.readOnly = /*readonly*/ ctx[9];
837
842
  }
838
843
 
839
844
  if (dirty & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
840
845
  set_input_value(input, /*value*/ ctx[0]);
841
846
  }
842
847
 
843
- if (dirty & /*border*/ 512) {
844
- toggle_class(input, "border", /*border*/ ctx[9]);
848
+ if (dirty & /*border*/ 1024) {
849
+ toggle_class(input, "border", /*border*/ ctx[10]);
845
850
  }
846
851
 
847
- if (dirty & /*error*/ 16) {
848
- toggle_class(input, "error", /*error*/ ctx[4] !== null);
852
+ if (dirty & /*error*/ 32) {
853
+ toggle_class(input, "error", /*error*/ ctx[5] !== null);
849
854
  }
850
855
 
851
- if (dirty & /*readonly*/ 256) {
852
- toggle_class(input, "readonlyInput", /*readonly*/ ctx[8] == true);
856
+ if (dirty & /*readonly*/ 512) {
857
+ toggle_class(input, "readonlyInput", /*readonly*/ ctx[9] == true);
853
858
  }
854
859
 
855
- if (/*error*/ ctx[4] != null) {
860
+ if (/*error*/ ctx[5] != null) {
856
861
  if (if_block1) {
857
862
  if_block1.p(ctx, dirty);
858
863
  } else {
@@ -888,6 +893,7 @@ function instance$g($$self, $$props, $$invalidate) {
888
893
 
889
894
  let { id } = $$props;
890
895
  let { type } = $$props;
896
+ let { name } = $$props;
891
897
  let { label = null } = $$props;
892
898
  let { placeholder } = $$props;
893
899
  let { error = null } = $$props;
@@ -912,23 +918,25 @@ function instance$g($$self, $$props, $$invalidate) {
912
918
  }
913
919
 
914
920
  $$self.$$set = $$props => {
915
- if ("TextType" in $$props) $$invalidate(11, TextType = $$props.TextType);
921
+ if ("TextType" in $$props) $$invalidate(12, TextType = $$props.TextType);
916
922
  if ("id" in $$props) $$invalidate(1, id = $$props.id);
917
- if ("type" in $$props) $$invalidate(12, type = $$props.type);
918
- if ("label" in $$props) $$invalidate(2, label = $$props.label);
919
- if ("placeholder" in $$props) $$invalidate(3, placeholder = $$props.placeholder);
920
- if ("error" in $$props) $$invalidate(4, error = $$props.error);
921
- if ("htmlError" in $$props) $$invalidate(5, htmlError = $$props.htmlError);
923
+ if ("type" in $$props) $$invalidate(13, type = $$props.type);
924
+ if ("name" in $$props) $$invalidate(2, name = $$props.name);
925
+ if ("label" in $$props) $$invalidate(3, label = $$props.label);
926
+ if ("placeholder" in $$props) $$invalidate(4, placeholder = $$props.placeholder);
927
+ if ("error" in $$props) $$invalidate(5, error = $$props.error);
928
+ if ("htmlError" in $$props) $$invalidate(6, htmlError = $$props.htmlError);
922
929
  if ("value" in $$props) $$invalidate(0, value = $$props.value);
923
- if ("onFocus" in $$props) $$invalidate(6, onFocus = $$props.onFocus);
924
- if ("onBlur" in $$props) $$invalidate(7, onBlur = $$props.onBlur);
925
- if ("readonly" in $$props) $$invalidate(8, readonly = $$props.readonly);
926
- if ("border" in $$props) $$invalidate(9, border = $$props.border);
930
+ if ("onFocus" in $$props) $$invalidate(7, onFocus = $$props.onFocus);
931
+ if ("onBlur" in $$props) $$invalidate(8, onBlur = $$props.onBlur);
932
+ if ("readonly" in $$props) $$invalidate(9, readonly = $$props.readonly);
933
+ if ("border" in $$props) $$invalidate(10, border = $$props.border);
927
934
  };
928
935
 
929
936
  return [
930
937
  value,
931
938
  id,
939
+ name,
932
940
  label,
933
941
  placeholder,
934
942
  error,
@@ -950,18 +958,19 @@ class TextInput extends SvelteComponent {
950
958
  super();
951
959
 
952
960
  init(this, options, instance$g, create_fragment$h, safe_not_equal, {
953
- TextType: 11,
961
+ TextType: 12,
954
962
  id: 1,
955
- type: 12,
956
- label: 2,
957
- placeholder: 3,
958
- error: 4,
959
- htmlError: 5,
963
+ type: 13,
964
+ name: 2,
965
+ label: 3,
966
+ placeholder: 4,
967
+ error: 5,
968
+ htmlError: 6,
960
969
  value: 0,
961
- onFocus: 6,
962
- onBlur: 7,
963
- readonly: 8,
964
- border: 9
970
+ onFocus: 7,
971
+ onBlur: 8,
972
+ readonly: 9,
973
+ border: 10
965
974
  });
966
975
  }
967
976
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
@@ -7,6 +7,7 @@
7
7
 
8
8
  export let id: string;
9
9
  export let type: TextType;
10
+ export let name: string;
10
11
  export let label: string | null = null;
11
12
  export let placeholder: string | undefined;
12
13
  export let error: string | null = null;
@@ -33,6 +34,7 @@
33
34
  on:blur={onBlur}
34
35
  {id}
35
36
  type="text"
37
+ name={name}
36
38
  {placeholder}
37
39
  class:border
38
40
  class:error={error !== null}