diff --git a/docs/docs/components/universal/_meta.json b/docs/docs/components/universal/_meta.json index 0f88905..cbdcc5e 100644 --- a/docs/docs/components/universal/_meta.json +++ b/docs/docs/components/universal/_meta.json @@ -5,5 +5,6 @@ "input", "badge", "calendar", - "card" + "card", + "select" ] \ No newline at end of file diff --git a/docs/docs/components/universal/card.mdx b/docs/docs/components/universal/card.mdx index d07f4ad..0bff8bd 100644 --- a/docs/docs/components/universal/card.mdx +++ b/docs/docs/components/universal/card.mdx @@ -13,7 +13,7 @@ The Card component displays content within a styled card container. padding={16} gap={8} width={400} - titleImageUrl="/aurora-poster.png" + titleImageUrl="https://sastimg.mxte.cc/image/6Ht1" >
Aurora UI · Universal Component
🌏 This is the universal version of SAST UI, which is based on Web Components. It is designed to be used in any framework, such as React, Vue, Angular, and even vanilla JavaScript.
@@ -131,7 +131,7 @@ export default function Example() { padding={16} gap={8} width={400} - titleImageUrl="/aurora-poster.png" + titleImageUrl="https://sastimg.mxte.cc/image/6Ht1" >
Header Content
Main Content
diff --git a/docs/docs/components/universal/input.mdx b/docs/docs/components/universal/input.mdx index d9ac864..7b48487 100644 --- a/docs/docs/components/universal/input.mdx +++ b/docs/docs/components/universal/input.mdx @@ -23,7 +23,6 @@ Input component allows users to input text or passwords. | `fontsize` | The font size of the input. | `number` | `16` | | `isFillFather` | If `true`, the input will fill its container.| `boolean` | `false` | | `value` | The value of the input. | `string` | | -| `defaultValue` | The default value of the input. | `string` | | | `isBorder` | If `true`, the input will have a border. | `boolean` | `true` | ## Example in HTML diff --git a/docs/docs/components/universal/select.mdx b/docs/docs/components/universal/select.mdx new file mode 100644 index 0000000..81f99d8 --- /dev/null +++ b/docs/docs/components/universal/select.mdx @@ -0,0 +1,70 @@ +import Wraper from '../../tools/wraper/index' +import { Select } from '@sast/ui-universal' + +# Select Component + +The Select component provides a dropdown menu with selectable options. + + +
+ console.log("Selected option:", value)} + selectKey={0} + width={400} + placeHolder="Please select" + /> +
+ ); +} +``` \ No newline at end of file diff --git a/packages/ui-universal/lib/components/Input/index.ts b/packages/ui-universal/lib/components/Input/index.ts index 4624567..027a39b 100644 --- a/packages/ui-universal/lib/components/Input/index.ts +++ b/packages/ui-universal/lib/components/Input/index.ts @@ -5,6 +5,7 @@ import { ifDefined } from "lit/directives/if-defined.js"; import { createComponent } from "@lit/react"; import React from "react"; import { classMap } from "lit/directives/class-map.js"; +import { live } from "lit/directives/live.js"; export interface InputProps { /** @@ -42,11 +43,7 @@ export interface InputProps { /** * value ,the value of the input */ - value: string; - /** - * defaultValue, the defaultValue of the input - */ - defaultValue?: string; + value?: string; /** * isBorder? have the border of the input */ @@ -58,14 +55,14 @@ export class AInput extends LitElement { static styles = styles; @property({ type: Number }) width: InputProps["width"] = 250; @property({ type: Boolean }) fill: InputProps["fill"] = false; - @property({ type: Boolean }) disabled: InputProps["disabled"] = false; + @property({ type: Boolean, reflect: true }) disabled: InputProps["disabled"] = + false; @property({ type: String }) label: InputProps["label"] = "输入框"; @property({ type: String }) mode: InputProps["mode"] = "text"; @property({ type: String }) placeholder: InputProps["placeholder"]; @property({ type: Number }) fontsize: InputProps["fontsize"] = 16; @property({ type: Boolean }) isFillFather: InputProps["isFillFather"] = false; @property({ type: String }) value: InputProps["value"] = ""; - @property({ type: String }) defaultValue: InputProps["defaultValue"]; @property({ type: Boolean }) isBorder: InputProps["isBorder"] = true; @state() isFocus = false; @@ -94,6 +91,7 @@ export class AInput extends LitElement { style="width:${this.fill ? "100%" : `${this.width}px`};--input-font-size:${this.fontsize}px;" + aria-disabled="${this.disabled ? "true" : "false"}" > ${this.label ? html`