@vtmn/svelte
Advanced tools
Comparing version
@@ -445,3 +445,3 @@ (function (global, factory) { | ||
function create_if_block_1(ctx) { | ||
function create_if_block_2(ctx) { | ||
let label; | ||
@@ -474,3 +474,113 @@ let t; | ||
// (60:0) {#if helperText} | ||
// (72:0) {:else} | ||
function create_else_block(ctx) { | ||
let div; | ||
let input; | ||
let t; | ||
let span; | ||
let span_class_value; | ||
let input_levels = [ | ||
{ class: "vtmn-text-input" }, | ||
{ type: "text" }, | ||
{ identifier: /*identifier*/ ctx[0] }, | ||
{ disabled: /*disabled*/ ctx[3] }, | ||
{ placeholder: /*placeholder*/ ctx[2] }, | ||
/*$$props*/ ctx[9] | ||
]; | ||
let input_data = {}; | ||
for (let i = 0; i < input_levels.length; i += 1) { | ||
input_data = assign(input_data, input_levels[i]); | ||
} | ||
return { | ||
c() { | ||
div = element("div"); | ||
input = element("input"); | ||
t = space(); | ||
span = element("span"); | ||
set_attributes(input, input_data); | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[6]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[7]); | ||
attr(span, "class", span_class_value = /*icon*/ ctx[8] && `vtmx-${/*icon*/ ctx[8]}`); | ||
attr(div, "class", "vtmn-text-input_container"); | ||
}, | ||
m(target, anchor) { | ||
insert(target, div, anchor); | ||
append(div, input); | ||
append(div, t); | ||
append(div, span); | ||
}, | ||
p(ctx, dirty) { | ||
set_attributes(input, input_data = get_spread_update(input_levels, [ | ||
{ class: "vtmn-text-input" }, | ||
{ type: "text" }, | ||
dirty & /*identifier*/ 1 && { identifier: /*identifier*/ ctx[0] }, | ||
dirty & /*disabled*/ 8 && { disabled: /*disabled*/ ctx[3] }, | ||
dirty & /*placeholder*/ 4 && { placeholder: /*placeholder*/ ctx[2] }, | ||
dirty & /*$$props*/ 512 && /*$$props*/ ctx[9] | ||
])); | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[6]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[7]); | ||
if (dirty & /*icon*/ 256 && span_class_value !== (span_class_value = /*icon*/ ctx[8] && `vtmx-${/*icon*/ ctx[8]}`)) { | ||
attr(span, "class", span_class_value); | ||
} | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(div); | ||
} | ||
}; | ||
} | ||
// (62:0) {#if multiline} | ||
function create_if_block_1(ctx) { | ||
let textarea; | ||
let textarea_levels = [ | ||
{ class: "vtmn-text-input" }, | ||
{ identifier: /*identifier*/ ctx[0] }, | ||
{ disabled: /*disabled*/ ctx[3] }, | ||
{ placeholder: /*placeholder*/ ctx[2] }, | ||
/*$$props*/ ctx[9] | ||
]; | ||
let textarea_data = {}; | ||
for (let i = 0; i < textarea_levels.length; i += 1) { | ||
textarea_data = assign(textarea_data, textarea_levels[i]); | ||
} | ||
return { | ||
c() { | ||
textarea = element("textarea"); | ||
set_attributes(textarea, textarea_data); | ||
toggle_class(textarea, "vtmn-text-input--error", /*error*/ ctx[7]); | ||
toggle_class(textarea, "vtmn-text-input--valid", /*valid*/ ctx[6]); | ||
}, | ||
m(target, anchor) { | ||
insert(target, textarea, anchor); | ||
}, | ||
p(ctx, dirty) { | ||
set_attributes(textarea, textarea_data = get_spread_update(textarea_levels, [ | ||
{ class: "vtmn-text-input" }, | ||
dirty & /*identifier*/ 1 && { identifier: /*identifier*/ ctx[0] }, | ||
dirty & /*disabled*/ 8 && { disabled: /*disabled*/ ctx[3] }, | ||
dirty & /*placeholder*/ 4 && { placeholder: /*placeholder*/ ctx[2] }, | ||
dirty & /*$$props*/ 512 && /*$$props*/ ctx[9] | ||
])); | ||
toggle_class(textarea, "vtmn-text-input--error", /*error*/ ctx[7]); | ||
toggle_class(textarea, "vtmn-text-input--valid", /*valid*/ ctx[6]); | ||
}, | ||
d(detaching) { | ||
if (detaching) detach(textarea); | ||
} | ||
}; | ||
} | ||
// (87:0) {#if helperText} | ||
function create_if_block(ctx) { | ||
@@ -485,2 +595,3 @@ let p; | ||
attr(p, "class", "vtmn-text-input_helper-text"); | ||
toggle_class(p, "vtmn-text-input_helper-text--error", /*error*/ ctx[7]); | ||
}, | ||
@@ -493,2 +604,6 @@ m(target, anchor) { | ||
if (dirty & /*helperText*/ 16) set_data(t, /*helperText*/ ctx[4]); | ||
if (dirty & /*error*/ 128) { | ||
toggle_class(p, "vtmn-text-input_helper-text--error", /*error*/ ctx[7]); | ||
} | ||
}, | ||
@@ -503,23 +618,14 @@ d(detaching) { | ||
let t0; | ||
let input; | ||
let t1; | ||
let if_block1_anchor; | ||
let if_block0 = /*labelText*/ ctx[1] && create_if_block_1(ctx); | ||
let if_block2_anchor; | ||
let if_block0 = /*labelText*/ ctx[1] && create_if_block_2(ctx); | ||
let input_levels = [ | ||
{ class: "vtmn-text-input" }, | ||
{ type: "text" }, | ||
{ identifier: /*identifier*/ ctx[0] }, | ||
{ disabled: /*disabled*/ ctx[3] }, | ||
{ placeholder: /*placeholder*/ ctx[2] }, | ||
/*$$props*/ ctx[7] | ||
]; | ||
let input_data = {}; | ||
for (let i = 0; i < input_levels.length; i += 1) { | ||
input_data = assign(input_data, input_levels[i]); | ||
function select_block_type(ctx, dirty) { | ||
if (/*multiline*/ ctx[5]) return create_if_block_1; | ||
return create_else_block; | ||
} | ||
let if_block1 = /*helperText*/ ctx[4] && create_if_block(ctx); | ||
let current_block_type = select_block_type(ctx); | ||
let if_block1 = current_block_type(ctx); | ||
let if_block2 = /*helperText*/ ctx[4] && create_if_block(ctx); | ||
@@ -530,9 +636,6 @@ return { | ||
t0 = space(); | ||
input = element("input"); | ||
if_block1.c(); | ||
t1 = space(); | ||
if (if_block1) if_block1.c(); | ||
if_block1_anchor = empty(); | ||
set_attributes(input, input_data); | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[5]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[6]); | ||
if (if_block2) if_block2.c(); | ||
if_block2_anchor = empty(); | ||
}, | ||
@@ -542,6 +645,6 @@ m(target, anchor) { | ||
insert(target, t0, anchor); | ||
insert(target, input, anchor); | ||
if_block1.m(target, anchor); | ||
insert(target, t1, anchor); | ||
if (if_block1) if_block1.m(target, anchor); | ||
insert(target, if_block1_anchor, anchor); | ||
if (if_block2) if_block2.m(target, anchor); | ||
insert(target, if_block2_anchor, anchor); | ||
}, | ||
@@ -553,3 +656,3 @@ p(ctx, [dirty]) { | ||
} else { | ||
if_block0 = create_if_block_1(ctx); | ||
if_block0 = create_if_block_2(ctx); | ||
if_block0.c(); | ||
@@ -563,25 +666,25 @@ if_block0.m(t0.parentNode, t0); | ||
set_attributes(input, input_data = get_spread_update(input_levels, [ | ||
{ class: "vtmn-text-input" }, | ||
{ type: "text" }, | ||
dirty & /*identifier*/ 1 && { identifier: /*identifier*/ ctx[0] }, | ||
dirty & /*disabled*/ 8 && { disabled: /*disabled*/ ctx[3] }, | ||
dirty & /*placeholder*/ 4 && { placeholder: /*placeholder*/ ctx[2] }, | ||
dirty & /*$$props*/ 128 && /*$$props*/ ctx[7] | ||
])); | ||
if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block1) { | ||
if_block1.p(ctx, dirty); | ||
} else { | ||
if_block1.d(1); | ||
if_block1 = current_block_type(ctx); | ||
toggle_class(input, "vtmn-text-input--valid", /*valid*/ ctx[5]); | ||
toggle_class(input, "vtmn-text-input--error", /*error*/ ctx[6]); | ||
if (if_block1) { | ||
if_block1.c(); | ||
if_block1.m(t1.parentNode, t1); | ||
} | ||
} | ||
if (/*helperText*/ ctx[4]) { | ||
if (if_block1) { | ||
if_block1.p(ctx, dirty); | ||
if (if_block2) { | ||
if_block2.p(ctx, dirty); | ||
} else { | ||
if_block1 = create_if_block(ctx); | ||
if_block1.c(); | ||
if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); | ||
if_block2 = create_if_block(ctx); | ||
if_block2.c(); | ||
if_block2.m(if_block2_anchor.parentNode, if_block2_anchor); | ||
} | ||
} else if (if_block1) { | ||
if_block1.d(1); | ||
if_block1 = null; | ||
} else if (if_block2) { | ||
if_block2.d(1); | ||
if_block2 = null; | ||
} | ||
@@ -594,6 +697,6 @@ }, | ||
if (detaching) detach(t0); | ||
if (detaching) detach(input); | ||
if_block1.d(detaching); | ||
if (detaching) detach(t1); | ||
if (if_block1) if_block1.d(detaching); | ||
if (detaching) detach(if_block1_anchor); | ||
if (if_block2) if_block2.d(detaching); | ||
if (detaching) detach(if_block2_anchor); | ||
} | ||
@@ -609,7 +712,9 @@ }; | ||
let { helperText } = $$props; | ||
let { multiline = false } = $$props; | ||
let { valid = false } = $$props; | ||
let { error = false } = $$props; | ||
let { icon } = $$props; | ||
$$self.$$set = $$new_props => { | ||
$$invalidate(7, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); | ||
$$invalidate(9, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props))); | ||
if ("identifier" in $$new_props) $$invalidate(0, identifier = $$new_props.identifier); | ||
@@ -620,4 +725,6 @@ if ("labelText" in $$new_props) $$invalidate(1, labelText = $$new_props.labelText); | ||
if ("helperText" in $$new_props) $$invalidate(4, helperText = $$new_props.helperText); | ||
if ("valid" in $$new_props) $$invalidate(5, valid = $$new_props.valid); | ||
if ("error" in $$new_props) $$invalidate(6, error = $$new_props.error); | ||
if ("multiline" in $$new_props) $$invalidate(5, multiline = $$new_props.multiline); | ||
if ("valid" in $$new_props) $$invalidate(6, valid = $$new_props.valid); | ||
if ("error" in $$new_props) $$invalidate(7, error = $$new_props.error); | ||
if ("icon" in $$new_props) $$invalidate(8, icon = $$new_props.icon); | ||
}; | ||
@@ -633,4 +740,6 @@ | ||
helperText, | ||
multiline, | ||
valid, | ||
error, | ||
icon, | ||
$$props | ||
@@ -650,4 +759,6 @@ ]; | ||
helperText: 4, | ||
valid: 5, | ||
error: 6 | ||
multiline: 5, | ||
valid: 6, | ||
error: 7, | ||
icon: 8 | ||
}); | ||
@@ -654,0 +765,0 @@ } |
{ | ||
"name": "@vtmn/svelte", | ||
"version": "0.4.7", | ||
"version": "0.5.0", | ||
"description": "Decathlon Design System - Vitamin Svelte library", | ||
@@ -53,3 +53,3 @@ "keywords": [ | ||
], | ||
"gitHead": "a74e63f41888e47deb9d0cea629d2d08224ae5f5" | ||
"gitHead": "49f66bc8d063367267d9cfb5c7365f3a1183b3b0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
176059
4.2%4612
4.49%