poe-svelte-ui-lib 1.4.1 → 1.4.3

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.
@@ -103,7 +103,14 @@
103
103
  ${disabled ? 'opacity-50' : 'cursor-pointer hover:shadow-md'}`,
104
104
  value?.class,
105
105
  )}
106
- style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
106
+ style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);
107
+ {value?.class?.split(' ').find((cls: string) => cls.startsWith('border-'))
108
+ ? `border-width: 1px;
109
+ border-color: var(--${value.class
110
+ ?.split(' ')
111
+ .find((cls: string) => cls.startsWith('border-'))
112
+ ?.replace('border-', '')}-color)`
113
+ : ''}"
107
114
  onclick={toggleDropdown}
108
115
  aria-haspopup="true"
109
116
  aria-expanded={isDropdownOpen}
@@ -129,7 +136,14 @@
129
136
  )}
130
137
  onclick={(e) => selectOption(option, e)}
131
138
  {disabled}
132
- style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
139
+ style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);
140
+ {option.class?.split(' ').find((cls: string) => cls.startsWith('border-'))
141
+ ? `border-width: 1px;
142
+ border-color: var(--${option.class
143
+ ?.split(' ')
144
+ .find((cls: string) => cls.startsWith('border-'))
145
+ ?.replace('border-', '')}-color)`
146
+ : ''}"
133
147
  >
134
148
  {option.name}
135
149
  </button>
@@ -148,6 +162,14 @@
148
162
  ${options.length > 0 && index === 0 ? 'rounded-l-2xl' : ''} ${index === options.length - 1 ? 'rounded-r-2xl' : ''}`,
149
163
  option.class,
150
164
  )} bg-(--bg-color)"
165
+ style="
166
+ {option.class?.split(' ').find((cls: string) => cls.startsWith('border-'))
167
+ ? `border-width: 1px;
168
+ border-color: var(--${option.class
169
+ ?.split(' ')
170
+ .find((cls: string) => cls.startsWith('border-'))
171
+ ?.replace('border-', '')}-color)`
172
+ : ''}"
151
173
  onclick={(e) => selectOption(option, e)}
152
174
  disabled={option.disabled}
153
175
  >
@@ -197,7 +219,14 @@
197
219
  )}
198
220
  onclick={(e) => selectOption(option, e)}
199
221
  {disabled}
200
- style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
222
+ style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);
223
+ {option.class?.split(' ').find((cls: string) => cls.startsWith('border-'))
224
+ ? `border-width: 1px;
225
+ border-color: var(--${option.class
226
+ ?.split(' ')
227
+ .find((cls: string) => cls.startsWith('border-'))
228
+ ?.replace('border-', '')}-color)`
229
+ : ''}"
201
230
  >
202
231
  {option.name}
203
232
  </button>
@@ -412,17 +412,14 @@
412
412
  updateProperty('options', options, component, onPropertyChange)
413
413
  }}
414
414
  />
415
- <UI.Select
416
- wrapperClass="w-80 h-14.5"
417
- label={{ name: $t('constructor.props.colors') }}
418
- type="buttons"
419
- options={$optionsStore.COLOR_OPTIONS}
420
- value={$optionsStore.COLOR_OPTIONS.find((c) =>
421
- (c.value as string).includes(option.class.split(' ').find((cls: string) => cls.startsWith('bg-'))),
422
- )}
423
- onUpdate={(option) => {
415
+ <UI.Input
416
+ label={{ name: $t('constructor.props.optionclass') }}
417
+ wrapperClass="!w-3/10"
418
+ value={option.class}
419
+ type={currentValueType.value}
420
+ onUpdate={(value) => {
424
421
  const options = [...(component.properties?.options || [])]
425
- options[index]['class'] = option.value
422
+ options[index]['class'] = value as string
426
423
  updateProperty('options', options, component, onPropertyChange)
427
424
  }}
428
425
  />
@@ -267,6 +267,7 @@
267
267
  }}
268
268
  />
269
269
  </div>
270
+
270
271
  <div class="flex w-1/3 flex-col items-center px-2">
271
272
  <UI.Select
272
273
  wrapperClass="h-14"
@@ -282,6 +283,7 @@
282
283
  })
283
284
  }}
284
285
  />
286
+
285
287
  <UI.Switch
286
288
  label={{
287
289
  name: $t('constructor.props.widthMode'),
@@ -291,20 +293,11 @@
291
293
  value={initialWidth()}
292
294
  options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
293
295
  onChange={(value) => {
294
- if (value === 2) {
295
- component.properties.items.forEach((_item: any, index: number) => {
296
- let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
297
- const items = [...(component.properties?.items || [])]
298
- items[index]['class'] = twMerge(items[index].class, `w-[${tabWidth}px]`)
299
- updateProperty('items', items, component, onPropertyChange)
300
- })
301
- } else {
302
- component.properties.items.forEach((_item: any, index: number) => {
303
- const items = [...(component.properties?.items || [])]
304
- items[index]['class'] = twMerge(items[index].class, 'w-auto')
305
- updateProperty('items', items, component, onPropertyChange)
306
- })
307
- }
296
+ component.properties.items.forEach((_item: any, index: number) => {
297
+ const items = [...(component.properties?.items || [])]
298
+ items[index]['class'] = twMerge(items[index].class, value ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
299
+ updateProperty('items', items, component, onPropertyChange)
300
+ })
308
301
  }}
309
302
  />
310
303
  </div>
@@ -115,7 +115,7 @@ const translations = {
115
115
  'constructor.props.min': 'Минимальное значение',
116
116
  'constructor.props.max': 'Максимальное значение',
117
117
  'constructor.props.units': 'Единица измерения',
118
- 'constructor.props.optionclass': 'Стили кнопки',
118
+ 'constructor.props.optionclass': 'Стили опции',
119
119
  'constructor.props.optionvalue': 'Значение',
120
120
  'constructor.props.optionposition': 'Позиция',
121
121
  'constructor.props.optionname': 'Текст',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@tailwindcss/vite": "^4.1.17",
36
- "prettier": "^3.6.2",
36
+ "prettier": "^3.7.3",
37
37
  "prettier-plugin-svelte": "^3.4.0",
38
38
  "prettier-plugin-tailwindcss": "^0.7.1",
39
39
  "svelte-maplibre-gl": "^1.0.2",
40
40
  "tailwind-merge": "^3.4.0",
41
41
  "tailwindcss": "^4.1.17",
42
- "tsx": "^4.20.6",
42
+ "tsx": "^4.21.0",
43
43
  "typescript": "^5.9.3"
44
44
  },
45
45
  "devDependencies": {