@forter/component-base
Advanced tools
Comparing version 4.1.0 to 5.0.0
@@ -573,4 +573,2 @@ import '@forter/tokens'; | ||
// camelCase => CamelCase | ||
// Getting the slot, and if does not exist creating it. Returns the slot. | ||
@@ -700,11 +698,2 @@ | ||
decorators: [property({ | ||
type: Boolean, | ||
reflect: true, | ||
attribute: 'custom-prefix' | ||
})], | ||
key: "customPrefix", | ||
value: void 0 | ||
}, { | ||
kind: "field", | ||
decorators: [property({ | ||
type: String, | ||
@@ -717,11 +706,2 @@ reflect: true, | ||
}, { | ||
kind: "field", | ||
decorators: [property({ | ||
type: Boolean, | ||
reflect: true, | ||
attribute: 'custom-suffix' | ||
})], | ||
key: "customSuffix", | ||
value: void 0 | ||
}, { | ||
kind: "method", | ||
@@ -773,6 +753,16 @@ key: "init", | ||
_ref; | ||
return _ref = {}, _defineProperty(_ref, SLOT_NAMES.PREFIX, function () { | ||
return _this2.leftIcon ? html(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["<fc-icon icon=\"", "\"></fc-icon>"])), _this2.leftIcon) : ''; | ||
}), _defineProperty(_ref, SLOT_NAMES.SUFFIX, function () { | ||
return _this2.rightIcon ? html(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["<fc-icon icon=\"", "\"></fc-icon>"])), _this2.rightIcon) : ''; | ||
return _ref = {}, _defineProperty(_ref, SLOT_NAMES.PREFIX, { | ||
condition: function condition() { | ||
return _this2.leftIcon; | ||
}, | ||
renderer: function renderer() { | ||
return html(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["<fc-icon icon=\"", "\"></fc-icon>"])), _this2.leftIcon); | ||
} | ||
}), _defineProperty(_ref, SLOT_NAMES.SUFFIX, { | ||
condition: function condition() { | ||
return _this2.rightIcon; | ||
}, | ||
renderer: function renderer() { | ||
return html(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["<fc-icon icon=\"", "\"></fc-icon>"])), _this2.rightIcon); | ||
} | ||
}), _ref; | ||
@@ -782,2 +772,14 @@ } | ||
kind: "method", | ||
key: "renderPrefix", | ||
value: function renderPrefix() { | ||
return html(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"prefix\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !this["has-slot-prefix"], SLOT_NAMES.PREFIX); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "renderSuffix", | ||
value: function renderSuffix() { | ||
return html(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"suffix\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !this["has-slot-suffix"], SLOT_NAMES.SUFFIX); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "onSpace", | ||
@@ -899,5 +901,5 @@ value: function onSpace(event) {} | ||
kind: "method", | ||
key: "update", | ||
value: function update(changedProperties) { | ||
_get(_getPrototypeOf(Element.prototype), "update", this).call(this, changedProperties); | ||
key: "willUpdate", | ||
value: function willUpdate(changedProperties) { | ||
_get(_getPrototypeOf(Element.prototype), "willUpdate", this).call(this, changedProperties); | ||
this.renderSlots(this.slots, changedProperties); | ||
@@ -919,10 +921,21 @@ } | ||
// slotRenderers is an object that contains functions used to create the slot structure | ||
var factory = this.slotRenderers[slotName]; | ||
var slotRenderer = this.slotRenderers[slotName]; | ||
var condition = slotRenderer === null || slotRenderer === void 0 ? void 0 : slotRenderer.condition; | ||
var renderer = slotRenderer === null || slotRenderer === void 0 ? void 0 : slotRenderer.renderer; | ||
var root = this.verifySlotted(slotName); | ||
if (factory && typeof factory === 'function' && root.getAttribute('internal-slot')) { | ||
// Getting the template and the position | ||
var template = factory.apply(this); | ||
var shouldRender = condition && typeof condition === 'function' && !!condition.apply(this); | ||
var hasSlotFlag = "has-slot-".concat(slotName); | ||
if (root.getAttribute('internal-slot')) { | ||
if (renderer && typeof renderer === 'function') { | ||
this[hasSlotFlag] = shouldRender; | ||
// Getting the template and the position | ||
var template = shouldRender ? renderer.apply(this) : null; | ||
// Rendering the template in the position | ||
render(template, root); | ||
// Rendering the template in the position | ||
render(template, root); | ||
} else { | ||
this[hasSlotFlag] = false; | ||
} | ||
} else { | ||
this[hasSlotFlag] = true; | ||
} | ||
@@ -932,27 +945,2 @@ } | ||
kind: "method", | ||
key: "renderPrefix", | ||
value: function renderPrefix() { | ||
var customPrefix = this.customPrefix, | ||
leftIcon = this.leftIcon; | ||
return html(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"prefix\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !customPrefix && !leftIcon, SLOT_NAMES.PREFIX); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "renderSuffix", | ||
value: function renderSuffix() { | ||
var customSuffix = this.customSuffix, | ||
rightIcon = this.rightIcon; | ||
return html(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"suffix\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !customSuffix && !rightIcon, SLOT_NAMES.SUFFIX); | ||
} | ||
}, { | ||
kind: "field", | ||
key: "capitalize", | ||
value: function value() { | ||
return function () { | ||
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
return "".concat(text.charAt(0).toUpperCase()).concat(text.slice(1)); | ||
}; | ||
} | ||
}, { | ||
kind: "method", | ||
key: "verifySlotted", | ||
@@ -1110,3 +1098,3 @@ value: function verifySlotted(slotName) { | ||
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8; | ||
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
@@ -1247,8 +1235,23 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
_objectSpread2; | ||
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(GeneralFormElement.prototype), "slotRenderers", this)), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, SLOT_NAMES.LABEL, function () { | ||
return html(_templateObject || (_templateObject = _taggedTemplateLiteral(["", ""])), _this2.label); | ||
}), _defineProperty(_objectSpread2, SLOT_NAMES.ERROR, function () { | ||
return html(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["", ""])), _this2.error); | ||
}), _defineProperty(_objectSpread2, SLOT_NAMES.NOTE, function () { | ||
return html(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["", ""])), _this2.note); | ||
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(GeneralFormElement.prototype), "slotRenderers", this)), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, SLOT_NAMES.LABEL, { | ||
condition: function condition() { | ||
return _this2.label; | ||
}, | ||
renderer: function renderer() { | ||
return html(_templateObject || (_templateObject = _taggedTemplateLiteral(["", ""])), _this2.label); | ||
} | ||
}), _defineProperty(_objectSpread2, SLOT_NAMES.ERROR, { | ||
condition: function condition() { | ||
return _this2.error; | ||
}, | ||
renderer: function renderer() { | ||
return html(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["", ""])), _this2.error); | ||
} | ||
}), _defineProperty(_objectSpread2, SLOT_NAMES.NOTE, { | ||
condition: function condition() { | ||
return _this2.note; | ||
}, | ||
renderer: function renderer() { | ||
return html(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["", ""])), _this2.note); | ||
} | ||
}), _objectSpread2)); | ||
@@ -1260,3 +1263,3 @@ } | ||
value: function renderLabel() { | ||
return html(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n <label tabindex=\"-1\" part=\"label\" ?hidden=\"", "\" for=\"", "\">\n <slot name=\"", "\"/>\n </label>"])), this["has-slot-label"], this.id, SLOT_NAMES.LABEL); | ||
return html(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n <label tabindex=\"-1\" part=\"label\" ?hidden=\"", "\" for=\"", "\">\n <slot name=\"", "\"/>\n </label>"])), !this["has-slot-label"], this.id, SLOT_NAMES.LABEL); | ||
} | ||
@@ -1267,3 +1270,3 @@ }, { | ||
value: function renderError() { | ||
return html(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"error\" name=\"", "\"></slot>"])), SLOT_NAMES.ERROR); | ||
return html(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"error\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !this["has-slot-error"], SLOT_NAMES.ERROR); | ||
} | ||
@@ -1274,18 +1277,6 @@ }, { | ||
value: function renderNote() { | ||
return html(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"note\" name=\"", "\"></slot>"])), SLOT_NAMES.NOTE); | ||
return html(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"note\" ?hidden=\"", "\" name=\"", "\"></slot>"])), !this["has-slot-note"], SLOT_NAMES.NOTE); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "renderPrefix", | ||
value: function renderPrefix() { | ||
return html(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"prefix\" name=\"", "\"></slot>"])), SLOT_NAMES.PREFIX); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "renderSuffix", | ||
value: function renderSuffix() { | ||
return html(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["<slot tabindex=\"-1\" part=\"suffix\" name=\"", "\"></slot>"])), SLOT_NAMES.SUFFIX); | ||
} | ||
}, { | ||
kind: "method", | ||
key: "onChange", | ||
@@ -1292,0 +1283,0 @@ value: function onChange(_ref) { |
{ | ||
"name": "@forter/component-base", | ||
"version": "4.1.0", | ||
"version": "5.0.0", | ||
"description": "", | ||
@@ -20,3 +20,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@forter/tokens": "^1.1.0", | ||
"@forter/tokens": "^2.0.0", | ||
"lit": "^2.7.2", | ||
@@ -31,3 +31,3 @@ "validate.js": "^0.13.1" | ||
}, | ||
"gitHead": "9d43ec17dde5d2ce8e5e78d23235cde5957c9f64" | ||
"gitHead": "1b013d1b4fb811a85e6e396694e276d16d0b8cf6" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132716
1311
+ Added@forter/tokens@2.2.0(transitive)
- Removed@forter/tokens@1.1.0(transitive)
Updated@forter/tokens@^2.0.0