Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pap-it/templates-form-element

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pap-it/templates-form-element - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

12

dist/react/FormElement.js

@@ -1,11 +0,1 @@

import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import { papHOC } from "@pap-it/system-react";
import "../register.bundle.mjs";
// exporting
export { FormElement as FormElementElement } from "../src";
const Component = React.forwardRef((props, forwardref) => {
const { children, ...attributes } = props;
return (_jsx("pap-form-element-template", { ...attributes, ref: forwardref, children: children }));
});
export const FormElement = papHOC(Component);
"use strict";import{jsx as m}from"react/jsx-runtime";import n from"react";import{papHOC as p}from"@pap-it/system-react";import"../register.bundle.mjs";export{FormElement as FormElementElement}from"../src";const a=n.forwardRef((e,r)=>{const{children:t,...o}=e;return m("pap-form-element-template",{...o,ref:r,children:t})});export const FormElement=p(a);

2

dist/react/index.js

@@ -1,1 +0,1 @@

export * from './FormElement';
"use strict";export*from"./FormElement";

@@ -1,126 +0,1 @@

import { __decorate } from "tslib";
// system
import { property, debounce } from "@pap-it/system-utils";
import { Base } from "@pap-it/system-base";
// local
export class FormElement extends Base {
constructor(config) {
super(config);
this.defaultinternal = false;
this.name = "missing-name";
this._internals = this.attachInternals();
this.debouncedchange = debounce(this.debouncedchange, 120);
}
firstUpdate() {
super.firstUpdate();
if (this.defaultValue === undefined) {
this.defaultinternal = true;
this.defaultValue = this.value;
}
}
formDisabledCallback(disabled) {
this.disabled = disabled;
}
formStateRestoreCallback(state, mode) {
console.log('[field]: formStateRestoreCallback', { state, mode });
}
checkValidity() {
var _a;
if (this._internals === undefined)
return true;
return (_a = this._internals) === null || _a === void 0 ? void 0 : _a.checkValidity();
}
reportValidity() {
var _a;
if (this._internals === undefined)
return true;
return (_a = this._internals) === null || _a === void 0 ? void 0 : _a.reportValidity();
}
get validity() {
if (this.element && 'validity' in this.element) {
return this.element.validity;
}
if (this._internals === undefined)
return { valid: true };
return this._internals.validity;
}
get validationMessage() {
if (this.element && 'validationMessage' in this.element) {
return this.element.validationMessage;
}
if (this._internals === undefined)
return "";
return this._internals.validationMessage;
}
setValidity(flags, message, anchor) {
if (!this._internals === undefined)
return;
this._internals.setValidity(flags, message, anchor || undefined);
}
formResetCallback() {
this.value = this.defaultValue;
if (this.element && 'value' in this.element) {
this.element.value = this.value || "";
}
}
// public setCustomValidity(message?: string) {
// if (this.element && 'setCustomValidity' in this.element)
// {
// this.element.setCustomValidity(message);
// }
// if (this._internals === undefined) return "";
// return this._internals.setCustomValidity();
// }
// private functions
connectElement(element) {
if (!this.element)
this.element = element;
}
updateform(value) {
if (this._internals !== undefined) {
this._internals.setFormValue(value);
}
}
validateElement() {
// do something
}
debouncedchange() {
this.dispatchEvent(new Event('change'));
this.validateElement();
}
}
FormElement.formAssociated = true;
__decorate([
property({
attribute: 'default-value',
after: function (value) {
if (!this.defaultinternal)
this.value = value;
this.defaultinternal = false;
}
})
], FormElement.prototype, "defaultValue", void 0);
__decorate([
property({
type: Boolean,
after: function (value) {
if (value) {
this.setAttribute('aria-disabled', 'true');
}
else {
this.setAttribute('aria-disabled', 'false');
}
}
})
], FormElement.prototype, "disabled", void 0);
__decorate([
property({ rerender: false })
], FormElement.prototype, "name", void 0);
__decorate([
property({
after: function (value) {
this.updateform(value);
this.debouncedchange();
}
})
], FormElement.prototype, "value", void 0);
"use strict";import{__decorate as i}from"tslib";import{property as a,debounce as l}from"@pap-it/system-utils";import{Base as r}from"@pap-it/system-base";export class FormElement extends r{constructor(e){super(e),this.defaultinternal=!1,this.name="missing-name",this._internals=this.attachInternals(),this.debouncedchange=l(this.debouncedchange,120)}firstUpdate(){super.firstUpdate(),this.defaultValue===void 0&&(this.defaultinternal=!0,this.defaultValue=this.value)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e,n){console.log("[field]: formStateRestoreCallback",{state:e,mode:n})}checkValidity(){var e;return this._internals===void 0?!0:(e=this._internals)===null||e===void 0?void 0:e.checkValidity()}reportValidity(){var e;return this._internals===void 0?!0:(e=this._internals)===null||e===void 0?void 0:e.reportValidity()}get validity(){return this.element&&"validity"in this.element?this.element.validity:this._internals===void 0?{valid:!0}:this._internals.validity}get validationMessage(){return this.element&&"validationMessage"in this.element?this.element.validationMessage:this._internals===void 0?"":this._internals.validationMessage}setValidity(e,n,s){!this._internals!==void 0&&this._internals.setValidity(e,n,s||void 0)}formResetCallback(){this.value=this.defaultValue,this.element&&"value"in this.element&&(this.element.value=this.value||"")}connectElement(e){this.element||(this.element=e)}updateform(e){this._internals!==void 0&&this._internals.setFormValue(e)}validateElement(){}debouncedchange(){this.dispatchEvent(new Event("change")),this.validateElement()}}FormElement.formAssociated=!0,i([a({attribute:"default-value",after:function(t){this.defaultinternal||(this.value=t),this.defaultinternal=!1}})],FormElement.prototype,"defaultValue",void 0),i([a({type:Boolean,after:function(t){t?this.setAttribute("aria-disabled","true"):this.setAttribute("aria-disabled","false")}})],FormElement.prototype,"disabled",void 0),i([a({rerender:!1})],FormElement.prototype,"name",void 0),i([a({after:function(t){this.updateform(t),this.debouncedchange()}})],FormElement.prototype,"value",void 0);

