@engineio/ui 0.4.0
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/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/components/brand/engine-icon.svelte +75 -0
- package/dist/components/brand/engine-icon.svelte.d.ts +25 -0
- package/dist/components/brand/engine-wordmark.svelte +104 -0
- package/dist/components/brand/engine-wordmark.svelte.d.ts +16 -0
- package/dist/components/brand/index.d.ts +3 -0
- package/dist/components/brand/index.js +3 -0
- package/dist/components/ui/alert/alert-description.svelte +22 -0
- package/dist/components/ui/alert/alert-description.svelte.d.ts +5 -0
- package/dist/components/ui/alert/alert-title.svelte +31 -0
- package/dist/components/ui/alert/alert-title.svelte.d.ts +8 -0
- package/dist/components/ui/alert/alert.svelte +114 -0
- package/dist/components/ui/alert/alert.svelte.d.ts +70 -0
- package/dist/components/ui/alert/index.d.ts +5 -0
- package/dist/components/ui/alert/index.js +7 -0
- package/dist/components/ui/badge/badge.svelte +96 -0
- package/dist/components/ui/badge/badge.svelte.d.ts +88 -0
- package/dist/components/ui/badge/index.d.ts +2 -0
- package/dist/components/ui/badge/index.js +2 -0
- package/dist/components/ui/button/button.svelte +137 -0
- package/dist/components/ui/button/button.svelte.d.ts +154 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.js +4 -0
- package/dist/components/ui/card/card-content.svelte +16 -0
- package/dist/components/ui/card/card-content.svelte.d.ts +5 -0
- package/dist/components/ui/card/card-description.svelte +20 -0
- package/dist/components/ui/card/card-description.svelte.d.ts +5 -0
- package/dist/components/ui/card/card-footer.svelte +20 -0
- package/dist/components/ui/card/card-footer.svelte.d.ts +5 -0
- package/dist/components/ui/card/card-header.svelte +20 -0
- package/dist/components/ui/card/card-header.svelte.d.ts +5 -0
- package/dist/components/ui/card/card-title.svelte +25 -0
- package/dist/components/ui/card/card-title.svelte.d.ts +8 -0
- package/dist/components/ui/card/card.svelte +23 -0
- package/dist/components/ui/card/card.svelte.d.ts +5 -0
- package/dist/components/ui/card/index.d.ts +7 -0
- package/dist/components/ui/card/index.js +9 -0
- package/dist/components/ui/checkbox/checkbox.svelte +38 -0
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/components/ui/checkbox/index.d.ts +2 -0
- package/dist/components/ui/checkbox/index.js +4 -0
- package/dist/components/ui/dialog/dialog-content.svelte +41 -0
- package/dist/components/ui/dialog/dialog-content.svelte.d.ts +9 -0
- package/dist/components/ui/dialog/dialog-description.svelte +16 -0
- package/dist/components/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/dialog-footer.svelte +23 -0
- package/dist/components/ui/dialog/dialog-footer.svelte.d.ts +5 -0
- package/dist/components/ui/dialog/dialog-header.svelte +20 -0
- package/dist/components/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/components/ui/dialog/dialog-overlay.svelte +19 -0
- package/dist/components/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/dialog-title.svelte +16 -0
- package/dist/components/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/components/ui/dialog/index.d.ts +12 -0
- package/dist/components/ui/dialog/index.js +14 -0
- package/dist/components/ui/input/index.d.ts +2 -0
- package/dist/components/ui/input/index.js +4 -0
- package/dist/components/ui/input/input.svelte +52 -0
- package/dist/components/ui/input/input.svelte.d.ts +13 -0
- package/dist/components/ui/label/index.d.ts +2 -0
- package/dist/components/ui/label/index.js +4 -0
- package/dist/components/ui/label/label.svelte +19 -0
- package/dist/components/ui/label/label.svelte.d.ts +4 -0
- package/dist/components/ui/popover/index.d.ts +6 -0
- package/dist/components/ui/popover/index.js +8 -0
- package/dist/components/ui/popover/popover-content.svelte +28 -0
- package/dist/components/ui/popover/popover-content.svelte.d.ts +7 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/progress/index.js +4 -0
- package/dist/components/ui/progress/progress.svelte +25 -0
- package/dist/components/ui/progress/progress.svelte.d.ts +4 -0
- package/dist/components/ui/radio-group/index.d.ts +3 -0
- package/dist/components/ui/radio-group/index.js +5 -0
- package/dist/components/ui/radio-group/radio-group-item.svelte +28 -0
- package/dist/components/ui/radio-group/radio-group-item.svelte.d.ts +4 -0
- package/dist/components/ui/radio-group/radio-group.svelte +13 -0
- package/dist/components/ui/radio-group/radio-group.svelte.d.ts +4 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/select/index.js +13 -0
- package/dist/components/ui/select/select-content.svelte +39 -0
- package/dist/components/ui/select/select-content.svelte.d.ts +7 -0
- package/dist/components/ui/select/select-group-heading.svelte +16 -0
- package/dist/components/ui/select/select-group-heading.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-item.svelte +37 -0
- package/dist/components/ui/select/select-item.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-scroll-down-button.svelte +19 -0
- package/dist/components/ui/select/select-scroll-down-button.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-scroll-up-button.svelte +19 -0
- package/dist/components/ui/select/select-scroll-up-button.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-separator.svelte +13 -0
- package/dist/components/ui/select/select-separator.svelte.d.ts +4 -0
- package/dist/components/ui/select/select-trigger.svelte +24 -0
- package/dist/components/ui/select/select-trigger.svelte.d.ts +4 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/index.js +4 -0
- package/dist/components/ui/separator/separator.svelte +22 -0
- package/dist/components/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/skeleton/index.js +4 -0
- package/dist/components/ui/skeleton/skeleton.svelte +17 -0
- package/dist/components/ui/skeleton/skeleton.svelte.d.ts +5 -0
- package/dist/components/ui/switch/index.d.ts +2 -0
- package/dist/components/ui/switch/index.js +4 -0
- package/dist/components/ui/switch/switch.svelte +27 -0
- package/dist/components/ui/switch/switch.svelte.d.ts +4 -0
- package/dist/components/ui/table/index.d.ts +9 -0
- package/dist/components/ui/table/index.js +11 -0
- package/dist/components/ui/table/table-body.svelte +22 -0
- package/dist/components/ui/table/table-body.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-caption.svelte +21 -0
- package/dist/components/ui/table/table-caption.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-cell.svelte +33 -0
- package/dist/components/ui/table/table-cell.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-footer.svelte +29 -0
- package/dist/components/ui/table/table-footer.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-head.svelte +36 -0
- package/dist/components/ui/table/table-head.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-header.svelte +23 -0
- package/dist/components/ui/table/table-header.svelte.d.ts +5 -0
- package/dist/components/ui/table/table-row.svelte +32 -0
- package/dist/components/ui/table/table-row.svelte.d.ts +5 -0
- package/dist/components/ui/table/table.svelte +36 -0
- package/dist/components/ui/table/table.svelte.d.ts +5 -0
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/tabs/index.js +8 -0
- package/dist/components/ui/tabs/tabs-content.svelte +19 -0
- package/dist/components/ui/tabs/tabs-content.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +27 -0
- package/dist/components/ui/tabs/tabs-list.svelte.d.ts +7 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte +29 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte.d.ts +7 -0
- package/dist/components/ui/textarea/index.d.ts +2 -0
- package/dist/components/ui/textarea/index.js +4 -0
- package/dist/components/ui/textarea/textarea.svelte +22 -0
- package/dist/components/ui/textarea/textarea.svelte.d.ts +5 -0
- package/dist/components/ui/tooltip/index.d.ts +6 -0
- package/dist/components/ui/tooltip/index.js +8 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte +21 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte.d.ts +4 -0
- package/dist/fonts/ProximaNova-ExtraCondensedThin.otf +0 -0
- package/dist/fonts/ProximaNovaBlack.otf +0 -0
- package/dist/fonts/ProximaNovaBold.otf +0 -0
- package/dist/fonts/ProximaNovaCondensedBlack.otf +0 -0
- package/dist/fonts/ProximaNovaExtraCondensedBlack.otf +0 -0
- package/dist/fonts/ProximaNovaRegular.otf +0 -0
- package/dist/fonts/ProximaNovaSemibold.otf +0 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +44 -0
- package/dist/styles/fonts.css +116 -0
- package/dist/styles/index.css +28 -0
- package/dist/styles/tokens.css +221 -0
- package/dist/styles/utilities.css +129 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.js +22 -0
- package/package.json +92 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants"
|
|
3
|
+
|
|
4
|
+
// The panel is always neutral. A 3px bar inset down the left, with rounded
|
|
5
|
+
// ends, is the ONLY thing that says whether this is good, bad or a warning —
|
|
6
|
+
// the fill, the rule and the type never change, so a wall of alerts reads as
|
|
7
|
+
// one surface with a column of state down the side rather than as four
|
|
8
|
+
// different components.
|
|
9
|
+
//
|
|
10
|
+
// ON THE BRAND RULE. The brand prohibits "a coloured left-edge accent",
|
|
11
|
+
// twice, and it is worth being precise about what it prohibits: both
|
|
12
|
+
// wordings scope it to signalling identity — "to signal which sub-brand a
|
|
13
|
+
// card belongs to", "to indicate category or ownership" — with the reason
|
|
14
|
+
// given that the lockup does that job. This bar signals STATE, which no
|
|
15
|
+
// lockup can do and which nothing else in the system claims. That is the
|
|
16
|
+
// reading this component is built on. It is a reading, though, not an
|
|
17
|
+
// exemption, so it is raised in the README with the other deviations.
|
|
18
|
+
//
|
|
19
|
+
// `alertVariants` is the extension seam — see button.svelte for the
|
|
20
|
+
// `tv({ extend: … })` recipe.
|
|
21
|
+
export const alertVariants = tv({
|
|
22
|
+
base: [
|
|
23
|
+
"relative w-full rounded-media",
|
|
24
|
+
"border border-grey-700 bg-card",
|
|
25
|
+
// Left geometry: 20px to the bar, 3px of bar, then 13px before the text.
|
|
26
|
+
// The border gap is wider than the text gap on purpose — proximity is
|
|
27
|
+
// what groups the bar with the message it marks rather than with the
|
|
28
|
+
// panel edge it sits near. py-3.5 matches the bar's vertical inset.
|
|
29
|
+
"py-3.5 pr-4 pl-9",
|
|
30
|
+
],
|
|
31
|
+
variants: {
|
|
32
|
+
// Applied to the bar, not the panel.
|
|
33
|
+
variant: {
|
|
34
|
+
default: "[--alert-bar:var(--color-grey-500)]",
|
|
35
|
+
success: "[--alert-bar:var(--color-success)]",
|
|
36
|
+
warning: "[--alert-bar:var(--color-warning)]",
|
|
37
|
+
danger: "[--alert-bar:var(--color-danger)]",
|
|
38
|
+
// shadcn's name for danger, kept so existing call sites resolve.
|
|
39
|
+
destructive: "[--alert-bar:var(--color-danger)]",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
variant: "default",
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
export type AlertVariant = VariantProps<typeof alertVariants>["variant"]
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script lang="ts">
|
|
51
|
+
import type { WithElementRef } from "../../../utils.js"
|
|
52
|
+
import { cn } from "../../../utils.js"
|
|
53
|
+
import X from "@lucide/svelte/icons/x"
|
|
54
|
+
import type { HTMLAttributes } from "svelte/elements"
|
|
55
|
+
|
|
56
|
+
let {
|
|
57
|
+
ref = $bindable(null),
|
|
58
|
+
class: className,
|
|
59
|
+
variant = "default",
|
|
60
|
+
onDismiss = undefined,
|
|
61
|
+
dismissLabel = "Dismiss",
|
|
62
|
+
children,
|
|
63
|
+
...restProps
|
|
64
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
65
|
+
variant?: AlertVariant
|
|
66
|
+
/** Supply a handler to render the close control. Omit for a static alert. */
|
|
67
|
+
onDismiss?: (() => void) | undefined
|
|
68
|
+
dismissLabel?: string
|
|
69
|
+
} = $props()
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
bind:this={ref}
|
|
74
|
+
class={cn(alertVariants({ variant }), onDismiss && "pr-11", className)}
|
|
75
|
+
{...restProps}
|
|
76
|
+
role="alert"
|
|
77
|
+
>
|
|
78
|
+
<!--
|
|
79
|
+
Inset on all three sides with rounded ends, not flush to the edge. Two
|
|
80
|
+
reasons beyond the look: a flush bar has to be clipped by the panel's
|
|
81
|
+
radius, which meant `overflow-hidden` on the panel and a bar whose top and
|
|
82
|
+
bottom were shaved by the corners; and `inset-y-3.5` matches the panel's
|
|
83
|
+
`py-3.5` exactly, so the bar spans the content box and tracks the text
|
|
84
|
+
rather than the panel. A one-line alert gets a short bar, as it should.
|
|
85
|
+
|
|
86
|
+
A real element rather than a `before:` pseudo: it needs no `content-['']`
|
|
87
|
+
and cannot be knocked out by a consumer passing their own `before:`
|
|
88
|
+
utility. `aria-hidden` because the colour is decoration — the text has to
|
|
89
|
+
say what happened on its own.
|
|
90
|
+
-->
|
|
91
|
+
<span
|
|
92
|
+
aria-hidden="true"
|
|
93
|
+
class="absolute inset-y-3.5 left-5 w-[3px] rounded-control"
|
|
94
|
+
style="background-color: var(--alert-bar)"
|
|
95
|
+
></span>
|
|
96
|
+
|
|
97
|
+
{@render children?.()}
|
|
98
|
+
|
|
99
|
+
{#if onDismiss}
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
onclick={onDismiss}
|
|
103
|
+
aria-label={dismissLabel}
|
|
104
|
+
class={cn(
|
|
105
|
+
"absolute top-3 right-3 grid size-6 place-items-center rounded-control",
|
|
106
|
+
"text-grey-400 transition-colors duration-140 ease-brand",
|
|
107
|
+
"hover:bg-white/6 hover:text-foreground",
|
|
108
|
+
"focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
<X class="size-4" />
|
|
112
|
+
</button>
|
|
113
|
+
{/if}
|
|
114
|
+
</div>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
export declare const alertVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
variant: {
|
|
4
|
+
default: string;
|
|
5
|
+
success: string;
|
|
6
|
+
warning: string;
|
|
7
|
+
danger: string;
|
|
8
|
+
destructive: string;
|
|
9
|
+
};
|
|
10
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
11
|
+
variant: {
|
|
12
|
+
default: string;
|
|
13
|
+
success: string;
|
|
14
|
+
warning: string;
|
|
15
|
+
danger: string;
|
|
16
|
+
destructive: string;
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
variant: {
|
|
20
|
+
default: string;
|
|
21
|
+
success: string;
|
|
22
|
+
warning: string;
|
|
23
|
+
danger: string;
|
|
24
|
+
destructive: string;
|
|
25
|
+
};
|
|
26
|
+
}>, {
|
|
27
|
+
variant: {
|
|
28
|
+
default: string;
|
|
29
|
+
success: string;
|
|
30
|
+
warning: string;
|
|
31
|
+
danger: string;
|
|
32
|
+
destructive: string;
|
|
33
|
+
};
|
|
34
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
35
|
+
variant: {
|
|
36
|
+
default: string;
|
|
37
|
+
success: string;
|
|
38
|
+
warning: string;
|
|
39
|
+
danger: string;
|
|
40
|
+
destructive: string;
|
|
41
|
+
};
|
|
42
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
43
|
+
variant: {
|
|
44
|
+
default: string;
|
|
45
|
+
success: string;
|
|
46
|
+
warning: string;
|
|
47
|
+
danger: string;
|
|
48
|
+
destructive: string;
|
|
49
|
+
};
|
|
50
|
+
}, {
|
|
51
|
+
variant: {
|
|
52
|
+
default: string;
|
|
53
|
+
success: string;
|
|
54
|
+
warning: string;
|
|
55
|
+
danger: string;
|
|
56
|
+
destructive: string;
|
|
57
|
+
};
|
|
58
|
+
}>, unknown, unknown, undefined>>;
|
|
59
|
+
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
60
|
+
import type { WithElementRef } from "../../../utils.js";
|
|
61
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
62
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
63
|
+
variant?: AlertVariant;
|
|
64
|
+
/** Supply a handler to render the close control. Omit for a static alert. */
|
|
65
|
+
onDismiss?: (() => void) | undefined;
|
|
66
|
+
dismissLabel?: string;
|
|
67
|
+
};
|
|
68
|
+
declare const Alert: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
69
|
+
type Alert = ReturnType<typeof Alert>;
|
|
70
|
+
export default Alert;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from "./alert.svelte";
|
|
2
|
+
import Description from "./alert-description.svelte";
|
|
3
|
+
import Title from "./alert-title.svelte";
|
|
4
|
+
export { alertVariants, type AlertVariant } from "./alert.svelte";
|
|
5
|
+
export { Root, Description, Title, Root as Alert, Description as AlertDescription, Title as AlertTitle, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Root from "./alert.svelte";
|
|
2
|
+
import Description from "./alert-description.svelte";
|
|
3
|
+
import Title from "./alert-title.svelte";
|
|
4
|
+
export { alertVariants } from "./alert.svelte";
|
|
5
|
+
export { Root, Description, Title,
|
|
6
|
+
//
|
|
7
|
+
Root as Alert, Description as AlertDescription, Title as AlertTitle, };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants"
|
|
3
|
+
|
|
4
|
+
// The system's one chip. Badge and Tag used to be separate components with
|
|
5
|
+
// a rule about which was which — solid pill for status, soft chip for
|
|
6
|
+
// category — and in practice that rule only ever generated arguments. This
|
|
7
|
+
// is the merged component: ONE chip, in the soft repository-label treatment
|
|
8
|
+
// (tinted fill, matching ink, 6px radius) for every job.
|
|
9
|
+
//
|
|
10
|
+
// It kept the name `Badge` because that is the name in use: 35 call sites in
|
|
11
|
+
// the engine repo say `<Badge>`, and none say `<Tag>`. Every variant those
|
|
12
|
+
// call sites reference — default, secondary, outline, success, destructive —
|
|
13
|
+
// survives below, so adopting this is a restyle rather than a migration.
|
|
14
|
+
//
|
|
15
|
+
// `badgeVariants` is the extension seam — see button.svelte for the
|
|
16
|
+
// `tv({ extend: … })` recipe.
|
|
17
|
+
//
|
|
18
|
+
// FILLS ARE TRANSLUCENT, AND THAT IS THE POINT. A chip has to read on the
|
|
19
|
+
// page (#0E0E0E), on a card (#161616) and on a table tile (#242424). An
|
|
20
|
+
// opaque grey fill can only be correct on one of them — the old `secondary`
|
|
21
|
+
// was grey-700, which vanished on a table tile, and a grey-800 fill would
|
|
22
|
+
// vanish on a card. A wash composites against whatever is behind it and
|
|
23
|
+
// stays roughly one step lighter everywhere. This is why there is no
|
|
24
|
+
// `solid` variant: an opaque chip is a surface-specific chip.
|
|
25
|
+
//
|
|
26
|
+
// ON THE BRAND INK. `default` sets its ink to `primary-300` #FF5C9B, not
|
|
27
|
+
// pure magenta: #FF006A on its own 12% tint measures 4.37:1, under AA, and
|
|
28
|
+
// the brand forbids magenta text below 15px bold. The lighter step gets
|
|
29
|
+
// 5.81:1 and ships today as `--brand-300` in integration.css. As a
|
|
30
|
+
// side-effect this fixes the contrast contradiction the old solid badge
|
|
31
|
+
// carried — white on magenta at 11px was 3.9:1, a known AA failure.
|
|
32
|
+
//
|
|
33
|
+
// ON THE HUES. The status variants are FUNCTIONAL — success, warning and
|
|
34
|
+
// danger report state. Do not use them as a categorical palette; `success`
|
|
35
|
+
// meaning "slots" because green looked right spends the only signal they
|
|
36
|
+
// carry. A real categorical palette is still a brand-team decision.
|
|
37
|
+
export const badgeVariants = tv({
|
|
38
|
+
base: [
|
|
39
|
+
"inline-flex items-center rounded-tag px-2 py-0.5",
|
|
40
|
+
"text-[13px] font-semibold whitespace-nowrap",
|
|
41
|
+
"transition-colors duration-140 ease-brand",
|
|
42
|
+
],
|
|
43
|
+
variants: {
|
|
44
|
+
variant: {
|
|
45
|
+
// Brand. The default, because an unqualified chip is an Engine chip.
|
|
46
|
+
default: "bg-primary-tint-12 text-primary-300 hover:bg-primary-tint-24",
|
|
47
|
+
// Neutral. The workhorse — a label with no state attached.
|
|
48
|
+
secondary: "bg-white/8 text-grey-200 hover:bg-white/12",
|
|
49
|
+
// No fill at all, for a chip on an already-busy surface.
|
|
50
|
+
outline:
|
|
51
|
+
"border-[1.5px] border-grey-600 text-foreground hover:border-grey-500",
|
|
52
|
+
// Engine Integration's reserved accent. Not in use — see tokens.css.
|
|
53
|
+
partner: "bg-partner-yellow-tint-12 text-partner-yellow",
|
|
54
|
+
|
|
55
|
+
// Status. Functional colour only.
|
|
56
|
+
success: "bg-success-tint-12 text-success",
|
|
57
|
+
warning: "bg-warning-tint-12 text-warning",
|
|
58
|
+
danger: "bg-danger-tint-12 text-danger",
|
|
59
|
+
// shadcn's name for danger, kept so existing call sites resolve.
|
|
60
|
+
destructive: "bg-danger-tint-12 text-danger",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
variant: "default",
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"]
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<script lang="ts">
|
|
72
|
+
import type { WithElementRef } from "../../../utils.js"
|
|
73
|
+
import { cn } from "../../../utils.js"
|
|
74
|
+
import type { HTMLAnchorAttributes } from "svelte/elements"
|
|
75
|
+
|
|
76
|
+
let {
|
|
77
|
+
ref = $bindable(null),
|
|
78
|
+
href,
|
|
79
|
+
class: className,
|
|
80
|
+
variant = "default",
|
|
81
|
+
children,
|
|
82
|
+
...restProps
|
|
83
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
84
|
+
variant?: BadgeVariant
|
|
85
|
+
} = $props()
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<svelte:element
|
|
89
|
+
this={href ? "a" : "span"}
|
|
90
|
+
bind:this={ref}
|
|
91
|
+
{href}
|
|
92
|
+
class={cn(badgeVariants({ variant }), className)}
|
|
93
|
+
{...restProps}
|
|
94
|
+
>
|
|
95
|
+
{@render children?.()}
|
|
96
|
+
</svelte:element>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
variant: {
|
|
4
|
+
default: string;
|
|
5
|
+
secondary: string;
|
|
6
|
+
outline: string;
|
|
7
|
+
partner: string;
|
|
8
|
+
success: string;
|
|
9
|
+
warning: string;
|
|
10
|
+
danger: string;
|
|
11
|
+
destructive: string;
|
|
12
|
+
};
|
|
13
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
14
|
+
variant: {
|
|
15
|
+
default: string;
|
|
16
|
+
secondary: string;
|
|
17
|
+
outline: string;
|
|
18
|
+
partner: string;
|
|
19
|
+
success: string;
|
|
20
|
+
warning: string;
|
|
21
|
+
danger: string;
|
|
22
|
+
destructive: string;
|
|
23
|
+
};
|
|
24
|
+
}, {
|
|
25
|
+
variant: {
|
|
26
|
+
default: string;
|
|
27
|
+
secondary: string;
|
|
28
|
+
outline: string;
|
|
29
|
+
partner: string;
|
|
30
|
+
success: string;
|
|
31
|
+
warning: string;
|
|
32
|
+
danger: string;
|
|
33
|
+
destructive: string;
|
|
34
|
+
};
|
|
35
|
+
}>, {
|
|
36
|
+
variant: {
|
|
37
|
+
default: string;
|
|
38
|
+
secondary: string;
|
|
39
|
+
outline: string;
|
|
40
|
+
partner: string;
|
|
41
|
+
success: string;
|
|
42
|
+
warning: string;
|
|
43
|
+
danger: string;
|
|
44
|
+
destructive: string;
|
|
45
|
+
};
|
|
46
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
47
|
+
variant: {
|
|
48
|
+
default: string;
|
|
49
|
+
secondary: string;
|
|
50
|
+
outline: string;
|
|
51
|
+
partner: string;
|
|
52
|
+
success: string;
|
|
53
|
+
warning: string;
|
|
54
|
+
danger: string;
|
|
55
|
+
destructive: string;
|
|
56
|
+
};
|
|
57
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
58
|
+
variant: {
|
|
59
|
+
default: string;
|
|
60
|
+
secondary: string;
|
|
61
|
+
outline: string;
|
|
62
|
+
partner: string;
|
|
63
|
+
success: string;
|
|
64
|
+
warning: string;
|
|
65
|
+
danger: string;
|
|
66
|
+
destructive: string;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
variant: {
|
|
70
|
+
default: string;
|
|
71
|
+
secondary: string;
|
|
72
|
+
outline: string;
|
|
73
|
+
partner: string;
|
|
74
|
+
success: string;
|
|
75
|
+
warning: string;
|
|
76
|
+
danger: string;
|
|
77
|
+
destructive: string;
|
|
78
|
+
};
|
|
79
|
+
}>, unknown, unknown, undefined>>;
|
|
80
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
81
|
+
import type { WithElementRef } from "../../../utils.js";
|
|
82
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
83
|
+
type $$ComponentProps = WithElementRef<HTMLAnchorAttributes> & {
|
|
84
|
+
variant?: BadgeVariant;
|
|
85
|
+
};
|
|
86
|
+
declare const Badge: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
87
|
+
type Badge = ReturnType<typeof Badge>;
|
|
88
|
+
export default Badge;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { WithElementRef } from "bits-ui"
|
|
3
|
+
import type {
|
|
4
|
+
HTMLAnchorAttributes,
|
|
5
|
+
HTMLButtonAttributes,
|
|
6
|
+
} from "svelte/elements"
|
|
7
|
+
import { type VariantProps, tv } from "tailwind-variants"
|
|
8
|
+
|
|
9
|
+
// The system's button: pill controls, bold labels, 140ms mechanical
|
|
10
|
+
// transitions, a 0.98 press and a magenta focus ring.
|
|
11
|
+
//
|
|
12
|
+
// THIS IS THE EXTENSION SEAM. `buttonVariants` is exported so a product can
|
|
13
|
+
// add its own variants without forking the component or waiting on a
|
|
14
|
+
// release here:
|
|
15
|
+
//
|
|
16
|
+
// // $lib/components/ui/button-variants.ts
|
|
17
|
+
// import { buttonVariants } from "@engineio/ui/components/ui/button"
|
|
18
|
+
// import { tv } from "tailwind-variants"
|
|
19
|
+
//
|
|
20
|
+
// export const appButtonVariants = tv({
|
|
21
|
+
// extend: buttonVariants,
|
|
22
|
+
// variants: {
|
|
23
|
+
// variant: {
|
|
24
|
+
// tab: "bg-transparent text-grey-300 hover:bg-white/6 hover:text-foreground",
|
|
25
|
+
// play: "bg-primary text-primary-foreground hover:bg-primary-press",
|
|
26
|
+
// },
|
|
27
|
+
// },
|
|
28
|
+
// })
|
|
29
|
+
//
|
|
30
|
+
// Brand rules (shape, weight, motion, focus) live here and are shared.
|
|
31
|
+
// Product variants live in the product. The upstream engine button carried
|
|
32
|
+
// `tab`, `tab-active`, `drawer`, `play` and `filled` in this file; they are
|
|
33
|
+
// app concerns and have been left to the apps. Its `success` variant was a
|
|
34
|
+
// stock Tailwind green standing in for a status colour that did not exist —
|
|
35
|
+
// it is back below, on the real token. See styles/tokens.css.
|
|
36
|
+
export const buttonVariants = tv({
|
|
37
|
+
base: [
|
|
38
|
+
"inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap",
|
|
39
|
+
"rounded-control text-[15px] font-bold tracking-[-0.01em]",
|
|
40
|
+
"transition-[background-color,color,border-color,transform] duration-140 ease-brand",
|
|
41
|
+
"active:scale-[0.98]",
|
|
42
|
+
"focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
43
|
+
"disabled:pointer-events-none disabled:opacity-38",
|
|
44
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
45
|
+
],
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
// The system's four: primary, inverse, secondary, ghost.
|
|
49
|
+
default: "bg-primary text-primary-foreground hover:bg-primary-press",
|
|
50
|
+
inverse: "bg-white text-background hover:bg-grey-100",
|
|
51
|
+
outline:
|
|
52
|
+
"border-[1.5px] border-grey-500 bg-transparent text-foreground hover:bg-white/6",
|
|
53
|
+
ghost: "bg-transparent text-foreground hover:bg-white/6",
|
|
54
|
+
|
|
55
|
+
secondary: "bg-grey-800 text-foreground hover:bg-grey-700",
|
|
56
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
57
|
+
icon: "bg-transparent text-foreground hover:bg-white/6",
|
|
58
|
+
|
|
59
|
+
// Status. Ink is Off Black on every status fill — white fails AA on
|
|
60
|
+
// all three. These are the only non-magenta fills in the button, and
|
|
61
|
+
// they are functional rather than decorative: reach for them when the
|
|
62
|
+
// button's OUTCOME is destructive or confirming, never for emphasis.
|
|
63
|
+
destructive:
|
|
64
|
+
"bg-danger text-danger-foreground hover:bg-danger/90",
|
|
65
|
+
success: "bg-success text-success-foreground hover:bg-success/90",
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
// 32 / 40 / 48px with the system's 12 / 18 / 24px padding.
|
|
69
|
+
default: "h-10 px-4.5",
|
|
70
|
+
sm: "h-8 px-3 text-[13px]",
|
|
71
|
+
lg: "h-12 px-6 text-lg",
|
|
72
|
+
icon: "size-10 rounded-full p-0",
|
|
73
|
+
"icon-sm": "size-8 rounded-full p-0",
|
|
74
|
+
"icon-lg": "size-12 rounded-full p-0",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
variant: "default",
|
|
79
|
+
size: "default",
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"]
|
|
84
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"]
|
|
85
|
+
|
|
86
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
87
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
88
|
+
variant?: ButtonVariant
|
|
89
|
+
size?: ButtonSize
|
|
90
|
+
loading?: boolean
|
|
91
|
+
}
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<script lang="ts">
|
|
95
|
+
import { cn } from "../../../utils.js"
|
|
96
|
+
import LoaderCircle from "@lucide/svelte/icons/loader-circle"
|
|
97
|
+
|
|
98
|
+
let {
|
|
99
|
+
class: className,
|
|
100
|
+
variant = "default",
|
|
101
|
+
size = "default",
|
|
102
|
+
ref = $bindable(null),
|
|
103
|
+
href = undefined,
|
|
104
|
+
type = "button",
|
|
105
|
+
loading = false,
|
|
106
|
+
disabled = false,
|
|
107
|
+
children,
|
|
108
|
+
...restProps
|
|
109
|
+
}: ButtonProps = $props()
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
{#if href}
|
|
113
|
+
<a
|
|
114
|
+
bind:this={ref}
|
|
115
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
116
|
+
{href}
|
|
117
|
+
{...restProps}
|
|
118
|
+
>
|
|
119
|
+
{#if loading}
|
|
120
|
+
<LoaderCircle class="animate-spin" />
|
|
121
|
+
{/if}
|
|
122
|
+
{@render children?.()}
|
|
123
|
+
</a>
|
|
124
|
+
{:else}
|
|
125
|
+
<button
|
|
126
|
+
bind:this={ref}
|
|
127
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
128
|
+
{type}
|
|
129
|
+
disabled={disabled || loading}
|
|
130
|
+
{...restProps}
|
|
131
|
+
>
|
|
132
|
+
{#if loading}
|
|
133
|
+
<LoaderCircle class="animate-spin" />
|
|
134
|
+
{/if}
|
|
135
|
+
{@render children?.()}
|
|
136
|
+
</button>
|
|
137
|
+
{/if}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { WithElementRef } from "bits-ui";
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
3
|
+
import { type VariantProps } from "tailwind-variants";
|
|
4
|
+
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
variant: {
|
|
6
|
+
default: string;
|
|
7
|
+
inverse: string;
|
|
8
|
+
outline: string;
|
|
9
|
+
ghost: string;
|
|
10
|
+
secondary: string;
|
|
11
|
+
link: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
destructive: string;
|
|
14
|
+
success: string;
|
|
15
|
+
};
|
|
16
|
+
size: {
|
|
17
|
+
default: string;
|
|
18
|
+
sm: string;
|
|
19
|
+
lg: string;
|
|
20
|
+
icon: string;
|
|
21
|
+
"icon-sm": string;
|
|
22
|
+
"icon-lg": string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
25
|
+
variant: {
|
|
26
|
+
default: string;
|
|
27
|
+
inverse: string;
|
|
28
|
+
outline: string;
|
|
29
|
+
ghost: string;
|
|
30
|
+
secondary: string;
|
|
31
|
+
link: string;
|
|
32
|
+
icon: string;
|
|
33
|
+
destructive: string;
|
|
34
|
+
success: string;
|
|
35
|
+
};
|
|
36
|
+
size: {
|
|
37
|
+
default: string;
|
|
38
|
+
sm: string;
|
|
39
|
+
lg: string;
|
|
40
|
+
icon: string;
|
|
41
|
+
"icon-sm": string;
|
|
42
|
+
"icon-lg": string;
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
variant: {
|
|
46
|
+
default: string;
|
|
47
|
+
inverse: string;
|
|
48
|
+
outline: string;
|
|
49
|
+
ghost: string;
|
|
50
|
+
secondary: string;
|
|
51
|
+
link: string;
|
|
52
|
+
icon: string;
|
|
53
|
+
destructive: string;
|
|
54
|
+
success: string;
|
|
55
|
+
};
|
|
56
|
+
size: {
|
|
57
|
+
default: string;
|
|
58
|
+
sm: string;
|
|
59
|
+
lg: string;
|
|
60
|
+
icon: string;
|
|
61
|
+
"icon-sm": string;
|
|
62
|
+
"icon-lg": string;
|
|
63
|
+
};
|
|
64
|
+
}>, {
|
|
65
|
+
variant: {
|
|
66
|
+
default: string;
|
|
67
|
+
inverse: string;
|
|
68
|
+
outline: string;
|
|
69
|
+
ghost: string;
|
|
70
|
+
secondary: string;
|
|
71
|
+
link: string;
|
|
72
|
+
icon: string;
|
|
73
|
+
destructive: string;
|
|
74
|
+
success: string;
|
|
75
|
+
};
|
|
76
|
+
size: {
|
|
77
|
+
default: string;
|
|
78
|
+
sm: string;
|
|
79
|
+
lg: string;
|
|
80
|
+
icon: string;
|
|
81
|
+
"icon-sm": string;
|
|
82
|
+
"icon-lg": string;
|
|
83
|
+
};
|
|
84
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
85
|
+
variant: {
|
|
86
|
+
default: string;
|
|
87
|
+
inverse: string;
|
|
88
|
+
outline: string;
|
|
89
|
+
ghost: string;
|
|
90
|
+
secondary: string;
|
|
91
|
+
link: string;
|
|
92
|
+
icon: string;
|
|
93
|
+
destructive: string;
|
|
94
|
+
success: string;
|
|
95
|
+
};
|
|
96
|
+
size: {
|
|
97
|
+
default: string;
|
|
98
|
+
sm: string;
|
|
99
|
+
lg: string;
|
|
100
|
+
icon: string;
|
|
101
|
+
"icon-sm": string;
|
|
102
|
+
"icon-lg": string;
|
|
103
|
+
};
|
|
104
|
+
}, undefined, string[], import("tailwind-variants/dist/config.js").TVConfig<{
|
|
105
|
+
variant: {
|
|
106
|
+
default: string;
|
|
107
|
+
inverse: string;
|
|
108
|
+
outline: string;
|
|
109
|
+
ghost: string;
|
|
110
|
+
secondary: string;
|
|
111
|
+
link: string;
|
|
112
|
+
icon: string;
|
|
113
|
+
destructive: string;
|
|
114
|
+
success: string;
|
|
115
|
+
};
|
|
116
|
+
size: {
|
|
117
|
+
default: string;
|
|
118
|
+
sm: string;
|
|
119
|
+
lg: string;
|
|
120
|
+
icon: string;
|
|
121
|
+
"icon-sm": string;
|
|
122
|
+
"icon-lg": string;
|
|
123
|
+
};
|
|
124
|
+
}, {
|
|
125
|
+
variant: {
|
|
126
|
+
default: string;
|
|
127
|
+
inverse: string;
|
|
128
|
+
outline: string;
|
|
129
|
+
ghost: string;
|
|
130
|
+
secondary: string;
|
|
131
|
+
link: string;
|
|
132
|
+
icon: string;
|
|
133
|
+
destructive: string;
|
|
134
|
+
success: string;
|
|
135
|
+
};
|
|
136
|
+
size: {
|
|
137
|
+
default: string;
|
|
138
|
+
sm: string;
|
|
139
|
+
lg: string;
|
|
140
|
+
icon: string;
|
|
141
|
+
"icon-sm": string;
|
|
142
|
+
"icon-lg": string;
|
|
143
|
+
};
|
|
144
|
+
}>, unknown, unknown, undefined>>;
|
|
145
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
146
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
147
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
|
|
148
|
+
variant?: ButtonVariant;
|
|
149
|
+
size?: ButtonSize;
|
|
150
|
+
loading?: boolean;
|
|
151
|
+
};
|
|
152
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
|
|
153
|
+
type Button = ReturnType<typeof Button>;
|
|
154
|
+
export default Button;
|