ranui 0.2.0-alpha.0 → 0.2.0-alpha.1
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/dist/button-BstLjXNe.js +117 -0
- package/dist/button.js +1 -1
- package/dist/colorpicker-CGh8pRqo.js +315 -0
- package/dist/colorpicker.js +1 -1
- package/dist/components/colorpicker/index.d.ts +11 -0
- package/dist/components/dropdown/index.d.ts +0 -2
- package/dist/components/image/index.d.ts +6 -0
- package/dist/components/input/index.d.ts +13 -20
- package/dist/components/player/core/view.d.ts +0 -1
- package/dist/components/player/index.d.ts +0 -1
- package/dist/components/popover/index.d.ts +0 -2
- package/dist/components/select/index.d.ts +15 -0
- package/dist/{dropdown-C5362qTy.js → dropdown-RqHMRhFE.js} +0 -6
- package/dist/dropdown.js +1 -1
- package/dist/{icon-DmoEnao5.js → icon-Blm7AbyY.js} +2 -0
- package/dist/icon.js +1 -1
- package/dist/{image-6GayFDqX.js → image-DKm6z7YQ.js} +17 -15
- package/dist/image.js +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.iife.js +35 -35
- package/dist/index.js +16 -16
- package/dist/input-Dskw1bAl.js +186 -0
- package/dist/input.js +1 -1
- package/dist/{katex-es-Cnq5Pk8K.cjs → katex-es-BTpuCxxV.cjs} +7 -7
- package/dist/{katex-es-Bpesphgp.js → katex-es-CKRwcaiU.js} +606 -606
- package/dist/{loading-Mko22ncl.js → loading-C4QUpm70.js} +1 -1
- package/dist/loading.js +1 -1
- package/dist/{math-B5PpSnFR.js → math-Dv4nXSoI.js} +1 -1
- package/dist/math.js +1 -1
- package/dist/{message-CQENvkoi.js → message-De5e1txT.js} +1 -1
- package/dist/message.js +1 -1
- package/dist/{player-CvfmwWUa.js → player-CqTAmg_E.js} +636 -638
- package/dist/player.js +1 -1
- package/dist/{popover-BCvHwLZb.js → popover-BY32HNMl.js} +19 -26
- package/dist/popover.js +1 -1
- package/dist/{progress-BWkNf2J5.js → progress-gZo0knzu.js} +11 -11
- package/dist/progress.js +1 -1
- package/dist/{radar-CWsawt2g.js → radar-19P5Mtld.js} +17 -17
- package/dist/radar.js +1 -1
- package/dist/ranui.css +1 -1
- package/dist/{select-BmhCUTLb.js → select-BVdUtQX5.js} +72 -51
- package/dist/select.js +1 -1
- package/dist/{skeleton-DPv9nFhL.js → skeleton-BAdJ6vyA.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/{tab-C9swK-hm.js → tab-DH2owP2V.js} +0 -1
- package/dist/tab.js +1 -1
- package/docs/COMPONENTS.md +10 -12
- package/docs/DESIGN.md +16 -0
- package/package.json +2 -2
- package/dist/button-DukaD6uL.js +0 -117
- package/dist/colorpicker-Ch67dWa_.js +0 -302
- package/dist/input-DoraIb3x.js +0 -198
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { n as r } from "./player-
|
|
1
|
+
import { n as r } from "./player-CqTAmg_E.js";
|
|
2
2
|
import { a, i as e, n as m, o as s, r as i, t as p } from "./utils-D4pPF77E.js";
|
|
3
|
-
import { t as f } from "./button-
|
|
4
|
-
import { n as P, r as T, t as h } from "./icon-
|
|
5
|
-
import { t as R } from "./image-
|
|
6
|
-
import { t as u } from "./input-
|
|
7
|
-
import { t as S } from "./message-
|
|
8
|
-
import { t as I } from "./skeleton-
|
|
3
|
+
import { t as f } from "./button-BstLjXNe.js";
|
|
4
|
+
import { n as P, r as T, t as h } from "./icon-Blm7AbyY.js";
|
|
5
|
+
import { t as R } from "./image-DKm6z7YQ.js";
|
|
6
|
+
import { t as u } from "./input-Dskw1bAl.js";
|
|
7
|
+
import { t as S } from "./message-De5e1txT.js";
|
|
8
|
+
import { t as I } from "./skeleton-BAdJ6vyA.js";
|
|
9
9
|
import { t as M } from "./tabpane-B_M-Jokw.js";
|
|
10
|
-
import { t as b } from "./tab-
|
|
11
|
-
import { t as A } from "./radar-
|
|
10
|
+
import { t as b } from "./tab-DH2owP2V.js";
|
|
11
|
+
import { t as A } from "./radar-19P5Mtld.js";
|
|
12
12
|
import { t as G } from "./modal-DruDj3AB.js";
|
|
13
|
-
import { t as N } from "./select-
|
|
14
|
-
import { n as y, t as O } from "./dropdown-
|
|
15
|
-
import { t as v } from "./math-
|
|
16
|
-
import { t as D } from "./progress-
|
|
13
|
+
import { t as N } from "./select-BVdUtQX5.js";
|
|
14
|
+
import { n as y, t as O } from "./dropdown-RqHMRhFE.js";
|
|
15
|
+
import { t as v } from "./math-Dv4nXSoI.js";
|
|
16
|
+
import { t as D } from "./progress-gZo0knzu.js";
|
|
17
17
|
import { t as V } from "./checkbox-iHZQb-yQ.js";
|
|
18
|
-
import { t as j } from "./colorpicker-
|
|
19
|
-
import { n as z, t as H } from "./popover-
|
|
20
|
-
import { n as K, t as Q } from "./loading-
|
|
18
|
+
import { t as j } from "./colorpicker-CGh8pRqo.js";
|
|
19
|
+
import { n as z, t as H } from "./popover-BY32HNMl.js";
|
|
20
|
+
import { n as K, t as Q } from "./loading-C4QUpm70.js";
|
|
21
21
|
import { t as X } from "./form-05Lxxl3D.js";
|
|
22
22
|
import "./scratch-Dbd9G6Q6.js";
|
|
23
23
|
import { t as oo } from "./card-DQUJoDUQ.js";
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { c as s, d as o, f as i, l, p as r, s as u, u as p } from "./utils-D4pPF77E.js";
|
|
2
|
+
import { t as d } from "./events-C59wGdni.js";
|
|
3
|
+
import { _ as c, c as h, i as a, s as b } from "./factory-BdsO0dEW.js";
|
|
4
|
+
import { a as v, n as g } from "./ssr-DSGwPtEd.js";
|
|
5
|
+
import "./icon-Blm7AbyY.js";
|
|
6
|
+
var m = `.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{position:var(--ran-input-host-position, relative);display:var(--ran-input-host-display, block);box-sizing:var(--ran-input-host-box-sizing, border-box)}:host([placeholder]) .ran-input-label{transform:var(--ran-input-label-placeholder-transform, translateY( calc(-50% - .43em) ) scale(.8));top:var(--ran-input-label-placeholder-top, 0)}:host .ran-input-label{transform:var(--ran-input-label-transform, translateY(-50%));top:var(--ran-input-label-top, 50%);transition:var(--ran-input-label-transition, all .3s)}.ran-input{box-sizing:var(--ran-input-box-sizing, border-box);position:var(--ran-input-position, relative);display:var(--ran-input-display, flex);width:var(--ran-input-width, 100%);height:var(--ran-input-height, auto);min-width:var(--ran-input-min-width, 0);padding:var(--ran-input-padding, 0px 0px 0px 4px);color:var(--ran-input-color, var(--ran-color-text, #000000d9));font-size:var(--ran-input-font-size, 12px);font-family:var(--ran-input-font-family, var(--ran-skin-font-family, inherit));line-height:var(--ran-input-line-height, 1.5715);background-color:var(--ran-input-background-color, var(--ran-color-bg-elevated, #fff));background-image:var(--ran-input-background-image, none);border:var(--ran-input-border, 1px solid var(--ran-color-border, #d9d9d9));border-image-source:var(--ran-input-border-image-source, none);border-image-slice:var(--ran-input-border-image-slice, 8);border-image-width:var(--ran-input-border-image-width, 4px);border-image-outset:0;border-image-repeat:stretch;border-radius:var(--ran-input-border-radius, var(--ran-radius-sm, 6px));transition:var(--ran-input-transition, border-color var(--ran-motion-duration-base, .2s), box-shadow var(--ran-motion-duration-base, .2s), color var(--ran-motion-duration-base, .2s));min-height:var(--ran-input-min-height, 32px)}.ran-input .ran-icon{display:var(--ran-input-icon-display, flex);align-items:var(--ran-input-icon-align-items, center);justify-content:var(--ran-input-icon-justify-content, center)}.ran-input:focus-within{border-color:var(--ran-input-active-border-color, var(--ran-color-primary, #006bff));box-shadow:var(--ran-input-active-box-shadow, 0 0 0 2px var(--ran-blue-400, #cae7ff));border-right-width:var(--ran-input-active-border-right-width, 1px);outline:var(--ran-input-active-outline, 0)}.ran-input:hover{border-color:var(--ran-input-hover-border-color, var(--ran-color-primary, #006bff));border-right-width:var(--ran-input-hover-border-right-width, 1px)}.ran-input>.ran-input-content:hover~.ran-input-label{color:var(--ran-input-label-hover-color, var(--ran-color-primary, #40a9ff))}.ran-input[value]>.ran-input-label{transform:var(--ran-input-label-value-transform, translateY( calc(-50% - .43em) ) scale(.8));color:var(--ran-input-label-value-color, var(--ran-color-text-disabled, #00000040))}.ran-input[status=error] .ran-input-content,.ran-input[status=warning] .ran-input-content{padding-right:var(--ran-input-content-status-padding-right, 28px)}.ran-input[status=error]:after,.ran-input[status=warning]:after{content:"";position:absolute;top:50%;right:10px;width:16px;height:16px;transform:translateY(-50%);pointer-events:none;mask-position:center;mask-repeat:no-repeat;mask-size:contain;-webkit-mask-position:center;-webkit-mask-repeat:no-repeat;-webkit-mask-size:contain}.ran-input[status=error]{border-color:var(--ran-input-status-error-border-color, var(--ran-color-danger, #ff4d4f))}.ran-input[status=error]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-error-color, var(--ran-color-danger, #ff4d4f))}.ran-input[status=error]:after{background-color:var(--ran-color-danger, #ff4d4f);mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5h1.5v5h-1.5v-5zM8 11a1 1 0 110 2 1 1 0 010-2z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5h1.5v5h-1.5v-5zM8 11a1 1 0 110 2 1 1 0 010-2z'/%3E%3C/svg%3E")}.ran-input[status=warning]{border-color:var(--ran-input-status-warning-border-color, var(--ran-color-warning, #faad14))}.ran-input[status=warning]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-warning-color, var(--ran-color-warning, #faad14))}.ran-input[status=warning]:after{background-color:var(--ran-color-warning, #faad14);mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.5l6.85 11.86a.5.5 0 01-.43.75H1.58a.5.5 0 01-.43-.75L8 1.5zm-.75 4.25v3.5h1.5v-3.5h-1.5zM8 10.75a1 1 0 110 2 1 1 0 010-2z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.5l6.85 11.86a.5.5 0 01-.43.75H1.58a.5.5 0 01-.43-.75L8 1.5zm-.75 4.25v3.5h1.5v-3.5h-1.5zM8 10.75a1 1 0 110 2 1 1 0 010-2z'/%3E%3C/svg%3E")}.ran-input[disabled]{color:var(--ran-input-disabled-color, var(--ran-color-text-disabled, #00000040));background-color:var(--ran-input-disabled-background-color, var(--ran-color-bg-muted, #f5f5f5));border-color:var(--ran-input-disabled-border-color, var(--ran-color-border, #d9d9d9));box-shadow:var(--ran-input-disabled-box-shadow, none);cursor:var(--ran-input-disabled-cursor, not-allowed);opacity:var(--ran-input-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content{color:var(--ran-input-content-disabled-color, var(--ran-color-text-disabled, #00000040));background-color:var(--ran-input-content-disabled-background-color, var(--ran-color-bg-muted, #f5f5f5));border-color:var(--ran-input-content-disabled-border-color, var(--ran-color-border, #d9d9d9));box-shadow:var(--ran-input-content-disabled-box-shadow, none);cursor:var(--ran-input-content-disabled-cursor, not-allowed);opacity:var(--ran-input-content-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-disabled-color, var(--ran-color-text-disabled, #00000040));background-color:var(--ran-input-label-disabled-background-color, var(--ran-color-bg-muted, #f5f5f5))}.ran-input[disabled]>.ran-input-label{color:var(--ran-input-label-disabled-color, var(--ran-color-text-disabled, #999));border-color:var(--ran-input-label-disabled-border-color, var(--ran-color-border, #d9d9d9));box-shadow:var(--ran-input-label-disabled-box-shadow, none);cursor:var(--ran-input-label-disabled-cursor, not-allowed)}.ran-input-content{writing-mode:var(--ran-input-content-writing-mode, horizontal-tb);text-rendering:var(--ran-input-content-text-rendering, auto);letter-spacing:var(--ran-input-content-letter-spacing, normal);word-spacing:var(--ran-input-content-word-spacing, normal);text-transform:var(--ran-input-content-text-transform, none);text-indent:var(--ran-input-content-text-indent, 0px);text-shadow:var(--ran-input-content-text-shadow, none);text-align:var(--ran-input-content-text-align, start);cursor:var(--ran-input-content-cursor, text);touch-action:var(--ran-input-content-touch-action, manipulation);-webkit-appearance:var(--ran-input-content--webkit-appearance, none);text-overflow:var(--ran-input-content-text-overflow, ellipsis);box-sizing:var(--ran-input-content-box-sizing, border-box);margin:var(--ran-input-content-margin, 0);font-variant:var(--ran-input-content-font-variant, tabular-nums);list-style:var(--ran-input-content-list-style, none);font-feature-settings:var(--ran-input-content-font-feature-settings, "tnum");position:var(--ran-input-content-position, relative);border:var(--ran-input-content-border, none);width:var(--ran-input-content-width, 100%);height:var(--ran-input-content-height, 100%);min-height:var(--ran-input-content-min-height, 30px);min-width:var(--ran-input-content-min-width, 0);color:var(--ran-input-content-color, var(--ran-color-text, #000000d9));font-size:var(--ran-input-content-font-size, 14px);line-height:var(--ran-input-content-line-height, 1.48);background-color:var(--ran-input-content-background-color, var(--ran-color-bg-elevated, #fff));background-image:var(--ran-input-content-background-image, none);transition:var(--ran-input-content-transition, border-color var(--ran-motion-duration-base, .2s), box-shadow var(--ran-motion-duration-base, .2s), color var(--ran-motion-duration-base, .2s));outline:var(--ran-input-content-outline, none);border-radius:var(--ran-input-content-border-radius, var(--ran-radius-sm, 6px));padding:var(--ran-input-content-padding, 0 0 0 2px);font-weight:var(--ran-input-content-font-weight, 400)}.ran-input-content:focus,.ran-input-content:hover{border:var(--ran-input-content-hover-border, none);outline:var(--ran-input-content-hover-outline, 0)}.ran-input-content::placeholder{color:var(--ran-input-content-placeholder-color, var(--ran-color-text-disabled, #999))}.ran-input-content:placeholder-shown~.ran-input-label{transform:var(--ran-input-content-placeholder-label-transform, translateY( calc(-50% - .43em) ) scale(.8))}.ran-input-content:focus~.ran-input-label{transform:var(--ran-input-content-focus-label-transform, translateY( calc(-50% - .43em) ) scale(.8));top:var(--ran-input-content-focus-label-top, 0px)}.ran-input-content::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-input-label{box-sizing:var(--ran-input-label-box-sizing, border-box);pointer-events:var(--ran-input-label-pointer-events, none);position:var(--ran-input-label-position, absolute);font-size:var(--ran-input-label-font-size, 14px);left:var(--ran-input-label-left, 8px);transition:var(--ran-input-label-transition, transform .3s, color .3s, background-color .3s, backdrop-filter .3s);transform-origin:var(--ran-input-label-transform-origin, left);padding:var(--ran-input-label-padding, 0 0);color:var(--ran-input-label-color, var(--ran-color-text-disabled, #999));background:var(--ran-input-label-background, var(--ran-color-bg-elevated, #fff));opacity:var(--ran-input-label-opacity, .9);transition:var(--ran-input-label-transition, all .3s)}.ran-input-message{margin-top:var(--ran-input-message-margin-top, 4px);font-size:var(--ran-input-message-font-size, 12px);line-height:var(--ran-input-message-line-height, 1.5);color:var(--ran-input-message-color, var(--ran-color-text-secondary, #8c8c8c))}.ran-input-message:empty{display:none}:host([status="error"]) .ran-input-message{color:var(--ran-input-message-error-color, var(--ran-color-danger, #ff4d4f))}:host([status="warning"]) .ran-input-message{color:var(--ran-input-message-warning-color, var(--ran-color-warning, #faad14))}`, f = 0, x = class extends g {
|
|
7
|
+
static formAssociated = !0;
|
|
8
|
+
_internals;
|
|
9
|
+
static get observedAttributes() {
|
|
10
|
+
return [
|
|
11
|
+
"label",
|
|
12
|
+
"disabled",
|
|
13
|
+
"name",
|
|
14
|
+
"placeholder",
|
|
15
|
+
"type",
|
|
16
|
+
"icon",
|
|
17
|
+
"value",
|
|
18
|
+
"status",
|
|
19
|
+
"message",
|
|
20
|
+
"min",
|
|
21
|
+
"max",
|
|
22
|
+
"step",
|
|
23
|
+
"required",
|
|
24
|
+
"sheet"
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
_events = new d();
|
|
28
|
+
_shadowDom;
|
|
29
|
+
_input;
|
|
30
|
+
_label;
|
|
31
|
+
_inputContent;
|
|
32
|
+
_icon;
|
|
33
|
+
_message;
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
try {
|
|
37
|
+
this._internals = this.attachInternals();
|
|
38
|
+
} catch {
|
|
39
|
+
this._internals = void 0;
|
|
40
|
+
}
|
|
41
|
+
this._shadowDom = s(this, m);
|
|
42
|
+
const t = u(this._shadowDom, ".ran-input", () => a().class("ran-input").part("input").children(b().class("ran-input-content").part("content")).build());
|
|
43
|
+
this._input = t, this._inputContent = t.querySelector(".ran-input-content"), this._inputContent.id || (this._inputContent.id = `ran-input-${++f}`);
|
|
44
|
+
}
|
|
45
|
+
get value() {
|
|
46
|
+
return this.getAttribute("value") || "";
|
|
47
|
+
}
|
|
48
|
+
set value(t) {
|
|
49
|
+
!r(this) && t ? (this.setAttribute("value", t), this._input.setAttribute("value", t)) : (this.removeAttribute("value"), this._input.removeAttribute("value")), this._internals?.setFormValue?.(this.getAttribute("value") ?? "");
|
|
50
|
+
}
|
|
51
|
+
get placeholder() {
|
|
52
|
+
return this.getAttribute("placeholder") || "";
|
|
53
|
+
}
|
|
54
|
+
set placeholder(t) {
|
|
55
|
+
t ? this.setAttribute("placeholder", t) : this.removeAttribute("placeholder");
|
|
56
|
+
}
|
|
57
|
+
get required() {
|
|
58
|
+
return this.hasAttribute("required");
|
|
59
|
+
}
|
|
60
|
+
set required(t) {
|
|
61
|
+
!t || t === "false" ? this.removeAttribute("required") : this.setAttribute("required", "");
|
|
62
|
+
}
|
|
63
|
+
get disabled() {
|
|
64
|
+
return r(this);
|
|
65
|
+
}
|
|
66
|
+
set disabled(t) {
|
|
67
|
+
i.includes(t) ? (this.removeAttribute("disabled"), this._input.removeAttribute("disabled"), this._inputContent.removeAttribute("disabled")) : (this.setAttribute("disabled", ""), this._input.setAttribute("disabled", ""), this._inputContent.setAttribute("disabled", ""));
|
|
68
|
+
}
|
|
69
|
+
get label() {
|
|
70
|
+
return this.getAttribute("label") || "";
|
|
71
|
+
}
|
|
72
|
+
set label(t) {
|
|
73
|
+
this.setAttribute("label", t);
|
|
74
|
+
}
|
|
75
|
+
get status() {
|
|
76
|
+
return this.getAttribute("status") || "";
|
|
77
|
+
}
|
|
78
|
+
set status(t) {
|
|
79
|
+
t ? (this.setAttribute("status", t), this._input.setAttribute("status", t)) : (this.removeAttribute("status"), this._input.removeAttribute("status"));
|
|
80
|
+
}
|
|
81
|
+
get message() {
|
|
82
|
+
return this.getAttribute("message") || "";
|
|
83
|
+
}
|
|
84
|
+
set message(t) {
|
|
85
|
+
t ? this.setAttribute("message", t) : this.removeAttribute("message");
|
|
86
|
+
}
|
|
87
|
+
get name() {
|
|
88
|
+
return this.getAttribute("name") || "";
|
|
89
|
+
}
|
|
90
|
+
set name(t) {
|
|
91
|
+
this.setAttribute("name", t);
|
|
92
|
+
}
|
|
93
|
+
get min() {
|
|
94
|
+
return this.getAttribute("min") || "";
|
|
95
|
+
}
|
|
96
|
+
set min(t) {
|
|
97
|
+
this.type === "number" && this.setAttribute("min", t);
|
|
98
|
+
}
|
|
99
|
+
get max() {
|
|
100
|
+
return this.getAttribute("max") || "";
|
|
101
|
+
}
|
|
102
|
+
set max(t) {
|
|
103
|
+
this.type === "number" && this.setAttribute("max", t);
|
|
104
|
+
}
|
|
105
|
+
get step() {
|
|
106
|
+
return this.getAttribute("step") || "";
|
|
107
|
+
}
|
|
108
|
+
set step(t) {
|
|
109
|
+
this.type === "number" && this.setAttribute("step", t);
|
|
110
|
+
}
|
|
111
|
+
get icon() {
|
|
112
|
+
return this.getAttribute("icon") || "";
|
|
113
|
+
}
|
|
114
|
+
set icon(t) {
|
|
115
|
+
t ? this.setAttribute("icon", t) : this.removeAttribute("icon");
|
|
116
|
+
}
|
|
117
|
+
get type() {
|
|
118
|
+
return this.getAttribute("type") || "";
|
|
119
|
+
}
|
|
120
|
+
set type(t) {
|
|
121
|
+
t ? this.setAttribute("type", t) : this.removeAttribute("type");
|
|
122
|
+
}
|
|
123
|
+
get sheet() {
|
|
124
|
+
return l(this, "sheet");
|
|
125
|
+
}
|
|
126
|
+
set sheet(t) {
|
|
127
|
+
p(this, "sheet", t);
|
|
128
|
+
}
|
|
129
|
+
handlerExternalCss = () => {
|
|
130
|
+
o(this, this._shadowDom, "sheet", null, this.sheet);
|
|
131
|
+
};
|
|
132
|
+
customInput = (t) => {
|
|
133
|
+
t.stopPropagation(), t.preventDefault();
|
|
134
|
+
const { target: n, data: e = "" } = t;
|
|
135
|
+
this.value = n?.value || e || "", this.dispatchEvent(new CustomEvent("input", { detail: { value: this.value } }));
|
|
136
|
+
};
|
|
137
|
+
customChange = () => {
|
|
138
|
+
this.value = this._inputContent?.value ?? this.value, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value } }));
|
|
139
|
+
};
|
|
140
|
+
listenPlaceholder = (t, n) => {
|
|
141
|
+
t === "placeholder" && this._inputContent && (n != null ? this._inputContent.setAttribute("placeholder", n) : this._inputContent.removeAttribute("placeholder"));
|
|
142
|
+
};
|
|
143
|
+
listenLabel = (t, n) => {
|
|
144
|
+
t === "label" && this._inputContent && (n != null ? this._label ? this._label.innerHTML = n : (this._label = h().class("ran-input-label").part("label").text(n).build(), this._label.htmlFor = this._inputContent.id, this._input.appendChild(this._label)) : (this._input.removeAttribute("label"), this._label && (this._input.removeChild(this._label), this._label = void 0)));
|
|
145
|
+
};
|
|
146
|
+
listenType = (t, n) => {
|
|
147
|
+
t === "type" && this._inputContent && (n ? this._inputContent.setAttribute("type", n) : (this._inputContent.removeAttribute("type"), this._inputContent.removeAttribute("min"), this._inputContent.removeAttribute("max"), this._inputContent.removeAttribute("step")));
|
|
148
|
+
};
|
|
149
|
+
listenStatus = (t, n) => {
|
|
150
|
+
t === "status" && this._input && (n ? this._input.setAttribute("status", n) : this._input.removeAttribute("status"));
|
|
151
|
+
};
|
|
152
|
+
listenMessage = (t, n) => {
|
|
153
|
+
t === "message" && (n ? (this._message || (this._message = a().class("ran-input-message").part("message").build(), this._shadowDom.appendChild(this._message)), this._message.textContent = n) : this._message && (this._message.remove(), this._message = void 0));
|
|
154
|
+
};
|
|
155
|
+
listenNumericConstraint = (t, n) => {
|
|
156
|
+
(t === "min" || t === "max" || t === "step") && this._inputContent && (this.type === "number" && n != null ? this._inputContent.setAttribute(t, n) : this._inputContent.removeAttribute(t));
|
|
157
|
+
};
|
|
158
|
+
listenRequired = (t, n) => {
|
|
159
|
+
t === "required" && this._inputContent && (n != null ? this._inputContent.setAttribute("required", "") : this._inputContent.removeAttribute("required"));
|
|
160
|
+
};
|
|
161
|
+
listenDisabled = (t, n) => {
|
|
162
|
+
t === "disabled" && this._input && (i.includes(n) ? this._input.removeAttribute("disabled") : (this._input.setAttribute("disabled", ""), this._inputContent.setAttribute("disabled", "")));
|
|
163
|
+
};
|
|
164
|
+
listenIcon = (t, n, e) => {
|
|
165
|
+
t === "icon" && n && n !== e && (this.removeAttribute("label"), this.setAttribute("icon", n), this.dealIcon());
|
|
166
|
+
};
|
|
167
|
+
dealIcon = () => {
|
|
168
|
+
this._icon || (this._icon = c("r-icon").class("ran-icon").build(), this._inputContent.insertAdjacentElement("beforebegin", this._icon)), this.icon && this._icon.setAttribute("name", this.icon);
|
|
169
|
+
};
|
|
170
|
+
listenEvent = (t, n, e) => {
|
|
171
|
+
this.listenPlaceholder(t, e), this.listenLabel(t, e), this.listenStatus(t, e), this.listenMessage(t, e), this.listenNumericConstraint(t, e), this.listenRequired(t, e), this.listenDisabled(t, e), this.listenIcon(t, e, n), t === "value" && n !== e && (this._inputContent.value = e, this._input.setAttribute("value", e));
|
|
172
|
+
};
|
|
173
|
+
connectedCallback() {
|
|
174
|
+
this.handlerExternalCss(), this.value && (this._inputContent.value = this.value, this._input.setAttribute("value", this.value)), this._internals?.setFormValue?.(this.value), this.status && this._input.setAttribute("status", this.status), this.message && this.listenMessage("message", this.message), r(this) && (this._input.setAttribute("disabled", ""), this._inputContent.setAttribute("disabled", "")), this.type && this._inputContent.setAttribute("type", this.type), this.type === "number" && (this.min && this._inputContent.setAttribute("min", this.min), this.max && this._inputContent.setAttribute("max", this.max), this.step && this._inputContent.setAttribute("step", this.step)), this.required && this._inputContent.setAttribute("required", ""), this._events.on(this._inputContent, "input", this.customInput), this._events.on(this._inputContent, "change", this.customChange), document.readyState === "complete" && this.dealIcon();
|
|
175
|
+
}
|
|
176
|
+
disconnectedCallback() {
|
|
177
|
+
this._events.abort();
|
|
178
|
+
}
|
|
179
|
+
attributeChangedCallback(t, n, e) {
|
|
180
|
+
n !== e && (this.listenEvent(t, n, e), t === "sheet" && this.handlerExternalCss());
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
v("r-input", x);
|
|
184
|
+
export {
|
|
185
|
+
x as t
|
|
186
|
+
};
|
package/dist/input.js
CHANGED