@@ -1,3 +0,1 @@

export * from './component';
export * from './types';
// * <-- This is an asshole
"use strict";export*from"./component";export*from"./types";

@@ -1,9 +0,1 @@

import { FormElement } from './component.js';
// Register the element with the browser
const cElements = customElements !== null && customElements !== void 0 ? customElements : window === null || window === void 0 ? void 0 : window.customElements;
if (!cElements) {
throw new Error('Custom Elements not supported');
}
if (!cElements.get('pap-form-element-template')) {
cElements.define('pap-form-element-template', FormElement);
}
"use strict";import{FormElement as t}from"./component.js";const e=customElements!=null?customElements:window==null?void 0:window.customElements;if(!e)throw new Error("Custom Elements not supported");e.get("pap-form-element-template")||e.define("pap-form-element-template",t);

@@ -1,1 +0,1 @@

export {};
"use strict";export{};
{
"name": "@pap-it/templates-form-element",
"version": "1.0.11",
"version": "1.0.12",
"scripts": {

@@ -29,3 +29,3 @@ "init": "sh .scripts/init.sh",

"./wc": "./dist/register.bundle.mjs",
"./react": "./dist/react/index.ts"
"./react": "./dist/react/index.js"
},

@@ -45,7 +45,7 @@ "author": "onkelhoy",

"@pap-it/system-utils": "1.0.10",
"@pap-it/system-react": "0.0.5",
"@pap-it/system-base": "1.0.11"
"@pap-it/system-react": "0.0.6",
"@pap-it/system-base": "1.0.12"
},
"devDependencies": {
"@pap-it/system-doc": "1.0.16",
"@pap-it/system-doc": "1.0.17",
"esbuild": "^0.17.18",

@@ -52,0 +52,0 @@ "tslib": "^2.5.0",

@@ -5,6 +5,7 @@ # FormElement

Version: Version: Version: 1.0.11
Version: Version: Version: 1.0.12
## Development

@@ -11,0 +12,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc