@logosphere-ui/core 0.0.0-alpha.4 → 0.0.0-alpha.42
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/AGENTS.md +1123 -0
- package/dist/AGENTS.md +1123 -0
- package/dist/atoms/Badge/badge.d.ts +1 -1
- package/dist/atoms/Button/button.d.ts +5 -3
- package/dist/atoms/Checkbox/checkbox.d.ts +2 -1
- package/dist/atoms/FormField/formfield.d.ts +10 -0
- package/dist/atoms/Slider/index.d.ts +1 -0
- package/dist/atoms/Slider/slider.d.ts +54 -0
- package/dist/badge-DsDxWEHx.js +72 -0
- package/dist/badge-DvaKpUHe.cjs +13 -0
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{breadcrumb-B-4yqoJZ.js → breadcrumb-BB61Xt0s.js} +3 -3
- package/dist/breadcrumb.js +1 -1
- package/dist/button-DRZ4sG4T.cjs +10 -0
- package/dist/button-Uu9oaieg.js +58 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar-CIgyrv3U.cjs +88 -0
- package/dist/calendar-CZ_IN2TF.js +652 -0
- package/dist/calendar.cjs +1 -0
- package/dist/calendar.js +4 -0
- package/dist/card-BOCW7gad.cjs +43 -0
- package/dist/{card-CUhlTJyJ.js → card-MDwFGplY.js} +27 -26
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/chatbot-B-NiZIYK.cjs +183 -0
- package/dist/chatbot-CHgiUY4h.js +564 -0
- package/dist/chatbot.cjs +1 -1
- package/dist/chatbot.js +2 -2
- package/dist/checkbox-CX0LgsWP.js +148 -0
- package/dist/checkbox-DpbKHANK.cjs +53 -0
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-group-BUL2H8rr.js +89 -0
- package/dist/chip-group-CpcjGoRm.cjs +26 -0
- package/dist/chip-group.cjs +1 -0
- package/dist/chip-group.js +4 -0
- package/dist/combobox-BmIFPk8X.cjs +113 -0
- package/dist/combobox-jak7Ac1m.js +437 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/datepicker-BgysIOZI.js +375 -0
- package/dist/datepicker-DOBmbxlo.cjs +85 -0
- package/dist/datepicker.cjs +1 -1
- package/dist/datepicker.js +2 -2
- package/dist/{download-manager-A4fOxGWJ.js → download-manager-BPg-6Qfg.js} +4 -4
- package/dist/download-manager-DDeTYRPs.cjs +97 -0
- package/dist/download-manager.cjs +1 -1
- package/dist/download-manager.js +1 -1
- package/dist/drawer-3nyjAkcS.cjs +32 -0
- package/dist/drawer-CE9zzllI.js +114 -0
- package/dist/drawer.cjs +1 -0
- package/dist/drawer.js +4 -0
- package/dist/formfield-CRcyUMvQ.cjs +33 -0
- package/dist/formfield-O327HYt0.js +154 -0
- package/dist/formfield.cjs +1 -1
- package/dist/formfield.js +1 -1
- package/dist/index.cjs +291 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js +908 -32
- package/dist/index.umd.js +1544 -521
- package/dist/input-CQS0LzF-.cjs +59 -0
- package/dist/input-CeF3YJk-.js +257 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/left-menu.cjs +1 -0
- package/dist/left-menu.js +5 -0
- package/dist/leftmenu-CmWvnA6L.js +301 -0
- package/dist/leftmenu-p9aR2QTy.cjs +83 -0
- package/dist/modal-DUIv_yoo.js +250 -0
- package/dist/modal-dUnnHe8u.cjs +84 -0
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/molecules/Accordion/accordion.d.ts +42 -0
- package/dist/molecules/Accordion/index.d.ts +2 -0
- package/dist/molecules/Chip/chip-group.d.ts +29 -0
- package/dist/molecules/Chip/index.d.ts +2 -0
- package/dist/molecules/Collapse/collapse.d.ts +42 -0
- package/dist/molecules/Collapse/index.d.ts +2 -0
- package/dist/molecules/Input/input.d.ts +7 -1
- package/dist/molecules/InputGroup/index.d.ts +1 -0
- package/dist/molecules/InputGroup/input-group.d.ts +40 -0
- package/dist/molecules/Pagination/index.d.ts +1 -0
- package/dist/molecules/Pagination/pagination.d.ts +60 -0
- package/dist/molecules/Popover/popover.d.ts +1 -0
- package/dist/molecules/SplitButton/index.d.ts +2 -0
- package/dist/molecules/SplitButton/split-button.d.ts +53 -0
- package/dist/molecules/Stepper/index.d.ts +2 -0
- package/dist/molecules/Stepper/stepper.d.ts +34 -0
- package/dist/molecules/Textarea/text-area.d.ts +5 -2
- package/dist/molecules/TimePicker/index.d.ts +2 -0
- package/dist/molecules/TimePicker/timepicker.d.ts +62 -0
- package/dist/organisms/Calendar/calendar.d.ts +54 -0
- package/dist/organisms/Calendar/index.d.ts +1 -0
- package/dist/organisms/Calendar/shared.d.ts +9 -0
- package/dist/organisms/Chatbot/chatbot.d.ts +10 -1
- package/dist/organisms/Chatbot/index.d.ts +1 -1
- package/dist/organisms/Combobox/combobox.d.ts +30 -0
- package/dist/organisms/DatePicker/datepicker.d.ts +33 -33
- package/dist/organisms/Drawer/drawer.d.ts +30 -0
- package/dist/organisms/Drawer/index.d.ts +1 -0
- package/dist/organisms/LeftMenu/index.d.ts +2 -0
- package/dist/organisms/LeftMenu/leftmenu-item.d.ts +14 -0
- package/dist/organisms/LeftMenu/leftmenu.d.ts +45 -0
- package/dist/organisms/Modal/modal.d.ts +29 -4
- package/dist/organisms/Tab/tab.d.ts +13 -1
- package/dist/organisms/Toast/index.d.ts +2 -0
- package/dist/organisms/Toast/toast-container.d.ts +42 -0
- package/dist/organisms/Toast/toast.d.ts +48 -0
- package/dist/organisms/TreeMenu/index.d.ts +1 -0
- package/dist/organisms/TreeMenu/tree-menu.d.ts +41 -0
- package/dist/pagination-B7jknoOz.js +360 -0
- package/dist/pagination-BkqbWBOn.cjs +169 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.js +4 -0
- package/dist/popover-CYDoeLKp.cjs +30 -0
- package/dist/{popover-B7tCqk3R.js → popover-DDaG8MSj.js} +21 -18
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/shared/types/button.types.d.ts +7 -0
- package/dist/styles/main.css +186 -182
- package/dist/switch-8RGGesy5.cjs +17 -0
- package/dist/switch-DNqPqH-R.js +64 -0
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/tab-CDMcFHvP.cjs +41 -0
- package/dist/tab-CuBCFGoO.js +204 -0
- package/dist/tab.cjs +1 -1
- package/dist/tab.js +1 -1
- package/dist/text-area-C73JxnqH.js +235 -0
- package/dist/text-area-Cprb-azV.cjs +51 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timepicker-CLJKWWGm.cjs +119 -0
- package/dist/timepicker-DMzGYd0p.js +316 -0
- package/dist/timepicker.cjs +1 -0
- package/dist/timepicker.js +4 -0
- package/dist/toast-container-6t6yEP9Y.cjs +64 -0
- package/dist/toast-container-B5v74b_5.js +274 -0
- package/dist/toast.cjs +1 -0
- package/dist/toast.js +6 -0
- package/dist/tree-menu-CkOPxr-W.js +154 -0
- package/dist/tree-menu-WNwZMreD.cjs +47 -0
- package/dist/tree-menu.cjs +1 -0
- package/dist/tree-menu.js +4 -0
- package/dist/ui-icon-BMJNdIOq.js +71 -0
- package/dist/ui-icon-DIucAQC_.cjs +22 -0
- package/package.json +99 -12
- package/dist/badge-BbhaO73N.cjs +0 -13
- package/dist/badge-DE7Tgd8Z.js +0 -71
- package/dist/button-C1EwOosO.js +0 -58
- package/dist/button-CDRccsk9.cjs +0 -10
- package/dist/card-n8ka8Zk-.cjs +0 -43
- package/dist/chatbot-Da_itUdJ.cjs +0 -160
- package/dist/chatbot-zkxngMRH.js +0 -481
- package/dist/checkbox-7Rb3WKGx.js +0 -119
- package/dist/checkbox-CdDTRdKV.cjs +0 -37
- package/dist/combobox-BJbI-Tgi.js +0 -268
- package/dist/combobox-pmE7bgEL.cjs +0 -99
- package/dist/datepicker-DFJx45C-.js +0 -750
- package/dist/datepicker-b9JGTTMx.cjs +0 -115
- package/dist/download-manager-BSIMTGaK.cjs +0 -97
- package/dist/formfield-D_7NFFoe.cjs +0 -27
- package/dist/formfield-d8fp9FTV.js +0 -118
- package/dist/input-BcnI1w3_.cjs +0 -46
- package/dist/input-Bj_7u8Iv.js +0 -192
- package/dist/modal-Bfc6WQSL.js +0 -110
- package/dist/modal-DQ8VFL-P.cjs +0 -39
- package/dist/popover-C2p5Pmts.cjs +0 -30
- package/dist/switch-Cpl53nRW.js +0 -64
- package/dist/switch-Rnnn10bn.cjs +0 -17
- package/dist/tab-BKdN4xAz.js +0 -176
- package/dist/tab-DcjAlXzU.cjs +0 -40
- package/dist/text-area-BkHdLnZj.cjs +0 -44
- package/dist/text-area-CC24lj8v.js +0 -204
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { unsafeCSS as d, css as _, LitElement as m, html as h } from "lit";
|
|
2
|
+
import { property as s, state as c, query as u, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import { createPopper as b } from "@popperjs/core";
|
|
4
|
+
import "./input-CeF3YJk-.js";
|
|
5
|
+
import "./ui-icon-BMJNdIOq.js";
|
|
6
|
+
const g = ":host{display:block;width:100%}.timepicker__reference{display:block;width:100%}.timepicker__trigger{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0;flex-shrink:0;height:100%;min-height:32px;outline:none;border-radius:0 var(--radius-base) var(--radius-base) 0;transition:color var(--transition-speed-fast) var(--transition-timing),background-color var(--transition-speed-fast) var(--transition-timing)}.timepicker__trigger:hover{color:var(--color-body-text);background-color:var(--color-body-bg-hover)}.timepicker__trigger--active{color:var(--color-body-text)}.timepicker__trigger:disabled{pointer-events:none;opacity:.4}.timepicker__popup[popover]{position:fixed;inset:unset;margin:0;padding:0;border:none;width:240px;background-color:var(--color-body-bg);border-radius:12px;box-shadow:0 4px 16px #7878783d;overflow:hidden;z-index:var(--z-index-dropdown, 1000)}.timepicker__spinner{display:flex;flex-direction:row;align-items:stretch;padding:var(--spacing-1) var(--spacing-2)}.timepicker__col{flex:1;display:flex;flex-direction:column;padding:0px var(--spacing-5)}.timepicker__col--left{align-items:flex-start}.timepicker__col--right{align-items:flex-end}.timepicker__col--sep{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 var(--spacing-1)}.timepicker__spin-btn{height:32px;display:flex;align-items:center;justify-content:center;border:none;padding:var(--spacing-2);background:transparent;color:var(--color-secondary);border-radius:var(--radius-base);cursor:pointer;outline:none;box-sizing:border-box;transition:background-color var(--transition-speed-fast) var(--transition-timing),color var(--transition-speed-fast) var(--transition-timing)}.timepicker__spin-btn:hover{background-color:var(--color-body-bg-hover);color:var(--color-body-text)}.timepicker__spin-btn:active{background-color:var(--color-body-bg-active)}.timepicker__time-unit{height:32px;display:flex;align-items:center;justify-content:center;font-size:14px;font-family:var(--font-family-base);font-weight:var(--font-weight-regular);line-height:1.25rem;letter-spacing:-.14px;color:var(--color-body-text);text-align:center;box-sizing:border-box;padding:var(--spacing-2)}.timepicker__colon{height:32px;display:flex;align-items:center;justify-content:center;font-size:16px;font-family:var(--font-family-base);font-weight:var(--font-weight-medium);color:var(--color-secondary)}.timepicker__actions{display:flex;align-items:center;padding:var(--spacing-2);border-top:1px solid var(--color-border);gap:var(--spacing-1)}.timepicker__action-btn{flex:1 0 0;min-width:0;height:32px;display:inline-flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--color-secondary);border-radius:var(--radius-full);cursor:pointer;padding:var(--spacing-2);outline:none;transition:background-color var(--transition-speed-fast) var(--transition-timing),color var(--transition-speed-fast) var(--transition-timing)}.timepicker__action-btn:hover{background-color:var(--color-body-bg-hover);color:var(--color-body-text)}.timepicker__action-btn:active{background-color:var(--color-body-bg-active)}";
|
|
7
|
+
var f = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, r, n, a) => {
|
|
8
|
+
for (var o = a > 1 ? void 0 : a ? y(r, n) : r, p = t.length - 1, l; p >= 0; p--)
|
|
9
|
+
(l = t[p]) && (o = (a ? l(r, n, o) : l(o)) || o);
|
|
10
|
+
return a && o && f(r, n, o), o;
|
|
11
|
+
};
|
|
12
|
+
let e = class extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.value = "", this.label = "", this.helper = "", this.error = "", this.placeholder = "__:__", this.required = !1, this.disabled = !1, this.readonly = !1, this.size = "default", this.variant = "default", this._isOpen = !1, this._hour = 0, this._minute = 0, this._handleOutsideClick = (t) => {
|
|
15
|
+
this._isOpen && !t.composedPath().includes(this) && (this._isOpen = !1);
|
|
16
|
+
}, this._handleInputChange = (t) => {
|
|
17
|
+
t.stopPropagation();
|
|
18
|
+
const r = t.detail?.value ?? "";
|
|
19
|
+
if (/^\d{2}:\d{2}$/.test(r)) {
|
|
20
|
+
const [n, a] = this._parseValue(r);
|
|
21
|
+
this._hour = n, this._minute = a;
|
|
22
|
+
const o = `${this._pad(n)}:${this._pad(a)}`;
|
|
23
|
+
this.value = o, this._emit(o);
|
|
24
|
+
}
|
|
25
|
+
}, this._handleInputClear = (t) => {
|
|
26
|
+
t.stopPropagation(), this.value = "", this._hour = 0, this._minute = 0, this._emit(""), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this._isOpen = !1;
|
|
27
|
+
}, this._incrementHour = () => {
|
|
28
|
+
this._hour = (this._hour + 1) % 24, this._syncValue();
|
|
29
|
+
}, this._decrementHour = () => {
|
|
30
|
+
this._hour = (this._hour - 1 + 24) % 24, this._syncValue();
|
|
31
|
+
}, this._incrementMinute = () => {
|
|
32
|
+
this._minute = (this._minute + 1) % 60, this._syncValue();
|
|
33
|
+
}, this._decrementMinute = () => {
|
|
34
|
+
this._minute = (this._minute - 1 + 60) % 60, this._syncValue();
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// ── Lifecycle ───────────────────────────────────────────────────────────────
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback(), document.addEventListener("click", this._handleOutsideClick);
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
super.disconnectedCallback(), document.removeEventListener("click", this._handleOutsideClick), this._destroyPopper();
|
|
43
|
+
}
|
|
44
|
+
willUpdate(t) {
|
|
45
|
+
if (t.has("value") && /^\d{1,2}:\d{2}$/.test(this.value)) {
|
|
46
|
+
const [r, n] = this._parseValue(this.value);
|
|
47
|
+
this._hour = r, this._minute = n;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
updated(t) {
|
|
51
|
+
t.has("_isOpen") && (this._isOpen ? this.updateComplete.then(() => {
|
|
52
|
+
this._showPopover(), this._updatePopper();
|
|
53
|
+
}) : (this._hidePopover(), this._destroyPopper()));
|
|
54
|
+
}
|
|
55
|
+
// ── Value helpers ───────────────────────────────────────────────────────────
|
|
56
|
+
_parseValue(t) {
|
|
57
|
+
const r = t.match(/^(\d{1,2}):(\d{2})$/);
|
|
58
|
+
return r ? [
|
|
59
|
+
Math.min(23, Math.max(0, parseInt(r[1], 10))),
|
|
60
|
+
Math.min(59, Math.max(0, parseInt(r[2], 10)))
|
|
61
|
+
] : [0, 0];
|
|
62
|
+
}
|
|
63
|
+
_pad(t) {
|
|
64
|
+
return String(t).padStart(2, "0");
|
|
65
|
+
}
|
|
66
|
+
// ── Popper / Popover ────────────────────────────────────────────────────────
|
|
67
|
+
_updatePopper() {
|
|
68
|
+
!this._referenceEl || !this._popupEl || (this._popperInstance = b(this._referenceEl, this._popupEl, {
|
|
69
|
+
placement: "bottom-start",
|
|
70
|
+
modifiers: [
|
|
71
|
+
{ name: "offset", options: { offset: [0, 4] } },
|
|
72
|
+
{ name: "flip", options: { fallbackPlacements: ["top-start"] } },
|
|
73
|
+
{
|
|
74
|
+
name: "preventOverflow",
|
|
75
|
+
options: { boundary: document.documentElement, padding: 8 }
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
_destroyPopper() {
|
|
81
|
+
this._popperInstance?.destroy(), this._popperInstance = void 0;
|
|
82
|
+
}
|
|
83
|
+
_showPopover() {
|
|
84
|
+
this._popupEl?.showPopover?.();
|
|
85
|
+
}
|
|
86
|
+
_hidePopover() {
|
|
87
|
+
const t = this._popupEl;
|
|
88
|
+
try {
|
|
89
|
+
t?.hidePopover?.();
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
_togglePopup() {
|
|
94
|
+
if (!(this.disabled || this.readonly))
|
|
95
|
+
if (this._isOpen)
|
|
96
|
+
this._isOpen = !1;
|
|
97
|
+
else {
|
|
98
|
+
const [t, r] = this._parseValue(this.value);
|
|
99
|
+
this._hour = t, this._minute = r, this._isOpen = !0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
_clearValue(t) {
|
|
103
|
+
t?.stopPropagation(), this.value = "", this._hour = 0, this._minute = 0, this._emit(""), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this._isOpen = !1;
|
|
104
|
+
}
|
|
105
|
+
_setNow() {
|
|
106
|
+
const t = /* @__PURE__ */ new Date();
|
|
107
|
+
this._hour = t.getHours(), this._minute = t.getMinutes(), this._syncValue();
|
|
108
|
+
}
|
|
109
|
+
_emit(t) {
|
|
110
|
+
this.onChange?.(t), this.dispatchEvent(new CustomEvent("change", {
|
|
111
|
+
bubbles: !0,
|
|
112
|
+
composed: !0,
|
|
113
|
+
detail: { value: t }
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
_syncValue() {
|
|
117
|
+
const t = `${this._pad(this._hour)}:${this._pad(this._minute)}`;
|
|
118
|
+
this.value = t, this._emit(t);
|
|
119
|
+
}
|
|
120
|
+
_startSpin(t) {
|
|
121
|
+
t(), this._spinInterval = setInterval(t, 120);
|
|
122
|
+
}
|
|
123
|
+
_stopSpin() {
|
|
124
|
+
clearInterval(this._spinInterval), this._spinInterval = void 0;
|
|
125
|
+
}
|
|
126
|
+
// ── Render ──────────────────────────────────────────────────────────────────
|
|
127
|
+
_renderPopup() {
|
|
128
|
+
return h`
|
|
129
|
+
<div data-timepicker-popup popover="manual" class="timepicker__popup">
|
|
130
|
+
<div class="timepicker__spinner">
|
|
131
|
+
<!-- Sol sütun: saat -->
|
|
132
|
+
<div class="timepicker__col timepicker__col--left">
|
|
133
|
+
<button
|
|
134
|
+
class="timepicker__spin-btn"
|
|
135
|
+
@mousedown=${() => this._startSpin(this._incrementHour)}
|
|
136
|
+
@mouseup=${this._stopSpin}
|
|
137
|
+
@mouseleave=${this._stopSpin}
|
|
138
|
+
@touchstart=${(t) => {
|
|
139
|
+
t.preventDefault(), this._startSpin(this._incrementHour);
|
|
140
|
+
}}
|
|
141
|
+
@touchend=${this._stopSpin}
|
|
142
|
+
tabindex="-1"
|
|
143
|
+
aria-label="Saat artır"
|
|
144
|
+
><ui-icon name="uil-arrow-up" size="16"></ui-icon></button>
|
|
145
|
+
<div class="timepicker__time-unit">${this._pad(this._hour)}</div>
|
|
146
|
+
<button
|
|
147
|
+
class="timepicker__spin-btn"
|
|
148
|
+
@mousedown=${() => this._startSpin(this._decrementHour)}
|
|
149
|
+
@mouseup=${this._stopSpin}
|
|
150
|
+
@mouseleave=${this._stopSpin}
|
|
151
|
+
@touchstart=${(t) => {
|
|
152
|
+
t.preventDefault(), this._startSpin(this._decrementHour);
|
|
153
|
+
}}
|
|
154
|
+
@touchend=${this._stopSpin}
|
|
155
|
+
tabindex="-1"
|
|
156
|
+
aria-label="Saat azalt"
|
|
157
|
+
><ui-icon name="uil-arrow-down" size="16"></ui-icon></button>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
<!-- Orta sütun: iki nokta -->
|
|
161
|
+
<div class="timepicker__col timepicker__col--sep">
|
|
162
|
+
<div class="timepicker__colon">:</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<!-- Sağ sütun: dakika -->
|
|
166
|
+
<div class="timepicker__col timepicker__col--right">
|
|
167
|
+
<button
|
|
168
|
+
class="timepicker__spin-btn"
|
|
169
|
+
@mousedown=${() => this._startSpin(this._incrementMinute)}
|
|
170
|
+
@mouseup=${this._stopSpin}
|
|
171
|
+
@mouseleave=${this._stopSpin}
|
|
172
|
+
@touchstart=${(t) => {
|
|
173
|
+
t.preventDefault(), this._startSpin(this._incrementMinute);
|
|
174
|
+
}}
|
|
175
|
+
@touchend=${this._stopSpin}
|
|
176
|
+
tabindex="-1"
|
|
177
|
+
aria-label="Dakika artır"
|
|
178
|
+
><ui-icon name="uil-arrow-up" size="16"></ui-icon></button>
|
|
179
|
+
<div class="timepicker__time-unit">${this._pad(this._minute)}</div>
|
|
180
|
+
<button
|
|
181
|
+
class="timepicker__spin-btn"
|
|
182
|
+
@mousedown=${() => this._startSpin(this._decrementMinute)}
|
|
183
|
+
@mouseup=${this._stopSpin}
|
|
184
|
+
@mouseleave=${this._stopSpin}
|
|
185
|
+
@touchstart=${(t) => {
|
|
186
|
+
t.preventDefault(), this._startSpin(this._decrementMinute);
|
|
187
|
+
}}
|
|
188
|
+
@touchend=${this._stopSpin}
|
|
189
|
+
tabindex="-1"
|
|
190
|
+
aria-label="Dakika azalt"
|
|
191
|
+
><ui-icon name="uil-arrow-down" size="16"></ui-icon></button>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<!-- Action buttons -->
|
|
196
|
+
<div class="timepicker__actions">
|
|
197
|
+
<button
|
|
198
|
+
class="timepicker__action-btn"
|
|
199
|
+
@click=${this._setNow}
|
|
200
|
+
title="Şu anki saati seç"
|
|
201
|
+
>
|
|
202
|
+
<ui-icon name="uil-calendar-alt" size="16"></ui-icon>
|
|
203
|
+
</button>
|
|
204
|
+
<button
|
|
205
|
+
class="timepicker__action-btn"
|
|
206
|
+
@click=${() => this._clearValue()}
|
|
207
|
+
title="Temizle"
|
|
208
|
+
>
|
|
209
|
+
<ui-icon name="uil-trash" size="16"></ui-icon>
|
|
210
|
+
</button>
|
|
211
|
+
<button
|
|
212
|
+
class="timepicker__action-btn"
|
|
213
|
+
@click=${() => {
|
|
214
|
+
this._isOpen = !1;
|
|
215
|
+
}}
|
|
216
|
+
title="Kapat"
|
|
217
|
+
>
|
|
218
|
+
<ui-icon name="uil-times" size="16"></ui-icon>
|
|
219
|
+
</button>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
`;
|
|
223
|
+
}
|
|
224
|
+
render() {
|
|
225
|
+
return h`
|
|
226
|
+
<div class="timepicker__reference">
|
|
227
|
+
<logosphere-input
|
|
228
|
+
.label=${this.label}
|
|
229
|
+
.helper=${this.helper}
|
|
230
|
+
.error=${this.error}
|
|
231
|
+
.required=${this.required}
|
|
232
|
+
.disabled=${this.disabled}
|
|
233
|
+
.readonly=${this.readonly}
|
|
234
|
+
.size=${this.size}
|
|
235
|
+
.variant=${this.variant}
|
|
236
|
+
.placeholder=${this.placeholder}
|
|
237
|
+
.value=${this.value}
|
|
238
|
+
mask="00:00"
|
|
239
|
+
@input=${this._handleInputChange}
|
|
240
|
+
@clear=${this._handleInputClear}
|
|
241
|
+
@change=${(t) => t.stopPropagation()}
|
|
242
|
+
>
|
|
243
|
+
<button
|
|
244
|
+
slot="suffix"
|
|
245
|
+
type="button"
|
|
246
|
+
class="timepicker__trigger ${this._isOpen ? "timepicker__trigger--active" : ""}"
|
|
247
|
+
@click=${this._togglePopup}
|
|
248
|
+
?disabled=${this.disabled}
|
|
249
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
250
|
+
aria-label="Saat seç"
|
|
251
|
+
aria-expanded=${this._isOpen ? "true" : "false"}
|
|
252
|
+
>
|
|
253
|
+
<ui-icon name="uil-clock" size="16"></ui-icon>
|
|
254
|
+
</button>
|
|
255
|
+
</logosphere-input>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
${this._renderPopup()}
|
|
259
|
+
`;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
e.styles = [_`${d(g)}`];
|
|
263
|
+
i([
|
|
264
|
+
s({ type: String })
|
|
265
|
+
], e.prototype, "value", 2);
|
|
266
|
+
i([
|
|
267
|
+
s({ type: String })
|
|
268
|
+
], e.prototype, "label", 2);
|
|
269
|
+
i([
|
|
270
|
+
s({ type: String })
|
|
271
|
+
], e.prototype, "helper", 2);
|
|
272
|
+
i([
|
|
273
|
+
s({ type: String })
|
|
274
|
+
], e.prototype, "error", 2);
|
|
275
|
+
i([
|
|
276
|
+
s({ type: String })
|
|
277
|
+
], e.prototype, "placeholder", 2);
|
|
278
|
+
i([
|
|
279
|
+
s({ type: Boolean })
|
|
280
|
+
], e.prototype, "required", 2);
|
|
281
|
+
i([
|
|
282
|
+
s({ type: Boolean })
|
|
283
|
+
], e.prototype, "disabled", 2);
|
|
284
|
+
i([
|
|
285
|
+
s({ type: Boolean })
|
|
286
|
+
], e.prototype, "readonly", 2);
|
|
287
|
+
i([
|
|
288
|
+
s({ type: String })
|
|
289
|
+
], e.prototype, "size", 2);
|
|
290
|
+
i([
|
|
291
|
+
s({ type: String })
|
|
292
|
+
], e.prototype, "variant", 2);
|
|
293
|
+
i([
|
|
294
|
+
s({ attribute: !1 })
|
|
295
|
+
], e.prototype, "onChange", 2);
|
|
296
|
+
i([
|
|
297
|
+
c()
|
|
298
|
+
], e.prototype, "_isOpen", 2);
|
|
299
|
+
i([
|
|
300
|
+
c()
|
|
301
|
+
], e.prototype, "_hour", 2);
|
|
302
|
+
i([
|
|
303
|
+
c()
|
|
304
|
+
], e.prototype, "_minute", 2);
|
|
305
|
+
i([
|
|
306
|
+
u(".timepicker__reference")
|
|
307
|
+
], e.prototype, "_referenceEl", 2);
|
|
308
|
+
i([
|
|
309
|
+
u("[data-timepicker-popup]")
|
|
310
|
+
], e.prototype, "_popupEl", 2);
|
|
311
|
+
e = i([
|
|
312
|
+
v("logosphere-timepicker")
|
|
313
|
+
], e);
|
|
314
|
+
export {
|
|
315
|
+
e as T
|
|
316
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./timepicker-CLJKWWGm.cjs");Object.defineProperty(exports,"TimePicker",{enumerable:!0,get:()=>e.TimePicker});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";const o=require("lit"),a=require("lit/decorators.js"),m=require("lit/directives/repeat.js");require("./ui-icon-DIucAQC_.cjs");require("./button-DRZ4sG4T.cjs");const d=".toast{position:relative;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:start;width:100%;box-sizing:border-box;border-radius:var(--radius-md);border-left:4px solid var(--toast-accent);background:#fff;box-shadow:var(--shadow-md);padding:var(--spacing-4);color:#3d3d3d;font-family:var(--font-family-base);animation:toast-enter .22s cubic-bezier(.2,.8,.2,1);transform-origin:top right}.toast__icon{display:inline-flex;margin-top:2px;color:var(--toast-accent)}.toast__content{min-width:0}.toast__title{margin:0;font-size:var(--font-size-lg);line-height:var(--line-height-tight);font-weight:var(--font-weight-semibold)}.toast__title--as-text{font-size:var(--font-size-base);line-height:var(--line-height-normal);font-weight:var(--font-weight-regular);color:#555}.toast__text{margin:4px 0 0;font-size:var(--font-size-base);line-height:var(--line-height-normal);color:#555}.toast__actions{display:flex;gap:10px;margin-top:12px}.toast__close{border:0;background:transparent;color:#5a5a5a;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;margin-top:2px}.toast__close:hover{color:#2f2f2f}.toast--success{--toast-accent: var(--color-success-active)}.toast--danger{--toast-accent: var(--color-danger-active)}.toast--warning{--toast-accent: var(--color-warning-active)}.toast--info{--toast-accent: var(--color-info-active)}.toast[data-closing=true]{pointer-events:none;animation:toast-exit .22s cubic-bezier(.4,0,1,1) forwards}@keyframes toast-enter{0%{opacity:0;transform:translate3d(18px,-8px,0) scale(.98)}to{opacity:1;transform:translateZ(0) scale(1)}}@keyframes toast-exit{0%{opacity:1;transform:translateZ(0) scale(1);max-height:240px;margin-bottom:0}to{opacity:0;transform:translate3d(20px,-6px,0) scale(.97);max-height:0;margin-bottom:-12px}}";var g=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(n,t,e,s)=>{for(var i=s>1?void 0:s?f(t,e):t,c=n.length-1,l;c>=0;c--)(l=n[c])&&(i=(s?l(t,e,i):l(i))||i);return s&&i&&g(t,e,i),i};const h=6e3,T=220,v={success:"uil-check-circle",danger:"uil-exclamation-octagon",warning:"uil-exclamation-triangle",info:"uil-info-circle"};exports.LogosphereToast=class extends o.LitElement{constructor(){super(...arguments),this.type="info",this.title="",this.text="",this.icon="",this.closeable=!0,this.duration=h,this.autoDismiss=!0,this.isClosing=!1,this.remainingMs=h,this.startedAt=0}connectedCallback(){super.connectedCallback(),this.remainingMs=this.duration,this.startTimer()}disconnectedCallback(){super.disconnectedCallback(),this.clearTimer(),this.closeTimerId&&(clearTimeout(this.closeTimerId),this.closeTimerId=void 0)}updated(t){t.has("duration")&&(this.remainingMs=this.duration,this.restartTimer()),(t.has("action")||t.has("autoDismiss")||t.has("type"))&&this.restartTimer()}close(t="manual"){this.isClosing||(this.clearTimer(),this.isClosing=!0,this.closeTimerId=setTimeout(()=>{this.dispatchEvent(new CustomEvent("toast-close",{detail:{reason:t},bubbles:!0,composed:!0}))},T))}get canAutoDismiss(){return this.autoDismiss&&this.type!=="danger"&&!this.hasActions}get resolvedTitle(){return this.title||this.text}get resolvedText(){return this.title?this.text:""}get resolvedIcon(){return this.icon||v[this.type]}get hasActions(){return!!this.action}onActionClick(t){this.action&&(t==="okay"?this.action.onOkay?.():this.action.onCancel?.(),(this.action.closeOnAction??!0)&&this.close("manual"))}clearTimer(){this.timerId&&(clearTimeout(this.timerId),this.timerId=void 0)}startTimer(){this.clearTimer(),!(!this.canAutoDismiss||this.remainingMs<=0)&&(this.startedAt=Date.now(),this.timerId=setTimeout(()=>this.close("auto"),this.remainingMs))}pauseTimer(){this.timerId&&(this.clearTimer(),this.remainingMs=Math.max(0,this.remainingMs-(Date.now()-this.startedAt)))}resumeTimer(){this.canAutoDismiss&&this.startTimer()}restartTimer(){this.clearTimer(),this.startTimer()}render(){return o.html`
|
|
2
|
+
<article
|
|
3
|
+
class="toast toast--${this.type}"
|
|
4
|
+
data-closing=${this.isClosing?"true":"false"}
|
|
5
|
+
role="status"
|
|
6
|
+
aria-live=${this.type==="danger"?"assertive":"polite"}
|
|
7
|
+
@mouseenter=${this.pauseTimer}
|
|
8
|
+
@mouseleave=${this.resumeTimer}
|
|
9
|
+
>
|
|
10
|
+
<span class="toast__icon">
|
|
11
|
+
<ui-icon name=${this.resolvedIcon} size="20"></ui-icon>
|
|
12
|
+
</span>
|
|
13
|
+
|
|
14
|
+
<div class="toast__content">
|
|
15
|
+
<h4 class=${this.title?"toast__title":"toast__title toast__title--as-text"}>
|
|
16
|
+
${this.resolvedTitle}
|
|
17
|
+
</h4>
|
|
18
|
+
${this.resolvedText?o.html`<p class="toast__text">${this.resolvedText}</p>`:o.nothing}
|
|
19
|
+
${this.hasActions?o.html`
|
|
20
|
+
<div class="toast__actions">
|
|
21
|
+
<logosphere-button
|
|
22
|
+
variant="outline"
|
|
23
|
+
theme="primary"
|
|
24
|
+
@click=${()=>this.onActionClick("okay")}
|
|
25
|
+
>
|
|
26
|
+
${this.action?.okayLabel||"Tamam"}
|
|
27
|
+
</logosphere-button>
|
|
28
|
+
<logosphere-button
|
|
29
|
+
variant="text"
|
|
30
|
+
theme="secondary"
|
|
31
|
+
@click=${()=>this.onActionClick("cancel")}
|
|
32
|
+
>
|
|
33
|
+
${this.action?.cancelLabel||"İptal"}
|
|
34
|
+
</logosphere-button>
|
|
35
|
+
</div>
|
|
36
|
+
`:o.nothing}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
${this.closeable?o.html`
|
|
40
|
+
<button class="toast__close" @click=${()=>this.close("manual")} aria-label="Close">
|
|
41
|
+
<ui-icon name="uil-times" size="20"></ui-icon>
|
|
42
|
+
</button>
|
|
43
|
+
`:o.nothing}
|
|
44
|
+
</article>
|
|
45
|
+
`}};exports.LogosphereToast.styles=[o.css`
|
|
46
|
+
${o.unsafeCSS(d)}
|
|
47
|
+
`];r([a.property({type:String})],exports.LogosphereToast.prototype,"type",2);r([a.property({type:String,attribute:"toast-title"})],exports.LogosphereToast.prototype,"title",2);r([a.property({type:String})],exports.LogosphereToast.prototype,"text",2);r([a.property({type:String})],exports.LogosphereToast.prototype,"icon",2);r([a.property({type:Boolean})],exports.LogosphereToast.prototype,"closeable",2);r([a.property({type:Number})],exports.LogosphereToast.prototype,"duration",2);r([a.property({type:Boolean})],exports.LogosphereToast.prototype,"autoDismiss",2);r([a.property({attribute:!1})],exports.LogosphereToast.prototype,"action",2);r([a.state()],exports.LogosphereToast.prototype,"isClosing",2);exports.LogosphereToast=r([a.customElement("logosphere-toast")],exports.LogosphereToast);const b=":host{position:fixed;top:16px;right:16px;z-index:9999;width:min(420px,calc(100vw - 24px));box-sizing:border-box}.toast-container{display:flex;flex-direction:column;gap:12px}";var y=Object.defineProperty,x=Object.getOwnPropertyDescriptor,p=(n,t,e,s)=>{for(var i=s>1?void 0:s?x(t,e):t,c=n.length-1,l;c>=0;c--)(l=n[c])&&(i=(s?l(t,e,i):l(i))||i);return s&&i&&y(t,e,i),i};const u=4;exports.LogosphereToastContainer=class extends o.LitElement{constructor(){super(...arguments),this.visibleToasts=[],this.queuedToasts=[]}show(t){const e=this.toToast(t);return this.visibleToasts.length<u?(this.visibleToasts=[e,...this.visibleToasts],e.id):(this.queuedToasts.push(e),e.id)}close(t){const e=this.visibleToasts.findIndex(s=>s.id===t);if(e!==-1){const s=this.visibleToasts.slice();s.splice(e,1),this.visibleToasts=s,this.dequeue();return}this.queuedToasts=this.queuedToasts.filter(s=>s.id!==t)}clear(){this.visibleToasts=[],this.queuedToasts=[]}dequeue(){if(!this.queuedToasts.length||this.visibleToasts.length>=u)return;const t=this.queuedToasts.shift();t&&(this.visibleToasts=[t,...this.visibleToasts])}toToast(t){return{id:t.id||this.createId(),type:t.type||"info",title:t.title||"",text:t.text,icon:t.icon||"",closeable:t.closeable??!0,autoDismiss:t.autoDismiss??!0,duration:t.duration??6e3,action:t.action}}createId(){return`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}render(){return o.html`
|
|
48
|
+
<div class="toast-container" role="region" aria-label="Notifications">
|
|
49
|
+
${m.repeat(this.visibleToasts,t=>t.id,t=>o.html`
|
|
50
|
+
<logosphere-toast
|
|
51
|
+
.type=${t.type}
|
|
52
|
+
.title=${t.title}
|
|
53
|
+
.text=${t.text}
|
|
54
|
+
.icon=${t.icon}
|
|
55
|
+
.closeable=${t.closeable}
|
|
56
|
+
.autoDismiss=${t.autoDismiss}
|
|
57
|
+
.duration=${t.duration}
|
|
58
|
+
.action=${t.action}
|
|
59
|
+
@toast-close=${()=>this.close(t.id)}
|
|
60
|
+
>
|
|
61
|
+
</logosphere-toast>
|
|
62
|
+
`)}
|
|
63
|
+
</div>
|
|
64
|
+
`}};exports.LogosphereToastContainer.styles=[o.css`${o.unsafeCSS(b)}`];p([a.state()],exports.LogosphereToastContainer.prototype,"visibleToasts",2);exports.LogosphereToastContainer=p([a.customElement("logosphere-toast-container")],exports.LogosphereToastContainer);class _{static show(t){return this.getContainer().show(t)}static success(t){return this.show({...t,type:"success"})}static danger(t){return this.show({...t,type:"danger",autoDismiss:!1})}static warning(t){return this.show({...t,type:"warning"})}static info(t){return this.show({...t,type:"info"})}static close(t){this.getContainer().close(t)}static clear(){this.getContainer().clear()}static getContainer(){if(this.container&&document.body.contains(this.container))return this.container;const t=document.querySelector("logosphere-toast-container");if(t&&t instanceof exports.LogosphereToastContainer)return this.container=t,t;const e=document.createElement("logosphere-toast-container");return document.body.appendChild(e),this.container=e,e}}exports.ToastService=_;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { unsafeCSS as g, css as f, LitElement as v, nothing as p, html as h } from "lit";
|
|
2
|
+
import { property as n, state as b, customElement as T } from "lit/decorators.js";
|
|
3
|
+
import { repeat as y } from "lit/directives/repeat.js";
|
|
4
|
+
import "./ui-icon-BMJNdIOq.js";
|
|
5
|
+
import "./button-Uu9oaieg.js";
|
|
6
|
+
const _ = ".toast{position:relative;display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:start;width:100%;box-sizing:border-box;border-radius:var(--radius-md);border-left:4px solid var(--toast-accent);background:#fff;box-shadow:var(--shadow-md);padding:var(--spacing-4);color:#3d3d3d;font-family:var(--font-family-base);animation:toast-enter .22s cubic-bezier(.2,.8,.2,1);transform-origin:top right}.toast__icon{display:inline-flex;margin-top:2px;color:var(--toast-accent)}.toast__content{min-width:0}.toast__title{margin:0;font-size:var(--font-size-lg);line-height:var(--line-height-tight);font-weight:var(--font-weight-semibold)}.toast__title--as-text{font-size:var(--font-size-base);line-height:var(--line-height-normal);font-weight:var(--font-weight-regular);color:#555}.toast__text{margin:4px 0 0;font-size:var(--font-size-base);line-height:var(--line-height-normal);color:#555}.toast__actions{display:flex;gap:10px;margin-top:12px}.toast__close{border:0;background:transparent;color:#5a5a5a;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;margin-top:2px}.toast__close:hover{color:#2f2f2f}.toast--success{--toast-accent: var(--color-success-active)}.toast--danger{--toast-accent: var(--color-danger-active)}.toast--warning{--toast-accent: var(--color-warning-active)}.toast--info{--toast-accent: var(--color-info-active)}.toast[data-closing=true]{pointer-events:none;animation:toast-exit .22s cubic-bezier(.4,0,1,1) forwards}@keyframes toast-enter{0%{opacity:0;transform:translate3d(18px,-8px,0) scale(.98)}to{opacity:1;transform:translateZ(0) scale(1)}}@keyframes toast-exit{0%{opacity:1;transform:translateZ(0) scale(1);max-height:240px;margin-bottom:0}to{opacity:0;transform:translate3d(20px,-6px,0) scale(.97);max-height:0;margin-bottom:-12px}}";
|
|
7
|
+
var $ = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (t, e, s, r) => {
|
|
8
|
+
for (var i = r > 1 ? void 0 : r ? w(e, s) : e, c = t.length - 1, l; c >= 0; c--)
|
|
9
|
+
(l = t[c]) && (i = (r ? l(e, s, i) : l(i)) || i);
|
|
10
|
+
return r && i && $(e, s, i), i;
|
|
11
|
+
};
|
|
12
|
+
const m = 6e3, C = 220, D = {
|
|
13
|
+
success: "uil-check-circle",
|
|
14
|
+
danger: "uil-exclamation-octagon",
|
|
15
|
+
warning: "uil-exclamation-triangle",
|
|
16
|
+
info: "uil-info-circle"
|
|
17
|
+
};
|
|
18
|
+
let o = class extends v {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.type = "info", this.title = "", this.text = "", this.icon = "", this.closeable = !0, this.duration = m, this.autoDismiss = !0, this.isClosing = !1, this.remainingMs = m, this.startedAt = 0;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback(), this.remainingMs = this.duration, this.startTimer();
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
super.disconnectedCallback(), this.clearTimer(), this.closeTimerId && (clearTimeout(this.closeTimerId), this.closeTimerId = void 0);
|
|
27
|
+
}
|
|
28
|
+
updated(t) {
|
|
29
|
+
t.has("duration") && (this.remainingMs = this.duration, this.restartTimer()), (t.has("action") || t.has("autoDismiss") || t.has("type")) && this.restartTimer();
|
|
30
|
+
}
|
|
31
|
+
close(t = "manual") {
|
|
32
|
+
this.isClosing || (this.clearTimer(), this.isClosing = !0, this.closeTimerId = setTimeout(() => {
|
|
33
|
+
this.dispatchEvent(
|
|
34
|
+
new CustomEvent("toast-close", {
|
|
35
|
+
detail: { reason: t },
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
composed: !0
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}, C));
|
|
41
|
+
}
|
|
42
|
+
get canAutoDismiss() {
|
|
43
|
+
return this.autoDismiss && this.type !== "danger" && !this.hasActions;
|
|
44
|
+
}
|
|
45
|
+
get resolvedTitle() {
|
|
46
|
+
return this.title || this.text;
|
|
47
|
+
}
|
|
48
|
+
get resolvedText() {
|
|
49
|
+
return this.title ? this.text : "";
|
|
50
|
+
}
|
|
51
|
+
get resolvedIcon() {
|
|
52
|
+
return this.icon || D[this.type];
|
|
53
|
+
}
|
|
54
|
+
get hasActions() {
|
|
55
|
+
return !!this.action;
|
|
56
|
+
}
|
|
57
|
+
onActionClick(t) {
|
|
58
|
+
this.action && (t === "okay" ? this.action.onOkay?.() : this.action.onCancel?.(), (this.action.closeOnAction ?? !0) && this.close("manual"));
|
|
59
|
+
}
|
|
60
|
+
clearTimer() {
|
|
61
|
+
this.timerId && (clearTimeout(this.timerId), this.timerId = void 0);
|
|
62
|
+
}
|
|
63
|
+
startTimer() {
|
|
64
|
+
this.clearTimer(), !(!this.canAutoDismiss || this.remainingMs <= 0) && (this.startedAt = Date.now(), this.timerId = setTimeout(() => this.close("auto"), this.remainingMs));
|
|
65
|
+
}
|
|
66
|
+
pauseTimer() {
|
|
67
|
+
this.timerId && (this.clearTimer(), this.remainingMs = Math.max(0, this.remainingMs - (Date.now() - this.startedAt)));
|
|
68
|
+
}
|
|
69
|
+
resumeTimer() {
|
|
70
|
+
this.canAutoDismiss && this.startTimer();
|
|
71
|
+
}
|
|
72
|
+
restartTimer() {
|
|
73
|
+
this.clearTimer(), this.startTimer();
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return h`
|
|
77
|
+
<article
|
|
78
|
+
class="toast toast--${this.type}"
|
|
79
|
+
data-closing=${this.isClosing ? "true" : "false"}
|
|
80
|
+
role="status"
|
|
81
|
+
aria-live=${this.type === "danger" ? "assertive" : "polite"}
|
|
82
|
+
@mouseenter=${this.pauseTimer}
|
|
83
|
+
@mouseleave=${this.resumeTimer}
|
|
84
|
+
>
|
|
85
|
+
<span class="toast__icon">
|
|
86
|
+
<ui-icon name=${this.resolvedIcon} size="20"></ui-icon>
|
|
87
|
+
</span>
|
|
88
|
+
|
|
89
|
+
<div class="toast__content">
|
|
90
|
+
<h4 class=${this.title ? "toast__title" : "toast__title toast__title--as-text"}>
|
|
91
|
+
${this.resolvedTitle}
|
|
92
|
+
</h4>
|
|
93
|
+
${this.resolvedText ? h`<p class="toast__text">${this.resolvedText}</p>` : p}
|
|
94
|
+
${this.hasActions ? h`
|
|
95
|
+
<div class="toast__actions">
|
|
96
|
+
<logosphere-button
|
|
97
|
+
variant="outline"
|
|
98
|
+
theme="primary"
|
|
99
|
+
@click=${() => this.onActionClick("okay")}
|
|
100
|
+
>
|
|
101
|
+
${this.action?.okayLabel || "Tamam"}
|
|
102
|
+
</logosphere-button>
|
|
103
|
+
<logosphere-button
|
|
104
|
+
variant="text"
|
|
105
|
+
theme="secondary"
|
|
106
|
+
@click=${() => this.onActionClick("cancel")}
|
|
107
|
+
>
|
|
108
|
+
${this.action?.cancelLabel || "İptal"}
|
|
109
|
+
</logosphere-button>
|
|
110
|
+
</div>
|
|
111
|
+
` : p}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
${this.closeable ? h`
|
|
115
|
+
<button class="toast__close" @click=${() => this.close("manual")} aria-label="Close">
|
|
116
|
+
<ui-icon name="uil-times" size="20"></ui-icon>
|
|
117
|
+
</button>
|
|
118
|
+
` : p}
|
|
119
|
+
</article>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
o.styles = [
|
|
124
|
+
f`
|
|
125
|
+
${g(_)}
|
|
126
|
+
`
|
|
127
|
+
];
|
|
128
|
+
a([
|
|
129
|
+
n({ type: String })
|
|
130
|
+
], o.prototype, "type", 2);
|
|
131
|
+
a([
|
|
132
|
+
n({ type: String, attribute: "toast-title" })
|
|
133
|
+
], o.prototype, "title", 2);
|
|
134
|
+
a([
|
|
135
|
+
n({ type: String })
|
|
136
|
+
], o.prototype, "text", 2);
|
|
137
|
+
a([
|
|
138
|
+
n({ type: String })
|
|
139
|
+
], o.prototype, "icon", 2);
|
|
140
|
+
a([
|
|
141
|
+
n({ type: Boolean })
|
|
142
|
+
], o.prototype, "closeable", 2);
|
|
143
|
+
a([
|
|
144
|
+
n({ type: Number })
|
|
145
|
+
], o.prototype, "duration", 2);
|
|
146
|
+
a([
|
|
147
|
+
n({ type: Boolean })
|
|
148
|
+
], o.prototype, "autoDismiss", 2);
|
|
149
|
+
a([
|
|
150
|
+
n({ attribute: !1 })
|
|
151
|
+
], o.prototype, "action", 2);
|
|
152
|
+
a([
|
|
153
|
+
b()
|
|
154
|
+
], o.prototype, "isClosing", 2);
|
|
155
|
+
o = a([
|
|
156
|
+
T("logosphere-toast")
|
|
157
|
+
], o);
|
|
158
|
+
const I = ":host{position:fixed;top:16px;right:16px;z-index:9999;width:min(420px,calc(100vw - 24px));box-sizing:border-box}.toast-container{display:flex;flex-direction:column;gap:12px}";
|
|
159
|
+
var A = Object.defineProperty, S = Object.getOwnPropertyDescriptor, x = (t, e, s, r) => {
|
|
160
|
+
for (var i = r > 1 ? void 0 : r ? S(e, s) : e, c = t.length - 1, l; c >= 0; c--)
|
|
161
|
+
(l = t[c]) && (i = (r ? l(e, s, i) : l(i)) || i);
|
|
162
|
+
return r && i && A(e, s, i), i;
|
|
163
|
+
};
|
|
164
|
+
const d = 4;
|
|
165
|
+
let u = class extends v {
|
|
166
|
+
constructor() {
|
|
167
|
+
super(...arguments), this.visibleToasts = [], this.queuedToasts = [];
|
|
168
|
+
}
|
|
169
|
+
show(t) {
|
|
170
|
+
const e = this.toToast(t);
|
|
171
|
+
return this.visibleToasts.length < d ? (this.visibleToasts = [e, ...this.visibleToasts], e.id) : (this.queuedToasts.push(e), e.id);
|
|
172
|
+
}
|
|
173
|
+
close(t) {
|
|
174
|
+
const e = this.visibleToasts.findIndex((s) => s.id === t);
|
|
175
|
+
if (e !== -1) {
|
|
176
|
+
const s = this.visibleToasts.slice();
|
|
177
|
+
s.splice(e, 1), this.visibleToasts = s, this.dequeue();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.queuedToasts = this.queuedToasts.filter((s) => s.id !== t);
|
|
181
|
+
}
|
|
182
|
+
clear() {
|
|
183
|
+
this.visibleToasts = [], this.queuedToasts = [];
|
|
184
|
+
}
|
|
185
|
+
dequeue() {
|
|
186
|
+
if (!this.queuedToasts.length || this.visibleToasts.length >= d) return;
|
|
187
|
+
const t = this.queuedToasts.shift();
|
|
188
|
+
t && (this.visibleToasts = [t, ...this.visibleToasts]);
|
|
189
|
+
}
|
|
190
|
+
toToast(t) {
|
|
191
|
+
return {
|
|
192
|
+
id: t.id || this.createId(),
|
|
193
|
+
type: t.type || "info",
|
|
194
|
+
title: t.title || "",
|
|
195
|
+
text: t.text,
|
|
196
|
+
icon: t.icon || "",
|
|
197
|
+
closeable: t.closeable ?? !0,
|
|
198
|
+
autoDismiss: t.autoDismiss ?? !0,
|
|
199
|
+
duration: t.duration ?? 6e3,
|
|
200
|
+
action: t.action
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
createId() {
|
|
204
|
+
return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
205
|
+
}
|
|
206
|
+
render() {
|
|
207
|
+
return h`
|
|
208
|
+
<div class="toast-container" role="region" aria-label="Notifications">
|
|
209
|
+
${y(
|
|
210
|
+
this.visibleToasts,
|
|
211
|
+
(t) => t.id,
|
|
212
|
+
(t) => h`
|
|
213
|
+
<logosphere-toast
|
|
214
|
+
.type=${t.type}
|
|
215
|
+
.title=${t.title}
|
|
216
|
+
.text=${t.text}
|
|
217
|
+
.icon=${t.icon}
|
|
218
|
+
.closeable=${t.closeable}
|
|
219
|
+
.autoDismiss=${t.autoDismiss}
|
|
220
|
+
.duration=${t.duration}
|
|
221
|
+
.action=${t.action}
|
|
222
|
+
@toast-close=${() => this.close(t.id)}
|
|
223
|
+
>
|
|
224
|
+
</logosphere-toast>
|
|
225
|
+
`
|
|
226
|
+
)}
|
|
227
|
+
</div>
|
|
228
|
+
`;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
u.styles = [f`${g(I)}`];
|
|
232
|
+
x([
|
|
233
|
+
b()
|
|
234
|
+
], u.prototype, "visibleToasts", 2);
|
|
235
|
+
u = x([
|
|
236
|
+
T("logosphere-toast-container")
|
|
237
|
+
], u);
|
|
238
|
+
class E {
|
|
239
|
+
static show(e) {
|
|
240
|
+
return this.getContainer().show(e);
|
|
241
|
+
}
|
|
242
|
+
static success(e) {
|
|
243
|
+
return this.show({ ...e, type: "success" });
|
|
244
|
+
}
|
|
245
|
+
static danger(e) {
|
|
246
|
+
return this.show({ ...e, type: "danger", autoDismiss: !1 });
|
|
247
|
+
}
|
|
248
|
+
static warning(e) {
|
|
249
|
+
return this.show({ ...e, type: "warning" });
|
|
250
|
+
}
|
|
251
|
+
static info(e) {
|
|
252
|
+
return this.show({ ...e, type: "info" });
|
|
253
|
+
}
|
|
254
|
+
static close(e) {
|
|
255
|
+
this.getContainer().close(e);
|
|
256
|
+
}
|
|
257
|
+
static clear() {
|
|
258
|
+
this.getContainer().clear();
|
|
259
|
+
}
|
|
260
|
+
static getContainer() {
|
|
261
|
+
if (this.container && document.body.contains(this.container))
|
|
262
|
+
return this.container;
|
|
263
|
+
const e = document.querySelector("logosphere-toast-container");
|
|
264
|
+
if (e && e instanceof u)
|
|
265
|
+
return this.container = e, e;
|
|
266
|
+
const s = document.createElement("logosphere-toast-container");
|
|
267
|
+
return document.body.appendChild(s), this.container = s, s;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
export {
|
|
271
|
+
o as L,
|
|
272
|
+
E as T,
|
|
273
|
+
u as a
|
|
274
|
+
};
|
package/dist/toast.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toast-container-6t6yEP9Y.cjs");Object.defineProperty(exports,"LogosphereToast",{enumerable:!0,get:()=>e.LogosphereToast});Object.defineProperty(exports,"LogosphereToastContainer",{enumerable:!0,get:()=>e.LogosphereToastContainer});exports.ToastService=e.ToastService;
|