ranui 0.2.0-alpha.0 → 0.2.0-alpha.2

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.
Files changed (82) hide show
  1. package/README.md +26 -0
  2. package/README.zh-CN.md +26 -0
  3. package/dist/bin/build-iife.d.ts +1 -0
  4. package/dist/button-BstLjXNe.js +117 -0
  5. package/dist/button.js +1 -1
  6. package/dist/colorpicker-CGh8pRqo.js +315 -0
  7. package/dist/colorpicker.js +1 -1
  8. package/dist/components/colorpicker/index.d.ts +11 -0
  9. package/dist/components/dropdown/index.d.ts +0 -2
  10. package/dist/components/image/index.d.ts +6 -0
  11. package/dist/components/input/index.d.ts +13 -20
  12. package/dist/components/player/core/view.d.ts +0 -1
  13. package/dist/components/player/index.d.ts +0 -1
  14. package/dist/components/popover/index.d.ts +0 -2
  15. package/dist/components/select/index.d.ts +15 -0
  16. package/dist/{dropdown-C5362qTy.js → dropdown-RqHMRhFE.js} +0 -6
  17. package/dist/dropdown.js +1 -1
  18. package/dist/{icon-DmoEnao5.js → icon-Blm7AbyY.js} +2 -0
  19. package/dist/icon.js +1 -1
  20. package/dist/iife/button.iife.js +1 -0
  21. package/dist/iife/card.iife.js +1 -0
  22. package/dist/iife/checkbox.iife.js +1 -0
  23. package/dist/iife/colorpicker.iife.js +5 -0
  24. package/dist/iife/dropdown.iife.js +1 -0
  25. package/dist/iife/form.iife.js +1 -0
  26. package/dist/iife/icon.iife.js +1 -0
  27. package/dist/iife/image.iife.js +3 -0
  28. package/dist/iife/input.iife.js +1 -0
  29. package/dist/iife/link.iife.js +1 -0
  30. package/dist/iife/loading.iife.js +1 -0
  31. package/dist/iife/math.iife.js +261 -0
  32. package/dist/iife/message.iife.js +1 -0
  33. package/dist/iife/modal.iife.js +1 -0
  34. package/dist/iife/player.iife.js +31 -0
  35. package/dist/iife/popover.iife.js +1 -0
  36. package/dist/iife/progress.iife.js +1 -0
  37. package/dist/iife/radar.iife.js +1 -0
  38. package/dist/iife/route.iife.js +1 -0
  39. package/dist/iife/router.iife.js +1 -0
  40. package/dist/iife/scratch.iife.js +1 -0
  41. package/dist/iife/section.iife.js +1 -0
  42. package/dist/iife/select.iife.js +5 -0
  43. package/dist/iife/skeleton.iife.js +1 -0
  44. package/dist/iife/tab.iife.js +1 -0
  45. package/dist/iife/tabpane.iife.js +1 -0
  46. package/dist/{image-6GayFDqX.js → image-DKm6z7YQ.js} +17 -15
  47. package/dist/image.js +1 -1
  48. package/dist/index.cjs +16 -16
  49. package/dist/index.iife.js +35 -35
  50. package/dist/index.js +16 -16
  51. package/dist/input-Dskw1bAl.js +186 -0
  52. package/dist/input.js +1 -1
  53. package/dist/{katex-es-Cnq5Pk8K.cjs → katex-es-BTpuCxxV.cjs} +7 -7
  54. package/dist/{katex-es-Bpesphgp.js → katex-es-CKRwcaiU.js} +606 -606
  55. package/dist/{loading-Mko22ncl.js → loading-C4QUpm70.js} +1 -1
  56. package/dist/loading.js +1 -1
  57. package/dist/{math-B5PpSnFR.js → math-Dv4nXSoI.js} +1 -1
  58. package/dist/math.js +1 -1
  59. package/dist/{message-CQENvkoi.js → message-De5e1txT.js} +1 -1
  60. package/dist/message.js +1 -1
  61. package/dist/{player-CvfmwWUa.js → player-CqTAmg_E.js} +636 -638
  62. package/dist/player.js +1 -1
  63. package/dist/{popover-BCvHwLZb.js → popover-BY32HNMl.js} +19 -26
  64. package/dist/popover.js +1 -1
  65. package/dist/{progress-BWkNf2J5.js → progress-gZo0knzu.js} +11 -11
  66. package/dist/progress.js +1 -1
  67. package/dist/{radar-CWsawt2g.js → radar-19P5Mtld.js} +17 -17
  68. package/dist/radar.js +1 -1
  69. package/dist/ranui.css +1 -1
  70. package/dist/{select-BmhCUTLb.js → select-BVdUtQX5.js} +72 -51
  71. package/dist/select.js +1 -1
  72. package/dist/{skeleton-DPv9nFhL.js → skeleton-BAdJ6vyA.js} +1 -1
  73. package/dist/skeleton.js +1 -1
  74. package/dist/{tab-C9swK-hm.js → tab-DH2owP2V.js} +0 -1
  75. package/dist/tab.js +1 -1
  76. package/dist/vite.config.d.ts +4 -0
  77. package/docs/COMPONENTS.md +10 -12
  78. package/docs/DESIGN.md +16 -0
  79. package/package.json +3 -3
  80. package/dist/button-DukaD6uL.js +0 -117
  81. package/dist/colorpicker-Ch67dWa_.js +0 -302
  82. package/dist/input-DoraIb3x.js +0 -198
