reke-ui 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +2 -0
  2. package/custom-elements.json +216 -116
  3. package/dist/components/reke-alert/reke-alert.js +53 -0
  4. package/dist/components/reke-alert/reke-alert.styles.d.ts.map +1 -1
  5. package/dist/components/reke-alert/reke-alert.styles.js +106 -0
  6. package/dist/components/reke-badge/reke-badge.d.ts +4 -2
  7. package/dist/components/reke-badge/reke-badge.d.ts.map +1 -1
  8. package/dist/components/reke-badge/reke-badge.js +44 -0
  9. package/dist/components/reke-badge/reke-badge.styles.d.ts.map +1 -1
  10. package/dist/components/reke-badge/reke-badge.styles.js +95 -0
  11. package/dist/components/reke-button/reke-button.js +64 -0
  12. package/dist/components/reke-button/reke-button.styles.d.ts.map +1 -1
  13. package/dist/components/reke-button/reke-button.styles.js +229 -0
  14. package/dist/components/reke-card/reke-card.d.ts +7 -0
  15. package/dist/components/reke-card/reke-card.d.ts.map +1 -1
  16. package/dist/components/reke-card/reke-card.js +70 -0
  17. package/dist/components/reke-card/reke-card.styles.d.ts.map +1 -1
  18. package/dist/components/reke-card/reke-card.styles.js +150 -0
  19. package/dist/components/reke-checkbox/reke-checkbox.js +64 -0
  20. package/dist/components/reke-checkbox/reke-checkbox.styles.js +81 -0
  21. package/dist/components/reke-chip/reke-chip.js +70 -0
  22. package/dist/components/reke-chip/reke-chip.styles.d.ts.map +1 -1
  23. package/dist/components/reke-chip/reke-chip.styles.js +125 -0
  24. package/dist/components/reke-date-range/reke-date-range.js +346 -0
  25. package/dist/components/reke-date-range/reke-date-range.styles.js +322 -0
  26. package/dist/components/reke-dialog/reke-dialog.js +90 -0
  27. package/dist/components/reke-dialog/reke-dialog.styles.js +134 -0
  28. package/dist/components/reke-file-upload/reke-file-upload.js +108 -0
  29. package/dist/components/reke-file-upload/reke-file-upload.styles.js +107 -0
  30. package/dist/components/reke-input/reke-input.js +73 -0
  31. package/dist/components/reke-input/reke-input.styles.js +80 -0
  32. package/dist/components/reke-select/reke-select.js +112 -0
  33. package/dist/components/reke-select/reke-select.styles.js +122 -0
  34. package/dist/components/reke-table/reke-table.d.ts +21 -1
  35. package/dist/components/reke-table/reke-table.d.ts.map +1 -1
  36. package/dist/components/reke-table/reke-table.js +191 -0
  37. package/dist/components/reke-table/reke-table.styles.js +207 -0
  38. package/dist/components/reke-textarea/reke-textarea.js +73 -0
  39. package/dist/components/reke-textarea/reke-textarea.styles.js +76 -0
  40. package/dist/components/reke-toast/reke-toast.js +92 -0
  41. package/dist/components/reke-toast/reke-toast.styles.d.ts.map +1 -1
  42. package/dist/components/reke-toast/reke-toast.styles.js +182 -0
  43. package/dist/components/reke-toggle/reke-toggle.js +57 -0
  44. package/dist/components/reke-toggle/reke-toggle.styles.js +71 -0
  45. package/dist/components/reke-tooltip/reke-tooltip.js +67 -0
  46. package/dist/components/reke-tooltip/reke-tooltip.styles.js +67 -0
  47. package/dist/index.d.ts +2 -2
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +36 -0
  50. package/dist/react.js +79 -64
  51. package/dist/shared/base-element.js +16 -0
  52. package/dist/shared/tailwind-styles.js +6 -0
  53. package/dist/shared/tailwind.css.js +4 -0
  54. package/dist/tokens/reke-tokens.css +23 -0
  55. package/package.json +6 -4
  56. package/dist/reke-chip-Xb0Y_Cqo.js +0 -3358
  57. package/dist/reke-ui.js +0 -20
