@logosphere-ui/core 0.0.0-alpha.5 → 0.0.0-alpha.51
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 +1204 -0
- package/dist/AGENTS.md +1204 -0
- package/dist/accordion-CYuCj7nB.cjs +21 -0
- package/dist/accordion-cDabqwu6.js +96 -0
- package/dist/accordion.cjs +1 -0
- package/dist/accordion.js +4 -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 +13 -3
- package/dist/atoms/FormField/formfield.d.ts +12 -0
- package/dist/atoms/Slider/index.d.ts +1 -0
- package/dist/atoms/Slider/slider.d.ts +54 -0
- package/dist/badge-BhINg1p5.js +72 -0
- package/dist/badge-CKSG_MyA.cjs +13 -0
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb-BOuCLUJh.cjs +12 -0
- package/dist/breadcrumb-BeJqq-5C.js +41 -0
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-CVkIa7M0.js +58 -0
- package/dist/button-vdNReBMi.cjs +10 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar-C71sj3Ki.js +652 -0
- package/dist/calendar-DZJM5Tyu.cjs +88 -0
- package/dist/calendar.cjs +1 -0
- package/dist/calendar.js +4 -0
- package/dist/{card-CUhlTJyJ.js → card-C7xXMV3h.js} +26 -25
- package/dist/card-DmQRNKtk.cjs +43 -0
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/chatbot-BAou4THb.cjs +183 -0
- package/dist/chatbot-BRfqXYYt.js +564 -0
- package/dist/chatbot.cjs +1 -1
- package/dist/chatbot.js +2 -2
- package/dist/checkbox-BAbPDN6x.cjs +53 -0
- package/dist/checkbox-CTfbav6M.js +152 -0
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-group-D4DwnC37.cjs +26 -0
- package/dist/chip-group-DzfOd6Vw.js +89 -0
- package/dist/chip-group.cjs +1 -0
- package/dist/chip-group.js +4 -0
- package/dist/collapse-CbRE8ABx.cjs +47 -0
- package/dist/collapse-DY6SJ9jS.js +141 -0
- package/dist/collapse.cjs +1 -0
- package/dist/collapse.js +4 -0
- package/dist/combobox-BAa3UAQs.cjs +113 -0
- package/dist/combobox-BR05Tgfd.js +460 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/datepicker-BFYWQRrJ.js +382 -0
- package/dist/datepicker-BWE4qDJM.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-CRu4G2zu.cjs +32 -0
- package/dist/drawer-DhuBPWHP.js +114 -0
- package/dist/drawer.cjs +1 -0
- package/dist/drawer.js +4 -0
- package/dist/formfield-JXiv9mvJ.cjs +33 -0
- package/dist/formfield-ss2mFweu.js +161 -0
- package/dist/formfield.cjs +1 -1
- package/dist/formfield.js +1 -1
- package/dist/icon.cjs +1 -0
- package/dist/icon.js +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.js +65 -32
- package/dist/index.umd.js +1613 -521
- package/dist/input-DyLKo7h6.cjs +60 -0
- package/dist/input-N3Z8D7q1.js +278 -0
- package/dist/input-group-C6sA1lzj.cjs +5 -0
- package/dist/input-group-DUPlrpug.js +66 -0
- package/dist/input-group.cjs +1 -0
- package/dist/input-group.js +4 -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-DiKo8iud.cjs +120 -0
- package/dist/leftmenu-DlU_G4Sj.js +373 -0
- package/dist/modal-g3KbWncV.cjs +84 -0
- package/dist/modal-vSjEpYrG.js +250 -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 +24 -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 +5 -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 +39 -0
- package/dist/organisms/DatePicker/datepicker.d.ts +35 -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-types.d.ts +24 -0
- package/dist/organisms/LeftMenu/leftmenu.d.ts +60 -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 +59 -0
- package/dist/pagination-CjXvpE2j.js +360 -0
- package/dist/pagination-Nnzacqdo.cjs +169 -0
- package/dist/pagination.cjs +1 -0
- package/dist/pagination.js +4 -0
- package/dist/popover-CrXUbUR-.cjs +30 -0
- package/dist/popover-M5ZcS5rj.js +161 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/shared/icons/index.d.ts +1 -0
- package/dist/shared/types/button.types.d.ts +7 -0
- package/dist/slider-DSRs5uhl.cjs +108 -0
- package/dist/slider-ntLRajQa.js +280 -0
- package/dist/slider.cjs +1 -0
- package/dist/slider.js +4 -0
- package/dist/split-button-BdBweoip.js +177 -0
- package/dist/split-button-BpffPlVg.cjs +63 -0
- package/dist/split-button.cjs +1 -0
- package/dist/split-button.js +4 -0
- package/dist/stepper-CZhwgLNp.js +122 -0
- package/dist/stepper-ZOMaU6aZ.cjs +52 -0
- package/dist/stepper.cjs +1 -0
- package/dist/stepper.js +4 -0
- package/dist/styles/main.css +186 -182
- package/dist/switch-Do6SCkPJ.cjs +17 -0
- package/dist/switch-uYVuohJ-.js +68 -0
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/tab-BvRVHpWs.cjs +41 -0
- package/dist/tab-Byh4UgFB.js +204 -0
- package/dist/tab.cjs +1 -1
- package/dist/tab.js +1 -1
- package/dist/text-area-1rALZ0iy.js +239 -0
- package/dist/text-area-D_TYL4_q.cjs +51 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/timepicker-B9l6HN-d.js +320 -0
- package/dist/timepicker-Bpf2d4Nn.cjs +119 -0
- package/dist/timepicker.cjs +1 -0
- package/dist/timepicker.js +4 -0
- package/dist/toast-container-C5qYjInG.js +274 -0
- package/dist/toast-container-D2dyP20J.cjs +64 -0
- package/dist/toast.cjs +1 -0
- package/dist/toast.js +6 -0
- package/dist/tree-menu-BZ7aBC7R.js +237 -0
- package/dist/tree-menu-DDQ_DYl7.cjs +78 -0
- package/dist/tree-menu.cjs +1 -0
- package/dist/tree-menu.js +4 -0
- package/dist/ui-icon-BeR-PaPg.js +75 -0
- package/dist/ui-icon-DWl7I5BQ.cjs +22 -0
- package/package.json +104 -15
- package/dist/badge-BbhaO73N.cjs +0 -13
- package/dist/badge-DE7Tgd8Z.js +0 -71
- package/dist/breadcrumb-B-4yqoJZ.js +0 -41
- package/dist/breadcrumb-Cop-B1J7.cjs +0 -12
- 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-B7tCqk3R.js +0 -140
- 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,280 @@
|
|
|
1
|
+
import { unsafeCSS as _, css as b, LitElement as v, html as l, nothing as p } from "lit";
|
|
2
|
+
import { property as a, state as u, customElement as g } from "lit/decorators.js";
|
|
3
|
+
const m = ':host{display:block}.slider{position:relative;width:100%;font-family:var(--font-family-base)}.slider--has-tooltip .slider__track-area{margin-top:var(--spacing-8)}.slider__track-area{position:relative;height:20px;display:flex;align-items:center}.slider__track{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);height:6px;border-radius:var(--radius-full);background:var(--color-border);pointer-events:none}.slider__fill{position:absolute;top:50%;transform:translateY(-50%);height:6px;border-radius:var(--radius-full);background:var(--color-primary);pointer-events:none}.slider__input{position:absolute;top:50%;transform:translateY(-50%);left:0;width:100%;height:6px;margin:0;padding:0;-webkit-appearance:none;appearance:none;background:transparent;cursor:pointer;pointer-events:none;outline:none}.slider__input::-webkit-slider-runnable-track{background:transparent;height:6px}.slider__input::-moz-range-track{background:transparent;height:6px}.slider__input::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;margin-top:-5px;border-radius:50%;background:var(--color-body-bg);border:2px solid var(--color-border);pointer-events:all;cursor:pointer;box-shadow:var(--shadow-sm)}.slider__input::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background:var(--color-body-bg);border:2px solid var(--color-border);pointer-events:all;cursor:pointer;box-shadow:var(--shadow-sm)}.slider__input:not(:disabled):focus-visible::-webkit-slider-thumb{outline:none;box-shadow:0 0 0 4px var(--color-primary-bg-subtle)}.slider__input:not(:disabled):focus-visible::-moz-range-thumb{box-shadow:0 0 0 4px var(--color-primary-bg-subtle)}.slider--disabled .slider__track{background:var(--color-border)}.slider--disabled .slider__fill{background:var(--color-primary-disabled)}.slider--disabled .slider__input{cursor:not-allowed}.slider--disabled .slider__input::-webkit-slider-thumb{background:var(--color-body-bg);border-color:var(--color-border);pointer-events:all;cursor:not-allowed;box-shadow:none}.slider--disabled .slider__input::-moz-range-thumb{background:var(--color-body-bg);border-color:var(--color-secondary-disabled);cursor:not-allowed;box-shadow:none}.slider--disabled .slider__scale-item{color:var(--color-secondary-disabled)}.slider--disabled .slider__scale-item:before{background:var(--color-secondary-disabled)}.slider--disabled .slider__tooltip{color:var(--color-secondary-disabled);border-color:var(--color-secondary-disabled)}.slider__tooltip{position:absolute;top:-34px;transform:translate(-50%);background:var(--color-body-bg);border:1px solid var(--color-border);color:var(--color-body-color);padding:var(--spacing-1) var(--spacing-2);border-radius:var(--radius-sm);font-size:var(--font-size-xs);font-weight:var(--font-weight-medium);font-family:var(--font-family-base);white-space:nowrap;pointer-events:none;z-index:var(--z-index-tooltip);line-height:var(--line-height-normal)}.slider__scale{position:relative;height:26px;margin-top:var(--spacing-1)}.slider__scale-item{position:absolute;transform:translate(-50%);display:flex;flex-direction:column;align-items:center;gap:var(--spacing-1);font-size:var(--font-size-xs);color:var(--color-tertiary);font-family:var(--font-family-base);font-weight:var(--font-weight-regular);white-space:nowrap;line-height:1;-webkit-user-select:none;user-select:none}.slider__scale-item:before{content:"";display:block;width:1px;height:6px;background:var(--color-border);flex-shrink:0}.slider__input--start,.slider__input--end{position:absolute;pointer-events:none}.slider__input--start::-webkit-slider-thumb,.slider__input--end::-webkit-slider-thumb{pointer-events:all}.slider__input--start::-moz-range-thumb,.slider__input--end::-moz-range-thumb{pointer-events:all}';
|
|
4
|
+
var f = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, e, s, n) => {
|
|
5
|
+
for (var o = n > 1 ? void 0 : n ? y(e, s) : e, d = t.length - 1, h; d >= 0; d--)
|
|
6
|
+
(h = t[d]) && (o = (n ? h(e, s, o) : h(o)) || o);
|
|
7
|
+
return n && o && f(e, s, o), o;
|
|
8
|
+
};
|
|
9
|
+
let r = class extends v {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.value = 50, this.min = 0, this.max = 100, this.step = 1, this.disabled = !1, this.range = !1, this.rangeStart = 25, this.rangeEnd = 75, this.minDistance = 0, this.tooltip = "never", this.showScale = !1, this.percentage = !1, this.labels = [], this._hoverStart = !1, this._hoverEnd = !1;
|
|
12
|
+
}
|
|
13
|
+
// ── Computed helpers ─────────────────────────────────────────────────────────
|
|
14
|
+
get _isLabeled() {
|
|
15
|
+
return this.labels.length > 0;
|
|
16
|
+
}
|
|
17
|
+
get _effectiveStep() {
|
|
18
|
+
return this._isLabeled && this.labels.length > 1 ? (this.max - this.min) / (this.labels.length - 1) : this.step;
|
|
19
|
+
}
|
|
20
|
+
get _valuePct() {
|
|
21
|
+
return (this.value - this.min) / (this.max - this.min) * 100;
|
|
22
|
+
}
|
|
23
|
+
get _startPct() {
|
|
24
|
+
return (this.rangeStart - this.min) / (this.max - this.min) * 100;
|
|
25
|
+
}
|
|
26
|
+
get _endPct() {
|
|
27
|
+
return (this.rangeEnd - this.min) / (this.max - this.min) * 100;
|
|
28
|
+
}
|
|
29
|
+
get _displayValue() {
|
|
30
|
+
if (this._isLabeled) {
|
|
31
|
+
const t = Math.round((this.value - this.min) / this._effectiveStep);
|
|
32
|
+
return this.labels[Math.min(t, this.labels.length - 1)] ?? String(this.value);
|
|
33
|
+
}
|
|
34
|
+
return this.percentage ? `${Math.round(this.value)}%` : String(this.value);
|
|
35
|
+
}
|
|
36
|
+
get _displayStart() {
|
|
37
|
+
return this.percentage ? `${Math.round(this.rangeStart)}%` : String(this.rangeStart);
|
|
38
|
+
}
|
|
39
|
+
get _displayEnd() {
|
|
40
|
+
return this.percentage ? `${Math.round(this.rangeEnd)}%` : String(this.rangeEnd);
|
|
41
|
+
}
|
|
42
|
+
/** CSS left value that correctly follows the native thumb position (accounts for thumb radius offset). */
|
|
43
|
+
_thumbLeft(t) {
|
|
44
|
+
return `calc(${t}% + ${(0.5 - t / 100) * 16}px)`;
|
|
45
|
+
}
|
|
46
|
+
// ── Event handlers ───────────────────────────────────────────────────────────
|
|
47
|
+
_onSingleChange(t) {
|
|
48
|
+
const e = t.target;
|
|
49
|
+
this.value = Number(e.value), this._emit("change", { value: this.value });
|
|
50
|
+
}
|
|
51
|
+
_onStartChange(t) {
|
|
52
|
+
const e = t.target, s = Math.min(Number(e.value), this.rangeEnd - this.minDistance);
|
|
53
|
+
this.rangeStart = s, this._emit("change", { rangeStart: this.rangeStart, rangeEnd: this.rangeEnd });
|
|
54
|
+
}
|
|
55
|
+
_onEndChange(t) {
|
|
56
|
+
const e = t.target, s = Math.max(Number(e.value), this.rangeStart + this.minDistance);
|
|
57
|
+
this.rangeEnd = s, this._emit("change", { rangeStart: this.rangeStart, rangeEnd: this.rangeEnd });
|
|
58
|
+
}
|
|
59
|
+
_emit(t, e) {
|
|
60
|
+
this.dispatchEvent(new CustomEvent(t, { detail: e, bubbles: !0, composed: !0 }));
|
|
61
|
+
}
|
|
62
|
+
// ── Render parts ─────────────────────────────────────────────────────────────
|
|
63
|
+
_renderFill() {
|
|
64
|
+
return this.range ? l`
|
|
65
|
+
<div
|
|
66
|
+
class="slider__fill"
|
|
67
|
+
style="left: ${this._startPct}%; width: ${this._endPct - this._startPct}%"
|
|
68
|
+
></div>
|
|
69
|
+
` : l`<div class="slider__fill" style="width: ${this._valuePct}%"></div>`;
|
|
70
|
+
}
|
|
71
|
+
_renderTooltip(t, e, s) {
|
|
72
|
+
return this.tooltip === "never" ? p : this.tooltip === "hover" && !s ? p : l`
|
|
73
|
+
<div class="slider__tooltip" style="left: ${this._thumbLeft(e)}">${t}</div>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
_renderScale() {
|
|
77
|
+
if (!this.showScale) return p;
|
|
78
|
+
const t = this.max - this.min, e = Math.min(Math.round(t / this.step) + 1, 11), s = Array.from({ length: e }, (n, o) => {
|
|
79
|
+
const d = e > 1 ? o / (e - 1) * 100 : 0, h = this.min + d / 100 * t, c = this.percentage ? `${Math.round(h)}%` : String(Math.round(h));
|
|
80
|
+
return { pct: d, display: c };
|
|
81
|
+
});
|
|
82
|
+
return l`
|
|
83
|
+
<div class="slider__scale">
|
|
84
|
+
${s.map(({ pct: n, display: o }) => l`
|
|
85
|
+
<span class="slider__scale-item" style="left: ${this._thumbLeft(n)}">${o}</span>
|
|
86
|
+
`)}
|
|
87
|
+
</div>
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
_renderLabels() {
|
|
91
|
+
if (!this._isLabeled) return p;
|
|
92
|
+
const t = this.labels.length;
|
|
93
|
+
return l`
|
|
94
|
+
<div class="slider__scale">
|
|
95
|
+
${this.labels.map((e, s) => {
|
|
96
|
+
const n = t > 1 ? s / (t - 1) * 100 : 0;
|
|
97
|
+
return l`
|
|
98
|
+
<span class="slider__scale-item" style="left: ${this._thumbLeft(n)}">${e}</span>
|
|
99
|
+
`;
|
|
100
|
+
})}
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
_renderSingleInput() {
|
|
105
|
+
const t = this.tooltip === "always" || this.tooltip === "hover" && this._hoverStart;
|
|
106
|
+
return l`
|
|
107
|
+
<div class="slider__track-area">
|
|
108
|
+
<div class="slider__track"></div>
|
|
109
|
+
${this._renderFill()}
|
|
110
|
+
${this._renderTooltip(this._displayValue, this._valuePct, t)}
|
|
111
|
+
<input
|
|
112
|
+
type="range"
|
|
113
|
+
class="slider__input"
|
|
114
|
+
.value=${String(this.value)}
|
|
115
|
+
min=${this.min}
|
|
116
|
+
max=${this.max}
|
|
117
|
+
step=${this._effectiveStep}
|
|
118
|
+
?disabled=${this.disabled}
|
|
119
|
+
@input=${this._onSingleChange}
|
|
120
|
+
@mouseenter=${() => {
|
|
121
|
+
this._hoverStart = !0;
|
|
122
|
+
}}
|
|
123
|
+
@mouseleave=${() => {
|
|
124
|
+
this._hoverStart = !1;
|
|
125
|
+
}}
|
|
126
|
+
@focus=${() => {
|
|
127
|
+
this._hoverStart = !0;
|
|
128
|
+
}}
|
|
129
|
+
@blur=${() => {
|
|
130
|
+
this._hoverStart = !1;
|
|
131
|
+
}}
|
|
132
|
+
aria-label="Slider"
|
|
133
|
+
aria-valuemin=${this.min}
|
|
134
|
+
aria-valuemax=${this.max}
|
|
135
|
+
aria-valuenow=${this.value}
|
|
136
|
+
aria-valuetext=${this._displayValue}
|
|
137
|
+
aria-disabled=${this.disabled}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
_renderRangeInputs() {
|
|
143
|
+
const t = this.tooltip === "always" || this.tooltip === "hover" && this._hoverStart, e = this.tooltip === "always" || this.tooltip === "hover" && this._hoverEnd, s = this._startPct >= 100 ? 4 : 3, n = this._startPct >= 100 ? 3 : 4;
|
|
144
|
+
return l`
|
|
145
|
+
<div class="slider__track-area">
|
|
146
|
+
<div class="slider__track"></div>
|
|
147
|
+
${this._renderFill()}
|
|
148
|
+
${this._renderTooltip(this._displayStart, this._startPct, t)}
|
|
149
|
+
${this._renderTooltip(this._displayEnd, this._endPct, e)}
|
|
150
|
+
<input
|
|
151
|
+
type="range"
|
|
152
|
+
class="slider__input slider__input--start"
|
|
153
|
+
style="z-index: ${s}"
|
|
154
|
+
.value=${String(this.rangeStart)}
|
|
155
|
+
min=${this.min}
|
|
156
|
+
max=${this.max}
|
|
157
|
+
step=${this._effectiveStep}
|
|
158
|
+
?disabled=${this.disabled}
|
|
159
|
+
@input=${this._onStartChange}
|
|
160
|
+
@mouseenter=${() => {
|
|
161
|
+
this._hoverStart = !0;
|
|
162
|
+
}}
|
|
163
|
+
@mouseleave=${() => {
|
|
164
|
+
this._hoverStart = !1;
|
|
165
|
+
}}
|
|
166
|
+
@focus=${() => {
|
|
167
|
+
this._hoverStart = !0;
|
|
168
|
+
}}
|
|
169
|
+
@blur=${() => {
|
|
170
|
+
this._hoverStart = !1;
|
|
171
|
+
}}
|
|
172
|
+
aria-label="Range start"
|
|
173
|
+
aria-valuemin=${this.min}
|
|
174
|
+
aria-valuemax=${this.max}
|
|
175
|
+
aria-valuenow=${this.rangeStart}
|
|
176
|
+
aria-valuetext=${this._displayStart}
|
|
177
|
+
aria-disabled=${this.disabled}
|
|
178
|
+
/>
|
|
179
|
+
<input
|
|
180
|
+
type="range"
|
|
181
|
+
class="slider__input slider__input--end"
|
|
182
|
+
style="z-index: ${n}"
|
|
183
|
+
.value=${String(this.rangeEnd)}
|
|
184
|
+
min=${this.min}
|
|
185
|
+
max=${this.max}
|
|
186
|
+
step=${this._effectiveStep}
|
|
187
|
+
?disabled=${this.disabled}
|
|
188
|
+
@input=${this._onEndChange}
|
|
189
|
+
@mouseenter=${() => {
|
|
190
|
+
this._hoverEnd = !0;
|
|
191
|
+
}}
|
|
192
|
+
@mouseleave=${() => {
|
|
193
|
+
this._hoverEnd = !1;
|
|
194
|
+
}}
|
|
195
|
+
@focus=${() => {
|
|
196
|
+
this._hoverEnd = !0;
|
|
197
|
+
}}
|
|
198
|
+
@blur=${() => {
|
|
199
|
+
this._hoverEnd = !1;
|
|
200
|
+
}}
|
|
201
|
+
aria-label="Range end"
|
|
202
|
+
aria-valuemin=${this.min}
|
|
203
|
+
aria-valuemax=${this.max}
|
|
204
|
+
aria-valuenow=${this.rangeEnd}
|
|
205
|
+
aria-valuetext=${this._displayEnd}
|
|
206
|
+
aria-disabled=${this.disabled}
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
render() {
|
|
212
|
+
const t = this.tooltip !== "never", e = this.showScale || this._isLabeled;
|
|
213
|
+
return l`
|
|
214
|
+
<div
|
|
215
|
+
class="slider
|
|
216
|
+
${this.disabled ? "slider--disabled" : ""}
|
|
217
|
+
${t ? "slider--has-tooltip" : ""}
|
|
218
|
+
${e ? "slider--has-below" : ""}
|
|
219
|
+
"
|
|
220
|
+
role="presentation"
|
|
221
|
+
>
|
|
222
|
+
${this.range ? this._renderRangeInputs() : this._renderSingleInput()}
|
|
223
|
+
${this._renderScale()}
|
|
224
|
+
${this._renderLabels()}
|
|
225
|
+
</div>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
r.styles = [b`${_(m)}`];
|
|
230
|
+
i([
|
|
231
|
+
a({ type: Number })
|
|
232
|
+
], r.prototype, "value", 2);
|
|
233
|
+
i([
|
|
234
|
+
a({ type: Number })
|
|
235
|
+
], r.prototype, "min", 2);
|
|
236
|
+
i([
|
|
237
|
+
a({ type: Number })
|
|
238
|
+
], r.prototype, "max", 2);
|
|
239
|
+
i([
|
|
240
|
+
a({ type: Number })
|
|
241
|
+
], r.prototype, "step", 2);
|
|
242
|
+
i([
|
|
243
|
+
a({ type: Boolean })
|
|
244
|
+
], r.prototype, "disabled", 2);
|
|
245
|
+
i([
|
|
246
|
+
a({ type: Boolean })
|
|
247
|
+
], r.prototype, "range", 2);
|
|
248
|
+
i([
|
|
249
|
+
a({ type: Number })
|
|
250
|
+
], r.prototype, "rangeStart", 2);
|
|
251
|
+
i([
|
|
252
|
+
a({ type: Number })
|
|
253
|
+
], r.prototype, "rangeEnd", 2);
|
|
254
|
+
i([
|
|
255
|
+
a({ type: Number })
|
|
256
|
+
], r.prototype, "minDistance", 2);
|
|
257
|
+
i([
|
|
258
|
+
a({ type: String })
|
|
259
|
+
], r.prototype, "tooltip", 2);
|
|
260
|
+
i([
|
|
261
|
+
a({ type: Boolean })
|
|
262
|
+
], r.prototype, "showScale", 2);
|
|
263
|
+
i([
|
|
264
|
+
a({ type: Boolean })
|
|
265
|
+
], r.prototype, "percentage", 2);
|
|
266
|
+
i([
|
|
267
|
+
a({ type: Array })
|
|
268
|
+
], r.prototype, "labels", 2);
|
|
269
|
+
i([
|
|
270
|
+
u()
|
|
271
|
+
], r.prototype, "_hoverStart", 2);
|
|
272
|
+
i([
|
|
273
|
+
u()
|
|
274
|
+
], r.prototype, "_hoverEnd", 2);
|
|
275
|
+
r = i([
|
|
276
|
+
g("logosphere-slider")
|
|
277
|
+
], r);
|
|
278
|
+
export {
|
|
279
|
+
r as S
|
|
280
|
+
};
|
package/dist/slider.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./slider-DSRs5uhl.cjs");Object.defineProperty(exports,"Slider",{enumerable:!0,get:()=>e.Slider});
|
package/dist/slider.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { unsafeCSS as u, css as _, LitElement as v, nothing as b, html as r } from "lit";
|
|
2
|
+
import { property as l, state as g, query as c, customElement as h } from "lit/decorators.js";
|
|
3
|
+
import { createPopper as f } from "@popperjs/core";
|
|
4
|
+
import "./ui-icon-BeR-PaPg.js";
|
|
5
|
+
const w = ":host{display:inline-block;position:relative}.split-button{display:inline-flex;align-items:stretch;gap:1px;font-family:var(--font-family-base);border-radius:var(--radius-base);overflow:hidden}.split-button__action,.split-button__dropdown{display:inline-flex;align-items:center;justify-content:center;border:none;cursor:pointer;font-family:inherit;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);line-height:1.25rem;letter-spacing:-.14px;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-speed-base) var(--transition-timing);outline:none}.split-button__action:focus-visible,.split-button__dropdown:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px;position:relative;z-index:1}.split-button__action:disabled,.split-button__dropdown:disabled{cursor:not-allowed;pointer-events:none}.split-button__action{gap:var(--spacing-1)}.split-button__chevron{transition:transform var(--transition-speed-base) var(--transition-timing);display:inline-flex}.split-button__chevron--open{transform:rotate(180deg)}.split-button--sm .split-button__action{padding:var(--spacing-0-5) var(--spacing-2)}.split-button--sm .split-button__dropdown{padding:var(--spacing-0-5) var(--spacing-1-5)}.split-button--md .split-button__action{padding:var(--spacing-1-5) var(--spacing-3)}.split-button--md .split-button__dropdown{padding:var(--spacing-1-5) var(--spacing-2)}.split-button--lg .split-button__action{padding:var(--spacing-2-5) var(--spacing-3)}.split-button--lg .split-button__dropdown{padding:var(--spacing-2-5) var(--spacing-2)}.split-button{background-color:#fff6}.split-button--primary .split-button__action,.split-button--primary .split-button__dropdown{background-color:var(--color-primary);color:#fff}.split-button--primary .split-button__action:hover:not(:disabled),.split-button--primary .split-button__dropdown:hover:not(:disabled){background-color:var(--color-primary-hover)}.split-button--primary .split-button__action:active:not(:disabled),.split-button--primary .split-button__dropdown:active:not(:disabled){background-color:var(--color-primary-active)}.split-button--primary.split-button--disabled,.split-button--primary .split-button__action:disabled,.split-button--primary .split-button__dropdown:disabled{background-color:var(--color-primary-disabled)}.split-button--primary.split-button--disabled .split-button__action,.split-button--primary.split-button--disabled .split-button__dropdown{background-color:var(--color-primary-disabled)}.split-button--secondary .split-button__action,.split-button--secondary .split-button__dropdown{background-color:var(--color-secondary);color:#fff}.split-button--secondary .split-button__action:hover:not(:disabled),.split-button--secondary .split-button__dropdown:hover:not(:disabled){background-color:var(--color-secondary-hover)}.split-button--secondary .split-button__action:active:not(:disabled),.split-button--secondary .split-button__dropdown:active:not(:disabled){background-color:var(--color-secondary-active)}.split-button--secondary.split-button--disabled .split-button__action,.split-button--secondary.split-button--disabled .split-button__dropdown,.split-button--secondary .split-button__action:disabled,.split-button--secondary .split-button__dropdown:disabled{background-color:var(--color-secondary-disabled)}.split-button--success .split-button__action,.split-button--success .split-button__dropdown{background-color:var(--color-success);color:#fff}.split-button--success .split-button__action:hover:not(:disabled),.split-button--success .split-button__dropdown:hover:not(:disabled){background-color:var(--color-success-hover)}.split-button--success .split-button__action:active:not(:disabled),.split-button--success .split-button__dropdown:active:not(:disabled){background-color:var(--color-success-active)}.split-button--success.split-button--disabled .split-button__action,.split-button--success.split-button--disabled .split-button__dropdown,.split-button--success .split-button__action:disabled,.split-button--success .split-button__dropdown:disabled{background-color:var(--color-success-disabled)}.split-button--danger .split-button__action,.split-button--danger .split-button__dropdown{background-color:var(--color-danger);color:#fff}.split-button--danger .split-button__action:hover:not(:disabled),.split-button--danger .split-button__dropdown:hover:not(:disabled){background-color:var(--color-danger-hover)}.split-button--danger .split-button__action:active:not(:disabled),.split-button--danger .split-button__dropdown:active:not(:disabled){background-color:var(--color-danger-active)}.split-button--danger.split-button--disabled .split-button__action,.split-button--danger.split-button--disabled .split-button__dropdown,.split-button--danger .split-button__action:disabled,.split-button--danger .split-button__dropdown:disabled{background-color:var(--color-danger-disabled)}.split-button--info .split-button__action,.split-button--info .split-button__dropdown{background-color:var(--color-info);color:#fff}.split-button--info .split-button__action:hover:not(:disabled),.split-button--info .split-button__dropdown:hover:not(:disabled){background-color:var(--color-info-hover)}.split-button--info .split-button__action:active:not(:disabled),.split-button--info .split-button__dropdown:active:not(:disabled){background-color:var(--color-info-active)}.split-button--info.split-button--disabled .split-button__action,.split-button--info.split-button--disabled .split-button__dropdown,.split-button--info .split-button__action:disabled,.split-button--info .split-button__dropdown:disabled{background-color:var(--color-info-disabled)}.split-button--warning .split-button__action,.split-button--warning .split-button__dropdown{background-color:var(--color-warning);color:var(--color-warning-emphasis)}.split-button--warning .split-button__action:hover:not(:disabled),.split-button--warning .split-button__dropdown:hover:not(:disabled){background-color:var(--color-warning-hover)}.split-button--warning .split-button__action:active:not(:disabled),.split-button--warning .split-button__dropdown:active:not(:disabled){background-color:var(--color-warning-active)}.split-button--warning.split-button--disabled .split-button__action,.split-button--warning.split-button--disabled .split-button__dropdown,.split-button--warning .split-button__action:disabled,.split-button--warning .split-button__dropdown:disabled{background-color:var(--color-warning-disabled)}.split-button__panel{position:fixed;z-index:var(--z-index-dropdown);min-width:160px;background-color:var(--color-body-bg);border:1px solid var(--color-border);border-radius:var(--radius-base);box-shadow:var(--shadow-lg);padding:var(--spacing-1) 0;outline:none}.split-button__panel-item{display:flex;align-items:center;gap:var(--spacing-2);width:100%;padding:var(--spacing-2) var(--spacing-3);background:none;border:none;cursor:pointer;font-family:var(--font-family-base);font-size:var(--font-size-sm);font-weight:var(--font-weight-regular);color:var(--color-body-color);text-align:left;white-space:nowrap;transition:background-color var(--transition-speed-fast) var(--transition-timing);box-sizing:border-box}.split-button__panel-item:hover:not(:disabled){background-color:var(--color-body-bg-hover)}.split-button__panel-item:active:not(:disabled){background-color:var(--color-body-bg-active)}.split-button__panel-item--disabled,.split-button__panel-item:disabled{color:var(--color-secondary-disabled);cursor:not-allowed;pointer-events:none}.split-button__panel-divider{height:1px;background-color:var(--color-border);margin:var(--spacing-1) 0}";
|
|
6
|
+
var m = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, o, s, a) => {
|
|
7
|
+
for (var e = a > 1 ? void 0 : a ? y(o, s) : o, d = t.length - 1, p; d >= 0; d--)
|
|
8
|
+
(p = t[d]) && (e = (a ? p(o, s, e) : p(e)) || e);
|
|
9
|
+
return a && e && m(o, s, e), e;
|
|
10
|
+
};
|
|
11
|
+
let n = class extends v {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.label = "Button", this.size = "md", this.theme = "primary", this.disabled = !1, this.dropdownDisabled = !1, this.items = [], this._open = !1, this._onDocClick = (t) => {
|
|
14
|
+
this._open && (t.composedPath().includes(this) || this._setOpen(!1));
|
|
15
|
+
}, this._onDocKeydown = (t) => {
|
|
16
|
+
t.key === "Escape" && this._open && this._setOpen(!1);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback(), document.addEventListener("click", this._onDocClick, { capture: !0 }), document.addEventListener("keydown", this._onDocKeydown);
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback(), document.removeEventListener("click", this._onDocClick, { capture: !0 }), document.removeEventListener("keydown", this._onDocKeydown), this._destroyPopper();
|
|
25
|
+
}
|
|
26
|
+
updated(t) {
|
|
27
|
+
super.updated(t), t.has("_open") && (this._open ? this._initPopper() : this._destroyPopper());
|
|
28
|
+
}
|
|
29
|
+
// ── Popper ───────────────────────────────────────────────────────────────
|
|
30
|
+
_initPopper() {
|
|
31
|
+
!this._dropdownBtn || !this._panel || (this._popper = f(this._dropdownBtn, this._panel, {
|
|
32
|
+
placement: "bottom-end",
|
|
33
|
+
strategy: "fixed",
|
|
34
|
+
modifiers: [
|
|
35
|
+
{ name: "offset", options: { offset: [0, 4] } },
|
|
36
|
+
{ name: "preventOverflow", options: { padding: 8 } },
|
|
37
|
+
{ name: "flip", options: { padding: 8 } }
|
|
38
|
+
]
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
_destroyPopper() {
|
|
42
|
+
this._popper?.destroy(), this._popper = void 0;
|
|
43
|
+
}
|
|
44
|
+
_setOpen(t) {
|
|
45
|
+
this._open !== t && (this._open = t, this.dispatchEvent(
|
|
46
|
+
new CustomEvent(t ? "dropdown-open" : "dropdown-close", {
|
|
47
|
+
bubbles: !0,
|
|
48
|
+
composed: !0
|
|
49
|
+
})
|
|
50
|
+
));
|
|
51
|
+
}
|
|
52
|
+
// ── Event handlers ────────────────────────────────────────────────────────
|
|
53
|
+
_onActionClick(t) {
|
|
54
|
+
t.stopPropagation(), !this.disabled && this.dispatchEvent(new CustomEvent("action", { bubbles: !0, composed: !0 }));
|
|
55
|
+
}
|
|
56
|
+
_onDropdownClick(t) {
|
|
57
|
+
t.stopPropagation(), !(this.disabled || this.dropdownDisabled) && this._setOpen(!this._open);
|
|
58
|
+
}
|
|
59
|
+
_onItemClick(t) {
|
|
60
|
+
t.disabled || (this.dispatchEvent(
|
|
61
|
+
new CustomEvent("item-select", {
|
|
62
|
+
detail: { value: t.value, item: t },
|
|
63
|
+
bubbles: !0,
|
|
64
|
+
composed: !0
|
|
65
|
+
})
|
|
66
|
+
), this._setOpen(!1));
|
|
67
|
+
}
|
|
68
|
+
_onKeydown(t, o) {
|
|
69
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), o === "action" ? this._onActionClick(t) : this._onDropdownClick(t));
|
|
70
|
+
}
|
|
71
|
+
// ── Render ────────────────────────────────────────────────────────────────
|
|
72
|
+
_renderPanel() {
|
|
73
|
+
if (!this._open) return b;
|
|
74
|
+
const t = this.items.length > 0;
|
|
75
|
+
return r`
|
|
76
|
+
<div
|
|
77
|
+
class="split-button__panel"
|
|
78
|
+
role="menu"
|
|
79
|
+
aria-label="${this.label} options"
|
|
80
|
+
>
|
|
81
|
+
${t ? this.items.map((o) => r`
|
|
82
|
+
${o.divider ? r`<div class="split-button__panel-divider" role="separator"></div>` : b}
|
|
83
|
+
<button
|
|
84
|
+
class="split-button__panel-item ${o.disabled ? "split-button__panel-item--disabled" : ""}"
|
|
85
|
+
role="menuitem"
|
|
86
|
+
?disabled=${o.disabled}
|
|
87
|
+
@click=${() => this._onItemClick(o)}
|
|
88
|
+
>
|
|
89
|
+
${o.icon ? r`<ui-icon name=${o.icon} size="16"></ui-icon>` : b}
|
|
90
|
+
<span>${o.label}</span>
|
|
91
|
+
</button>
|
|
92
|
+
`) : r`<slot name="dropdown"></slot>`}
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
const t = this.disabled, o = this.disabled || this.dropdownDisabled;
|
|
98
|
+
return r`
|
|
99
|
+
<div
|
|
100
|
+
class="split-button split-button--${this.size} split-button--${this.theme}
|
|
101
|
+
${this.disabled ? "split-button--disabled" : ""}
|
|
102
|
+
${this._open ? "split-button--open" : ""}"
|
|
103
|
+
role="group"
|
|
104
|
+
>
|
|
105
|
+
<!-- Main action -->
|
|
106
|
+
<button
|
|
107
|
+
class="split-button__action"
|
|
108
|
+
?disabled=${t}
|
|
109
|
+
aria-label=${this.label}
|
|
110
|
+
@click=${this._onActionClick}
|
|
111
|
+
@keydown=${(s) => this._onKeydown(s, "action")}
|
|
112
|
+
type="button"
|
|
113
|
+
>
|
|
114
|
+
<slot name="prefix"></slot>
|
|
115
|
+
<span class="split-button__label">
|
|
116
|
+
<slot>${this.label}</slot>
|
|
117
|
+
</span>
|
|
118
|
+
</button>
|
|
119
|
+
|
|
120
|
+
<!-- Dropdown trigger -->
|
|
121
|
+
<button
|
|
122
|
+
class="split-button__dropdown"
|
|
123
|
+
?disabled=${o}
|
|
124
|
+
aria-label="Open dropdown"
|
|
125
|
+
aria-haspopup="menu"
|
|
126
|
+
aria-expanded=${this._open ? "true" : "false"}
|
|
127
|
+
@click=${this._onDropdownClick}
|
|
128
|
+
@keydown=${(s) => this._onKeydown(s, "dropdown")}
|
|
129
|
+
type="button"
|
|
130
|
+
>
|
|
131
|
+
<ui-icon
|
|
132
|
+
name="uil-angle-down"
|
|
133
|
+
size="16"
|
|
134
|
+
class="split-button__chevron ${this._open ? "split-button__chevron--open" : ""}"
|
|
135
|
+
></ui-icon>
|
|
136
|
+
</button>
|
|
137
|
+
|
|
138
|
+
<!-- Dropdown panel -->
|
|
139
|
+
${this._renderPanel()}
|
|
140
|
+
</div>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
n.styles = [_`${u(w)}`];
|
|
145
|
+
i([
|
|
146
|
+
l({ type: String })
|
|
147
|
+
], n.prototype, "label", 2);
|
|
148
|
+
i([
|
|
149
|
+
l({ type: String })
|
|
150
|
+
], n.prototype, "size", 2);
|
|
151
|
+
i([
|
|
152
|
+
l({ type: String })
|
|
153
|
+
], n.prototype, "theme", 2);
|
|
154
|
+
i([
|
|
155
|
+
l({ type: Boolean })
|
|
156
|
+
], n.prototype, "disabled", 2);
|
|
157
|
+
i([
|
|
158
|
+
l({ type: Boolean })
|
|
159
|
+
], n.prototype, "dropdownDisabled", 2);
|
|
160
|
+
i([
|
|
161
|
+
l({ attribute: !1 })
|
|
162
|
+
], n.prototype, "items", 2);
|
|
163
|
+
i([
|
|
164
|
+
g()
|
|
165
|
+
], n.prototype, "_open", 2);
|
|
166
|
+
i([
|
|
167
|
+
c(".split-button__dropdown")
|
|
168
|
+
], n.prototype, "_dropdownBtn", 2);
|
|
169
|
+
i([
|
|
170
|
+
c(".split-button__panel")
|
|
171
|
+
], n.prototype, "_panel", 2);
|
|
172
|
+
n = i([
|
|
173
|
+
h("logosphere-split-button")
|
|
174
|
+
], n);
|
|
175
|
+
export {
|
|
176
|
+
n as S
|
|
177
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";const n=require("lit"),i=require("lit/decorators.js"),d=require("@popperjs/core");require("./ui-icon-DWl7I5BQ.cjs");const b=":host{display:inline-block;position:relative}.split-button{display:inline-flex;align-items:stretch;gap:1px;font-family:var(--font-family-base);border-radius:var(--radius-base);overflow:hidden}.split-button__action,.split-button__dropdown{display:inline-flex;align-items:center;justify-content:center;border:none;cursor:pointer;font-family:inherit;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);line-height:1.25rem;letter-spacing:-.14px;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background-color var(--transition-speed-base) var(--transition-timing);outline:none}.split-button__action:focus-visible,.split-button__dropdown:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px;position:relative;z-index:1}.split-button__action:disabled,.split-button__dropdown:disabled{cursor:not-allowed;pointer-events:none}.split-button__action{gap:var(--spacing-1)}.split-button__chevron{transition:transform var(--transition-speed-base) var(--transition-timing);display:inline-flex}.split-button__chevron--open{transform:rotate(180deg)}.split-button--sm .split-button__action{padding:var(--spacing-0-5) var(--spacing-2)}.split-button--sm .split-button__dropdown{padding:var(--spacing-0-5) var(--spacing-1-5)}.split-button--md .split-button__action{padding:var(--spacing-1-5) var(--spacing-3)}.split-button--md .split-button__dropdown{padding:var(--spacing-1-5) var(--spacing-2)}.split-button--lg .split-button__action{padding:var(--spacing-2-5) var(--spacing-3)}.split-button--lg .split-button__dropdown{padding:var(--spacing-2-5) var(--spacing-2)}.split-button{background-color:#fff6}.split-button--primary .split-button__action,.split-button--primary .split-button__dropdown{background-color:var(--color-primary);color:#fff}.split-button--primary .split-button__action:hover:not(:disabled),.split-button--primary .split-button__dropdown:hover:not(:disabled){background-color:var(--color-primary-hover)}.split-button--primary .split-button__action:active:not(:disabled),.split-button--primary .split-button__dropdown:active:not(:disabled){background-color:var(--color-primary-active)}.split-button--primary.split-button--disabled,.split-button--primary .split-button__action:disabled,.split-button--primary .split-button__dropdown:disabled{background-color:var(--color-primary-disabled)}.split-button--primary.split-button--disabled .split-button__action,.split-button--primary.split-button--disabled .split-button__dropdown{background-color:var(--color-primary-disabled)}.split-button--secondary .split-button__action,.split-button--secondary .split-button__dropdown{background-color:var(--color-secondary);color:#fff}.split-button--secondary .split-button__action:hover:not(:disabled),.split-button--secondary .split-button__dropdown:hover:not(:disabled){background-color:var(--color-secondary-hover)}.split-button--secondary .split-button__action:active:not(:disabled),.split-button--secondary .split-button__dropdown:active:not(:disabled){background-color:var(--color-secondary-active)}.split-button--secondary.split-button--disabled .split-button__action,.split-button--secondary.split-button--disabled .split-button__dropdown,.split-button--secondary .split-button__action:disabled,.split-button--secondary .split-button__dropdown:disabled{background-color:var(--color-secondary-disabled)}.split-button--success .split-button__action,.split-button--success .split-button__dropdown{background-color:var(--color-success);color:#fff}.split-button--success .split-button__action:hover:not(:disabled),.split-button--success .split-button__dropdown:hover:not(:disabled){background-color:var(--color-success-hover)}.split-button--success .split-button__action:active:not(:disabled),.split-button--success .split-button__dropdown:active:not(:disabled){background-color:var(--color-success-active)}.split-button--success.split-button--disabled .split-button__action,.split-button--success.split-button--disabled .split-button__dropdown,.split-button--success .split-button__action:disabled,.split-button--success .split-button__dropdown:disabled{background-color:var(--color-success-disabled)}.split-button--danger .split-button__action,.split-button--danger .split-button__dropdown{background-color:var(--color-danger);color:#fff}.split-button--danger .split-button__action:hover:not(:disabled),.split-button--danger .split-button__dropdown:hover:not(:disabled){background-color:var(--color-danger-hover)}.split-button--danger .split-button__action:active:not(:disabled),.split-button--danger .split-button__dropdown:active:not(:disabled){background-color:var(--color-danger-active)}.split-button--danger.split-button--disabled .split-button__action,.split-button--danger.split-button--disabled .split-button__dropdown,.split-button--danger .split-button__action:disabled,.split-button--danger .split-button__dropdown:disabled{background-color:var(--color-danger-disabled)}.split-button--info .split-button__action,.split-button--info .split-button__dropdown{background-color:var(--color-info);color:#fff}.split-button--info .split-button__action:hover:not(:disabled),.split-button--info .split-button__dropdown:hover:not(:disabled){background-color:var(--color-info-hover)}.split-button--info .split-button__action:active:not(:disabled),.split-button--info .split-button__dropdown:active:not(:disabled){background-color:var(--color-info-active)}.split-button--info.split-button--disabled .split-button__action,.split-button--info.split-button--disabled .split-button__dropdown,.split-button--info .split-button__action:disabled,.split-button--info .split-button__dropdown:disabled{background-color:var(--color-info-disabled)}.split-button--warning .split-button__action,.split-button--warning .split-button__dropdown{background-color:var(--color-warning);color:var(--color-warning-emphasis)}.split-button--warning .split-button__action:hover:not(:disabled),.split-button--warning .split-button__dropdown:hover:not(:disabled){background-color:var(--color-warning-hover)}.split-button--warning .split-button__action:active:not(:disabled),.split-button--warning .split-button__dropdown:active:not(:disabled){background-color:var(--color-warning-active)}.split-button--warning.split-button--disabled .split-button__action,.split-button--warning.split-button--disabled .split-button__dropdown,.split-button--warning .split-button__action:disabled,.split-button--warning .split-button__dropdown:disabled{background-color:var(--color-warning-disabled)}.split-button__panel{position:fixed;z-index:var(--z-index-dropdown);min-width:160px;background-color:var(--color-body-bg);border:1px solid var(--color-border);border-radius:var(--radius-base);box-shadow:var(--shadow-lg);padding:var(--spacing-1) 0;outline:none}.split-button__panel-item{display:flex;align-items:center;gap:var(--spacing-2);width:100%;padding:var(--spacing-2) var(--spacing-3);background:none;border:none;cursor:pointer;font-family:var(--font-family-base);font-size:var(--font-size-sm);font-weight:var(--font-weight-regular);color:var(--color-body-color);text-align:left;white-space:nowrap;transition:background-color var(--transition-speed-fast) var(--transition-timing);box-sizing:border-box}.split-button__panel-item:hover:not(:disabled){background-color:var(--color-body-bg-hover)}.split-button__panel-item:active:not(:disabled){background-color:var(--color-body-bg-active)}.split-button__panel-item--disabled,.split-button__panel-item:disabled{color:var(--color-secondary-disabled);cursor:not-allowed;pointer-events:none}.split-button__panel-divider{height:1px;background-color:var(--color-border);margin:var(--spacing-1) 0}";var c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,s=(l,t,o,e)=>{for(var r=e>1?void 0:e?u(t,o):t,a=l.length-1,p;a>=0;a--)(p=l[a])&&(r=(e?p(t,o,r):p(r))||r);return e&&r&&c(t,o,r),r};exports.SplitButton=class extends n.LitElement{constructor(){super(...arguments),this.label="Button",this.size="md",this.theme="primary",this.disabled=!1,this.dropdownDisabled=!1,this.items=[],this._open=!1,this._onDocClick=t=>{this._open&&(t.composedPath().includes(this)||this._setOpen(!1))},this._onDocKeydown=t=>{t.key==="Escape"&&this._open&&this._setOpen(!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._onDocClick,{capture:!0}),document.addEventListener("keydown",this._onDocKeydown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._onDocClick,{capture:!0}),document.removeEventListener("keydown",this._onDocKeydown),this._destroyPopper()}updated(t){super.updated(t),t.has("_open")&&(this._open?this._initPopper():this._destroyPopper())}_initPopper(){!this._dropdownBtn||!this._panel||(this._popper=d.createPopper(this._dropdownBtn,this._panel,{placement:"bottom-end",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,4]}},{name:"preventOverflow",options:{padding:8}},{name:"flip",options:{padding:8}}]}))}_destroyPopper(){this._popper?.destroy(),this._popper=void 0}_setOpen(t){this._open!==t&&(this._open=t,this.dispatchEvent(new CustomEvent(t?"dropdown-open":"dropdown-close",{bubbles:!0,composed:!0})))}_onActionClick(t){t.stopPropagation(),!this.disabled&&this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0}))}_onDropdownClick(t){t.stopPropagation(),!(this.disabled||this.dropdownDisabled)&&this._setOpen(!this._open)}_onItemClick(t){t.disabled||(this.dispatchEvent(new CustomEvent("item-select",{detail:{value:t.value,item:t},bubbles:!0,composed:!0})),this._setOpen(!1))}_onKeydown(t,o){(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),o==="action"?this._onActionClick(t):this._onDropdownClick(t))}_renderPanel(){if(!this._open)return n.nothing;const t=this.items.length>0;return n.html`
|
|
2
|
+
<div
|
|
3
|
+
class="split-button__panel"
|
|
4
|
+
role="menu"
|
|
5
|
+
aria-label="${this.label} options"
|
|
6
|
+
>
|
|
7
|
+
${t?this.items.map(o=>n.html`
|
|
8
|
+
${o.divider?n.html`<div class="split-button__panel-divider" role="separator"></div>`:n.nothing}
|
|
9
|
+
<button
|
|
10
|
+
class="split-button__panel-item ${o.disabled?"split-button__panel-item--disabled":""}"
|
|
11
|
+
role="menuitem"
|
|
12
|
+
?disabled=${o.disabled}
|
|
13
|
+
@click=${()=>this._onItemClick(o)}
|
|
14
|
+
>
|
|
15
|
+
${o.icon?n.html`<ui-icon name=${o.icon} size="16"></ui-icon>`:n.nothing}
|
|
16
|
+
<span>${o.label}</span>
|
|
17
|
+
</button>
|
|
18
|
+
`):n.html`<slot name="dropdown"></slot>`}
|
|
19
|
+
</div>
|
|
20
|
+
`}render(){const t=this.disabled,o=this.disabled||this.dropdownDisabled;return n.html`
|
|
21
|
+
<div
|
|
22
|
+
class="split-button split-button--${this.size} split-button--${this.theme}
|
|
23
|
+
${this.disabled?"split-button--disabled":""}
|
|
24
|
+
${this._open?"split-button--open":""}"
|
|
25
|
+
role="group"
|
|
26
|
+
>
|
|
27
|
+
<!-- Main action -->
|
|
28
|
+
<button
|
|
29
|
+
class="split-button__action"
|
|
30
|
+
?disabled=${t}
|
|
31
|
+
aria-label=${this.label}
|
|
32
|
+
@click=${this._onActionClick}
|
|
33
|
+
@keydown=${e=>this._onKeydown(e,"action")}
|
|
34
|
+
type="button"
|
|
35
|
+
>
|
|
36
|
+
<slot name="prefix"></slot>
|
|
37
|
+
<span class="split-button__label">
|
|
38
|
+
<slot>${this.label}</slot>
|
|
39
|
+
</span>
|
|
40
|
+
</button>
|
|
41
|
+
|
|
42
|
+
<!-- Dropdown trigger -->
|
|
43
|
+
<button
|
|
44
|
+
class="split-button__dropdown"
|
|
45
|
+
?disabled=${o}
|
|
46
|
+
aria-label="Open dropdown"
|
|
47
|
+
aria-haspopup="menu"
|
|
48
|
+
aria-expanded=${this._open?"true":"false"}
|
|
49
|
+
@click=${this._onDropdownClick}
|
|
50
|
+
@keydown=${e=>this._onKeydown(e,"dropdown")}
|
|
51
|
+
type="button"
|
|
52
|
+
>
|
|
53
|
+
<ui-icon
|
|
54
|
+
name="uil-angle-down"
|
|
55
|
+
size="16"
|
|
56
|
+
class="split-button__chevron ${this._open?"split-button__chevron--open":""}"
|
|
57
|
+
></ui-icon>
|
|
58
|
+
</button>
|
|
59
|
+
|
|
60
|
+
<!-- Dropdown panel -->
|
|
61
|
+
${this._renderPanel()}
|
|
62
|
+
</div>
|
|
63
|
+
`}};exports.SplitButton.styles=[n.css`${n.unsafeCSS(b)}`];s([i.property({type:String})],exports.SplitButton.prototype,"label",2);s([i.property({type:String})],exports.SplitButton.prototype,"size",2);s([i.property({type:String})],exports.SplitButton.prototype,"theme",2);s([i.property({type:Boolean})],exports.SplitButton.prototype,"disabled",2);s([i.property({type:Boolean})],exports.SplitButton.prototype,"dropdownDisabled",2);s([i.property({attribute:!1})],exports.SplitButton.prototype,"items",2);s([i.state()],exports.SplitButton.prototype,"_open",2);s([i.query(".split-button__dropdown")],exports.SplitButton.prototype,"_dropdownBtn",2);s([i.query(".split-button__panel")],exports.SplitButton.prototype,"_panel",2);exports.SplitButton=s([i.customElement("logosphere-split-button")],exports.SplitButton);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./split-button-BpffPlVg.cjs");Object.defineProperty(exports,"SplitButton",{enumerable:!0,get:()=>t.SplitButton});
|