@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 { HTMLSelectAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
4
|
-
export type NativeSelectOption<V = string> = {
|
|
5
|
-
value: V;
|
|
6
|
-
label: string;
|
|
7
|
-
/**
|
|
8
|
-
* The `<optgroup>` the option sits in. Options with the same group share
|
|
9
|
-
* one, in the order each group first appears; options without one come
|
|
10
|
-
* first.
|
|
11
|
-
*/
|
|
12
|
-
group?: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** From which width the label sits beside the well: 600px, 900px or 1200px. */
|
|
17
|
-
export type NativeSelectBreakpoint = 'medium' | 'expanded' | 'large';
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<script lang="ts" generics="V = string">
|
|
21
|
-
import type { Snippet } from 'svelte';
|
|
22
|
-
import { groupOptions } from './internal/groups.js';
|
|
23
|
-
|
|
24
|
-
const uid = $props.id();
|
|
25
|
-
|
|
26
|
-
let {
|
|
27
|
-
label,
|
|
28
|
-
value = $bindable(),
|
|
29
|
-
options,
|
|
30
|
-
labelBeside = false,
|
|
31
|
-
id = uid,
|
|
32
|
-
class: className,
|
|
33
|
-
children,
|
|
34
|
-
...rest
|
|
35
|
-
}: Omit<HTMLSelectAttributes, 'value' | 'multiple' | 'children'> & {
|
|
36
|
-
/** The caps field label. */
|
|
37
|
-
label: string;
|
|
38
|
-
/** The chosen option's value. Bindable. */
|
|
39
|
-
value?: V;
|
|
40
|
-
/** The choices. Without it, pass `<option>` elements as children. */
|
|
41
|
-
options?: NativeSelectOption<V>[];
|
|
42
|
-
/**
|
|
43
|
-
* The label sits above the well by default. `true` puts it beside the
|
|
44
|
-
* well at every width; a breakpoint puts it beside from that width up.
|
|
45
|
-
*/
|
|
46
|
-
labelBeside?: boolean | NativeSelectBreakpoint;
|
|
47
|
-
children?: Snippet;
|
|
48
|
-
} = $props();
|
|
49
|
-
|
|
50
|
-
const grouped = $derived(options && groupOptions(options));
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<!--
|
|
54
|
-
A single choice from a short fixed list. A native <select>, so phones keep
|
|
55
|
-
their own picker (BRIEF, Apps and phones). Extra attributes, handlers and
|
|
56
|
-
`class` go to the <select>.
|
|
57
|
-
-->
|
|
58
|
-
<div
|
|
59
|
-
class="hp-native-select"
|
|
60
|
-
data-label-beside={labelBeside === true ? 'always' : labelBeside || undefined}
|
|
61
|
-
>
|
|
62
|
-
<label class="hp-label" for={id}>{label}</label>
|
|
63
|
-
<span class="hp-well-chevron">
|
|
64
|
-
<select {...rest} {id} class={['hp-well', className]} bind:value>
|
|
65
|
-
{#if grouped}
|
|
66
|
-
{#each grouped.loose as option (option.value)}
|
|
67
|
-
<option value={option.value} disabled={option.disabled}>{option.label}</option>
|
|
68
|
-
{/each}
|
|
69
|
-
{#each grouped.groups as group (group.name)}
|
|
70
|
-
<optgroup label={group.name}>
|
|
71
|
-
{#each group.items as option (option.value)}
|
|
72
|
-
<option value={option.value} disabled={option.disabled}>{option.label}</option>
|
|
73
|
-
{/each}
|
|
74
|
-
</optgroup>
|
|
75
|
-
{/each}
|
|
76
|
-
{:else}
|
|
77
|
-
{@render children?.()}
|
|
78
|
-
{/if}
|
|
79
|
-
</select>
|
|
80
|
-
</span>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<style>
|
|
84
|
-
.hp-native-select {
|
|
85
|
-
display: grid;
|
|
86
|
-
gap: var(--space-1);
|
|
87
|
-
min-width: 0;
|
|
88
|
-
}
|
|
89
|
-
label {
|
|
90
|
-
color: var(--muted);
|
|
91
|
-
}
|
|
92
|
-
/* The well fills its column, never narrower than a short choice and the
|
|
93
|
-
chevron. The wrapper is the grid or flex item, so it holds the minimum;
|
|
94
|
-
a select's own minimum would be its longest option. */
|
|
95
|
-
.hp-well-chevron {
|
|
96
|
-
width: 100%;
|
|
97
|
-
min-width: 136px;
|
|
98
|
-
}
|
|
99
|
-
select {
|
|
100
|
-
display: block;
|
|
101
|
-
width: 100%;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* Beside the well, the label keeps its one line and the well gives way. */
|
|
105
|
-
[data-label-beside] label {
|
|
106
|
-
flex: none;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
[data-label-beside='always'] {
|
|
110
|
-
display: flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
gap: var(--space-2);
|
|
113
|
-
}
|
|
114
|
-
@media (min-width: 600px) {
|
|
115
|
-
[data-label-beside='medium'] {
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
gap: var(--space-2);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
@media (min-width: 900px) {
|
|
122
|
-
[data-label-beside='expanded'] {
|
|
123
|
-
display: flex;
|
|
124
|
-
align-items: center;
|
|
125
|
-
gap: var(--space-2);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
@media (min-width: 1200px) {
|
|
129
|
-
[data-label-beside='large'] {
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
gap: var(--space-2);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
</style>
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
export type NativeSelectOption<V = string> = {
|
|
5
|
+
value: V;
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The `<optgroup>` the option sits in. Options with the same group share
|
|
9
|
+
* one, in the order each group first appears; options without one come
|
|
10
|
+
* first.
|
|
11
|
+
*/
|
|
12
|
+
group?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** From which width the label sits beside the well: 600px, 900px or 1200px. */
|
|
17
|
+
export type NativeSelectBreakpoint = 'medium' | 'expanded' | 'large';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" generics="V = string">
|
|
21
|
+
import type { Snippet } from 'svelte';
|
|
22
|
+
import { groupOptions } from './internal/groups.js';
|
|
23
|
+
|
|
24
|
+
const uid = $props.id();
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
label,
|
|
28
|
+
value = $bindable(),
|
|
29
|
+
options,
|
|
30
|
+
labelBeside = false,
|
|
31
|
+
id = uid,
|
|
32
|
+
class: className,
|
|
33
|
+
children,
|
|
34
|
+
...rest
|
|
35
|
+
}: Omit<HTMLSelectAttributes, 'value' | 'multiple' | 'children'> & {
|
|
36
|
+
/** The caps field label. */
|
|
37
|
+
label: string;
|
|
38
|
+
/** The chosen option's value. Bindable. */
|
|
39
|
+
value?: V;
|
|
40
|
+
/** The choices. Without it, pass `<option>` elements as children. */
|
|
41
|
+
options?: NativeSelectOption<V>[];
|
|
42
|
+
/**
|
|
43
|
+
* The label sits above the well by default. `true` puts it beside the
|
|
44
|
+
* well at every width; a breakpoint puts it beside from that width up.
|
|
45
|
+
*/
|
|
46
|
+
labelBeside?: boolean | NativeSelectBreakpoint;
|
|
47
|
+
children?: Snippet;
|
|
48
|
+
} = $props();
|
|
49
|
+
|
|
50
|
+
const grouped = $derived(options && groupOptions(options));
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<!--
|
|
54
|
+
A single choice from a short fixed list. A native <select>, so phones keep
|
|
55
|
+
their own picker (BRIEF, Apps and phones). Extra attributes, handlers and
|
|
56
|
+
`class` go to the <select>.
|
|
57
|
+
-->
|
|
58
|
+
<div
|
|
59
|
+
class="hp-native-select"
|
|
60
|
+
data-label-beside={labelBeside === true ? 'always' : labelBeside || undefined}
|
|
61
|
+
>
|
|
62
|
+
<label class="hp-label" for={id}>{label}</label>
|
|
63
|
+
<span class="hp-well-chevron">
|
|
64
|
+
<select {...rest} {id} class={['hp-well', className]} bind:value>
|
|
65
|
+
{#if grouped}
|
|
66
|
+
{#each grouped.loose as option (option.value)}
|
|
67
|
+
<option value={option.value} disabled={option.disabled}>{option.label}</option>
|
|
68
|
+
{/each}
|
|
69
|
+
{#each grouped.groups as group (group.name)}
|
|
70
|
+
<optgroup label={group.name}>
|
|
71
|
+
{#each group.items as option (option.value)}
|
|
72
|
+
<option value={option.value} disabled={option.disabled}>{option.label}</option>
|
|
73
|
+
{/each}
|
|
74
|
+
</optgroup>
|
|
75
|
+
{/each}
|
|
76
|
+
{:else}
|
|
77
|
+
{@render children?.()}
|
|
78
|
+
{/if}
|
|
79
|
+
</select>
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
.hp-native-select {
|
|
85
|
+
display: grid;
|
|
86
|
+
gap: var(--space-1);
|
|
87
|
+
min-width: 0;
|
|
88
|
+
}
|
|
89
|
+
label {
|
|
90
|
+
color: var(--muted);
|
|
91
|
+
}
|
|
92
|
+
/* The well fills its column, never narrower than a short choice and the
|
|
93
|
+
chevron. The wrapper is the grid or flex item, so it holds the minimum;
|
|
94
|
+
a select's own minimum would be its longest option. */
|
|
95
|
+
.hp-well-chevron {
|
|
96
|
+
width: 100%;
|
|
97
|
+
min-width: 136px;
|
|
98
|
+
}
|
|
99
|
+
select {
|
|
100
|
+
display: block;
|
|
101
|
+
width: 100%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Beside the well, the label keeps its one line and the well gives way. */
|
|
105
|
+
[data-label-beside] label {
|
|
106
|
+
flex: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-label-beside='always'] {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: var(--space-2);
|
|
113
|
+
}
|
|
114
|
+
@media (min-width: 600px) {
|
|
115
|
+
[data-label-beside='medium'] {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--space-2);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
@media (min-width: 900px) {
|
|
122
|
+
[data-label-beside='expanded'] {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: var(--space-2);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
@media (min-width: 1200px) {
|
|
129
|
+
[data-label-beside='large'] {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: var(--space-2);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</style>
|