feat(webui): add stock and registry primitives for the redesign
Stock shadcn-vue: number-field, tags-input, radio-group, breadcrumb, kbd. From archie-component-registry: duration-input, byte-size-input, segmented-control, secret-reference, setting-row, stat-strip, status-pill.
This commit is contained in:
1 parent
6d8fe247a7
commit
e3bf3b7584
46 files changed
+831
-12
No files matched your search
@@ -14,7 +14,16 @@ Not editorial, not marketing, not playful. Every rule below serves that.
|
||||
- Vue 3 SFCs + TypeScript, Vite, Pinia, vue-router.
|
||||
- Tailwind CSS v4 via `@tailwindcss/vite`; `@custom-variant dark` keyed on the
|
||||
`[data-theme]` attribute; shadcn-vue + reka-ui for primitives;
|
||||
`@lucide/vue` for icons; `@fontsource-variable/geist` is the typeface.
|
||||
`@lucide/vue` for icons; IBM Plex Sans for UI, IBM Plex Mono for every
|
||||
machine value (Graphite theme, `docs/design/ui-redesign/`).
|
||||
- `ui/src/components/ui/` is CLI-installed only; never hand-edit it. Order of
|
||||
preference for a missing component: stock shadcn-vue (`npx shadcn-vue add`;
|
||||
reka-ui names differ, e.g. chip input is Tags input), another shadcn-vue
|
||||
registry (e.g. inspira-ui), then a new item in the sibling
|
||||
`archie-component-registry` repo, installed from its `public/r/<item>.json`.
|
||||
The CLI prompts to overwrite stock primitives an item depends on: answer no.
|
||||
If `npm install` fails with `EALLOWSCRIPTS`, run the CLI with
|
||||
`NPM_CONFIG_USERCONFIG=/dev/null`.
|
||||
- Features live in `ui/src/<feature>/` with colocated `.js`/`.css`. Extract a
|
||||
helper to `ui/src/base/` only on the **second distinct consumer**.
|
||||
- `ui/dist/` is committed and generated — never hand-edit it, never ignore it
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"$schema": "https://shadcn-vue.com/schema.json",
|
||||
"style": "reka-nova",
|
||||
"font": "geist-sans",
|
||||
"typescript": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
|
||||
Generated
+8
-8
@@ -10,13 +10,13 @@
|
||||
"dependencies": {
|
||||
"@fontsource-variable/ibm-plex-sans": "^5.3.0",
|
||||
"@fontsource/ibm-plex-mono": "^5.3.0",
|
||||
"@lucide/vue": "^1.47.0",
|
||||
"@lucide/vue": "^1.48.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vueuse/core": "^15.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"pinia": "^4.0.3",
|
||||
"reka-ui": "^2.10.4",
|
||||
"reka-ui": "^2.10.5",
|
||||
"tailwind-merge": "^3.7.0",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
@@ -943,9 +943,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@lucide/vue": {
|
||||
"version": "1.47.0",
|
||||
"resolved": "https://registry.npmjs.org/@lucide/vue/-/vue-1.47.0.tgz",
|
||||
"integrity": "sha512-S0/UX9zra4Z8xmqrA1MH5GiSKA8daAPFwkmORt/u+gUHAkYZoeOcr+DH3scZeyE9bdLWScGK+MJoDYi8rIU5Jg==",
|
||||
"version": "1.48.0",
|
||||
"resolved": "https://registry.npmjs.org/@lucide/vue/-/vue-1.48.0.tgz",
|
||||
"integrity": "sha512-3/Nwx/RsqQ4ZrrSML1GNsSWCSDyLnBgoF/eEr1q9G6iZymn3+WKtzIj7Dbc/Nxrt9WOPuGrJ58S+CBiamK+36w==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"vue": ">=3.0.1"
|
||||
@@ -6322,9 +6322,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/reka-ui": {
|
||||
"version": "2.10.4",
|
||||
"resolved": "https://registry.npmjs.org/reka-ui/-/reka-ui-2.10.4.tgz",
|
||||
"integrity": "sha512-kbS5GAbkHkYj0EVKAg5ZPEPndhBjeUFSa1Aq5m5ftQwyHnB1v5tw8X6fcwfKH/ry3StPXblMWM1DW82MVS71cw==",
|
||||
"version": "2.10.5",
|
||||
"resolved": "https://registry.npmjs.org/reka-ui/-/reka-ui-2.10.5.tgz",
|
||||
"integrity": "sha512-/8o0y9BThE0hcHKFg+3770tWcJh3qKdOEFxLOPb9HIajXeFoH/J530cZH62jUJunbqwBgpSBL9v7nB8LJ5pDXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.6.13",
|
||||
|
||||
+2
-2
@@ -13,13 +13,13 @@
|
||||
"dependencies": {
|
||||
"@fontsource-variable/ibm-plex-sans": "^5.3.0",
|
||||
"@fontsource/ibm-plex-mono": "^5.3.0",
|
||||
"@lucide/vue": "^1.47.0",
|
||||
"@lucide/vue": "^1.48.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vueuse/core": "^15.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"pinia": "^4.0.3",
|
||||
"reka-ui": "^2.10.4",
|
||||
"reka-ui": "^2.10.5",
|
||||
"tailwind-merge": "^3.7.0",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav
|
||||
aria-label="breadcrumb"
|
||||
data-slot="breadcrumb"
|
||||
:class="cn('', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,24 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
|
||||
import { MoreHorizontalIcon } from '@lucide/vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
data-slot="breadcrumb-ellipsis"
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
:class="cn('size-5 [&>svg]:size-4 flex items-center justify-center', props.class)"
|
||||
>
|
||||
<slot>
|
||||
<MoreHorizontalIcon />
|
||||
</slot>
|
||||
<span class="sr-only">More</span>
|
||||
</span>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
data-slot="breadcrumb-item"
|
||||
:class="cn('gap-1 inline-flex items-center', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</li>
|
||||
</template>
|
||||
@@ -0,0 +1,21 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PrimitiveProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { Primitive } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = withDefaults(defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>(), {
|
||||
as: 'a',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
data-slot="breadcrumb-link"
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn('hover:text-foreground transition-colors', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ol
|
||||
data-slot="breadcrumb-list"
|
||||
:class="cn('text-muted-foreground gap-1.5 text-sm flex flex-wrap items-center wrap-break-word', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</ol>
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
data-slot="breadcrumb-page"
|
||||
role="link"
|
||||
aria-disabled="true"
|
||||
aria-current="page"
|
||||
:class="cn('text-foreground font-normal', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
|
||||
import { ChevronRightIcon } from '@lucide/vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
data-slot="breadcrumb-separator"
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
:class="cn('[&>svg]:size-3.5', props.class)"
|
||||
>
|
||||
<slot>
|
||||
<ChevronRightIcon class="cn-rtl-flip" />
|
||||
</slot>
|
||||
</li>
|
||||
</template>
|
||||
@@ -0,0 +1,7 @@
|
||||
export { default as Breadcrumb } from './Breadcrumb.vue'
|
||||
export { default as BreadcrumbEllipsis } from './BreadcrumbEllipsis.vue'
|
||||
export { default as BreadcrumbItem } from './BreadcrumbItem.vue'
|
||||
export { default as BreadcrumbLink } from './BreadcrumbLink.vue'
|
||||
export { default as BreadcrumbList } from './BreadcrumbList.vue'
|
||||
export { default as BreadcrumbPage } from './BreadcrumbPage.vue'
|
||||
export { default as BreadcrumbSeparator } from './BreadcrumbSeparator.vue'
|
||||
@@ -0,0 +1,40 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from "@/components/ui/input-group";
|
||||
import { bytesToMB, mbToBytes } from "./bytes";
|
||||
|
||||
defineProps<{ id?: string; disabled?: boolean }>();
|
||||
const model = defineModel<number>({ required: true });
|
||||
|
||||
const mb = ref(0);
|
||||
watch(
|
||||
model,
|
||||
(bytes) => {
|
||||
if (mbToBytes(mb.value) !== bytes) mb.value = bytesToMB(bytes ?? 0);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function emitChange() {
|
||||
if (Number.isFinite(mb.value) && mb.value >= 0) model.value = mbToBytes(mb.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<InputGroup class="w-40">
|
||||
<InputGroupInput
|
||||
:id="id"
|
||||
v-model.number="mb"
|
||||
type="number"
|
||||
min="0"
|
||||
step="any"
|
||||
inputmode="decimal"
|
||||
class="font-mono"
|
||||
:disabled="disabled"
|
||||
@change="emitChange"
|
||||
/>
|
||||
<InputGroupAddon align="inline-end">
|
||||
<InputGroupText class="font-mono text-xs">MB</InputGroupText>
|
||||
</InputGroupAddon>
|
||||
</InputGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,9 @@
|
||||
export const BYTES_PER_MB = 1_000_000;
|
||||
|
||||
export function bytesToMB(bytes: number): number {
|
||||
return Number((bytes / BYTES_PER_MB).toFixed(6));
|
||||
}
|
||||
|
||||
export function mbToBytes(mb: number): number {
|
||||
return Math.round(mb * BYTES_PER_MB);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as ByteSizeInput } from "./ByteSizeInput.vue";
|
||||
export * from "./bytes";
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
|
||||
import type { DurationUnit } from "./duration";
|
||||
import {
|
||||
DURATION_UNITS,
|
||||
formatGoDuration,
|
||||
joinDuration,
|
||||
parseGoDuration,
|
||||
splitDuration,
|
||||
} from "./duration";
|
||||
|
||||
const props = defineProps<{ id?: string; disabled?: boolean; units?: DurationUnit[] }>();
|
||||
const model = defineModel<string>({ required: true });
|
||||
|
||||
const units = computed(() => props.units ?? DURATION_UNITS);
|
||||
const amount = ref(0);
|
||||
const unit = ref<DurationUnit>("s");
|
||||
|
||||
watch(
|
||||
model,
|
||||
(text) => {
|
||||
const ms = parseGoDuration(text ?? "");
|
||||
if (ms === null) return;
|
||||
if (joinDuration(amount.value, unit.value) === ms) return;
|
||||
const split = splitDuration(ms);
|
||||
amount.value = split.value;
|
||||
unit.value = units.value.includes(split.unit) ? split.unit : "ms";
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function emitChange() {
|
||||
if (!Number.isFinite(amount.value) || amount.value < 0) return;
|
||||
model.value = formatGoDuration(joinDuration(amount.value, unit.value));
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<InputGroup class="w-48">
|
||||
<InputGroupInput
|
||||
:id="id"
|
||||
v-model.number="amount"
|
||||
type="number"
|
||||
min="0"
|
||||
inputmode="decimal"
|
||||
class="font-mono"
|
||||
:disabled="disabled"
|
||||
@change="emitChange"
|
||||
/>
|
||||
<InputGroupAddon align="inline-end">
|
||||
<select
|
||||
v-model="unit"
|
||||
aria-label="Unit"
|
||||
class="bg-transparent font-mono text-xs text-muted-foreground outline-none"
|
||||
:disabled="disabled"
|
||||
@change="emitChange"
|
||||
>
|
||||
<option v-for="u in units" :key="u" :value="u">{{ u }}</option>
|
||||
</select>
|
||||
</InputGroupAddon>
|
||||
</InputGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,66 @@
|
||||
export type DurationUnit = "ms" | "s" | "m" | "h";
|
||||
|
||||
const UNIT_MS: Record<string, number> = {
|
||||
ns: 1e-6,
|
||||
us: 1e-3,
|
||||
"µs": 1e-3,
|
||||
ms: 1,
|
||||
s: 1000,
|
||||
m: 60_000,
|
||||
h: 3_600_000,
|
||||
};
|
||||
|
||||
export const DURATION_UNITS: DurationUnit[] = ["ms", "s", "m", "h"];
|
||||
|
||||
/** Parses a Go duration string ("1h0m0s", "1m30s", "500ms", "0") to milliseconds. */
|
||||
export function parseGoDuration(input: string): number | null {
|
||||
const text = input.trim();
|
||||
if (text === "0") return 0;
|
||||
const sign = text.startsWith("-") ? -1 : 1;
|
||||
const body = text.replace(/^[-+]/, "");
|
||||
if (body === "") return null;
|
||||
const re = /(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|ms|s|m|h)/gy;
|
||||
let total = 0;
|
||||
let consumed = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
while ((match = re.exec(body)) !== null) {
|
||||
total += Number(match[1]) * UNIT_MS[match[2]];
|
||||
consumed = re.lastIndex;
|
||||
}
|
||||
if (consumed !== body.length) return null;
|
||||
return sign * total;
|
||||
}
|
||||
|
||||
function trimFraction(n: number): string {
|
||||
return Number(n.toFixed(9)).toString();
|
||||
}
|
||||
|
||||
/** Formats milliseconds the way Go's time.Duration.String does. */
|
||||
export function formatGoDuration(ms: number): string {
|
||||
if (ms === 0) return "0s";
|
||||
const sign = ms < 0 ? "-" : "";
|
||||
let rest = Math.abs(ms);
|
||||
if (rest < 1000) return `${sign}${trimFraction(rest)}ms`;
|
||||
const h = Math.floor(rest / 3_600_000);
|
||||
rest -= h * 3_600_000;
|
||||
const m = Math.floor(rest / 60_000);
|
||||
rest -= m * 60_000;
|
||||
const s = `${trimFraction(rest / 1000)}s`;
|
||||
if (h > 0) return `${sign}${h}h${m}m${s}`;
|
||||
if (m > 0) return `${sign}${m}m${s}`;
|
||||
return `${sign}${s}`;
|
||||
}
|
||||
|
||||
/** Picks the largest unit that expresses ms as a whole number. */
|
||||
export function splitDuration(ms: number): { value: number; unit: DurationUnit } {
|
||||
for (const unit of ["h", "m", "s"] as const) {
|
||||
const size = UNIT_MS[unit];
|
||||
if (ms !== 0 && ms % size === 0) return { value: ms / size, unit };
|
||||
}
|
||||
if (ms === 0) return { value: 0, unit: "s" };
|
||||
return { value: ms, unit: "ms" };
|
||||
}
|
||||
|
||||
export function joinDuration(value: number, unit: DurationUnit): number {
|
||||
return value * UNIT_MS[unit];
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as DurationInput } from "./DurationInput.vue";
|
||||
export * from "./duration";
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<kbd
|
||||
data-slot="kbd"
|
||||
:class="cn('bg-muted text-muted-foreground in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*=size-])]:size-3 pointer-events-none inline-flex items-center justify-center select-none', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</kbd>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<kbd
|
||||
data-slot="kbd-group"
|
||||
:class="cn('gap-1 inline-flex items-center', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</kbd>
|
||||
</template>
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as Kbd } from './Kbd.vue'
|
||||
export { default as KbdGroup } from './KbdGroup.vue'
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import type { NumberFieldRootEmits, NumberFieldRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { NumberFieldRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<NumberFieldRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<NumberFieldRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NumberFieldRoot v-slot="slotProps" v-bind="forwarded" :class="cn('grid gap-1.5', props.class)">
|
||||
<slot v-bind="slotProps" />
|
||||
</NumberFieldRoot>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn('relative [&>[data-slot=input]]:has-[[data-slot=increment]]:pr-5 [&>[data-slot=input]]:has-[[data-slot=decrement]]:pl-5', props.class)">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import type { NumberFieldDecrementProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { MinusIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { NumberFieldDecrement, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<NumberFieldDecrementProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NumberFieldDecrement data-slot="decrement" v-bind="forwarded" :class="cn('absolute top-1/2 -translate-y-1/2 left-0 p-3 disabled:cursor-not-allowed disabled:opacity-20', props.class)">
|
||||
<slot>
|
||||
<MinusIcon class="h-4 w-4" />
|
||||
</slot>
|
||||
</NumberFieldDecrement>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import type { NumberFieldIncrementProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { PlusIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { NumberFieldIncrement, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<NumberFieldIncrementProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NumberFieldIncrement data-slot="increment" v-bind="forwarded" :class="cn('absolute top-1/2 -translate-y-1/2 right-0 disabled:cursor-not-allowed disabled:opacity-20 p-3', props.class)">
|
||||
<slot>
|
||||
<PlusIcon class="h-4 w-4" />
|
||||
</slot>
|
||||
</NumberFieldIncrement>
|
||||
</template>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { NumberFieldInput } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NumberFieldInput
|
||||
data-slot="input"
|
||||
:class="cn(
|
||||
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm w-full min-w-0 text-center outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class,
|
||||
)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
export { default as NumberField } from './NumberField.vue'
|
||||
export { default as NumberFieldContent } from './NumberFieldContent.vue'
|
||||
export { default as NumberFieldDecrement } from './NumberFieldDecrement.vue'
|
||||
export { default as NumberFieldIncrement } from './NumberFieldIncrement.vue'
|
||||
export { default as NumberFieldInput } from './NumberFieldInput.vue'
|
||||
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import type { RadioGroupRootEmits, RadioGroupRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { RadioGroupRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<RadioGroupRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<RadioGroupRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="radio-group"
|
||||
:class="cn('grid gap-2 w-full', props.class)"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</RadioGroupRoot>
|
||||
</template>
|
||||
@@ -0,0 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
import type { RadioGroupItemProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { CircleIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import {
|
||||
RadioGroupIndicator,
|
||||
RadioGroupItem,
|
||||
useForwardProps,
|
||||
} from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<RadioGroupItemProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupItem
|
||||
data-slot="radio-group-item"
|
||||
v-bind="forwardedProps"
|
||||
:class="
|
||||
cn(
|
||||
'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<RadioGroupIndicator
|
||||
data-slot="radio-group-indicator"
|
||||
class="flex size-4 items-center justify-center"
|
||||
>
|
||||
<slot>
|
||||
<CircleIcon class="bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full" />
|
||||
</slot>
|
||||
</RadioGroupIndicator>
|
||||
</RadioGroupItem>
|
||||
</template>
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as RadioGroup } from './RadioGroup.vue'
|
||||
export { default as RadioGroupItem } from './RadioGroupItem.vue'
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import { CircleCheck, CircleAlert, Lock } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
defineProps<{
|
||||
engine: string;
|
||||
secretKey: string;
|
||||
/** undefined while unknown; the resolved line is hidden. */
|
||||
resolved?: boolean;
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
defineEmits<{ change: [] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<div class="flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 font-mono text-[13px]">
|
||||
<Lock class="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
|
||||
<span class="text-muted-foreground">{{ engine }}</span>
|
||||
<span class="text-muted-foreground" aria-hidden="true">/</span>
|
||||
<span class="min-w-0 flex-1 truncate">{{ secretKey }}</span>
|
||||
<Button variant="ghost" size="sm" class="h-7" :disabled="disabled" @click="$emit('change')">
|
||||
Change
|
||||
</Button>
|
||||
</div>
|
||||
<p v-if="resolved === true" class="flex items-center gap-1.5 text-xs text-ok">
|
||||
<CircleCheck class="size-3.5" aria-hidden="true" /> Credential resolved
|
||||
</p>
|
||||
<p v-else-if="resolved === false" class="flex items-center gap-1.5 text-xs text-danger">
|
||||
<CircleAlert class="size-3.5" aria-hidden="true" /> Credential not found
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as SecretReference } from "./SecretReference.vue";
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts" generic="T extends string">
|
||||
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineProps<{
|
||||
options: { value: T; label: string }[];
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
class?: string;
|
||||
}>();
|
||||
const model = defineModel<T>({ required: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupRoot
|
||||
v-model="model"
|
||||
:aria-label="label"
|
||||
:disabled="disabled"
|
||||
orientation="horizontal"
|
||||
loop
|
||||
:class="cn('inline-flex h-9 items-center gap-0.5 rounded-md border border-input bg-background p-0.5', $props.class)"
|
||||
>
|
||||
<RadioGroupItem
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
class="h-full rounded-sm px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:bg-secondary data-[state=checked]:text-foreground disabled:opacity-50"
|
||||
>
|
||||
{{ option.label }}
|
||||
</RadioGroupItem>
|
||||
</RadioGroupRoot>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as SegmentedControl } from "./SegmentedControl.vue";
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineProps<{
|
||||
label: string;
|
||||
hint?: string;
|
||||
/** id of the control, so the label targets it. */
|
||||
for?: string;
|
||||
/** Risky settings sit in a bordered danger row. */
|
||||
tone?: "default" | "danger";
|
||||
class?: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:class="
|
||||
cn(
|
||||
'grid gap-2 border-t border-border py-4 md:grid-cols-[17rem_1fr] md:gap-8',
|
||||
tone === 'danger' && 'rounded-md border border-danger/40 bg-danger-soft px-4',
|
||||
$props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<div class="min-w-0">
|
||||
<label :for="$props.for" class="text-[13px] font-medium text-foreground">{{ label }}</label>
|
||||
<p v-if="hint" class="mt-0.5 text-xs leading-normal text-fg-subtle">{{ hint }}</p>
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as SettingRow } from "./SettingRow.vue";
|
||||
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineProps<{
|
||||
cells: { label: string; value: string | number; sub?: string; tone?: "default" | "warn" | "danger" }[];
|
||||
class?: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<dl
|
||||
:class="cn('grid auto-cols-fr grid-flow-col divide-x divide-border rounded-lg border border-border bg-card max-md:grid-flow-row max-md:divide-x-0 max-md:divide-y', $props.class)"
|
||||
>
|
||||
<div v-for="cell in cells" :key="cell.label" class="min-w-0 px-5 py-4">
|
||||
<dt class="truncate text-xs text-fg-subtle">{{ cell.label }}</dt>
|
||||
<dd
|
||||
:class="
|
||||
cn(
|
||||
'mt-1 truncate text-3xl font-semibold tabular-nums',
|
||||
cell.tone === 'warn' && 'text-warn',
|
||||
cell.tone === 'danger' && 'text-danger',
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ cell.value }}
|
||||
</dd>
|
||||
<dd v-if="cell.sub" class="mt-1 truncate text-xs text-fg-subtle">{{ cell.sub }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as StatStrip } from "./StatStrip.vue";
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const pill = cva(
|
||||
"inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 text-xs font-medium",
|
||||
{
|
||||
variants: {
|
||||
tone: {
|
||||
neutral: "border-border bg-secondary text-muted-foreground",
|
||||
accent: "border-primary/50 bg-transparent text-primary",
|
||||
warn: "border-warn/40 bg-warn-soft text-warn",
|
||||
danger: "border-danger/40 bg-danger-soft text-danger",
|
||||
},
|
||||
dot: {
|
||||
none: "",
|
||||
live: "before:size-1.5 before:rounded-full before:bg-primary",
|
||||
warn: "before:size-1.5 before:rounded-full before:bg-warn",
|
||||
danger: "before:size-1.5 before:rounded-full before:bg-danger",
|
||||
idle: "before:size-1.5 before:rounded-full before:bg-idle",
|
||||
},
|
||||
},
|
||||
defaultVariants: { tone: "neutral", dot: "none" },
|
||||
},
|
||||
);
|
||||
|
||||
type PillVariants = VariantProps<typeof pill>;
|
||||
defineProps<{ tone?: PillVariants["tone"]; dot?: PillVariants["dot"]; class?: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span :class="cn(pill({ tone, dot }), $props.class)"><slot /></span>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as StatusPill } from "./StatusPill.vue";
|
||||
@@ -0,0 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagsInputRootEmits, TagsInputRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { TagsInputRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<TagsInputRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<TagsInputRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TagsInputRoot
|
||||
v-slot="slotProps" v-bind="forwarded" :class="cn(
|
||||
'flex flex-wrap gap-2 items-center rounded-md border border-input bg-background px-2 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none',
|
||||
'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-3',
|
||||
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
||||
props.class)"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</TagsInputRoot>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagsInputInputProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { TagsInputInput, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<TagsInputInputProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TagsInputInput v-bind="forwardedProps" :class="cn('text-sm min-h-5 focus:outline-none flex-1 bg-transparent px-1', props.class)" />
|
||||
</template>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagsInputItemProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { TagsInputItem, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<TagsInputItemProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TagsInputItem v-bind="forwardedProps" :class="cn('flex h-5 items-center rounded-md bg-secondary data-[state=active]:ring-ring data-[state=active]:ring-2 data-[state=active]:ring-offset-2 ring-offset-background', props.class)">
|
||||
<slot />
|
||||
</TagsInputItem>
|
||||
</template>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagsInputItemDeleteProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { XIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { TagsInputItemDelete, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<TagsInputItemDeleteProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TagsInputItemDelete v-bind="forwardedProps" :class="cn('flex rounded bg-transparent mr-1', props.class)">
|
||||
<slot>
|
||||
<XIcon class="w-4 h-4" />
|
||||
</slot>
|
||||
</TagsInputItemDelete>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { TagsInputItemTextProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { TagsInputItemText, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<TagsInputItemTextProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<TagsInputItemText v-bind="forwardedProps" :class="cn('py-0.5 px-2 text-sm rounded bg-transparent', props.class)" />
|
||||
</template>
|
||||
@@ -0,0 +1,5 @@
|
||||
export { default as TagsInput } from './TagsInput.vue'
|
||||
export { default as TagsInputInput } from './TagsInputInput.vue'
|
||||
export { default as TagsInputItem } from './TagsInputItem.vue'
|
||||
export { default as TagsInputItemDelete } from './TagsInputItemDelete.vue'
|
||||
export { default as TagsInputItemText } from './TagsInputItemText.vue'
|
||||
Reference in new issue
Block a user