@logosphere-ui/core 0.0.0-alpha.32 → 0.0.0-alpha.35

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.
@@ -0,0 +1,360 @@
1
+ import { LitElement as h, unsafeCSS as b, css as v, html as i, nothing as p } from "lit";
2
+ import { property as o, state as f, query as _ } from "lit/decorators.js";
3
+ import { live as y } from "lit/directives/live.js";
4
+ import "./ui-icon-Ctn4nGFa.js";
5
+ import "./combobox-CTqEZUg6.js";
6
+ const x = ":host{display:block;width:100%}.pagination{display:flex;align-items:center;justify-content:space-between;padding:var(--spacing-4) var(--spacing-6);background-color:var(--color-body-bg);border-top:1px solid var(--color-border);font-family:var(--font-family-base);gap:var(--spacing-4)}.pagination--justify-end{justify-content:flex-end}.pagination--justify-start{justify-content:flex-start}.pagination--justify-center{justify-content:center}.pagination__nav{display:flex;align-items:center;gap:var(--spacing-1)}.pagination__nav-group{display:flex;align-items:center}.pagination__btn{display:flex;align-items:center;justify-content:center;padding:var(--spacing-2);border:none;background:transparent;border-radius:var(--radius-base);cursor:pointer;color:var(--color-secondary);transition:background-color .15s ease,color .15s ease,opacity .15s ease}.pagination__btn:hover:not(:disabled){background-color:var(--color-body-bg-hover)}.pagination__btn:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.pagination__btn:disabled{opacity:.4;cursor:not-allowed}.pagination__btn--icon{display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:var(--spacing-2);border:1px solid var(--color-border);background-color:var(--color-body-bg);border-radius:var(--radius-base);cursor:pointer;color:var(--color-secondary);transition:background-color .15s ease,border-color .15s ease,opacity .15s ease}.pagination__btn--icon:hover:not(:disabled){background-color:var(--color-body-bg-hover);border-color:var(--color-border-hover)}.pagination__btn--icon:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.pagination__btn--icon:disabled{opacity:.4;cursor:not-allowed}.pagination__btn--text{display:flex;align-items:center;justify-content:center;gap:var(--spacing-1);height:32px;min-width:100px;padding:var(--spacing-1) var(--spacing-3);border:1px solid var(--color-border);background-color:var(--color-body-bg);border-radius:var(--radius-base);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);color:var(--color-secondary);cursor:pointer;transition:all .15s ease}.pagination__btn--text:hover:not(:disabled){background-color:var(--color-body-bg-hover);border-color:var(--color-border-hover)}.pagination__btn--text:disabled{color:var(--color-secondary-disabled);cursor:not-allowed}.pagination__btn--number{display:flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:var(--spacing-1) var(--spacing-3);border:1px solid var(--color-border);background-color:var(--color-body-bg);border-radius:var(--radius-base);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);color:var(--color-secondary);cursor:pointer;transition:all .15s ease}.pagination__btn--number:hover:not(:disabled):not(.pagination__btn--active){background-color:var(--color-body-bg-hover)}.pagination__btn--active{background-color:var(--color-secondary);border-color:var(--color-secondary);color:#fff;font-weight:var(--font-weight-semibold)}.pagination__btn--ellipsis{border:none;background:transparent;cursor:default;min-width:32px}.pagination__btn--ellipsis:hover{background:transparent}.pagination__input-container{display:flex;align-items:center;justify-content:center;min-width:32px;height:32px}.pagination__input{width:100%;height:100%;min-width:32px;padding:0;border:1px solid var(--color-border);border-radius:var(--radius-base);background-color:var(--color-body-bg);font-size:var(--font-size-sm);font-weight:var(--font-weight-regular);color:var(--color-body-text);text-align:center;outline:none;transition:border-color .15s ease}.pagination__input:focus{border-color:var(--color-primary)}.pagination__input::-webkit-outer-spin-button,.pagination__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.pagination__input[type=number]{-moz-appearance:textfield}.pagination__separator{font-size:var(--font-size-xs);font-weight:var(--font-weight-regular);color:var(--color-tertiary);line-height:18px;letter-spacing:-.12px;margin-right:var(--spacing-1)}.pagination__info{display:flex;align-items:center;gap:var(--spacing-2)}.pagination__page-info{display:flex;align-items:center;gap:var(--spacing-1);font-size:var(--font-size-xs);line-height:18px;letter-spacing:-.12px}.pagination__page-info-text{color:var(--color-secondary)}.pagination__page-info-separator{color:var(--color-tertiary)}.pagination__total{display:flex;align-items:center;gap:var(--spacing-1);font-size:var(--font-size-xs);line-height:18px;letter-spacing:-.12px}.pagination__total-separator{color:var(--color-tertiary)}.pagination__total-text{color:var(--color-secondary)}.pagination__page-size{display:flex;align-items:center}@media(max-width:768px){.pagination{flex-wrap:wrap;gap:var(--spacing-3);padding:var(--spacing-3) var(--spacing-4)}.pagination__btn--text{min-width:80px;font-size:var(--font-size-xs)}}@media(max-width:480px){.pagination__nav,.pagination__info{flex-wrap:wrap;justify-content:center}}";
7
+ var m = Object.defineProperty, n = (u, t, e, r) => {
8
+ for (var s = void 0, l = u.length - 1, g; l >= 0; l--)
9
+ (g = u[l]) && (s = g(t, e, s) || s);
10
+ return s && m(t, e, s), s;
11
+ };
12
+ const c = class c extends h {
13
+ constructor() {
14
+ super(...arguments), this.variant = "default", this.page = 1, this.pageSize = 25, this.total = 0, this.pageSizeOptions = [10, 25, 50, 100], this.showPageSize = !0, this.showTotal = !0, this.disabled = !1, this.prevLabel = "Önceki", this.nextLabel = "Sonraki", this.pageLabel = "Sayfa", this.perPageLabel = "/ sayfa", this.totalLabel = "kayıt", this.inputValue = "1", this.goFirst = () => {
15
+ this.canGoPrev && this.goToPage(1);
16
+ }, this.goPrev = () => {
17
+ this.canGoPrev && this.goToPage(this.page - 1);
18
+ }, this.goNext = () => {
19
+ this.canGoNext && this.goToPage(this.page + 1);
20
+ }, this.goLast = () => {
21
+ this.canGoNext && this.goToPage(this.totalPages);
22
+ }, this.handleInputChange = (t) => {
23
+ const e = t.target;
24
+ this.inputValue = e.value;
25
+ }, this.handleInputBlur = () => {
26
+ const t = parseInt(this.inputValue, 10);
27
+ isNaN(t) ? this.inputValue = String(this.page) : this.goToPage(t);
28
+ }, this.handleInputKeydown = (t) => {
29
+ t.key === "Enter" && t.target.blur();
30
+ }, this.handlePageSizeChange = (t) => {
31
+ const e = t.detail?.value?.[0];
32
+ if (e) {
33
+ const r = e.value;
34
+ r !== this.pageSize && (this.pageSize = r, this.page = 1, this.emitPageChange());
35
+ }
36
+ };
37
+ }
38
+ get totalPages() {
39
+ return Math.max(1, Math.ceil(this.total / this.pageSize));
40
+ }
41
+ get canGoPrev() {
42
+ return this.page > 1 && !this.disabled;
43
+ }
44
+ get canGoNext() {
45
+ return this.page < this.totalPages && !this.disabled;
46
+ }
47
+ firstUpdated() {
48
+ this.updateComboboxSelection();
49
+ }
50
+ updated(t) {
51
+ super.updated(t), t.has("page") && (this.inputValue = String(this.page)), t.has("pageSize") && this.updateComboboxSelection();
52
+ }
53
+ updateComboboxSelection() {
54
+ this._combobox && this.showPageSize && this._combobox.setSelected(this.selectedPageSizeItem);
55
+ }
56
+ emitPageChange() {
57
+ this.dispatchEvent(new CustomEvent("page-change", {
58
+ bubbles: !0,
59
+ composed: !0,
60
+ detail: {
61
+ page: this.page,
62
+ pageSize: this.pageSize,
63
+ totalPages: this.totalPages
64
+ }
65
+ }));
66
+ }
67
+ goToPage(t) {
68
+ const e = Math.max(1, Math.min(t, this.totalPages));
69
+ e !== this.page && (this.page = e, this.emitPageChange());
70
+ }
71
+ get pageSizeItems() {
72
+ return this.pageSizeOptions.map((t) => ({
73
+ label: `${t} ${this.perPageLabel}`,
74
+ value: t
75
+ }));
76
+ }
77
+ get selectedPageSizeItem() {
78
+ return [{ label: `${this.pageSize} ${this.perPageLabel}`, value: this.pageSize }];
79
+ }
80
+ getPageNumbers() {
81
+ const t = [], e = this.totalPages, r = this.page, s = 1;
82
+ if (e <= 7)
83
+ for (let l = 1; l <= e; l++) t.push(l);
84
+ else {
85
+ t.push(1), r > 3 && t.push("ellipsis");
86
+ const l = Math.max(2, r - s), g = Math.min(e - 1, r + s);
87
+ for (let d = l; d <= g; d++)
88
+ t.includes(d) || t.push(d);
89
+ r < e - 2 && t.push("ellipsis"), t.includes(e) || t.push(e);
90
+ }
91
+ return t;
92
+ }
93
+ renderNavButtons(t = !1) {
94
+ const e = t ? "pagination__btn--icon" : "pagination__btn";
95
+ return i`
96
+ <div class="pagination__nav-group">
97
+ <button
98
+ type="button"
99
+ class="${e}"
100
+ ?disabled=${!this.canGoPrev}
101
+ @click=${this.goFirst}
102
+ aria-label="İlk sayfa"
103
+ >
104
+ <ui-icon name="uil-angle-double-left" size="16"></ui-icon>
105
+ </button>
106
+ <button
107
+ type="button"
108
+ class="${e}"
109
+ ?disabled=${!this.canGoPrev}
110
+ @click=${this.goPrev}
111
+ aria-label="Önceki sayfa"
112
+ >
113
+ <ui-icon name="uil-angle-left" size="16"></ui-icon>
114
+ </button>
115
+ </div>
116
+ `;
117
+ }
118
+ renderNavButtonsAfter(t = !1) {
119
+ const e = t ? "pagination__btn--icon" : "pagination__btn";
120
+ return i`
121
+ <div class="pagination__nav-group">
122
+ <button
123
+ type="button"
124
+ class="${e}"
125
+ ?disabled=${!this.canGoNext}
126
+ @click=${this.goNext}
127
+ aria-label="Sonraki sayfa"
128
+ >
129
+ <ui-icon name="uil-angle-right" size="16"></ui-icon>
130
+ </button>
131
+ <button
132
+ type="button"
133
+ class="${e}"
134
+ ?disabled=${!this.canGoNext}
135
+ @click=${this.goLast}
136
+ aria-label="Son sayfa"
137
+ >
138
+ <ui-icon name="uil-angle-double-right" size="16"></ui-icon>
139
+ </button>
140
+ </div>
141
+ `;
142
+ }
143
+ renderPageInput() {
144
+ return i`
145
+ <div class="pagination__input-container">
146
+ <input
147
+ type="number"
148
+ class="pagination__input"
149
+ .value=${y(this.inputValue)}
150
+ min="1"
151
+ max=${this.totalPages}
152
+ ?disabled=${this.disabled}
153
+ @input=${this.handleInputChange}
154
+ @blur=${this.handleInputBlur}
155
+ @keydown=${this.handleInputKeydown}
156
+ aria-label="Sayfa numarası"
157
+ />
158
+ </div>
159
+ <span class="pagination__separator">/ ${this.totalPages}</span>
160
+ `;
161
+ }
162
+ renderPrevNextButtons() {
163
+ return i`
164
+ <button
165
+ type="button"
166
+ class="pagination__btn--text"
167
+ ?disabled=${!this.canGoPrev}
168
+ @click=${this.goPrev}
169
+ >
170
+ <ui-icon name="uil-angle-left" size="16"></ui-icon>
171
+ ${this.prevLabel}
172
+ </button>
173
+ <button
174
+ type="button"
175
+ class="pagination__btn--text"
176
+ ?disabled=${!this.canGoNext}
177
+ @click=${this.goNext}
178
+ >
179
+ ${this.nextLabel}
180
+ <ui-icon name="uil-angle-right" size="16"></ui-icon>
181
+ </button>
182
+ `;
183
+ }
184
+ renderPageInfo() {
185
+ return i`
186
+ <div class="pagination__page-info">
187
+ <span class="pagination__page-info-text">${this.pageLabel} ${this.page}</span>
188
+ <span class="pagination__page-info-separator">/</span>
189
+ <span class="pagination__page-info-text">${this.totalPages}</span>
190
+ </div>
191
+ `;
192
+ }
193
+ renderNumberButtons() {
194
+ const t = this.getPageNumbers();
195
+ return i`
196
+ ${t.map(
197
+ (e, r) => e === "ellipsis" ? i`
198
+ <span
199
+ class="pagination__btn--number pagination__btn--ellipsis"
200
+ key="ellipsis-${r}"
201
+ >...</span>
202
+ ` : i`
203
+ <button
204
+ type="button"
205
+ class="pagination__btn--number ${e === this.page ? "pagination__btn--active" : ""}"
206
+ ?disabled=${this.disabled}
207
+ @click=${() => this.goToPage(e)}
208
+ aria-label="Sayfa ${e}"
209
+ aria-current=${e === this.page ? "page" : p}
210
+ >
211
+ ${e}
212
+ </button>
213
+ `
214
+ )}
215
+ `;
216
+ }
217
+ renderPageSizeDropdown() {
218
+ return this.showPageSize ? i`
219
+ <div class="pagination__page-size">
220
+ <logosphere-combobox
221
+ .items=${this.pageSizeItems}
222
+ .disabled=${this.disabled}
223
+ .clearable=${!1}
224
+ optionLabel="label"
225
+ optionValue="value"
226
+ placeholder=""
227
+ @change=${this.handlePageSizeChange}
228
+ ></logosphere-combobox>
229
+ </div>
230
+ ` : p;
231
+ }
232
+ renderTotalInfo() {
233
+ return this.showTotal ? i`
234
+ <div class="pagination__total">
235
+ <span class="pagination__total-separator">/</span>
236
+ <span class="pagination__total-text">${this.total} ${this.totalLabel}</span>
237
+ </div>
238
+ ` : p;
239
+ }
240
+ renderDefault() {
241
+ return i`
242
+ <div class="pagination__nav">
243
+ ${this.renderNavButtons()}
244
+ ${this.renderPageInput()}
245
+ ${this.renderNavButtonsAfter()}
246
+ </div>
247
+ <div class="pagination__info">
248
+ ${this.renderPageSizeDropdown()}
249
+ ${this.renderTotalInfo()}
250
+ </div>
251
+ `;
252
+ }
253
+ renderPrevNext() {
254
+ return i`
255
+ <div class="pagination__nav" style="gap: 8px;">
256
+ ${this.renderPrevNextButtons()}
257
+ </div>
258
+ <div class="pagination__info">
259
+ ${this.renderPageInfo()}
260
+ </div>
261
+ `;
262
+ }
263
+ renderPrevNextInverted() {
264
+ return i`
265
+ <div class="pagination__info">
266
+ ${this.renderPageInfo()}
267
+ </div>
268
+ <div class="pagination__nav" style="gap: 8px;">
269
+ ${this.renderPrevNextButtons()}
270
+ </div>
271
+ `;
272
+ }
273
+ renderPrevNextOnly() {
274
+ return i`
275
+ <div class="pagination__nav" style="gap: 8px; margin-left: auto;">
276
+ ${this.renderPrevNextButtons()}
277
+ </div>
278
+ `;
279
+ }
280
+ renderNumberButtonsVariant() {
281
+ return i`
282
+ <div class="pagination__nav">
283
+ ${this.renderNavButtons(!0)}
284
+ ${this.renderNumberButtons()}
285
+ ${this.renderNavButtonsAfter(!0)}
286
+ </div>
287
+ <div class="pagination__info">
288
+ ${this.renderPageSizeDropdown()}
289
+ ${this.renderTotalInfo()}
290
+ </div>
291
+ `;
292
+ }
293
+ render() {
294
+ const t = this.variant === "prev-next-only" ? "pagination--justify-end" : "";
295
+ return i`
296
+ <nav
297
+ class="pagination ${t}"
298
+ role="navigation"
299
+ aria-label="Sayfalama"
300
+ >
301
+ ${this.variant === "default" ? this.renderDefault() : p}
302
+ ${this.variant === "prev-next" ? this.renderPrevNext() : p}
303
+ ${this.variant === "prev-next-inverted" ? this.renderPrevNextInverted() : p}
304
+ ${this.variant === "prev-next-only" ? this.renderPrevNextOnly() : p}
305
+ ${this.variant === "number-buttons" ? this.renderNumberButtonsVariant() : p}
306
+ </nav>
307
+ `;
308
+ }
309
+ };
310
+ c.styles = [v`${b(x)}`];
311
+ let a = c;
312
+ n([
313
+ o({ type: String })
314
+ ], a.prototype, "variant");
315
+ n([
316
+ o({ type: Number })
317
+ ], a.prototype, "page");
318
+ n([
319
+ o({ type: Number })
320
+ ], a.prototype, "pageSize");
321
+ n([
322
+ o({ type: Number })
323
+ ], a.prototype, "total");
324
+ n([
325
+ o({ type: Array })
326
+ ], a.prototype, "pageSizeOptions");
327
+ n([
328
+ o({ type: Boolean })
329
+ ], a.prototype, "showPageSize");
330
+ n([
331
+ o({ type: Boolean })
332
+ ], a.prototype, "showTotal");
333
+ n([
334
+ o({ type: Boolean })
335
+ ], a.prototype, "disabled");
336
+ n([
337
+ o({ type: String })
338
+ ], a.prototype, "prevLabel");
339
+ n([
340
+ o({ type: String })
341
+ ], a.prototype, "nextLabel");
342
+ n([
343
+ o({ type: String })
344
+ ], a.prototype, "pageLabel");
345
+ n([
346
+ o({ type: String })
347
+ ], a.prototype, "perPageLabel");
348
+ n([
349
+ o({ type: String })
350
+ ], a.prototype, "totalLabel");
351
+ n([
352
+ f()
353
+ ], a.prototype, "inputValue");
354
+ n([
355
+ _("logosphere-combobox")
356
+ ], a.prototype, "_combobox");
357
+ customElements.get("logosphere-pagination") || customElements.define("logosphere-pagination", a);
358
+ export {
359
+ a as P
360
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./pagination-AclB9qi1.cjs");exports.Pagination=i.Pagination;
@@ -0,0 +1,4 @@
1
+ import { P as i } from "./pagination-BLNrwUSO.js";
2
+ export {
3
+ i as Pagination
4
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared Button Types
3
+ * Used by Button, SplitButton, and any other component that needs button-like sizing/theming.
4
+ */
5
+ export type ButtonVariant = "solid" | "outline" | "text";
6
+ export type ButtonSize = "sm" | "md" | "lg";
7
+ export type ButtonTheme = "primary" | "secondary" | "success" | "danger" | "info" | "warning" | "light" | "dark";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logosphere-ui/core",
3
- "version": "0.0.0-alpha.32",
3
+ "version": "0.0.0-alpha.35",
4
4
  "description": "A modern, framework-agnostic UI component library built with Lit and Web Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -76,6 +76,11 @@
76
76
  "import": "./dist/input.js",
77
77
  "require": "./dist/input.cjs"
78
78
  },
79
+ "./pagination": {
80
+ "types": "./dist/molecules/Pagination/index.d.ts",
81
+ "import": "./dist/pagination.js",
82
+ "require": "./dist/pagination.cjs"
83
+ },
79
84
  "./formfield": {
80
85
  "types": "./dist/atoms/FormField/index.d.ts",
81
86
  "import": "./dist/formfield.js",
@@ -86,6 +91,31 @@
86
91
  "import": "./dist/combobox.js",
87
92
  "require": "./dist/combobox.cjs"
88
93
  },
94
+ "./slider": {
95
+ "types": "./dist/atoms/Slider/index.d.ts",
96
+ "import": "./dist/slider.js",
97
+ "require": "./dist/slider.cjs"
98
+ },
99
+ "./stepper": {
100
+ "types": "./dist/molecules/Stepper/index.d.ts",
101
+ "import": "./dist/stepper.js",
102
+ "require": "./dist/stepper.cjs"
103
+ },
104
+ "./split-button": {
105
+ "types": "./dist/molecules/SplitButton/index.d.ts",
106
+ "import": "./dist/split-button.js",
107
+ "require": "./dist/split-button.cjs"
108
+ },
109
+ "./collapse": {
110
+ "types": "./dist/molecules/Collapse/index.d.ts",
111
+ "import": "./dist/collapse.js",
112
+ "require": "./dist/collapse.cjs"
113
+ },
114
+ "./accordion": {
115
+ "types": "./dist/molecules/Accordion/index.d.ts",
116
+ "import": "./dist/accordion.js",
117
+ "require": "./dist/accordion.cjs"
118
+ },
89
119
  "./textarea": {
90
120
  "types": "./dist/molecules/Textarea/index.d.ts",
91
121
  "import": "./dist/textarea.js",