Prechádzať zdrojové kódy

[stdf]Update ActionSheet compoent and documents.

dufu1991 1 rok pred
rodič
commit
aa4d59d577

+ 38 - 38
demo/src/routes/en_US/actionSheet/+page.svelte

@@ -2,41 +2,41 @@
 <script>
 	import { Cell, ActionSheet, Toast } from '../../../../../packages/stdf/components';
 
-	let visible1 = false;
-	let visible2 = false;
-	let visible3 = false;
-	let visible4 = false;
-	let visible5 = false;
-	let visible6 = false;
-	let visible7 = false;
-	let visible8 = false;
-	let visible9 = false;
-	let visible10 = false;
-	let visible11 = false;
-	let visible12 = false;
+	let visible1 = $state(false);
+	let visible2 = $state(false);
+	let visible3 = $state(false);
+	let visible4 = $state(false);
+	let visible5 = $state(false);
+	let visible6 = $state(false);
+	let visible7 = $state(false);
+	let visible8 = $state(false);
+	let visible9 = $state(false);
+	let visible10 = $state(false);
+	let visible11 = $state(false);
+	let visible12 = $state(false);
 
 	const actions = [{ content: 'Option one' }, { content: 'Option two' }, { content: 'Option three' }];
 
-	let toastVisible1 = false;
-	let toastVisible2 = false;
-	let toastVisible3 = false;
-	let index = 0;
-	let item = {};
-	const clickActionFunc = e => {
-		index = e.detail.index;
-		item = e.detail.item;
+	let toastVisible1 = $state(false);
+	let toastVisible2 = $state(false);
+	let toastVisible3 = $state(false);
+	let index = $state(0);
+	let item = $state({ content: '' });
+	const clickActionFunc = (i, action) => {
+		index = i;
+		item = action;
 		toastVisible3 = true;
 	};
 </script>
 
 <div class="py-4">
-	<Cell title="Basic usage" on:click={() => (visible1 = true)} />
+	<Cell title="Basic usage" onclick={() => (visible1 = true)} />
 	<ActionSheet bind:visible={visible1} {actions} />
 
-	<Cell title="If you have canceled operation and click on the mask, you cannot turn off" on:click={() => (visible2 = true)} />
+	<Cell title="If you have canceled operation and click on the mask, you cannot turn off" onclick={() => (visible2 = true)} />
 	<ActionSheet bind:visible={visible2} {actions} showCancel popup={{ maskClosable: false }} />
 
-	<Cell title="Different styles" on:click={() => (visible3 = true)} />
+	<Cell title="Different styles" onclick={() => (visible3 = true)} />
 	<ActionSheet
 		bind:visible={visible3}
 		actions={[
@@ -47,7 +47,7 @@
 		]}
 	/>
 
-	<Cell title="Title and description information" on:click={() => (visible4 = true)} />
+	<Cell title="Title and description information" onclick={() => (visible4 = true)} />
 	<ActionSheet
 		bind:visible={visible4}
 		actions={[
@@ -58,38 +58,38 @@
 		title="This is the title, which can be briefly explained."
 	/>
 
-	<Cell title="Come on the top" on:click={() => (visible5 = true)} />
+	<Cell title="Come on the top" onclick={() => (visible5 = true)} />
 	<ActionSheet bind:visible={visible5} {actions} popup={{ radius: 'xl' }} />
 
-	<Cell title="There is a spacing on both sides" on:click={() => (visible6 = true)} />
+	<Cell title="There is a spacing on both sides" onclick={() => (visible6 = true)} />
 	<ActionSheet bind:visible={visible6} {actions} popup={{ radius: 'xl', px: '2' }} />
 
-	<Cell title="Supervision and closing incident" on:click={() => (visible7 = true)} />
-	<ActionSheet bind:visible={visible7} {actions} on:close={() => (toastVisible1 = true)} />
+	<Cell title="Supervision and closing incident" onclick={() => (visible7 = true)} />
+	<ActionSheet bind:visible={visible7} {actions} onclose={() => (toastVisible1 = true)} />
 	<Toast bind:visible={toastVisible1} message="closed ActionSheet!" />
 
-	<Cell title="Supervision and canceling incident" on:click={() => (visible8 = true)} />
-	<ActionSheet bind:visible={visible8} {actions} showCancel on:cancel={() => (toastVisible2 = true)} />
+	<Cell title="Supervision and canceling incident" onclick={() => (visible8 = true)} />
+	<ActionSheet bind:visible={visible8} {actions} showCancel oncancel={() => (toastVisible2 = true)} />
 	<Toast bind:visible={toastVisible2} message="Click to cancel!" />
 
-	<Cell title="Survening options click event" on:click={() => (visible9 = true)} />
-	<ActionSheet bind:visible={visible9} {actions} on:clickAction={clickActionFunc} />
+	<Cell title="Survening options click event" onclick={() => (visible9 = true)} />
+	<ActionSheet bind:visible={visible9} {actions} onclickAction={clickActionFunc} />
 	<Toast bind:visible={toastVisible3} message={`Click the ${index + 1} item,${item.content}!`} />
 
-	<Cell title="Click the option not to be closed" on:click={() => (visible10 = true)} />
+	<Cell title="Click the option not to be closed" onclick={() => (visible10 = true)} />
 	<ActionSheet bind:visible={visible10} {actions} actionClosable={false} />
 
-	<Cell title="Options with pictures" on:click={() => (visible11 = true)} />
+	<Cell title="Options with pictures" onclick={() => (visible11 = true)} />
 	<ActionSheet
 		bind:visible={visible11}
 		actions={[
-			{ content: 'Fire girl', showImg: true, imgSrc: '/assets/images/dota_火女.png', imgRadius: 'base' },
-			{ content: 'calf', showImg: true, imgSrc: '/assets/images/dota_小牛.png', imgRadius: 'base' },
-			{ content: 'water man', showImg: true, imgSrc: '/assets/images/dota_水人.png', imgRadius: 'base' },
+			{ content: 'Lina', showImg: true, imgSrc: '/assets/images/dota_火女.png', imgRadius: 'base' },
+			{ content: 'Earthshaker', showImg: true, imgSrc: '/assets/images/dota_小牛.png', imgRadius: 'base' },
+			{ content: 'Morphling', showImg: true, imgSrc: '/assets/images/dota_水人.png', imgRadius: 'base' },
 		]}
 	/>
 
-	<Cell title="Option left" on:click={() => (visible12 = true)} />
+	<Cell title="Option left" onclick={() => (visible12 = true)} />
 	<ActionSheet
 		bind:visible={visible12}
 		actions={[

+ 35 - 35
demo/src/routes/zh_CN/actionSheet/+page.svelte

@@ -2,41 +2,41 @@
 <script>
 	import { Cell, ActionSheet, Toast } from '../../../../../packages/stdf/components';
 
-	let visible1 = false;
-	let visible2 = false;
-	let visible3 = false;
-	let visible4 = false;
-	let visible5 = false;
-	let visible6 = false;
-	let visible7 = false;
-	let visible8 = false;
-	let visible9 = false;
-	let visible10 = false;
-	let visible11 = false;
-	let visible12 = false;
+	let visible1 = $state(false);
+	let visible2 = $state(false);
+	let visible3 = $state(false);
+	let visible4 = $state(false);
+	let visible5 = $state(false);
+	let visible6 = $state(false);
+	let visible7 = $state(false);
+	let visible8 = $state(false);
+	let visible9 = $state(false);
+	let visible10 = $state(false);
+	let visible11 = $state(false);
+	let visible12 = $state(false);
 
 	const actions = [{ content: '选项一' }, { content: '选项二' }, { content: '选项三' }];
 
-	let toastVisible1 = false;
-	let toastVisible2 = false;
-	let toastVisible3 = false;
-	let index = 0;
-	let item = {};
-	const clickActionFunc = e => {
-		index = e.detail.index;
-		item = e.detail.item;
+	let toastVisible1 = $state(false);
+	let toastVisible2 = $state(false);
+	let toastVisible3 = $state(false);
+	let index = $state(0);
+	let item = $state({ content: '' });
+	const clickActionFunc = (i, action) => {
+		index = i;
+		item = action;
 		toastVisible3 = true;
 	};
 </script>
 
 <div class="py-4">
-	<Cell title="基础用法" on:click={() => (visible1 = true)} />
+	<Cell title="基础用法" onclick={() => (visible1 = true)} />
 	<ActionSheet bind:visible={visible1} {actions} />
 
-	<Cell title="有取消操作且点击遮罩不可关闭" on:click={() => (visible2 = true)} />
+	<Cell title="有取消操作且点击遮罩不可关闭" onclick={() => (visible2 = true)} />
 	<ActionSheet bind:visible={visible2} {actions} showCancel popup={{ maskClosable: false }} />
 
-	<Cell title="不同样式" on:click={() => (visible3 = true)} />
+	<Cell title="不同样式" onclick={() => (visible3 = true)} />
 	<ActionSheet
 		bind:visible={visible3}
 		actions={[
@@ -47,7 +47,7 @@
 		]}
 	/>
 
-	<Cell title="带标题和描述信息" on:click={() => (visible4 = true)} />
+	<Cell title="带标题和描述信息" onclick={() => (visible4 = true)} />
 	<ActionSheet
 		bind:visible={visible4}
 		actions={[
@@ -58,28 +58,28 @@
 		title="这里是标题,可以简要说明以下操作。"
 	/>
 
-	<Cell title="顶部来点圆角" on:click={() => (visible5 = true)} />
+	<Cell title="顶部来点圆角" onclick={() => (visible5 = true)} />
 	<ActionSheet bind:visible={visible5} {actions} popup={{ radius: 'xl' }} />
 
-	<Cell title="两侧有间距" on:click={() => (visible6 = true)} />
+	<Cell title="两侧有间距" onclick={() => (visible6 = true)} />
 	<ActionSheet bind:visible={visible6} {actions} popup={{ radius: 'xl', px: '2' }} />
 
-	<Cell title="监听关闭事件" on:click={() => (visible7 = true)} />
-	<ActionSheet bind:visible={visible7} {actions} on:close={() => (toastVisible1 = true)} />
+	<Cell title="监听关闭事件" onclick={() => (visible7 = true)} />
+	<ActionSheet bind:visible={visible7} {actions} onclose={() => (toastVisible1 = true)} />
 	<Toast bind:visible={toastVisible1} message="关闭了 ActionSheet!" />
 
-	<Cell title="监听取消事件" on:click={() => (visible8 = true)} />
-	<ActionSheet bind:visible={visible8} {actions} showCancel on:cancel={() => (toastVisible2 = true)} />
+	<Cell title="监听取消事件" onclick={() => (visible8 = true)} />
+	<ActionSheet bind:visible={visible8} {actions} showCancel oncancel={() => (toastVisible2 = true)} />
 	<Toast bind:visible={toastVisible2} message="点击了取消!" />
 
-	<Cell title="监听选项点击事件" on:click={() => (visible9 = true)} />
-	<ActionSheet bind:visible={visible9} {actions} on:clickAction={clickActionFunc} />
+	<Cell title="监听选项点击事件" onclick={() => (visible9 = true)} />
+	<ActionSheet bind:visible={visible9} {actions} onclickAction={clickActionFunc} />
 	<Toast bind:visible={toastVisible3} message={`点击了第 ${index + 1} 项,${item.content}!`} />
 
-	<Cell title="点击选项不关闭" on:click={() => (visible10 = true)} />
+	<Cell title="点击选项不关闭" onclick={() => (visible10 = true)} />
 	<ActionSheet bind:visible={visible10} {actions} actionClosable={false} />
 
-	<Cell title="选项带图片" on:click={() => (visible11 = true)} />
+	<Cell title="选项带图片" onclick={() => (visible11 = true)} />
 	<ActionSheet
 		bind:visible={visible11}
 		actions={[
@@ -89,7 +89,7 @@
 		]}
 	/>
 
-	<Cell title="选项左对齐" on:click={() => (visible12 = true)} />
+	<Cell title="选项左对齐" onclick={() => (visible12 = true)} />
 	<ActionSheet
 		bind:visible={visible12}
 		actions={[

+ 26 - 27
doc/components/actionSheet/api.md

@@ -1,33 +1,32 @@
 ## ActionSheet Props
 
-| 属性           | 类型    | 默认值                            | 可选值                  | 必传 | 说明                                 |
-| -------------- | ------- | --------------------------------- | ----------------------- | ---- | ------------------------------------ |
-| visible        | Boolean | false                             | true/false              | N    | 是否显示。                           |
-| title          | String  | ''                                | -                       | N    | 标题。                               |
-| titleAlign     | String  | 'center'                          | 'left'/'center'/'right' | N    | 标题对齐方式。                       |
-| actions        | Array   | []                                | 参考 Actions Props      | Y    | 菜单选项,Actions Props 组成的数组。 |
-| popup          | Object  | {}                                | 参考 Popup Props        | N    | 弹出层参数。                         |
-| showCancel     | Boolean | false                             | true/false              | N    | 是否显示取消选项。                   |
-| cancelText     | String  | 当前语言的 actionSheet.cancelText | -                       | N    | 取消选项文本。                       |
-| actionClosable | Boolean | true                              | true/false              | N    | 点击选项是否关闭。                   |
-| align          | String  | 'center'                          | 'left'/'center'/'right' | N    | 对齐方式。                           |
+| 属性           | 类型                          | 默认值                            | 必传 | 说明                                                                         |
+| -------------- | ----------------------------- | --------------------------------- | ---- | ---------------------------------------------------------------------------- |
+| visible        | `boolean`                     | false                             | N    | 是否显示。                                                                   |
+| title          | `string`                      | ''                                | N    | 标题。                                                                       |
+| titleAlign     | `left` \| `center` \| `right` | 'center'                          | N    | 标题对齐方式。                                                               |
+| actions        | `Action[]`                    | []                                | N    | 菜单选项,Action Props 组成的数组。                                          |
+| popup          | `Popup`                       | {}                                | N    | 弹出层参数 [Popup Props](https://stdf.design/#/components?nav=popup&tab=1)。 |
+| showCancel     | `boolean`                     | false                             | N    | 是否显示取消选项。                                                           |
+| cancelText     | `string`                      | 当前语言的 actionSheet.cancelText | N    | 取消选项文本。                                                               |
+| actionClosable | `boolean`                     | true                              | N    | 点击选项是否关闭。                                                           |
+| align          | `left` \| `center` \| `right` | 'center'                          | N    | 对齐方式。                                                                   |
 
-## Actions Props
+## ActionSheet Events
 
-| 属性      | 类型    | 默认值   | 可选值                               | 必传 | 说明           |
-| --------- | ------- | -------- | ------------------------------------ | ---- | -------------- |
-| content   | String  | -        | -                                    | Y    | 选项内容。     |
-| style     | String  | 'normal' | 'normal'/'theme'/'danger'/'disabled' | N    | 选项样式。     |
-| desc      | String  | ''       | -                                    | N    | 选项描述。     |
-| showImg   | Boolean | false    | true/false                           | N    | 是否显示图片。 |
-| imgRadius | String  | 'full'   | 'none'/'base'/'full'/'lg'            | N    | 图片圆角。     |
-| imgSrc    | String  | ''       | -                                    | N    | 图片地址。     |
+| 名称          | 类型                                      | 参数                                      | 描述                                         |
+| ------------- | ----------------------------------------- | ----------------------------------------- | -------------------------------------------- |
+| onclose       | `() => void`                              | -                                         | 关闭时触发。                                 |
+| oncancel      | `() => void`                              | -                                         | 点击取消时触发。                             |
+| onclickAction | `(index: number, action: Action) => void` | index - 点击索引值;action - 点击选项数据 | 点击选项时触发,即使点击选项不关闭也会触发。 |
 
-## ActionSheet Events
+## Action Props
 
-| 名称        | 参数                                                                                                           | 描述                                             |
-| ----------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
-| open        | -                                                                                                              | 打开时触发。                                     |
-| close       | -                                                                                                              | 关闭时触发。                                     |
-| cancel      | -                                                                                                              | 点击取消时触发。                                 |
-| clickAction | event:事件对象,其中 detail 内有两个参数:<br />1. index:当前点击索引值;<br />2. item:当前点击选项 Props。 | 点击选项时触发,即使点击选项不允许关闭也会触发。 |
+| 属性      | 类型                                          | 默认值   | 必传 | 说明           |
+| --------- | --------------------------------------------- | -------- | ---- | -------------- |
+| content   | `string`                                      | -        | Y    | 选项内容。     |
+| style     | `normal` \| `theme` \| `danger` \| `disabled` | 'normal' | N    | 选项样式。     |
+| desc      | `string`                                      | ''       | N    | 选项描述。     |
+| showImg   | `boolean`                                     | false    | N    | 是否显示图片。 |
+| imgRadius | `none` \| `base` \| `full` \| `lg`            | 'full'   | N    | 图片圆角。     |
+| imgSrc    | `string`                                      | ''       | N    | 图片地址。     |

+ 26 - 27
doc/components/actionSheet/api_en.md

@@ -1,33 +1,32 @@
 ## ActionSheet Props
 
-| Properties     | Type    | Default value                           | optional value          | required | Description                                 |
-| -------------- | ------- | --------------------------------------- | ----------------------- | -------- | ------------------------------------------- |
-| visible        | Boolean | false                                   | true/false              | N        | Whether to display.                         |
-| title          | String  | ''                                      | -                       | N        | title.                                      |
-| titleAlign     | String  | 'center'                                | 'left'/'center'/'right' | N        | Title alignment method.                     |
-| actions        | Array   | []                                      | refer to Actions Props  | Y        | Menu options, array of Actions Props.       |
-| popup          | Object  | {}                                      | refer to Popup Props    | N        | Popping layer parameters.                   |
-| showCancel     | Boolean | false                                   | true/false              | N        | Whether to display the cancellation option. |
-| cancelText     | String  | Current language actionSheet.cancelText | -                       | N        | Cancel the option text.                     |
-| actionClosable | Boolean | true                                    | true/false              | N        | Click whether the option is closed.         |
-| align          | String  | 'center'                                | 'left'/'center'/'right' | N        | Alignment.                                  |
+| Name           | Type                          | Default                                 | Required | Description                                                                             |
+| -------------- | ----------------------------- | --------------------------------------- | -------- | --------------------------------------------------------------------------------------- |
+| visible        | `boolean`                     | false                                   | N        | Whether to show the action sheet.                                                       |
+| title          | `string`                      | ''                                      | N        | Title text.                                                                             |
+| titleAlign     | `left` \| `center` \| `right` | 'center'                                | N        | Title alignment.                                                                        |
+| actions        | `Action[]`                    | []                                      | N        | Menu options array composed of Action Props.                                            |
+| popup          | `Popup`                       | {}                                      | N        | Popup layer parameters [Popup Props](https://stdf.design/#/components?nav=popup&tab=1). |
+| showCancel     | `boolean`                     | false                                   | N        | Whether to show cancel button.                                                          |
+| cancelText     | `string`                      | Current language actionSheet.cancelText | N        | Cancel button text.                                                                     |
+| actionClosable | `boolean`                     | true                                    | N        | Whether to close when clicking an option.                                               |
+| align          | `left` \| `center` \| `right` | 'center'                                | N        | Content alignment.                                                                      |
 
-## Actions Props
+## ActionSheet Events
 
-| Properties | Type    | Default value | Optional value                       | required | Description                  |
-| ---------- | ------- | ------------- | ------------------------------------ | -------- | ---------------------------- |
-| content    | String  | -             | -                                    | Y        | Option content.              |
-| style      | String  | 'normal'      | 'normal'/'theme'/'danger'/'disabled' | N        | Option style.                |
-| desc       | String  | ''            | -                                    | N        | Option description.          |
-| showImg    | Boolean | false         | true/false                           | N        | Whether to display pictures. |
-| imgRadius  | String  | 'full'        | 'none'/'base'/'full'/'lg'            | N        | Picture round corner.        |
-| imgSrc     | String  | ''            | -                                    | N        | The map's address.           |
+| Name          | Type                                      | Parameters                                      | Description                                                           |
+| ------------- | ----------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------- |
+| onclose       | `() => void`                              | -                                               | Triggered when closing.                                               |
+| oncancel      | `() => void`                              | -                                               | Triggered when clicking cancel button.                                |
+| onclickAction | `(index: number, action: Action) => void` | index - Click index; action - Click option data | Triggered when clicking an option, even if the option does not close. |
 
-## ActionSheet Events
+## Action Props
 
-| Name        | Parameter                                                                                                                                                  | Description                                                                                                    |
-| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
-| open        | -                                                                                                                                                          | Triggered when opening.                                                                                        |
-| close       | -                                                                                                                                                          | Triggered when closed.                                                                                         |
-| cancel      | -                                                                                                                                                          | Click to trigger when cancel.                                                                                  |
-| clickAction | event: Event object, where there are two parameters in Detail:<br />1. index: Currently click the index value;<br />2. item: Current click Options Props。 | Triggered when you click the option, even if you click the option, you will be triggered if it is not allowed. |
+| Name      | Type                                          | Default  | Required | Description            |
+| --------- | --------------------------------------------- | -------- | -------- | ---------------------- |
+| content   | `string`                                      | -        | Y        | Option content.        |
+| style     | `normal` \| `theme` \| `danger` \| `disabled` | 'normal' | N        | Option style.          |
+| desc      | `string`                                      | ''       | N        | Option description.    |
+| showImg   | `boolean`                                     | false    | N        | Whether to show image. |
+| imgRadius | `none` \| `base` \| `full` \| `lg`            | 'full'   | N        | Image border radius.   |
+| imgSrc    | `string`                                      | ''       | N        | Image source URL.      |

+ 1 - 1
doc/components/actionSheet/guide.md

@@ -8,7 +8,7 @@ ActionSheet 动作面板是在 Popup 基础上封装的,通过预先定义一
 
 ## actions
 
-ActionSheet 的 actions 属性是一个数组,数组中的每一项都是一个对象,对象属性参考 Actions Props。
+ActionSheet 的 actions 属性是一个数组,数组中的每一项都是一个对象,对象属性参考 Action Props。
 
 ## ActionSheet、Picker、Radio
 

+ 1 - 1
doc/components/actionSheet/guide_en.md

@@ -8,7 +8,7 @@ ActionSheet is encapsulated based on Popup. By predefining some Props of Popup,
 
 ## Actions
 
-The actions property of ActionSheet is an array, and each item in the array is an object. The properties of the object refer to Actions Props.
+The actions property of ActionSheet is an array, and each item in the array is an object. The properties of the object refer to Action Props.
 
 ## ActionSheet, Picker, Radio
 

+ 25 - 33
packages/stdf/components/actionSheet/ActionSheet.svelte

@@ -22,7 +22,6 @@
 		align = 'center',
 		oncancel,
 		onclickAction,
-		onopen,
 		onclose,
 	} = $props();
 
@@ -43,8 +42,8 @@
 	// Image radius
 	const imgRadiusClass = { none: 'rounded-none', base: 'rounded', full: 'rounded-full', lg: 'rounded-lg' };
 
-	// 图片对齐方式
-	// Image alignment
+	// 对齐方式
+	// alignment
 	const alignClass = { left: 'justify-start pl-4', center: 'justify-center', right: 'justify-end pr-4' };
 
 	// 计算弹出层高度
@@ -64,7 +63,8 @@
 	// Click event of cancel button
 	const cancelFunc = () => {
 		visible = false;
-		oncancel && oncancel(); // 如果 cancel 存在,执行 cancel 函数
+		oncancel && oncancel();
+		onclose && onclose();
 	};
 
 	// 选项点击事件,如果选项不可点击,不触发事件,如果可点击,触发事件,如果 actionClosable 为 true,关闭弹出层
@@ -74,52 +74,39 @@
 			onclickAction && onclickAction(index, item); // 如果 clickAction 存在,执行 clickAction 函数
 			if (actionClosable) {
 				visible = false;
+				onclose && onclose();
 			}
 		}
 	};
-
-	// 监听 visible 变化,如果为 true,派发 open 事件,如果为 false,派发 close 事件
-	// Listen to the change of visible, if it is true, dispatch the open event, if it is false, dispatch the close event
-	$effect(() => {
-		if (visible) {
-			onopen && onopen();
-		} else {
-			onclose && onclose();
-		}
-	});
 </script>
 
-<Popup bind:visible size={0} maskClosable transitionDistance={getTransitionDistanceunc(title, showCancel, actions)} {...popup}>
+<Popup bind:visible size={0} maskClosable transitionDistance={getTransitionDistanceunc(title, showCancel, actions)} {onclose} {...popup}>
 	{#if title}
 		<div
-			class={`truncate text-xs text-black/50 dark:text-white/50 border-b border-black/5 dark:border-white/5 h-10 flex flex-col justify-center ${
-				titleAlignClass[titleAlign] || titleAlignClass['left']
-			}`}
+			class="truncate text-xs text-black/50 dark:text-white/50 border-b border-black/5 dark:border-white/5 h-10 flex flex-col justify-center {titleAlignClass[
+				titleAlign
+			] || titleAlignClass['left']}"
 		>
 			{title}
 		</div>
 	{/if}
 	<div>
 		{#each actions as item, index}
-			<!-- svelte-ignore a11y_click_events_have_key_events -->
-			<!-- svelte-ignore a11y_no_static_element_interactions -->
-			<div
-				class={`${item.style !== 'disabled' ? 'active:scale-90 ' : ''}transition-all flex items-center gap-2 ${
-					alignClass[align] || alignClass['center']
-				}`}
+			<button
+				class="{item.style !== 'disabled' ? 'active:scale-90 ' : ''}transition-all flex items-center gap-2 w-full {alignClass[align] ||
+					alignClass['center']}"
 				onclick={() => clickActionFunc(index, item)}
 			>
-				<!-- image -->
 				{#if item.showImg}
-					<div class={`w-6 h-6 overflow-hidden ${imgRadiusClass[item.imgRadius] || 'rounded-full'}`}>
+					<div class="w-6 h-6 overflow-hidden {imgRadiusClass[item.imgRadius] || 'rounded-full'}">
 						<img class="w-full h-full object-cover" src={item.imgSrc} alt="" />
 					</div>
 				{/if}
 				<div>
 					<div
-						class={`truncate text-center font-bold${stateClass[item.style] || stateClass.normal}flex flex-col justify-center${
-							item.desc ? ' h-10' : ' h-14'
-						}`}
+						class="truncate text-center font-bold {stateClass[item.style] || stateClass.normal} flex flex-col justify-center {item.desc
+							? ' h-10'
+							: ' h-14'}"
 					>
 						{item.content}
 					</div>
@@ -127,7 +114,7 @@
 						<div class="truncate text-center text-xs pb-1 text-black/50 dark:text-white/40">{item.desc}</div>
 					{/if}
 				</div>
-			</div>
+			</button>
 			{#if index !== actions.length - 1}
 				<div class="h-px w-full bg-black/5 dark:bg-white/5"></div>
 			{/if}
@@ -135,8 +122,13 @@
 	</div>
 	{#if showCancel}
 		<div class="bg-black/5 dark:bg-white/5 h-2"></div>
-		<!-- svelte-ignore a11y_click_events_have_key_events -->
-		<!-- svelte-ignore a11y_no_static_element_interactions -->
-		<div class="active:scale-90 transition-all text-center h-12 flex flex-col justify-center" onclick={cancelFunc}>{cancelText}</div>
+		<button
+			class="active:scale-90 transition-all h-12 flex items-center w-full {alignClass[align] || alignClass['center']}"
+			onclick={cancelFunc}
+		>
+			<div>
+				{cancelText}
+			</div>
+		</button>
 	{/if}
 </Popup>