@zyro-sec/ui 1.0.0 → 1.0.2
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 -40
- 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,221 @@
|
|
|
1
|
+
import { createSignal } from "solid-js"
|
|
2
|
+
import { List } from "./list"
|
|
3
|
+
|
|
4
|
+
const docs = `### Overview
|
|
5
|
+
Filterable list with keyboard navigation and optional search input.
|
|
6
|
+
|
|
7
|
+
Use within panels or popovers where keyboard navigation is expected.
|
|
8
|
+
|
|
9
|
+
### API
|
|
10
|
+
- Required: \`items\` and \`key\`.
|
|
11
|
+
- Required: \`children\` render function for items.
|
|
12
|
+
- Optional: \`search\`, \`filterKeys\`, \`groupBy\`, \`onSelect\`, \`onKeyEvent\`.
|
|
13
|
+
|
|
14
|
+
### Variants and states
|
|
15
|
+
- Optional search bar and group headers.
|
|
16
|
+
|
|
17
|
+
### Behavior
|
|
18
|
+
- Uses fuzzy search when \`search\` is enabled.
|
|
19
|
+
- Keyboard navigation via arrow keys; Enter selects.
|
|
20
|
+
|
|
21
|
+
### Accessibility
|
|
22
|
+
- TODO: confirm ARIA roles for list items and search input.
|
|
23
|
+
|
|
24
|
+
### Theming/tokens
|
|
25
|
+
- Uses \`data-component="list"\` and data slots for structure.
|
|
26
|
+
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
type ListArgs = { search: boolean }
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: "UI/List",
|
|
33
|
+
id: "components-list",
|
|
34
|
+
component: List,
|
|
35
|
+
args: { search: true },
|
|
36
|
+
tags: ["autodocs"],
|
|
37
|
+
parameters: {
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
component: docs,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function NumberList(props: ListArgs & { current?: string; query?: string }) {
|
|
47
|
+
const [selected, setSelected] = createSignal(props.current)
|
|
48
|
+
|
|
49
|
+
const [filter, setFilter] = createSignal(props.query ?? "")
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<List
|
|
53
|
+
items={["One", "Two", "Three", "Four"]}
|
|
54
|
+
key={(item) => item}
|
|
55
|
+
search={props.search}
|
|
56
|
+
current={selected()}
|
|
57
|
+
onSelect={setSelected}
|
|
58
|
+
filter={filter()}
|
|
59
|
+
onFilter={setFilter}
|
|
60
|
+
>
|
|
61
|
+
{(item) => item}
|
|
62
|
+
</List>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Basic = { render: NumberList }
|
|
67
|
+
|
|
68
|
+
export const Selected = { render: (props: ListArgs) => <NumberList {...props} current="Two" /> }
|
|
69
|
+
|
|
70
|
+
export const NoMatches = { render: (props: ListArgs) => <NumberList {...props} query="Five" /> }
|
|
71
|
+
|
|
72
|
+
export const Loading = {
|
|
73
|
+
render: (props: ListArgs) => {
|
|
74
|
+
const load = Promise.withResolvers<string[]>()
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div>
|
|
78
|
+
<List items={() => load.promise} key={(item) => item} search={props.search}>
|
|
79
|
+
{(item) => item}
|
|
80
|
+
</List>
|
|
81
|
+
<button type="button" onClick={() => load.resolve(["One", "Two"])}>
|
|
82
|
+
Finish loading
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const Grouped = {
|
|
90
|
+
render: (props: ListArgs) => {
|
|
91
|
+
const items = [
|
|
92
|
+
{ id: "a1", title: "Alpha", group: "Group A" },
|
|
93
|
+
{ id: "a2", title: "Bravo", group: "Group A" },
|
|
94
|
+
{ id: "b1", title: "Delta", group: "Group B" },
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<List items={items} key={(item) => item.id} groupBy={(item) => item.group} search={props.search}>
|
|
99
|
+
{(item) => item.title}
|
|
100
|
+
</List>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const Empty = {
|
|
106
|
+
render: (props: ListArgs) => (
|
|
107
|
+
<List items={[]} key={(item: string) => item} search={props.search}>
|
|
108
|
+
{(item) => item}
|
|
109
|
+
</List>
|
|
110
|
+
),
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const LoadFailed = {
|
|
114
|
+
render: (props: ListArgs) => (
|
|
115
|
+
<List items={() => Promise.reject(new Error("offline"))} key={(item: string) => item} search={props.search}>
|
|
116
|
+
{(item: string) => item}
|
|
117
|
+
</List>
|
|
118
|
+
),
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const WithAdd = {
|
|
122
|
+
render: (props: ListArgs) => (
|
|
123
|
+
<List
|
|
124
|
+
items={["One", "Two"]}
|
|
125
|
+
key={(item) => item}
|
|
126
|
+
search={props.search}
|
|
127
|
+
add={{
|
|
128
|
+
render: () => (
|
|
129
|
+
<button type="button" data-slot="list-item">
|
|
130
|
+
Add item
|
|
131
|
+
</button>
|
|
132
|
+
),
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
{(item) => item}
|
|
136
|
+
</List>
|
|
137
|
+
),
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const Divider = {
|
|
141
|
+
args: { search: false },
|
|
142
|
+
render: (props: ListArgs) => (
|
|
143
|
+
<List items={["One", "Two", "Three"]} key={(item) => item} divider search={props.search}>
|
|
144
|
+
{(item) => item}
|
|
145
|
+
</List>
|
|
146
|
+
),
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const ActiveIcon = {
|
|
150
|
+
args: { search: false },
|
|
151
|
+
render: (props: ListArgs) => (
|
|
152
|
+
<List items={["Alpha", "Beta", "Gamma"]} key={(item) => item} activeIcon="chevron-right" search={props.search}>
|
|
153
|
+
{(item) => item}
|
|
154
|
+
</List>
|
|
155
|
+
),
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const NoSearch = {
|
|
159
|
+
args: { search: false },
|
|
160
|
+
render: (props: ListArgs) => (
|
|
161
|
+
<List items={["One", "Two", "Three"]} key={(item) => item} search={props.search}>
|
|
162
|
+
{(item) => item}
|
|
163
|
+
</List>
|
|
164
|
+
),
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const SearchOptions = {
|
|
168
|
+
render: (props: ListArgs) => (
|
|
169
|
+
<List
|
|
170
|
+
items={["Apple", "Banana", "Cherry"]}
|
|
171
|
+
key={(item) => item}
|
|
172
|
+
search={
|
|
173
|
+
props.search && {
|
|
174
|
+
placeholder: "Filter...",
|
|
175
|
+
hideIcon: true,
|
|
176
|
+
action: <button type="button">Action</button>,
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
>
|
|
180
|
+
{(item) => item}
|
|
181
|
+
</List>
|
|
182
|
+
),
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const ItemWrapper = {
|
|
186
|
+
args: { search: false },
|
|
187
|
+
render: (props: ListArgs) => (
|
|
188
|
+
<List
|
|
189
|
+
items={["One", "Two", "Three"]}
|
|
190
|
+
key={(item) => item}
|
|
191
|
+
search={props.search}
|
|
192
|
+
itemWrapper={(_item, node) => (
|
|
193
|
+
<div style={{ border: "1px solid var(--border-weak)", "border-radius": "6px", margin: "4px 0" }}>{node}</div>
|
|
194
|
+
)}
|
|
195
|
+
>
|
|
196
|
+
{(item) => item}
|
|
197
|
+
</List>
|
|
198
|
+
),
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const GroupHeader = {
|
|
202
|
+
args: { search: false },
|
|
203
|
+
render: (props: ListArgs) => {
|
|
204
|
+
const items = [
|
|
205
|
+
{ id: "a1", title: "Alpha", group: "Group A" },
|
|
206
|
+
{ id: "b1", title: "Beta", group: "Group B" },
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<List
|
|
211
|
+
items={items}
|
|
212
|
+
key={(item) => item.id}
|
|
213
|
+
groupBy={(item) => item.group}
|
|
214
|
+
groupHeader={(group) => <strong>{group.category}</strong>}
|
|
215
|
+
search={props.search}
|
|
216
|
+
>
|
|
217
|
+
{(item) => item.title}
|
|
218
|
+
</List>
|
|
219
|
+
)
|
|
220
|
+
},
|
|
221
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Logo, Mark, Splash } from "./logo"
|
|
2
|
+
|
|
3
|
+
const docs = `### Overview
|
|
4
|
+
OpenCode logo assets: mark, splash, and wordmark.
|
|
5
|
+
|
|
6
|
+
Use Mark for compact spaces, Logo for headers, Splash for hero sections.
|
|
7
|
+
|
|
8
|
+
### API
|
|
9
|
+
- \`Mark\`, \`Splash\`, and \`Logo\` accept a CSS class for sizing. \`Splash\` also accepts a ref.
|
|
10
|
+
|
|
11
|
+
### Variants and states
|
|
12
|
+
- Multiple logo variants for different contexts.
|
|
13
|
+
|
|
14
|
+
### Behavior
|
|
15
|
+
- Pure SVG rendering.
|
|
16
|
+
|
|
17
|
+
### Accessibility
|
|
18
|
+
- Provide title/aria-label when logos convey meaning.
|
|
19
|
+
|
|
20
|
+
### Theming/tokens
|
|
21
|
+
- Uses theme color tokens via CSS variables.
|
|
22
|
+
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
title: "UI/Logo",
|
|
27
|
+
id: "components-logo",
|
|
28
|
+
component: Logo,
|
|
29
|
+
tags: ["autodocs"],
|
|
30
|
+
parameters: {
|
|
31
|
+
docs: {
|
|
32
|
+
description: {
|
|
33
|
+
component: docs,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Basic = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div style={{ display: "grid", gap: "16px", "align-items": "start" }}>
|
|
42
|
+
<div>
|
|
43
|
+
<div style={{ color: "var(--text-weak)", "font-size": "12px" }}>Mark</div>
|
|
44
|
+
<Mark />
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
<div style={{ color: "var(--text-weak)", "font-size": "12px" }}>Splash</div>
|
|
48
|
+
<Splash class="h-[100px] w-20" />
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<div style={{ color: "var(--text-weak)", "font-size": "12px" }}>Logo</div>
|
|
52
|
+
<Logo class="w-[200px]" />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const CompactMark = { render: () => <Mark /> }
|
|
59
|
+
|
|
60
|
+
export const SplashMark = { render: () => <Splash class="h-[100px] w-20" /> }
|
|
61
|
+
|
|
62
|
+
export const Wordmark = { render: () => <Logo class="w-[200px]" /> }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createSignal, For } from "solid-js"
|
|
2
|
+
import { Button } from "@zyro-sec/ui/button"
|
|
3
|
+
import { MenuScroll } from "./menu-scroll"
|
|
4
|
+
|
|
5
|
+
const branches = [
|
|
6
|
+
"main",
|
|
7
|
+
"dev",
|
|
8
|
+
"release",
|
|
9
|
+
"docs",
|
|
10
|
+
"file-search",
|
|
11
|
+
"settings",
|
|
12
|
+
"theme-picker",
|
|
13
|
+
"history",
|
|
14
|
+
"keyboard",
|
|
15
|
+
"mobile",
|
|
16
|
+
"accessibility",
|
|
17
|
+
"preview",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
const args = { rows: branches.length, height: 144, rtl: false }
|
|
21
|
+
|
|
22
|
+
function Preview(props: typeof args) {
|
|
23
|
+
const [branch, setBranch] = createSignal("main")
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div class="grid w-64 max-w-full gap-2 text-sm">
|
|
27
|
+
<div class="font-medium">Switch branch</div>
|
|
28
|
+
<div dir={props.rtl ? "rtl" : undefined}>
|
|
29
|
+
<MenuScroll
|
|
30
|
+
role="group"
|
|
31
|
+
aria-label="Branches"
|
|
32
|
+
style={{ "max-height": `${props.height}px` }}
|
|
33
|
+
class="rounded-md border border-v2-border-border-base bg-v2-background-bg-layer-01"
|
|
34
|
+
viewportClass="p-1"
|
|
35
|
+
>
|
|
36
|
+
<For each={branches.slice(0, props.rows)}>
|
|
37
|
+
{(name) => (
|
|
38
|
+
<Button
|
|
39
|
+
variant="ghost"
|
|
40
|
+
class="w-full !justify-start"
|
|
41
|
+
aria-pressed={branch() === name}
|
|
42
|
+
onClick={() => setBranch(name)}
|
|
43
|
+
>
|
|
44
|
+
<bdi>{name}</bdi>
|
|
45
|
+
</Button>
|
|
46
|
+
)}
|
|
47
|
+
</For>
|
|
48
|
+
</MenuScroll>
|
|
49
|
+
</div>
|
|
50
|
+
<output class="text-xs text-v2-text-text-muted">
|
|
51
|
+
Current branch: <bdi>{branch()}</bdi>
|
|
52
|
+
</output>
|
|
53
|
+
<p class="text-xs text-v2-text-text-muted">Tab through branches or swipe the list on a touch device.</p>
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
title: "UI/MenuScroll",
|
|
60
|
+
id: "ui-menu-scroll",
|
|
61
|
+
component: Preview,
|
|
62
|
+
args,
|
|
63
|
+
argTypes: {
|
|
64
|
+
rows: { control: { type: "range", min: 1, max: branches.length, step: 1 } },
|
|
65
|
+
height: { control: { type: "range", min: 80, max: 320, step: 8 } },
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Overflow = {}
|
|
70
|
+
|
|
71
|
+
export const Fits = { args: { rows: 3 } }
|
|
72
|
+
|
|
73
|
+
export const RightToLeft = { args: { rtl: true } }
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test"
|
|
2
|
+
import {
|
|
3
|
+
createPopoverState,
|
|
4
|
+
EMPTY_POPOVER_STACK,
|
|
5
|
+
selectPopoverOpen,
|
|
6
|
+
selectPreventCloseAutoFocus,
|
|
7
|
+
transitionPopover,
|
|
8
|
+
transitionPopoverStack,
|
|
9
|
+
type PopoverEvent,
|
|
10
|
+
type PopoverStackEvent,
|
|
11
|
+
type PopoverState,
|
|
12
|
+
type PopoverStackState,
|
|
13
|
+
type PopoverTransition,
|
|
14
|
+
} from "./popover-machine"
|
|
15
|
+
|
|
16
|
+
function run(state: PopoverState, ...events: PopoverEvent[]) {
|
|
17
|
+
return events.reduce<PopoverTransition>(
|
|
18
|
+
(result, event) => {
|
|
19
|
+
const next = transitionPopover(result.state, event)
|
|
20
|
+
|
|
21
|
+
return { state: next.state, effects: [...result.effects, ...next.effects] }
|
|
22
|
+
},
|
|
23
|
+
{ state, effects: [] },
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function stackOf(...events: PopoverStackEvent[]) {
|
|
28
|
+
return events.reduce<PopoverStackState>(
|
|
29
|
+
(state, event) => transitionPopoverStack(state, event).state,
|
|
30
|
+
EMPTY_POPOVER_STACK,
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("popover machine", () => {
|
|
35
|
+
test("a refused controlled close leaves no outside reason for the next close to read", () => {
|
|
36
|
+
// The owner keeps `open={true}`: the driver reads the prop again right after `onOpenChange(false)`.
|
|
37
|
+
const refused = run(
|
|
38
|
+
createPopoverState(true, undefined),
|
|
39
|
+
{ type: "dismiss", reason: "outside" },
|
|
40
|
+
{
|
|
41
|
+
type: "props.synced",
|
|
42
|
+
open: true,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
expect(refused.effects).toEqual([{ type: "notify.open", open: false }])
|
|
47
|
+
expect(selectPopoverOpen(refused.state)).toBe(true)
|
|
48
|
+
|
|
49
|
+
// Later the close button closes it, and the owner accepts.
|
|
50
|
+
const closed = run(refused.state, { type: "kobalte.changed", open: false }, { type: "props.synced", open: false })
|
|
51
|
+
|
|
52
|
+
expect(closed.state).toEqual({ status: "closed", mode: "controlled", closeReason: "control" })
|
|
53
|
+
expect(selectPreventCloseAutoFocus(closed.state)).toBe(false)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test("an accepted outside close keeps focus where the press moved it, once", () => {
|
|
57
|
+
const closed = run(
|
|
58
|
+
createPopoverState(true, undefined),
|
|
59
|
+
{ type: "dismiss", reason: "outside" },
|
|
60
|
+
{
|
|
61
|
+
type: "props.synced",
|
|
62
|
+
open: false,
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
expect(selectPreventCloseAutoFocus(closed.state)).toBe(true)
|
|
67
|
+
|
|
68
|
+
const handled = transitionPopover(closed.state, { type: "close-auto-focus.handled" })
|
|
69
|
+
|
|
70
|
+
expect(selectPreventCloseAutoFocus(handled.state)).toBe(false)
|
|
71
|
+
expect(transitionPopover(handled.state, { type: "close-auto-focus.handled" }).state).toBe(handled.state)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test("Kobalte echoing a close the owner already heard does not notify twice", () => {
|
|
75
|
+
const echoed = run(
|
|
76
|
+
createPopoverState(true, undefined),
|
|
77
|
+
{ type: "dismiss", reason: "escape" },
|
|
78
|
+
{ type: "kobalte.changed", open: false },
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
expect(echoed.effects).toEqual([{ type: "notify.open", open: false }])
|
|
82
|
+
|
|
83
|
+
const closed = transitionPopover(echoed.state, { type: "props.synced", open: false })
|
|
84
|
+
|
|
85
|
+
expect(closed.state).toEqual({ status: "closed", mode: "controlled", closeReason: "escape" })
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test("an uncontrolled popover opens and closes itself and tells the owner", () => {
|
|
89
|
+
const opened = run(createPopoverState(undefined, false), { type: "kobalte.changed", open: true })
|
|
90
|
+
|
|
91
|
+
expect(opened.state).toEqual({ status: "open", mode: "uncontrolled" })
|
|
92
|
+
expect(opened.effects).toEqual([{ type: "notify.open", open: true }])
|
|
93
|
+
|
|
94
|
+
const closed = run(opened.state, { type: "dismiss", reason: "outside" }, { type: "props.synced", open: undefined })
|
|
95
|
+
|
|
96
|
+
expect(closed.state).toEqual({ status: "closed", mode: "uncontrolled", closeReason: "outside" })
|
|
97
|
+
expect(closed.effects).toEqual([{ type: "notify.open", open: false }])
|
|
98
|
+
expect(transitionPopover(closed.state, { type: "dismiss", reason: "escape" }).state).toBe(closed.state)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
test("a controlled popover asks to open and waits for the prop", () => {
|
|
102
|
+
const state = createPopoverState(false, undefined)
|
|
103
|
+
const asked = transitionPopover(state, { type: "kobalte.changed", open: true })
|
|
104
|
+
|
|
105
|
+
expect(asked.state).toBe(state)
|
|
106
|
+
expect(asked.effects).toEqual([{ type: "notify.open", open: true }])
|
|
107
|
+
expect(selectPopoverOpen(transitionPopover(state, { type: "props.synced", open: true }).state)).toBe(true)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
test("a disposed popover ignores later events", () => {
|
|
111
|
+
const disposed = transitionPopover(createPopoverState(undefined, true), { type: "disposed" }).state
|
|
112
|
+
|
|
113
|
+
expect(transitionPopover(disposed, { type: "dismiss", reason: "escape" })).toEqual({ state: disposed, effects: [] })
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
describe("popover stack", () => {
|
|
118
|
+
const nested = stackOf({ type: "layer.opened", id: 1, parentId: null }, { type: "layer.opened", id: 2, parentId: 1 })
|
|
119
|
+
|
|
120
|
+
test("Escape dismisses only the newest popover", () => {
|
|
121
|
+
expect(transitionPopoverStack(nested, { type: "escape.pressed" }).effects).toEqual([
|
|
122
|
+
{ type: "dismiss.layer", id: 2, reason: "escape" },
|
|
123
|
+
])
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
test("a press inside a portaled child keeps its parent open", () => {
|
|
127
|
+
const inside = (...ids: number[]) =>
|
|
128
|
+
transitionPopoverStack(nested, { type: "outside.interacted", insideIds: new Set(ids) }).effects
|
|
129
|
+
|
|
130
|
+
expect(inside(2)).toEqual([])
|
|
131
|
+
expect(inside(1)).toEqual([{ type: "dismiss.layer", id: 2, reason: "outside" }])
|
|
132
|
+
expect(inside()).toEqual([
|
|
133
|
+
{ type: "dismiss.layer", id: 2, reason: "outside" },
|
|
134
|
+
{ type: "dismiss.layer", id: 1, reason: "outside" },
|
|
135
|
+
])
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test("closing every layer empties the stack, and repeats keep the state", () => {
|
|
139
|
+
expect(transitionPopoverStack(nested, { type: "layer.opened", id: 2, parentId: 1 }).state).toBe(nested)
|
|
140
|
+
|
|
141
|
+
const closed = stackOf(
|
|
142
|
+
{ type: "layer.opened", id: 1, parentId: null },
|
|
143
|
+
{ type: "layer.closed", id: 1 },
|
|
144
|
+
{ type: "layer.closed", id: 1 },
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
expect(closed).toBe(EMPTY_POPOVER_STACK)
|
|
148
|
+
expect(transitionPopoverStack(EMPTY_POPOVER_STACK, { type: "escape.pressed" }).effects).toEqual([])
|
|
149
|
+
})
|
|
150
|
+
})
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createEffect, createSignal } from "solid-js"
|
|
2
|
+
import { Popover, type PopoverProps } from "./popover"
|
|
3
|
+
|
|
4
|
+
const docs = `### Overview
|
|
5
|
+
Composable popover with optional title, description, and close button.
|
|
6
|
+
|
|
7
|
+
Use for small contextual details; avoid long forms.
|
|
8
|
+
|
|
9
|
+
### API
|
|
10
|
+
- \`trigger\` and \`children\` define the anchor and content.
|
|
11
|
+
- Optional: \`title\`, \`description\`, \`portal\`, \`open\`, \`defaultOpen\`.
|
|
12
|
+
|
|
13
|
+
### Variants and states
|
|
14
|
+
- Supports controlled and uncontrolled open state.
|
|
15
|
+
|
|
16
|
+
### Behavior
|
|
17
|
+
- Closes on outside click or Escape by default.
|
|
18
|
+
|
|
19
|
+
### Accessibility
|
|
20
|
+
- TODO: confirm focus management from Kobalte.
|
|
21
|
+
|
|
22
|
+
### Theming/tokens
|
|
23
|
+
- Uses \`data-component="popover-content"\` and related slots.
|
|
24
|
+
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: "UI/Popover",
|
|
29
|
+
id: "components-popover",
|
|
30
|
+
component: Popover,
|
|
31
|
+
args: {
|
|
32
|
+
trigger: "Open popover",
|
|
33
|
+
title: "Popover",
|
|
34
|
+
description: "Optional description",
|
|
35
|
+
defaultOpen: true,
|
|
36
|
+
portal: true,
|
|
37
|
+
children: "Popover content",
|
|
38
|
+
},
|
|
39
|
+
render: (props: PopoverProps) => {
|
|
40
|
+
const [open, setOpen] = createSignal(props.defaultOpen)
|
|
41
|
+
createEffect(() => setOpen(props.defaultOpen))
|
|
42
|
+
|
|
43
|
+
return <Popover {...props} open={open()} onOpenChange={setOpen} />
|
|
44
|
+
},
|
|
45
|
+
tags: ["autodocs"],
|
|
46
|
+
parameters: {
|
|
47
|
+
gridPreview: () => (
|
|
48
|
+
<Popover trigger="Open popover" title="Popover" portal={false} defaultOpen>
|
|
49
|
+
Popover content
|
|
50
|
+
</Popover>
|
|
51
|
+
),
|
|
52
|
+
docs: {
|
|
53
|
+
description: {
|
|
54
|
+
component: docs,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const Basic = {}
|
|
61
|
+
|
|
62
|
+
export const NoHeader = {
|
|
63
|
+
args: {
|
|
64
|
+
title: "",
|
|
65
|
+
description: "",
|
|
66
|
+
children: "Popover body only",
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const Inline = {
|
|
71
|
+
args: {
|
|
72
|
+
portal: false,
|
|
73
|
+
defaultOpen: true,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Controlled = {
|
|
78
|
+
args: {
|
|
79
|
+
trigger: "Toggle popover",
|
|
80
|
+
title: "Controlled",
|
|
81
|
+
description: "Open state is controlled",
|
|
82
|
+
children: "Controlled content",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createEffect, createSignal } from "solid-js"
|
|
2
|
+
import { PreviewControls } from "./preview-controls"
|
|
3
|
+
|
|
4
|
+
const defaults = { zoom: 100, disabled: false }
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "UI/PreviewControls",
|
|
8
|
+
id: "ui-preview-controls",
|
|
9
|
+
args: defaults,
|
|
10
|
+
argTypes: { zoom: { control: { type: "range", min: 50, max: 200, step: 25 } } },
|
|
11
|
+
render: (args: typeof defaults) => {
|
|
12
|
+
const [zoom, setZoom] = createSignal(args.zoom)
|
|
13
|
+
|
|
14
|
+
createEffect(() => setZoom(args.zoom))
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div class="relative grid h-52 w-full max-w-sm place-items-center overflow-hidden rounded-md bg-v2-background-bg-layer-01">
|
|
18
|
+
<output class="rounded bg-v2-background-bg-base px-3 py-2" style={{ transform: `scale(${zoom() / 100})` }}>
|
|
19
|
+
{zoom()}%
|
|
20
|
+
</output>
|
|
21
|
+
<PreviewControls
|
|
22
|
+
disabled={args.disabled}
|
|
23
|
+
zoomOutDisabled={zoom() <= 50}
|
|
24
|
+
zoomInDisabled={zoom() >= 200}
|
|
25
|
+
onZoomOut={() => setZoom((n) => Math.max(50, n - 25))}
|
|
26
|
+
onZoomIn={() => setZoom((n) => Math.min(200, n + 25))}
|
|
27
|
+
onFit={() => setZoom(100)}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Fit = {}
|
|
35
|
+
|
|
36
|
+
export const Minimum = { args: { zoom: 50 } }
|
|
37
|
+
|
|
38
|
+
export const Maximum = { args: { zoom: 200 } }
|
|
39
|
+
|
|
40
|
+
export const Disabled = { args: { disabled: true } }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Progress, type ProgressProps } from "./progress"
|
|
2
|
+
|
|
3
|
+
const docs = `### Overview
|
|
4
|
+
Linear progress indicator with optional label and value display.
|
|
5
|
+
|
|
6
|
+
Use in forms, uploads, or background tasks.
|
|
7
|
+
|
|
8
|
+
### API
|
|
9
|
+
- \`value\` and \`maxValue\` control progress.
|
|
10
|
+
- Optional: \`showValueLabel\`, \`hideLabel\`.
|
|
11
|
+
- Children provide the label text.
|
|
12
|
+
|
|
13
|
+
### Variants and states
|
|
14
|
+
- Supports indeterminate state via Kobalte props (if provided).
|
|
15
|
+
|
|
16
|
+
### Behavior
|
|
17
|
+
- Uses Kobalte Progress for value calculation.
|
|
18
|
+
|
|
19
|
+
### Accessibility
|
|
20
|
+
- TODO: confirm ARIA attributes from Kobalte.
|
|
21
|
+
|
|
22
|
+
### Theming/tokens
|
|
23
|
+
- Uses \`data-component="progress"\` with track/fill slots.
|
|
24
|
+
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: "UI/Progress",
|
|
29
|
+
id: "components-progress",
|
|
30
|
+
component: Progress,
|
|
31
|
+
render: (args: ProgressProps) => (
|
|
32
|
+
<Progress {...args} class="min-w-48" aria-label={args.children ? undefined : "Progress"} />
|
|
33
|
+
),
|
|
34
|
+
args: {
|
|
35
|
+
value: 60,
|
|
36
|
+
minValue: 0,
|
|
37
|
+
maxValue: 100,
|
|
38
|
+
children: "Progress",
|
|
39
|
+
indeterminate: false,
|
|
40
|
+
hideLabel: false,
|
|
41
|
+
showValueLabel: true,
|
|
42
|
+
},
|
|
43
|
+
argTypes: {
|
|
44
|
+
value: { control: { type: "range", min: 0, max: 100, step: 1 } },
|
|
45
|
+
minValue: { control: { type: "range", min: -100, max: 0, step: 1 } },
|
|
46
|
+
maxValue: { control: { type: "range", min: 1, max: 100, step: 1 } },
|
|
47
|
+
},
|
|
48
|
+
tags: ["autodocs"],
|
|
49
|
+
parameters: {
|
|
50
|
+
docs: {
|
|
51
|
+
description: {
|
|
52
|
+
component: docs,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Basic = {}
|
|
59
|
+
|
|
60
|
+
export const NoLabel = {
|
|
61
|
+
args: {
|
|
62
|
+
children: "",
|
|
63
|
+
hideLabel: true,
|
|
64
|
+
showValueLabel: false,
|
|
65
|
+
value: 30,
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Indeterminate = { args: { children: "Loading", indeterminate: true, showValueLabel: false } }
|