@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
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A button and, joined to its end, a second that opens a menu of how to do it, or
|
|
3
|
+
of what else there is to do: Merge, and the ways to merge. The two are one
|
|
4
|
+
group, disabled together. Without a menu the button stands alone, rounded at
|
|
5
|
+
both ends, so a menu that is offered only sometimes does not change the markup.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts" module>
|
|
8
|
+
import * as stylex from '@stylexjs/stylex';
|
|
9
|
+
import type { Snippet } from 'svelte';
|
|
10
|
+
import Glyph from '../../internal/Glyph.svelte';
|
|
11
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
12
|
+
import Button, { type ButtonProps } from '../button/Button.svelte';
|
|
13
|
+
import * as Menu from '../menu/index.js';
|
|
14
|
+
|
|
15
|
+
export type SplitButtonProps = Omit<
|
|
16
|
+
ButtonProps,
|
|
17
|
+
'variant' | 'iconOnly' | 'href' | 'shape' | 'pressed' | 'sx'
|
|
18
|
+
> & {
|
|
19
|
+
/** `secondary`, an edge round both halves; `primary`, the one solid, with a line between them. */
|
|
20
|
+
variant?: 'primary' | 'secondary' | undefined;
|
|
21
|
+
/** Names the pair as a group, where the button's own words do not say it all: "Merge". */
|
|
22
|
+
label?: string | undefined;
|
|
23
|
+
/** Names the button that opens the menu: "Choose how to merge", "More for GitHub". */
|
|
24
|
+
menuLabel?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The menu: Menu.Item, Menu.RadioGroup, Menu.CheckboxItem and the rest. Without it there
|
|
27
|
+
* is no second button.
|
|
28
|
+
*/
|
|
29
|
+
menu?: Snippet | undefined;
|
|
30
|
+
/** Where the menu lines up with the pair. */
|
|
31
|
+
align?: 'start' | 'center' | 'end' | undefined;
|
|
32
|
+
/** A width of its own for the menu, such as `16rem`. */
|
|
33
|
+
menuWidth?: string | undefined;
|
|
34
|
+
/** Whether the menu is open. Bindable. */
|
|
35
|
+
open?: boolean | undefined;
|
|
36
|
+
/** Called as the menu opens or closes: to fetch what it lists as it opens, say. */
|
|
37
|
+
onopenchange?: ((open: boolean) => void) | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* A tooltip on the button that opens the menu, as `tooltip` is on the main one: words, or a
|
|
40
|
+
* snippet with a shortcut.
|
|
41
|
+
*/
|
|
42
|
+
menuTooltip?: string | Snippet | undefined;
|
|
43
|
+
/** On the group, which holds both halves. */
|
|
44
|
+
sx?: Sx | undefined;
|
|
45
|
+
/** The main button's label, and its icon if it has one. */
|
|
46
|
+
children?: Snippet | undefined;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const styles = stylex.create({
|
|
50
|
+
group: {
|
|
51
|
+
display: 'inline-flex',
|
|
52
|
+
alignItems: 'stretch',
|
|
53
|
+
flexShrink: 0,
|
|
54
|
+
verticalAlign: 'middle'
|
|
55
|
+
},
|
|
56
|
+
// The focused half is drawn over its neighbour, so its ring is whole
|
|
57
|
+
half: { zIndex: { default: null, ':focus-visible': 1 } },
|
|
58
|
+
main: { borderStartEndRadius: 0, borderEndEndRadius: 0 },
|
|
59
|
+
more: { borderStartStartRadius: 0, borderEndStartRadius: 0 },
|
|
60
|
+
// The edges overlap, so one hairline runs between the halves
|
|
61
|
+
moreSecondary: { marginInlineStart: '-1px' },
|
|
62
|
+
// On the solid, a line in its own ink, faint, divides them
|
|
63
|
+
morePrimary: {
|
|
64
|
+
'::before': {
|
|
65
|
+
content: '""',
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
insetInlineStart: 0,
|
|
68
|
+
insetBlock: 0,
|
|
69
|
+
width: '1px',
|
|
70
|
+
backgroundColor: 'color-mix(in srgb, currentColor 28%, transparent)',
|
|
71
|
+
pointerEvents: 'none'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// The chevron's button is a little narrower than a square: it is the lesser half
|
|
75
|
+
moreWidth: { paddingInline: '0.375rem' }
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<script lang="ts">
|
|
80
|
+
let {
|
|
81
|
+
variant = 'secondary',
|
|
82
|
+
size = 'md',
|
|
83
|
+
label,
|
|
84
|
+
menuLabel = 'More options',
|
|
85
|
+
menu,
|
|
86
|
+
align = 'end',
|
|
87
|
+
menuWidth,
|
|
88
|
+
open = $bindable(false),
|
|
89
|
+
onopenchange,
|
|
90
|
+
menuTooltip,
|
|
91
|
+
disabled = false,
|
|
92
|
+
loading = false,
|
|
93
|
+
sx,
|
|
94
|
+
class: className,
|
|
95
|
+
ref = $bindable(null),
|
|
96
|
+
children,
|
|
97
|
+
...rest
|
|
98
|
+
}: SplitButtonProps = $props();
|
|
99
|
+
|
|
100
|
+
const glyph = { micro: 10, xs: 12, sm: 12, md: 14, lg: 16 } as const;
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<div
|
|
104
|
+
role="group"
|
|
105
|
+
aria-label={label}
|
|
106
|
+
data-slot="split-button"
|
|
107
|
+
{...attrs([styles.group, sx], className)}
|
|
108
|
+
>
|
|
109
|
+
<Button
|
|
110
|
+
bind:ref
|
|
111
|
+
{...rest}
|
|
112
|
+
{variant}
|
|
113
|
+
{size}
|
|
114
|
+
{disabled}
|
|
115
|
+
{loading}
|
|
116
|
+
sx={[styles.half, menu && styles.main]}
|
|
117
|
+
>
|
|
118
|
+
{@render children?.()}
|
|
119
|
+
</Button>
|
|
120
|
+
{#if menu}
|
|
121
|
+
<Menu.Root bind:open onOpenChange={onopenchange}>
|
|
122
|
+
<Menu.Trigger disabled={disabled || loading}>
|
|
123
|
+
{#snippet child({ props })}
|
|
124
|
+
<Button
|
|
125
|
+
{...props}
|
|
126
|
+
{variant}
|
|
127
|
+
{size}
|
|
128
|
+
disabled={disabled || loading}
|
|
129
|
+
aria-label={menuLabel}
|
|
130
|
+
tooltip={menuTooltip}
|
|
131
|
+
sx={[
|
|
132
|
+
styles.half,
|
|
133
|
+
styles.more,
|
|
134
|
+
styles.moreWidth,
|
|
135
|
+
variant === 'primary' ? styles.morePrimary : styles.moreSecondary
|
|
136
|
+
]}
|
|
137
|
+
>
|
|
138
|
+
<Glyph name="chevron" size={glyph[size]} />
|
|
139
|
+
</Button>
|
|
140
|
+
{/snippet}
|
|
141
|
+
</Menu.Trigger>
|
|
142
|
+
<Menu.Content {align} width={menuWidth}>
|
|
143
|
+
{@render menu()}
|
|
144
|
+
</Menu.Content>
|
|
145
|
+
</Menu.Root>
|
|
146
|
+
{/if}
|
|
147
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type Sx } from '../../internal/sx.js';
|
|
3
|
+
import { type ButtonProps } from '../button/Button.svelte';
|
|
4
|
+
export type SplitButtonProps = Omit<ButtonProps, 'variant' | 'iconOnly' | 'href' | 'shape' | 'pressed' | 'sx'> & {
|
|
5
|
+
/** `secondary`, an edge round both halves; `primary`, the one solid, with a line between them. */
|
|
6
|
+
variant?: 'primary' | 'secondary' | undefined;
|
|
7
|
+
/** Names the pair as a group, where the button's own words do not say it all: "Merge". */
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
/** Names the button that opens the menu: "Choose how to merge", "More for GitHub". */
|
|
10
|
+
menuLabel?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The menu: Menu.Item, Menu.RadioGroup, Menu.CheckboxItem and the rest. Without it there
|
|
13
|
+
* is no second button.
|
|
14
|
+
*/
|
|
15
|
+
menu?: Snippet | undefined;
|
|
16
|
+
/** Where the menu lines up with the pair. */
|
|
17
|
+
align?: 'start' | 'center' | 'end' | undefined;
|
|
18
|
+
/** A width of its own for the menu, such as `16rem`. */
|
|
19
|
+
menuWidth?: string | undefined;
|
|
20
|
+
/** Whether the menu is open. Bindable. */
|
|
21
|
+
open?: boolean | undefined;
|
|
22
|
+
/** Called as the menu opens or closes: to fetch what it lists as it opens, say. */
|
|
23
|
+
onopenchange?: ((open: boolean) => void) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A tooltip on the button that opens the menu, as `tooltip` is on the main one: words, or a
|
|
26
|
+
* snippet with a shortcut.
|
|
27
|
+
*/
|
|
28
|
+
menuTooltip?: string | Snippet | undefined;
|
|
29
|
+
/** On the group, which holds both halves. */
|
|
30
|
+
sx?: Sx | undefined;
|
|
31
|
+
/** The main button's label, and its icon if it has one. */
|
|
32
|
+
children?: Snippet | undefined;
|
|
33
|
+
};
|
|
34
|
+
declare const SplitButton: import("svelte").Component<SplitButtonProps, {}, "ref" | "open">;
|
|
35
|
+
type SplitButton = ReturnType<typeof SplitButton>;
|
|
36
|
+
export default SplitButton;
|