poe-svelte-ui-lib 1.2.8 → 1.2.9

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.
@@ -56,19 +56,6 @@
56
56
  } else if (width.class.includes('w-auto')) return 1
57
57
  else return 2
58
58
  })
59
-
60
- const handleImageUpload = (event: Event) => {
61
- const input = event.target as HTMLInputElement
62
- if (!input.files || input.files.length === 0) return
63
-
64
- const file = input.files[0]
65
- const reader = new FileReader()
66
- reader.onload = (e) => {
67
- const base64String = e.target?.result as string
68
- updateProperty('image', base64String, component, onPropertyChange)
69
- }
70
- reader.readAsDataURL(file)
71
- }
72
59
  </script>
73
60
 
74
61
  {#if forConstructor}
@@ -121,19 +108,11 @@
121
108
  }}
122
109
  value={initialWidth()}
123
110
  onChange={(value) => {
124
- if (value === 2) {
125
- component.properties.items.forEach((_item: any, index: number) => {
126
- const items = [...(component.properties?.items || [])]
127
- items[index]['class'] = twMerge(items[index].class, `w-[${(1 / items.length) * 100}%]`)
128
- updateProperty('items', items, component, onPropertyChange)
129
- })
130
- } else {
131
- component.properties.items.forEach((_item: any, index: number) => {
132
- const items = [...(component.properties?.items || [])]
133
- items[index]['class'] = twMerge(items[index].class, 'w-auto')
134
- updateProperty('items', items, component, onPropertyChange)
135
- })
136
- }
111
+ component.properties.items.forEach((_item: any, index: number) => {
112
+ const items = [...(component.properties?.items || [])]
113
+ items[index]['class'] = twMerge(items[index].class, value === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
114
+ updateProperty('items', items, component, onPropertyChange)
115
+ })
137
116
  }}
138
117
  />
139
118
  </div>
@@ -146,14 +125,16 @@
146
125
  wrapperClass="w-8"
147
126
  content={{ icon: ButtonAdd }}
148
127
  onClick={() => {
149
- let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
150
128
  const newItem: { name: string; icon: string; class: string } = {
151
129
  name: `Tab ${component.properties?.items.length + 1}`,
152
- class: `w-${initialWidth() === 2 ? `[${tabWidth}px]` : 'auto'} text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
130
+ class: `text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
153
131
  icon: '',
154
132
  }
155
133
  const items = [...(component.properties?.items || []), newItem]
156
- updateProperty('items', items, component, onPropertyChange)
134
+ items.forEach((_item: any, index: number) => {
135
+ items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
136
+ updateProperty('items', items, component, onPropertyChange)
137
+ })
157
138
  }}
158
139
  />
159
140
  </div>
@@ -194,6 +175,10 @@
194
175
  onClick={() => {
195
176
  const items = [...(component.properties?.items || [])]
196
177
  items.splice(index, 1)
178
+ items.forEach((_item: any, index: number) => {
179
+ items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
180
+ updateProperty('items', items, component, onPropertyChange)
181
+ })
197
182
  updateProperty('items', items, component, onPropertyChange)
198
183
  }}
199
184
  />
package/dist/types.d.ts CHANGED
@@ -269,7 +269,6 @@ export interface ITabsProps {
269
269
  icon?: string;
270
270
  class?: string;
271
271
  children?: Snippet;
272
- width?: string;
273
272
  }[];
274
273
  apiArray?: UIComponent[];
275
274
  Components?: Snippet<[component: UIComponent, fixedHeight: boolean]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {