@diegopluna/narvi 0.3.5 → 0.3.6

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.
@@ -8,6 +8,7 @@
8
8
  import { media } from '../../media.stylex.js';
9
9
  import Spinner from '../spinner/Spinner.svelte';
10
10
  import * as Tooltip from '../tooltip/index.js';
11
+ import TooltipScope from '../../internal/TooltipScope.svelte';
11
12
  import { mergeProps } from 'bits-ui';
12
13
  import '../../internal/icons.css';
13
14
 
@@ -32,12 +33,20 @@
32
33
  | 'success-outline';
33
34
  export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
34
35
  export type ButtonShape = 'default' | 'pill';
36
+ export type ButtonJustify = 'center' | 'start';
37
+ export type ButtonTooltipSide = 'top' | 'right' | 'bottom' | 'left';
35
38
 
36
39
  export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
37
40
  variant?: ButtonVariant | undefined;
38
41
  size?: ButtonSize | undefined;
39
42
  /** `pill` rounds the ends fully: for a chip, or a button that floats. */
40
43
  shape?: ButtonShape | undefined;
44
+ /**
45
+ * Where its contents sit: in the `center`, or at the `start`, for a wide button that reads
46
+ * as a menu's row. Either way they fill the button, so a margin of `auto` on the last
47
+ * pushes it to the end.
48
+ */
49
+ justify?: ButtonJustify | undefined;
41
50
  /** Shows a spinner and blocks interaction while keeping the button's width. */
42
51
  loading?: boolean | undefined;
43
52
  /**
@@ -58,9 +67,13 @@
58
67
  /**
59
68
  * A tooltip, shown as the pointer rests on it or the keyboard reaches it: words, or a
60
69
  * snippet for words with a shortcut. It says more than the button's name, which stays as
61
- * it is. It waits 400ms, as Narvi's other parts' tooltips do.
70
+ * it is. It waits as long as the app's Tooltip.Provider says, or 400ms without one.
62
71
  */
63
72
  tooltip?: string | Snippet | undefined;
73
+ /** The side of the button the tooltip opens on. Above it unless there is no room. */
74
+ tooltipSide?: ButtonTooltipSide | undefined;
75
+ /** The keys that do the same, shown after the tooltip's words: `['⌘', 'K']`. */
76
+ tooltipShortcut?: string[] | undefined;
64
77
  /** Renders a link styled as a button. */
65
78
  href?: string | undefined;
66
79
  sx?: Sx | undefined;
@@ -204,6 +217,7 @@
204
217
  },
205
218
 
206
219
  pill: { borderRadius: radius.pill },
220
+ start: { justifyContent: 'flex-start', textAlign: 'start' },
207
221
 
208
222
  // Primary: the one solid, flat, in the text's own colour
209
223
  primary: {
@@ -347,10 +361,11 @@
347
361
  pointerEvents: 'none'
348
362
  },
349
363
  // As wide as the button, so in a wide one something inside can be pushed to the end
364
+ // It takes the button's justification, so `sx` can set that on the button alone
350
365
  content: {
351
366
  display: 'inline-flex',
352
367
  alignItems: 'center',
353
- justifyContent: 'center',
368
+ justifyContent: 'inherit',
354
369
  flexGrow: 1,
355
370
  minWidth: 0,
356
371
  gap: 'inherit',
@@ -458,12 +473,15 @@
458
473
  variant = 'secondary',
459
474
  size = 'md',
460
475
  shape = 'default',
476
+ justify = 'center',
461
477
  loading = false,
462
478
  loadingLabel,
463
479
  disabled = false,
464
480
  pressed,
465
481
  iconOnly = false,
466
482
  tooltip,
483
+ tooltipSide,
484
+ tooltipShortcut,
467
485
  href,
468
486
  type = 'button',
469
487
  sx,
@@ -483,6 +501,7 @@
483
501
  styles[size],
484
502
  iconOnly && iconStyles[size],
485
503
  (shape === 'pill' || variant === 'floating') && styles.pill,
504
+ justify === 'start' && styles.start,
486
505
  variantStyles[variant],
487
506
  disabled && styles.disabled,
488
507
  loading && styles.loading,
@@ -551,16 +570,16 @@
551
570
  {/snippet}
552
571
 
553
572
  {#if tooltip}
554
- <Tooltip.Provider delayDuration={400}>
573
+ <TooltipScope>
555
574
  <Tooltip.Root>
556
575
  <Tooltip.Trigger>
557
576
  {#snippet child({ props })}{@render control(props)}{/snippet}
558
577
  </Tooltip.Trigger>
559
- <Tooltip.Content>
578
+ <Tooltip.Content side={tooltipSide} shortcut={tooltipShortcut}>
560
579
  {#if typeof tooltip === 'function'}{@render tooltip()}{:else}{tooltip}{/if}
561
580
  </Tooltip.Content>
562
581
  </Tooltip.Root>
563
- </Tooltip.Provider>
582
+ </TooltipScope>
564
583
  {:else}
565
584
  {@render control({})}
566
585
  {/if}
@@ -11,11 +11,19 @@ import '../../internal/icons.css';
11
11
  export type ButtonVariant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'bare' | 'link' | 'floating' | 'danger' | 'danger-outline' | 'ghost-danger' | 'warning-outline' | 'success-outline';
12
12
  export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
13
13
  export type ButtonShape = 'default' | 'pill';
14
+ export type ButtonJustify = 'center' | 'start';
15
+ export type ButtonTooltipSide = 'top' | 'right' | 'bottom' | 'left';
14
16
  export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
15
17
  variant?: ButtonVariant | undefined;
16
18
  size?: ButtonSize | undefined;
17
19
  /** `pill` rounds the ends fully: for a chip, or a button that floats. */
18
20
  shape?: ButtonShape | undefined;
21
+ /**
22
+ * Where its contents sit: in the `center`, or at the `start`, for a wide button that reads
23
+ * as a menu's row. Either way they fill the button, so a margin of `auto` on the last
24
+ * pushes it to the end.
25
+ */
26
+ justify?: ButtonJustify | undefined;
19
27
  /** Shows a spinner and blocks interaction while keeping the button's width. */
20
28
  loading?: boolean | undefined;
21
29
  /**
@@ -36,9 +44,13 @@ export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'chi
36
44
  /**
37
45
  * A tooltip, shown as the pointer rests on it or the keyboard reaches it: words, or a
38
46
  * snippet for words with a shortcut. It says more than the button's name, which stays as
39
- * it is. It waits 400ms, as Narvi's other parts' tooltips do.
47
+ * it is. It waits as long as the app's Tooltip.Provider says, or 400ms without one.
40
48
  */
41
49
  tooltip?: string | Snippet | undefined;
50
+ /** The side of the button the tooltip opens on. Above it unless there is no room. */
51
+ tooltipSide?: ButtonTooltipSide | undefined;
52
+ /** The keys that do the same, shown after the tooltip's words: `['⌘', 'K']`. */
53
+ tooltipShortcut?: string[] | undefined;
42
54
  /** Renders a link styled as a button. */
43
55
  href?: string | undefined;
44
56
  sx?: Sx | undefined;
@@ -12,6 +12,7 @@
12
12
  import Button from '../button/Button.svelte';
13
13
  import { text, type MessageTextSize } from '../message/styles.js';
14
14
  import * as Tooltip from '../tooltip/index.js';
15
+ import TooltipScope from '../../internal/TooltipScope.svelte';
15
16
 
16
17
  export type QueuedMessageStatus = 'queued' | 'editing' | 'unsent';
17
18
 
@@ -151,7 +152,7 @@
151
152
  {...stylex.attrs(styles.status, status === 'unsent' && styles.unsent)}
152
153
  >{statusText ?? STATUS[status]}</span
153
154
  >
154
- <Tooltip.Provider delayDuration={400}>
155
+ <TooltipScope>
155
156
  {#each actions as [key, handler, icon, fallback] (key)}
156
157
  {@const label = labels?.[key] ?? fallback}
157
158
  <Tooltip.Root>
@@ -173,6 +174,6 @@
173
174
  <Tooltip.Content>{label}</Tooltip.Content>
174
175
  </Tooltip.Root>
175
176
  {/each}
176
- </Tooltip.Provider>
177
+ </TooltipScope>
177
178
  </div>
178
179
  </div>
@@ -11,7 +11,7 @@
11
11
  import type { HTMLAttributes } from 'svelte/elements';
12
12
  import { roving } from '../../internal/roving.js';
13
13
  import { attrs, type Sx } from '../../internal/sx.js';
14
- import * as Tooltip from '../tooltip/index.js';
14
+ import TooltipScope from '../../internal/TooltipScope.svelte';
15
15
 
16
16
  export type RailRootProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
17
17
  /** Names it for assistive technology: "Workspaces". */
@@ -54,7 +54,7 @@
54
54
  {...attrs([styles.rail, sx], className)}
55
55
  {@attach roving({ selector: '[data-rail-item]' })}
56
56
  >
57
- <Tooltip.Provider delayDuration={400}>
57
+ <TooltipScope>
58
58
  {@render children?.()}
59
- </Tooltip.Provider>
59
+ </TooltipScope>
60
60
  </nav>
@@ -9,6 +9,7 @@
9
9
  import '../../internal/icons.css';
10
10
  import { groupTrigger } from '../../internal/tooltip-trigger.js';
11
11
  import * as Tooltip from '../tooltip/index.js';
12
+ import TooltipScope from '../../internal/TooltipScope.svelte';
12
13
 
13
14
  export type SegmentedOption = {
14
15
  value: string;
@@ -217,7 +218,7 @@
217
218
  {/each}
218
219
  {/snippet}
219
220
  {#if titled}
220
- <Tooltip.Provider delayDuration={400}>{@render segments()}</Tooltip.Provider>
221
+ <TooltipScope>{@render segments()}</TooltipScope>
221
222
  {:else}
222
223
  {@render segments()}
223
224
  {/if}
@@ -15,6 +15,7 @@
15
15
  import { media } from '../../media.stylex.js';
16
16
  import { typography } from '../../typography.js';
17
17
  import * as Tooltip from '../tooltip/index.js';
18
+ import TooltipScope from '../../internal/TooltipScope.svelte';
18
19
  import { getSettingsGroupContext } from '../settings-group/context.js';
19
20
  import '../../internal/icons.css';
20
21
 
@@ -222,7 +223,7 @@
222
223
  <span id={control.labelId} {...stylex.attrs(...labelStyles)}>{label}</span>
223
224
  {/if}
224
225
  {#if about}
225
- <Tooltip.Provider delayDuration={400}>
226
+ <TooltipScope>
226
227
  <Tooltip.Root>
227
228
  <Tooltip.Trigger>
228
229
  {#snippet child({ props })}
@@ -238,7 +239,7 @@
238
239
  </Tooltip.Trigger>
239
240
  <Tooltip.Content side="top">{about}</Tooltip.Content>
240
241
  </Tooltip.Root>
241
- </Tooltip.Provider>
242
+ </TooltipScope>
242
243
  {/if}
243
244
  </span>
244
245
  {#if description}
@@ -37,7 +37,7 @@
37
37
  onopenchange?: ((open: boolean) => void) | undefined;
38
38
  /**
39
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.
40
+ * snippet with a shortcut. It opens on the side `tooltipSide` names, as the main one's does.
41
41
  */
42
42
  menuTooltip?: string | Snippet | undefined;
43
43
  /** On the group, which holds both halves. */
@@ -88,6 +88,7 @@
88
88
  open = $bindable(false),
89
89
  onopenchange,
90
90
  menuTooltip,
91
+ tooltipSide,
91
92
  disabled = false,
92
93
  loading = false,
93
94
  sx,
@@ -113,6 +114,7 @@
113
114
  {size}
114
115
  {disabled}
115
116
  {loading}
117
+ {tooltipSide}
116
118
  sx={[styles.half, menu && styles.main]}
117
119
  >
118
120
  {@render children?.()}
@@ -128,6 +130,7 @@
128
130
  disabled={disabled || loading}
129
131
  aria-label={menuLabel}
130
132
  tooltip={menuTooltip}
133
+ {tooltipSide}
131
134
  sx={[
132
135
  styles.half,
133
136
  styles.more,
@@ -23,7 +23,7 @@ export type SplitButtonProps = Omit<ButtonProps, 'variant' | 'iconOnly' | 'href'
23
23
  onopenchange?: ((open: boolean) => void) | undefined;
24
24
  /**
25
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.
26
+ * snippet with a shortcut. It opens on the side `tooltipSide` names, as the main one's does.
27
27
  */
28
28
  menuTooltip?: string | Snippet | undefined;
29
29
  /** On the group, which holds both halves. */
@@ -6,6 +6,7 @@
6
6
  import '../../internal/icons.css';
7
7
  import { groupTrigger } from '../../internal/tooltip-trigger.js';
8
8
  import * as Tooltip from '../tooltip/index.js';
9
+ import TooltipScope from '../../internal/TooltipScope.svelte';
9
10
  import { attrs, type Sx } from '../../internal/sx.js';
10
11
  import { colors, font, motion, radius } from '../../tokens.stylex.js';
11
12
  import { media } from '../../media.stylex.js';
@@ -198,7 +199,7 @@
198
199
  {/each}
199
200
  {/snippet}
200
201
  {#if tabs.some((tab) => tab.title)}
201
- <Tooltip.Provider delayDuration={400}>{@render items()}</Tooltip.Provider>
202
+ <TooltipScope>{@render items()}</TooltipScope>
202
203
  {:else}
203
204
  {@render items()}
204
205
  {/if}
@@ -0,0 +1,23 @@
1
+ <script lang="ts" module>
2
+ import type { Loose } from '../../internal/loose.js';
3
+ import { Tooltip } from 'bits-ui';
4
+ import { hasContext, setContext } from 'svelte';
5
+
6
+ export type TooltipProviderProps = Loose<Tooltip.ProviderProps>;
7
+
8
+ const PROVIDED = Symbol('narvi.tooltip.provider');
9
+
10
+ /** Whether a Tooltip.Provider of Narvi's is above the calling component. */
11
+ export const hasTooltipProvider = () => hasContext(PROVIDED);
12
+ </script>
13
+
14
+ <script lang="ts">
15
+ let { children, ...rest }: TooltipProviderProps = $props();
16
+
17
+ // Narvi's own parts with a tooltip find it, and take its delay rather than one of their own
18
+ setContext(PROVIDED, true);
19
+ </script>
20
+
21
+ <Tooltip.Provider {...rest}>
22
+ {@render children?.()}
23
+ </Tooltip.Provider>
@@ -0,0 +1,8 @@
1
+ import type { Loose } from '../../internal/loose.js';
2
+ import { Tooltip } from 'bits-ui';
3
+ export type TooltipProviderProps = Loose<Tooltip.ProviderProps>;
4
+ /** Whether a Tooltip.Provider of Narvi's is above the calling component. */
5
+ export declare const hasTooltipProvider: () => boolean;
6
+ declare const TooltipProvider: import("svelte").Component<Loose<Tooltip.ProviderProps>, {}, "">;
7
+ type TooltipProvider = ReturnType<typeof TooltipProvider>;
8
+ export default TooltipProvider;
@@ -1,14 +1,13 @@
1
- import { Tooltip } from 'bits-ui';
2
- import { type Loosened } from '../../internal/loose.js';
3
1
  import Content from './TooltipContent.svelte';
2
+ import Provider from './TooltipProvider.svelte';
4
3
  import Root from './TooltipRoot.svelte';
5
4
  import Trigger from './TooltipTrigger.svelte';
6
5
  /**
7
- * Place one Provider near the root of the app. Its delay applies to every
8
- * tooltip inside, and once one is open the next opens without waiting.
6
+ * Place one Provider near the root of the app. Its delay applies to every tooltip inside, Narvi's
7
+ * own parts' among them, and once one is open the next opens without waiting.
9
8
  */
10
- declare const Provider: Loosened<typeof Tooltip.Provider>;
11
9
  export { Provider, Root, Trigger, Content };
12
10
  export type { TooltipContentProps } from './TooltipContent.svelte';
11
+ export type { TooltipProviderProps } from './TooltipProvider.svelte';
13
12
  export type { TooltipRootProps } from './TooltipRoot.svelte';
14
13
  export type { TooltipTriggerProps } from './TooltipTrigger.svelte';
@@ -1,11 +1,9 @@
1
- import { Tooltip } from 'bits-ui';
2
- import { loose } from '../../internal/loose.js';
3
1
  import Content from './TooltipContent.svelte';
2
+ import Provider from './TooltipProvider.svelte';
4
3
  import Root from './TooltipRoot.svelte';
5
4
  import Trigger from './TooltipTrigger.svelte';
6
5
  /**
7
- * Place one Provider near the root of the app. Its delay applies to every
8
- * tooltip inside, and once one is open the next opens without waiting.
6
+ * Place one Provider near the root of the app. Its delay applies to every tooltip inside, Narvi's
7
+ * own parts' among them, and once one is open the next opens without waiting.
9
8
  */
10
- const Provider = loose(Tooltip.Provider);
11
9
  export { Provider, Root, Trigger, Content };
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export type { AvatarFallbackProps, AvatarImageProps, AvatarRootProps, AvatarSize
12
12
  export { default as Badge } from './components/badge/Badge.svelte';
13
13
  export type { BadgeProps, BadgeTone } from './components/badge/Badge.svelte';
14
14
  export { default as Button } from './components/button/Button.svelte';
15
- export type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant } from './components/button/Button.svelte';
15
+ export type { ButtonJustify, ButtonProps, ButtonShape, ButtonSize, ButtonTooltipSide, ButtonVariant } from './components/button/Button.svelte';
16
16
  export { default as Card } from './components/card/Card.svelte';
17
17
  export type { CardPadding, CardProps, CardVariant } from './components/card/Card.svelte';
18
18
  export { default as ChangeStats } from './components/change-stats/ChangeStats.svelte';
@@ -159,7 +159,7 @@ export type { ToasterProps } from './components/toast/Toaster.svelte';
159
159
  export { toast } from './components/toast/toasts.svelte.js';
160
160
  export type { ToastAction, ToastId, ToastOptions, ToastTone } from './components/toast/toasts.svelte.js';
161
161
  export * as Tooltip from './components/tooltip/index.js';
162
- export type { TooltipContentProps, TooltipRootProps, TooltipTriggerProps } from './components/tooltip/index.js';
162
+ export type { TooltipContentProps, TooltipProviderProps, TooltipRootProps, TooltipTriggerProps } from './components/tooltip/index.js';
163
163
  export { default as Theme } from './components/theme/Theme.svelte';
164
164
  export type { ThemeOverrides, ThemeProps, ThemeScheme } from './components/theme/Theme.svelte';
165
165
  export { default as WorkFold } from './components/work-fold/WorkFold.svelte';
@@ -0,0 +1,19 @@
1
+ <!--
2
+ Around a part's tooltips. Inside the app's Tooltip.Provider they are the app's: they wait as
3
+ long as it says, and one opens at once after another anywhere under it, along a toolbar of
4
+ buttons each with its own. Without one they have their own, which waits 400ms.
5
+ -->
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Provider, { hasTooltipProvider } from '../components/tooltip/TooltipProvider.svelte';
9
+
10
+ let { children }: { children: Snippet } = $props();
11
+
12
+ const provided = hasTooltipProvider();
13
+ </script>
14
+
15
+ {#if provided}
16
+ {@render children()}
17
+ {:else}
18
+ <Provider delayDuration={400}>{@render children()}</Provider>
19
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ children: Snippet;
4
+ };
5
+ declare const TooltipScope: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type TooltipScope = ReturnType<typeof TooltipScope>;
7
+ export default TooltipScope;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopluna/narvi",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "packageManager": "pnpm@12.18.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,7 +12,7 @@ metadata:
12
12
  Grid, and Narvi's conventions for colour, labels and copy.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.5'
15
+ library_version: '0.3.6'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -37,6 +37,8 @@ sources:
37
37
  - src/lib/components/app-shell/AppShellPanel.svelte
38
38
  - src/lib/components/composer/ComposerModelPicker.svelte
39
39
  - src/lib/components/questionnaire/Questionnaire.svelte
40
+ - src/lib/components/button/Button.svelte
41
+ - src/lib/components/tooltip/TooltipProvider.svelte
40
42
  ---
41
43
 
42
44
  # Build interfaces with Narvi
@@ -300,15 +302,14 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
300
302
  ```
301
303
 
302
304
  - Errors and work under way stay until dismissed, and every toast has a Dismiss button.
303
- - `Tooltip.Root` must sit inside a `Tooltip.Provider`. Mount one near the root. Give an icon
304
- button an `aria-label` too, because the tooltip shows a name but doesn't supply one.
305
+ - `Tooltip.Root` needs a `Tooltip.Provider` near the root, whose delay and hand-off Narvi's own
306
+ tooltips (Button, Rail, Tabs) take too. An icon button needs an `aria-label` as well.
305
307
  - Use `Notice` for a note in place (`tone`: neutral, info, success, warning, danger; `raised`
306
- over a busy background, such as an image behind the composer),
307
- `EmptyState` for an empty place, `Skeleton`, `Spinner` or `Progress` while loading, and
308
- `StatusIndicator` (`status`: idle, working, waiting, done, failed, stopped, connecting) for where
309
- a run stands. Where there is no room for its shapes, beside a name or on a mark's corner, use
310
- `StatusDot` (`tone`; `shape`: dot, ring for on its way, diamond for failed; `size`, 6px; `label`).
311
- Don't draw a dot as a span of your own.
308
+ over a busy background, such as an image behind the composer), `EmptyState` for an empty
309
+ place, `Skeleton`, `Spinner` or `Progress` while loading, and `StatusIndicator` (`status`:
310
+ idle, working, waiting, done, failed, stopped, connecting) for where a run stands. With no
311
+ room for its shapes, use `StatusDot` (`tone`; `shape`: dot, ring for on its way, diamond for
312
+ failed; `size`, 6px; `label`): don't draw a dot as a span of your own.
312
313
 
313
314
  ### Lists, badges and folds
314
315
 
@@ -316,18 +317,17 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
316
317
  `List.Item`s, or rows of your own. Don't redraw the card and its lines.
317
318
  - `Badge` shows its tone as a dot; `plain` hides the dot and colours the words in the tone.
318
319
  `color` paints the dot alone in a colour of its own (a label's `#d73a4a`): don't draw a dot.
319
- `size="sm"` is 18px, a sidebar row's line, so it sits in a row without growing it. An icon in
320
- it is sized to 12px.
320
+ `size="sm"` is 18px, a sidebar row's line, so a row keeps its height; an icon in it is 12px.
321
321
  - `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
322
- - `Tabs` and `SegmentedControl` options take an `icon` (a component, sized to fit) and a
323
- `title` that names a short label in full, as a tooltip and the item's description.
322
+ - `Tabs` and `SegmentedControl` options take an `icon` and a `title`: tooltip and description.
324
323
  - A loading `Button` hides its label under the spinner; `loadingLabel="Connecting…"` says what
325
- it does beside it instead. `tooltip` (words or a snippet) gives it a tooltip, as on
326
- `Composer.Submit` and a `SplitButton` (`menuTooltip` for its chevron, `onopenchange` for its
327
- menu): don't wrap one in `Tooltip` parts. `variant="link"` sits in a sentence, unpadded. A ghost, bare, secondary or floating Button that opens a menu or a
328
- popover holds an open look while it shows, by the `aria-expanded` bits-ui sets: don't style
329
- the open trigger yourself. `pressed` makes it a toggle button (`aria-pressed`) held in the same
330
- look while true: don't style `aria-pressed` by hand.
324
+ it does beside it instead. `tooltip` (words or a snippet), `tooltipSide` (`bottom` under a
325
+ bar) and `tooltipShortcut` (`['⌘', 'K']`) give it a tooltip, as on `Composer.Submit` and a
326
+ `SplitButton` (`menuTooltip` for its chevron; `onopenchange`): don't wrap one in `Tooltip`
327
+ parts. `justify="start"` starts its contents, for a full-width row, and a margin of `auto`
328
+ sends the last to the end. `variant="link"` sits in a sentence. An open ghost, bare, secondary
329
+ or floating trigger holds an open look by bits-ui's `aria-expanded`, and `pressed` makes a
330
+ toggle button (`aria-pressed`) in that look: style neither.
331
331
  - A main action with a menu of how to do it (Merge, Sign in) is a `SplitButton`: `menu` snippet,
332
332
  `menuLabel` for the chevron, `label` for the group, both halves disabled together. Without
333
333
  `menu` it stands alone. Don't join two Buttons by hand.
@@ -26,26 +26,26 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
26
26
 
27
27
  ## Controls and forms
28
28
 
29
- | Component | Use it for | Docs slug |
30
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- |
31
- | `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `loading`, `iconOnly`, `pressed` | `button` |
32
- | `Field` | Label, help text and error around one control | `field` |
33
- | `Input` | One line of text | `input` |
34
- | `Textarea` | Several lines of text | `textarea` |
35
- | `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`) | `select` |
36
- | `Checkbox` | An option on or off, or several from a list | `checkbox` |
37
- | `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
38
- | `Switch` | A setting that takes effect at once | `switch` |
39
- | `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`) | `segmented-control` |
40
- | `Slider` | A value or a range along a track | `slider` |
41
- | `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant`) | `split-button` |
42
- | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
43
- | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
44
- | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
45
- | `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
46
- | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
47
- | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
48
- | `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `trailing`. The panels are yours | `tab-strip` |
29
+ | Component | Use it for | Docs slug |
30
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
31
+ | `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `justify`, `loading`, `iconOnly`, `pressed`, `tooltip` | `button` |
32
+ | `Field` | Label, help text and error around one control | `field` |
33
+ | `Input` | One line of text | `input` |
34
+ | `Textarea` | Several lines of text | `textarea` |
35
+ | `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`) | `select` |
36
+ | `Checkbox` | An option on or off, or several from a list | `checkbox` |
37
+ | `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
38
+ | `Switch` | A setting that takes effect at once | `switch` |
39
+ | `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`) | `segmented-control` |
40
+ | `Slider` | A value or a range along a track | `slider` |
41
+ | `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant`) | `split-button` |
42
+ | `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
43
+ | `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
44
+ | `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
45
+ | `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
46
+ | `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
47
+ | `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
48
+ | `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `trailing`. The panels are yours | `tab-strip` |
49
49
 
50
50
  ## Overlays (bits-ui; use `child` snippets on triggers)
51
51
 
@@ -12,7 +12,7 @@ metadata:
12
12
  patching the DOM, and decide which links and images text from a model may load.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.5'
15
+ library_version: '0.3.6'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  4 when the app uses it.
12
12
  type: lifecycle
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.5'
14
+ library_version: '0.3.6'
15
15
  sources:
16
16
  - src/lib/vite.ts
17
17
  - src/lib/base.css
@@ -12,7 +12,7 @@ metadata:
12
12
  hover, motion and forced-colour preferences.
13
13
  type: core
14
14
  library: '@diegopluna/narvi'
15
- library_version: '0.3.5'
15
+ library_version: '0.3.6'
16
16
  requires:
17
17
  - setup
18
18
  sources:
@@ -11,7 +11,7 @@ metadata:
11
11
  menus and dialogs, and resolve token colours for drawing code that cannot read CSS variables.
12
12
  type: core
13
13
  library: '@diegopluna/narvi'
14
- library_version: '0.3.5'
14
+ library_version: '0.3.6'
15
15
  requires:
16
16
  - setup
17
17
  sources: