@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,204 @@
|
|
|
1
|
+
import { unsafeCSS as _, css as u, LitElement as v, nothing as b, html as d } from "lit";
|
|
2
|
+
import { property as c, state as h, query as f, customElement as g } from "lit/decorators.js";
|
|
3
|
+
const m = ".tab{width:100%;font-family:var(--font-family-base)}.tab__list{display:flex;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid var(--color-border);scroll-behavior:smooth;-webkit-overflow-scrolling:touch;scrollbar-width:none;-ms-overflow-style:none}.tab__list::-webkit-scrollbar{display:none}.tab__button{display:inline-flex;flex-direction:row;align-items:center;gap:var(--spacing-2);padding:var(--spacing-3) var(--spacing-4);min-width:120px;position:relative;cursor:pointer;border:none;border-bottom:2px solid transparent;background:transparent;font-family:var(--font-family-base);white-space:nowrap;transition:background-color var(--transition-speed-base) var(--transition-timing),border-color var(--transition-speed-base) var(--transition-timing)}.tab__button:hover:not(.tab__button--disabled):not(.tab__button--active){background-color:var(--color-light)}.tab__button--active{border-bottom-color:var(--color-primary)}.tab__button--disabled{cursor:not-allowed;opacity:.4;pointer-events:none}.tab__icon{font-size:var(--font-size-xl);flex-shrink:0;color:inherit;line-height:1}.tab__content{display:flex;flex-direction:column;align-items:flex-start}.tab__label{font-weight:var(--font-weight-medium);font-size:var(--font-size-sm);color:var(--color-body-text)}.tab__label--inactive{color:var(--color-tertiary)}.tab__description{font-size:var(--font-size-xs);text-align:left;color:var(--color-tertiary)}.tab__description--active{color:var(--color-secondary)}.tab__panel{padding:var(--spacing-4);outline:none}.tab__panel--hidden{display:none}.tab--segmented .tab__list{display:inline-flex;position:relative;border-bottom:none;background-color:var(--color-light);border-radius:var(--radius-base);padding:0;gap:0;overflow:visible}.tab__segment-pill{position:absolute;top:0;bottom:0;left:0;width:0;background-color:var(--color-white, #ffffff);border:1px solid var(--color-border);border-radius:var(--radius-base);pointer-events:none;z-index:0;transition:transform .22s cubic-bezier(.35,0,.25,1),width .22s cubic-bezier(.35,0,.25,1)}.tab--segmented .tab__button{position:relative;z-index:1;min-width:unset;height:32px;padding:var(--spacing-1) var(--spacing-3);border:1px solid transparent;border-bottom:1px solid transparent;border-radius:var(--radius-base);background:transparent;transition:color var(--transition-speed-base) var(--transition-timing)}.tab--segmented .tab__button:hover:not(.tab__button--disabled):not(.tab__button--active){background-color:transparent}.tab--segmented .tab__button--active{background-color:transparent;border-color:transparent}.tab--segmented .tab__label{color:var(--color-secondary);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);line-height:20px;letter-spacing:-.14px}.tab--segmented .tab__label--inactive{color:var(--color-secondary)}.tab--segmented .tab__button--active .tab__label,.tab--segmented .tab__button--active .tab__label--inactive{color:var(--color-primary)}.tab--segmented .tab__icon{color:inherit;font-size:var(--font-size-base)}.tab--segmented .tab__panels{margin-top:var(--spacing-3)}.tab--segmented .tab__panel{padding:0}";
|
|
4
|
+
var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, l = (t, i, e, a) => {
|
|
5
|
+
for (var s = a > 1 ? void 0 : a ? w(i, e) : i, o = t.length - 1, r; o >= 0; o--)
|
|
6
|
+
(r = t[o]) && (s = (a ? r(i, e, s) : r(s)) || s);
|
|
7
|
+
return a && s && y(i, e, s), s;
|
|
8
|
+
};
|
|
9
|
+
let n = class extends v {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.tabs = [], this.activeTab = "", this.lazy = !0, this.variant = "default", this._focusedIndex = 0, this._renderedTabs = /* @__PURE__ */ new Set(), this._pillInitialized = !1;
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback(), !this.activeTab && this.tabs.length > 0 && (this.activeTab = this.tabs[0].id);
|
|
15
|
+
}
|
|
16
|
+
disconnectedCallback() {
|
|
17
|
+
super.disconnectedCallback(), this._pillResizeObserver?.disconnect(), this._pillResizeObserver = void 0;
|
|
18
|
+
}
|
|
19
|
+
willUpdate(t) {
|
|
20
|
+
if (super.willUpdate(t), t.has("activeTab") && this.activeTab) {
|
|
21
|
+
this._renderedTabs.add(this.activeTab);
|
|
22
|
+
const i = this.tabs.findIndex((e) => e.id === this.activeTab);
|
|
23
|
+
i !== -1 && (this._focusedIndex = i);
|
|
24
|
+
}
|
|
25
|
+
t.has("tabs") && this.tabs.length > 0 && (this.tabs.some((e) => e.id === this.activeTab) || (this.activeTab = this.tabs[0].id), this._focusedIndex = this.tabs.findIndex((e) => e.id === this.activeTab));
|
|
26
|
+
}
|
|
27
|
+
// ==================== EVENTS ====================
|
|
28
|
+
handleTabClick(t, i) {
|
|
29
|
+
if (i) return;
|
|
30
|
+
const e = this.activeTab;
|
|
31
|
+
this.activeTab = t, this._focusedIndex = this.tabs.findIndex((a) => a.id === t), this.dispatchEvent(
|
|
32
|
+
new CustomEvent("tab-change", {
|
|
33
|
+
detail: { oldTab: e, newTab: t },
|
|
34
|
+
bubbles: !0,
|
|
35
|
+
composed: !0
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
handleKeyDown(t) {
|
|
40
|
+
const { tabs: i } = this;
|
|
41
|
+
if (i.filter((s) => !s.disabled).length === 0) return;
|
|
42
|
+
let e = this._focusedIndex;
|
|
43
|
+
const a = this._focusedIndex;
|
|
44
|
+
switch (t.key) {
|
|
45
|
+
case "ArrowLeft":
|
|
46
|
+
t.preventDefault();
|
|
47
|
+
do
|
|
48
|
+
e = e > 0 ? e - 1 : i.length - 1;
|
|
49
|
+
while (i[e]?.disabled && e !== a);
|
|
50
|
+
break;
|
|
51
|
+
case "ArrowRight":
|
|
52
|
+
t.preventDefault();
|
|
53
|
+
do
|
|
54
|
+
e = e < i.length - 1 ? e + 1 : 0;
|
|
55
|
+
while (i[e]?.disabled && e !== a);
|
|
56
|
+
break;
|
|
57
|
+
case "Home":
|
|
58
|
+
for (t.preventDefault(), e = 0; i[e]?.disabled && e < i.length - 1; ) e++;
|
|
59
|
+
break;
|
|
60
|
+
case "End":
|
|
61
|
+
for (t.preventDefault(), e = i.length - 1; i[e]?.disabled && e > 0; ) e--;
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (e !== this._focusedIndex && !i[e]?.disabled) {
|
|
67
|
+
const s = this.activeTab;
|
|
68
|
+
this._focusedIndex = e, this.activeTab = i[e].id, this.updateComplete.then(() => {
|
|
69
|
+
this.shadowRoot?.querySelector(
|
|
70
|
+
`[role="tab"][data-tab-id="${i[e].id}"]`
|
|
71
|
+
)?.focus();
|
|
72
|
+
}), this.dispatchEvent(
|
|
73
|
+
new CustomEvent("tab-change", {
|
|
74
|
+
detail: { oldTab: s, newTab: i[e].id },
|
|
75
|
+
bubbles: !0,
|
|
76
|
+
composed: !0
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
updated(t) {
|
|
82
|
+
super.updated(t), this.variant === "segmented" && (this._ensurePillObserver(), this._updateSegmentPill());
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Observe the tablist so the pill is repositioned whenever the list gains or
|
|
86
|
+
* changes size — this covers the cases where the first render happens while
|
|
87
|
+
* the tab is hidden (nested/lazy panels) or before web fonts load, when
|
|
88
|
+
* layout measurements would otherwise be 0 / stale.
|
|
89
|
+
*/
|
|
90
|
+
_ensurePillObserver() {
|
|
91
|
+
if (this._pillResizeObserver) return;
|
|
92
|
+
const t = this.shadowRoot?.querySelector(".tab__list");
|
|
93
|
+
!t || typeof ResizeObserver > "u" || (this._pillResizeObserver = new ResizeObserver(() => this._updateSegmentPill()), this._pillResizeObserver.observe(t));
|
|
94
|
+
}
|
|
95
|
+
_updateSegmentPill() {
|
|
96
|
+
const t = this.shadowRoot?.querySelector(".tab__segment-pill"), i = this.shadowRoot?.querySelector(".tab__button--active"), e = this.shadowRoot?.querySelector(".tab__list");
|
|
97
|
+
if (!t || !i || !e) return;
|
|
98
|
+
const a = e.getBoundingClientRect(), s = i.getBoundingClientRect();
|
|
99
|
+
if (s.width === 0) return;
|
|
100
|
+
const o = parseFloat(getComputedStyle(e).paddingLeft) || 0, r = s.left - a.left - e.clientLeft - o + e.scrollLeft, p = s.width;
|
|
101
|
+
this._pillInitialized ? (t.style.transform = `translateX(${r}px)`, t.style.width = `${p}px`) : (t.style.transition = "none", t.style.transform = `translateX(${r}px)`, t.style.width = `${p}px`, requestAnimationFrame(() => {
|
|
102
|
+
t.style.transition = "";
|
|
103
|
+
}), this._pillInitialized = !0);
|
|
104
|
+
}
|
|
105
|
+
scrollTabIntoView(t) {
|
|
106
|
+
this.updateComplete.then(() => {
|
|
107
|
+
const i = this.shadowRoot?.querySelector(
|
|
108
|
+
`[role="tab"][data-tab-id="${t}"]`
|
|
109
|
+
);
|
|
110
|
+
if (i && this.tablist) {
|
|
111
|
+
const e = this.tablist.getBoundingClientRect(), a = i.getBoundingClientRect();
|
|
112
|
+
a.left < e.left ? this.tablist.scrollLeft -= e.left - a.left + 16 : a.right > e.right && (this.tablist.scrollLeft += a.right - e.right + 16);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// ==================== RENDER ====================
|
|
117
|
+
renderTabButton(t, i) {
|
|
118
|
+
const e = this.activeTab === t.id, a = this._focusedIndex === i, s = [
|
|
119
|
+
"tab__button",
|
|
120
|
+
e ? "tab__button--active" : "",
|
|
121
|
+
t.disabled ? "tab__button--disabled" : ""
|
|
122
|
+
].filter(Boolean).join(" "), o = ["tab__label", e ? "" : "tab__label--inactive"].filter(Boolean).join(" "), r = ["tab__description", e ? "tab__description--active" : ""].filter(Boolean).join(" ");
|
|
123
|
+
return d`
|
|
124
|
+
<button
|
|
125
|
+
role="tab"
|
|
126
|
+
class=${s}
|
|
127
|
+
data-tab-id=${t.id}
|
|
128
|
+
aria-selected=${e ? "true" : "false"}
|
|
129
|
+
aria-controls="panel-${t.id}"
|
|
130
|
+
tabindex=${e || a ? "0" : "-1"}
|
|
131
|
+
?disabled=${t.disabled}
|
|
132
|
+
@click=${() => this.handleTabClick(t.id, t.disabled)}
|
|
133
|
+
@focus=${() => this.scrollTabIntoView(t.id)}
|
|
134
|
+
>
|
|
135
|
+
${t.icon ? d`<i class="${t.icon} tab__icon"></i>` : b}
|
|
136
|
+
<div class="tab__content">
|
|
137
|
+
<span class=${o}>${t.label}</span>
|
|
138
|
+
${t.description ? d`<span class=${r}>${t.description}</span>` : b}
|
|
139
|
+
</div>
|
|
140
|
+
</button>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
renderTabPanel(t) {
|
|
144
|
+
const i = this.activeTab === t.id;
|
|
145
|
+
if (!(!this.lazy || this._renderedTabs.has(t.id))) return b;
|
|
146
|
+
const a = ["tab__panel", i ? "" : "tab__panel--hidden"].filter(Boolean).join(" ");
|
|
147
|
+
return d`
|
|
148
|
+
<div
|
|
149
|
+
role="tabpanel"
|
|
150
|
+
id="panel-${t.id}"
|
|
151
|
+
aria-labelledby="tab-${t.id}"
|
|
152
|
+
class=${a}
|
|
153
|
+
tabindex="0"
|
|
154
|
+
>
|
|
155
|
+
<slot name=${`panel-${t.id}`}>
|
|
156
|
+
${typeof t.content == "string" ? d`${t.content}` : b}
|
|
157
|
+
</slot>
|
|
158
|
+
</div>
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
return d`
|
|
163
|
+
<div class="tab tab--${this.variant}">
|
|
164
|
+
<div role="tablist" aria-label="Tabs" class="tab__list" @keydown=${this.handleKeyDown}>
|
|
165
|
+
${this.variant === "segmented" ? d`<span class="tab__segment-pill" aria-hidden="true"></span>` : b}
|
|
166
|
+
${this.tabs.map((t, i) => this.renderTabButton(t, i))}
|
|
167
|
+
</div>
|
|
168
|
+
<div class="tab__panels">${this.tabs.map((t) => this.renderTabPanel(t))}</div>
|
|
169
|
+
</div>
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
n.styles = [
|
|
174
|
+
u`
|
|
175
|
+
${_(m)}
|
|
176
|
+
`
|
|
177
|
+
];
|
|
178
|
+
l([
|
|
179
|
+
c({ type: Array })
|
|
180
|
+
], n.prototype, "tabs", 2);
|
|
181
|
+
l([
|
|
182
|
+
c({ type: String })
|
|
183
|
+
], n.prototype, "activeTab", 2);
|
|
184
|
+
l([
|
|
185
|
+
c({ type: Boolean })
|
|
186
|
+
], n.prototype, "lazy", 2);
|
|
187
|
+
l([
|
|
188
|
+
c({ type: String })
|
|
189
|
+
], n.prototype, "variant", 2);
|
|
190
|
+
l([
|
|
191
|
+
h()
|
|
192
|
+
], n.prototype, "_focusedIndex", 2);
|
|
193
|
+
l([
|
|
194
|
+
h()
|
|
195
|
+
], n.prototype, "_renderedTabs", 2);
|
|
196
|
+
l([
|
|
197
|
+
f('[role="tablist"]')
|
|
198
|
+
], n.prototype, "tablist", 2);
|
|
199
|
+
n = l([
|
|
200
|
+
g("logosphere-tab")
|
|
201
|
+
], n);
|
|
202
|
+
export {
|
|
203
|
+
n as L
|
|
204
|
+
};
|
package/dist/tab.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tab-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tab-CDMcFHvP.cjs");Object.defineProperty(exports,"LogosphereTab",{enumerable:!0,get:()=>e.LogosphereTab});
|
package/dist/tab.js
CHANGED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { unsafeCSS as c, css as y, LitElement as m, nothing as n, html as u } from "lit";
|
|
2
|
+
import { query as _, property as i, state as d, customElement as x } from "lit/decorators.js";
|
|
3
|
+
import { live as g } from "lit/directives/live.js";
|
|
4
|
+
import "./formfield-O327HYt0.js";
|
|
5
|
+
import "./ui-icon-BMJNdIOq.js";
|
|
6
|
+
const f = ".textarea__wrap{position:relative;flex:1;min-width:0}.textarea__field{display:block;width:100%;background:transparent;border:none;outline:none;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);box-sizing:border-box}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__counter{position:absolute;bottom:5px;right:18px;font-size:11px;font-weight:var(--font-weight-medium);line-height:1rem;letter-spacing:-.11px;color:var(--color-secondary);background-color:var(--color-light-bg-2);border-radius:var(--radius-sm, 4px);padding:0 var(--spacing-1);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none}.textarea__wrap--no-grip .textarea__counter{right:4px}.textarea__clear-btn{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;outline:none;line-height:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-body-text)}";
|
|
7
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, r = (e, a, s, o) => {
|
|
8
|
+
for (var l = o > 1 ? void 0 : o ? b(a, s) : a, h = e.length - 1, p; h >= 0; h--)
|
|
9
|
+
(p = e[h]) && (l = (o ? p(a, s, l) : p(l)) || l);
|
|
10
|
+
return o && l && v(a, s, l), l;
|
|
11
|
+
};
|
|
12
|
+
let t = class extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.value = "", this.placeholder = "", this.name = "", this.autocomplete = "", this.rows = 3, this.maxRows = 8, this.wrap = "soft", this.resize = "vertical", this.autoResize = !0, this.size = "default", this.variant = "default", this.label = "", this.helper = "", this.error = "", this.required = !1, this.disabled = !1, this.readonly = !1, this._internalError = "", this._charCount = 0, this.handleInput = (e) => {
|
|
15
|
+
const a = e.target;
|
|
16
|
+
this.value = a.value, this._charCount = this.value.length, this.autoResize && this.adjustHeight(), this._internalError && (this._internalError = "", this._textareaElement.setCustomValidity("")), this.dispatchEvent(new CustomEvent("input", {
|
|
17
|
+
bubbles: !0,
|
|
18
|
+
composed: !0,
|
|
19
|
+
detail: { value: this.value, originalEvent: e }
|
|
20
|
+
}));
|
|
21
|
+
}, this.handleChange = (e) => {
|
|
22
|
+
const a = e.target;
|
|
23
|
+
this.value = a.value, a.checkValidity() || (this._internalError = a.validationMessage), this.dispatchEvent(new CustomEvent("change", {
|
|
24
|
+
bubbles: !0,
|
|
25
|
+
composed: !0,
|
|
26
|
+
detail: { value: this.value, originalEvent: e }
|
|
27
|
+
}));
|
|
28
|
+
}, this.handleKeyDown = (e) => {
|
|
29
|
+
this.dispatchEvent(new CustomEvent("keydown", {
|
|
30
|
+
bubbles: !0,
|
|
31
|
+
composed: !0,
|
|
32
|
+
detail: { key: e.key, originalEvent: e }
|
|
33
|
+
}));
|
|
34
|
+
}, this.handleKeyUp = (e) => {
|
|
35
|
+
this.dispatchEvent(new CustomEvent("keyup", {
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
composed: !0,
|
|
38
|
+
detail: { key: e.key, originalEvent: e }
|
|
39
|
+
}));
|
|
40
|
+
}, this.handleClear = () => {
|
|
41
|
+
this.value = "", this._charCount = 0, this._textareaElement && (this._textareaElement.value = "", this.autoResize && this.adjustHeight()), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("input", {
|
|
42
|
+
bubbles: !0,
|
|
43
|
+
composed: !0,
|
|
44
|
+
detail: { value: "", originalEvent: null }
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
get textareaElement() {
|
|
49
|
+
return this._textareaElement;
|
|
50
|
+
}
|
|
51
|
+
focus() {
|
|
52
|
+
this._textareaElement?.focus();
|
|
53
|
+
}
|
|
54
|
+
blur() {
|
|
55
|
+
this._textareaElement?.blur();
|
|
56
|
+
}
|
|
57
|
+
select() {
|
|
58
|
+
this._textareaElement?.select();
|
|
59
|
+
}
|
|
60
|
+
setSelectionRange(e, a, s) {
|
|
61
|
+
this._textareaElement?.setSelectionRange(e, a, s);
|
|
62
|
+
}
|
|
63
|
+
checkValidity() {
|
|
64
|
+
return this._textareaElement?.checkValidity() ?? !0;
|
|
65
|
+
}
|
|
66
|
+
reportValidity() {
|
|
67
|
+
return this._textareaElement?.reportValidity() ?? !0;
|
|
68
|
+
}
|
|
69
|
+
setCustomValidity(e) {
|
|
70
|
+
this._textareaElement?.setCustomValidity(e), this._internalError = e, this.requestUpdate();
|
|
71
|
+
}
|
|
72
|
+
adjustHeight() {
|
|
73
|
+
if (!this.autoResize || !this._textareaElement) return;
|
|
74
|
+
const e = this._textareaElement;
|
|
75
|
+
e.style.height = "", e.style.overflow = "hidden";
|
|
76
|
+
const a = e.scrollHeight;
|
|
77
|
+
if (a !== 0) {
|
|
78
|
+
if (this.maxRows > 0) {
|
|
79
|
+
const s = parseFloat(getComputedStyle(e).lineHeight) || 20, o = Math.round(s * this.maxRows);
|
|
80
|
+
if (a >= o) {
|
|
81
|
+
e.style.height = `${o}px`, e.style.overflow = "auto";
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
e.style.height = `${a}px`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getResizeClass() {
|
|
89
|
+
return this.autoResize ? "textarea__field--auto-resize" : {
|
|
90
|
+
none: "textarea__field--resize-none",
|
|
91
|
+
vertical: "textarea__field--resize-vertical",
|
|
92
|
+
horizontal: "textarea__field--resize-horizontal",
|
|
93
|
+
both: "textarea__field--resize-both"
|
|
94
|
+
}[this.resize];
|
|
95
|
+
}
|
|
96
|
+
firstUpdated() {
|
|
97
|
+
this._charCount = this.value.length, this.autoResize && requestAnimationFrame(() => this.adjustHeight());
|
|
98
|
+
}
|
|
99
|
+
updated(e) {
|
|
100
|
+
super.updated(e), e.has("value") && (this._charCount = this.value.length, this.autoResize && this.adjustHeight());
|
|
101
|
+
}
|
|
102
|
+
getWrapClass() {
|
|
103
|
+
return this.autoResize || this.resize === "none" ? "textarea__wrap textarea__wrap--no-grip" : "textarea__wrap";
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
const e = this.error || this._internalError, a = !!this.value && !this.disabled && !this.readonly, s = this.maxlength != null, o = `textarea__field ${this.getResizeClass()}`;
|
|
107
|
+
return u`
|
|
108
|
+
<logosphere-formfield
|
|
109
|
+
.label=${this.label}
|
|
110
|
+
.helper=${this.helper}
|
|
111
|
+
.error=${e}
|
|
112
|
+
.required=${this.required}
|
|
113
|
+
.disabled=${this.disabled}
|
|
114
|
+
.readonly=${this.readonly}
|
|
115
|
+
.size=${this.size}
|
|
116
|
+
.variant=${this.variant}
|
|
117
|
+
.multiline=${!0}
|
|
118
|
+
>
|
|
119
|
+
<slot name="prefix" slot="prefix"></slot>
|
|
120
|
+
<div class="${this.getWrapClass()}">
|
|
121
|
+
<textarea
|
|
122
|
+
class="${o}"
|
|
123
|
+
.value=${g(this.value)}
|
|
124
|
+
placeholder=${this.placeholder || n}
|
|
125
|
+
name=${this.name || n}
|
|
126
|
+
autocomplete=${this.autocomplete || n}
|
|
127
|
+
?required=${this.required}
|
|
128
|
+
?disabled=${this.disabled}
|
|
129
|
+
?readonly=${this.readonly}
|
|
130
|
+
minlength=${this.minlength ?? n}
|
|
131
|
+
maxlength=${this.maxlength ?? n}
|
|
132
|
+
rows=${this.rows}
|
|
133
|
+
cols=${this.cols ?? n}
|
|
134
|
+
wrap=${this.wrap}
|
|
135
|
+
@input=${this.handleInput}
|
|
136
|
+
@change=${this.handleChange}
|
|
137
|
+
@keydown=${this.handleKeyDown}
|
|
138
|
+
@keyup=${this.handleKeyUp}
|
|
139
|
+
></textarea>
|
|
140
|
+
${s ? u`
|
|
141
|
+
<span class="textarea__counter">${this._charCount}/${this.maxlength}</span>
|
|
142
|
+
` : n}
|
|
143
|
+
</div>
|
|
144
|
+
${a ? u`
|
|
145
|
+
<button
|
|
146
|
+
type="button"
|
|
147
|
+
slot="clear"
|
|
148
|
+
class="textarea__clear-btn"
|
|
149
|
+
@click=${this.handleClear}
|
|
150
|
+
tabindex="-1"
|
|
151
|
+
>
|
|
152
|
+
<ui-icon name="uil-times" size="14"></ui-icon>
|
|
153
|
+
</button>
|
|
154
|
+
` : n}
|
|
155
|
+
<slot name="suffix" slot="suffix"></slot>
|
|
156
|
+
</logosphere-formfield>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
t.styles = [y`${c(f)}`];
|
|
161
|
+
r([
|
|
162
|
+
_("textarea")
|
|
163
|
+
], t.prototype, "_textareaElement", 2);
|
|
164
|
+
r([
|
|
165
|
+
i({ type: String })
|
|
166
|
+
], t.prototype, "value", 2);
|
|
167
|
+
r([
|
|
168
|
+
i({ type: String })
|
|
169
|
+
], t.prototype, "placeholder", 2);
|
|
170
|
+
r([
|
|
171
|
+
i({ type: String })
|
|
172
|
+
], t.prototype, "name", 2);
|
|
173
|
+
r([
|
|
174
|
+
i({ type: String })
|
|
175
|
+
], t.prototype, "autocomplete", 2);
|
|
176
|
+
r([
|
|
177
|
+
i({ type: Number })
|
|
178
|
+
], t.prototype, "minlength", 2);
|
|
179
|
+
r([
|
|
180
|
+
i({ type: Number })
|
|
181
|
+
], t.prototype, "maxlength", 2);
|
|
182
|
+
r([
|
|
183
|
+
i({ type: Number })
|
|
184
|
+
], t.prototype, "rows", 2);
|
|
185
|
+
r([
|
|
186
|
+
i({ type: Number })
|
|
187
|
+
], t.prototype, "maxRows", 2);
|
|
188
|
+
r([
|
|
189
|
+
i({ type: Number })
|
|
190
|
+
], t.prototype, "cols", 2);
|
|
191
|
+
r([
|
|
192
|
+
i({ type: String })
|
|
193
|
+
], t.prototype, "wrap", 2);
|
|
194
|
+
r([
|
|
195
|
+
i({ type: String })
|
|
196
|
+
], t.prototype, "resize", 2);
|
|
197
|
+
r([
|
|
198
|
+
i({ type: Boolean })
|
|
199
|
+
], t.prototype, "autoResize", 2);
|
|
200
|
+
r([
|
|
201
|
+
i({ type: String })
|
|
202
|
+
], t.prototype, "size", 2);
|
|
203
|
+
r([
|
|
204
|
+
i({ type: String })
|
|
205
|
+
], t.prototype, "variant", 2);
|
|
206
|
+
r([
|
|
207
|
+
i({ type: String })
|
|
208
|
+
], t.prototype, "label", 2);
|
|
209
|
+
r([
|
|
210
|
+
i({ type: String })
|
|
211
|
+
], t.prototype, "helper", 2);
|
|
212
|
+
r([
|
|
213
|
+
i({ type: String })
|
|
214
|
+
], t.prototype, "error", 2);
|
|
215
|
+
r([
|
|
216
|
+
i({ type: Boolean })
|
|
217
|
+
], t.prototype, "required", 2);
|
|
218
|
+
r([
|
|
219
|
+
i({ type: Boolean })
|
|
220
|
+
], t.prototype, "disabled", 2);
|
|
221
|
+
r([
|
|
222
|
+
i({ type: Boolean })
|
|
223
|
+
], t.prototype, "readonly", 2);
|
|
224
|
+
r([
|
|
225
|
+
d()
|
|
226
|
+
], t.prototype, "_internalError", 2);
|
|
227
|
+
r([
|
|
228
|
+
d()
|
|
229
|
+
], t.prototype, "_charCount", 2);
|
|
230
|
+
t = r([
|
|
231
|
+
x("logosphere-textarea")
|
|
232
|
+
], t);
|
|
233
|
+
export {
|
|
234
|
+
t as T
|
|
235
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";const i=require("lit"),t=require("lit/decorators.js"),p=require("lit/directives/live.js");require("./formfield-CRcyUMvQ.cjs");require("./ui-icon-DIucAQC_.cjs");const u=".textarea__wrap{position:relative;flex:1;min-width:0}.textarea__field{display:block;width:100%;background:transparent;border:none;outline:none;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);box-sizing:border-box}.textarea__field::placeholder{color:var(--color-tertiary)}.textarea__field:disabled{cursor:not-allowed}.textarea__field--resize-none{resize:none}.textarea__field--resize-vertical{resize:vertical}.textarea__field--resize-horizontal{resize:horizontal}.textarea__field--resize-both{resize:both}.textarea__field--auto-resize{resize:none;overflow:hidden}.textarea__counter{position:absolute;bottom:5px;right:18px;font-size:11px;font-weight:var(--font-weight-medium);line-height:1rem;letter-spacing:-.11px;color:var(--color-secondary);background-color:var(--color-light-bg-2);border-radius:var(--radius-sm, 4px);padding:0 var(--spacing-1);white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none}.textarea__wrap--no-grip .textarea__counter{right:4px}.textarea__clear-btn{border:none;background:transparent;color:var(--color-tertiary);cursor:pointer;padding:0;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;outline:none;line-height:0;transition:color var(--transition-speed-fast) var(--transition-timing)}.textarea__clear-btn:hover{color:var(--color-body-text)}";var d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,r=(n,e,a,s)=>{for(var o=s>1?void 0:s?c(e,a):e,l=n.length-1,h;l>=0;l--)(h=n[l])&&(o=(s?h(e,a,o):h(o))||o);return s&&o&&d(e,a,o),o};exports.TextArea=class extends i.LitElement{constructor(){super(...arguments),this.value="",this.placeholder="",this.name="",this.autocomplete="",this.rows=3,this.maxRows=8,this.wrap="soft",this.resize="vertical",this.autoResize=!0,this.size="default",this.variant="default",this.label="",this.helper="",this.error="",this.required=!1,this.disabled=!1,this.readonly=!1,this._internalError="",this._charCount=0,this.handleInput=e=>{const a=e.target;this.value=a.value,this._charCount=this.value.length,this.autoResize&&this.adjustHeight(),this._internalError&&(this._internalError="",this._textareaElement.setCustomValidity("")),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleChange=e=>{const a=e.target;this.value=a.value,a.checkValidity()||(this._internalError=a.validationMessage),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:e}}))},this.handleKeyDown=e=>{this.dispatchEvent(new CustomEvent("keydown",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleKeyUp=e=>{this.dispatchEvent(new CustomEvent("keyup",{bubbles:!0,composed:!0,detail:{key:e.key,originalEvent:e}}))},this.handleClear=()=>{this.value="",this._charCount=0,this._textareaElement&&(this._textareaElement.value="",this.autoResize&&this.adjustHeight()),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,composed:!0,detail:{value:"",originalEvent:null}}))}}get textareaElement(){return this._textareaElement}focus(){this._textareaElement?.focus()}blur(){this._textareaElement?.blur()}select(){this._textareaElement?.select()}setSelectionRange(e,a,s){this._textareaElement?.setSelectionRange(e,a,s)}checkValidity(){return this._textareaElement?.checkValidity()??!0}reportValidity(){return this._textareaElement?.reportValidity()??!0}setCustomValidity(e){this._textareaElement?.setCustomValidity(e),this._internalError=e,this.requestUpdate()}adjustHeight(){if(!this.autoResize||!this._textareaElement)return;const e=this._textareaElement;e.style.height="",e.style.overflow="hidden";const a=e.scrollHeight;if(a!==0){if(this.maxRows>0){const s=parseFloat(getComputedStyle(e).lineHeight)||20,o=Math.round(s*this.maxRows);if(a>=o){e.style.height=`${o}px`,e.style.overflow="auto";return}}e.style.height=`${a}px`}}getResizeClass(){return this.autoResize?"textarea__field--auto-resize":{none:"textarea__field--resize-none",vertical:"textarea__field--resize-vertical",horizontal:"textarea__field--resize-horizontal",both:"textarea__field--resize-both"}[this.resize]}firstUpdated(){this._charCount=this.value.length,this.autoResize&&requestAnimationFrame(()=>this.adjustHeight())}updated(e){super.updated(e),e.has("value")&&(this._charCount=this.value.length,this.autoResize&&this.adjustHeight())}getWrapClass(){return this.autoResize||this.resize==="none"?"textarea__wrap textarea__wrap--no-grip":"textarea__wrap"}render(){const e=this.error||this._internalError,a=!!this.value&&!this.disabled&&!this.readonly,s=this.maxlength!=null,o=`textarea__field ${this.getResizeClass()}`;return i.html`
|
|
2
|
+
<logosphere-formfield
|
|
3
|
+
.label=${this.label}
|
|
4
|
+
.helper=${this.helper}
|
|
5
|
+
.error=${e}
|
|
6
|
+
.required=${this.required}
|
|
7
|
+
.disabled=${this.disabled}
|
|
8
|
+
.readonly=${this.readonly}
|
|
9
|
+
.size=${this.size}
|
|
10
|
+
.variant=${this.variant}
|
|
11
|
+
.multiline=${!0}
|
|
12
|
+
>
|
|
13
|
+
<slot name="prefix" slot="prefix"></slot>
|
|
14
|
+
<div class="${this.getWrapClass()}">
|
|
15
|
+
<textarea
|
|
16
|
+
class="${o}"
|
|
17
|
+
.value=${p.live(this.value)}
|
|
18
|
+
placeholder=${this.placeholder||i.nothing}
|
|
19
|
+
name=${this.name||i.nothing}
|
|
20
|
+
autocomplete=${this.autocomplete||i.nothing}
|
|
21
|
+
?required=${this.required}
|
|
22
|
+
?disabled=${this.disabled}
|
|
23
|
+
?readonly=${this.readonly}
|
|
24
|
+
minlength=${this.minlength??i.nothing}
|
|
25
|
+
maxlength=${this.maxlength??i.nothing}
|
|
26
|
+
rows=${this.rows}
|
|
27
|
+
cols=${this.cols??i.nothing}
|
|
28
|
+
wrap=${this.wrap}
|
|
29
|
+
@input=${this.handleInput}
|
|
30
|
+
@change=${this.handleChange}
|
|
31
|
+
@keydown=${this.handleKeyDown}
|
|
32
|
+
@keyup=${this.handleKeyUp}
|
|
33
|
+
></textarea>
|
|
34
|
+
${s?i.html`
|
|
35
|
+
<span class="textarea__counter">${this._charCount}/${this.maxlength}</span>
|
|
36
|
+
`:i.nothing}
|
|
37
|
+
</div>
|
|
38
|
+
${a?i.html`
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
slot="clear"
|
|
42
|
+
class="textarea__clear-btn"
|
|
43
|
+
@click=${this.handleClear}
|
|
44
|
+
tabindex="-1"
|
|
45
|
+
>
|
|
46
|
+
<ui-icon name="uil-times" size="14"></ui-icon>
|
|
47
|
+
</button>
|
|
48
|
+
`:i.nothing}
|
|
49
|
+
<slot name="suffix" slot="suffix"></slot>
|
|
50
|
+
</logosphere-formfield>
|
|
51
|
+
`}};exports.TextArea.styles=[i.css`${i.unsafeCSS(u)}`];r([t.query("textarea")],exports.TextArea.prototype,"_textareaElement",2);r([t.property({type:String})],exports.TextArea.prototype,"value",2);r([t.property({type:String})],exports.TextArea.prototype,"placeholder",2);r([t.property({type:String})],exports.TextArea.prototype,"name",2);r([t.property({type:String})],exports.TextArea.prototype,"autocomplete",2);r([t.property({type:Number})],exports.TextArea.prototype,"minlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"maxlength",2);r([t.property({type:Number})],exports.TextArea.prototype,"rows",2);r([t.property({type:Number})],exports.TextArea.prototype,"maxRows",2);r([t.property({type:Number})],exports.TextArea.prototype,"cols",2);r([t.property({type:String})],exports.TextArea.prototype,"wrap",2);r([t.property({type:String})],exports.TextArea.prototype,"resize",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"autoResize",2);r([t.property({type:String})],exports.TextArea.prototype,"size",2);r([t.property({type:String})],exports.TextArea.prototype,"variant",2);r([t.property({type:String})],exports.TextArea.prototype,"label",2);r([t.property({type:String})],exports.TextArea.prototype,"helper",2);r([t.property({type:String})],exports.TextArea.prototype,"error",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"required",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"disabled",2);r([t.property({type:Boolean})],exports.TextArea.prototype,"readonly",2);r([t.state()],exports.TextArea.prototype,"_internalError",2);r([t.state()],exports.TextArea.prototype,"_charCount",2);exports.TextArea=r([t.customElement("logosphere-textarea")],exports.TextArea);
|
package/dist/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./text-area-Cprb-azV.cjs");Object.defineProperty(exports,"TextArea",{enumerable:!0,get:()=>e.TextArea});
|
package/dist/textarea.js
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";const a=require("lit"),t=require("lit/decorators.js"),l=require("@popperjs/core");require("./input-CQS0LzF-.cjs");require("./ui-icon-DIucAQC_.cjs");const u=":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)}";var h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,i=(p,e,r,o)=>{for(var s=o>1?void 0:o?d(e,r):e,n=p.length-1,c;n>=0;n--)(c=p[n])&&(s=(o?c(e,r,s):c(s))||s);return o&&s&&h(e,r,s),s};exports.TimePicker=class extends a.LitElement{constructor(){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=e=>{this._isOpen&&!e.composedPath().includes(this)&&(this._isOpen=!1)},this._handleInputChange=e=>{e.stopPropagation();const r=e.detail?.value??"";if(/^\d{2}:\d{2}$/.test(r)){const[o,s]=this._parseValue(r);this._hour=o,this._minute=s;const n=`${this._pad(o)}:${this._pad(s)}`;this.value=n,this._emit(n)}},this._handleInputClear=e=>{e.stopPropagation(),this.value="",this._hour=0,this._minute=0,this._emit(""),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this._isOpen=!1},this._incrementHour=()=>{this._hour=(this._hour+1)%24,this._syncValue()},this._decrementHour=()=>{this._hour=(this._hour-1+24)%24,this._syncValue()},this._incrementMinute=()=>{this._minute=(this._minute+1)%60,this._syncValue()},this._decrementMinute=()=>{this._minute=(this._minute-1+60)%60,this._syncValue()}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick),this._destroyPopper()}willUpdate(e){if(e.has("value")&&/^\d{1,2}:\d{2}$/.test(this.value)){const[r,o]=this._parseValue(this.value);this._hour=r,this._minute=o}}updated(e){e.has("_isOpen")&&(this._isOpen?this.updateComplete.then(()=>{this._showPopover(),this._updatePopper()}):(this._hidePopover(),this._destroyPopper()))}_parseValue(e){const r=e.match(/^(\d{1,2}):(\d{2})$/);return r?[Math.min(23,Math.max(0,parseInt(r[1],10))),Math.min(59,Math.max(0,parseInt(r[2],10)))]:[0,0]}_pad(e){return String(e).padStart(2,"0")}_updatePopper(){!this._referenceEl||!this._popupEl||(this._popperInstance=l.createPopper(this._referenceEl,this._popupEl,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"flip",options:{fallbackPlacements:["top-start"]}},{name:"preventOverflow",options:{boundary:document.documentElement,padding:8}}]}))}_destroyPopper(){this._popperInstance?.destroy(),this._popperInstance=void 0}_showPopover(){this._popupEl?.showPopover?.()}_hidePopover(){const e=this._popupEl;try{e?.hidePopover?.()}catch{}}_togglePopup(){if(!(this.disabled||this.readonly))if(this._isOpen)this._isOpen=!1;else{const[e,r]=this._parseValue(this.value);this._hour=e,this._minute=r,this._isOpen=!0}}_clearValue(e){e?.stopPropagation(),this.value="",this._hour=0,this._minute=0,this._emit(""),this.dispatchEvent(new CustomEvent("clear",{bubbles:!0,composed:!0})),this._isOpen=!1}_setNow(){const e=new Date;this._hour=e.getHours(),this._minute=e.getMinutes(),this._syncValue()}_emit(e){this.onChange?.(e),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:e}}))}_syncValue(){const e=`${this._pad(this._hour)}:${this._pad(this._minute)}`;this.value=e,this._emit(e)}_startSpin(e){e(),this._spinInterval=setInterval(e,120)}_stopSpin(){clearInterval(this._spinInterval),this._spinInterval=void 0}_renderPopup(){return a.html`
|
|
2
|
+
<div data-timepicker-popup popover="manual" class="timepicker__popup">
|
|
3
|
+
<div class="timepicker__spinner">
|
|
4
|
+
<!-- Sol sütun: saat -->
|
|
5
|
+
<div class="timepicker__col timepicker__col--left">
|
|
6
|
+
<button
|
|
7
|
+
class="timepicker__spin-btn"
|
|
8
|
+
@mousedown=${()=>this._startSpin(this._incrementHour)}
|
|
9
|
+
@mouseup=${this._stopSpin}
|
|
10
|
+
@mouseleave=${this._stopSpin}
|
|
11
|
+
@touchstart=${e=>{e.preventDefault(),this._startSpin(this._incrementHour)}}
|
|
12
|
+
@touchend=${this._stopSpin}
|
|
13
|
+
tabindex="-1"
|
|
14
|
+
aria-label="Saat artır"
|
|
15
|
+
><ui-icon name="uil-arrow-up" size="16"></ui-icon></button>
|
|
16
|
+
<div class="timepicker__time-unit">${this._pad(this._hour)}</div>
|
|
17
|
+
<button
|
|
18
|
+
class="timepicker__spin-btn"
|
|
19
|
+
@mousedown=${()=>this._startSpin(this._decrementHour)}
|
|
20
|
+
@mouseup=${this._stopSpin}
|
|
21
|
+
@mouseleave=${this._stopSpin}
|
|
22
|
+
@touchstart=${e=>{e.preventDefault(),this._startSpin(this._decrementHour)}}
|
|
23
|
+
@touchend=${this._stopSpin}
|
|
24
|
+
tabindex="-1"
|
|
25
|
+
aria-label="Saat azalt"
|
|
26
|
+
><ui-icon name="uil-arrow-down" size="16"></ui-icon></button>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- Orta sütun: iki nokta -->
|
|
30
|
+
<div class="timepicker__col timepicker__col--sep">
|
|
31
|
+
<div class="timepicker__colon">:</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<!-- Sağ sütun: dakika -->
|
|
35
|
+
<div class="timepicker__col timepicker__col--right">
|
|
36
|
+
<button
|
|
37
|
+
class="timepicker__spin-btn"
|
|
38
|
+
@mousedown=${()=>this._startSpin(this._incrementMinute)}
|
|
39
|
+
@mouseup=${this._stopSpin}
|
|
40
|
+
@mouseleave=${this._stopSpin}
|
|
41
|
+
@touchstart=${e=>{e.preventDefault(),this._startSpin(this._incrementMinute)}}
|
|
42
|
+
@touchend=${this._stopSpin}
|
|
43
|
+
tabindex="-1"
|
|
44
|
+
aria-label="Dakika artır"
|
|
45
|
+
><ui-icon name="uil-arrow-up" size="16"></ui-icon></button>
|
|
46
|
+
<div class="timepicker__time-unit">${this._pad(this._minute)}</div>
|
|
47
|
+
<button
|
|
48
|
+
class="timepicker__spin-btn"
|
|
49
|
+
@mousedown=${()=>this._startSpin(this._decrementMinute)}
|
|
50
|
+
@mouseup=${this._stopSpin}
|
|
51
|
+
@mouseleave=${this._stopSpin}
|
|
52
|
+
@touchstart=${e=>{e.preventDefault(),this._startSpin(this._decrementMinute)}}
|
|
53
|
+
@touchend=${this._stopSpin}
|
|
54
|
+
tabindex="-1"
|
|
55
|
+
aria-label="Dakika azalt"
|
|
56
|
+
><ui-icon name="uil-arrow-down" size="16"></ui-icon></button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<!-- Action buttons -->
|
|
61
|
+
<div class="timepicker__actions">
|
|
62
|
+
<button
|
|
63
|
+
class="timepicker__action-btn"
|
|
64
|
+
@click=${this._setNow}
|
|
65
|
+
title="Şu anki saati seç"
|
|
66
|
+
>
|
|
67
|
+
<ui-icon name="uil-calendar-alt" size="16"></ui-icon>
|
|
68
|
+
</button>
|
|
69
|
+
<button
|
|
70
|
+
class="timepicker__action-btn"
|
|
71
|
+
@click=${()=>this._clearValue()}
|
|
72
|
+
title="Temizle"
|
|
73
|
+
>
|
|
74
|
+
<ui-icon name="uil-trash" size="16"></ui-icon>
|
|
75
|
+
</button>
|
|
76
|
+
<button
|
|
77
|
+
class="timepicker__action-btn"
|
|
78
|
+
@click=${()=>{this._isOpen=!1}}
|
|
79
|
+
title="Kapat"
|
|
80
|
+
>
|
|
81
|
+
<ui-icon name="uil-times" size="16"></ui-icon>
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
`}render(){return a.html`
|
|
86
|
+
<div class="timepicker__reference">
|
|
87
|
+
<logosphere-input
|
|
88
|
+
.label=${this.label}
|
|
89
|
+
.helper=${this.helper}
|
|
90
|
+
.error=${this.error}
|
|
91
|
+
.required=${this.required}
|
|
92
|
+
.disabled=${this.disabled}
|
|
93
|
+
.readonly=${this.readonly}
|
|
94
|
+
.size=${this.size}
|
|
95
|
+
.variant=${this.variant}
|
|
96
|
+
.placeholder=${this.placeholder}
|
|
97
|
+
.value=${this.value}
|
|
98
|
+
mask="00:00"
|
|
99
|
+
@input=${this._handleInputChange}
|
|
100
|
+
@clear=${this._handleInputClear}
|
|
101
|
+
@change=${e=>e.stopPropagation()}
|
|
102
|
+
>
|
|
103
|
+
<button
|
|
104
|
+
slot="suffix"
|
|
105
|
+
type="button"
|
|
106
|
+
class="timepicker__trigger ${this._isOpen?"timepicker__trigger--active":""}"
|
|
107
|
+
@click=${this._togglePopup}
|
|
108
|
+
?disabled=${this.disabled}
|
|
109
|
+
tabindex=${this.disabled?"-1":"0"}
|
|
110
|
+
aria-label="Saat seç"
|
|
111
|
+
aria-expanded=${this._isOpen?"true":"false"}
|
|
112
|
+
>
|
|
113
|
+
<ui-icon name="uil-clock" size="16"></ui-icon>
|
|
114
|
+
</button>
|
|
115
|
+
</logosphere-input>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
${this._renderPopup()}
|
|
119
|
+
`}};exports.TimePicker.styles=[a.css`${a.unsafeCSS(u)}`];i([t.property({type:String})],exports.TimePicker.prototype,"value",2);i([t.property({type:String})],exports.TimePicker.prototype,"label",2);i([t.property({type:String})],exports.TimePicker.prototype,"helper",2);i([t.property({type:String})],exports.TimePicker.prototype,"error",2);i([t.property({type:String})],exports.TimePicker.prototype,"placeholder",2);i([t.property({type:Boolean})],exports.TimePicker.prototype,"required",2);i([t.property({type:Boolean})],exports.TimePicker.prototype,"disabled",2);i([t.property({type:Boolean})],exports.TimePicker.prototype,"readonly",2);i([t.property({type:String})],exports.TimePicker.prototype,"size",2);i([t.property({type:String})],exports.TimePicker.prototype,"variant",2);i([t.property({attribute:!1})],exports.TimePicker.prototype,"onChange",2);i([t.state()],exports.TimePicker.prototype,"_isOpen",2);i([t.state()],exports.TimePicker.prototype,"_hour",2);i([t.state()],exports.TimePicker.prototype,"_minute",2);i([t.query(".timepicker__reference")],exports.TimePicker.prototype,"_referenceEl",2);i([t.query("[data-timepicker-popup]")],exports.TimePicker.prototype,"_popupEl",2);exports.TimePicker=i([t.customElement("logosphere-timepicker")],exports.TimePicker);
|