@diegopluna/narvi 0.3.1 → 0.3.3
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/activity/ActivityIcon.svelte +54 -0
- package/dist/components/activity/ActivityIcon.svelte.d.ts +24 -0
- package/dist/components/activity/ActivityStep.svelte +47 -13
- package/dist/components/activity/ActivityStep.svelte.d.ts +13 -4
- package/dist/components/activity/ActivityThought.svelte +24 -5
- package/dist/components/activity/ActivityThought.svelte.d.ts +12 -2
- package/dist/components/activity/index.d.ts +3 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/app-shell/AppShellHeader.svelte +18 -4
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +5 -0
- package/dist/components/app-shell/AppShellMain.svelte +5 -1
- package/dist/components/approval/Approval.svelte +14 -1
- package/dist/components/approval/Approval.svelte.d.ts +5 -0
- package/dist/components/badge/Badge.svelte +19 -2
- package/dist/components/badge/Badge.svelte.d.ts +4 -1
- package/dist/components/button/Button.svelte +63 -13
- package/dist/components/composer/ComposerModelPicker.svelte +80 -13
- package/dist/components/composer/ComposerModelPicker.svelte.d.ts +23 -6
- package/dist/components/composer/ComposerRoot.svelte +51 -12
- package/dist/components/composer/ComposerRoot.svelte.d.ts +16 -0
- package/dist/components/composer/ComposerSubmit.svelte +19 -5
- package/dist/components/composer/ComposerSubmit.svelte.d.ts +3 -1
- package/dist/components/composer/ComposerToggle.svelte +18 -4
- package/dist/components/composer/ComposerToggle.svelte.d.ts +2 -0
- package/dist/components/composer/ComposerTray.svelte +17 -3
- package/dist/components/composer/ComposerTray.svelte.d.ts +5 -0
- package/dist/components/composer/context.d.ts +4 -1
- package/dist/components/dialog/DialogContent.svelte +22 -12
- package/dist/components/dialog/DialogContent.svelte.d.ts +10 -0
- package/dist/components/divider/Divider.svelte +56 -14
- package/dist/components/divider/Divider.svelte.d.ts +13 -3
- package/dist/components/empty-state/EmptyState.svelte +12 -2
- package/dist/components/empty-state/EmptyState.svelte.d.ts +6 -0
- package/dist/components/heading/Heading.svelte +15 -0
- package/dist/components/heading/Heading.svelte.d.ts +6 -0
- package/dist/components/hover-card/HoverCardContent.svelte +19 -3
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +8 -0
- package/dist/components/input/Input.svelte +13 -3
- package/dist/components/input/Input.svelte.d.ts +10 -2
- package/dist/components/markdown/Markdown.svelte +22 -2
- package/dist/components/markdown/MarkdownDiagram.svelte +33 -2
- package/dist/components/markdown/MarkdownFile.svelte +56 -10
- package/dist/components/markdown/MarkdownMath.svelte +6 -0
- package/dist/components/markdown/MarkdownTable.svelte +3 -4
- package/dist/components/markdown/context.d.ts +6 -0
- package/dist/components/markdown/labels.d.ts +7 -0
- package/dist/components/markdown/labels.js +2 -0
- package/dist/components/menu/ContextMenuTrigger.svelte +14 -2
- package/dist/components/menu/ContextMenuTrigger.svelte.d.ts +10 -0
- package/dist/components/menu/MenuCheckboxItem.svelte +50 -7
- package/dist/components/menu/MenuCheckboxItem.svelte.d.ts +16 -0
- package/dist/components/menu/MenuContent.svelte +10 -2
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuGroup.svelte +16 -0
- package/dist/components/menu/MenuGroup.svelte.d.ts +6 -0
- package/dist/components/menu/MenuItem.svelte +17 -2
- package/dist/components/menu/MenuItem.svelte.d.ts +8 -0
- package/dist/components/menu/MenuLabel.svelte +22 -8
- package/dist/components/menu/MenuRadioGroup.svelte +16 -0
- package/dist/components/menu/MenuRadioGroup.svelte.d.ts +6 -0
- package/dist/components/menu/MenuSubContent.svelte +10 -2
- package/dist/components/menu/MenuSubContent.svelte.d.ts +10 -0
- package/dist/components/menu/MenuSubTrigger.svelte +19 -2
- package/dist/components/menu/MenuSubTrigger.svelte.d.ts +6 -0
- package/dist/components/menu/group.d.ts +2 -0
- package/dist/components/menu/group.js +9 -0
- package/dist/components/menu/index.d.ts +4 -2
- package/dist/components/menu/index.js +2 -2
- package/dist/components/message/MessageBubble.svelte +40 -0
- package/dist/components/message/MessageBubble.svelte.d.ts +12 -0
- package/dist/components/message/MessageContent.svelte +23 -14
- package/dist/components/message/MessageContent.svelte.d.ts +6 -0
- package/dist/components/message/MessageCopy.svelte +27 -15
- package/dist/components/message/MessageCopy.svelte.d.ts +9 -2
- package/dist/components/message/MessageRoot.svelte +20 -3
- package/dist/components/message/MessageRoot.svelte.d.ts +6 -0
- package/dist/components/message/context.d.ts +2 -0
- package/dist/components/message/index.d.ts +4 -1
- package/dist/components/message/index.js +3 -2
- package/dist/components/message/styles.d.ts +30 -0
- package/dist/components/message/styles.js +24 -0
- package/dist/components/notice/Notice.svelte +3 -3
- package/dist/components/popover/PopoverContent.svelte +27 -3
- package/dist/components/popover/PopoverContent.svelte.d.ts +18 -0
- package/dist/components/questionnaire/Questionnaire.svelte +103 -19
- package/dist/components/questionnaire/Questionnaire.svelte.d.ts +13 -1
- package/dist/components/queued-message/QueuedMessage.svelte +44 -6
- package/dist/components/queued-message/QueuedMessage.svelte.d.ts +12 -1
- package/dist/components/select/Select.svelte +18 -2
- package/dist/components/select/Select.svelte.d.ts +7 -0
- package/dist/components/sidebar/SidebarContent.svelte +59 -13
- package/dist/components/sidebar/SidebarContent.svelte.d.ts +6 -0
- package/dist/components/sidebar/SidebarFolder.svelte +29 -2
- package/dist/components/sidebar/SidebarGroup.svelte +50 -7
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +10 -1
- package/dist/components/sidebar/SidebarItem.svelte +136 -21
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +22 -2
- package/dist/components/sidebar/SidebarSwitcher.svelte +18 -2
- package/dist/components/sidebar/SidebarSwitcher.svelte.d.ts +2 -0
- package/dist/components/sidebar/fold.d.ts +12 -0
- package/dist/components/sidebar/fold.js +8 -0
- package/dist/components/status-indicator/StatusDot.svelte +90 -0
- package/dist/components/status-indicator/StatusDot.svelte.d.ts +18 -0
- package/dist/components/toast/Toaster.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte +12 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +11 -1
- package/dist/components/toggle-group/ToggleGroupItem.svelte +10 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +7 -1
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +3 -1
- package/dist/components/toggle-group/context.d.ts +2 -1
- package/dist/components/tooltip/TooltipContent.svelte +13 -1
- package/dist/components/tooltip/TooltipContent.svelte.d.ts +10 -0
- package/dist/components/work-fold/WorkFold.svelte +13 -4
- package/dist/components/work-fold/WorkFold.svelte.d.ts +2 -1
- package/dist/focus-ring.d.ts +29 -0
- package/dist/focus-ring.js +42 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -2
- package/dist/internal/Collapse.svelte +15 -2
- package/dist/internal/Glyph.svelte +28 -0
- package/dist/internal/Glyph.svelte.d.ts +5 -0
- package/dist/internal/Tile.svelte +3 -2
- package/dist/internal/layer.d.ts +23 -0
- package/dist/internal/layer.js +19 -0
- package/dist/internal/toggle.d.ts +8 -1
- package/dist/internal/toggle.js +20 -2
- package/dist/markdown/file-paths.d.ts +7 -0
- package/dist/markdown/file-paths.js +29 -0
- package/dist/markdown/files.d.ts +22 -2
- package/dist/markdown/files.js +45 -14
- package/dist/tokens.stylex.d.ts +3 -0
- package/dist/tokens.stylex.js +5 -1
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +87 -8
- package/skills/building-ui/references/components.md +39 -38
- package/skills/markdown/SKILL.md +22 -6
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +10 -3
- package/skills/theming/SKILL.md +11 -4
|
@@ -5,6 +5,8 @@ export type SidebarSwitcherProps = Omit<SidebarItemProps, 'compact' | 'current'
|
|
|
5
5
|
leading?: Snippet | undefined;
|
|
6
6
|
/** The name of what is chosen now. */
|
|
7
7
|
children?: Snippet | undefined;
|
|
8
|
+
/** Just after the name: a StatusDot, say. The name is cut short before it is. */
|
|
9
|
+
aside?: Snippet | undefined;
|
|
8
10
|
};
|
|
9
11
|
declare const SidebarSwitcher: import("svelte").Component<SidebarSwitcherProps, {}, "">;
|
|
10
12
|
type SidebarSwitcher = ReturnType<typeof SidebarSwitcher>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the rows under a group or folder are folded away, and a way for the open row to stay
|
|
3
|
+
* in view while they are: a current row holds its group and folders open, and the rest of the
|
|
4
|
+
* rows hide. A folder passes the hold on, so the group above it stays open too.
|
|
5
|
+
*/
|
|
6
|
+
export type SidebarFold = {
|
|
7
|
+
folded: () => boolean;
|
|
8
|
+
/** Called by a current row; returns the release. */
|
|
9
|
+
hold: () => () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function getSidebarFold(): SidebarFold | undefined;
|
|
12
|
+
export declare function setSidebarFold(fold: SidebarFold | undefined): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
A dot of status colour, small enough to sit beside a name or on the corner of a mark: a
|
|
3
|
+
machine that is reachable, a thread with something new, a workspace at work. Its shape can say
|
|
4
|
+
it too, for those who cannot tell the colours apart: a ring while something is on its way, a
|
|
5
|
+
diamond when it failed. For a run's status, with a shape for each, use StatusIndicator.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts" module>
|
|
8
|
+
import * as stylex from '@stylexjs/stylex';
|
|
9
|
+
import { attrs, type Sx } from '../../internal/sx.js';
|
|
10
|
+
import { colors, radius } from '../../tokens.stylex.js';
|
|
11
|
+
|
|
12
|
+
export type StatusDotTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
13
|
+
export type StatusDotShape = 'dot' | 'ring' | 'diamond';
|
|
14
|
+
|
|
15
|
+
export type StatusDotProps = {
|
|
16
|
+
/** `accent` for something live or new; `success`, `warning` and `danger` once settled. */
|
|
17
|
+
tone?: StatusDotTone | undefined;
|
|
18
|
+
/** `ring` for something on its way, `diamond` for a failure; a filled dot otherwise. */
|
|
19
|
+
shape?: StatusDotShape | undefined;
|
|
20
|
+
/** Width and height, in pixels. */
|
|
21
|
+
size?: number | undefined;
|
|
22
|
+
/** Names it for assistive technology. Without one it is hidden, as words beside it say it. */
|
|
23
|
+
label?: string | null | undefined;
|
|
24
|
+
sx?: Sx | undefined;
|
|
25
|
+
class?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const styles = stylex.create({
|
|
29
|
+
root: {
|
|
30
|
+
display: 'inline-block',
|
|
31
|
+
flexShrink: 0,
|
|
32
|
+
boxSizing: 'border-box',
|
|
33
|
+
borderRadius: radius.pill,
|
|
34
|
+
verticalAlign: 'middle',
|
|
35
|
+
forcedColorAdjust: 'none'
|
|
36
|
+
},
|
|
37
|
+
ring: { backgroundColor: 'transparent' },
|
|
38
|
+
// A square on its point, a little smaller, so it weighs what the dot does
|
|
39
|
+
diamond: { borderRadius: '1px', transform: 'scale(0.75) rotate(45deg)' }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const fills = stylex.create({
|
|
43
|
+
neutral: { backgroundColor: colors.textSubtle },
|
|
44
|
+
accent: { backgroundColor: colors.accent },
|
|
45
|
+
success: { backgroundColor: colors.success },
|
|
46
|
+
warning: { backgroundColor: colors.warning },
|
|
47
|
+
danger: { backgroundColor: colors.danger }
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const rings = stylex.create({
|
|
51
|
+
neutral: { boxShadow: `inset 0 0 0 1px ${colors.textSubtle}` },
|
|
52
|
+
accent: { boxShadow: `inset 0 0 0 1px ${colors.accent}` },
|
|
53
|
+
success: { boxShadow: `inset 0 0 0 1px ${colors.success}` },
|
|
54
|
+
warning: { boxShadow: `inset 0 0 0 1px ${colors.warning}` },
|
|
55
|
+
danger: { boxShadow: `inset 0 0 0 1px ${colors.danger}` }
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
let {
|
|
61
|
+
tone = 'neutral',
|
|
62
|
+
shape = 'dot',
|
|
63
|
+
size = 6,
|
|
64
|
+
label,
|
|
65
|
+
sx,
|
|
66
|
+
class: className
|
|
67
|
+
}: StatusDotProps = $props();
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<span
|
|
71
|
+
role={label ? 'img' : undefined}
|
|
72
|
+
aria-label={label || undefined}
|
|
73
|
+
aria-hidden={label ? undefined : true}
|
|
74
|
+
data-slot="status-dot"
|
|
75
|
+
data-tone={tone}
|
|
76
|
+
data-shape={shape}
|
|
77
|
+
{...attrs(
|
|
78
|
+
[
|
|
79
|
+
styles.root,
|
|
80
|
+
fills[tone],
|
|
81
|
+
shape === 'ring' && styles.ring,
|
|
82
|
+
shape === 'ring' && rings[tone],
|
|
83
|
+
shape === 'diamond' && styles.diamond,
|
|
84
|
+
sx
|
|
85
|
+
],
|
|
86
|
+
className
|
|
87
|
+
)}
|
|
88
|
+
style:width="{size}px"
|
|
89
|
+
style:height="{size}px"
|
|
90
|
+
></span>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Sx } from '../../internal/sx.js';
|
|
2
|
+
export type StatusDotTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export type StatusDotShape = 'dot' | 'ring' | 'diamond';
|
|
4
|
+
export type StatusDotProps = {
|
|
5
|
+
/** `accent` for something live or new; `success`, `warning` and `danger` once settled. */
|
|
6
|
+
tone?: StatusDotTone | undefined;
|
|
7
|
+
/** `ring` for something on its way, `diamond` for a failure; a filled dot otherwise. */
|
|
8
|
+
shape?: StatusDotShape | undefined;
|
|
9
|
+
/** Width and height, in pixels. */
|
|
10
|
+
size?: number | undefined;
|
|
11
|
+
/** Names it for assistive technology. Without one it is hidden, as words beside it say it. */
|
|
12
|
+
label?: string | null | undefined;
|
|
13
|
+
sx?: Sx | undefined;
|
|
14
|
+
class?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
declare const StatusDot: import("svelte").Component<StatusDotProps, {}, "">;
|
|
17
|
+
type StatusDot = ReturnType<typeof StatusDot>;
|
|
18
|
+
export default StatusDot;
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
import { Toggle } from 'bits-ui';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
|
-
import { toggle, type ToggleSize } from '../../internal/toggle.js';
|
|
6
|
+
import { toggle, type ToggleSize, type ToggleTone } from '../../internal/toggle.js';
|
|
7
7
|
|
|
8
8
|
export type ToggleProps = Loose<
|
|
9
9
|
Omit<Toggle.RootProps, 'children' | 'child'> & {
|
|
10
10
|
size?: ToggleSize | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* How it shows it is pressed: lit in the `accent`, or `neutral`, in the fill of what is
|
|
13
|
+
* chosen, for a toolbar's icons that show or hide something.
|
|
14
|
+
*/
|
|
15
|
+
tone?: ToggleTone | undefined;
|
|
11
16
|
/** Square, for a single icon. Give it an `aria-label`. */
|
|
12
17
|
iconOnly?: boolean | undefined;
|
|
13
18
|
sx?: Sx | undefined;
|
|
@@ -22,6 +27,7 @@
|
|
|
22
27
|
pressed = $bindable(false),
|
|
23
28
|
ref = $bindable(null),
|
|
24
29
|
size = 'md',
|
|
30
|
+
tone = 'accent',
|
|
25
31
|
iconOnly = false,
|
|
26
32
|
sx,
|
|
27
33
|
class: className,
|
|
@@ -36,8 +42,12 @@
|
|
|
36
42
|
bind:pressed
|
|
37
43
|
bind:ref
|
|
38
44
|
data-slot="toggle"
|
|
45
|
+
data-tone={tone}
|
|
39
46
|
{...rest}
|
|
40
|
-
{...attrs(
|
|
47
|
+
{...attrs(
|
|
48
|
+
[toggle.base, tone === 'neutral' && toggle.neutral, toggle[size], iconOnly && square[size], sx],
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
41
51
|
>
|
|
42
52
|
{@render children?.()}
|
|
43
53
|
</Toggle.Root>
|
|
@@ -2,9 +2,14 @@ import type { Loose } from '../../internal/loose.js';
|
|
|
2
2
|
import { Toggle } from 'bits-ui';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
|
-
import { type ToggleSize } from '../../internal/toggle.js';
|
|
5
|
+
import { type ToggleSize, type ToggleTone } from '../../internal/toggle.js';
|
|
6
6
|
export type ToggleProps = Loose<Omit<Toggle.RootProps, 'children' | 'child'> & {
|
|
7
7
|
size?: ToggleSize | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* How it shows it is pressed: lit in the `accent`, or `neutral`, in the fill of what is
|
|
10
|
+
* chosen, for a toolbar's icons that show or hide something.
|
|
11
|
+
*/
|
|
12
|
+
tone?: ToggleTone | undefined;
|
|
8
13
|
/** Square, for a single icon. Give it an `aria-label`. */
|
|
9
14
|
iconOnly?: boolean | undefined;
|
|
10
15
|
sx?: Sx | undefined;
|
|
@@ -13,6 +18,11 @@ export type ToggleProps = Loose<Omit<Toggle.RootProps, 'children' | 'child'> & {
|
|
|
13
18
|
}>;
|
|
14
19
|
declare const Toggle: import("svelte").Component<Loose<Omit<Toggle.RootProps, "children" | "child"> & {
|
|
15
20
|
size?: ToggleSize | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* How it shows it is pressed: lit in the `accent`, or `neutral`, in the fill of what is
|
|
23
|
+
* chosen, for a toolbar's icons that show or hide something.
|
|
24
|
+
*/
|
|
25
|
+
tone?: ToggleTone | undefined;
|
|
16
26
|
/** Square, for a single icon. Give it an `aria-label`. */
|
|
17
27
|
iconOnly?: boolean | undefined;
|
|
18
28
|
sx?: Sx | undefined;
|
|
@@ -34,7 +34,16 @@
|
|
|
34
34
|
bind:ref
|
|
35
35
|
data-slot="toggle-group-item"
|
|
36
36
|
{...rest}
|
|
37
|
-
{...attrs(
|
|
37
|
+
{...attrs(
|
|
38
|
+
[
|
|
39
|
+
toggle.base,
|
|
40
|
+
group.tone === 'neutral' && toggle.neutral,
|
|
41
|
+
toggle[group.size],
|
|
42
|
+
iconOnly && square[group.size],
|
|
43
|
+
sx
|
|
44
|
+
],
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
38
47
|
>
|
|
39
48
|
{@render children?.()}
|
|
40
49
|
</ToggleGroup.Item>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
import type { Loose } from '../../internal/loose.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
|
-
import type { ToggleSize } from '../../internal/toggle.js';
|
|
7
|
+
import type { ToggleSize, ToggleTone } from '../../internal/toggle.js';
|
|
8
8
|
import { setToggleGroupContext } from './context.js';
|
|
9
9
|
|
|
10
10
|
type Base = {
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
orientation?: 'horizontal' | 'vertical' | undefined;
|
|
15
15
|
/** The size of every item. */
|
|
16
16
|
size?: ToggleSize | undefined;
|
|
17
|
+
/** How a pressed item shows it: lit in the `accent`, or `neutral`, in the fill of what is chosen. */
|
|
18
|
+
tone?: ToggleTone | undefined;
|
|
17
19
|
sx?: Sx | undefined;
|
|
18
20
|
ref?: HTMLElement | null | undefined;
|
|
19
21
|
/** ToggleGroup.Item buttons. */
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
value = $bindable(),
|
|
63
65
|
onValueChange,
|
|
64
66
|
size = 'md',
|
|
67
|
+
tone = 'accent',
|
|
65
68
|
orientation = 'horizontal',
|
|
66
69
|
ref = $bindable(null),
|
|
67
70
|
sx,
|
|
@@ -73,6 +76,9 @@
|
|
|
73
76
|
setToggleGroupContext({
|
|
74
77
|
get size() {
|
|
75
78
|
return size;
|
|
79
|
+
},
|
|
80
|
+
get tone() {
|
|
81
|
+
return tone;
|
|
76
82
|
}
|
|
77
83
|
});
|
|
78
84
|
|
|
@@ -2,7 +2,7 @@ import { ToggleGroup } from 'bits-ui';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { Loose } from '../../internal/loose.js';
|
|
4
4
|
import { type Sx } from '../../internal/sx.js';
|
|
5
|
-
import type { ToggleSize } from '../../internal/toggle.js';
|
|
5
|
+
import type { ToggleSize, ToggleTone } from '../../internal/toggle.js';
|
|
6
6
|
type Base = {
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
8
|
/** Whether the arrow keys wrap from the last item to the first. */
|
|
@@ -10,6 +10,8 @@ type Base = {
|
|
|
10
10
|
orientation?: 'horizontal' | 'vertical' | undefined;
|
|
11
11
|
/** The size of every item. */
|
|
12
12
|
size?: ToggleSize | undefined;
|
|
13
|
+
/** How a pressed item shows it: lit in the `accent`, or `neutral`, in the fill of what is chosen. */
|
|
14
|
+
tone?: ToggleTone | undefined;
|
|
13
15
|
sx?: Sx | undefined;
|
|
14
16
|
ref?: HTMLElement | null | undefined;
|
|
15
17
|
/** ToggleGroup.Item buttons. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ToggleSize } from '../../internal/toggle.js';
|
|
1
|
+
import type { ToggleSize, ToggleTone } from '../../internal/toggle.js';
|
|
2
2
|
export type ToggleGroupContext = {
|
|
3
3
|
readonly size: ToggleSize;
|
|
4
|
+
readonly tone: ToggleTone;
|
|
4
5
|
};
|
|
5
6
|
export declare function setToggleGroupContext(context: ToggleGroupContext): void;
|
|
6
7
|
export declare function getToggleGroupContext(part: string): ToggleGroupContext;
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
Omit<Tooltip.ContentProps, 'children' | 'child'> & {
|
|
13
13
|
/** The keys that do the same, shown after the label: `['⌘', 'K']`. */
|
|
14
14
|
shortcut?: string[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* `row` keeps the label and the shortcut on one line. `column` sets the content one
|
|
17
|
+
* part under another: a title, then a line or two that says more.
|
|
18
|
+
*/
|
|
19
|
+
layout?: 'row' | 'column' | undefined;
|
|
15
20
|
sx?: Sx | undefined;
|
|
16
21
|
children?: Snippet | undefined;
|
|
17
22
|
}
|
|
@@ -48,6 +53,12 @@
|
|
|
48
53
|
// toolbar should feel quick, not like each button is thinking
|
|
49
54
|
transitionDuration: { default: '120ms', [CLOSED]: '80ms', [INSTANT]: '0ms' }
|
|
50
55
|
},
|
|
56
|
+
column: {
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
alignItems: 'flex-start',
|
|
59
|
+
gap: '0.125rem',
|
|
60
|
+
paddingBlock: '0.4375rem'
|
|
61
|
+
},
|
|
51
62
|
keys: { display: 'inline-flex', gap: '0.125rem' }
|
|
52
63
|
});
|
|
53
64
|
</script>
|
|
@@ -57,6 +68,7 @@
|
|
|
57
68
|
sideOffset = 6,
|
|
58
69
|
collisionPadding = 8,
|
|
59
70
|
shortcut,
|
|
71
|
+
layout = 'row',
|
|
60
72
|
sx,
|
|
61
73
|
class: className,
|
|
62
74
|
children,
|
|
@@ -70,7 +82,7 @@
|
|
|
70
82
|
{collisionPadding}
|
|
71
83
|
data-slot="tooltip"
|
|
72
84
|
{...rest}
|
|
73
|
-
{...attrs([styles.content, sx], className)}
|
|
85
|
+
{...attrs([styles.content, layout === 'column' && styles.column, sx], className)}
|
|
74
86
|
>
|
|
75
87
|
{@render children?.()}
|
|
76
88
|
{#if shortcut?.length}
|
|
@@ -5,12 +5,22 @@ import { type Sx } from '../../internal/sx.js';
|
|
|
5
5
|
export type TooltipContentProps = Loose<Omit<Tooltip.ContentProps, 'children' | 'child'> & {
|
|
6
6
|
/** The keys that do the same, shown after the label: `['⌘', 'K']`. */
|
|
7
7
|
shortcut?: string[] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* `row` keeps the label and the shortcut on one line. `column` sets the content one
|
|
10
|
+
* part under another: a title, then a line or two that says more.
|
|
11
|
+
*/
|
|
12
|
+
layout?: 'row' | 'column' | undefined;
|
|
8
13
|
sx?: Sx | undefined;
|
|
9
14
|
children?: Snippet | undefined;
|
|
10
15
|
}>;
|
|
11
16
|
declare const TooltipContent: import("svelte").Component<Loose<Omit<Tooltip.ContentProps, "children" | "child"> & {
|
|
12
17
|
/** The keys that do the same, shown after the label: `['⌘', 'K']`. */
|
|
13
18
|
shortcut?: string[] | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* `row` keeps the label and the shortcut on one line. `column` sets the content one
|
|
21
|
+
* part under another: a title, then a line or two that says more.
|
|
22
|
+
*/
|
|
23
|
+
layout?: "row" | "column" | undefined;
|
|
14
24
|
sx?: Sx | undefined;
|
|
15
25
|
children?: Snippet | undefined;
|
|
16
26
|
}>, {}, "">;
|
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
13
13
|
import { media } from '../../media.stylex.js';
|
|
14
14
|
import CollapsibleContent from '../collapsible/CollapsibleContent.svelte';
|
|
15
|
-
import CollapsibleRoot
|
|
15
|
+
import CollapsibleRoot, {
|
|
16
|
+
type CollapsibleRootProps
|
|
17
|
+
} from '../collapsible/CollapsibleRoot.svelte';
|
|
16
18
|
|
|
17
|
-
export type WorkFoldProps = {
|
|
19
|
+
export type WorkFoldProps = Omit<CollapsibleRootProps, 'children' | 'open' | 'sx' | 'class'> & {
|
|
18
20
|
/** What the fold holds, in words: "Worked for 2m 5s". */
|
|
19
21
|
label: string;
|
|
20
22
|
/** Whether the work shows. Bindable. */
|
|
@@ -65,12 +67,19 @@
|
|
|
65
67
|
</script>
|
|
66
68
|
|
|
67
69
|
<script lang="ts">
|
|
68
|
-
let {
|
|
70
|
+
let {
|
|
71
|
+
label,
|
|
72
|
+
open = $bindable(false),
|
|
73
|
+
sx,
|
|
74
|
+
class: className,
|
|
75
|
+
children,
|
|
76
|
+
...rest
|
|
77
|
+
}: WorkFoldProps = $props();
|
|
69
78
|
|
|
70
79
|
const uid = $props.id();
|
|
71
80
|
</script>
|
|
72
81
|
|
|
73
|
-
<CollapsibleRoot bind:open data-slot="work-fold" {sx} class={className}>
|
|
82
|
+
<CollapsibleRoot bind:open data-slot="work-fold" {...rest} {sx} class={className}>
|
|
74
83
|
<Collapsible.Trigger id="{uid}-trigger" {...stylex.attrs(styles.trigger)}>
|
|
75
84
|
<Tile glyph="layers" />
|
|
76
85
|
<span {...stylex.attrs(styles.label)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { Sx } from '../../internal/sx.js';
|
|
3
|
-
|
|
3
|
+
import { type CollapsibleRootProps } from '../collapsible/CollapsibleRoot.svelte';
|
|
4
|
+
export type WorkFoldProps = Omit<CollapsibleRootProps, 'children' | 'open' | 'sx' | 'class'> & {
|
|
4
5
|
/** What the fold holds, in words: "Worked for 2m 5s". */
|
|
5
6
|
label: string;
|
|
6
7
|
/** Whether the work shows. Bindable. */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus as Narvi's own parts show it, for an element of your own.
|
|
3
|
+
*
|
|
4
|
+
* - `ring`: for anything that takes focus, such as a button or a row. A 2px ring in the
|
|
5
|
+
* accent, 2px out, when the keyboard brings focus there, and none for a click. Normally it
|
|
6
|
+
* is a transparent hairline, which forced-colours mode turns into an edge.
|
|
7
|
+
* - `frame`: for a frame around a field, such as the box around an editor of your own. Its
|
|
8
|
+
* hairline turns to the ring, with a halo, while a field in it is typed into, as a text
|
|
9
|
+
* field's does. Buttons inside the frame show their own focus, not the frame's.
|
|
10
|
+
*
|
|
11
|
+
* <button {...stylex.attrs(focusRing.ring, styles.chip)}>
|
|
12
|
+
* <div {...stylex.attrs(focusRing.frame, styles.box)}>…your editor…</div>
|
|
13
|
+
*/
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
15
|
+
export declare const focusRing: Readonly<{
|
|
16
|
+
readonly ring: Readonly<{
|
|
17
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "solid">;
|
|
18
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", "1px" | "2px">;
|
|
19
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", string>;
|
|
20
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "2px" | "-1px">;
|
|
21
|
+
}>;
|
|
22
|
+
readonly frame: Readonly<{
|
|
23
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `inset 0 0 0 1px ${stylex.StyleXVar<string>}` | `inset 0 0 0 1px ${stylex.StyleXVar<string>}, 0 0 0 3px ${stylex.StyleXVar<string>}`>;
|
|
24
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "solid">;
|
|
25
|
+
readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", "transparent">;
|
|
26
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "-1px">;
|
|
27
|
+
readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", "1px" | "2px">;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus as Narvi's own parts show it, for an element of your own.
|
|
3
|
+
*
|
|
4
|
+
* - `ring`: for anything that takes focus, such as a button or a row. A 2px ring in the
|
|
5
|
+
* accent, 2px out, when the keyboard brings focus there, and none for a click. Normally it
|
|
6
|
+
* is a transparent hairline, which forced-colours mode turns into an edge.
|
|
7
|
+
* - `frame`: for a frame around a field, such as the box around an editor of your own. Its
|
|
8
|
+
* hairline turns to the ring, with a halo, while a field in it is typed into, as a text
|
|
9
|
+
* field's does. Buttons inside the frame show their own focus, not the frame's.
|
|
10
|
+
*
|
|
11
|
+
* <button {...stylex.attrs(focusRing.ring, styles.chip)}>
|
|
12
|
+
* <div {...stylex.attrs(focusRing.frame, styles.box)}>…your editor…</div>
|
|
13
|
+
*/
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
15
|
+
import { colors } from './tokens.stylex.js';
|
|
16
|
+
import { media } from './media.stylex.js';
|
|
17
|
+
// A field inside the frame, as it takes the keyboard. A text field matches `:focus-visible`
|
|
18
|
+
// for a click too, as it is typed into either way.
|
|
19
|
+
const FIELD = `:has(:is(input, textarea, [contenteditable]:not([contenteditable="false"])):focus-visible)`;
|
|
20
|
+
const styles = stylex.create({
|
|
21
|
+
ring: {
|
|
22
|
+
outlineStyle: 'solid',
|
|
23
|
+
outlineWidth: { default: '1px', ':focus-visible': '2px' },
|
|
24
|
+
outlineColor: { default: 'transparent', ':focus-visible': colors.focusRing },
|
|
25
|
+
outlineOffset: { default: '-1px', ':focus-visible': '2px' }
|
|
26
|
+
},
|
|
27
|
+
frame: {
|
|
28
|
+
boxShadow: {
|
|
29
|
+
default: `inset 0 0 0 1px ${colors.border}`,
|
|
30
|
+
[FIELD]: `inset 0 0 0 1px ${colors.focusRing}, 0 0 0 3px ${colors.focusHalo}`
|
|
31
|
+
},
|
|
32
|
+
// In forced colours the shadow is gone; the outline is the edge, and thickens with focus
|
|
33
|
+
outlineStyle: 'solid',
|
|
34
|
+
outlineColor: 'transparent',
|
|
35
|
+
outlineOffset: '-1px',
|
|
36
|
+
outlineWidth: {
|
|
37
|
+
default: '1px',
|
|
38
|
+
[media.forcedColors]: { default: '1px', ':focus-within': '2px' }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export const focusRing = styles;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * as AppShell from './components/app-shell/index.js';
|
|
|
4
4
|
export { getAppShellContext } from './components/app-shell/index.js';
|
|
5
5
|
export type { AppShellBarProps, AppShellContext, AppShellHeaderProps, AppShellMainProps, AppShellPanelProps, AppShellPanesProps, AppShellRailProps, AppShellRootProps, AppShellSheetProps, AppShellSidebarProps, AppShellToggleProps } from './components/app-shell/index.js';
|
|
6
6
|
export * as Activity from './components/activity/index.js';
|
|
7
|
-
export type { ActivityContentProps, ActivityRootProps, ActivityStepKind, ActivityStepProps, ActivityStepStatus, ActivityThoughtProps, ActivityTriggerProps } from './components/activity/index.js';
|
|
7
|
+
export type { ActivityContentProps, ActivityIconProps, ActivityIconTone, ActivityRootProps, ActivityStepKind, ActivityStepProps, ActivityStepStatus, ActivityThoughtProps, ActivityTriggerProps } from './components/activity/index.js';
|
|
8
8
|
export { default as Announcer } from './components/announcer/Announcer.svelte';
|
|
9
9
|
export type { AnnouncerProps } from './components/announcer/Announcer.svelte';
|
|
10
10
|
export * as Avatar from './components/avatar/index.js';
|
|
@@ -55,7 +55,7 @@ export type { FrameProps } from './components/frame/Frame.svelte';
|
|
|
55
55
|
export { default as Grid } from './components/grid/Grid.svelte';
|
|
56
56
|
export type { GridAlign, GridColumns, GridGap, GridProps } from './components/grid/Grid.svelte';
|
|
57
57
|
export { default as Heading } from './components/heading/Heading.svelte';
|
|
58
|
-
export type { HeadingLevel, HeadingProps, HeadingSize } from './components/heading/Heading.svelte';
|
|
58
|
+
export type { HeadingLevel, HeadingProps, HeadingSize, HeadingWeight } from './components/heading/Heading.svelte';
|
|
59
59
|
export * as HoverCard from './components/hover-card/index.js';
|
|
60
60
|
export type { HoverCardContentProps, HoverCardRootProps } from './components/hover-card/index.js';
|
|
61
61
|
export { default as Input } from './components/input/Input.svelte';
|
|
@@ -65,9 +65,9 @@ export type { KbdProps } from './components/kbd/Kbd.svelte';
|
|
|
65
65
|
export { default as Link } from './components/link/Link.svelte';
|
|
66
66
|
export type { LinkProps } from './components/link/Link.svelte';
|
|
67
67
|
export * as Menu from './components/menu/index.js';
|
|
68
|
-
export type { MenuCheckboxItemProps, MenuContentProps, MenuItemProps, MenuLabelProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentProps, MenuSubTriggerProps } from './components/menu/index.js';
|
|
68
|
+
export type { MenuCheckboxItemProps, MenuContentProps, MenuGroupProps, MenuItemProps, MenuLabelProps, MenuRadioGroupProps, MenuRadioItemProps, MenuSeparatorProps, MenuSubContentProps, MenuSubTriggerProps } from './components/menu/index.js';
|
|
69
69
|
export * as Message from './components/message/index.js';
|
|
70
|
-
export type { MessageActionProps, MessageActionsProps, MessageContentProps, MessageCopyProps, MessageFrom, MessageHeaderProps, MessagePendingProps, MessageRootProps, MessageTimeProps } from './components/message/index.js';
|
|
70
|
+
export type { MessageActionProps, MessageActionsProps, MessageBubbleProps, MessageContentProps, MessageCopyProps, MessageFrom, MessageHeaderProps, MessagePendingProps, MessageRootProps, MessageTextSize, MessageTimeProps } from './components/message/index.js';
|
|
71
71
|
export { default as Markdown } from './components/markdown/Markdown.svelte';
|
|
72
72
|
export type { MarkdownProps } from './components/markdown/Markdown.svelte';
|
|
73
73
|
export { copyAsWritten } from './components/markdown/copy.js';
|
|
@@ -86,7 +86,7 @@ export type { PopoverContentProps } from './components/popover/index.js';
|
|
|
86
86
|
export { default as Questionnaire } from './components/questionnaire/Questionnaire.svelte';
|
|
87
87
|
export type { Question, QuestionAnswer, QuestionnaireAnswers, QuestionnaireProps } from './components/questionnaire/Questionnaire.svelte';
|
|
88
88
|
export { default as QueuedMessage } from './components/queued-message/QueuedMessage.svelte';
|
|
89
|
-
export type { QueuedMessageProps, QueuedMessageStatus } from './components/queued-message/QueuedMessage.svelte';
|
|
89
|
+
export type { QueuedMessageAction, QueuedMessageProps, QueuedMessageStatus } from './components/queued-message/QueuedMessage.svelte';
|
|
90
90
|
export * as Rail from './components/rail/index.js';
|
|
91
91
|
export type { RailItemProps, RailRootProps } from './components/rail/index.js';
|
|
92
92
|
export * as Reasoning from './components/reasoning/index.js';
|
|
@@ -127,6 +127,8 @@ export type { StackAlign, StackDirection, StackGap, StackJustify, StackProps } f
|
|
|
127
127
|
export * as Suggestions from './components/suggestions/index.js';
|
|
128
128
|
export type { SuggestionsItemProps, SuggestionsRootProps } from './components/suggestions/index.js';
|
|
129
129
|
export { default as StatusIndicator } from './components/status-indicator/StatusIndicator.svelte';
|
|
130
|
+
export { default as StatusDot } from './components/status-indicator/StatusDot.svelte';
|
|
131
|
+
export type { StatusDotProps, StatusDotShape, StatusDotTone } from './components/status-indicator/StatusDot.svelte';
|
|
130
132
|
export type { Status, StatusIndicatorProps } from './components/status-indicator/StatusIndicator.svelte';
|
|
131
133
|
export { default as Switch } from './components/switch/Switch.svelte';
|
|
132
134
|
export type { SwitchProps } from './components/switch/Switch.svelte';
|
|
@@ -139,12 +141,13 @@ export type { TextFace, TextProps, TextTone, TextVariant, TextWeight } from './c
|
|
|
139
141
|
export { typography } from './typography.js';
|
|
140
142
|
export type { TypeRole } from './typography.js';
|
|
141
143
|
export { visuallyHidden } from './visually-hidden.js';
|
|
144
|
+
export { focusRing } from './focus-ring.js';
|
|
142
145
|
export type { IconComponent } from './internal/icon.js';
|
|
143
146
|
export { default as Textarea } from './components/textarea/Textarea.svelte';
|
|
144
147
|
export type { TextareaProps } from './components/textarea/Textarea.svelte';
|
|
145
148
|
export { default as Toggle } from './components/toggle/Toggle.svelte';
|
|
146
149
|
export type { ToggleProps } from './components/toggle/Toggle.svelte';
|
|
147
|
-
export type { ToggleSize } from './internal/toggle.js';
|
|
150
|
+
export type { ToggleSize, ToggleTone } from './internal/toggle.js';
|
|
148
151
|
export * as ToggleGroup from './components/toggle-group/index.js';
|
|
149
152
|
export type { ToggleGroupItemProps, ToggleGroupRootProps } from './components/toggle-group/index.js';
|
|
150
153
|
export * as Tool from './components/tool/index.js';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,8 @@ export { default as Approval } from './components/approval/Approval.svelte';
|
|
|
4
4
|
// <AppShell.Sidebar>, <AppShell.Main>, <AppShell.Header>, <AppShell.Panel>, <AppShell.Toggle>
|
|
5
5
|
export * as AppShell from './components/app-shell/index.js';
|
|
6
6
|
export { getAppShellContext } from './components/app-shell/index.js';
|
|
7
|
-
// Compound: <Activity.Root>, <Activity.Trigger>, <Activity.Content>, <Activity.Step>, <Activity.Thought
|
|
7
|
+
// Compound: <Activity.Root>, <Activity.Trigger>, <Activity.Content>, <Activity.Step>, <Activity.Thought>,
|
|
8
|
+
// <Activity.Icon>
|
|
8
9
|
export * as Activity from './components/activity/index.js';
|
|
9
10
|
export { default as Announcer } from './components/announcer/Announcer.svelte';
|
|
10
11
|
// Compound: <Avatar.Root>, <Avatar.Image>, <Avatar.Fallback>
|
|
@@ -52,7 +53,8 @@ export { default as Link } from './components/link/Link.svelte';
|
|
|
52
53
|
// Compound: <Menu.Root>, <Menu.Trigger>, <Menu.Content>, <Menu.Item>, <Menu.CheckboxItem>,
|
|
53
54
|
// <Menu.RadioGroup>, <Menu.RadioItem>, <Menu.Group>, <Menu.Label>, <Menu.Separator>, <Menu.Sub>…
|
|
54
55
|
export * as Menu from './components/menu/index.js';
|
|
55
|
-
// Compound: <Message.Root>, <Message.Header>, <Message.Pending>, <Message.Content>, <Message.
|
|
56
|
+
// Compound: <Message.Root>, <Message.Header>, <Message.Pending>, <Message.Content>, <Message.Bubble>,
|
|
57
|
+
// <Message.Actions>, <Message.Action>, <Message.Copy>, <Message.Time>
|
|
56
58
|
export * as Message from './components/message/index.js';
|
|
57
59
|
export { default as Markdown } from './components/markdown/Markdown.svelte';
|
|
58
60
|
export { copyAsWritten } from './components/markdown/copy.js';
|
|
@@ -94,6 +96,7 @@ export { default as Stack } from './components/stack/Stack.svelte';
|
|
|
94
96
|
// Compound: <Suggestions.Root>, <Suggestions.Item>
|
|
95
97
|
export * as Suggestions from './components/suggestions/index.js';
|
|
96
98
|
export { default as StatusIndicator } from './components/status-indicator/StatusIndicator.svelte';
|
|
99
|
+
export { default as StatusDot } from './components/status-indicator/StatusDot.svelte';
|
|
97
100
|
export { default as Switch } from './components/switch/Switch.svelte';
|
|
98
101
|
export { default as TabStrip } from './components/tab-strip/TabStrip.svelte';
|
|
99
102
|
export { default as Tabs } from './components/tabs/Tabs.svelte';
|
|
@@ -102,6 +105,9 @@ export { default as Text } from './components/text/Text.svelte';
|
|
|
102
105
|
export { typography } from './typography.js';
|
|
103
106
|
// Hidden from sight, kept for assistive technology: `stylex.attrs(visuallyHidden)`
|
|
104
107
|
export { visuallyHidden } from './visually-hidden.js';
|
|
108
|
+
// Focus as Narvi's parts show it: `focusRing.ring` for a control of your own, `focusRing.frame`
|
|
109
|
+
// for the box around a field of your own
|
|
110
|
+
export { focusRing } from './focus-ring.js';
|
|
105
111
|
export { default as Textarea } from './components/textarea/Textarea.svelte';
|
|
106
112
|
export { default as Toggle } from './components/toggle/Toggle.svelte';
|
|
107
113
|
// Compound: <ToggleGroup.Root>, <ToggleGroup.Item>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
A region that folds open and shut. Its height eases between nothing and its
|
|
3
3
|
content's height by moving a grid row between 0fr and 1fr, which needs no
|
|
4
4
|
measuring. While shut it is inert: out of the tab order and the accessibility tree.
|
|
5
|
+
Once it has finished closing, its content is not rendered either, so the page's find,
|
|
6
|
+
`checkVisibility()` and a test's visibility checks all know it is not shown.
|
|
5
7
|
-->
|
|
6
8
|
<script lang="ts" module>
|
|
7
9
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -24,9 +26,20 @@
|
|
|
24
26
|
gridTemplateRows: '1fr',
|
|
25
27
|
opacity: 1
|
|
26
28
|
},
|
|
29
|
+
// Shut, the content stops being rendered at the end of the fold, and starts again as it
|
|
30
|
+
// opens: `visibility` turns at those ends by itself, `content-visibility` as a discrete step
|
|
27
31
|
inner: {
|
|
28
32
|
minHeight: 0,
|
|
29
|
-
overflow: 'hidden'
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
visibility: 'hidden',
|
|
35
|
+
contentVisibility: 'hidden',
|
|
36
|
+
transitionProperty: 'visibility, content-visibility',
|
|
37
|
+
transitionBehavior: 'allow-discrete',
|
|
38
|
+
transitionDuration: motion.slow
|
|
39
|
+
},
|
|
40
|
+
innerOpen: {
|
|
41
|
+
visibility: 'visible',
|
|
42
|
+
contentVisibility: 'visible'
|
|
30
43
|
}
|
|
31
44
|
});
|
|
32
45
|
</script>
|
|
@@ -50,7 +63,7 @@
|
|
|
50
63
|
</script>
|
|
51
64
|
|
|
52
65
|
<div inert={!open} {...rest} {...attrs([styles.region, open && styles.open, sx], className)}>
|
|
53
|
-
<div {...stylex.attrs(styles.inner)}>
|
|
66
|
+
<div {...stylex.attrs(styles.inner, open && styles.innerOpen)}>
|
|
54
67
|
<div {...attrs([innerSx], innerClass)}>
|
|
55
68
|
{@render children?.()}
|
|
56
69
|
</div>
|