le-kit 0.1.12 → 0.1.13
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/custom-elements.json +1268 -1268
- package/dist/collection/assets/custom-elements.json +750 -750
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +113 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/le-box.d.ts +11 -0
- package/dist/components/le-box.js +257 -0
- package/dist/components/le-box.js.map +1 -0
- package/dist/components/le-button.d.ts +11 -0
- package/dist/components/le-button.js +9 -0
- package/dist/components/le-button.js.map +1 -0
- package/dist/components/le-button2.js +1149 -0
- package/dist/components/le-button2.js.map +1 -0
- package/dist/components/le-card.d.ts +11 -0
- package/dist/components/le-card.js +84 -0
- package/dist/components/le-card.js.map +1 -0
- package/dist/components/le-checkbox.d.ts +11 -0
- package/dist/components/le-checkbox.js +9 -0
- package/dist/components/le-checkbox.js.map +1 -0
- package/dist/components/le-component.d.ts +11 -0
- package/dist/components/le-component.js +9 -0
- package/dist/components/le-component.js.map +1 -0
- package/dist/components/le-number-input.d.ts +11 -0
- package/dist/components/le-number-input.js +272 -0
- package/dist/components/le-number-input.js.map +1 -0
- package/dist/components/le-popover.d.ts +11 -0
- package/dist/components/le-popover.js +9 -0
- package/dist/components/le-popover.js.map +1 -0
- package/dist/components/le-popover2.js +382 -0
- package/dist/components/le-popover2.js.map +1 -0
- package/dist/components/le-popup.d.ts +11 -0
- package/dist/components/le-popup.js +279 -0
- package/dist/components/le-popup.js.map +1 -0
- package/dist/components/le-round-progress.d.ts +11 -0
- package/dist/components/le-round-progress.js +135 -0
- package/dist/components/le-round-progress.js.map +1 -0
- package/dist/components/le-slot.d.ts +11 -0
- package/dist/components/le-slot.js +9 -0
- package/dist/components/le-slot.js.map +1 -0
- package/dist/components/le-stack.d.ts +11 -0
- package/dist/components/le-stack.js +199 -0
- package/dist/components/le-stack.js.map +1 -0
- package/dist/components/le-string-input.d.ts +11 -0
- package/dist/components/le-string-input.js +9 -0
- package/dist/components/le-string-input.js.map +1 -0
- package/dist/components/le-text.d.ts +11 -0
- package/dist/components/le-text.js +399 -0
- package/dist/components/le-text.js.map +1 -0
- package/dist/components/le-turntable.d.ts +11 -0
- package/dist/components/le-turntable.js +164 -0
- package/dist/components/le-turntable.js.map +1 -0
- package/dist/components/utils.js +310 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/core/collection/assets/custom-elements.json +4305 -0
- package/dist/core/collection/themes/base.css +89 -0
- package/dist/core/collection/themes/dark.css +100 -0
- package/dist/core/collection/themes/default.css +108 -0
- package/dist/core/collection/themes/gradient.css +100 -0
- package/dist/core/collection/themes/index.css +413 -0
- package/dist/core/collection/themes/minimal.css +100 -0
- package/dist/core/collection/themes/warm.css +100 -0
- package/dist/core/components/index.d.ts +33 -0
- package/dist/core/components/index.js +113 -0
- package/dist/core/components/index.js.map +1 -0
- package/dist/core/components/le-box.d.ts +11 -0
- package/dist/core/components/le-box.js +225 -0
- package/dist/core/components/le-box.js.map +1 -0
- package/dist/core/components/le-button.d.ts +11 -0
- package/dist/core/components/le-button.js +9 -0
- package/dist/core/components/le-button.js.map +1 -0
- package/dist/core/components/le-button2.js +121 -0
- package/dist/core/components/le-button2.js.map +1 -0
- package/dist/core/components/le-card.d.ts +11 -0
- package/dist/core/components/le-card.js +52 -0
- package/dist/core/components/le-card.js.map +1 -0
- package/dist/core/components/le-checkbox.d.ts +11 -0
- package/dist/core/components/le-checkbox.js +87 -0
- package/dist/core/components/le-checkbox.js.map +1 -0
- package/dist/core/components/le-number-input.d.ts +11 -0
- package/dist/core/components/le-number-input.js +246 -0
- package/dist/core/components/le-number-input.js.map +1 -0
- package/dist/core/components/le-popover.d.ts +11 -0
- package/dist/core/components/le-popover.js +385 -0
- package/dist/core/components/le-popover.js.map +1 -0
- package/dist/core/components/le-popup.d.ts +11 -0
- package/dist/core/components/le-popup.js +253 -0
- package/dist/core/components/le-popup.js.map +1 -0
- package/dist/core/components/le-round-progress.d.ts +11 -0
- package/dist/core/components/le-round-progress.js +135 -0
- package/dist/core/components/le-round-progress.js.map +1 -0
- package/dist/core/components/le-stack.d.ts +11 -0
- package/dist/core/components/le-stack.js +167 -0
- package/dist/core/components/le-stack.js.map +1 -0
- package/dist/core/components/le-string-input.d.ts +11 -0
- package/dist/core/components/le-string-input.js +127 -0
- package/dist/core/components/le-string-input.js.map +1 -0
- package/dist/core/components/le-text.d.ts +11 -0
- package/dist/core/components/le-text.js +367 -0
- package/dist/core/components/le-text.js.map +1 -0
- package/dist/core/components/le-turntable.d.ts +11 -0
- package/dist/core/components/le-turntable.js +164 -0
- package/dist/core/components/le-turntable.js.map +1 -0
- package/dist/core/components/utils.js +310 -0
- package/dist/core/components/utils.js.map +1 -0
- package/dist/docs.json +1 -1
- package/dist/le-kit/assets/custom-elements.json +750 -750
- package/dist/le-kit/dist/collection/themes/base.css +89 -0
- package/dist/le-kit/dist/collection/themes/dark.css +100 -0
- package/dist/le-kit/dist/collection/themes/default.css +108 -0
- package/dist/le-kit/dist/collection/themes/gradient.css +100 -0
- package/dist/le-kit/dist/collection/themes/index.css +413 -0
- package/dist/le-kit/dist/collection/themes/minimal.css +100 -0
- package/dist/le-kit/dist/collection/themes/warm.css +100 -0
- package/package.json +2 -2
- /package/dist/{le-kit → collection/dist/collection}/themes/base.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/dark.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/default.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/gradient.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/index.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/minimal.css +0 -0
- /package/dist/{le-kit → collection/dist/collection}/themes/warm.css +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { h as classnames } from './utils.js';
|
|
3
|
+
|
|
4
|
+
const leCardDefaultCss = ":host{display:block;--le-card-bg:var(--le-color-surface);--le-card-border-radius:var(--le-radius-lg);--le-card-shadow:var(--le-shadow-md);--le-card-shadow-elevated:var(--le-shadow-lg);--le-card-shadow-hover:var(--le-shadow-xl);--le-card-padding:var(--le-space-md);--le-card-border-color:var(--le-color-border);--le-card-transition:var(--le-transition-normal)}.card{background:var(--le-card-bg);border-radius:var(--le-card-border-radius);overflow:hidden;color:var(--le-color-text);box-shadow:var(--le-card-shadow)}:host(.variant-outlined) .card{border:1px solid var(--le-card-border-color);box-shadow:none}:host(.variant-elevated) .card{box-shadow:var(--le-card-shadow-elevated)}:host(.interactive) .card{cursor:pointer;transition:transform var(--le-card-transition), box-shadow var(--le-card-transition)}:host(.interactive) .card:hover{transform:translateY(-2px);box-shadow:var(--le-card-shadow-hover)}:host(.interactive) .card:focus-visible{outline:2px solid var(--le-color-border-focus);outline-offset:2px}.card-header{padding:var(--le-card-padding);padding-bottom:0}.card-header:empty{display:none}.card-content{padding:var(--le-card-padding)}.card-footer{padding:var(--le-card-padding);padding-top:0}.card-footer:empty{display:none}";
|
|
5
|
+
|
|
6
|
+
const LeCard$1 = /*@__PURE__*/ proxyCustomElement(class LeCard extends HTMLElement {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
}
|
|
14
|
+
get el() { return this; }
|
|
15
|
+
/**
|
|
16
|
+
* Card variant style
|
|
17
|
+
* @allowedValues default | outlined | elevated
|
|
18
|
+
*/
|
|
19
|
+
variant = 'default';
|
|
20
|
+
/**
|
|
21
|
+
* Whether the card is interactive (clickable)
|
|
22
|
+
*/
|
|
23
|
+
interactive = false;
|
|
24
|
+
render() {
|
|
25
|
+
return (h(Host, { key: '3eea8bf2727559c412e61cb67590086445364a8d', class: classnames(`variant-${this.variant}`, { 'interactive': this.interactive }) }, h("div", { key: '13e109838a50e72dccef935f0184806368f35f20', class: "card", part: "card" }, h("div", { key: '856ed3092d89ecf0ffb402b5b0adac183fe831da', class: "card-header", part: "header" }, h("slot", { key: '85dc99684912db37f96864fb45b3498e21cb7a29', name: "header" })), h("div", { key: '96b6be225aa5e13aee9fd03ada88c57c8912d563', class: "card-content", part: "content" }, h("slot", { key: 'fea429c02941980955583a7b559cd4edcee8c5fd' })), h("div", { key: 'ce2c6d5cf0652029f82147fa648b8c8526a15849', class: "card-footer", part: "footer" }, h("slot", { key: 'b81414ec7ae1068c449e7a3f738314e8c8725a14', name: "footer" })))));
|
|
26
|
+
}
|
|
27
|
+
static get style() { return leCardDefaultCss; }
|
|
28
|
+
}, [769, "le-card", {
|
|
29
|
+
"variant": [1],
|
|
30
|
+
"interactive": [4]
|
|
31
|
+
}]);
|
|
32
|
+
function defineCustomElement$1() {
|
|
33
|
+
if (typeof customElements === "undefined") {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const components = ["le-card"];
|
|
37
|
+
components.forEach(tagName => { switch (tagName) {
|
|
38
|
+
case "le-card":
|
|
39
|
+
if (!customElements.get(tagName)) {
|
|
40
|
+
customElements.define(tagName, LeCard$1);
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
} });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const LeCard = LeCard$1;
|
|
47
|
+
const defineCustomElement = defineCustomElement$1;
|
|
48
|
+
|
|
49
|
+
export { LeCard, defineCustomElement };
|
|
50
|
+
//# sourceMappingURL=le-card.js.map
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=le-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"le-card.js","mappings":";;;AAAA,MAAM,gBAAgB,GAAG,stCAAstC;;MCgCluCA,QAAM,iBAAAC,kBAAA,CAAA,MAAA,MAAA,SAAA,WAAA,CAAA;;;;;;;;;AAGjB;;;AAGG;IACK,OAAO,GAAwC,SAAS;AAEhE;;AAEG;IACK,WAAW,GAAY,KAAK;IAEpC,MAAM,GAAA;AACJ,QAAA,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAE,KAAK,EAAE,UAAU,CAAC,WAAW,IAAI,CAAC,OAAO,CAAA,CAAE,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,EAAA,EACtF,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAA,EAC3B,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,EAAA,EAElC,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,QAAQ,EAAA,CAAQ,CAEzB,EAEN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,cAAc,EAAC,IAAI,EAAC,SAAS,EAAA,EAEpC,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CAEX,EAEN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,EAAA,EAElC,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,QAAQ,EAAA,CAAQ,CAEzB,CACF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["LeCard","__stencil_proxyCustomElement"],"sources":["src-core/components/le-card/le-card.default.css?tag=le-card&encapsulation=shadow","src-core/components/le-card/le-card.tsx"],"sourcesContent":["/**\n * Default mode styles for le-card\n * Uses global design tokens with component-specific overrides\n */\n:host {\n display: block;\n \n /* Component-specific tokens that map to global tokens */\n --le-card-bg: var(--le-color-surface);\n --le-card-border-radius: var(--le-radius-lg);\n --le-card-shadow: var(--le-shadow-md);\n --le-card-shadow-elevated: var(--le-shadow-lg);\n --le-card-shadow-hover: var(--le-shadow-xl);\n --le-card-padding: var(--le-space-md);\n --le-card-border-color: var(--le-color-border);\n --le-card-transition: var(--le-transition-normal);\n}\n\n.card {\n background: var(--le-card-bg);\n border-radius: var(--le-card-border-radius);\n overflow: hidden;\n color: var(--le-color-text);\n box-shadow: var(--le-card-shadow);\n}\n\n/* Variants - le-component gets the hostClass, so we use :host */\n:host(.variant-outlined) .card {\n border: 1px solid var(--le-card-border-color);\n box-shadow: none;\n}\n\n:host(.variant-elevated) .card {\n box-shadow: var(--le-card-shadow-elevated);\n}\n\n/* Interactive state */\n:host(.interactive) .card {\n cursor: pointer;\n transition: transform var(--le-card-transition), box-shadow var(--le-card-transition);\n}\n\n:host(.interactive) .card:hover {\n transform: translateY(-2px);\n box-shadow: var(--le-card-shadow-hover);\n}\n\n:host(.interactive) .card:focus-visible {\n outline: 2px solid var(--le-color-border-focus);\n outline-offset: 2px;\n}\n\n/* Sections */\n.card-header {\n padding: var(--le-card-padding);\n padding-bottom: 0;\n}\n\n.card-header:empty {\n display: none;\n}\n\n.card-content {\n padding: var(--le-card-padding);\n}\n\n.card-footer {\n padding: var(--le-card-padding);\n padding-top: 0;\n}\n\n.card-footer:empty {\n display: none;\n}\n","import { Component, Prop, h, Element , Host } from '@stencil/core';\nimport { classnames } from '../../utils/utils';\n\n/**\n * A flexible card component with header, content, and footer slots.\n *\n * The card uses le-slot wrappers for each slot area. In admin mode,\n * le-slot shows placeholders for CMS editing. In default mode,\n * le-slot acts as a transparent passthrough.\n *\n * @slot header - Card header content (title, actions)\n * @slot - Default slot for main card content\n * @slot footer - Card footer content (buttons, links)\n *\n * @cssprop --le-card-bg - Card background color\n * @cssprop --le-card-border-radius - Card border radius\n * @cssprop --le-card-shadow - Card box shadow\n * @cssprop --le-card-padding - Card content padding\n *\n * @csspart card - The main card container\n * @csspart header - The card header section\n * @csspart content - The card content section\n * @csspart footer - The card footer section\n *\n * @cmsEditable true\n * @cmsCategory Layout\n */\n@Component({\n tag: 'le-card',\n styleUrl: 'le-card.default.css',\n shadow: true,\n})\nexport class LeCard {\n @Element() el: HTMLElement;\n\n /**\n * Card variant style\n * @allowedValues default | outlined | elevated\n */\n @Prop() variant: 'default' | 'outlined' | 'elevated' = 'default';\n\n /**\n * Whether the card is interactive (clickable)\n */\n @Prop() interactive: boolean = false;\n\n render() {\n return (\n <Host class={classnames(`variant-${this.variant}`, { 'interactive': this.interactive })}>\n <div class=\"card\" part=\"card\">\n <div class=\"card-header\" part=\"header\">\n \n <slot name=\"header\"></slot>\n \n </div>\n\n <div class=\"card-content\" part=\"content\">\n \n <slot></slot>\n \n </div>\n\n <div class=\"card-footer\" part=\"footer\">\n \n <slot name=\"footer\"></slot>\n \n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface LeCheckbox extends Components.LeCheckbox, HTMLElement {}
|
|
4
|
+
export const LeCheckbox: {
|
|
5
|
+
prototype: LeCheckbox;
|
|
6
|
+
new (): LeCheckbox;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { h as classnames } from './utils.js';
|
|
3
|
+
|
|
4
|
+
const leCheckboxCss = ":host{display:block;--le-checkbox-size:18px;--le-checkbox-color:var(--le-color-primary, #007bff);--le-checkbox-label-color:var(--le-color-text-primary, #333);--le-checkbox-desc-color:var(--le-color-text-secondary, #666);--le-checkbox-border-radius:var(--le-radius-sm, 2px);--le-checkbox-marker-color:var(--le-color-surface, #fff)}.le-checkbox-wrapper{display:flex;flex-direction:column;gap:4px}.le-checkbox-label{display:inline-flex;align-items:flex-start;gap:8px;cursor:pointer;user-select:none}:host([disabled]) .le-checkbox-label{cursor:not-allowed;opacity:0.6}.le-checkbox-input{display:flex;align-items:center;justify-content:center;min-height:1.4em}input[type=\"checkbox\"]{appearance:none;-webkit-appearance:none;width:var(--le-checkbox-size);height:var(--le-checkbox-size);border:var(--le-border-width, 2px) solid var(--le-checkbox-color);border-radius:var(--le-checkbox-border-radius);margin:0;margin-top:2px;position:relative;cursor:inherit;background-color:transparent;transition:background-color 0.2s, border-color 0.2s}input[type=\"checkbox\"]:checked{background-color:var(--le-checkbox-color)}input[type=\"checkbox\"]:checked::after{content:'';position:absolute;left:0;top:0;bottom:calc(var(--le-checkbox-size) / 5);right:0;margin:auto;width:calc(var(--le-checkbox-size) / 4);height:calc(var(--le-checkbox-size) / 2);border:solid var(--le-checkbox-marker-color, #fff);border-width:0 calc(var(--le-checkbox-size) / 10) calc(var(--le-checkbox-size) / 10) 0;transform:rotate(45deg)}input[type=\"checkbox\"]:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.le-checkbox-text{flex:1;flex-wrap:wrap;color:var(--le-checkbox-label-color);line-height:1.5;text-align:start}.le-checkbox-description{margin-left:calc(var(--le-checkbox-size) + 8px);font-size:0.875em;color:var(--le-checkbox-desc-color);line-height:1.4}:host [slot=\"description\"]{margin:0}";
|
|
5
|
+
|
|
6
|
+
const LeCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class LeCheckbox extends HTMLElement {
|
|
7
|
+
constructor(registerHost) {
|
|
8
|
+
super();
|
|
9
|
+
if (registerHost !== false) {
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
}
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.leChange = createEvent(this, "change", 7);
|
|
14
|
+
}
|
|
15
|
+
get el() { return this; }
|
|
16
|
+
/**
|
|
17
|
+
* Whether the checkbox is checked
|
|
18
|
+
*/
|
|
19
|
+
checked = false;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the checkbox is disabled
|
|
22
|
+
*/
|
|
23
|
+
disabled = false;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the checkbox input
|
|
26
|
+
*/
|
|
27
|
+
name;
|
|
28
|
+
/**
|
|
29
|
+
* The value of the checkbox input
|
|
30
|
+
*/
|
|
31
|
+
value;
|
|
32
|
+
/**
|
|
33
|
+
* External ID for linking with external systems (e.g. database ID, PDF form field ID)
|
|
34
|
+
*/
|
|
35
|
+
externalId;
|
|
36
|
+
/**
|
|
37
|
+
* Emitted when the checked state changes
|
|
38
|
+
*/
|
|
39
|
+
leChange;
|
|
40
|
+
handleChange = (event) => {
|
|
41
|
+
// We stop the internal button click from bubbling up
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
if (this.disabled) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const input = event.target;
|
|
48
|
+
this.checked = input.checked;
|
|
49
|
+
this.leChange.emit({
|
|
50
|
+
checked: this.checked,
|
|
51
|
+
value: this.value,
|
|
52
|
+
name: this.name,
|
|
53
|
+
externalId: this.externalId
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
render() {
|
|
57
|
+
return (h(Host, { key: '51009836a51d0474ccb9a9f8192d2b6f02c81b68', class: classnames({ 'disabled': this.disabled }) }, h("div", { key: '2559adc5e05ca65b48d6686a016d011e85268d18', class: "le-checkbox-wrapper" }, h("label", { key: '1605a81e24c251593f779495830be1091944afcd', class: "le-checkbox-label" }, h("span", { key: 'ba8a7a115e2eba8dec24e818cfe1cdc2bea1d748', class: "le-checkbox-input" }, h("input", { key: '06f195130cee73bbd2bc9fcd508ad5d7792d00f9', type: "checkbox", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, onChange: this.handleChange })), h("span", { key: '1ff6235108db9536573eac7284e0841ad6581bda', class: "le-checkbox-text" }, h("slot", { key: 'fe0a5d531d235b66e085dc61435dc48b30c4d997' }))), h("div", { key: 'e6f593f35dc260a948cabeed6d1f2f8d3f55616d', class: "le-checkbox-description" }, h("slot", { key: 'ea38acd9443d10c0da2159048964cb4c814acbaa', name: "description" })))));
|
|
58
|
+
}
|
|
59
|
+
static get style() { return leCheckboxCss; }
|
|
60
|
+
}, [769, "le-checkbox", {
|
|
61
|
+
"checked": [1540],
|
|
62
|
+
"disabled": [4],
|
|
63
|
+
"name": [1],
|
|
64
|
+
"value": [1],
|
|
65
|
+
"externalId": [1, "external-id"]
|
|
66
|
+
}]);
|
|
67
|
+
function defineCustomElement$1() {
|
|
68
|
+
if (typeof customElements === "undefined") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const components = ["le-checkbox"];
|
|
72
|
+
components.forEach(tagName => { switch (tagName) {
|
|
73
|
+
case "le-checkbox":
|
|
74
|
+
if (!customElements.get(tagName)) {
|
|
75
|
+
customElements.define(tagName, LeCheckbox$1);
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
} });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const LeCheckbox = LeCheckbox$1;
|
|
82
|
+
const defineCustomElement = defineCustomElement$1;
|
|
83
|
+
|
|
84
|
+
export { LeCheckbox, defineCustomElement };
|
|
85
|
+
//# sourceMappingURL=le-checkbox.js.map
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=le-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"le-checkbox.js","mappings":";;;AAAA,MAAM,aAAa,GAAG,41DAA41D;;MCmBr2DA,YAAU,iBAAAC,kBAAA,CAAA,MAAA,UAAA,SAAA,WAAA,CAAA;;;;;;;;;;AAGrB;;AAEG;IACqC,OAAO,GAAY,KAAK;AAEhE;;AAEG;IACK,QAAQ,GAAY,KAAK;AAEjC;;AAEG;AACK,IAAA,IAAI;AAEZ;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,UAAU;AAElB;;AAEG;AAC6B,IAAA,QAAQ;AAEhC,IAAA,YAA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AAK,EAAC,kBAAkB,EAAA,EAE1B,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CAEV,CACD,EAER,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,yBAAyB,EAAA,EAEhC,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,aAAa,EAAA,CAAQ,CAE9B,CACF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["LeCheckbox","__stencil_proxyCustomElement"],"sources":["src-core/components/le-checkbox/le-checkbox.css?tag=le-checkbox&encapsulation=shadow","src-core/components/le-checkbox/le-checkbox.tsx"],"sourcesContent":[":host {\n display: block;\n --le-checkbox-size: 18px;\n --le-checkbox-color: var(--le-color-primary, #007bff);\n --le-checkbox-label-color: var(--le-color-text-primary, #333);\n --le-checkbox-desc-color: var(--le-color-text-secondary, #666);\n --le-checkbox-border-radius: var(--le-radius-sm, 2px);\n --le-checkbox-marker-color: var(--le-color-surface, #fff);\n}\n\n.le-checkbox-wrapper {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.le-checkbox-label {\n display: inline-flex;\n align-items: flex-start;\n gap: 8px;\n cursor: pointer;\n user-select: none;\n}\n\n:host([disabled]) .le-checkbox-label {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.le-checkbox-input {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 1.4em;\n}\n\ninput[type=\"checkbox\"] {\n appearance: none;\n -webkit-appearance: none;\n width: var(--le-checkbox-size);\n height: var(--le-checkbox-size);\n border: var(--le-border-width, 2px) solid var(--le-checkbox-color);\n border-radius: var(--le-checkbox-border-radius);\n margin: 0;\n margin-top: 2px; /* Align with text */\n position: relative;\n cursor: inherit;\n background-color: transparent;\n transition: background-color 0.2s, border-color 0.2s;\n}\n\ninput[type=\"checkbox\"]:checked {\n background-color: var(--le-checkbox-color);\n}\n\ninput[type=\"checkbox\"]:checked::after {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: calc(var(--le-checkbox-size) / 5);\n right: 0;\n margin: auto;\n width: calc(var(--le-checkbox-size) / 4);\n height: calc(var(--le-checkbox-size) / 2);\n border: solid var(--le-checkbox-marker-color, #fff);\n border-width: 0 calc(var(--le-checkbox-size) / 10) calc(var(--le-checkbox-size) / 10) 0;\n transform: rotate(45deg);\n}\n\ninput[type=\"checkbox\"]:focus-visible {\n outline: 2px solid var(--le-color-focus);\n outline-offset: 2px;\n}\n\n.le-checkbox-text {\n flex: 1;\n flex-wrap: wrap;\n color: var(--le-checkbox-label-color);\n line-height: 1.5;\n text-align: start;\n}\n\n.le-checkbox-description {\n margin-left: calc(var(--le-checkbox-size) + 8px);\n font-size: 0.875em;\n color: var(--le-checkbox-desc-color);\n line-height: 1.4;\n}\n\n:host [slot=\"description\"] {\n margin: 0;\n}\n","import { Component, Prop, Event, EventEmitter, h, Element , Host } from '@stencil/core';\nimport { classnames } from '../../utils/utils';\n\n/**\n * A checkbox component with support for labels, descriptions, and external IDs.\n *\n * @slot - The label text for the checkbox\n * @slot description - Additional description text displayed below the label\n *\n * @cssprop --le-checkbox-size - Size of the checkbox input\n * @cssprop --le-checkbox-color - Color of the checkbox when checked\n * @cssprop --le-checkbox-label-color - Color of the label text\n * @cssprop --le-checkbox-desc-color - Color of the description text\n */\n@Component({\n tag: 'le-checkbox',\n styleUrl: 'le-checkbox.css',\n shadow: true,\n})\nexport class LeCheckbox {\n @Element() el: HTMLElement;\n\n /**\n * Whether the checkbox is checked\n */\n @Prop({ mutable: true, reflect: true }) checked: boolean = false;\n\n /**\n * Whether the checkbox is disabled\n */\n @Prop() disabled: boolean = false;\n\n /**\n * The name of the checkbox input\n */\n @Prop() name: string;\n\n /**\n * The value of the checkbox input\n */\n @Prop() value: string;\n\n /**\n * External ID for linking with external systems (e.g. database ID, PDF form field ID)\n */\n @Prop() externalId: string;\n\n /**\n * Emitted when the checked state changes\n */\n @Event({ eventName: 'change' }) leChange: EventEmitter<{ checked: boolean; value: string; name: string; externalId: string }>;\n\n private handleChange = (event: Event) => {\n // We stop the internal button click from bubbling up\n event.stopPropagation();\n\n if (this.disabled) {\n event.preventDefault();\n return;\n }\n\n const input = event.target as HTMLInputElement;\n this.checked = input.checked;\n this.leChange.emit({\n checked: this.checked,\n value: this.value,\n name: this.name,\n externalId: this.externalId\n });\n };\n\n render() {\n return (\n <Host class={classnames({ 'disabled': this.disabled })}>\n <div class=\"le-checkbox-wrapper\">\n <label class=\"le-checkbox-label\">\n <span class=\"le-checkbox-input\">\n <input\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n disabled={this.disabled}\n onChange={this.handleChange}\n />\n </span>\n <span class=\"le-checkbox-text\">\n \n <slot></slot>\n \n </span>\n </label>\n \n <div class=\"le-checkbox-description\">\n \n <slot name=\"description\"></slot>\n \n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface LeNumberInput extends Components.LeNumberInput, HTMLElement {}
|
|
4
|
+
export const LeNumberInput: {
|
|
5
|
+
prototype: LeNumberInput;
|
|
6
|
+
new (): LeNumberInput;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { h as classnames } from './utils.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './le-button2.js';
|
|
4
|
+
|
|
5
|
+
const leNumberInputCss = ":host{display:block;--le-input-bg:var(--le-color-surface, #ffffff);--le-input-color:var(--le-color-text-primary, #333333);--le-input-border:var(--le-border-width, 2px) solid var(--le-color-border-input, #007bff);--le-input-radius:var(--le-radius-sm, 4px);--le-input-padding:2px 6px;--le-input-height:1.5rem;--le-input-label-color:var(--le-color-text-primary, #333333);--le-input-desc-color:var(--le-color-text-secondary, #666666);--le-input-placeholder-color:#999999;--le-input-border-error:2px solid var(--le-color-danger, #dc3545);--le-input-error-color:var(--le-color-danger, #dc3545)}.le-input-wrapper{display:flex;flex-direction:column;gap:2px}.le-input-label{display:block;font-size:0.9em;font-weight:500;color:var(--le-input-label-color);margin-bottom:2px}.le-input-container{position:relative;display:flex;align-items:center;background:var(--le-input-bg);border:var(--le-input-border);border-radius:var(--le-input-radius);transition:border-color 0.2s}.le-input-container:focus-within{outline:2px solid var(--le-color-focus);outline-offset:2px}.le-input-container.has-error{border:var(--le-input-border-error)}:host([disabled]) .le-input-container{opacity:0.6;background-color:rgba(0,0,0,0.05);cursor:not-allowed}input{flex:1;width:100%;height:calc(var(--le-input-height) - 2px);padding:var(--le-input-padding);border:none;background:transparent;color:var(--le-input-color);font-family:inherit;font-size:inherit;outline:none;text-align:right;-moz-appearance:textfield;}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input::placeholder{color:var(--le-input-placeholder-color)}.icon-start,.icon-end{display:flex;align-items:center;justify-content:center;padding:0 8px;color:var(--le-input-desc-color)}.le-input-controls{display:flex;flex-direction:column;border-left:1px solid var(--le-color-border, #cccccc);height:100%}.le-input-control-btn{--le-button-border-radius:0;--le-button-padding-x:0;--le-button-padding-y:0;--le-button-small-font-size:9.5px;--le-button-small-padding:0 0.2rem;--le-button-icon-aspect-ratio:2;display:flex;align-items:center;justify-content:center;height:50%;cursor:pointer;background:none;border:none;color:var(--le-input-desc-color);font-size:10px;line-height:1}.le-input-control-btn:hover{background-color:rgba(0,0,0,0.05);color:var(--le-color-primary, #007bff)}.le-input-control-btn:active{background-color:rgba(0,0,0,0.1)}.le-input-description{font-size:0.85em;color:var(--le-input-desc-color);margin-top:2px}.le-input-error{font-size:0.85em;color:var(--le-input-error-color);margin-top:2px}";
|
|
6
|
+
|
|
7
|
+
const LeNumberInput$1 = /*@__PURE__*/ proxyCustomElement(class LeNumberInput extends HTMLElement {
|
|
8
|
+
constructor(registerHost) {
|
|
9
|
+
super();
|
|
10
|
+
if (registerHost !== false) {
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
}
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.leChange = createEvent(this, "leChange", 7);
|
|
15
|
+
this.leInput = createEvent(this, "leInput", 7);
|
|
16
|
+
}
|
|
17
|
+
get el() { return this; }
|
|
18
|
+
/**
|
|
19
|
+
* The value of the input
|
|
20
|
+
*/
|
|
21
|
+
value;
|
|
22
|
+
/**
|
|
23
|
+
* The name of the input
|
|
24
|
+
*/
|
|
25
|
+
name;
|
|
26
|
+
/**
|
|
27
|
+
* Label for the input
|
|
28
|
+
*/
|
|
29
|
+
label;
|
|
30
|
+
/**
|
|
31
|
+
* Placeholder text
|
|
32
|
+
*/
|
|
33
|
+
placeholder;
|
|
34
|
+
/**
|
|
35
|
+
* Minimum allowed value
|
|
36
|
+
*/
|
|
37
|
+
min;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum allowed value
|
|
40
|
+
*/
|
|
41
|
+
max;
|
|
42
|
+
/**
|
|
43
|
+
* Step value for increment/decrement
|
|
44
|
+
*/
|
|
45
|
+
step = 1;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the input is required
|
|
48
|
+
*/
|
|
49
|
+
required = false;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is disabled
|
|
52
|
+
*/
|
|
53
|
+
disabled = false;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the input is read-only
|
|
56
|
+
*/
|
|
57
|
+
readonly = false;
|
|
58
|
+
/**
|
|
59
|
+
* Icon for the start icon
|
|
60
|
+
*/
|
|
61
|
+
iconStart;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to show the spinner controls
|
|
64
|
+
*/
|
|
65
|
+
showSpinners = true;
|
|
66
|
+
/**
|
|
67
|
+
* External ID for linking with external systems
|
|
68
|
+
*/
|
|
69
|
+
externalId;
|
|
70
|
+
/**
|
|
71
|
+
* Internal validation state
|
|
72
|
+
*/
|
|
73
|
+
isValid = true;
|
|
74
|
+
validationMessage = '';
|
|
75
|
+
/**
|
|
76
|
+
* Emitted when the value changes (on blur or Enter)
|
|
77
|
+
*/
|
|
78
|
+
leChange;
|
|
79
|
+
/**
|
|
80
|
+
* Emitted when the input value changes (on keystroke/spin)
|
|
81
|
+
*/
|
|
82
|
+
leInput;
|
|
83
|
+
valueChanged() {
|
|
84
|
+
this.validate();
|
|
85
|
+
}
|
|
86
|
+
validate() {
|
|
87
|
+
if (this.required && (this.value === undefined || this.value === null || isNaN(this.value))) {
|
|
88
|
+
this.isValid = false;
|
|
89
|
+
this.validationMessage = 'This field is required';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (this.value !== undefined && this.value !== null && !isNaN(this.value)) {
|
|
93
|
+
if (this.min !== undefined && this.value < this.min) {
|
|
94
|
+
this.isValid = false;
|
|
95
|
+
this.validationMessage = `Value must be at least ${this.min}`;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (this.max !== undefined && this.value > this.max) {
|
|
99
|
+
this.isValid = false;
|
|
100
|
+
this.validationMessage = `Value must be at most ${this.max}`;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.isValid = true;
|
|
105
|
+
this.validationMessage = '';
|
|
106
|
+
}
|
|
107
|
+
emitChange() {
|
|
108
|
+
this.leChange.emit({
|
|
109
|
+
value: this.value,
|
|
110
|
+
name: this.name,
|
|
111
|
+
externalId: this.externalId,
|
|
112
|
+
isValid: this.isValid
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
emitInput() {
|
|
116
|
+
this.leInput.emit({
|
|
117
|
+
value: this.value,
|
|
118
|
+
name: this.name,
|
|
119
|
+
externalId: this.externalId,
|
|
120
|
+
isValid: this.isValid
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
updateValue(newValue) {
|
|
124
|
+
if (this.disabled || this.readonly)
|
|
125
|
+
return;
|
|
126
|
+
// Round to avoid floating point errors
|
|
127
|
+
const precision = this.step.toString().split('.')[1]?.length || 0;
|
|
128
|
+
const rounded = parseFloat(newValue.toFixed(precision));
|
|
129
|
+
this.value = rounded;
|
|
130
|
+
this.validate();
|
|
131
|
+
this.emitInput();
|
|
132
|
+
}
|
|
133
|
+
handleInput = (ev) => {
|
|
134
|
+
const input = ev.target;
|
|
135
|
+
const val = parseFloat(input.value);
|
|
136
|
+
if (input.value === '') {
|
|
137
|
+
this.value = undefined;
|
|
138
|
+
}
|
|
139
|
+
else if (!isNaN(val)) {
|
|
140
|
+
this.value = val;
|
|
141
|
+
}
|
|
142
|
+
this.validate();
|
|
143
|
+
this.emitInput();
|
|
144
|
+
};
|
|
145
|
+
handleChange = () => {
|
|
146
|
+
this.validate();
|
|
147
|
+
this.emitChange();
|
|
148
|
+
};
|
|
149
|
+
handleKeyDown = (ev) => {
|
|
150
|
+
if (this.disabled || this.readonly)
|
|
151
|
+
return;
|
|
152
|
+
let multiplier = 1;
|
|
153
|
+
if (ev.shiftKey)
|
|
154
|
+
multiplier = 10;
|
|
155
|
+
if (ev.altKey)
|
|
156
|
+
multiplier = 0.1;
|
|
157
|
+
const current = this.value || 0;
|
|
158
|
+
if (ev.key === 'ArrowUp') {
|
|
159
|
+
ev.preventDefault();
|
|
160
|
+
this.updateValue(current + (this.step * multiplier));
|
|
161
|
+
}
|
|
162
|
+
else if (ev.key === 'ArrowDown') {
|
|
163
|
+
ev.preventDefault();
|
|
164
|
+
this.updateValue(current - (this.step * multiplier));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
handleWheel = (ev) => {
|
|
168
|
+
if (this.disabled || this.readonly)
|
|
169
|
+
return;
|
|
170
|
+
// Only handle if input is focused to prevent accidental scrolling
|
|
171
|
+
if (document.activeElement !== ev.target)
|
|
172
|
+
return;
|
|
173
|
+
ev.preventDefault();
|
|
174
|
+
const current = this.value || 0;
|
|
175
|
+
if (ev.deltaY < 0) {
|
|
176
|
+
this.updateValue(current + this.step);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.updateValue(current - this.step);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
increment = (ev) => {
|
|
183
|
+
ev.preventDefault(); // Prevent focus loss
|
|
184
|
+
const current = this.value || 0;
|
|
185
|
+
this.updateValue(current + this.step);
|
|
186
|
+
// Trigger change event for buttons as they are "final" actions usually
|
|
187
|
+
this.emitChange();
|
|
188
|
+
};
|
|
189
|
+
decrement = (ev) => {
|
|
190
|
+
ev.preventDefault();
|
|
191
|
+
const current = this.value || 0;
|
|
192
|
+
this.updateValue(current - this.step);
|
|
193
|
+
this.emitChange();
|
|
194
|
+
};
|
|
195
|
+
render() {
|
|
196
|
+
return (h(Host, { key: '4b23af3dffd76a17c89f028447bb85c7cf12e3df', class: classnames({ 'disabled': this.disabled }) }, h("div", { key: '750438149c519f06672bed9d57f1f9830db79d11', class: "le-input-wrapper" }, this.label && (h("label", { key: '6e5f1dc4cd9211def05593635a3d798684aee52e', class: "le-input-label", htmlFor: this.name }, this.label)), h("div", { key: 'a3a39d3ae3c0da57927b06b0293ca5852d4f2b60', class: classnames('le-input-container', { 'has-error': !this.isValid }) }, this.iconStart && (h("span", { key: 'be1c9e1cb4061e6ca8e13796dfb536a7e436a688', class: "icon-start" }, this.iconStart)), h("input", { key: 'e59624c3a2360595b75577e2d9b04933300f4d3d', id: this.name, type: "number", name: this.name, placeholder: this.placeholder, min: this.min, max: this.max, step: this.step, value: this.value, disabled: this.disabled, readOnly: this.readonly, required: this.required, onInput: this.handleInput, onChange: this.handleChange, onKeyDown: this.handleKeyDown, onWheel: this.handleWheel }), this.showSpinners && (h("div", { key: 'ac84077c3444da1414ba06e8b797f60766edd3db', class: "le-input-controls" }, h("le-button", { key: 'c452141f07a3a4f3090374df10896fca036f4a01', mode: "default", variant: "clear", size: "small", "icon-only": true, class: "le-input-control-btn", onClick: this.increment, disabled: this.disabled || this.readonly || (this.max !== undefined && this.value >= this.max), tabindex: "-1" }, h("span", { key: '489960a26e655f3852b4d26f1660d7c8411cc896', slot: "icon-only" }, "\u2191")), h("le-button", { key: 'd3662170c7718c9d51a0089362faf70b62715aa8', mode: "default", variant: "clear", size: "small", "icon-only": true, class: "le-input-control-btn", onClick: this.decrement, disabled: this.disabled || this.readonly || (this.min !== undefined && this.value <= this.min), tabindex: "-1" }, h("span", { key: '48e035cece04f248137925af42d0728010e4ac78', slot: "icon-only" }, "\u2193"))))), !this.isValid && h("div", { key: 'd439b3c235fd3f8fb127eaed292f49e6382d0d6e', class: "le-input-error" }, this.validationMessage), h("div", { key: 'e27428a5e033617af04c656cbf5d5954ab770cec', class: "le-input-description" }, h("slot", { key: 'bab0f00e77f7241d63ffb694f4905b8cf82e5513', name: "description" })))));
|
|
197
|
+
}
|
|
198
|
+
static get watchers() { return {
|
|
199
|
+
"value": ["valueChanged"]
|
|
200
|
+
}; }
|
|
201
|
+
static get style() { return leNumberInputCss; }
|
|
202
|
+
}, [769, "le-number-input", {
|
|
203
|
+
"value": [1538],
|
|
204
|
+
"name": [1],
|
|
205
|
+
"label": [1],
|
|
206
|
+
"placeholder": [1],
|
|
207
|
+
"min": [2],
|
|
208
|
+
"max": [2],
|
|
209
|
+
"step": [2],
|
|
210
|
+
"required": [4],
|
|
211
|
+
"disabled": [4],
|
|
212
|
+
"readonly": [4],
|
|
213
|
+
"iconStart": [1, "icon-start"],
|
|
214
|
+
"showSpinners": [4, "show-spinners"],
|
|
215
|
+
"externalId": [1, "external-id"],
|
|
216
|
+
"isValid": [32],
|
|
217
|
+
"validationMessage": [32]
|
|
218
|
+
}, undefined, {
|
|
219
|
+
"value": ["valueChanged"]
|
|
220
|
+
}]);
|
|
221
|
+
function defineCustomElement$1() {
|
|
222
|
+
if (typeof customElements === "undefined") {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const components = ["le-number-input", "le-button"];
|
|
226
|
+
components.forEach(tagName => { switch (tagName) {
|
|
227
|
+
case "le-number-input":
|
|
228
|
+
if (!customElements.get(tagName)) {
|
|
229
|
+
customElements.define(tagName, LeNumberInput$1);
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
case "le-button":
|
|
233
|
+
if (!customElements.get(tagName)) {
|
|
234
|
+
defineCustomElement$2();
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
} });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const LeNumberInput = LeNumberInput$1;
|
|
241
|
+
const defineCustomElement = defineCustomElement$1;
|
|
242
|
+
|
|
243
|
+
export { LeNumberInput, defineCustomElement };
|
|
244
|
+
//# sourceMappingURL=le-number-input.js.map
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=le-number-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"le-number-input.js","mappings":";;;;AAAA,MAAM,gBAAgB,GAAG,shFAAshF;;MCuBliFA,eAAa,iBAAAC,kBAAA,CAAA,MAAA,aAAA,SAAA,WAAA,CAAA;;;;;;;;;;;AAGxB;;AAEG;AACqC,IAAA,KAAK;AAE7C;;AAEG;AACK,IAAA,IAAI;AAEZ;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,WAAW;AAEnB;;AAEG;AACK,IAAA,GAAG;AAEX;;AAEG;AACK,IAAA,GAAG;AAEX;;AAEG;IACK,IAAI,GAAW,CAAC;AAExB;;AAEG;IACK,QAAQ,GAAY,KAAK;AAEjC;;AAEG;IACK,QAAQ,GAAY,KAAK;AAEjC;;AAEG;IACK,QAAQ,GAAY,KAAK;AAEjC;;AAEG;AACK,IAAA,SAAS;AAEjB;;AAEG;IACK,YAAY,GAAY,IAAI;AAEpC;;AAEG;AACK,IAAA,UAAU;AAElB;;AAEG;IACc,OAAO,GAAY,IAAI;IACvB,iBAAiB,GAAW,EAAE;AA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O,EACf,IAAI,EAAC,OAAO,qBAEZ,KAAK,EAAC,sBAAsB,EAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,EAC9F,QAAQ,EAAC,IAAI,EAAA,EAEb,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,WAAW,aAAS,CACrB,CACR,CACP,CACG,EAEL,CAAC,IAAI,CAAC,OAAO,IAAI,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,gBAAgB,EAAE,EAAA,IAAI,CAAC,iBAAiB,CAAO,EAE5E,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,sBAAsB,EAAA,EAE7B,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,aAAa,EAAA,CAAQ,CAE9B,CACF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["LeNumberInput","__stencil_proxyCustomElement"],"sources":["src-core/components/le-number-input/le-number-input.css?tag=le-number-input&encapsulation=shadow","src-core/components/le-number-input/le-number-input.tsx"],"sourcesContent":[":host {\n display: block;\n --le-input-bg: var(--le-color-surface, #ffffff);\n --le-input-color: var(--le-color-text-primary, #333333);\n --le-input-border: var(--le-border-width, 2px) solid var(--le-color-border-input, #007bff);\n --le-input-radius: var(--le-radius-sm, 4px);\n --le-input-padding: 2px 6px;\n --le-input-height: 1.5rem;\n --le-input-label-color: var(--le-color-text-primary, #333333);\n --le-input-desc-color: var(--le-color-text-secondary, #666666);\n --le-input-placeholder-color: #999999;\n --le-input-border-error: 2px solid var(--le-color-danger, #dc3545);\n --le-input-error-color: var(--le-color-danger, #dc3545);\n}\n\n.le-input-wrapper {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.le-input-label {\n display: block;\n font-size: 0.9em;\n font-weight: 500;\n color: var(--le-input-label-color);\n margin-bottom: 2px;\n}\n\n.le-input-container {\n position: relative;\n display: flex;\n align-items: center;\n background: var(--le-input-bg);\n border: var(--le-input-border);\n border-radius: var(--le-input-radius);\n transition: border-color 0.2s;\n}\n\n.le-input-container:focus-within {\n outline: 2px solid var(--le-color-focus);\n outline-offset: 2px;\n}\n\n.le-input-container.has-error {\n border: var(--le-input-border-error);\n}\n\n:host([disabled]) .le-input-container {\n opacity: 0.6;\n background-color: rgba(0,0,0,0.05);\n cursor: not-allowed;\n}\n\ninput {\n flex: 1;\n width: 100%;\n height: calc(var(--le-input-height) - 2px);\n padding: var(--le-input-padding);\n border: none;\n background: transparent;\n color: var(--le-input-color);\n font-family: inherit;\n font-size: inherit;\n outline: none;\n text-align: right; /* Aligned to end */\n -moz-appearance: textfield; /* Remove default spinners in Firefox */\n}\n\n/* Remove default spinners in Chrome/Safari/Edge */\ninput::-webkit-outer-spin-button,\ninput::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput::placeholder {\n color: var(--le-input-placeholder-color);\n}\n\n.icon-start, .icon-end {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 8px;\n color: var(--le-input-desc-color);\n}\n\n.le-input-controls {\n display: flex;\n flex-direction: column;\n border-left: 1px solid var(--le-color-border, #cccccc);\n height: 100%;\n}\n\n.le-input-control-btn {\n --le-button-border-radius: 0;\n --le-button-padding-x: 0;\n --le-button-padding-y: 0;\n --le-button-small-font-size: 9.5px;\n --le-button-small-padding: 0 0.2rem;\n --le-button-icon-aspect-ratio: 2;\n\n display: flex;\n align-items: center;\n justify-content: center;\n height: 50%;\n cursor: pointer;\n background: none;\n border: none;\n color: var(--le-input-desc-color);\n font-size: 10px;\n line-height: 1;\n}\n\n.le-input-control-btn:hover {\n background-color: rgba(0,0,0,0.05);\n color: var(--le-color-primary, #007bff);\n}\n\n.le-input-control-btn:active {\n background-color: rgba(0,0,0,0.1);\n}\n\n.le-input-description {\n font-size: 0.85em;\n color: var(--le-input-desc-color);\n margin-top: 2px;\n}\n\n.le-input-error {\n font-size: 0.85em;\n color: var(--le-input-error-color);\n margin-top: 2px;\n}\n","import { Component, Prop, Event, EventEmitter, State, h, Element, Watch , Host } from '@stencil/core';\nimport { classnames } from '../../utils/utils';\n\n/**\n * A number input component with validation, keyboard controls, and custom spinners.\n *\n * @slot - The label text for the input\n * @slot description - Additional description text displayed below the input\n * @slot icon-start - Icon to display at the start of the input\n *\n * @cssprop --le-input-bg - Input background color\n * @cssprop --le-input-color - Input text color\n * @cssprop --le-input-border - Input border style\n * @cssprop --le-input-border-focus - Input border style when focused\n * @cssprop --le-input-border-error - Input border style when invalid\n * @cssprop --le-input-radius - Input border radius\n * @cssprop --le-input-padding - Input padding\n */\n@Component({\n tag: 'le-number-input',\n styleUrl: 'le-number-input.css',\n shadow: true,\n})\nexport class LeNumberInput {\n @Element() el: HTMLElement;\n\n /**\n * The value of the input\n */\n @Prop({ mutable: true, reflect: true }) value: number;\n\n /**\n * The name of the input\n */\n @Prop() name: string;\n\n /**\n * Label for the input\n */\n @Prop() label: string;\n\n /**\n * Placeholder text\n */\n @Prop() placeholder: string;\n\n /**\n * Minimum allowed value\n */\n @Prop() min?: number;\n\n /**\n * Maximum allowed value\n */\n @Prop() max?: number;\n\n /**\n * Step value for increment/decrement\n */\n @Prop() step: number = 1;\n\n /**\n * Whether the input is required\n */\n @Prop() required: boolean = false;\n\n /**\n * Whether the input is disabled\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Whether the input is read-only\n */\n @Prop() readonly: boolean = false;\n\n /**\n * Icon for the start icon\n */\n @Prop() iconStart?: string;\n\n /**\n * Whether to show the spinner controls\n */\n @Prop() showSpinners: boolean = true;\n\n /**\n * External ID for linking with external systems\n */\n @Prop() externalId: string;\n\n /**\n * Internal validation state\n */\n @State() private isValid: boolean = true;\n @State() private validationMessage: string = '';\n\n /**\n * Emitted when the value changes (on blur or Enter)\n */\n @Event() leChange: EventEmitter<{ value: number; name: string; externalId: string; isValid: boolean }>;\n\n /**\n * Emitted when the input value changes (on keystroke/spin)\n */\n @Event() leInput: EventEmitter<{ value: number; name: string; externalId: string; isValid: boolean }>;\n\n @Watch('value')\n valueChanged() {\n this.validate();\n }\n\n private validate() {\n if (this.required && (this.value === undefined || this.value === null || isNaN(this.value))) {\n this.isValid = false;\n this.validationMessage = 'This field is required';\n return;\n }\n\n if (this.value !== undefined && this.value !== null && !isNaN(this.value)) {\n if (this.min !== undefined && this.value < this.min) {\n this.isValid = false;\n this.validationMessage = `Value must be at least ${this.min}`;\n return;\n }\n if (this.max !== undefined && this.value > this.max) {\n this.isValid = false;\n this.validationMessage = `Value must be at most ${this.max}`;\n return;\n }\n }\n\n this.isValid = true;\n this.validationMessage = '';\n }\n\n private emitChange() {\n this.leChange.emit({\n value: this.value,\n name: this.name,\n externalId: this.externalId,\n isValid: this.isValid\n });\n }\n\n private emitInput() {\n this.leInput.emit({\n value: this.value,\n name: this.name,\n externalId: this.externalId,\n isValid: this.isValid\n });\n }\n\n private updateValue(newValue: number) {\n if (this.disabled || this.readonly) return;\n \n // Round to avoid floating point errors\n const precision = this.step.toString().split('.')[1]?.length || 0;\n const rounded = parseFloat(newValue.toFixed(precision));\n \n this.value = rounded;\n this.validate();\n this.emitInput();\n }\n\n private handleInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement;\n const val = parseFloat(input.value);\n \n if (input.value === '') {\n this.value = undefined;\n } else if (!isNaN(val)) {\n this.value = val;\n }\n \n this.validate();\n this.emitInput();\n };\n\n private handleChange = () => {\n this.validate();\n this.emitChange();\n };\n\n private handleKeyDown = (ev: KeyboardEvent) => {\n if (this.disabled || this.readonly) return;\n\n let multiplier = 1;\n if (ev.shiftKey) multiplier = 10;\n if (ev.altKey) multiplier = 0.1;\n\n const current = this.value || 0;\n\n if (ev.key === 'ArrowUp') {\n ev.preventDefault();\n this.updateValue(current + (this.step * multiplier));\n } else if (ev.key === 'ArrowDown') {\n ev.preventDefault();\n this.updateValue(current - (this.step * multiplier));\n }\n };\n\n private handleWheel = (ev: WheelEvent) => {\n if (this.disabled || this.readonly) return;\n // Only handle if input is focused to prevent accidental scrolling\n if (document.activeElement !== ev.target) return;\n\n ev.preventDefault();\n const current = this.value || 0;\n \n if (ev.deltaY < 0) {\n this.updateValue(current + this.step);\n } else {\n this.updateValue(current - this.step);\n }\n };\n\n private increment = (ev: Event) => {\n ev.preventDefault(); // Prevent focus loss\n const current = this.value || 0;\n this.updateValue(current + this.step);\n // Trigger change event for buttons as they are \"final\" actions usually\n this.emitChange();\n };\n\n private decrement = (ev: Event) => {\n ev.preventDefault();\n const current = this.value || 0;\n this.updateValue(current - this.step);\n this.emitChange();\n };\n\n render() {\n return (\n <Host class={classnames({ 'disabled': this.disabled })}>\n <div class=\"le-input-wrapper\">\n {this.label && (\n <label class=\"le-input-label\" htmlFor={this.name}>{this.label}</label>\n )}\n \n <div class={classnames('le-input-container', { 'has-error': !this.isValid })}>\n {this.iconStart && (\n <span class=\"icon-start\">{this.iconStart}</span>\n )}\n \n <input\n id={this.name}\n type=\"number\"\n name={this.name}\n placeholder={this.placeholder}\n min={this.min}\n max={this.max}\n step={this.step}\n value={this.value}\n disabled={this.disabled}\n readOnly={this.readonly}\n required={this.required}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onKeyDown={this.handleKeyDown}\n onWheel={this.handleWheel}\n />\n \n {this.showSpinners && (\n <div class=\"le-input-controls\">\n <le-button\n mode=\"default\"\n variant=\"clear\" \n size=\"small\"\n icon-only\n class=\"le-input-control-btn\" \n onClick={this.increment}\n disabled={this.disabled || this.readonly || (this.max !== undefined && this.value >= this.max)}\n tabindex=\"-1\"\n >\n <span slot=\"icon-only\">↑</span>\n </le-button>\n <le-button\n mode=\"default\"\n variant=\"clear\" \n size=\"small\" \n icon-only \n class=\"le-input-control-btn\" \n onClick={this.decrement}\n disabled={this.disabled || this.readonly || (this.min !== undefined && this.value <= this.min)}\n tabindex=\"-1\"\n >\n <span slot=\"icon-only\">↓</span>\n </le-button>\n </div>\n )}\n </div>\n\n {!this.isValid && <div class=\"le-input-error\">{this.validationMessage}</div>}\n\n <div class=\"le-input-description\">\n \n <slot name=\"description\"></slot>\n \n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface LePopover extends Components.LePopover, HTMLElement {}
|
|
4
|
+
export const LePopover: {
|
|
5
|
+
prototype: LePopover;
|
|
6
|
+
new (): LePopover;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|