@mystravil/hardpoint 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -38
- package/LICENSE +25 -25
- package/README.md +67 -64
- package/dist/base.css +625 -625
- package/dist/components/AppShell.svelte +698 -698
- package/dist/components/Button.svelte +174 -174
- package/dist/components/Checkbox.svelte +235 -235
- package/dist/components/CheckboxGroup.svelte +207 -207
- package/dist/components/Combobox.svelte +901 -901
- package/dist/components/Dialog.svelte +359 -359
- package/dist/components/Disclosure.svelte +201 -201
- package/dist/components/EmptyState.svelte +88 -88
- package/dist/components/ErrorState.svelte +135 -135
- package/dist/components/ImageViewer.svelte +764 -764
- package/dist/components/KeyValueList.svelte +114 -114
- package/dist/components/ListDetail.svelte +218 -218
- package/dist/components/LoadRegion.svelte +219 -219
- package/dist/components/MediaFrame.svelte +110 -110
- package/dist/components/MediaImage.svelte +256 -256
- package/dist/components/Menu.svelte +258 -258
- package/dist/components/MenuCheckboxItem.svelte +119 -119
- package/dist/components/MenuGroup.svelte +50 -50
- package/dist/components/MenuItem.svelte +94 -94
- package/dist/components/MenuRadioGroup.svelte +62 -62
- package/dist/components/MenuRadioItem.svelte +110 -110
- package/dist/components/MenuSeparator.svelte +28 -28
- package/dist/components/Meter.svelte +283 -283
- package/dist/components/NativeSelect.svelte +135 -135
- package/dist/components/Notice.svelte +262 -262
- package/dist/components/Popover.svelte +222 -222
- package/dist/components/Progress.svelte +157 -157
- package/dist/components/RadioGroup.svelte +440 -440
- package/dist/components/Select.svelte +471 -471
- package/dist/components/Skeleton.svelte +149 -149
- package/dist/components/Spinner.svelte +118 -118
- package/dist/components/Stat.svelte +253 -253
- package/dist/components/Steps.svelte +189 -189
- package/dist/components/Switch.svelte +222 -222
- package/dist/components/Table.svelte +504 -504
- package/dist/components/Tabs.svelte +246 -246
- package/dist/components/Tag.svelte +40 -40
- package/dist/components/TextArea.svelte +272 -272
- package/dist/components/TextField.svelte +256 -256
- package/dist/components/Timeline.svelte +156 -156
- package/dist/components/Toaster.svelte +411 -411
- package/dist/components/Tooltip.svelte +200 -200
- package/dist/components/TooltipGroup.svelte +46 -46
- package/dist/components/internal/Scrim.svelte +52 -52
- package/dist/components/internal/Sheet.svelte +263 -263
- package/dist/fonts.css +71 -71
- package/dist/tokens.css +283 -283
- package/package.json +81 -76
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* `standard` (default): the title at the section-title size. `display`:
|
|
7
|
-
* the title in Geist Pixel Square, as the screen's one display line.
|
|
8
|
-
*/
|
|
9
|
-
export type ErrorStateVariant = 'standard' | 'display';
|
|
10
|
-
|
|
11
|
-
/** The title's element: `p` by default, a heading where the state names a region of the page. */
|
|
12
|
-
export type ErrorStateTitleElement = 'p' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
13
|
-
|
|
14
|
-
export type ErrorStateProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> & {
|
|
15
|
-
/** What failed, as a short line: `Couldn't load projects`. Never transformed. */
|
|
16
|
-
title: string;
|
|
17
|
-
/** How to fix it: `Check your connection, then try again.` Errors never apologise. */
|
|
18
|
-
description?: string;
|
|
19
|
-
/** Shows a retry button that calls this. */
|
|
20
|
-
onretry?: () => void;
|
|
21
|
-
/** The retry button's label. Defaults to `Try again`. */
|
|
22
|
-
retryLabel?: string;
|
|
23
|
-
/** A fix that is not a retry, such as signing in again: render a `Button` here. It follows the retry button. */
|
|
24
|
-
action?: Snippet;
|
|
25
|
-
titleAs?: ErrorStateTitleElement;
|
|
26
|
-
variant?: ErrorStateVariant;
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
import Button from './Button.svelte';
|
|
32
|
-
|
|
33
|
-
let {
|
|
34
|
-
title,
|
|
35
|
-
description,
|
|
36
|
-
onretry,
|
|
37
|
-
retryLabel = 'Try again',
|
|
38
|
-
action,
|
|
39
|
-
titleAs = 'p',
|
|
40
|
-
variant = 'standard',
|
|
41
|
-
class: className,
|
|
42
|
-
...rest
|
|
43
|
-
}: ErrorStateProps = $props();
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<!--
|
|
47
|
-
A data view that failed to load, shown where its content would be (BRIEF,
|
|
48
|
-
Apps and phones: States): what failed, how to fix it, and a retry action.
|
|
49
|
-
The title carries an outlined square with a "!" in the status red, so the
|
|
50
|
-
state never rests on colour alone; the text stays in the two inks. The
|
|
51
|
-
title and description sit in a role="alert" region, so a screen reader
|
|
52
|
-
announces the failure when the state replaces the content; the actions
|
|
53
|
-
stay outside it. It sets no outer margin. Extra attributes and `class` go
|
|
54
|
-
to the root `div.hp-error-state`.
|
|
55
|
-
-->
|
|
56
|
-
<div {...rest} class={['hp-error-state', className]} data-variant={variant}>
|
|
57
|
-
<div class="hp-error-state-message" role="alert">
|
|
58
|
-
<svelte:element
|
|
59
|
-
this={titleAs}
|
|
60
|
-
class={['hp-error-state-title', variant === 'display' ? 'hp-pixel' : 'hp-section-title']}
|
|
61
|
-
>
|
|
62
|
-
<span class="hp-error-state-icon" aria-hidden="true">
|
|
63
|
-
<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor">
|
|
64
|
-
<path d="M1.5 1.5h13v13h-13z" />
|
|
65
|
-
<path d="M8 4v4M8 10v2" stroke-width="2" />
|
|
66
|
-
</svg>
|
|
67
|
-
</span>
|
|
68
|
-
<span>{title}</span>
|
|
69
|
-
</svelte:element>
|
|
70
|
-
{#if description}
|
|
71
|
-
<p class="hp-error-state-description">{description}</p>
|
|
72
|
-
{/if}
|
|
73
|
-
</div>
|
|
74
|
-
{#if onretry || action}
|
|
75
|
-
<div class="hp-error-state-actions">
|
|
76
|
-
{#if onretry}
|
|
77
|
-
<!-- type="button", so a retry inside a form never submits it. -->
|
|
78
|
-
<Button type="button" onclick={onretry}>{retryLabel}</Button>
|
|
79
|
-
{/if}
|
|
80
|
-
{@render action?.()}
|
|
81
|
-
</div>
|
|
82
|
-
{/if}
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<style>
|
|
86
|
-
.hp-error-state {
|
|
87
|
-
display: grid;
|
|
88
|
-
justify-items: start;
|
|
89
|
-
min-width: 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.hp-error-state-message {
|
|
93
|
-
display: grid;
|
|
94
|
-
justify-items: start;
|
|
95
|
-
gap: var(--space-2);
|
|
96
|
-
max-width: 100%;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/* The icon hangs before the title's first line, as on a field error. */
|
|
100
|
-
.hp-error-state-title {
|
|
101
|
-
display: flex;
|
|
102
|
-
gap: var(--space-2);
|
|
103
|
-
max-width: 100%;
|
|
104
|
-
overflow-wrap: anywhere;
|
|
105
|
-
}
|
|
106
|
-
/* One line box high, so the icon centres on the first line of the title
|
|
107
|
-
however it wraps. */
|
|
108
|
-
.hp-error-state-icon {
|
|
109
|
-
display: flex;
|
|
110
|
-
flex: none;
|
|
111
|
-
align-items: center;
|
|
112
|
-
height: 1lh;
|
|
113
|
-
color: var(--danger);
|
|
114
|
-
}
|
|
115
|
-
.hp-error-state-icon svg {
|
|
116
|
-
display: block;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/* Reading text: 16px at every width, in the reading measure. */
|
|
120
|
-
.hp-error-state-description {
|
|
121
|
-
max-width: var(--measure);
|
|
122
|
-
color: var(--muted);
|
|
123
|
-
font-size: var(--type-body);
|
|
124
|
-
line-height: 24px;
|
|
125
|
-
overflow-wrap: anywhere;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* The actions are their own group: three times the gap inside the text. */
|
|
129
|
-
.hp-error-state-actions {
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-wrap: wrap;
|
|
132
|
-
gap: var(--space-2);
|
|
133
|
-
margin-top: var(--space-6);
|
|
134
|
-
}
|
|
135
|
-
</style>
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `standard` (default): the title at the section-title size. `display`:
|
|
7
|
+
* the title in Geist Pixel Square, as the screen's one display line.
|
|
8
|
+
*/
|
|
9
|
+
export type ErrorStateVariant = 'standard' | 'display';
|
|
10
|
+
|
|
11
|
+
/** The title's element: `p` by default, a heading where the state names a region of the page. */
|
|
12
|
+
export type ErrorStateTitleElement = 'p' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
13
|
+
|
|
14
|
+
export type ErrorStateProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> & {
|
|
15
|
+
/** What failed, as a short line: `Couldn't load projects`. Never transformed. */
|
|
16
|
+
title: string;
|
|
17
|
+
/** How to fix it: `Check your connection, then try again.` Errors never apologise. */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Shows a retry button that calls this. */
|
|
20
|
+
onretry?: () => void;
|
|
21
|
+
/** The retry button's label. Defaults to `Try again`. */
|
|
22
|
+
retryLabel?: string;
|
|
23
|
+
/** A fix that is not a retry, such as signing in again: render a `Button` here. It follows the retry button. */
|
|
24
|
+
action?: Snippet;
|
|
25
|
+
titleAs?: ErrorStateTitleElement;
|
|
26
|
+
variant?: ErrorStateVariant;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
import Button from './Button.svelte';
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
onretry,
|
|
37
|
+
retryLabel = 'Try again',
|
|
38
|
+
action,
|
|
39
|
+
titleAs = 'p',
|
|
40
|
+
variant = 'standard',
|
|
41
|
+
class: className,
|
|
42
|
+
...rest
|
|
43
|
+
}: ErrorStateProps = $props();
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<!--
|
|
47
|
+
A data view that failed to load, shown where its content would be (BRIEF,
|
|
48
|
+
Apps and phones: States): what failed, how to fix it, and a retry action.
|
|
49
|
+
The title carries an outlined square with a "!" in the status red, so the
|
|
50
|
+
state never rests on colour alone; the text stays in the two inks. The
|
|
51
|
+
title and description sit in a role="alert" region, so a screen reader
|
|
52
|
+
announces the failure when the state replaces the content; the actions
|
|
53
|
+
stay outside it. It sets no outer margin. Extra attributes and `class` go
|
|
54
|
+
to the root `div.hp-error-state`.
|
|
55
|
+
-->
|
|
56
|
+
<div {...rest} class={['hp-error-state', className]} data-variant={variant}>
|
|
57
|
+
<div class="hp-error-state-message" role="alert">
|
|
58
|
+
<svelte:element
|
|
59
|
+
this={titleAs}
|
|
60
|
+
class={['hp-error-state-title', variant === 'display' ? 'hp-pixel' : 'hp-section-title']}
|
|
61
|
+
>
|
|
62
|
+
<span class="hp-error-state-icon" aria-hidden="true">
|
|
63
|
+
<svg viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor">
|
|
64
|
+
<path d="M1.5 1.5h13v13h-13z" />
|
|
65
|
+
<path d="M8 4v4M8 10v2" stroke-width="2" />
|
|
66
|
+
</svg>
|
|
67
|
+
</span>
|
|
68
|
+
<span>{title}</span>
|
|
69
|
+
</svelte:element>
|
|
70
|
+
{#if description}
|
|
71
|
+
<p class="hp-error-state-description">{description}</p>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
{#if onretry || action}
|
|
75
|
+
<div class="hp-error-state-actions">
|
|
76
|
+
{#if onretry}
|
|
77
|
+
<!-- type="button", so a retry inside a form never submits it. -->
|
|
78
|
+
<Button type="button" onclick={onretry}>{retryLabel}</Button>
|
|
79
|
+
{/if}
|
|
80
|
+
{@render action?.()}
|
|
81
|
+
</div>
|
|
82
|
+
{/if}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.hp-error-state {
|
|
87
|
+
display: grid;
|
|
88
|
+
justify-items: start;
|
|
89
|
+
min-width: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.hp-error-state-message {
|
|
93
|
+
display: grid;
|
|
94
|
+
justify-items: start;
|
|
95
|
+
gap: var(--space-2);
|
|
96
|
+
max-width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* The icon hangs before the title's first line, as on a field error. */
|
|
100
|
+
.hp-error-state-title {
|
|
101
|
+
display: flex;
|
|
102
|
+
gap: var(--space-2);
|
|
103
|
+
max-width: 100%;
|
|
104
|
+
overflow-wrap: anywhere;
|
|
105
|
+
}
|
|
106
|
+
/* One line box high, so the icon centres on the first line of the title
|
|
107
|
+
however it wraps. */
|
|
108
|
+
.hp-error-state-icon {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex: none;
|
|
111
|
+
align-items: center;
|
|
112
|
+
height: 1lh;
|
|
113
|
+
color: var(--danger);
|
|
114
|
+
}
|
|
115
|
+
.hp-error-state-icon svg {
|
|
116
|
+
display: block;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Reading text: 16px at every width, in the reading measure. */
|
|
120
|
+
.hp-error-state-description {
|
|
121
|
+
max-width: var(--measure);
|
|
122
|
+
color: var(--muted);
|
|
123
|
+
font-size: var(--type-body);
|
|
124
|
+
line-height: 24px;
|
|
125
|
+
overflow-wrap: anywhere;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* The actions are their own group: three times the gap inside the text. */
|
|
129
|
+
.hp-error-state-actions {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-wrap: wrap;
|
|
132
|
+
gap: var(--space-2);
|
|
133
|
+
margin-top: var(--space-6);
|
|
134
|
+
}
|
|
135
|
+
</style>
|