poe-svelte-ui-lib 1.0.4 → 1.0.5

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.
@@ -21,7 +21,11 @@
21
21
  {props.type === 'sub' ? 'border-b border-[var(--border-color)]' : ''}"
22
22
  onclick={toggle}
23
23
  >
24
- <span class="toggle m-0 cursor-pointer text-lg font-semibold {props.label?.class}">
24
+ <span class="toggle m-0 cursor-pointer text-lg flex items-center gap-2 font-semibold {props.label?.class}">
25
+ {#if props.icon?.component}
26
+ {@const IconComponent = props.icon?.component}
27
+ <IconComponent {...props.icon?.properties} />
28
+ {/if}
25
29
  {props.label?.name}
26
30
  </span>
27
31
  <svg
@@ -173,7 +173,7 @@
173
173
  class="absolute top-1/2 right-10 -translate-y-1/2 transform rounded-md bg-[var(--green-color)] px-2 py-1 text-sm shadow-lg"
174
174
  transition:fly={{ x: 10, duration: 200 }}
175
175
  >
176
-
176
+
177
177
  </div>
178
178
  {/if}
179
179
  {/if}
@@ -18,6 +18,7 @@
18
18
  type = 'select',
19
19
  value = $bindable(),
20
20
  options = [],
21
+ placeholder= '---',
21
22
  onUpdate,
22
23
  }: ISelectProps<T> = $props()
23
24
 
@@ -101,7 +102,7 @@
101
102
  aria-expanded={isDropdownOpen}
102
103
  {disabled}
103
104
  >
104
- {value?.name || ''}
105
+ {value?.name || placeholder}
105
106
  </button>
106
107
 
107
108
  {#if isDropdownOpen}
@@ -94,7 +94,7 @@
94
94
  {/if}
95
95
 
96
96
  <!-- Слайдер -->
97
- <div class="relative flex h-2 w-full justify-center {disabled ? 'opacity-50' : ''}" id={id.value}>
97
+ <div class="relative flex h-2 w-full justify-center {disabled ? 'opacity-50 cursor-not-allowed' : ''}" id={id.value}>
98
98
  {#if isRange}
99
99
  <!-- Трек и активная зона -->
100
100
  <div
@@ -8,12 +8,12 @@
8
8
  id = { value: crypto.randomUUID(), name: '' },
9
9
  wrapperClass = 'bg-blue',
10
10
  label = { name: '', class: '' },
11
- tableBody = [],
12
- tableHeader = [],
11
+ body = [],
12
+ header = [],
13
+ footer = '',
13
14
  cursor = null,
14
15
  loader,
15
16
  getData = () => {},
16
- info = '',
17
17
  modalData = $bindable({ isOpen: false, rawData: '', formattedData: '' }),
18
18
  onClick,
19
19
  }: ITableProps<any> = $props()
@@ -36,7 +36,7 @@
36
36
  sortState.direction = 'asc'
37
37
  }
38
38
 
39
- tableBody = [...tableBody].sort((a, b) => {
39
+ body = [...body].sort((a, b) => {
40
40
  const aValue = a[key]
41
41
  const bValue = b[key]
42
42
  if (typeof aValue === 'number' && typeof bValue === 'number') {
@@ -126,8 +126,8 @@
126
126
 
127
127
  <div class="flex h-full flex-col overflow-hidden rounded-xl border-[var(--border-color)]">
128
128
  <!-- Table Header -->
129
- <div class="grid font-semibold" style={`grid-template-columns: ${tableHeader.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
130
- {#each tableHeader as column (column)}
129
+ <div class="grid font-semibold" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
130
+ {#each header as column (column)}
131
131
  <div class="justify-center bg-[var(--bg-color)] p-2 text-center">
132
132
  <div class="flex items-center justify-start gap-2">
133
133
  <span>{column.label}</span>
@@ -146,9 +146,9 @@
146
146
 
147
147
  <!-- Table Body с прокруткой -->
148
148
  <div class="flex-1 overflow-y-auto bg-[var(--conteiner-color)]/50" bind:this={container} onscroll={handleScroll}>
149
- <div class="grid min-w-0" style={`grid-template-columns: ${tableHeader.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
150
- {#each tableBody as row, index (row)}
151
- {#each tableHeader as column (column)}
149
+ <div class="grid min-w-0" style={`grid-template-columns: ${header.map((c) => c.width || 'minmax(0, 1fr)').join(' ')};`}>
150
+ {#each body as row, index (row)}
151
+ {#each header as column (column)}
152
152
  <div
153
153
  class="relative flex w-full min-w-0 items-center px-2 py-1 break-words
154
154
  {index % 2 ? '!bg-[var(--back-color)]/40' : ''}
@@ -242,7 +242,7 @@
242
242
  class="absolute top-1/2 right-10 -translate-y-1/2 transform rounded-md bg-[var(--green-color)] px-2 py-1 text-sm shadow-lg"
243
243
  transition:fly={{ x: 10, duration: 200 }}
244
244
  >
245
-
245
+
246
246
  </div>
247
247
  {/if}
248
248
  {/if}
@@ -266,9 +266,9 @@
266
266
  {/if}
267
267
 
268
268
  <!-- Нижнее поле для сводной информации -->
269
- {#if info != ''}
269
+ {#if footer != ''}
270
270
  <div class="flex h-8 items-center justify-center bg-[var(--bg-color)]">
271
- <h5>{info}</h5>
271
+ <h5>{footer}</h5>
272
272
  </div>
273
273
  {/if}
274
274
  </div>
package/dist/types.d.ts CHANGED
@@ -57,6 +57,10 @@ export interface IAccordionProps {
57
57
  name?: string;
58
58
  class?: string;
59
59
  };
60
+ icon?: {
61
+ component?: ConstructorOfATypedSvelteComponent | null;
62
+ properties?: Record<string, unknown>;
63
+ };
60
64
  isOpen: boolean;
61
65
  componentClass?: string;
62
66
  type?: 'main' | 'sub';
@@ -110,6 +114,7 @@ export interface ISelectProps<T = unknown> {
110
114
  type?: 'select' | 'buttons' | 'input';
111
115
  value?: ISelectOption<T> | null;
112
116
  options?: ISelectOption<T>[];
117
+ placeholder?: string;
113
118
  eventHandler?: IUIComponentHandler;
114
119
  onUpdate?: (value: ISelectOption<T>) => void;
115
120
  }
@@ -269,9 +274,9 @@ export interface ITableProps<T extends object> {
269
274
  name?: string;
270
275
  class?: string;
271
276
  };
272
- tableHeader: ITableHeader<T>[];
273
- tableBody: T[];
274
- info?: string;
277
+ header: ITableHeader<T>[];
278
+ body: T[];
279
+ footer?: string;
275
280
  cursor?: string | null;
276
281
  loader?: Writable<boolean>;
277
282
  getData?: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {