@diegopluna/narvi 0.3.3 → 0.3.5
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/dist/components/app-shell/AppShellMain.svelte +14 -2
- package/dist/components/app-shell/AppShellPanel.svelte +108 -12
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +11 -1
- package/dist/components/app-shell/AppShellSheet.svelte +11 -1
- package/dist/components/app-shell/context.d.ts +8 -0
- package/dist/components/app-shell/context.js +7 -0
- package/dist/components/avatar/AvatarRoot.svelte +20 -7
- package/dist/components/avatar/AvatarRoot.svelte.d.ts +10 -3
- package/dist/components/badge/Badge.svelte +13 -1
- package/dist/components/badge/Badge.svelte.d.ts +6 -0
- package/dist/components/button/Button.svelte +71 -32
- package/dist/components/button/Button.svelte.d.ts +13 -0
- package/dist/components/command/CommandDialog.svelte +24 -2
- package/dist/components/command/CommandDialog.svelte.d.ts +12 -0
- package/dist/components/command/CommandItem.svelte +15 -4
- package/dist/components/command/CommandItem.svelte.d.ts +20 -4
- package/dist/components/command/CommandRoot.svelte +57 -2
- package/dist/components/command/CommandRoot.svelte.d.ts +25 -1
- package/dist/components/composer/ComposerModelPicker.svelte +608 -53
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +56 -1
- package/dist/components/composer/ComposerRoot.svelte.d.ts +1 -1
- package/dist/components/composer/ComposerSubmit.svelte +12 -2
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +6 -0
- package/dist/components/composer/index.d.ts +1 -1
- package/dist/components/input/Input.svelte.d.ts +1 -1
- package/dist/components/menu/MenuCheckboxItem.svelte +14 -5
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +15 -4
- package/dist/components/menu/MenuItem.svelte +9 -3
- package/dist/components/menu/MenuItem.svelte.d.ts +11 -4
- package/dist/components/menu/MenuRadioItem.svelte +18 -9
- package/dist/components/menu/MenuRadioItem.svelte.d.ts +15 -4
- package/dist/components/menu/MenuSubTrigger.svelte +9 -3
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +11 -4
- package/dist/components/questionnaire/Questionnaire.svelte +100 -9
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +11 -0
- package/dist/components/segmented/SegmentedControl.svelte +12 -1
- package/dist/components/segmented/SegmentedControl.svelte.d.ts +3 -1
- package/dist/components/select/Select.svelte +36 -5
- package/dist/components/select/Select.svelte.d.ts +12 -0
- package/dist/components/settings-row/SettingsRow.svelte +87 -37
- package/dist/components/settings-row/SettingsRow.svelte.d.ts +13 -0
- package/dist/components/slider/Slider.svelte.d.ts +2 -2
- package/dist/components/split-button/SplitButton.svelte +147 -0
- package/dist/components/split-button/SplitButton.svelte.d.ts +36 -0
- package/dist/components/tab-strip/TabStrip.svelte +410 -109
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +51 -3
- package/dist/components/tab-strip/drag.svelte.d.ts +31 -0
- package/dist/components/tab-strip/drag.svelte.js +148 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +1 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/internal/ItemDescription.svelte +34 -0
- package/dist/internal/ItemDescription.svelte.d.ts +10 -0
- package/dist/internal/roving.d.ts +3 -1
- package/dist/internal/roving.js +6 -3
- package/dist/media.stylex.d.ts +6 -0
- package/dist/media.stylex.js +6 -0
- package/dist/vite.js +4 -0
- package/package.json +20 -1
- package/skills/building-ui/SKILL.md +48 -20
- package/skills/building-ui/references/components.md +43 -42
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +11 -2
- package/skills/theming/SKILL.md +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import type { IconComponent } from '../../internal/icon.js';
|
|
4
|
+
import '../../internal/icons.css';
|
|
2
5
|
import { type Sx } from '../../internal/sx.js';
|
|
3
6
|
export type ComposerModel = {
|
|
4
7
|
value: string;
|
|
@@ -9,8 +12,23 @@ export type ComposerModel = {
|
|
|
9
12
|
group?: string | undefined;
|
|
10
13
|
/** A short tag beside the name, such as "New". */
|
|
11
14
|
badge?: string | undefined;
|
|
15
|
+
/** With `providers`, the value of the provider it comes from, whose models it is listed with. */
|
|
16
|
+
provider?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Superseded by a newer model: folded with the other older ones into one row at the end of
|
|
19
|
+
* the list, or of its provider's, until that row is opened. A search shows it as any other.
|
|
20
|
+
*/
|
|
21
|
+
older?: boolean | undefined;
|
|
12
22
|
disabled?: boolean | undefined;
|
|
13
23
|
};
|
|
24
|
+
/** Who a model comes from, one to a button in the rail beside the list: an agent, a provider. */
|
|
25
|
+
export type ComposerModelProvider = {
|
|
26
|
+
value: string;
|
|
27
|
+
/** Its name, given to its button and said with the list as it is shown. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Its mark in the rail, a component such as a Lucide icon, sized to 16px. */
|
|
30
|
+
icon?: IconComponent | undefined;
|
|
31
|
+
};
|
|
14
32
|
type PickerBase = Omit<HTMLButtonAttributes, 'children' | 'value' | 'onchange'> & {
|
|
15
33
|
models: ComposerModel[];
|
|
16
34
|
/** What is being chosen. Names the list, and is read before the model on the button. */
|
|
@@ -19,6 +37,33 @@ type PickerBase = Omit<HTMLButtonAttributes, 'children' | 'value' | 'onchange'>
|
|
|
19
37
|
open?: boolean | undefined;
|
|
20
38
|
/** Called when the list opens or closes. */
|
|
21
39
|
onopenchange?: ((open: boolean) => void) | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Who the models come from. With more than one, a rail of them stands beside the list, and
|
|
42
|
+
* the list shows the models of the one chosen there, by each model's `provider`. It opens
|
|
43
|
+
* on the chosen model's.
|
|
44
|
+
*/
|
|
45
|
+
providers?: ComposerModelProvider[] | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Draws a provider's mark in the rail, in place of `provider.icon`: for a mark that takes
|
|
48
|
+
* props, or one with a badge of its own. It is sized as a 16px icon.
|
|
49
|
+
*/
|
|
50
|
+
providerIcon?: Snippet<[provider: ComposerModelProvider]> | undefined;
|
|
51
|
+
/** Names the rail of providers. */
|
|
52
|
+
providersLabel?: string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* A field over the list that searches every model by its name, value, group and provider,
|
|
55
|
+
* past the rail. It takes focus as the list opens.
|
|
56
|
+
*/
|
|
57
|
+
searchable?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The values of the starred models. Bindable. Given, each model can be starred, with its
|
|
60
|
+
* star or ⌘D, and with `providers` the starred ones are listed together at the top of the rail.
|
|
61
|
+
*/
|
|
62
|
+
starred?: string[] | undefined;
|
|
63
|
+
/** Called as a model is starred or unstarred. */
|
|
64
|
+
onstar?: ((value: string, starred: boolean) => void) | undefined;
|
|
65
|
+
/** Its words: the search field's name, what no match says, and a star's two states. */
|
|
66
|
+
labels?: Partial<Record<'search' | 'noMatch' | 'starred' | 'unstarred' | 'older' | 'alsoHint', string>> | undefined;
|
|
22
67
|
sx?: Sx | undefined;
|
|
23
68
|
ref?: HTMLButtonElement | null | undefined;
|
|
24
69
|
};
|
|
@@ -30,6 +75,14 @@ export type ComposerModelPickerProps = PickerBase & ({
|
|
|
30
75
|
/** Called when the person picks a model. */
|
|
31
76
|
onchange?: ((value: string) => void) | undefined;
|
|
32
77
|
placeholder?: undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The models beside the chosen one, to send the prompt to each too. Bindable. Given,
|
|
80
|
+
* Shift, ⌘ or Ctrl with a click or Enter adds a model beside the chosen one, or takes
|
|
81
|
+
* it off, and the list stays open.
|
|
82
|
+
*/
|
|
83
|
+
also?: string[] | undefined;
|
|
84
|
+
/** Called with the models beside the chosen one as one is added or taken off. */
|
|
85
|
+
onalso?: ((values: string[]) => void) | undefined;
|
|
33
86
|
} | {
|
|
34
87
|
multiple: true;
|
|
35
88
|
/** The chosen models' values, in the order of `models`. Bindable. */
|
|
@@ -38,7 +91,9 @@ export type ComposerModelPickerProps = PickerBase & ({
|
|
|
38
91
|
onchange?: ((value: string[]) => void) | undefined;
|
|
39
92
|
/** What the button says while none is chosen. */
|
|
40
93
|
placeholder?: string | undefined;
|
|
94
|
+
also?: undefined;
|
|
95
|
+
onalso?: undefined;
|
|
41
96
|
});
|
|
42
|
-
declare const ComposerModelPicker: import("svelte").Component<ComposerModelPickerProps, {}, "value" | "
|
|
97
|
+
declare const ComposerModelPicker: import("svelte").Component<ComposerModelPickerProps, {}, "ref" | "open" | "value" | "also" | "starred">;
|
|
43
98
|
type ComposerModelPicker = ReturnType<typeof ComposerModelPicker>;
|
|
44
99
|
export default ComposerModelPicker;
|
|
@@ -53,6 +53,6 @@ export type ComposerRootProps = Omit<HTMLFormAttributes, 'children' | 'onsubmit'
|
|
|
53
53
|
/** Composer.Attachments, a Composer.Textarea and a Composer.Toolbar. */
|
|
54
54
|
children?: Snippet | undefined;
|
|
55
55
|
};
|
|
56
|
-
declare const ComposerRoot: import("svelte").Component<ComposerRootProps, {}, "
|
|
56
|
+
declare const ComposerRoot: import("svelte").Component<ComposerRootProps, {}, "ref" | "value" | "files">;
|
|
57
57
|
type ComposerRoot = ReturnType<typeof ComposerRoot>;
|
|
58
58
|
export default ComposerRoot;
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
stopLabel?: string | undefined;
|
|
28
28
|
/** Accessible name while the composer is `sending`: the message is on its way and cannot be stopped. */
|
|
29
29
|
sendingLabel?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* What sending is doing, said beside the spinner while the composer is `sending`, such as
|
|
32
|
+
* "Creating worktree…". The button widens to the words, and they are its name until it
|
|
33
|
+
* is done. Without it the button keeps its size and shows the spinner alone.
|
|
34
|
+
*/
|
|
35
|
+
sendingText?: string | undefined;
|
|
30
36
|
sx?: Sx | undefined;
|
|
31
37
|
ref?: HTMLButtonElement | null | undefined;
|
|
32
38
|
};
|
|
@@ -80,6 +86,7 @@
|
|
|
80
86
|
sendLabel = 'Send',
|
|
81
87
|
stopLabel = 'Stop',
|
|
82
88
|
sendingLabel = 'Sending',
|
|
89
|
+
sendingText,
|
|
83
90
|
disabled,
|
|
84
91
|
sx,
|
|
85
92
|
ref = $bindable(null),
|
|
@@ -90,16 +97,19 @@
|
|
|
90
97
|
const sending = $derived(composer.sending);
|
|
91
98
|
const busy = $derived(composer.busy && !sending);
|
|
92
99
|
const idle = $derived(!busy && !sending && !composer.canSend);
|
|
100
|
+
// Words beside the spinner: the button is no longer a square for one icon
|
|
101
|
+
const says = $derived(sending && !!sendingText);
|
|
93
102
|
</script>
|
|
94
103
|
|
|
95
104
|
<Button
|
|
96
105
|
bind:ref={() => ref, (el) => (ref = el as HTMLButtonElement | null)}
|
|
97
106
|
type="submit"
|
|
98
107
|
variant="primary"
|
|
99
|
-
iconOnly
|
|
100
|
-
aria-label={sending ? sendingLabel : busy ? stopLabel : sendLabel}
|
|
108
|
+
iconOnly={!says}
|
|
109
|
+
aria-label={says ? sendingText : sending ? sendingLabel : busy ? stopLabel : sendLabel}
|
|
101
110
|
disabled={disabled ?? (composer.disabled || (!busy && !sending && !composer.canSend))}
|
|
102
111
|
loading={sending}
|
|
112
|
+
loadingLabel={says ? sendingText : undefined}
|
|
103
113
|
data-slot="composer-submit"
|
|
104
114
|
data-status={composer.status}
|
|
105
115
|
data-sending={sending || undefined}
|
|
@@ -7,6 +7,12 @@ export type ComposerSubmitProps = Omit<ButtonProps, 'children' | 'type' | 'varia
|
|
|
7
7
|
stopLabel?: string | undefined;
|
|
8
8
|
/** Accessible name while the composer is `sending`: the message is on its way and cannot be stopped. */
|
|
9
9
|
sendingLabel?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* What sending is doing, said beside the spinner while the composer is `sending`, such as
|
|
12
|
+
* "Creating worktree…". The button widens to the words, and they are its name until it
|
|
13
|
+
* is done. Without it the button keeps its size and shows the spinner alone.
|
|
14
|
+
*/
|
|
15
|
+
sendingText?: string | undefined;
|
|
10
16
|
sx?: Sx | undefined;
|
|
11
17
|
ref?: HTMLButtonElement | null | undefined;
|
|
12
18
|
};
|
|
@@ -14,7 +14,7 @@ export type { ComposerContext, ComposerMessage, ComposerRejection, ComposerStatu
|
|
|
14
14
|
export type { ComposerAttachButtonProps } from './ComposerAttachButton.svelte';
|
|
15
15
|
export type { ComposerAttachmentProps } from './ComposerAttachment.svelte';
|
|
16
16
|
export type { ComposerAttachmentsProps } from './ComposerAttachments.svelte';
|
|
17
|
-
export type { ComposerModel, ComposerModelPickerProps } from './ComposerModelPicker.svelte';
|
|
17
|
+
export type { ComposerModel, ComposerModelPickerProps, ComposerModelProvider } from './ComposerModelPicker.svelte';
|
|
18
18
|
export type { ComposerRootProps } from './ComposerRoot.svelte';
|
|
19
19
|
export type { ComposerSubmitProps } from './ComposerSubmit.svelte';
|
|
20
20
|
export type { ComposerTextareaProps } from './ComposerTextarea.svelte';
|
|
@@ -24,6 +24,6 @@ export type InputProps = Omit<HTMLInputAttributes, 'size' | 'children'> & {
|
|
|
24
24
|
inputClass?: ClassValue | null | undefined;
|
|
25
25
|
ref?: HTMLInputElement | null | undefined;
|
|
26
26
|
};
|
|
27
|
-
declare const Input: import("svelte").Component<InputProps, {}, "
|
|
27
|
+
declare const Input: import("svelte").Component<InputProps, {}, "ref" | "value">;
|
|
28
28
|
type Input = ReturnType<typeof Input>;
|
|
29
29
|
export default Input;
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import Glyph from '../../internal/Glyph.svelte';
|
|
7
|
+
import ItemDescription, {
|
|
8
|
+
type ItemDescriptionContent
|
|
9
|
+
} from '../../internal/ItemDescription.svelte';
|
|
7
10
|
import { layer } from '../../internal/layer.js';
|
|
8
11
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
9
12
|
import { colors } from '../../tokens.stylex.js';
|
|
@@ -17,8 +20,13 @@
|
|
|
17
20
|
* to the end of the row, so the icons line up down the menu.
|
|
18
21
|
*/
|
|
19
22
|
icon?: Snippet | undefined;
|
|
20
|
-
/**
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A line under the label, such as what the setting does. Words, or a snippet for words with an icon
|
|
25
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
26
|
+
*/
|
|
27
|
+
description?: ItemDescriptionContent | undefined;
|
|
28
|
+
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
29
|
+
trailing?: Snippet | undefined;
|
|
22
30
|
sx?: Sx | undefined;
|
|
23
31
|
children?: Snippet | undefined;
|
|
24
32
|
}
|
|
@@ -42,6 +50,7 @@
|
|
|
42
50
|
shortcut,
|
|
43
51
|
icon,
|
|
44
52
|
description,
|
|
53
|
+
trailing,
|
|
45
54
|
// Picking it closes the menu, as a radio item's does: one left open takes the next click
|
|
46
55
|
// that was meant for the page. Pass `false` for a menu of settings set several at a time.
|
|
47
56
|
closeOnSelect = true,
|
|
@@ -70,14 +79,14 @@
|
|
|
70
79
|
{#if description}
|
|
71
80
|
<span {...stylex.attrs(layer.text)}>
|
|
72
81
|
<span {...stylex.attrs(layer.label)}>{@render label?.()}</span>
|
|
73
|
-
<
|
|
82
|
+
<ItemDescription {description} />
|
|
74
83
|
</span>
|
|
75
84
|
{:else}
|
|
76
85
|
<span {...stylex.attrs(layer.label)}>{@render label?.()}</span>
|
|
77
86
|
{/if}
|
|
78
|
-
{#if shortcut || icon}
|
|
87
|
+
{#if shortcut || trailing || icon}
|
|
79
88
|
<span {...stylex.attrs(layer.trailing)}>
|
|
80
|
-
{shortcut}
|
|
89
|
+
{shortcut}{@render trailing?.()}
|
|
81
90
|
{#if icon}
|
|
82
91
|
<span data-slot="menu-check" {...stylex.attrs(styles.check)}>
|
|
83
92
|
{#if checked}<Glyph name="check" stroke={1.75} />{/if}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Loose } from '../../internal/loose.js';
|
|
2
2
|
import { DropdownMenu } from 'bits-ui';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
4
5
|
import { type Sx } from '../../internal/sx.js';
|
|
5
6
|
export type MenuCheckboxItemProps = Loose<Omit<DropdownMenu.CheckboxItemProps, 'children' | 'child'> & {
|
|
6
7
|
/** The keys that do the same, shown at the end, such as "⌘D". */
|
|
@@ -10,8 +11,13 @@ export type MenuCheckboxItemProps = Loose<Omit<DropdownMenu.CheckboxItemProps, '
|
|
|
10
11
|
* to the end of the row, so the icons line up down the menu.
|
|
11
12
|
*/
|
|
12
13
|
icon?: Snippet | undefined;
|
|
13
|
-
/**
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A line under the label, such as what the setting does. Words, or a snippet for words with an icon
|
|
16
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
17
|
+
*/
|
|
18
|
+
description?: ItemDescriptionContent | undefined;
|
|
19
|
+
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
20
|
+
trailing?: Snippet | undefined;
|
|
15
21
|
sx?: Sx | undefined;
|
|
16
22
|
children?: Snippet | undefined;
|
|
17
23
|
}>;
|
|
@@ -23,8 +29,13 @@ declare const MenuCheckboxItem: import("svelte").Component<Loose<Omit<DropdownMe
|
|
|
23
29
|
* to the end of the row, so the icons line up down the menu.
|
|
24
30
|
*/
|
|
25
31
|
icon?: Snippet | undefined;
|
|
26
|
-
/**
|
|
27
|
-
|
|
32
|
+
/**
|
|
33
|
+
* A line under the label, such as what the setting does. Words, or a snippet for words with an icon
|
|
34
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
35
|
+
*/
|
|
36
|
+
description?: ItemDescriptionContent | undefined;
|
|
37
|
+
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
38
|
+
trailing?: Snippet | undefined;
|
|
28
39
|
sx?: Sx | undefined;
|
|
29
40
|
children?: Snippet | undefined;
|
|
30
41
|
}>, {}, "checked">;
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
import { DropdownMenu } from 'bits-ui';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
|
+
import ItemDescription, {
|
|
7
|
+
type ItemDescriptionContent
|
|
8
|
+
} from '../../internal/ItemDescription.svelte';
|
|
6
9
|
import { layer } from '../../internal/layer.js';
|
|
7
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
8
11
|
|
|
@@ -14,8 +17,11 @@
|
|
|
14
17
|
shortcut?: string | undefined;
|
|
15
18
|
/** A 16px icon before the label. */
|
|
16
19
|
icon?: Snippet | undefined;
|
|
17
|
-
/**
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A line under the label, such as what the action does. Words, or a snippet for words with an icon
|
|
22
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
23
|
+
*/
|
|
24
|
+
description?: ItemDescriptionContent | undefined;
|
|
19
25
|
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
20
26
|
trailing?: Snippet | undefined;
|
|
21
27
|
sx?: Sx | undefined;
|
|
@@ -48,7 +54,7 @@
|
|
|
48
54
|
{#if description}
|
|
49
55
|
<span {...stylex.attrs(layer.text)}>
|
|
50
56
|
<span {...stylex.attrs(layer.label)}>{@render children?.()}</span>
|
|
51
|
-
<
|
|
57
|
+
<ItemDescription {description} />
|
|
52
58
|
</span>
|
|
53
59
|
{:else}
|
|
54
60
|
<span {...stylex.attrs(layer.label)}>{@render children?.()}</span>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Loose } from '../../internal/loose.js';
|
|
2
2
|
import { DropdownMenu } from 'bits-ui';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
4
5
|
import { type Sx } from '../../internal/sx.js';
|
|
5
6
|
export type MenuItemProps = Loose<Omit<DropdownMenu.ItemProps, 'children' | 'child'> & {
|
|
6
7
|
/** `danger` for an action that destroys or cannot be undone. */
|
|
@@ -9,8 +10,11 @@ export type MenuItemProps = Loose<Omit<DropdownMenu.ItemProps, 'children' | 'chi
|
|
|
9
10
|
shortcut?: string | undefined;
|
|
10
11
|
/** A 16px icon before the label. */
|
|
11
12
|
icon?: Snippet | undefined;
|
|
12
|
-
/**
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A line under the label, such as what the action does. Words, or a snippet for words with an icon
|
|
15
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
16
|
+
*/
|
|
17
|
+
description?: ItemDescriptionContent | undefined;
|
|
14
18
|
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
15
19
|
trailing?: Snippet | undefined;
|
|
16
20
|
sx?: Sx | undefined;
|
|
@@ -23,8 +27,11 @@ declare const MenuItem: import("svelte").Component<Loose<Omit<DropdownMenu.ItemP
|
|
|
23
27
|
shortcut?: string | undefined;
|
|
24
28
|
/** A 16px icon before the label. */
|
|
25
29
|
icon?: Snippet | undefined;
|
|
26
|
-
/**
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* A line under the label, such as what the action does. Words, or a snippet for words with an icon
|
|
32
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
33
|
+
*/
|
|
34
|
+
description?: ItemDescriptionContent | undefined;
|
|
28
35
|
/** Something at the end, after the shortcut: a badge, a count, a status. */
|
|
29
36
|
trailing?: Snippet | undefined;
|
|
30
37
|
sx?: Sx | undefined;
|
|
@@ -3,18 +3,26 @@
|
|
|
3
3
|
import { DropdownMenu } from 'bits-ui';
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
|
+
import ItemDescription, {
|
|
7
|
+
type ItemDescriptionContent
|
|
8
|
+
} from '../../internal/ItemDescription.svelte';
|
|
6
9
|
import { layer } from '../../internal/layer.js';
|
|
7
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
8
|
-
import { colors
|
|
11
|
+
import { colors } from '../../tokens.stylex.js';
|
|
9
12
|
|
|
10
13
|
export type MenuRadioItemProps = Loose<
|
|
11
14
|
Omit<DropdownMenu.RadioItemProps, 'children' | 'child'> & {
|
|
12
|
-
/**
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
17
|
+
* with an icon in them: the icon is 12px and lies in the line.
|
|
18
|
+
*/
|
|
19
|
+
description?: ItemDescriptionContent | undefined;
|
|
14
20
|
/** A 16px icon before the label. */
|
|
15
21
|
icon?: Snippet | undefined;
|
|
16
22
|
/** The keys that choose it, shown at the end, such as "⌘1". */
|
|
17
23
|
shortcut?: string | undefined;
|
|
24
|
+
/** Something at the end, after the shortcut: a badge, a count, a word such as "Default". */
|
|
25
|
+
trailing?: Snippet | undefined;
|
|
18
26
|
sx?: Sx | undefined;
|
|
19
27
|
children?: Snippet | undefined;
|
|
20
28
|
}
|
|
@@ -27,11 +35,9 @@
|
|
|
27
35
|
borderRadius: '9999px',
|
|
28
36
|
backgroundColor: colors.accent
|
|
29
37
|
},
|
|
30
|
-
text: { display: 'flex', flexDirection: 'column', gap: '0.125rem', minWidth: 0, flexGrow: 1 },
|
|
31
38
|
// What the label holds lies in a row, an icon or a badge beside the words: an svg is a
|
|
32
39
|
// block in Narvi's base styles, and would break the line
|
|
33
|
-
label: { display: 'flex', alignItems: 'center', gap: '0.375rem' }
|
|
34
|
-
description: { color: colors.textMuted, fontSize: font.sizeCaption }
|
|
40
|
+
label: { display: 'flex', alignItems: 'center', gap: '0.375rem' }
|
|
35
41
|
});
|
|
36
42
|
</script>
|
|
37
43
|
|
|
@@ -42,6 +48,7 @@
|
|
|
42
48
|
description,
|
|
43
49
|
icon,
|
|
44
50
|
shortcut,
|
|
51
|
+
trailing,
|
|
45
52
|
sx,
|
|
46
53
|
class: className,
|
|
47
54
|
children: label,
|
|
@@ -60,10 +67,12 @@
|
|
|
60
67
|
{#if checked}<span {...stylex.attrs(styles.dot)}></span>{/if}
|
|
61
68
|
</span>
|
|
62
69
|
{#if icon}<span data-icons {...stylex.attrs(layer.icon)}>{@render icon()}</span>{/if}
|
|
63
|
-
<span {...stylex.attrs(
|
|
70
|
+
<span {...stylex.attrs(layer.text)}>
|
|
64
71
|
<span {...stylex.attrs(layer.label, styles.label)}>{@render label?.()}</span>
|
|
65
|
-
{#if description}<
|
|
72
|
+
{#if description}<ItemDescription {description} />{/if}
|
|
66
73
|
</span>
|
|
67
|
-
{#if shortcut
|
|
74
|
+
{#if shortcut || trailing}
|
|
75
|
+
<span {...stylex.attrs(layer.trailing)}>{shortcut}{@render trailing?.()}</span>
|
|
76
|
+
{/if}
|
|
68
77
|
{/snippet}
|
|
69
78
|
</DropdownMenu.RadioItem>
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import type { Loose } from '../../internal/loose.js';
|
|
2
2
|
import { DropdownMenu } from 'bits-ui';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
4
5
|
import { type Sx } from '../../internal/sx.js';
|
|
5
6
|
export type MenuRadioItemProps = Loose<Omit<DropdownMenu.RadioItemProps, 'children' | 'child'> & {
|
|
6
|
-
/**
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
9
|
+
* with an icon in them: the icon is 12px and lies in the line.
|
|
10
|
+
*/
|
|
11
|
+
description?: ItemDescriptionContent | undefined;
|
|
8
12
|
/** A 16px icon before the label. */
|
|
9
13
|
icon?: Snippet | undefined;
|
|
10
14
|
/** The keys that choose it, shown at the end, such as "⌘1". */
|
|
11
15
|
shortcut?: string | undefined;
|
|
16
|
+
/** Something at the end, after the shortcut: a badge, a count, a word such as "Default". */
|
|
17
|
+
trailing?: Snippet | undefined;
|
|
12
18
|
sx?: Sx | undefined;
|
|
13
19
|
children?: Snippet | undefined;
|
|
14
20
|
}>;
|
|
15
21
|
declare const MenuRadioItem: import("svelte").Component<Loose<Omit<DropdownMenu.RadioItemProps, "children" | "child"> & {
|
|
16
|
-
/**
|
|
17
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A line under the label, such as what the choice means. Words, or a snippet for words
|
|
24
|
+
* with an icon in them: the icon is 12px and lies in the line.
|
|
25
|
+
*/
|
|
26
|
+
description?: ItemDescriptionContent | undefined;
|
|
18
27
|
/** A 16px icon before the label. */
|
|
19
28
|
icon?: Snippet | undefined;
|
|
20
29
|
/** The keys that choose it, shown at the end, such as "⌘1". */
|
|
21
30
|
shortcut?: string | undefined;
|
|
31
|
+
/** Something at the end, after the shortcut: a badge, a count, a word such as "Default". */
|
|
32
|
+
trailing?: Snippet | undefined;
|
|
22
33
|
sx?: Sx | undefined;
|
|
23
34
|
children?: Snippet | undefined;
|
|
24
35
|
}>, {}, "">;
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import * as stylex from '@stylexjs/stylex';
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import Glyph from '../../internal/Glyph.svelte';
|
|
7
|
+
import ItemDescription, {
|
|
8
|
+
type ItemDescriptionContent
|
|
9
|
+
} from '../../internal/ItemDescription.svelte';
|
|
7
10
|
import { layer } from '../../internal/layer.js';
|
|
8
11
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
9
12
|
|
|
@@ -11,8 +14,11 @@
|
|
|
11
14
|
Omit<DropdownMenu.SubTriggerProps, 'children' | 'child'> & {
|
|
12
15
|
/** A 16px icon before the label. */
|
|
13
16
|
icon?: Snippet | undefined;
|
|
14
|
-
/**
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A line under the label, such as what the submenu holds. Words, or a snippet for words with an icon
|
|
19
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
20
|
+
*/
|
|
21
|
+
description?: ItemDescriptionContent | undefined;
|
|
16
22
|
sx?: Sx | undefined;
|
|
17
23
|
children?: Snippet | undefined;
|
|
18
24
|
}
|
|
@@ -44,7 +50,7 @@
|
|
|
44
50
|
{#if description}
|
|
45
51
|
<span {...stylex.attrs(layer.text)}>
|
|
46
52
|
<span {...stylex.attrs(layer.label)}>{@render children?.()}</span>
|
|
47
|
-
<
|
|
53
|
+
<ItemDescription {description} />
|
|
48
54
|
</span>
|
|
49
55
|
{:else}
|
|
50
56
|
<span {...stylex.attrs(layer.label)}>{@render children?.()}</span>
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import type { Loose } from '../../internal/loose.js';
|
|
2
2
|
import { DropdownMenu } from 'bits-ui';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { type ItemDescriptionContent } from '../../internal/ItemDescription.svelte';
|
|
4
5
|
import { type Sx } from '../../internal/sx.js';
|
|
5
6
|
export type MenuSubTriggerProps = Loose<Omit<DropdownMenu.SubTriggerProps, 'children' | 'child'> & {
|
|
6
7
|
/** A 16px icon before the label. */
|
|
7
8
|
icon?: Snippet | undefined;
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A line under the label, such as what the submenu holds. Words, or a snippet for words with an icon
|
|
11
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
12
|
+
*/
|
|
13
|
+
description?: ItemDescriptionContent | undefined;
|
|
10
14
|
sx?: Sx | undefined;
|
|
11
15
|
children?: Snippet | undefined;
|
|
12
16
|
}>;
|
|
13
17
|
declare const MenuSubTrigger: import("svelte").Component<Loose<Omit<DropdownMenu.SubTriggerProps, "children" | "child"> & {
|
|
14
18
|
/** A 16px icon before the label. */
|
|
15
19
|
icon?: Snippet | undefined;
|
|
16
|
-
/**
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A line under the label, such as what the submenu holds. Words, or a snippet for words with an icon
|
|
22
|
+
* in them, such as a branch's icon and its name: the icon is 12px and lies in the line.
|
|
23
|
+
*/
|
|
24
|
+
description?: ItemDescriptionContent | undefined;
|
|
18
25
|
sx?: Sx | undefined;
|
|
19
26
|
children?: Snippet | undefined;
|
|
20
27
|
}>, {}, "">;
|