poe-svelte-ui-lib 1.2.0 → 1.2.1
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/dist/Tabs/TabsProps.svelte +146 -75
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -239,12 +239,10 @@
|
|
|
239
239
|
value={component.properties.id}
|
|
240
240
|
onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
|
|
241
241
|
/>
|
|
242
|
-
<UI.
|
|
243
|
-
label={{ name: $t('constructor.props.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
options={$optionsStore.ACCORDION_TYPE_OPTIONS}
|
|
247
|
-
onUpdate={(item) => updateProperty('outline', item.value as boolean, component, onPropertyChange)}
|
|
242
|
+
<UI.Input
|
|
243
|
+
label={{ name: $t('constructor.props.wrapperclass') }}
|
|
244
|
+
value={component.properties.wrapperClass}
|
|
245
|
+
onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
|
|
248
246
|
/>
|
|
249
247
|
<div class="flex w-full gap-4">
|
|
250
248
|
<UI.Input
|
|
@@ -262,88 +260,161 @@
|
|
|
262
260
|
type="number"
|
|
263
261
|
/>
|
|
264
262
|
</div>
|
|
263
|
+
</div>
|
|
264
|
+
<div class="flex w-1/3 flex-col items-center px-2">
|
|
265
|
+
<UI.Select
|
|
266
|
+
label={{ name: $t('constructor.props.align') }}
|
|
267
|
+
type="buttons"
|
|
268
|
+
value={initialAlign}
|
|
269
|
+
options={$optionsStore.JUSTIFY_ALIGN_OPTIONS}
|
|
270
|
+
onUpdate={(option) => updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)}
|
|
271
|
+
/>
|
|
265
272
|
|
|
266
|
-
<UI.
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
273
|
+
<UI.Select
|
|
274
|
+
wrapperClass="h-14"
|
|
275
|
+
label={{ name: $t('constructor.props.colors') }}
|
|
276
|
+
type="buttons"
|
|
277
|
+
options={$optionsStore.COLOR_OPTIONS.slice(1)}
|
|
278
|
+
value={initialColor}
|
|
279
|
+
onUpdate={(option) => {
|
|
280
|
+
updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)
|
|
281
|
+
component.properties.items.forEach((_item: any, index: number) => {
|
|
282
|
+
const items = [...(component.properties?.items || [])]
|
|
283
|
+
items[index]['class'] = twMerge(items[index].class, `text-${option.value?.slice(3)}-500`)
|
|
284
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
285
|
+
})
|
|
286
|
+
}}
|
|
270
287
|
/>
|
|
271
288
|
</div>
|
|
272
289
|
<div class="flex w-1/3 flex-col items-center px-2">
|
|
273
|
-
<UI.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
290
|
+
<UI.Select
|
|
291
|
+
wrapperClass="h-14"
|
|
292
|
+
label={{ name: $t('constructor.props.icon.text.position') }}
|
|
293
|
+
type="buttons"
|
|
294
|
+
options={$optionsStore.ICON_TEXT_POSITION_OPTIONS}
|
|
295
|
+
value={initialPosition}
|
|
296
|
+
onUpdate={(option) => {
|
|
297
|
+
component.properties.items.forEach((_item: any, index: number) => {
|
|
298
|
+
const items = [...(component.properties?.items || [])]
|
|
299
|
+
items[index]['class'] = twMerge(items[index].class, option.value)
|
|
300
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
301
|
+
})
|
|
302
|
+
}}
|
|
277
303
|
/>
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
</Modal>
|
|
303
|
-
{/if}
|
|
304
|
-
{#if component.properties.label.icon}
|
|
305
|
-
<Button
|
|
306
|
-
wrapperClass="w-8.5 "
|
|
307
|
-
componentClass="p-0.5 bg-red"
|
|
308
|
-
content={{ icon: CrossIcon }}
|
|
309
|
-
onClick={() => {
|
|
310
|
-
updateProperty('label.icon', '', component, onPropertyChange)
|
|
311
|
-
}}
|
|
312
|
-
/>
|
|
313
|
-
{/if}
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<UI.Input
|
|
317
|
-
label={{ name: $t('constructor.props.label') }}
|
|
318
|
-
value={component.properties.label.name}
|
|
319
|
-
onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
|
|
304
|
+
<UI.Switch
|
|
305
|
+
label={{
|
|
306
|
+
name: $t('constructor.props.widthMode'),
|
|
307
|
+
captionLeft: $t('constructor.props.height.small'),
|
|
308
|
+
captionRight: $t('constructor.props.equal'),
|
|
309
|
+
}}
|
|
310
|
+
value={initialWidth()}
|
|
311
|
+
onChange={(value) => {
|
|
312
|
+
if (value === 2) {
|
|
313
|
+
component.properties.items.forEach((_item: any, index: number) => {
|
|
314
|
+
let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
|
|
315
|
+
const items = [...(component.properties?.items || [])]
|
|
316
|
+
items[index]['class'] = twMerge(items[index].class, `w-[${tabWidth}px]`)
|
|
317
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
318
|
+
})
|
|
319
|
+
} else {
|
|
320
|
+
component.properties.items.forEach((_item: any, index: number) => {
|
|
321
|
+
const items = [...(component.properties?.items || [])]
|
|
322
|
+
items[index]['class'] = twMerge(items[index].class, 'w-auto')
|
|
323
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
324
|
+
})
|
|
325
|
+
}
|
|
326
|
+
console.log(component.properties?.items)
|
|
327
|
+
}}
|
|
320
328
|
/>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
<div class="space-y-4">
|
|
333
|
+
<div class="m-0 flex items-center justify-center gap-2">
|
|
334
|
+
<h4>{$t('constructor.props.options.title')}</h4>
|
|
335
|
+
<UI.Button
|
|
336
|
+
wrapperClass="w-8"
|
|
337
|
+
content={{ icon: ButtonAdd }}
|
|
338
|
+
onClick={() => {
|
|
339
|
+
let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
|
|
340
|
+
const newItem: { name: string; icon: string; class: string } = {
|
|
341
|
+
name: `Tab ${component.properties?.items.length + 1}`,
|
|
342
|
+
class: `w-${initialWidth() === 2 ? `[${tabWidth}px]` : 'auto'} text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
|
|
343
|
+
icon: '',
|
|
344
|
+
}
|
|
345
|
+
const items = [...(component.properties?.items || []), newItem]
|
|
346
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
347
|
+
}}
|
|
325
348
|
/>
|
|
326
349
|
</div>
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
label={{ name: $t('constructor.props.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
350
|
+
|
|
351
|
+
{#each component.properties.items || [] as tab, index}
|
|
352
|
+
<div class="m-0 flex items-end justify-around gap-2 border-gray-400">
|
|
353
|
+
<UI.Input
|
|
354
|
+
label={{ name: $t('constructor.props.optionname') }}
|
|
355
|
+
wrapperClass="w-5/10"
|
|
356
|
+
value={tab.name}
|
|
357
|
+
onUpdate={(value) => {
|
|
358
|
+
const items = [...(component.properties?.items || [])]
|
|
359
|
+
items[index]['name'] = value
|
|
360
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
361
|
+
}}
|
|
335
362
|
/>
|
|
336
|
-
|
|
337
|
-
<Button
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
363
|
+
<div class="relative mt-5 flex w-3/10 gap-2">
|
|
364
|
+
<UI.Button content={{ name: $t('constructor.props.labelicon') }} onClick={() => (tabIcon = { index: index, isModalOpen: true })} />
|
|
365
|
+
|
|
366
|
+
{#if tab.icon}
|
|
367
|
+
<Button
|
|
368
|
+
wrapperClass="w-8.5 "
|
|
369
|
+
componentClass="p-0.5 bg-red"
|
|
370
|
+
content={{ icon: CrossIcon }}
|
|
371
|
+
onClick={() => {
|
|
372
|
+
const items = [...(component.properties?.items || [])]
|
|
373
|
+
items[index]['icon'] = ''
|
|
374
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
375
|
+
}}
|
|
376
|
+
/>
|
|
377
|
+
{/if}
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
{#if component.properties.items.length > 1}
|
|
381
|
+
<UI.Button
|
|
382
|
+
wrapperClass="w-8"
|
|
383
|
+
content={{ icon: ButtonDelete }}
|
|
341
384
|
onClick={() => {
|
|
342
|
-
|
|
385
|
+
const items = [...(component.properties?.items || [])]
|
|
386
|
+
items.splice(index, 1)
|
|
387
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
343
388
|
}}
|
|
344
389
|
/>
|
|
345
390
|
{/if}
|
|
346
391
|
</div>
|
|
347
|
-
|
|
392
|
+
{/each}
|
|
393
|
+
{#if tabIcon.isModalOpen}
|
|
394
|
+
<Modal bind:isOpen={tabIcon.isModalOpen} wrapperClass="w-130">
|
|
395
|
+
{#snippet main()}
|
|
396
|
+
<div class="grid grid-cols-3">
|
|
397
|
+
{#each ICONS as category}
|
|
398
|
+
<div class="relative m-1.5 rounded-xl border-2 border-(--border-color) p-3">
|
|
399
|
+
<div class="absolute -top-3.5 bg-(--back-color) px-1">{$t(`constructor.props.icon.${category[0]}`)}</div>
|
|
400
|
+
<div class="grid grid-cols-3 place-items-center gap-2">
|
|
401
|
+
{#each category[1] as icon}
|
|
402
|
+
<button
|
|
403
|
+
class="h-8 w-8 cursor-pointer [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
|
|
404
|
+
onclick={() => {
|
|
405
|
+
const items = [...(component.properties?.items || [])]
|
|
406
|
+
items[tabIcon.index]['icon'] = icon as string
|
|
407
|
+
updateProperty('items', items, component, onPropertyChange)
|
|
408
|
+
}}
|
|
409
|
+
>
|
|
410
|
+
{@html icon}
|
|
411
|
+
</button>{/each}
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
{/each}
|
|
415
|
+
</div>
|
|
416
|
+
{/snippet}
|
|
417
|
+
</Modal>
|
|
418
|
+
{/if}
|
|
348
419
|
</div>
|
|
349
420
|
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export { default as TextField } from './TextField/TextField.svelte';
|
|
|
26
26
|
export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
|
|
27
27
|
export * from './locales/i18n';
|
|
28
28
|
export * from './locales/translations';
|
|
29
|
-
export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type ISelectOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITabsProps, } from './types';
|
|
29
|
+
export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type ISelectOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, type ITabsProps, } from './types';
|