@@ -0,0 +1,191 @@
1
+ import { nothing as h, html as n } from "lit";
2
+ import { property as l, state as c, customElement as b } from "lit/decorators.js";
3
+ import { classMap as y } from "lit/directives/class-map.js";
4
+ import { RekeElement as f } from "../../shared/base-element.js";
5
+ import { styles as u } from "./reke-table.styles.js";
6
+ var m = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (t, e, r, o) => {
7
+ for (var d = o > 1 ? void 0 : o ? w(e, r) : e, i = t.length - 1, p; i >= 0; i--)
8
+ (p = t[i]) && (d = (o ? p(e, r, d) : p(d)) || d);
9
+ return o && d && m(e, r, d), d;
10
+ };
11
+ let s = class extends f {
12
+ constructor() {
13
+ super(...arguments), this.columns = [], this.rows = [], this.striped = !1, this.dense = !1, this.hoverable = !1, this.bordered = !1, this.borderless = !1, this.sortKey = "", this.sortDirection = "asc", this.expandedRowRender = null, this.expandedRowElement = null, this.expandedRows = /* @__PURE__ */ new Set(), this._expandCleanups = /* @__PURE__ */ new Map(), this._hasToolbar = !1, this._hasFooter = !1;
14
+ }
15
+ handleHeaderClick(t) {
16
+ t.sortable !== !1 && (this.sortKey === t.key ? this.sortDirection = this.sortDirection === "asc" ? "desc" : "asc" : (this.sortKey = t.key, this.sortDirection = "asc"), this.emit("reke-sort", { key: this.sortKey, direction: this.sortDirection }));
17
+ }
18
+ handleRowClick(t, e) {
19
+ this.emit("reke-row-click", { row: t, index: e });
20
+ }
21
+ /** Toggle expand state for a row at the given index. */
22
+ toggleExpand(t) {
23
+ const e = new Set(this.expandedRows), r = this.rows[t], o = !e.has(t);
24
+ if (o)
25
+ e.add(t);
26
+ else {
27
+ e.delete(t);
28
+ const d = this._expandCleanups.get(t);
29
+ d && (d(), this._expandCleanups.delete(t));
30
+ }
31
+ this.expandedRows = e, this.emit("reke-row-expand", { row: r, index: t, expanded: o });
32
+ }
33
+ /** Check whether a row at the given index is currently expanded. */
34
+ isRowExpanded(t) {
35
+ return this.expandedRows.has(t);
36
+ }
37
+ _onToolbarSlotChange(t) {
38
+ const e = t.target;
39
+ this._hasToolbar = e.assignedNodes({ flatten: !0 }).length > 0;
40
+ }
41
+ _onFooterSlotChange(t) {
42
+ const e = t.target;
43
+ this._hasFooter = e.assignedNodes({ flatten: !0 }).length > 0;
44
+ }
45
+ _renderRow(t, e) {
46
+ const r = this.expandedRows.has(e);
47
+ return n`
48
+ <tr
49
+ part="row"
50
+ class="row ${e % 2 === 1 ? "row--even" : ""} ${r ? "row--expanded" : ""}"
51
+ @click=${() => this.handleRowClick(t, e)}
52
+ >
53
+ ${this.columns.map(
54
+ (o) => n`
55
+ <td
56
+ part="cell"
57
+ class="cell"
58
+ data-align=${o.align || "left"}
59
+ >
60
+ ${o.render ? o.render(t[o.key], t, e) : t[o.key] ?? ""}
61
+ </td>
62
+ `
63
+ )}
64
+ </tr>
65
+ ${(this.expandedRowElement || this.expandedRowRender) && r ? n`
66
+ <tr part="expand-row" class="expand-row">
67
+ <td part="expand-content" class="expand-content" colspan=${this.columns.length}>
68
+ ${this.expandedRowElement ? this._renderExpandedElement(t, e) : this.expandedRowRender(t, e)}
69
+ </td>
70
+ </tr>
71
+ ` : h}
72
+ `;
73
+ }
74
+ _renderExpandedElement(t, e) {
75
+ const r = document.createElement("div");
76
+ r.style.cssText = "display: contents;";
77
+ const o = this.expandedRowElement(r, t, e);
78
+ return o && this._expandCleanups.set(e, o), r;
79
+ }
80
+ disconnectedCallback() {
81
+ super.disconnectedCallback(), this._expandCleanups.forEach((t) => t()), this._expandCleanups.clear();
82
+ }
83
+ render() {
84
+ const t = {
85
+ table: !0,
86
+ "table--striped": this.striped,
87
+ "table--dense": this.dense,
88
+ "table--hoverable": this.hoverable,
89
+ "table--bordered": this.bordered
90
+ };
91
+ return n`
92
+ <div class="table-container">
93
+ ${this._hasToolbar ? n`
94
+ <div part="toolbar" class="table-toolbar">
95
+ <slot name="toolbar" @slotchange=${this._onToolbarSlotChange}></slot>
96
+ </div>
97
+ ` : n`<slot name="toolbar" @slotchange=${this._onToolbarSlotChange} style="display:none"></slot>`}
98
+
99
+ <div class="table-wrapper">
100
+ <table part="table" class=${y(t)} role="table">
101
+ <thead part="header">
102
+ <tr>
103
+ ${this.columns.map(
104
+ (e) => n`
105
+ <th
106
+ part="header-cell"
107
+ class="header-cell ${this.sortKey === e.key ? "header-cell--sorted" : ""} ${e.sortable === !1 ? "header-cell--no-sort" : ""}"
108
+ style=${e.width ? `width: ${e.width}` : ""}
109
+ data-align=${e.align || "left"}
110
+ @click=${() => this.handleHeaderClick(e)}
111
+ >
112
+ <span class="header-content">
113
+ ${e.header}
114
+ ${this.sortKey === e.key ? n`<span class="sort-indicator" aria-hidden="true">${this.sortDirection === "asc" ? "↑" : "↓"}</span>` : h}
115
+ </span>
116
+ </th>
117
+ `
118
+ )}
119
+ </tr>
120
+ </thead>
121
+ <tbody part="body">
122
+ ${this.rows.map((e, r) => this._renderRow(e, r))}
123
+ ${this.rows.length === 0 ? n`
124
+ <tr class="row row--empty">
125
+ <td class="cell cell--empty" colspan=${this.columns.length}>
126
+ <slot name="empty">No data</slot>
127
+ </td>
128
+ </tr>
129
+ ` : h}
130
+ </tbody>
131
+ </table>
132
+ </div>
133
+
134
+ ${this._hasFooter ? n`
135
+ <div part="footer" class="table-footer">
136
+ <slot name="footer" @slotchange=${this._onFooterSlotChange}></slot>
137
+ </div>
138
+ ` : n`<slot name="footer" @slotchange=${this._onFooterSlotChange} style="display:none"></slot>`}
139
+ </div>
140
+ `;
141
+ }
142
+ };
143
+ s.styles = u;
144
+ a([
145
+ l({ attribute: !1 })
146
+ ], s.prototype, "columns", 2);
147
+ a([
148
+ l({ attribute: !1 })
149
+ ], s.prototype, "rows", 2);
150
+ a([
151
+ l({ type: Boolean, reflect: !0 })
152
+ ], s.prototype, "striped", 2);
153
+ a([
154
+ l({ type: Boolean, reflect: !0 })
155
+ ], s.prototype, "dense", 2);
156
+ a([
157
+ l({ type: Boolean, reflect: !0 })
158
+ ], s.prototype, "hoverable", 2);
159
+ a([
160
+ l({ type: Boolean, reflect: !0 })
161
+ ], s.prototype, "bordered", 2);
162
+ a([
163
+ l({ type: Boolean, reflect: !0 })
164
+ ], s.prototype, "borderless", 2);
165
+ a([
166
+ l({ reflect: !0, attribute: "sort-key" })
167
+ ], s.prototype, "sortKey", 2);
168
+ a([
169
+ l({ reflect: !0, attribute: "sort-direction" })
170
+ ], s.prototype, "sortDirection", 2);
171
+ a([
172
+ l({ attribute: !1 })
173
+ ], s.prototype, "expandedRowRender", 2);
174
+ a([
175
+ l({ attribute: !1 })
176
+ ], s.prototype, "expandedRowElement", 2);
177
+ a([
178
+ l({ attribute: !1 })
179
+ ], s.prototype, "expandedRows", 2);
180
+ a([
181
+ c()
182
+ ], s.prototype, "_hasToolbar", 2);
183
+ a([
184
+ c()
185
+ ], s.prototype, "_hasFooter", 2);
186
+ s = a([
187
+ b("reke-table")
188
+ ], s);
189
+ export {
190
+ s as RekeTable
191
+ };
@@ -0,0 +1,207 @@
1
+ import { tailwindStyles as e } from "../../shared/tailwind-styles.js";
2
+ import { css as r } from "lit";
3
+ const t = [
4
+ e,
5
+ r`
6
+ :host {
7
+ display: block;
8
+ }
9
+
10
+ /* === Container (wraps toolbar + table + footer) === */
11
+
12
+ .table-container {
13
+ border: 1px solid var(--reke-color-border, #252525);
14
+ border-radius: var(--reke-radius, 4px);
15
+ overflow: hidden;
16
+ }
17
+
18
+ .table-wrapper {
19
+ overflow-x: auto;
20
+ }
21
+
22
+ .table {
23
+ width: 100%;
24
+ border-collapse: collapse;
25
+ font-family: var(--reke-font-mono, 'JetBrains Mono', ui-monospace, monospace);
26
+ font-size: 13px;
27
+ color: var(--reke-color-text, #E5E5E5);
28
+ background: var(--reke-color-surface, #1A1A1A);
29
+ }
30
+
31
+ /* === Toolbar === */
32
+
33
+ .table-toolbar {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 8px;
37
+ padding: 12px 16px;
38
+ border-bottom: 1px solid var(--reke-color-border, #252525);
39
+ background: var(--reke-color-surface, #1A1A1A);
40
+ }
41
+
42
+ /* === Footer === */
43
+
44
+ .table-footer {
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: space-between;
48
+ padding: 12px 16px;
49
+ border-top: 1px solid var(--reke-color-border, #252525);
50
+ background: var(--reke-color-surface, #1A1A1A);
51
+ font-size: 12px;
52
+ color: var(--reke-color-text-muted, #525252);
53
+ }
54
+
55
+ /* === Header === */
56
+
57
+ thead {
58
+ background: var(--reke-color-surface, #1A1A1A);
59
+ }
60
+
61
+ .header-cell {
62
+ padding: 12px 16px;
63
+ font-size: 11px;
64
+ font-weight: 600;
65
+ text-transform: uppercase;
66
+ letter-spacing: 0.05em;
67
+ color: var(--reke-color-text-muted, #525252);
68
+ border-bottom: 1px solid var(--reke-color-border, #252525);
69
+ cursor: pointer;
70
+ user-select: none;
71
+ white-space: nowrap;
72
+ }
73
+
74
+ .header-cell--no-sort {
75
+ cursor: default;
76
+ }
77
+
78
+ .header-cell[data-align='left'] {
79
+ text-align: left;
80
+ }
81
+
82
+ .header-cell[data-align='center'] {
83
+ text-align: center;
84
+ }
85
+
86
+ .header-cell[data-align='right'] {
87
+ text-align: right;
88
+ }
89
+
90
+ .header-cell:hover {
91
+ color: var(--reke-color-text, #E5E5E5);
92
+ }
93
+
94
+ .header-cell--no-sort:hover {
95
+ color: var(--reke-color-text-muted, #525252);
96
+ }
97
+
98
+ .header-cell--sorted {
99
+ color: var(--reke-color-primary, #22C55E);
100
+ }
101
+
102
+ .header-content {
103
+ display: inline-flex;
104
+ align-items: center;
105
+ gap: 4px;
106
+ }
107
+
108
+ .sort-indicator {
109
+ font-size: 10px;
110
+ }
111
+
112
+ /* === Body === */
113
+
114
+ .row {
115
+ border-bottom: 1px solid var(--reke-color-border, #252525);
116
+ }
117
+
118
+ .row:last-child {
119
+ border-bottom: none;
120
+ }
121
+
122
+ .row--expanded {
123
+ border-bottom: none;
124
+ }
125
+
126
+ .cell {
127
+ padding: 12px 16px;
128
+ }
129
+
130
+ .cell[data-align='left'] {
131
+ text-align: left;
132
+ }
133
+
134
+ .cell[data-align='center'] {
135
+ text-align: center;
136
+ }
137
+
138
+ .cell[data-align='right'] {
139
+ text-align: right;
140
+ }
141
+
142
+ .cell--empty {
143
+ text-align: center;
144
+ color: var(--reke-color-text-muted, #525252);
145
+ padding: 24px 16px;
146
+ }
147
+
148
+ /* === Expanded row === */
149
+
150
+ .expand-row {
151
+ background: var(--reke-color-surface, #1A1A1A);
152
+ border-bottom: 1px solid var(--reke-color-border, #252525);
153
+ }
154
+
155
+ .expand-row:last-child {
156
+ border-bottom: none;
157
+ }
158
+
159
+ .expand-content {
160
+ padding: 0 16px 16px 16px;
161
+ }
162
+
163
+ /* === Modifiers === */
164
+
165
+ .table--striped .row--even {
166
+ background: color-mix(in srgb, var(--reke-color-surface, #1A1A1A) 85%, var(--reke-color-border, #252525));
167
+ }
168
+
169
+ .table--hoverable .row:hover {
170
+ background: color-mix(in srgb, var(--reke-color-surface, #1A1A1A) 75%, var(--reke-color-border, #252525));
171
+ cursor: pointer;
172
+ }
173
+
174
+ .table--dense .header-cell {
175
+ padding: 8px 12px;
176
+ }
177
+
178
+ .table--dense .cell {
179
+ padding: 6px 12px;
180
+ font-size: 12px;
181
+ }
182
+
183
+ .table--dense .expand-content {
184
+ padding: 0 12px 12px 12px;
185
+ }
186
+
187
+ .table--bordered .cell,
188
+ .table--bordered .header-cell {
189
+ border-right: 1px solid var(--reke-color-border, #252525);
190
+ }
191
+
192
+ .table--bordered .cell:last-child,
193
+ .table--bordered .header-cell:last-child {
194
+ border-right: none;
195
+ }
196
+
197
+ /* === Borderless (for embedding inside cards/containers) === */
198
+
199
+ :host([borderless]) .table-container {
200
+ border: none;
201
+ border-radius: 0;
202
+ }
203
+ `
204
+ ];
205
+ export {
206
+ t as styles
207
+ };
@@ -0,0 +1,73 @@
1
+ import { nothing as n, html as u } from "lit";
2
+ import { property as a, customElement as d } from "lit/decorators.js";
3
+ import { classMap as c } from "lit/directives/class-map.js";
4
+ import { RekeElement as m } from "../../shared/base-element.js";
5
+ import { styles as b } from "./reke-textarea.styles.js";
6
+ var v = Object.defineProperty, f = Object.getOwnPropertyDescriptor, t = (l, s, i, o) => {
7
+ for (var r = o > 1 ? void 0 : o ? f(s, i) : s, p = l.length - 1, h; p >= 0; p--)
8
+ (h = l[p]) && (r = (o ? h(s, i, r) : h(r)) || r);
9
+ return o && r && v(s, i, r), r;
10
+ };
11
+ let e = class extends m {
12
+ constructor() {
13
+ super(...arguments), this.value = "", this.placeholder = "", this.rows = 4, this.size = "md", this.disabled = !1, this.error = !1, this.label = "";
14
+ }
15
+ handleInput(l) {
16
+ const s = l.target;
17
+ this.value = s.value, this.emit("reke-input", { value: this.value });
18
+ }
19
+ handleChange() {
20
+ this.emit("reke-change", { value: this.value });
21
+ }
22
+ render() {
23
+ const l = {
24
+ textarea: !0,
25
+ [`textarea--${this.size}`]: !0,
26
+ "textarea--error": this.error
27
+ };
28
+ return u`
29
+ ${this.label ? u`<label class="label">${this.label}</label>` : n}
30
+ <textarea
31
+ part="textarea"
32
+ class=${c(l)}
33
+ .value=${this.value}
34
+ placeholder=${this.placeholder || n}
35
+ rows=${this.rows}
36
+ ?disabled=${this.disabled}
37
+ aria-disabled=${this.disabled}
38
+ aria-invalid=${this.error}
39
+ aria-label=${this.label || n}
40
+ @input=${this.handleInput}
41
+ @change=${this.handleChange}
42
+ ></textarea>
43
+ `;
44
+ }
45
+ };
46
+ e.styles = b;
47
+ t([
48
+ a()
49
+ ], e.prototype, "value", 2);
50
+ t([
51
+ a()
52
+ ], e.prototype, "placeholder", 2);
53
+ t([
54
+ a({ type: Number })
55
+ ], e.prototype, "rows", 2);
56
+ t([
57
+ a({ reflect: !0 })
58
+ ], e.prototype, "size", 2);
59
+ t([
60
+ a({ type: Boolean, reflect: !0 })
61
+ ], e.prototype, "disabled", 2);
62
+ t([
63
+ a({ type: Boolean, reflect: !0 })
64
+ ], e.prototype, "error", 2);
65
+ t([
66
+ a()
67
+ ], e.prototype, "label", 2);
68
+ e = t([
69
+ d("reke-textarea")
70
+ ], e);
71
+ export {
72
+ e as RekeTextarea
73
+ };
@@ -0,0 +1,76 @@
1
+ import { tailwindStyles as e } from "../../shared/tailwind-styles.js";
2
+ import { css as r } from "lit";
3
+ const t = [
4
+ e,
5
+ r`
6
+ :host {
7
+ display: inline-block;
8
+ }
9
+
10
+ :host([disabled]) {
11
+ pointer-events: none;
12
+ opacity: 0.5;
13
+ }
14
+
15
+ .label {
16
+ display: block;
17
+ margin-bottom: var(--reke-space-2xs, 6px);
18
+ font-family: var(--reke-font-mono, 'JetBrains Mono', ui-monospace, monospace);
19
+ font-size: var(--reke-font-size-xs, 12px);
20
+ color: var(--reke-color-text-label, #8A8A8A);
21
+ }
22
+
23
+ .textarea {
24
+ display: block;
25
+ width: 100%;
26
+ background-color: var(--reke-color-surface, #1A1A1A);
27
+ color: var(--reke-color-text, #E5E5E5);
28
+ border: 1px solid var(--reke-color-border, #252525);
29
+ border-radius: var(--reke-radius, 4px);
30
+ font-family: var(--reke-font-mono, 'JetBrains Mono', ui-monospace, monospace);
31
+ box-sizing: border-box;
32
+ outline: none;
33
+ transition: border-color 0.15s ease;
34
+ resize: vertical;
35
+ }
36
+
37
+ .textarea::placeholder {
38
+ color: var(--reke-color-text-muted, #525252);
39
+ }
40
+
41
+ .textarea:focus-visible {
42
+ border-color: var(--reke-color-primary, #22C55E);
43
+ outline: 2px solid var(--reke-color-primary, #22C55E);
44
+ outline-offset: -1px;
45
+ }
46
+
47
+ .textarea--error {
48
+ border-color: var(--reke-color-danger, #EF4444);
49
+ }
50
+
51
+ .textarea--error:focus-visible {
52
+ border-color: var(--reke-color-danger, #EF4444);
53
+ outline-color: var(--reke-color-danger, #EF4444);
54
+ }
55
+
56
+ /* === Sizes === */
57
+
58
+ .textarea--sm {
59
+ padding: var(--reke-space-xs, 8px) var(--reke-space-sm, 12px);
60
+ font-size: var(--reke-font-size-xs, 12px);
61
+ }
62
+
63
+ .textarea--md {
64
+ padding: var(--reke-space-sm, 12px) var(--reke-space-md, 16px);
65
+ font-size: var(--reke-font-size-sm, 13px);
66
+ }
67
+
68
+ .textarea--lg {
69
+ padding: var(--reke-space-md, 16px) var(--reke-space-lg, 20px);
70
+ font-size: var(--reke-font-size-md, 14px);
71
+ }
72
+ `
73
+ ];
74
+ export {
75
+ t as styles
76
+ };
@@ -0,0 +1,92 @@
1
+ import { html as e, nothing as p } from "lit";
2
+ import { property as c, customElement as h } from "lit/decorators.js";
3
+ import { classMap as v } from "lit/directives/class-map.js";
4
+ import { RekeElement as u } from "../../shared/base-element.js";
5
+ import { styles as d } from "./reke-toast.styles.js";
6
+ var y = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, i = (r, a, n, o) => {
7
+ for (var t = o > 1 ? void 0 : o ? _(a, n) : a, l = r.length - 1, m; l >= 0; l--)
8
+ (m = r[l]) && (t = (o ? m(a, n, t) : m(t)) || t);
9
+ return o && t && y(a, n, t), t;
10
+ };
11
+ const x = {
12
+ success: e`<svg viewBox="0 0 24 24"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>`,
13
+ error: e`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`,
14
+ warning: e`<svg viewBox="0 0 24 24"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`,
15
+ info: e`<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>`
16
+ };
17
+ let s = class extends u {
18
+ constructor() {
19
+ super(...arguments), this.variant = "success", this.message = "", this.action = "", this.duration = 0;
20
+ }
21
+ connectedCallback() {
22
+ super.connectedCallback(), this.startTimer();
23
+ }
24
+ disconnectedCallback() {
25
+ super.disconnectedCallback(), this.clearTimer();
26
+ }
27
+ startTimer() {
28
+ this.clearTimer(), this.duration > 0 && (this._timer = setTimeout(() => this.dismiss(), this.duration));
29
+ }
30
+ clearTimer() {
31
+ this._timer !== void 0 && (clearTimeout(this._timer), this._timer = void 0);
32
+ }
33
+ dismiss() {
34
+ this.emit("reke-close"), this.remove();
35
+ }
36
+ handleAction() {
37
+ this.emit("reke-action");
38
+ }
39
+ render() {
40
+ const r = {
41
+ toast: !0,
42
+ [`toast--${this.variant}`]: !0
43
+ };
44
+ return e`
45
+ <div part="toast" class=${v(r)} role="status">
46
+ <div class="toast__left">
47
+ <span class="toast__icon" aria-hidden="true">
48
+ ${x[this.variant]}
49
+ </span>
50
+ <span class="toast__message">${this.message}</span>
51
+ </div>
52
+ <div class="toast__right">
53
+ ${this.action ? e`
54
+ <button
55
+ class="toast__action"
56
+ type="button"
57
+ @click=${this.handleAction}
58
+ >
59
+ ${this.action}
60
+ </button>
61
+ ` : p}
62
+ <button
63
+ class="toast__close"
64
+ @click=${() => this.dismiss()}
65
+ aria-label="Close"
66
+ >
67
+ &times;
68
+ </button>
69
+ </div>
70
+ </div>
71
+ `;
72
+ }
73
+ };
74
+ s.styles = d;
75
+ i([
76
+ c({ reflect: !0 })
77
+ ], s.prototype, "variant", 2);
78
+ i([
79
+ c()
80
+ ], s.prototype, "message", 2);
81
+ i([
82
+ c()
83
+ ], s.prototype, "action", 2);
84
+ i([
85
+ c({ type: Number })
86
+ ], s.prototype, "duration", 2);
87
+ s = i([
88
+ h("reke-toast")
89
+ ], s);
90
+ export {
91
+ s as RekeToast
92
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"reke-toast.styles.d.ts","sourceRoot":"","sources":["../../../src/components/reke-toast/reke-toast.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,2BAgKlB,CAAC"}
1
+ {"version":3,"file":"reke-toast.styles.d.ts","sourceRoot":"","sources":["../../../src/components/reke-toast/reke-toast.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,2BAgLlB,CAAC"}