@zyro-sec/ui 1.0.0 → 1.0.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/AGENTS.md +29 -0
- package/bunfig.toml +2 -0
- package/package.json +21 -114
- package/perf/motion.bench.ts +14 -0
- package/perf/motion.ts +16 -0
- package/script/build-oc2-v2-overrides.ts +38 -0
- package/script/colors.txt +288 -0
- package/script/generate-spinner.ts +121 -0
- package/script/pack.ts +5 -0
- package/script/tailwind.ts +24 -0
- package/src/actions/button/button.stories.tsx +158 -0
- package/src/actions/icon-button/icon-button.stories.tsx +122 -0
- package/src/actions/split-button/split-button.stories.tsx +59 -0
- package/src/assets/favicon/apple-touch-icon-v3.png +0 -0
- package/src/assets/favicon/apple-touch-icon.png +0 -0
- package/src/assets/favicon/favicon-96x96-v3.png +0 -0
- package/src/assets/favicon/favicon-96x96.png +0 -0
- package/src/assets/favicon/favicon-v3.ico +0 -0
- package/src/assets/favicon/favicon-v3.svg +7 -0
- package/src/assets/favicon/favicon.ico +0 -0
- package/src/assets/favicon/favicon.svg +7 -0
- package/src/assets/favicon/site.webmanifest +24 -0
- package/src/assets/favicon/web-app-manifest-192x192.png +0 -0
- package/src/assets/favicon/web-app-manifest-512x512.png +0 -0
- package/src/assets/icons/provider/302ai.svg +7 -0
- package/src/assets/icons/provider/abacus.svg +14 -0
- package/src/assets/icons/provider/aihubmix.svg +3 -0
- package/src/assets/icons/provider/alibaba-cn.svg +3 -0
- package/src/assets/icons/provider/alibaba-coding-plan-cn.svg +3 -0
- package/src/assets/icons/provider/alibaba-coding-plan.svg +3 -0
- package/src/assets/icons/provider/alibaba.svg +3 -0
- package/src/assets/icons/provider/amazon-bedrock.svg +3 -0
- package/src/assets/icons/provider/anthropic.svg +3 -0
- package/src/assets/icons/provider/azure-cognitive-services.svg +24 -0
- package/src/assets/icons/provider/azure.svg +3 -0
- package/src/assets/icons/provider/bailing.svg +3 -0
- package/src/assets/icons/provider/baseten.svg +3 -0
- package/src/assets/icons/provider/berget.svg +3 -0
- package/src/assets/icons/provider/cerebras.svg +4 -0
- package/src/assets/icons/provider/chutes.svg +24 -0
- package/src/assets/icons/provider/clarifai.svg +24 -0
- package/src/assets/icons/provider/claude-agent.svg +3 -0
- package/src/assets/icons/provider/cloudferro-sherlock.svg +5 -0
- package/src/assets/icons/provider/cloudflare-ai-gateway.svg +4 -0
- package/src/assets/icons/provider/cloudflare-workers-ai.svg +4 -0
- package/src/assets/icons/provider/cohere.svg +5 -0
- package/src/assets/icons/provider/cortecs.svg +24 -0
- package/src/assets/icons/provider/deepinfra.svg +4 -0
- package/src/assets/icons/provider/deepseek.svg +3 -0
- package/src/assets/icons/provider/digitalocean.svg +6 -0
- package/src/assets/icons/provider/dinference.svg +1 -0
- package/src/assets/icons/provider/drun.svg +8 -0
- package/src/assets/icons/provider/evroc.svg +3 -0
- package/src/assets/icons/provider/fastrouter.svg +3 -0
- package/src/assets/icons/provider/fireworks-ai.svg +3 -0
- package/src/assets/icons/provider/firmware.svg +18 -0
- package/src/assets/icons/provider/friendli.svg +3 -0
- package/src/assets/icons/provider/github-copilot.svg +3 -0
- package/src/assets/icons/provider/github-models.svg +3 -0
- package/src/assets/icons/provider/gitlab.svg +3 -0
- package/src/assets/icons/provider/google-vertex-anthropic.svg +24 -0
- package/src/assets/icons/provider/google-vertex.svg +10 -0
- package/src/assets/icons/provider/google.svg +3 -0
- package/src/assets/icons/provider/groq.svg +3 -0
- package/src/assets/icons/provider/helicone.svg +6 -0
- package/src/assets/icons/provider/huggingface.svg +3 -0
- package/src/assets/icons/provider/iflowcn.svg +3 -0
- package/src/assets/icons/provider/inception.svg +4 -0
- package/src/assets/icons/provider/inference.svg +3 -0
- package/src/assets/icons/provider/io-net.svg +5 -0
- package/src/assets/icons/provider/jiekou.svg +4 -0
- package/src/assets/icons/provider/kilo.svg +4 -0
- package/src/assets/icons/provider/kimi-for-coding.svg +3 -0
- package/src/assets/icons/provider/kuae-cloud-coding-plan.svg +3 -0
- package/src/assets/icons/provider/llama.svg +3 -0
- package/src/assets/icons/provider/lmstudio.svg +24 -0
- package/src/assets/icons/provider/lucidquery.svg +3 -0
- package/src/assets/icons/provider/meganova.svg +3 -0
- package/src/assets/icons/provider/meituan.svg +6 -0
- package/src/assets/icons/provider/meta.svg +3 -0
- package/src/assets/icons/provider/minimax-cn-coding-plan.svg +24 -0
- package/src/assets/icons/provider/minimax-cn.svg +3 -0
- package/src/assets/icons/provider/minimax-coding-plan.svg +24 -0
- package/src/assets/icons/provider/minimax.svg +3 -0
- package/src/assets/icons/provider/mistral.svg +3 -0
- package/src/assets/icons/provider/moark.svg +3 -0
- package/src/assets/icons/provider/modelscope.svg +5 -0
- package/src/assets/icons/provider/moonshotai-cn.svg +3 -0
- package/src/assets/icons/provider/moonshotai.svg +3 -0
- package/src/assets/icons/provider/morph.svg +24 -0
- package/src/assets/icons/provider/nano-gpt.svg +3 -0
- package/src/assets/icons/provider/nebius.svg +4 -0
- package/src/assets/icons/provider/nova.svg +3 -0
- package/src/assets/icons/provider/novita-ai.svg +10 -0
- package/src/assets/icons/provider/nvidia.svg +3 -0
- package/src/assets/icons/provider/ollama-cloud.svg +7 -0
- package/src/assets/icons/provider/openai.svg +3 -0
- package/src/assets/icons/provider/opencode-go.svg +3 -0
- package/src/assets/icons/provider/opencode.svg +3 -0
- package/src/assets/icons/provider/openrouter.svg +3 -0
- package/src/assets/icons/provider/ovhcloud.svg +3 -0
- package/src/assets/icons/provider/perplexity-agent.svg +3 -0
- package/src/assets/icons/provider/perplexity.svg +3 -0
- package/src/assets/icons/provider/poe.svg +7 -0
- package/src/assets/icons/provider/privatemode-ai.svg +5 -0
- package/src/assets/icons/provider/qihang-ai.svg +9 -0
- package/src/assets/icons/provider/qiniu-ai.svg +7 -0
- package/src/assets/icons/provider/reflection.svg +3 -0
- package/src/assets/icons/provider/requesty.svg +24 -0
- package/src/assets/icons/provider/sap-ai-core.svg +24 -0
- package/src/assets/icons/provider/scaleway.svg +5 -0
- package/src/assets/icons/provider/siliconflow-cn.svg +3 -0
- package/src/assets/icons/provider/siliconflow.svg +3 -0
- package/src/assets/icons/provider/stackit.svg +4 -0
- package/src/assets/icons/provider/stepfun.svg +16 -0
- package/src/assets/icons/provider/submodel.svg +3 -0
- package/src/assets/icons/provider/synthetic.svg +24 -0
- package/src/assets/icons/provider/tencent-coding-plan.svg +5 -0
- package/src/assets/icons/provider/tencent.svg +3 -0
- package/src/assets/icons/provider/thinkingmachines.svg +3 -0
- package/src/assets/icons/provider/togetherai.svg +4 -0
- package/src/assets/icons/provider/upstage.svg +24 -0
- package/src/assets/icons/provider/v0.svg +3 -0
- package/src/assets/icons/provider/venice.svg +4 -0
- package/src/assets/icons/provider/vercel.svg +3 -0
- package/src/assets/icons/provider/vivgrid.svg +4 -0
- package/src/assets/icons/provider/vultr.svg +6 -0
- package/src/assets/icons/provider/wandb.svg +24 -0
- package/src/assets/icons/provider/xai.svg +3 -0
- package/src/assets/icons/provider/xiaomi.svg +3 -0
- package/src/assets/icons/provider/zai-coding-plan.svg +3 -0
- package/src/assets/icons/provider/zai.svg +3 -0
- package/src/assets/icons/provider/zenmux.svg +4 -0
- package/src/assets/icons/provider/zhipuai-coding-plan.svg +3 -0
- package/src/assets/icons/provider/zhipuai.svg +3 -0
- package/src/assets/images/social-share-black.png +0 -0
- package/src/assets/images/social-share-zen.png +0 -0
- package/src/assets/images/social-share.png +0 -0
- package/src/components/animated-number-machine.test.ts +140 -0
- package/src/components/animated-number.stories.tsx +35 -0
- package/src/components/app-icon.stories.tsx +73 -0
- package/src/components/card.stories.tsx +101 -0
- package/src/components/collapsible.stories.tsx +76 -0
- package/src/components/context-menu.stories.tsx +150 -0
- package/src/components/diagram-preview.stories.tsx +62 -0
- package/src/components/dock-surface.stories.tsx +26 -0
- package/src/components/document-surface.stories.tsx +42 -0
- package/src/components/error-details.stories.tsx +72 -0
- package/src/components/favicon.stories.tsx +49 -0
- package/src/components/file-icon-machine.test.ts +52 -0
- package/src/components/file-icon.stories.tsx +93 -0
- package/src/components/file-icons/sprite.svg +11707 -0
- package/src/components/font.stories.tsx +48 -0
- package/src/components/hover-card.stories.tsx +79 -0
- package/src/components/image-flight-machine.test.ts +184 -0
- package/src/components/image-flight.test.ts +173 -0
- package/src/components/image-preview.stories.tsx +392 -0
- package/src/components/image-zoom-machine.test.ts +154 -0
- package/src/components/image-zoom.test.ts +96 -0
- package/src/components/list.stories.tsx +221 -0
- package/src/components/logo.stories.tsx +62 -0
- package/src/components/menu-scroll.stories.tsx +73 -0
- package/src/components/popover-machine.test.ts +150 -0
- package/src/components/popover.stories.tsx +84 -0
- package/src/components/preview-controls.stories.tsx +40 -0
- package/src/components/progress.stories.tsx +69 -0
- package/src/components/provider-icon.stories.tsx +75 -0
- package/src/components/resize-handle-machine.test.ts +164 -0
- package/src/components/resize-handle.stories.tsx +81 -0
- package/src/components/rolling-number.stories.tsx +23 -0
- package/src/components/scroll-view-machine.test.ts +141 -0
- package/src/components/scroll-view.stories.tsx +68 -0
- package/src/components/scroll-view.test.ts +114 -0
- package/src/components/spinner-radar.test.ts +61 -0
- package/src/components/spinner.stories.tsx +40 -0
- package/src/components/sticky-accordion-header.stories.tsx +64 -0
- package/src/components/text-field-machine.test.ts +99 -0
- package/src/components/text-field.stories.tsx +132 -0
- package/src/components/text-reveal-machine.test.ts +157 -0
- package/src/components/text-reveal.stories.tsx +363 -0
- package/src/components/text-strikethrough.stories.tsx +296 -0
- package/src/components/thinking-heading.stories.tsx +900 -0
- package/src/components/truncated-text.stories.tsx +37 -0
- package/src/components/typewriter-machine.test.ts +177 -0
- package/src/components/typewriter.stories.tsx +51 -0
- package/src/context/dialog-machine.test.ts +295 -0
- package/src/context/i18n.test.ts +89 -0
- package/src/context/marked-base.test.ts +75 -0
- package/src/context/marked-parser.test.ts +167 -0
- package/src/context/marked-regression.test.ts +12 -0
- package/src/data-display/accordion/accordion.stories.tsx +76 -0
- package/src/data-display/avatar/avatar.stories.tsx +48 -0
- package/src/data-display/badge/badge.stories.tsx +75 -0
- package/src/data-display/diff-changes/diff-changes.stories.tsx +63 -0
- package/src/data-display/keybind/keybind.stories.tsx +77 -0
- package/src/data-display/line-comment/line-comment.stories.tsx +288 -0
- package/src/data-display/line-comment/machine.test.ts +385 -0
- package/src/data-display/project-avatar/animation-machine.test.ts +134 -0
- package/src/data-display/project-avatar/generated.test.ts +50 -0
- package/src/data-display/project-avatar/procedural.test.ts +16 -0
- package/src/data-display/project-avatar/project-avatar.stories.tsx +102 -0
- package/src/data-display/project-avatar/project-avatar.test.ts +21 -0
- package/src/data-display/project-avatar/project-icon-styles.stories.tsx +772 -0
- package/src/feedback/activity-ring/activity-ring.stories.tsx +20 -0
- package/src/feedback/loader/loader.stories.tsx +44 -0
- package/src/feedback/progress-circle/progress-circle.stories.tsx +56 -0
- package/src/feedback/toast/description.test.ts +20 -0
- package/src/feedback/toast/machine.test.ts +106 -0
- package/src/feedback/toast/toast.stories.tsx +186 -0
- package/src/forms/checkbox/checkbox.stories.tsx +104 -0
- package/src/forms/field/field.stories.tsx +129 -0
- package/src/forms/inline-input/inline-input.stories.tsx +37 -0
- package/src/forms/radio/radio.stories.tsx +145 -0
- package/src/forms/redirect-paste/redirect-paste.stories.tsx +101 -0
- package/src/forms/search-list/navigation.test.ts +40 -0
- package/src/forms/search-list/search-list.stories.tsx +108 -0
- package/src/forms/select/machine.test.ts +105 -0
- package/src/forms/select/select.stories.tsx +208 -0
- package/src/forms/switch/switch.stories.tsx +97 -0
- package/src/forms/text-input/text-input.stories.tsx +220 -0
- package/src/forms/textarea/textarea.stories.tsx +137 -0
- package/src/forms/typeahead/machine.test.ts +143 -0
- package/src/forms/typeahead/typeahead.stories.tsx +113 -0
- package/src/hooks/auto-scroll-machine.test.ts +212 -0
- package/src/hooks/list-machine.test.ts +263 -0
- package/src/hooks/spin-phase.test.ts +32 -0
- package/src/hooks/use-filtered-list.test.ts +41 -0
- package/src/icons/icon/icon.stories.tsx +131 -0
- package/src/layout/divider/divider.stories.tsx +38 -0
- package/src/motion/README.md +113 -0
- package/src/motion/core.test.ts +328 -0
- package/src/motion-tuning-features.test.ts +129 -0
- package/src/motion-tuning.test.ts +68 -0
- package/src/navigation/menu/machine.test.ts +85 -0
- package/src/navigation/menu/menu.stories.tsx +328 -0
- package/src/navigation/menu/submenu-machine.test.ts +71 -0
- package/src/navigation/segmented-control/segmented-control.stories.tsx +115 -0
- package/src/navigation/segmented-control/segmented-control.test.ts +123 -0
- package/src/navigation/tab-state-indicator.stories.tsx +24 -0
- package/src/navigation/tabs/tabs.stories.tsx +193 -0
- package/src/overlays/dialog/dialog.stories.tsx +365 -0
- package/src/overlays/mcp-sign-in/machine.test.ts +215 -0
- package/src/overlays/tooltip/machine.test.ts +214 -0
- package/src/overlays/tooltip/tooltip.stories.tsx +155 -0
- package/src/styles/blue-tokens.stories.tsx +215 -0
- package/src/theme/desktop-theme.schema.json +168 -0
- package/src/theme/machine.test.ts +498 -0
- package/src/theme/v2/resolve.test.ts +120 -0
- package/src/typography/slash/slash.stories.tsx +26 -0
- package/src/typography/text-shimmer/machine.test.ts +117 -0
- package/src/typography/text-shimmer/text-shimmer.stories.tsx +64 -0
- package/src/typography/wordmark/wordmark.stories.tsx +19 -0
- package/test/solid-jsx.ts +20 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +23 -0
- package/vite.config.ts +61 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { createEffect, createSignal } from "solid-js"
|
|
2
|
+
import { Field } from "@zyro-sec/ui/field"
|
|
3
|
+
import { Select, type SelectProps } from "./select"
|
|
4
|
+
|
|
5
|
+
const fruits = ["Apple", "Banana", "Cherry", "Date", "Elderberry"]
|
|
6
|
+
|
|
7
|
+
type Region = "North" | "South" | "East" | "West"
|
|
8
|
+
|
|
9
|
+
const cities: { city: string; region: Region }[] = [
|
|
10
|
+
{ city: "Boston", region: "North" },
|
|
11
|
+
{ city: "Miami", region: "South" },
|
|
12
|
+
{ city: "Atlanta", region: "South" },
|
|
13
|
+
{ city: "Seattle", region: "West" },
|
|
14
|
+
{ city: "Denver", region: "West" },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const docs = `### Overview
|
|
18
|
+
Single-select built on Kobalte with current menu styling. The trigger is inline by default, or an input field that matches the text input.
|
|
19
|
+
|
|
20
|
+
### API
|
|
21
|
+
- \`appearance\`: \`inline\` (default) is the borderless trigger; \`small\`, \`base\` and \`large\` are 24px, 28px and 32px input fields.
|
|
22
|
+
- \`surface\`: \`base\` (default), \`layer-1\` or \`invisible\` for input fields; invisible gains a fill on hover.
|
|
23
|
+
- \`placeholder\`: Shown in the trigger when nothing is selected (same idea as text inputs).
|
|
24
|
+
- \`options\`, \`current\`, \`onSelect\`: controlled selection (\`current\` is the selected option object).
|
|
25
|
+
- \`value\` / \`label\`: accessors when options are not plain strings.
|
|
26
|
+
- \`groupBy\`: groups options; section headers use menu group label styling.
|
|
27
|
+
- \`placement\`, \`gutter\`, \`sameWidth\`, \`flip\`, \`slide\`, \`fitViewport\`: forwarded to Kobalte popper.
|
|
28
|
+
- \`invalid\`, \`disabled\`, \`numeric\`: match text input conventions.
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
type Controls = Pick<
|
|
32
|
+
SelectProps<string>,
|
|
33
|
+
| "appearance"
|
|
34
|
+
| "surface"
|
|
35
|
+
| "invalid"
|
|
36
|
+
| "disabled"
|
|
37
|
+
| "numeric"
|
|
38
|
+
| "placeholder"
|
|
39
|
+
| "open"
|
|
40
|
+
| "placement"
|
|
41
|
+
| "gutter"
|
|
42
|
+
| "sameWidth"
|
|
43
|
+
| "closeOnSelection"
|
|
44
|
+
| "slide"
|
|
45
|
+
| "flip"
|
|
46
|
+
| "fitViewport"
|
|
47
|
+
>
|
|
48
|
+
|
|
49
|
+
function Sample<T>(props: SelectProps<T>) {
|
|
50
|
+
const [current, setCurrent] = createSignal<T | undefined>(props.current)
|
|
51
|
+
|
|
52
|
+
const [open, setOpen] = createSignal(false)
|
|
53
|
+
|
|
54
|
+
createEffect(() => setOpen(!!props.open))
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Select
|
|
58
|
+
{...props}
|
|
59
|
+
current={current()}
|
|
60
|
+
open={open()}
|
|
61
|
+
onOpenChange={setOpen}
|
|
62
|
+
onSelect={(value) => {
|
|
63
|
+
setCurrent(() => value ?? undefined)
|
|
64
|
+
props.onSelect?.(value)
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function FruitSelect(props: Controls) {
|
|
71
|
+
return <Sample {...props} options={fruits} />
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
title: "UI/Select",
|
|
76
|
+
id: "ui-select",
|
|
77
|
+
component: Select,
|
|
78
|
+
render: FruitSelect,
|
|
79
|
+
tags: ["autodocs"],
|
|
80
|
+
parameters: {
|
|
81
|
+
frameHeight: "420px",
|
|
82
|
+
frameBackground: "#fff",
|
|
83
|
+
docs: {
|
|
84
|
+
description: {
|
|
85
|
+
component: docs,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
args: {
|
|
90
|
+
placeholder: "Pick a fruit",
|
|
91
|
+
invalid: false,
|
|
92
|
+
disabled: false,
|
|
93
|
+
numeric: false,
|
|
94
|
+
appearance: "inline",
|
|
95
|
+
surface: "base",
|
|
96
|
+
open: false,
|
|
97
|
+
placement: "bottom-end",
|
|
98
|
+
gutter: 4,
|
|
99
|
+
sameWidth: false,
|
|
100
|
+
closeOnSelection: true,
|
|
101
|
+
slide: true,
|
|
102
|
+
flip: true,
|
|
103
|
+
fitViewport: false,
|
|
104
|
+
} satisfies Controls,
|
|
105
|
+
argTypes: {
|
|
106
|
+
appearance: { options: ["inline", "small", "base", "large"] },
|
|
107
|
+
surface: { options: ["base", "layer-1", "invisible"] },
|
|
108
|
+
placement: {
|
|
109
|
+
options: [
|
|
110
|
+
"top",
|
|
111
|
+
"top-start",
|
|
112
|
+
"top-end",
|
|
113
|
+
"right",
|
|
114
|
+
"right-start",
|
|
115
|
+
"right-end",
|
|
116
|
+
"bottom",
|
|
117
|
+
"bottom-start",
|
|
118
|
+
"bottom-end",
|
|
119
|
+
"left",
|
|
120
|
+
"left-start",
|
|
121
|
+
"left-end",
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
gutter: { control: { type: "range", min: 0, max: 24, step: 1 } },
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const Playground = {}
|
|
129
|
+
|
|
130
|
+
export const Grouped = {
|
|
131
|
+
render: (args: Controls) => (
|
|
132
|
+
<Sample {...args} options={cities} value={(x) => x.city} label={(x) => x.city} groupBy={(x) => x.region} />
|
|
133
|
+
),
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const Invalid = { args: { invalid: true } }
|
|
137
|
+
|
|
138
|
+
export const Disabled = {
|
|
139
|
+
args: { disabled: true },
|
|
140
|
+
render: (args: Controls) => <Sample {...args} options={fruits} current="Cherry" />,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const Appearances = {
|
|
144
|
+
args: { appearance: "small", placeholder: "Small (24px)" },
|
|
145
|
+
render: (args: Controls) => (
|
|
146
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
147
|
+
<FruitSelect {...args} />
|
|
148
|
+
<Sample appearance="base" placeholder="Base (28px)" options={fruits} current="Banana" />
|
|
149
|
+
<Sample appearance="large" placeholder="Large (32px)" options={fruits} current="Cherry" />
|
|
150
|
+
<Sample placeholder="Inline (default)" options={fruits} current="Date" />
|
|
151
|
+
</div>
|
|
152
|
+
),
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const Surfaces = {
|
|
156
|
+
args: { appearance: "base", placeholder: "Base (default)" },
|
|
157
|
+
render: (args: Controls) => (
|
|
158
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
159
|
+
<FruitSelect {...args} />
|
|
160
|
+
<Sample appearance="base" surface="layer-1" placeholder="Layer 1" options={fruits} />
|
|
161
|
+
<Sample appearance="base" surface="invisible" placeholder="Invisible" options={fruits} />
|
|
162
|
+
<Sample appearance="base" surface="invisible" placeholder="Invisible, invalid" options={fruits} invalid />
|
|
163
|
+
<Sample appearance="base" surface="invisible" placeholder="Invisible, disabled" options={fruits} disabled />
|
|
164
|
+
</div>
|
|
165
|
+
),
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export const HighlightPreview = {
|
|
169
|
+
args: { appearance: "base", placeholder: "" },
|
|
170
|
+
render: (args: Controls) => {
|
|
171
|
+
const [shown, setShown] = createSignal<string | undefined>("Apple")
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<div style={{ display: "grid", gap: "12px", width: "280px" }}>
|
|
175
|
+
<Sample
|
|
176
|
+
{...args}
|
|
177
|
+
options={fruits}
|
|
178
|
+
current="Apple"
|
|
179
|
+
onHighlight={(value) => {
|
|
180
|
+
const previous = shown()
|
|
181
|
+
setShown(value)
|
|
182
|
+
|
|
183
|
+
return () => setShown(previous)
|
|
184
|
+
}}
|
|
185
|
+
onSelect={(value) => {
|
|
186
|
+
if (!value) return
|
|
187
|
+
setShown(value)
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
<output data-slot="select-preview">Showing {shown()}</output>
|
|
191
|
+
</div>
|
|
192
|
+
)
|
|
193
|
+
},
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export const WithField = {
|
|
197
|
+
parameters: { frameHeight: "500px" },
|
|
198
|
+
render: (args: Controls) => (
|
|
199
|
+
<div style={{ width: "280px" }}>
|
|
200
|
+
<Field>
|
|
201
|
+
<Field.Label tooltip="Choose one of the available options.">Fruit</Field.Label>
|
|
202
|
+
<Field.Prefix>Optional helper</Field.Prefix>
|
|
203
|
+
<FruitSelect {...args} />
|
|
204
|
+
<Field.Suffix>After selection</Field.Suffix>
|
|
205
|
+
</Field>
|
|
206
|
+
</div>
|
|
207
|
+
),
|
|
208
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createEffect, createSignal } from "solid-js"
|
|
2
|
+
import { Switch, type SwitchProps } from "./switch"
|
|
3
|
+
|
|
4
|
+
const docs = `### Overview
|
|
5
|
+
Toggle control for binary settings.
|
|
6
|
+
|
|
7
|
+
Use in settings panels or forms.
|
|
8
|
+
|
|
9
|
+
### API
|
|
10
|
+
- Uses Kobalte Switch props (\`checked\`, \`defaultChecked\`, \`onChange\`).
|
|
11
|
+
- Optional: \`appearance\`, \`hideLabel\`, and \`description\`.
|
|
12
|
+
- Children render as the label.
|
|
13
|
+
|
|
14
|
+
### Variants and states
|
|
15
|
+
- Standard and compact appearances; checked/unchecked and disabled states.
|
|
16
|
+
|
|
17
|
+
### Behavior
|
|
18
|
+
- Controlled or uncontrolled usage via Kobalte props.
|
|
19
|
+
|
|
20
|
+
### Accessibility
|
|
21
|
+
- TODO: confirm aria attributes from Kobalte.
|
|
22
|
+
|
|
23
|
+
### Theming/tokens
|
|
24
|
+
- Uses \`data-component="switch"\` and slot attributes.
|
|
25
|
+
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
function Sample(props: SwitchProps) {
|
|
29
|
+
const [checked, setChecked] = createSignal(false)
|
|
30
|
+
|
|
31
|
+
createEffect(() => setChecked(!!props.defaultChecked))
|
|
32
|
+
|
|
33
|
+
return <Switch {...props} checked={checked()} onChange={setChecked} />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: "UI/Switch",
|
|
38
|
+
id: "ui-switch",
|
|
39
|
+
component: Switch,
|
|
40
|
+
render: Sample,
|
|
41
|
+
tags: ["autodocs"],
|
|
42
|
+
parameters: {
|
|
43
|
+
docs: {
|
|
44
|
+
description: {
|
|
45
|
+
component: docs,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
args: {
|
|
50
|
+
defaultChecked: true,
|
|
51
|
+
children: "Enable notifications",
|
|
52
|
+
description: "",
|
|
53
|
+
appearance: "compact",
|
|
54
|
+
hideLabel: false,
|
|
55
|
+
disabled: false,
|
|
56
|
+
readOnly: false,
|
|
57
|
+
required: false,
|
|
58
|
+
validationState: "valid",
|
|
59
|
+
} satisfies SwitchProps,
|
|
60
|
+
argTypes: {
|
|
61
|
+
appearance: { options: ["standard", "compact"] },
|
|
62
|
+
validationState: { options: ["valid", "invalid"] },
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Basic = {}
|
|
67
|
+
|
|
68
|
+
export const Appearances = {
|
|
69
|
+
args: { appearance: "standard", children: "Standard" },
|
|
70
|
+
render: (args: SwitchProps) => (
|
|
71
|
+
<div style={{ display: "grid", gap: "12px" }}>
|
|
72
|
+
<Sample {...args} />
|
|
73
|
+
<Switch appearance="compact" defaultChecked>
|
|
74
|
+
Compact
|
|
75
|
+
</Switch>
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const States = {
|
|
81
|
+
args: { children: "Enabled" },
|
|
82
|
+
render: (args: SwitchProps) => (
|
|
83
|
+
<div style={{ display: "grid", gap: "12px" }}>
|
|
84
|
+
<Sample {...args} />
|
|
85
|
+
<Switch>Disabled</Switch>
|
|
86
|
+
<Switch disabled>Disabled switch</Switch>
|
|
87
|
+
</div>
|
|
88
|
+
),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const HiddenLabel = {
|
|
92
|
+
args: {
|
|
93
|
+
children: "Hidden label",
|
|
94
|
+
hideLabel: true,
|
|
95
|
+
defaultChecked: true,
|
|
96
|
+
},
|
|
97
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { createEffect, createSignal, splitProps } from "solid-js"
|
|
2
|
+
import { Field } from "@zyro-sec/ui/field"
|
|
3
|
+
import { Icon } from "@zyro-sec/ui/icon"
|
|
4
|
+
import { Keybind } from "@zyro-sec/ui/keybind"
|
|
5
|
+
import { TextInput, type TextInputProps } from "./text-input"
|
|
6
|
+
|
|
7
|
+
const docs = `### Overview
|
|
8
|
+
Compact single-line text field with neutral elevation, optional trailing copy action, and theme tokens.
|
|
9
|
+
|
|
10
|
+
### API
|
|
11
|
+
- Forwards native \`input\` props (\`value\`, \`defaultValue\`, \`placeholder\`, \`disabled\`, \`name\`, \`type\`, etc.).
|
|
12
|
+
- \`showCopyButton\`: Renders the trailing outline-copy control.
|
|
13
|
+
- \`copyLabel\`: Accessible name for the copy button (default: "Copy").
|
|
14
|
+
- \`onCopyClick\`: Handler for the copy button.
|
|
15
|
+
- \`invalid\`: Error outline and danger text color.
|
|
16
|
+
- \`appearance\`: \`"small"\` (24px), \`"base"\` (28px), or \`"large"\` (32px).
|
|
17
|
+
- \`surface\`: \`"base"\` (default) or \`"layer-1"\` for a flat fill; \`"invisible"\` is unfilled at rest, with hover fill and inset focus/error outlines.
|
|
18
|
+
|
|
19
|
+
### States
|
|
20
|
+
- **Hover**: neutral overlay on the raised surface.
|
|
21
|
+
- **Focus** (\`:focus-within\`): focus border, elevation removed.
|
|
22
|
+
- **Invalid**: danger border and text.
|
|
23
|
+
- **Disabled**: 50% opacity.
|
|
24
|
+
- Uses \`data-component="text-input-v2"\` with \`--v2-background-bg-base\`, \`--v2-elevation-input\`, \`--v2-text-text-faint\` (placeholder), and \`--v2-icon-icon-muted\` (copy icon).
|
|
25
|
+
|
|
26
|
+
### Field
|
|
27
|
+
Compose with \`Field\` for label, helper prefix/suffix, and tooltip — see the **Field** story.
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
type Controls = TextInputProps & {
|
|
31
|
+
defaultValue?: string
|
|
32
|
+
showLeadingIcon?: boolean
|
|
33
|
+
showTrailing?: boolean
|
|
34
|
+
onValue?: (value: string) => void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function Sample(props: Controls) {
|
|
38
|
+
const [local, input] = splitProps(props, ["defaultValue", "showLeadingIcon", "showTrailing", "onValue"])
|
|
39
|
+
|
|
40
|
+
const [value, setValue] = createSignal("")
|
|
41
|
+
|
|
42
|
+
createEffect(() => setValue(local.defaultValue ?? ""))
|
|
43
|
+
createEffect(() => local.onValue?.(value()))
|
|
44
|
+
|
|
45
|
+
let field!: HTMLInputElement
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<TextInput
|
|
49
|
+
{...input}
|
|
50
|
+
ref={field}
|
|
51
|
+
copyLabel={props.copyLabel || undefined}
|
|
52
|
+
value={value()}
|
|
53
|
+
onInput={(event) => setValue(event.currentTarget.value)}
|
|
54
|
+
leadingIcon={local.showLeadingIcon && <Icon name="magnifying-glass" />}
|
|
55
|
+
trailing={local.showTrailing && <Keybind keys={["↵"]} variant="neutral" />}
|
|
56
|
+
onClearClick={() => setValue("")}
|
|
57
|
+
onCopyClick={() => {
|
|
58
|
+
const copySelection = () => {
|
|
59
|
+
field.select()
|
|
60
|
+
document.execCommand("copy")
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!navigator.clipboard) return copySelection()
|
|
64
|
+
void navigator.clipboard.writeText(value()).catch(copySelection)
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
title: "UI/TextInput",
|
|
72
|
+
id: "ui-text-input",
|
|
73
|
+
component: TextInput,
|
|
74
|
+
render: Sample,
|
|
75
|
+
tags: ["autodocs"],
|
|
76
|
+
parameters: {
|
|
77
|
+
frameHeight: "300px",
|
|
78
|
+
frameBackground: "#fff",
|
|
79
|
+
docs: {
|
|
80
|
+
description: {
|
|
81
|
+
component: docs,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
args: {
|
|
86
|
+
placeholder: "Placeholder",
|
|
87
|
+
defaultValue: "",
|
|
88
|
+
showCopyButton: false,
|
|
89
|
+
copyLabel: "",
|
|
90
|
+
showClearButton: false,
|
|
91
|
+
showLeadingIcon: false,
|
|
92
|
+
showTrailing: false,
|
|
93
|
+
numeric: false,
|
|
94
|
+
readOnly: false,
|
|
95
|
+
disabled: false,
|
|
96
|
+
invalid: false,
|
|
97
|
+
appearance: "base",
|
|
98
|
+
surface: "base",
|
|
99
|
+
type: "text",
|
|
100
|
+
} satisfies Controls,
|
|
101
|
+
argTypes: {
|
|
102
|
+
type: { options: ["text", "search", "email", "password", "url", "tel", "number"] },
|
|
103
|
+
surface: {
|
|
104
|
+
control: "select",
|
|
105
|
+
options: ["base", "layer-1", "invisible"],
|
|
106
|
+
},
|
|
107
|
+
appearance: {
|
|
108
|
+
control: "select",
|
|
109
|
+
options: ["small", "base", "large"],
|
|
110
|
+
},
|
|
111
|
+
showCopyButton: {
|
|
112
|
+
control: "boolean",
|
|
113
|
+
},
|
|
114
|
+
disabled: {
|
|
115
|
+
control: "boolean",
|
|
116
|
+
},
|
|
117
|
+
invalid: {
|
|
118
|
+
control: "boolean",
|
|
119
|
+
},
|
|
120
|
+
placeholder: {
|
|
121
|
+
control: "text",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const Playground = {}
|
|
127
|
+
|
|
128
|
+
export const Surfaces = {
|
|
129
|
+
args: { placeholder: "Base (default)" },
|
|
130
|
+
render: (args: Controls) => (
|
|
131
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
132
|
+
<Sample {...args} />
|
|
133
|
+
<TextInput surface="layer-1" placeholder="Layer 1" />
|
|
134
|
+
<TextInput surface="invisible" placeholder="Invisible" />
|
|
135
|
+
<TextInput surface="invisible" placeholder="Invisible, invalid" invalid />
|
|
136
|
+
<TextInput surface="invisible" placeholder="Invisible, disabled" disabled />
|
|
137
|
+
</div>
|
|
138
|
+
),
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const WithCopyButton = {
|
|
142
|
+
args: {
|
|
143
|
+
placeholder: "api.example.com/v1",
|
|
144
|
+
defaultValue: "https://api.example.com/v1",
|
|
145
|
+
showCopyButton: true,
|
|
146
|
+
copyLabel: "Copy URL",
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const Controlled = {
|
|
151
|
+
args: { defaultValue: "Controlled value", placeholder: "Type here…" },
|
|
152
|
+
render: (args: Controls) => {
|
|
153
|
+
const [value, setValue] = createSignal("Controlled value")
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<div style={{ display: "grid", gap: "12px" }}>
|
|
157
|
+
<Sample {...args} onValue={setValue} />
|
|
158
|
+
<div
|
|
159
|
+
style={{
|
|
160
|
+
"font-family": "var(--v2-font-family-sans)",
|
|
161
|
+
"font-size": "12px",
|
|
162
|
+
color: "var(--text-text-faint)",
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
Value: {value()}
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
)
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const Appearances = {
|
|
173
|
+
args: { appearance: "small", placeholder: "Small (24px)" },
|
|
174
|
+
render: (args: Controls) => (
|
|
175
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
176
|
+
<Sample {...args} />
|
|
177
|
+
<TextInput appearance="base" placeholder="Base (28px)" value="Base" />
|
|
178
|
+
<TextInput appearance="large" placeholder="Large (32px)" value="Large" />
|
|
179
|
+
<Sample appearance="large" placeholder="Large with copy" defaultValue="copy-me" showCopyButton />
|
|
180
|
+
<Sample appearance="small" placeholder="Small with clear" showClearButton />
|
|
181
|
+
<Sample appearance="base" placeholder="Base with clear" showClearButton />
|
|
182
|
+
<Sample appearance="large" placeholder="Large with clear" showClearButton />
|
|
183
|
+
</div>
|
|
184
|
+
),
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const WithField = {
|
|
188
|
+
parameters: { frameHeight: "500px" },
|
|
189
|
+
args: { placeholder: "Text", showCopyButton: true },
|
|
190
|
+
render: (args: Controls) => (
|
|
191
|
+
<div style={{ display: "grid", gap: "24px", width: "280px" }}>
|
|
192
|
+
<Field invalid={args.invalid}>
|
|
193
|
+
<Field.Label tooltip="Additional context">Label</Field.Label>
|
|
194
|
+
<Field.Prefix>Prefix</Field.Prefix>
|
|
195
|
+
<Sample {...args} />
|
|
196
|
+
<Field.Suffix>Suffix</Field.Suffix>
|
|
197
|
+
</Field>
|
|
198
|
+
<Field invalid>
|
|
199
|
+
<Field.Label>Label</Field.Label>
|
|
200
|
+
<Field.Prefix>Prefix</Field.Prefix>
|
|
201
|
+
<Sample placeholder="Text" defaultValue="Invalid" showCopyButton />
|
|
202
|
+
<Field.Suffix>Suffix</Field.Suffix>
|
|
203
|
+
</Field>
|
|
204
|
+
</div>
|
|
205
|
+
),
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export const States = {
|
|
209
|
+
args: { placeholder: "Default" },
|
|
210
|
+
render: (args: Controls) => (
|
|
211
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
212
|
+
<Sample {...args} />
|
|
213
|
+
<TextInput placeholder="With value" value="Hello world" />
|
|
214
|
+
<Sample placeholder="With copy" defaultValue="copy-me" showCopyButton />
|
|
215
|
+
<Sample placeholder="Invalid" defaultValue="Invalid value" invalid showCopyButton />
|
|
216
|
+
<TextInput placeholder="Disabled" disabled />
|
|
217
|
+
<TextInput placeholder="Disabled with value" value="Read only" disabled showCopyButton />
|
|
218
|
+
</div>
|
|
219
|
+
),
|
|
220
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { createEffect, createSignal } from "solid-js"
|
|
2
|
+
import { Field } from "@zyro-sec/ui/field"
|
|
3
|
+
import { Textarea, type TextareaProps } from "./textarea"
|
|
4
|
+
|
|
5
|
+
const docs = `### Overview
|
|
6
|
+
Multiline text field with the same neutral elevation, states, and tokens as TextInput v2.
|
|
7
|
+
|
|
8
|
+
### API
|
|
9
|
+
- Forwards native \`textarea\` props (\`value\`, \`defaultValue\`, \`placeholder\`, \`disabled\`, \`name\`, \`rows\`, etc.).
|
|
10
|
+
- \`invalid\`: Error outline and danger text color.
|
|
11
|
+
- \`surface\`: \`"base"\` (default) or \`"layer-1"\` for a flat fill.
|
|
12
|
+
|
|
13
|
+
### States
|
|
14
|
+
- **Hover**: neutral overlay on the raised surface.
|
|
15
|
+
- **Focus** (\`:focus-within\`): focus outline, elevation removed.
|
|
16
|
+
- **Invalid**: danger outline and text.
|
|
17
|
+
- **Disabled**: 50% opacity.
|
|
18
|
+
|
|
19
|
+
### Field
|
|
20
|
+
Compose with \`Field\` for label, helper prefix/suffix, and tooltip — see the **Field** story.
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: "UI/Textarea",
|
|
25
|
+
id: "ui-textarea",
|
|
26
|
+
component: Textarea,
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
parameters: {
|
|
29
|
+
frameHeight: "400px",
|
|
30
|
+
frameBackground: "#fff",
|
|
31
|
+
docs: {
|
|
32
|
+
description: {
|
|
33
|
+
component: docs,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
args: {
|
|
38
|
+
placeholder: "Placeholder",
|
|
39
|
+
value: "",
|
|
40
|
+
readOnly: false,
|
|
41
|
+
disabled: false,
|
|
42
|
+
invalid: false,
|
|
43
|
+
rows: 3,
|
|
44
|
+
surface: "base",
|
|
45
|
+
} satisfies TextareaProps,
|
|
46
|
+
argTypes: {
|
|
47
|
+
surface: {
|
|
48
|
+
control: "select",
|
|
49
|
+
options: ["base", "layer-1"],
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
control: "boolean",
|
|
53
|
+
},
|
|
54
|
+
invalid: {
|
|
55
|
+
control: "boolean",
|
|
56
|
+
},
|
|
57
|
+
placeholder: {
|
|
58
|
+
control: "text",
|
|
59
|
+
},
|
|
60
|
+
rows: {
|
|
61
|
+
control: { type: "number", min: 1, max: 12 },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Playground = {}
|
|
67
|
+
|
|
68
|
+
export const Surfaces = {
|
|
69
|
+
parameters: { frameHeight: "700px" },
|
|
70
|
+
args: { placeholder: "Base (default)" },
|
|
71
|
+
render: (args: TextareaProps) => (
|
|
72
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
73
|
+
<Textarea {...args} />
|
|
74
|
+
<Textarea surface="layer-1" placeholder="Layer 1" />
|
|
75
|
+
<Textarea surface="layer-1" placeholder="Layer 1, invalid" invalid />
|
|
76
|
+
<Textarea surface="layer-1" placeholder="Layer 1, disabled" disabled />
|
|
77
|
+
</div>
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const Controlled = {
|
|
82
|
+
args: { value: "Controlled value", placeholder: "Type here…" },
|
|
83
|
+
render: (args: TextareaProps) => {
|
|
84
|
+
const [value, setValue] = createSignal("")
|
|
85
|
+
|
|
86
|
+
createEffect(() => setValue(String(args.value ?? "")))
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div style={{ display: "grid", gap: "12px", width: "280px" }}>
|
|
90
|
+
<Textarea {...args} value={value()} onInput={(e) => setValue(e.currentTarget.value)} />
|
|
91
|
+
<div
|
|
92
|
+
style={{
|
|
93
|
+
"font-family": "var(--v2-font-family-sans)",
|
|
94
|
+
"font-size": "12px",
|
|
95
|
+
color: "var(--text-text-faint)",
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
Value: {value()}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const WithField = {
|
|
106
|
+
parameters: { frameHeight: "500px" },
|
|
107
|
+
args: { placeholder: "Text" },
|
|
108
|
+
render: (args: TextareaProps) => (
|
|
109
|
+
<div style={{ display: "grid", gap: "24px", width: "280px" }}>
|
|
110
|
+
<Field invalid={args.invalid}>
|
|
111
|
+
<Field.Label tooltip="Additional context">Label</Field.Label>
|
|
112
|
+
<Field.Prefix>Prefix</Field.Prefix>
|
|
113
|
+
<Textarea {...args} />
|
|
114
|
+
<Field.Suffix>Suffix</Field.Suffix>
|
|
115
|
+
</Field>
|
|
116
|
+
<Field invalid>
|
|
117
|
+
<Field.Label>Label</Field.Label>
|
|
118
|
+
<Field.Prefix>Prefix</Field.Prefix>
|
|
119
|
+
<Textarea placeholder="Text" value="Invalid value" />
|
|
120
|
+
<Field.Suffix>Suffix</Field.Suffix>
|
|
121
|
+
</Field>
|
|
122
|
+
</div>
|
|
123
|
+
),
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const States = {
|
|
127
|
+
args: { placeholder: "Default" },
|
|
128
|
+
render: (args: TextareaProps) => (
|
|
129
|
+
<div style={{ display: "grid", gap: "20px", width: "280px" }}>
|
|
130
|
+
<Textarea {...args} />
|
|
131
|
+
<Textarea placeholder="With value" value="Hello world" />
|
|
132
|
+
<Textarea placeholder="Invalid" value="Invalid value" invalid />
|
|
133
|
+
<Textarea placeholder="Disabled" disabled />
|
|
134
|
+
<Textarea placeholder="Disabled with value" value="Read only" disabled />
|
|
135
|
+
</div>
|
|
136
|
+
),
|
|
137
|
+
}
|