diff --git a/examples/uni/src/pages-feedback/action-sheet/base.vue b/examples/uni/src/pages-feedback/action-sheet/base.vue new file mode 100644 index 0000000..3f21c76 --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/base.vue @@ -0,0 +1,32 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/cancel.vue b/examples/uni/src/pages-feedback/action-sheet/cancel.vue new file mode 100644 index 0000000..ded87fa --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/cancel.vue @@ -0,0 +1,53 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/controlled.vue b/examples/uni/src/pages-feedback/action-sheet/controlled.vue new file mode 100644 index 0000000..b56724e --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/controlled.vue @@ -0,0 +1,58 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/custom.vue b/examples/uni/src/pages-feedback/action-sheet/custom.vue new file mode 100644 index 0000000..db88cbc --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/custom.vue @@ -0,0 +1,60 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/description.vue b/examples/uni/src/pages-feedback/action-sheet/description.vue new file mode 100644 index 0000000..9bdf5dd --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/description.vue @@ -0,0 +1,45 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/destructive.vue b/examples/uni/src/pages-feedback/action-sheet/destructive.vue new file mode 100644 index 0000000..f4d4022 --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/destructive.vue @@ -0,0 +1,49 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/disabled.vue b/examples/uni/src/pages-feedback/action-sheet/disabled.vue new file mode 100644 index 0000000..85775ee --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/disabled.vue @@ -0,0 +1,34 @@ + + + diff --git a/examples/uni/src/pages-feedback/action-sheet/icon.vue b/examples/uni/src/pages-feedback/action-sheet/icon.vue new file mode 100644 index 0000000..2140964 --- /dev/null +++ b/examples/uni/src/pages-feedback/action-sheet/icon.vue @@ -0,0 +1,50 @@ + + + diff --git a/examples/uni/src/pages.json b/examples/uni/src/pages.json index bb82f30..39d2ed8 100644 --- a/examples/uni/src/pages.json +++ b/examples/uni/src/pages.json @@ -637,6 +637,38 @@ { "root": "pages-feedback", "pages": [ + { + "path": "action-sheet/base", + "type": "page" + }, + { + "path": "action-sheet/cancel", + "type": "page" + }, + { + "path": "action-sheet/controlled", + "type": "page" + }, + { + "path": "action-sheet/custom", + "type": "page" + }, + { + "path": "action-sheet/description", + "type": "page" + }, + { + "path": "action-sheet/destructive", + "type": "page" + }, + { + "path": "action-sheet/disabled", + "type": "page" + }, + { + "path": "action-sheet/icon", + "type": "page" + }, { "path": "dialog/base", "type": "page" @@ -733,4 +765,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/packages/skiyee-uni-ui/src/components/sk-action-sheet.vue b/packages/skiyee-uni-ui/src/components/sk-action-sheet.vue new file mode 100644 index 0000000..eb37227 --- /dev/null +++ b/packages/skiyee-uni-ui/src/components/sk-action-sheet.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/packages/skiyee-uni-ui/src/styles/index.ts b/packages/skiyee-uni-ui/src/styles/index.ts index cd3dee8..3beffc0 100644 --- a/packages/skiyee-uni-ui/src/styles/index.ts +++ b/packages/skiyee-uni-ui/src/styles/index.ts @@ -6,6 +6,9 @@ * @github https://github.com/skiyee */ +export type { SkActionSheetUcvProps } from './sk-action-sheet' +export { SkActionSheetUcv } from './sk-action-sheet' + export type { SkBadgeUcvProps } from './sk-badge' export { SkBadgeUcv } from './sk-badge' diff --git a/packages/skiyee-uni-ui/src/styles/sk-action-sheet.ts b/packages/skiyee-uni-ui/src/styles/sk-action-sheet.ts new file mode 100644 index 0000000..e08b08c --- /dev/null +++ b/packages/skiyee-uni-ui/src/styles/sk-action-sheet.ts @@ -0,0 +1,125 @@ +// @unocss-include +/** + * sk-action-sheet 由 @skiyee/ucv 生成的样式组件 + * + * @author sKy(skiyee) + * @qq 319619193 + * @github https://github.com/skiyee + * + * @example + * ```ts + * const classes = SkActionSheetUcv(props) + * ``` + * + * @see 更多示例请参考文档: https://skiyee-ui.netlify.app/docs/components/feedback/action-sheet + */ +import type { InferProps } from '@skiyee/ucv' + +import { ucv } from '@skiyee/ucv' + +export const SkActionSheetUcv = ucv({ + element: { + root: 'box-border flex flex-col bg-surface w-full', + header: 'flex flex-col items-center text-center border-b border-divider', + title: 'font-medium text-primary text-body-large', + description: 'text-secondary text-body-small sk-unit:mt-4', + optionList: 'flex flex-col', + option: 'flex items-center justify-center cursor-pointer transition-colors duration-200 active:bg-hover border-b border-divider', + optionContent: 'flex flex-col items-center justify-center flex-1', + optionIcon: 'text-primary', + optionName: 'text-primary text-body-medium', + optionDescription: 'text-secondary text-body-small sk-unit:mt-2', + cancel: 'flex items-center justify-center cursor-pointer transition-colors duration-200 active:bg-hover bg-surface', + cancelText: 'font-medium text-primary text-body-medium', + safeArea: 'w-full', + }, + variants: { + round: { + true: { + root: 'rounded-t-large', + }, + false: { + root: 'rounded-none', + }, + }, + spacing: { + compact: { + header: 'sk-unit:(px-16 py-12)', + option: 'sk-unit:(px-16 py-12)', + cancel: 'sk-unit:(px-16 py-12)', + }, + normal: { + header: 'sk-unit:(px-16 py-16)', + option: 'sk-unit:(px-16 py-16)', + cancel: 'sk-unit:(px-16 py-16)', + }, + }, + optionVariant: { + default: { + optionName: 'text-primary', + }, + destructive: { + optionName: 'text-danger', + }, + }, + disabled: { + true: { + option: 'opacity-50 cursor-not-allowed active:bg-transparent', + }, + }, + hasIcon: { + true: { + option: 'sk-unit:gap-12', + }, + }, + hasDescription: { + true: { + optionContent: 'items-start', + }, + }, + hasCancel: { + true: { + root: 'sk-unit:pb-0', + }, + false: { + root: '', + }, + }, + safeAreaInsetBottom: { + true: { + safeArea: 'pb-safe', + }, + false: { + safeArea: 'sk-unit:pb-0', + }, + }, + }, + cases: [ + // 圆角与取消按钮间距 + { + when: { round: true, hasCancel: true }, + use: { + cancel: 'sk-unit:mt-8', + }, + }, + // 最后一个选项去除底部边框 + { + when: { hasCancel: false }, + use: { + option: 'last:border-b-0', + }, + }, + ], + defaults: { + round: true, + spacing: 'normal', + optionVariant: 'default', + disabled: false, + hasIcon: false, + hasDescription: false, + hasCancel: true, + safeAreaInsetBottom: true, + }, +}) + +export type SkActionSheetUcvProps = InferProps