@@ -1,117 +0,0 @@
1
- import { C as i, c as b, d as l, f as d, p as a, s as h } from "./utils-D4pPF77E.js";
2
- import { t as u } from "./events-C59wGdni.js";
3
- import { _ as v, i as s, p as f } from "./factory-BdsO0dEW.js";
4
- import { a as p, n as g } from "./ssr-DSGwPtEd.js";
5
- 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{box-sizing:var(--ran-btn-box-sizing, border-box);position:var(--ran-btn-position, relative);display:var(--ran-btn-display, inline-flex);background-image:var(--ran-btn-background-image, none);box-shadow:var(--ran-btn-box-shadow, var(--ran-skin-raised-shadow, 0 2px #00000004));cursor:var(--ran-btn-cursor, pointer);-webkit-user-select:var(--ran-btn-user-select, none);user-select:var(--ran-btn-user-select, none);touch-action:var(--ran-btn-touch-action, manipulation);overflow:var(--ran-btn-overflow, hidden);pointer-events:var(--ran-btn-pointer-events, auto)}:host .ran-btn{box-sizing:var(--ran-btn-contain-box-sizing, border-box);position:var(--ran-btn-contain-position, relative);display:var(--ran-btn-contain-display, block);background-image:var(--ran-btn-contain-background-image, none);cursor:var(--ran-btn-contain-cursor, pointer);transition:var(--ran-btn-contain-transition, all var(--ran-motion-duration-base, .2s) cubic-bezier(.645, .045, .355, 1));-webkit-user-select:var(--ran-btn-contain-user-select, none);user-select:var(--ran-btn-contain-user-select, none);touch-action:var(--ran-btn-contain-touch-action, manipulation);background:var(--ran-btn-contain-background, var(--ran-color-bg-elevated, #fff))}:host,:host(:active),:host(:focus){outline:0;-webkit-tap-highlight-color:transparent}:host .ran-btn,:host(:active) .ran-btn,:host(:focus) .ran-btn{outline:var(--ran-btn-contain-outline, 0)}:host(:focus-visible){outline:var(--ran-btn-focus-outline, 2px solid var(--ran-color-primary));outline-offset:var(--ran-btn-focus-outline-offset, 2px)}:host([type="primary"]) .ran-btn-content{background-color:var(--ran-btn-content-background-color, var(--ran-color-primary, #1890ff));background-image:var(--ran-btn-content-background-image, none);border-color:var(--ran-btn-content-border-color, var(--ran-color-primary, #1890ff));color:var(--ran-btn-content-color, #fff)}:host([type="primary"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}:host([type="primary"]:not([disabled]):active) .ran-btn-content{background-color:var(--ran-btn-content-active-background-color, var(--ran-color-primary-active, #005ff2));border-color:var(--ran-btn-content-active-border-color, var(--ran-color-primary-active, #005ff2))}@media(min-width:1024px){:host(:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-hover-border-color, var(--ran-color-primary, #1890ff));color:var(--ran-btn-content-hover-color, var(--ran-color-primary, #1890ff))}:host([type="primary"]:not([disabled]):hover) .ran-btn-content{background-color:var(--ran-btn-content-hover-background-color, var(--ran-color-primary-hover, #0059ec));border-color:var(--ran-btn-content-hover-border-color, var(--ran-color-primary-hover, #0059ec));color:var(--ran-btn-content-hover-color, #fff)}:host([type="warning"]:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, var(--ran-color-danger, #ff4d4f));background-color:var(--ran-btn-content-warning-background-color, var(--ran-color-danger, #ff4d4f));color:var(--ran-btn-content-warning-color, #fff)}}:host([type="warning"]) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, var(--ran-color-danger, #ff4d4f));background-color:var(--ran-btn-content-warning-background-color, var(--ran-color-danger, #ff4d4f));background-image:var(--ran-btn-content-background-image, none);color:var(--ran-btn-content-warning-color, #fff)}:host([type="warning"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}:host([type="text"]) .ran-btn-content{border:var(--ran-btn-content-text-border, none)}:host([disabled]){cursor:var(--ran-btn-disabled-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-pointer-events, all);opacity:var(--ran-btn-disabled-opacity, .6)}:host([disabled]) .ran-btn{cursor:var(--ran-btn-disabled-container-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-container-pointer-events, all);opacity:var(--ran-btn-disabled-container-opacity, .6)}:host(:not([disabled]):active) .ran-btn:after{transform:var(--ran-btn-after-transform, translate(-50%, -50%) scale(0));opacity:var(--ran-btn-after-opacity, .3);transition:var(--ran-btn-after-transition, 0s)}@media(min-width:1024px){:host(:not([disabled],[effect])) .ran-btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--ran-x, 0);top:var(--ran-y, 0);pointer-events:none;background-image:radial-gradient(circle,var(--ran-color-primary, #1890ff) 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}}:host .slot{display:var(--ran-btn-slot-display, block)}.ran-btn-content{display:var(--ran-btn-content-display, flex);justify-content:var(--ran-btn-content-display, space-between);align-items:var(--ran-btn-content-align-items, center);padding:var(--ran-btn-content-padding, 4px 15px);border:var(--ran-btn-content-border, 1px solid transparent);border-image-source:var(--ran-btn-content-border-image-source, none);border-image-slice:var(--ran-btn-content-border-image-slice, 8);border-image-width:var(--ran-btn-content-border-image-width, 4px);border-image-outset:0;border-image-repeat:stretch;border-radius:var(--ran-btn-content-border-radius, var(--ran-radius-sm, 6px));border-color:var(--ran-btn-content-border-color, var(--ran-color-border, #d9d9d9));color:var(--ran-btn-content-color, var(--ran-color-text, #000000d9));line-height:var(--ran-btn-content-line-height, 22px);font-size:var(--ran-btn-content-font-size, 14px);font-weight:var(--ran-btn-content-font-weight, 400);font-family:var(--ran-btn-content-font-family, var(--ran-skin-font-family, inherit));white-space:var(--ran-btn-content-white-space, nowrap);text-align:var(--ran-btn-content-text-align, center);box-sizing:var(--ran-btn-content-box-sizing, border-box)}.ran-btn-content .icon{margin-right:var(--ran-btn-icon-margin-right, 2px)}', y = class extends g {
6
- _btn;
7
- _btnContent;
8
- _iconElement;
9
- _slot;
10
- _shadowDom;
11
- _events = new u();
12
- debounceTimeId;
13
- static get observedAttributes() {
14
- return [
15
- "disabled",
16
- "icon",
17
- "effect",
18
- "iconSize",
19
- "type",
20
- "sheet"
21
- ];
22
- }
23
- constructor() {
24
- super(), this._shadowDom = b(this, m);
25
- const t = h(this._shadowDom, ".ran-btn", () => s().class("ran-btn").attr("part", "button").role("button").tabIndex(0).children(s().class("ran-btn-content").attr("part", "content").children(f().class("slot"))).build());
26
- this._btn = t, this._btnContent = t.querySelector(".ran-btn-content"), this._slot = t.querySelector("slot");
27
- }
28
- get sheet() {
29
- return this.getAttribute("sheet") || "";
30
- }
31
- set sheet(t) {
32
- this.setAttribute("sheet", t || ""), this.handlerExternalCss();
33
- }
34
- get disabled() {
35
- return a(this);
36
- }
37
- set disabled(t) {
38
- !t || t === "false" ? (this.removeAttribute("disabled"), this.removeAttribute("aria-disabled")) : (this.setAttribute("disabled", ""), this.setAttribute("aria-disabled", "true"));
39
- }
40
- get iconSize() {
41
- return this.getAttribute("iconSize") || "";
42
- }
43
- set iconSize(t) {
44
- !t || t === "false" ? this.removeAttribute("iconSize") : (this.setAttribute("iconSize", t), this.setIcon());
45
- }
46
- get icon() {
47
- return this.getAttribute("icon") || "";
48
- }
49
- set icon(t) {
50
- !t || t === "false" ? this.removeAttribute("icon") : (this.setAttribute("icon", t), this.setIcon());
51
- }
52
- get effect() {
53
- return this.getAttribute("effect") || "";
54
- }
55
- set effect(t) {
56
- d.includes(t) || !t ? this.removeAttribute("effect") : this.setAttribute("effect", t);
57
- }
58
- get type() {
59
- return this.getAttribute("type") || "";
60
- }
61
- set type(t) {
62
- t ? this.setAttribute("type", t) : this.removeAttribute("type");
63
- }
64
- setIcon = () => {
65
- if (typeof document > "u" || !this._slot) return;
66
- const t = this.icon;
67
- if (!t) {
68
- this._iconElement && (this._iconElement.remove(), this._iconElement = void 0);
69
- return;
70
- }
71
- if (this._iconElement) this._iconElement.setAttribute("name", t);
72
- else {
73
- let r = this._shadowDom.querySelector("r-icon");
74
- r || (r = v("r-icon").attr("color", "currentColor").class("icon").build(), this._slot.insertAdjacentElement("beforebegin", r)), this._iconElement = r, this._iconElement.setAttribute("name", t);
75
- }
76
- const { width: n, height: e } = this._slot.getBoundingClientRect(), o = Math.min(n, e) || 16, c = this.iconSize || `${o > 5 ? o - 5 : o}`;
77
- this._iconElement.setAttribute("size", String(c));
78
- };
79
- mousedown = (t) => {
80
- if (i() === "pc" && !this.disabled) {
81
- this.debounceMouseEvent();
82
- const { left: n, top: e } = this.getBoundingClientRect();
83
- this._btn.style.setProperty("--ran-x", `${t.clientX - n}px`), this._btn.style.setProperty("--ran-y", `${t.clientY - e}px`);
84
- }
85
- };
86
- mouseup = () => {
87
- i() === "pc" && (this.debounceTimeId || (this.debounceTimeId = setTimeout(() => {
88
- this._btn.style.removeProperty("--ran-x"), this._btn.style.removeProperty("--ran-y"), this.debounceMouseEvent();
89
- }, 600)));
90
- };
91
- keydown = (t) => {
92
- a(this) || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.click());
93
- };
94
- debounceMouseEvent = () => {
95
- this.debounceTimeId && (clearTimeout(this.debounceTimeId), this.debounceTimeId = void 0);
96
- };
97
- handlerExternalCss = () => {
98
- l(this, this._shadowDom, "sheet", null, this.sheet);
99
- };
100
- syncA11yState = () => {
101
- const t = a(this);
102
- this._btn.setAttribute("aria-disabled", t ? "true" : "false"), this._btn.tabIndex = t ? -1 : 0, t ? (this.setAttribute("aria-disabled", "true"), this._btnContent.setAttribute("disabled", "true")) : (this.removeAttribute("aria-disabled"), this._btnContent.removeAttribute("disabled"));
103
- };
104
- connectedCallback() {
105
- this.handlerExternalCss(), this.setIcon(), this.syncA11yState(), this._events.on(this._btn, "mousedown", this.mousedown).on(this._btn, "mouseup", this.mouseup).on(this._btn, "keydown", this.keydown);
106
- }
107
- disconnectedCallback() {
108
- this.debounceMouseEvent(), this._events.abort();
109
- }
110
- attributeChangedCallback(t, n, e) {
111
- n !== e && (t === "disabled" && this._btnContent && this.syncA11yState(), (t === "icon" || t === "iconSize") && this.setIcon(), t === "sheet" && this.handlerExternalCss());
112
- }
113
- };
114
- p("r-button", y);
115
- export {
116
- y as t
117
- };
@@ -1,302 +0,0 @@
1
- import { c as f, d as v, l as x, s as m, u as P, x as l } from "./utils-D4pPF77E.js";
2
- import { t as w } from "./events-C59wGdni.js";
3
- import { i as y, r as u } from "./signal-XHfNsQNW.js";
4
- import { _ as h, h as S, i as s } from "./factory-BdsO0dEW.js";
5
- import { a as A, n as $ } from "./ssr-DSGwPtEd.js";
6
- import "./input-DoraIb3x.js";
7
- import "./select-BmhCUTLb.js";
8
- import "./popover-BCvHwLZb.js";
9
- var _ = (e) => {
10
- const { r, g: o, b: t } = C(e);
11
- return g(r, o, t);
12
- }, C = (e) => (e[0] === "#" && (e = e.substr(1)), e.length === 3 ? {
13
- r: parseInt(e[0] + e[0], 16),
14
- g: parseInt(e[1] + e[1], 16),
15
- b: parseInt(e[2] + e[2], 16)
16
- } : {
17
- r: parseInt(e.substr(0, 2), 16),
18
- g: parseInt(e.substr(2, 2), 16),
19
- b: parseInt(e.substr(4, 2), 16)
20
- }), g = (e, r, o) => {
21
- let t;
22
- const i = Math.max(e, r, o), a = i - Math.min(e, r, o);
23
- a === 0 ? t = 0 : e === i ? t = (r - o) / a % 6 : r === i ? t = (o - e) / a + 2 : t = (e - r) / a + 4, t = Math.round(t * 60), t < 0 && (t += 360);
24
- const n = Math.round((i === 0 ? 0 : a / i) * 100), c = Math.round(i / 255 * 100);
25
- return {
26
- h: t,
27
- s: n,
28
- v: c
29
- };
30
- }, d = (e, r, o) => {
31
- r = r / 100, o = o / 100;
32
- let t = [];
33
- const i = o * r, a = e / 60, n = i * (1 - Math.abs(a % 2 - 1)), c = o - i;
34
- return a >= 0 && a < 1 ? t = [
35
- i,
36
- n,
37
- 0
38
- ] : a >= 1 && a < 2 ? t = [
39
- n,
40
- i,
41
- 0
42
- ] : a >= 2 && a < 3 ? t = [
43
- 0,
44
- i,
45
- n
46
- ] : e >= 3 && a < 4 ? t = [
47
- 0,
48
- n,
49
- i
50
- ] : e >= 4 && a < 5 ? t = [
51
- n,
52
- 0,
53
- i
54
- ] : e >= 5 && a <= 6 ? t = [
55
- i,
56
- 0,
57
- n
58
- ] : t = [
59
- 0,
60
- 0,
61
- 0
62
- ], {
63
- r: Math.round(255 * (t[0] + c)),
64
- g: Math.round(255 * (t[1] + c)),
65
- b: Math.round(255 * (t[2] + c))
66
- };
67
- }, b = (e) => {
68
- const r = e.toString(16);
69
- return r.length === 1 ? "0" + r : r;
70
- }, k = (e, r, o) => "#" + [
71
- b(e),
72
- b(r),
73
- b(o)
74
- ].join(""), I = /^#([\da-f]{6}|[\da-f]{3})$/i, E = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/, D = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3}(\.\d+)?)\)$/, R = ".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}.ran-colorpicker{box-sizing:border-box;min-width:32px;height:32px;border-radius:var(--ran-colorpicker-border-radius, var(--ran-radius-md, 8px));border:var(--ran-colorpicker-border, 1px solid var(--ran-color-border, #d9d9d9));cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:var(--ran-colorpicker-transition, border-color .2s, box-shadow .2s);background:var(--ran-colorpicker-background, var(--ran-color-bg-elevated, #ffffff));padding:3px}.ran-colorpicker:hover{border-color:var(--ran-colorpicker-border-hover, var(--ran-color-border-hover, var(--ran-gray-500)))}.ran-colorpicker-block{position:relative;border-radius:var(--ran-colorpicker-block-border-radius, var(--ran-radius-sm, 4px));width:24px;height:24px;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:50% 50%}.ran-colorpicker-inner{width:100%;height:100%;border-radius:inherit}", V = ".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}.ran-color-picker-inner{box-sizing:border-box}.ran-color-picker-inner-content{box-sizing:border-box;display:flex;flex-direction:column;gap:12px;width:224px;padding:12px;font-family:var(--ran-font-family, inherit)}.ran-color-picker-inner-content *,.ran-color-picker-inner-content *:before,.ran-color-picker-inner-content *:after{box-sizing:border-box}.ran-color-picker-palette{position:relative;width:100%;height:160px;border-radius:var(--ran-radius-sm, 6px);overflow:hidden;cursor:crosshair;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));touch-action:none}.ran-color-picker-saturation{position:absolute;inset:0;border-radius:inherit;background-image:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,#fff0)}.ran-color-picker-palette-dot{position:absolute;top:0;left:0;z-index:2;width:14px;height:14px;transform:translate(-50%,-50%);border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #0003,0 1px 3px #00000059;pointer-events:none}.ran-color-picker-controls{display:flex;align-items:center;gap:12px}.ran-color-picker-preview{position:relative;flex:none;width:28px;height:28px;border-radius:50%;overflow:hidden;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:12px 12px}.ran-color-picker-preview-inner{position:absolute;inset:0;border-radius:inherit}.ran-color-picker-sliders{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px}.ran-color-picker-slider{position:relative;height:10px;border-radius:999px;cursor:pointer;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));touch-action:none}.ran-color-picker-slider-hue{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.ran-color-picker-slider-alpha{background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:8px 8px}.ran-color-picker-slider-alpha-track{position:absolute;inset:0;border-radius:inherit}.ran-color-picker-slider-thumb{position:absolute;top:50%;left:0;z-index:1;width:14px;height:14px;transform:translate(-50%,-50%);border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #0003,0 1px 3px #00000059;pointer-events:none}.ran-color-picker-input-container{display:flex;align-items:center;gap:8px}.ran-color-picker-format{flex:none;width:68px}.ran-color-picker-value{flex:1;min-width:0}", p = 360, H = class extends $ {
75
- colorpicker;
76
- colorpickerInner;
77
- context;
78
- _shadowDom;
79
- _events = new w();
80
- _effectDisposers = [];
81
- popoverBlock;
82
- popoverContent;
83
- colorPickerInner;
84
- colorPickerPalette;
85
- colorPickerSaturation;
86
- colorPickerPaletteDot;
87
- colorPickerHueSlider;
88
- colorPickerHueThumb;
89
- colorPickerAlphaSlider;
90
- colorPickerAlphaTrack;
91
- colorPickerAlphaThumb;
92
- colorPickerPreviewInner;
93
- colorPickerValueInput;
94
- colorPickerFormatSelect;
95
- colorPickerPaletteSelect;
96
- _activeSlider = null;
97
- _format = "HEX";
98
- _editingInput = !1;
99
- static get observedAttributes() {
100
- return [
101
- "disabled",
102
- "value",
103
- "sheet"
104
- ];
105
- }
106
- constructor() {
107
- super(), this._shadowDom = f(this, R);
108
- const e = m(this._shadowDom, "r-popover", () => {
109
- const r = s().class("ran-colorpicker-inner").part("swatch").build(), o = s().class("ran-colorpicker-block").part("block").children(r).build(), t = h("r-content").class("ran-content").build();
110
- return h("r-popover").class("ran-popover").attr("trigger", "click").children(o, t).build();
111
- });
112
- this.popoverBlock = e, this.popoverContent = e.querySelector("r-content"), this.colorpicker = e.querySelector(".ran-colorpicker-block"), this.colorpickerInner = e.querySelector(".ran-colorpicker-inner"), this.colorpicker.setAttribute("role", "button"), this.colorpicker.setAttribute("tabindex", "0"), this.colorpicker.setAttribute("aria-haspopup", "dialog"), this.colorpicker.setAttribute("aria-label", "Choose color"), this.colorPickerPaletteSelect = !1, this.createContext();
113
- }
114
- get value() {
115
- return this.context?.value.getter() || "";
116
- }
117
- set value(e) {
118
- this.setAttribute("value", e);
119
- }
120
- get sheet() {
121
- return x(this, "sheet");
122
- }
123
- set sheet(e) {
124
- P(this, "sheet", e);
125
- }
126
- handlerExternalCss = () => {
127
- v(this, this._shadowDom, "sheet", null, this.sheet);
128
- };
129
- createContext = () => {
130
- const e = (r) => {
131
- const [o, t] = y(r);
132
- return {
133
- getter: o,
134
- setter: t
135
- };
136
- };
137
- this.context = {
138
- value: e(""),
139
- disabled: e(!1),
140
- hue: e(0),
141
- saturation: e(0),
142
- lightness: e(100),
143
- transparency: e(100)
144
- };
145
- };
146
- currentRgba = () => {
147
- const { hue: e, saturation: r, lightness: o, transparency: t } = this.context, { r: i, g: a, b: n } = d(e.getter(), r.getter(), o.getter());
148
- return {
149
- r: i,
150
- g: a,
151
- b: n,
152
- a: t.getter() / 100
153
- };
154
- };
155
- currentValue = () => {
156
- const { r: e, g: r, b: o, a: t } = this.currentRgba();
157
- return t < 1 ? `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(2))})` : k(e, r, o);
158
- };
159
- currentDisplay = () => {
160
- const { r: e, g: r, b: o, a: t } = this.currentRgba();
161
- return this._format === "RGB" ? t < 1 ? `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(2))})` : `rgb(${e}, ${r}, ${o})` : k(e, r, o);
162
- };
163
- updateColorValue = (e) => {
164
- if (e === this.context?.value.getter()) return;
165
- const r = e.replace(/\s+/g, ""), o = I.exec(e), t = D.exec(r), i = E.exec(r);
166
- if (o) {
167
- const { h: a, s: n, v: c } = _(o[0]);
168
- this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(100);
169
- } else if (t) {
170
- const { h: a, s: n, v: c } = g(Number(t[1]), Number(t[2]), Number(t[3]));
171
- this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(Number(t[4]) * 100);
172
- } else if (i) {
173
- const { h: a, s: n, v: c } = g(Number(i[1]), Number(i[2]), Number(i[3]));
174
- this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(100);
175
- } else return;
176
- this.setAttribute("value", e), this.context?.value.setter(e);
177
- };
178
- emitChange = () => {
179
- const e = this.currentValue(), { r, g: o, b: t, a: i } = this.currentRgba();
180
- this.context?.value.setter(e), this.setAttribute("value", e), this.dispatchEvent(new CustomEvent("change", {
181
- detail: {
182
- value: e,
183
- hex: k(r, o, t),
184
- rgb: `rgb(${r}, ${o}, ${t})`,
185
- rgba: `rgba(${r}, ${o}, ${t}, ${Number(i.toFixed(2))})`,
186
- alpha: Number(i.toFixed(2))
187
- },
188
- bubbles: !0,
189
- composed: !0
190
- }));
191
- };
192
- palettePointerDown = (e) => {
193
- e.preventDefault(), this.colorPickerPaletteSelect = !0, this.updatePaletteFromEvent(e);
194
- };
195
- updatePaletteFromEvent = (e) => {
196
- if (!this.colorPickerPalette) return;
197
- const { left: r, top: o, width: t, height: i } = this.colorPickerPalette.getBoundingClientRect();
198
- if (!t || !i) return;
199
- const a = l(e.clientX - r, 0, t), n = l(e.clientY - o, 0, i);
200
- this.context.saturation.setter(a / t * 100), this.context.lightness.setter((1 - n / i) * 100), this.emitChange();
201
- };
202
- sliderPointerDown = (e) => (r) => {
203
- r.preventDefault(), this._activeSlider = e, this.updateSliderFromEvent(e, r);
204
- };
205
- updateSliderFromEvent = (e, r) => {
206
- const o = e === "hue" ? this.colorPickerHueSlider : this.colorPickerAlphaSlider;
207
- if (!o) return;
208
- const { left: t, width: i } = o.getBoundingClientRect();
209
- if (!i) return;
210
- const a = l(r.clientX - t, 0, i) / i;
211
- e === "hue" ? this.context.hue.setter(a * p) : this.context.transparency.setter(a * 100), this.emitChange();
212
- };
213
- onPointerMove = (e) => {
214
- const r = e;
215
- this.colorPickerPaletteSelect ? this.updatePaletteFromEvent(r) : this._activeSlider && this.updateSliderFromEvent(this._activeSlider, r);
216
- };
217
- initSliderA11y = (e, r, o) => {
218
- e.setAttribute("role", "slider"), e.setAttribute("tabindex", "0"), e.setAttribute("aria-label", r), e.setAttribute("aria-orientation", "horizontal"), e.setAttribute("aria-valuemin", "0"), e.setAttribute("aria-valuemax", String(o));
219
- };
220
- sliderKeydown = (e) => (r) => {
221
- const o = e === "hue" ? p : 100, t = e === "hue" ? this.context.hue : this.context.transparency, i = r.shiftKey ? 10 : 1, a = t.getter();
222
- let n = a;
223
- switch (r.key) {
224
- case "ArrowRight":
225
- case "ArrowUp":
226
- n = a + i;
227
- break;
228
- case "ArrowLeft":
229
- case "ArrowDown":
230
- n = a - i;
231
- break;
232
- case "Home":
233
- n = 0;
234
- break;
235
- case "End":
236
- n = o;
237
- break;
238
- default:
239
- return;
240
- }
241
- r.preventDefault(), t.setter(l(n, 0, o)), this.emitChange();
242
- };
243
- onPointerUp = () => {
244
- this.colorPickerPaletteSelect = !1, this._activeSlider = null;
245
- };
246
- onSwatchKeydown = (e) => {
247
- (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), this.colorpicker?.click());
248
- };
249
- onValueInput = (e) => {
250
- const r = e.target, o = e.detail?.value ?? r?.value;
251
- typeof o == "string" && (this._editingInput = !0, this.updateColorValue(o.trim()), this._editingInput = !1, this.emitChange());
252
- };
253
- onFormatChange = (e) => {
254
- const r = e.detail?.value;
255
- this._format = r === "RGB" ? "RGB" : "HEX", this.syncValueInput();
256
- };
257
- syncValueInput = () => {
258
- this._editingInput || !this.colorPickerValueInput || (this.colorPickerValueInput.value = this.currentDisplay());
259
- };
260
- setupEffects = () => {
261
- this._effectDisposers.push(u(() => {
262
- const { r: e, g: r, b: o } = d(this.context.hue.getter(), 100, 100);
263
- this.colorPickerSaturation?.style.setProperty("background-color", `rgb(${e}, ${r}, ${o})`);
264
- }), u(() => {
265
- const e = l(this.context.saturation.getter(), 0, 100), r = l(this.context.lightness.getter(), 0, 100);
266
- this.colorPickerPaletteDot?.style.setProperty("left", `${e}%`), this.colorPickerPaletteDot?.style.setProperty("top", `${100 - r}%`);
267
- }), u(() => {
268
- const e = this.context.hue.getter(), { r, g: o, b: t } = d(e, 100, 100);
269
- this.colorPickerHueThumb?.style.setProperty("left", `${e / p * 100}%`), this.colorPickerHueThumb?.style.setProperty("background", `rgb(${r}, ${o}, ${t})`), this.colorPickerHueSlider?.setAttribute("aria-valuenow", String(Math.round(e)));
270
- }), u(() => {
271
- const { r: e, g: r, b: o, a: t } = this.currentRgba(), i = `rgb(${e}, ${r}, ${o})`, a = `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(3))})`;
272
- this.colorPickerAlphaTrack?.style.setProperty("background", `linear-gradient(to right, rgba(${e}, ${r}, ${o}, 0), ${i})`), this.colorPickerAlphaThumb?.style.setProperty("left", `${t * 100}%`), this.colorPickerAlphaThumb?.style.setProperty("background", a), this.colorPickerPreviewInner?.style.setProperty("background", a), this.colorpickerInner?.style.setProperty("background", a), this.colorPickerAlphaSlider?.setAttribute("aria-valuenow", String(Math.round(t * 100))), this.colorPickerAlphaSlider?.setAttribute("aria-valuetext", `${Math.round(t * 100)}%`), this.syncValueInput();
273
- }));
274
- };
275
- disposeEffects = () => {
276
- for (const e of this._effectDisposers) e();
277
- this._effectDisposers = [];
278
- };
279
- openColorPicker = () => {
280
- if (this.colorPickerInner) return;
281
- this.colorPickerSaturation = s().class("ran-color-picker-saturation").build(), this.colorPickerPaletteDot = s().class("ran-color-picker-palette-dot").build(), this.colorPickerPalette = s().class("ran-color-picker-palette").on("mousedown", this.palettePointerDown).children(this.colorPickerSaturation, this.colorPickerPaletteDot).build(), this.colorPickerPreviewInner = s().class("ran-color-picker-preview-inner").build();
282
- const e = s().class("ran-color-picker-preview").children(this.colorPickerPreviewInner).build();
283
- this.colorPickerHueThumb = s().class("ran-color-picker-slider-thumb").build(), this.colorPickerHueSlider = s().class("ran-color-picker-slider ran-color-picker-slider-hue").on("mousedown", this.sliderPointerDown("hue")).on("keydown", this.sliderKeydown("hue")).children(this.colorPickerHueThumb).build(), this.initSliderA11y(this.colorPickerHueSlider, "Hue", p), this.colorPickerAlphaTrack = s().class("ran-color-picker-slider-alpha-track").build(), this.colorPickerAlphaThumb = s().class("ran-color-picker-slider-thumb").build(), this.colorPickerAlphaSlider = s().class("ran-color-picker-slider ran-color-picker-slider-alpha").on("mousedown", this.sliderPointerDown("alpha")).on("keydown", this.sliderKeydown("alpha")).children(this.colorPickerAlphaTrack, this.colorPickerAlphaThumb).build(), this.initSliderA11y(this.colorPickerAlphaSlider, "Alpha opacity", 100);
284
- const r = s().class("ran-color-picker-sliders").children(this.colorPickerHueSlider, this.colorPickerAlphaSlider).build(), o = s().class("ran-color-picker-controls").children(e, r).build();
285
- this.colorPickerFormatSelect = h("r-select").class("ran-color-picker-format").attr("value", this._format).attr("defaultValue", this._format).attr("trigger", "click").children(...["HEX", "RGB"].map((a) => h("r-option").attr("value", a).text(a).build())).on("change", this.onFormatChange).build(), this.colorPickerValueInput = h("r-input").class("ran-color-picker-value").on("change", this.onValueInput).build();
286
- const t = s().class("ran-color-picker-input-container").children(this.colorPickerFormatSelect, this.colorPickerValueInput).build(), i = s().class("ran-color-picker-inner-content").children(this.colorPickerPalette, o, t).build();
287
- this.colorPickerInner = s().class("ran-color-picker-inner").children(S().text(V).build(), i).build(), this.popoverContent.appendChild(this.colorPickerInner), this.setupEffects(), this.syncValueInput();
288
- };
289
- connectedCallback() {
290
- this.handlerExternalCss(), this.setAttribute("class", "ran-colorpicker"), this._events.on(this.popoverBlock, "click", this.openColorPicker), this._events.on(this.colorpicker, "keydown", this.onSwatchKeydown), this._events.on(document, "mousemove", this.onPointerMove), this._events.on(document, "mouseup", this.onPointerUp), this.value && this.updateColorValue(this.value);
291
- }
292
- disconnectedCallback() {
293
- this._events.abort(), this.disposeEffects();
294
- }
295
- attributeChangedCallback(e, r, o) {
296
- r !== o && (e === "value" && this.updateColorValue(o), e === "sheet" && this.handlerExternalCss());
297
- }
298
- };
299
- A("r-colorpicker", H);
300
- export {
301
- H as t
302
- };
@@ -1,198 +0,0 @@
1
- import { c as s, d as o, f as a, l, p as r, s as u, u as p } from "./utils-D4pPF77E.js";
2
- import { t as c } from "./events-C59wGdni.js";
3
- import { _ as d, c as h, i, s as b } from "./factory-BdsO0dEW.js";
4
- import { a as v, n as g } from "./ssr-DSGwPtEd.js";
5
- import "./icon-DmoEnao5.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, all 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, all 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
- "prefix",
21
- "suffix",
22
- "allowclear",
23
- "count",
24
- "maxlength",
25
- "showcount",
26
- "onPressEnter",
27
- "variant",
28
- "minrows",
29
- "maxrows",
30
- "sheet"
31
- ];
32
- }
33
- _events = new c();
34
- _shadowDom;
35
- _input;
36
- _label;
37
- _inputContent;
38
- _icon;
39
- _message;
40
- constructor() {
41
- super();
42
- try {
43
- this._internals = this.attachInternals();
44
- } catch {
45
- this._internals = void 0;
46
- }
47
- this._shadowDom = s(this, m);
48
- const t = u(this._shadowDom, ".ran-input", () => i().class("ran-input").part("input").children(b().class("ran-input-content").part("content")).build());
49
- this._input = t, this._inputContent = t.querySelector(".ran-input-content"), this._inputContent.id || (this._inputContent.id = `ran-input-${++f}`);
50
- }
51
- get value() {
52
- return this.getAttribute("value") || "";
53
- }
54
- set value(t) {
55
- !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") ?? "");
56
- }
57
- get placeholder() {
58
- return this.getAttribute("placeholder") || "";
59
- }
60
- set placeholder(t) {
61
- t ? this.setAttribute("placeholder", t) : this.removeAttribute("placeholder");
62
- }
63
- get required() {
64
- return this.hasAttribute("required");
65
- }
66
- set required(t) {
67
- !t || t === "false" ? this.removeAttribute("required") : this.setAttribute("required", "");
68
- }
69
- get disabled() {
70
- return r(this);
71
- }
72
- set disabled(t) {
73
- a.includes(t) ? (this.removeAttribute("disabled"), this._input.removeAttribute("disabled"), this._inputContent.removeAttribute("disabled")) : (this.setAttribute("disabled", ""), this._input.setAttribute("disabled", ""), this._inputContent.setAttribute("disabled", ""));
74
- }
75
- get label() {
76
- return this.getAttribute("label") || "";
77
- }
78
- set label(t) {
79
- this.setAttribute("label", t);
80
- }
81
- get status() {
82
- return this.getAttribute("status") || "";
83
- }
84
- set status(t) {
85
- t ? (this.setAttribute("status", t), this._input.setAttribute("status", t)) : (this.removeAttribute("status"), this._input.removeAttribute("status"));
86
- }
87
- get message() {
88
- return this.getAttribute("message") || "";
89
- }
90
- set message(t) {
91
- t ? this.setAttribute("message", t) : this.removeAttribute("message");
92
- }
93
- get name() {
94
- return this.getAttribute("name") || "";
95
- }
96
- set name(t) {
97
- this.setAttribute("name", t);
98
- }
99
- get min() {
100
- return this.getAttribute("min") || "";
101
- }
102
- set min(t) {
103
- this.type === "number" && this.setAttribute("min", t);
104
- }
105
- get max() {
106
- return this.getAttribute("max") || "";
107
- }
108
- set max(t) {
109
- this.type === "number" && this.setAttribute("max", t);
110
- }
111
- get step() {
112
- return this.getAttribute("step") || "";
113
- }
114
- set step(t) {
115
- this.type === "number" && this.setAttribute("step", t);
116
- }
117
- get icon() {
118
- return this.getAttribute("icon") || "";
119
- }
120
- set icon(t) {
121
- t ? this.setAttribute("icon", t) : this.removeAttribute("icon");
122
- }
123
- get prefix() {
124
- return this.getAttribute("prefix") || "";
125
- }
126
- set prefix(t) {
127
- t ? this.setAttribute("prefix", t) : this.removeAttribute("prefix");
128
- }
129
- get suffix() {
130
- return this.getAttribute("suffix") || "";
131
- }
132
- set suffix(t) {
133
- t ? this.setAttribute("suffix", t) : this.removeAttribute("suffix");
134
- }
135
- get type() {
136
- return this.getAttribute("type") || "";
137
- }
138
- set type(t) {
139
- t ? this.setAttribute("type", t) : this.removeAttribute("type");
140
- }
141
- get sheet() {
142
- return l(this, "sheet");
143
- }
144
- set sheet(t) {
145
- p(this, "sheet", t);
146
- }
147
- handlerExternalCss = () => {
148
- o(this, this._shadowDom, "sheet", null, this.sheet);
149
- };
150
- customInput = (t) => {
151
- t.stopPropagation(), t.preventDefault();
152
- const { target: e, data: n = "" } = t;
153
- this.value = e?.value || n || "", this.dispatchEvent(new CustomEvent("input", { detail: { value: this.value } }));
154
- };
155
- customChange = () => {
156
- this.value = this._inputContent?.value ?? this.value, this.dispatchEvent(new CustomEvent("change", { detail: { value: this.value } }));
157
- };
158
- listenPlaceholder = (t, e) => {
159
- t === "placeholder" && this._inputContent && (e != null ? this._inputContent.setAttribute("placeholder", e) : this._inputContent.removeAttribute("placeholder"));
160
- };
161
- listenLabel = (t, e) => {
162
- t === "label" && this._inputContent && (e != null ? this._label ? this._label.innerHTML = e : (this._label = h().class("ran-input-label").part("label").text(e).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)));
163
- };
164
- listenType = (t, e) => {
165
- t === "type" && this._inputContent && (e ? this._inputContent.setAttribute("type", e) : (this._inputContent.removeAttribute("type"), this._inputContent.removeAttribute("min"), this._inputContent.removeAttribute("max"), this._inputContent.removeAttribute("step")));
166
- };
167
- listenStatus = (t, e) => {
168
- t === "status" && this._input && (e ? this._input.setAttribute("status", e) : this._input.removeAttribute("status"));
169
- };
170
- listenMessage = (t, e) => {
171
- t === "message" && (e ? (this._message || (this._message = i().class("ran-input-message").part("message").build(), this._shadowDom.appendChild(this._message)), this._message.textContent = e) : this._message && (this._message.remove(), this._message = void 0));
172
- };
173
- listenDisabled = (t, e) => {
174
- t === "disabled" && this._input && (a.includes(e) ? this._input.removeAttribute("disabled") : (this._input.setAttribute("disabled", ""), this._inputContent.setAttribute("disabled", "")));
175
- };
176
- listenIcon = (t, e, n) => {
177
- t === "icon" && e && e !== n && (this.removeAttribute("label"), this.setAttribute("icon", e), this.dealIcon());
178
- };
179
- dealIcon = () => {
180
- this._icon || (this._icon = d("r-icon").class("ran-icon").build(), this._inputContent.insertAdjacentElement("beforebegin", this._icon)), this.icon && this._icon.setAttribute("name", this.icon);
181
- };
182
- listenEvent = (t, e, n) => {
183
- this.listenPlaceholder(t, n), this.listenLabel(t, n), this.listenStatus(t, n), this.listenMessage(t, n), this.listenDisabled(t, n), this.listenIcon(t, n, e), t === "value" && e !== n && (this._inputContent.value = n, this._input.setAttribute("value", n));
184
- };
185
- connectedCallback() {
186
- 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._events.on(this._inputContent, "input", this.customInput), this._events.on(this._inputContent, "change", this.customChange), document.readyState === "complete" && this.dealIcon();
187
- }
188
- disconnectedCallback() {
189
- this._events.abort();
190
- }
191
- attributeChangedCallback(t, e, n) {
192
- e !== n && (this.listenEvent(t, e, n), t === "sheet" && this.handlerExternalCss());
193
- }
194
- };
195
- v("r-input", x);
196
- export {
197
- x as t
198
- };