@diegopluna/narvi 0.0.2 → 0.2.0
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/README.md +116 -44
- package/dist/base.css +96 -0
- package/dist/color.d.ts +1 -1
- package/dist/color.js +1 -1
- package/dist/components/activity/ActivityContent.svelte +3 -15
- package/dist/components/activity/ActivityStep.svelte +12 -12
- package/dist/components/activity/ActivityThought.svelte +4 -4
- package/dist/components/activity/ActivityTrigger.svelte +5 -6
- package/dist/components/app-shell/AppShellBar.svelte +89 -0
- package/dist/components/app-shell/AppShellBar.svelte.d.ts +20 -0
- package/dist/components/app-shell/AppShellHeader.svelte +17 -17
- package/dist/components/app-shell/AppShellHeader.svelte.d.ts +2 -2
- package/dist/components/app-shell/AppShellMain.svelte +4 -20
- package/dist/components/app-shell/AppShellPanel.svelte +21 -19
- package/dist/components/app-shell/AppShellPanes.svelte +58 -0
- package/dist/components/app-shell/AppShellPanes.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRail.svelte +85 -0
- package/dist/components/app-shell/AppShellRail.svelte.d.ts +11 -0
- package/dist/components/app-shell/AppShellRoot.svelte +50 -24
- package/dist/components/app-shell/AppShellRoot.svelte.d.ts +8 -6
- package/dist/components/app-shell/AppShellSheet.svelte +95 -0
- package/dist/components/app-shell/AppShellSheet.svelte.d.ts +17 -0
- package/dist/components/app-shell/AppShellSidebar.svelte +41 -65
- package/dist/components/app-shell/AppShellSidebar.svelte.d.ts +1 -5
- package/dist/components/app-shell/AppShellToggle.svelte +62 -23
- package/dist/components/app-shell/AppShellToggle.svelte.d.ts +2 -0
- package/dist/components/app-shell/context.d.ts +6 -0
- package/dist/components/app-shell/index.d.ts +9 -1
- package/dist/components/app-shell/index.js +5 -1
- package/dist/components/approval/Approval.svelte +99 -23
- package/dist/components/approval/Approval.svelte.d.ts +7 -0
- package/dist/components/avatar/AvatarFallback.svelte +1 -2
- package/dist/components/avatar/AvatarRoot.svelte +2 -2
- package/dist/components/badge/Badge.svelte +5 -5
- package/dist/components/button/Button.svelte +227 -51
- package/dist/components/button/Button.svelte.d.ts +38 -2
- package/dist/components/card/Card.svelte +19 -33
- package/dist/components/change-stats/ChangeStats.svelte +1 -2
- package/dist/components/changes-summary/ChangesSummary.svelte +14 -15
- package/dist/components/checkbox/Checkbox.svelte +31 -25
- package/dist/components/checkbox/Checkbox.svelte.d.ts +5 -0
- package/dist/components/code/Code.svelte +1 -2
- package/dist/components/collapsible/CollapsibleContent.svelte +38 -0
- package/dist/components/collapsible/CollapsibleContent.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte +44 -0
- package/dist/components/collapsible/CollapsibleRoot.svelte.d.ts +11 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte +83 -0
- package/dist/components/collapsible/CollapsibleTrigger.svelte.d.ts +13 -0
- package/dist/components/collapsible/context.d.ts +5 -0
- package/dist/components/collapsible/context.js +11 -0
- package/dist/components/collapsible/index.d.ts +7 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/command/CommandItem.svelte +1 -1
- package/dist/components/command/styles.d.ts +3 -2
- package/dist/components/command/styles.js +15 -12
- package/dist/components/composer/ComposerAttachButton.svelte +1 -1
- package/dist/components/composer/ComposerAttachment.svelte +13 -18
- package/dist/components/composer/ComposerModelPicker.svelte +24 -28
- package/dist/components/composer/ComposerRoot.svelte +15 -13
- package/dist/components/composer/ComposerSubmit.svelte +12 -20
- package/dist/components/composer/ComposerTextarea.svelte +1 -1
- package/dist/components/composer/ComposerToggle.svelte +16 -18
- package/dist/components/composer/ComposerTray.svelte +78 -0
- package/dist/components/composer/ComposerTray.svelte.d.ts +15 -0
- package/dist/components/composer/index.d.ts +3 -1
- package/dist/components/composer/index.js +3 -2
- package/dist/components/conversation/ConversationContent.svelte +3 -2
- package/dist/components/conversation/ConversationEmpty.svelte +1 -1
- package/dist/components/conversation/ConversationScrollButton.svelte +9 -11
- package/dist/components/dialog/ConfirmDialog.svelte +1 -1
- package/dist/components/dialog/DialogContent.svelte +5 -1
- package/dist/components/dialog/styles.d.ts +2 -26
- package/dist/components/dialog/styles.js +12 -49
- package/dist/components/divider/Divider.svelte +3 -3
- package/dist/components/empty-state/EmptyState.svelte +4 -5
- package/dist/components/field/Field.svelte +4 -4
- package/dist/components/frame/Frame.svelte +6 -7
- package/dist/components/frame/Frame.svelte.d.ts +1 -1
- package/dist/components/grid/Grid.svelte +111 -0
- package/dist/components/grid/Grid.svelte.d.ts +27 -0
- package/dist/components/heading/Heading.svelte +2 -2
- package/dist/components/hover-card/HoverCardContent.svelte +50 -0
- package/dist/components/hover-card/HoverCardContent.svelte.d.ts +10 -0
- package/dist/components/hover-card/HoverCardRoot.svelte +22 -0
- package/dist/components/hover-card/HoverCardRoot.svelte.d.ts +5 -0
- package/dist/components/hover-card/index.d.ts +7 -0
- package/dist/components/hover-card/index.js +7 -0
- package/dist/components/kbd/Kbd.svelte +12 -7
- package/dist/components/link/Link.svelte +9 -7
- package/dist/components/link/Link.svelte.d.ts +4 -1
- package/dist/components/markdown/Markdown.svelte +714 -0
- package/dist/components/markdown/Markdown.svelte.d.ts +80 -0
- package/dist/components/markdown/MarkdownBlock.svelte +231 -0
- package/dist/components/markdown/MarkdownBlock.svelte.d.ts +11 -0
- package/dist/components/markdown/MarkdownBlocks.svelte +115 -0
- package/dist/components/markdown/MarkdownBlocks.svelte.d.ts +15 -0
- package/dist/components/markdown/MarkdownCode.svelte +583 -0
- package/dist/components/markdown/MarkdownCode.svelte.d.ts +23 -0
- package/dist/components/markdown/MarkdownDiagram.svelte +310 -0
- package/dist/components/markdown/MarkdownDiagram.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownFile.svelte +134 -0
- package/dist/components/markdown/MarkdownFile.svelte.d.ts +19 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte +61 -0
- package/dist/components/markdown/MarkdownFootnotes.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownFresh.svelte +69 -0
- package/dist/components/markdown/MarkdownFresh.svelte.d.ts +6 -0
- package/dist/components/markdown/MarkdownHtml.svelte +72 -0
- package/dist/components/markdown/MarkdownHtml.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownImage.svelte +150 -0
- package/dist/components/markdown/MarkdownImage.svelte.d.ts +8 -0
- package/dist/components/markdown/MarkdownInlines.svelte +225 -0
- package/dist/components/markdown/MarkdownInlines.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownLink.svelte +120 -0
- package/dist/components/markdown/MarkdownLink.svelte.d.ts +25 -0
- package/dist/components/markdown/MarkdownMath.svelte +138 -0
- package/dist/components/markdown/MarkdownMath.svelte.d.ts +7 -0
- package/dist/components/markdown/MarkdownTable.svelte +265 -0
- package/dist/components/markdown/MarkdownTable.svelte.d.ts +17 -0
- package/dist/components/markdown/caret.d.ts +14 -0
- package/dist/components/markdown/caret.js +67 -0
- package/dist/components/markdown/context.d.ts +93 -0
- package/dist/components/markdown/context.js +128 -0
- package/dist/components/markdown/copy.d.ts +13 -0
- package/dist/components/markdown/copy.js +74 -0
- package/dist/components/markdown/hidden.d.ts +12 -0
- package/dist/components/markdown/hidden.js +31 -0
- package/dist/components/markdown/kept.d.ts +32 -0
- package/dist/components/markdown/kept.js +71 -0
- package/dist/components/markdown/labels.d.ts +46 -0
- package/dist/components/markdown/labels.js +35 -0
- package/dist/components/markdown/save.d.ts +11 -0
- package/dist/components/markdown/save.js +58 -0
- package/dist/components/markdown/scrollable.d.ts +24 -0
- package/dist/components/markdown/scrollable.js +152 -0
- package/dist/components/markdown/static.d.ts +37 -0
- package/dist/components/markdown/static.js +233 -0
- package/dist/components/markdown/styles.d.ts +328 -0
- package/dist/components/markdown/styles.js +302 -0
- package/dist/components/menu/MenuRadioItem.svelte +3 -3
- package/dist/components/menu/index.d.ts +23 -0
- package/dist/components/menu/index.js +3 -1
- package/dist/components/message/MessageAction.svelte +24 -5
- package/dist/components/message/MessageAction.svelte.d.ts +9 -0
- package/dist/components/message/MessageActions.svelte +2 -3
- package/dist/components/message/MessageContent.svelte +2 -3
- package/dist/components/message/MessageCopy.svelte +66 -8
- package/dist/components/message/MessageCopy.svelte.d.ts +17 -1
- package/dist/components/message/MessageHeader.svelte +3 -3
- package/dist/components/message/MessagePending.svelte +1 -1
- package/dist/components/message/MessageRoot.svelte +3 -4
- package/dist/components/message/MessageTime.svelte +3 -4
- package/dist/components/notice/Notice.svelte +14 -10
- package/dist/components/plan/Plan.svelte +25 -21
- package/dist/components/progress/Progress.svelte +34 -38
- package/dist/components/questionnaire/Questionnaire.svelte +19 -22
- package/dist/components/queued-message/QueuedMessage.svelte +14 -7
- package/dist/components/rail/RailItem.svelte +43 -40
- package/dist/components/rail/RailItem.svelte.d.ts +3 -1
- package/dist/components/rail/RailRoot.svelte +18 -4
- package/dist/components/rail/RailRoot.svelte.d.ts +1 -1
- package/dist/components/rail/RailSeparator.svelte +17 -0
- package/dist/components/rail/RailSeparator.svelte.d.ts +18 -0
- package/dist/components/rail/index.d.ts +2 -1
- package/dist/components/rail/index.js +2 -1
- package/dist/components/reasoning/ReasoningContent.svelte +4 -8
- package/dist/components/reasoning/ReasoningTrigger.svelte +4 -5
- package/dist/components/resize-handle/ResizeHandle.svelte +4 -7
- package/dist/components/reveal/Reveal.svelte +89 -0
- package/dist/components/reveal/Reveal.svelte.d.ts +17 -0
- package/dist/components/reveal/revealed.d.ts +38 -0
- package/dist/components/reveal/revealed.js +79 -0
- package/dist/components/segmented/SegmentedControl.svelte +11 -16
- package/dist/components/select/Select.svelte +1 -1
- package/dist/components/separator/Separator.svelte +1 -1
- package/dist/components/settings-row/SettingsRow.svelte +5 -5
- package/dist/components/sheet/SheetContent.svelte +63 -0
- package/dist/components/sheet/SheetContent.svelte.d.ts +18 -0
- package/dist/components/sheet/index.d.ts +12 -0
- package/dist/components/sheet/index.js +12 -0
- package/dist/components/sheet/styles.d.ts +51 -0
- package/dist/components/sheet/styles.js +65 -0
- package/dist/components/shimmer/Shimmer.svelte +41 -26
- package/dist/components/sidebar/SidebarContent.svelte +1 -1
- package/dist/components/sidebar/SidebarFolder.svelte +142 -0
- package/dist/components/sidebar/SidebarFolder.svelte.d.ts +19 -0
- package/dist/components/sidebar/SidebarFooter.svelte +1 -1
- package/dist/components/sidebar/SidebarGroup.svelte +41 -35
- package/dist/components/sidebar/SidebarGroup.svelte.d.ts +3 -3
- package/dist/components/sidebar/SidebarHeader.svelte +12 -6
- package/dist/components/sidebar/SidebarHeader.svelte.d.ts +4 -1
- package/dist/components/sidebar/SidebarItem.svelte +34 -38
- package/dist/components/sidebar/SidebarRoot.svelte +62 -0
- package/dist/components/sidebar/SidebarRoot.svelte.d.ts +14 -0
- package/dist/components/sidebar/index.d.ts +5 -1
- package/dist/components/sidebar/index.js +3 -1
- package/dist/components/skeleton/Skeleton.svelte +26 -15
- package/dist/components/slider/Slider.svelte +200 -0
- package/dist/components/slider/Slider.svelte.d.ts +55 -0
- package/dist/components/spinner/Spinner.svelte +4 -11
- package/dist/components/stack/Stack.svelte +37 -44
- package/dist/components/stack/Stack.svelte.d.ts +12 -6
- package/dist/components/status-indicator/StatusIndicator.svelte +1 -1
- package/dist/components/suggestions/SuggestionsItem.svelte +11 -13
- package/dist/components/switch/Switch.svelte +16 -25
- package/dist/components/tab-strip/TabStrip.svelte +340 -0
- package/dist/components/tab-strip/TabStrip.svelte.d.ts +31 -0
- package/dist/components/tabs/Tabs.svelte +15 -14
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/text/Text.svelte +64 -14
- package/dist/components/text/Text.svelte.d.ts +13 -3
- package/dist/components/toast/Toaster.svelte +12 -10
- package/dist/components/toggle/Toggle.svelte +40 -0
- package/dist/components/toggle/Toggle.svelte.d.ts +15 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte +37 -0
- package/dist/components/toggle-group/ToggleGroupItem.svelte.d.ts +12 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte +95 -0
- package/dist/components/toggle-group/ToggleGroupRoot.svelte.d.ts +33 -0
- package/dist/components/toggle-group/context.d.ts +6 -0
- package/dist/components/toggle-group/context.js +11 -0
- package/dist/components/toggle-group/index.d.ts +5 -0
- package/dist/components/toggle-group/index.js +3 -0
- package/dist/components/tool/ToolContent.svelte +3 -8
- package/dist/components/tool/ToolSection.svelte +4 -5
- package/dist/components/tool/ToolTrigger.svelte +14 -15
- package/dist/components/tooltip/TooltipContent.svelte +9 -6
- package/dist/components/work-fold/WorkFold.svelte +17 -34
- package/dist/components/work-fold/WorkFold.svelte.d.ts +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.js +38 -12
- package/dist/internal/Chevron.svelte +2 -3
- package/dist/internal/Code.svelte +3 -4
- package/dist/internal/Collapse.svelte +6 -5
- package/dist/internal/Collapse.svelte.d.ts +2 -1
- package/dist/internal/Glyph.svelte +16 -0
- package/dist/internal/Glyph.svelte.d.ts +6 -0
- package/dist/internal/Tile.svelte +17 -37
- package/dist/internal/control.d.ts +4 -4
- package/dist/internal/control.js +21 -18
- package/dist/internal/layer.d.ts +3 -5
- package/dist/internal/layer.js +14 -18
- package/dist/internal/layout.d.ts +13 -0
- package/dist/internal/layout.js +453 -0
- package/dist/internal/markers.stylex.d.ts +8 -0
- package/dist/internal/markers.stylex.js +4 -0
- package/dist/internal/plugin-order.d.ts +8 -0
- package/dist/internal/plugin-order.js +16 -0
- package/dist/internal/responsive.d.ts +45 -0
- package/dist/internal/responsive.js +42 -0
- package/dist/internal/roving.js +5 -2
- package/dist/internal/shared.d.ts +8 -1
- package/dist/internal/shared.js +21 -5
- package/dist/internal/sx.d.ts +31 -4
- package/dist/internal/sx.js +17 -0
- package/dist/internal/toggle.d.ts +73 -0
- package/dist/internal/toggle.js +83 -0
- package/dist/internal/visible.d.ts +32 -0
- package/dist/internal/visible.js +44 -0
- package/dist/markdown/ast.d.ts +209 -0
- package/dist/markdown/ast.js +10 -0
- package/dist/markdown/blocks.d.ts +177 -0
- package/dist/markdown/blocks.js +1489 -0
- package/dist/markdown/code-info.d.ts +10 -0
- package/dist/markdown/code-info.js +16 -0
- package/dist/markdown/common.d.ts +25 -0
- package/dist/markdown/common.js +107 -0
- package/dist/markdown/diagrams.d.ts +2 -0
- package/dist/markdown/diagrams.js +18 -0
- package/dist/markdown/file-paths.d.ts +29 -0
- package/dist/markdown/file-paths.js +80 -0
- package/dist/markdown/files.d.ts +16 -0
- package/dist/markdown/files.js +133 -0
- package/dist/markdown/highlight.d.ts +30 -0
- package/dist/markdown/highlight.js +127 -0
- package/dist/markdown/html.d.ts +23 -0
- package/dist/markdown/html.js +289 -0
- package/dist/markdown/images.d.ts +15 -0
- package/dist/markdown/images.js +45 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +5 -0
- package/dist/markdown/inlines.d.ts +48 -0
- package/dist/markdown/inlines.js +1714 -0
- package/dist/markdown/math.d.ts +2 -0
- package/dist/markdown/math.js +22 -0
- package/dist/markdown/parse.d.ts +81 -0
- package/dist/markdown/parse.js +204 -0
- package/dist/markdown/plugin.d.ts +178 -0
- package/dist/markdown/plugin.js +160 -0
- package/dist/markdown/sanitize.d.ts +78 -0
- package/dist/markdown/sanitize.js +522 -0
- package/dist/markdown/share.d.ts +12 -0
- package/dist/markdown/share.js +59 -0
- package/dist/markdown/table.d.ts +13 -0
- package/dist/markdown/table.js +60 -0
- package/dist/media.stylex.d.ts +52 -0
- package/dist/media.stylex.js +53 -0
- package/dist/preset.d.ts +40 -16
- package/dist/preset.js +169 -51
- package/dist/tokens.stylex.d.ts +70 -37
- package/dist/tokens.stylex.js +127 -62
- package/dist/typography.d.ts +48 -0
- package/dist/typography.js +55 -0
- package/dist/vite.d.ts +9 -1
- package/dist/vite.js +37 -4
- package/package.json +58 -6
- package/skills/building-ui/SKILL.md +242 -0
- package/skills/building-ui/references/components.md +207 -0
- package/skills/markdown/SKILL.md +452 -0
- package/skills/markdown/references/plugins.md +103 -0
- package/skills/setup/SKILL.md +191 -0
- package/skills/styling/SKILL.md +269 -0
- package/skills/theming/SKILL.md +184 -0
- package/dist/internal/loop.d.ts +0 -35
- package/dist/internal/loop.js +0 -72
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
minHeight: '1.375rem',
|
|
27
27
|
paddingInline: '0.5rem',
|
|
28
28
|
// A pill at the default scale, squarer when it is sharp
|
|
29
|
-
borderRadius: radius.
|
|
30
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
29
|
+
borderRadius: radius.card,
|
|
30
|
+
boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`,
|
|
31
31
|
color: colors.textMuted,
|
|
32
32
|
fontFamily: font.body,
|
|
33
|
-
fontSize: font.
|
|
33
|
+
fontSize: font.sizeCaption,
|
|
34
34
|
fontWeight: font.weightMedium,
|
|
35
35
|
fontVariantNumeric: 'tabular-nums',
|
|
36
36
|
lineHeight: 1,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
flexShrink: 0,
|
|
42
42
|
width: '0.375rem',
|
|
43
43
|
height: '0.375rem',
|
|
44
|
-
borderRadius: radius.
|
|
44
|
+
borderRadius: radius.pill,
|
|
45
45
|
forcedColorAdjust: 'none'
|
|
46
46
|
},
|
|
47
47
|
lit: { color: colors.text }
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
const dots = stylex.create({
|
|
51
51
|
neutral: { backgroundColor: colors.textSubtle },
|
|
52
|
-
accent: { backgroundColor: colors.
|
|
52
|
+
accent: { backgroundColor: colors.accent },
|
|
53
53
|
success: { backgroundColor: colors.success },
|
|
54
54
|
warning: { backgroundColor: colors.warning },
|
|
55
55
|
danger: { backgroundColor: colors.danger }
|
|
@@ -3,16 +3,38 @@
|
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
5
5
|
import { shared } from '../../internal/shared.js';
|
|
6
|
-
import { attrs, type Sx } from '../../internal/sx.js';
|
|
6
|
+
import { attrs, classes, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
import Spinner from '../spinner/Spinner.svelte';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* `primary` is the one solid; `secondary` an edge; `soft` a fill of the accent. `ghost` has
|
|
13
|
+
* a fill only under the pointer, `bare` never has one, and `link` is words that underline.
|
|
14
|
+
* `floating` stands over content. The rest say what pressing them does: `danger` (solid),
|
|
15
|
+
* `danger-outline`, `ghost-danger`, `warning-outline` and `success-outline`.
|
|
16
|
+
*/
|
|
17
|
+
export type ButtonVariant =
|
|
18
|
+
| 'primary'
|
|
19
|
+
| 'secondary'
|
|
20
|
+
| 'soft'
|
|
21
|
+
| 'ghost'
|
|
22
|
+
| 'bare'
|
|
23
|
+
| 'link'
|
|
24
|
+
| 'floating'
|
|
25
|
+
| 'danger'
|
|
26
|
+
| 'danger-outline'
|
|
27
|
+
| 'ghost-danger'
|
|
28
|
+
| 'warning-outline'
|
|
29
|
+
| 'success-outline';
|
|
30
|
+
export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
|
|
31
|
+
export type ButtonShape = 'default' | 'pill';
|
|
12
32
|
|
|
13
33
|
export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
|
|
14
34
|
variant?: ButtonVariant;
|
|
15
35
|
size?: ButtonSize;
|
|
36
|
+
/** `pill` rounds the ends fully: for a chip, or a button that floats. */
|
|
37
|
+
shape?: ButtonShape;
|
|
16
38
|
/** Shows a spinner and blocks interaction while keeping the button's width. */
|
|
17
39
|
loading?: boolean;
|
|
18
40
|
disabled?: boolean;
|
|
@@ -25,12 +47,14 @@
|
|
|
25
47
|
children?: Snippet;
|
|
26
48
|
};
|
|
27
49
|
|
|
28
|
-
//
|
|
29
|
-
const HOVER = '
|
|
30
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
50
|
+
// One key for every hover, so the catalog can show it without a pointer
|
|
51
|
+
const HOVER = ':is(:hover, [data-preview~="hover"])';
|
|
31
52
|
|
|
32
53
|
const styles = stylex.create({
|
|
33
54
|
base: {
|
|
55
|
+
// A key hint inside takes the button's own ink, whatever it stands on
|
|
56
|
+
'--narvi-kbd-fill': 'color-mix(in srgb, currentColor 14%, transparent)',
|
|
57
|
+
'--narvi-kbd-ink': 'currentColor',
|
|
34
58
|
position: 'relative',
|
|
35
59
|
display: 'inline-flex',
|
|
36
60
|
alignItems: 'center',
|
|
@@ -49,104 +73,184 @@
|
|
|
49
73
|
appearance: 'none',
|
|
50
74
|
WebkitTapHighlightColor: 'transparent',
|
|
51
75
|
// Press feedback, only for people who have not asked for less motion
|
|
52
|
-
scale: { default: null, ':active': { default: null, [
|
|
76
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.96 } },
|
|
53
77
|
// The press answers at once with a strong ease-out. Hover colours use a plain ease.
|
|
54
78
|
transitionProperty: {
|
|
55
79
|
default: 'background-color, color, filter',
|
|
56
|
-
[
|
|
80
|
+
[media.motion]: 'scale, background-color, color, filter'
|
|
57
81
|
},
|
|
58
82
|
transitionDuration: motion.base,
|
|
59
83
|
transitionTimingFunction: {
|
|
60
84
|
default: 'ease',
|
|
61
|
-
[
|
|
85
|
+
[media.motion]: `${motion.easeOut}, ease, ease, ease`
|
|
62
86
|
}
|
|
63
87
|
},
|
|
64
88
|
|
|
65
|
-
// Sizes.
|
|
89
|
+
// Sizes. All but the large one extend their hit area to 40px without moving the layout.
|
|
90
|
+
micro: {
|
|
91
|
+
minHeight: '1.25rem',
|
|
92
|
+
paddingInline: '0.375rem',
|
|
93
|
+
gap: '0.25rem',
|
|
94
|
+
borderRadius: radius.chip,
|
|
95
|
+
fontSize: font.sizeCaption,
|
|
96
|
+
'::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-10px' }
|
|
97
|
+
},
|
|
98
|
+
xs: {
|
|
99
|
+
minHeight: '1.5rem',
|
|
100
|
+
paddingInline: '0.5rem',
|
|
101
|
+
gap: '0.3125rem',
|
|
102
|
+
borderRadius: radius.item,
|
|
103
|
+
fontSize: font.sizeMeta,
|
|
104
|
+
'::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-8px' }
|
|
105
|
+
},
|
|
66
106
|
sm: {
|
|
67
107
|
minHeight: '1.75rem',
|
|
68
108
|
paddingInline: '0.625rem',
|
|
69
109
|
gap: '0.375rem',
|
|
70
|
-
borderRadius: radius.
|
|
71
|
-
fontSize: font.
|
|
110
|
+
borderRadius: radius.item,
|
|
111
|
+
fontSize: font.sizeMeta,
|
|
72
112
|
'::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-6px' }
|
|
73
113
|
},
|
|
74
114
|
md: {
|
|
75
115
|
minHeight: '2rem',
|
|
76
116
|
paddingInline: '0.75rem',
|
|
77
117
|
gap: '0.4375rem',
|
|
78
|
-
borderRadius: radius.
|
|
79
|
-
fontSize: font.
|
|
118
|
+
borderRadius: radius.control,
|
|
119
|
+
fontSize: font.sizeBody,
|
|
80
120
|
'::after': { content: '""', position: 'absolute', insetInline: 0, insetBlock: '-4px' }
|
|
81
121
|
},
|
|
82
122
|
lg: {
|
|
83
123
|
minHeight: '2.5rem',
|
|
84
124
|
paddingInline: '1rem',
|
|
85
125
|
gap: '0.5rem',
|
|
86
|
-
borderRadius: radius.
|
|
87
|
-
fontSize:
|
|
126
|
+
borderRadius: radius.panel,
|
|
127
|
+
fontSize: font.sizeReading
|
|
88
128
|
},
|
|
129
|
+
iconMicro: { width: '1.25rem', paddingInline: 0 },
|
|
130
|
+
iconXs: { width: '1.5rem', paddingInline: 0 },
|
|
89
131
|
iconSm: { width: '1.75rem', paddingInline: 0 },
|
|
90
132
|
iconMd: { width: '2rem', paddingInline: 0 },
|
|
91
133
|
iconLg: { width: '2.5rem', paddingInline: 0 },
|
|
92
134
|
|
|
93
|
-
|
|
135
|
+
pill: { borderRadius: radius.pill },
|
|
136
|
+
|
|
137
|
+
// Primary: the one solid, flat, in the text's own colour
|
|
94
138
|
primary: {
|
|
95
|
-
color: colors.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
filter: { default: null, ':hover': { default: null, [HOVER]: 'brightness(1.06)' } },
|
|
99
|
-
// The deeper hover shadow is a layer of its own that fades in. Fading
|
|
100
|
-
// opacity is cheap; animating the shadow itself repaints it every frame.
|
|
101
|
-
'::before': {
|
|
102
|
-
content: '""',
|
|
103
|
-
position: 'absolute',
|
|
104
|
-
inset: 0,
|
|
105
|
-
borderRadius: 'inherit',
|
|
106
|
-
boxShadow: `0 12px 22px -10px ${colors.mithrilDrop}`,
|
|
107
|
-
opacity: { default: 0, ':hover': { default: null, [HOVER]: 1 } },
|
|
108
|
-
pointerEvents: 'none',
|
|
109
|
-
transitionProperty: 'opacity',
|
|
110
|
-
transitionDuration: motion.base,
|
|
111
|
-
transitionTimingFunction: 'ease'
|
|
112
|
-
}
|
|
139
|
+
color: colors.onPrimary,
|
|
140
|
+
backgroundColor: colors.primary,
|
|
141
|
+
opacity: { default: null, [HOVER]: { default: null, [media.hover]: 0.88 } }
|
|
113
142
|
},
|
|
114
143
|
secondary: {
|
|
115
144
|
color: colors.text,
|
|
116
145
|
backgroundColor: {
|
|
117
|
-
default:
|
|
118
|
-
|
|
146
|
+
default: 'transparent',
|
|
147
|
+
[HOVER]: { default: null, [media.hover]: colors.fillHover }
|
|
119
148
|
},
|
|
120
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
149
|
+
boxShadow: `inset 0 0 0 1px ${colors.borderStrong}`
|
|
121
150
|
},
|
|
122
151
|
soft: {
|
|
123
|
-
color: colors.
|
|
152
|
+
color: colors.accent,
|
|
124
153
|
backgroundColor: {
|
|
125
|
-
default: colors.
|
|
126
|
-
|
|
154
|
+
default: colors.accentSoft,
|
|
155
|
+
[HOVER]: { default: null, [media.hover]: colors.focusHalo }
|
|
127
156
|
}
|
|
128
157
|
},
|
|
129
158
|
ghost: {
|
|
130
159
|
color: {
|
|
131
160
|
default: colors.textMuted,
|
|
132
|
-
|
|
161
|
+
[HOVER]: { default: null, [media.hover]: colors.text }
|
|
133
162
|
},
|
|
134
163
|
backgroundColor: {
|
|
135
164
|
default: 'transparent',
|
|
136
|
-
|
|
165
|
+
[HOVER]: { default: null, [media.hover]: colors.fillHover }
|
|
137
166
|
}
|
|
138
167
|
},
|
|
168
|
+
// No surface in any state: for a control on a shape that already frames it
|
|
169
|
+
bare: {
|
|
170
|
+
color: {
|
|
171
|
+
default: colors.textMuted,
|
|
172
|
+
[HOVER]: { default: null, [media.hover]: colors.text }
|
|
173
|
+
},
|
|
174
|
+
backgroundColor: 'transparent'
|
|
175
|
+
},
|
|
176
|
+
// Words that act: underlined under the pointer, as a link is
|
|
177
|
+
link: {
|
|
178
|
+
color: colors.text,
|
|
179
|
+
backgroundColor: 'transparent',
|
|
180
|
+
textDecorationLine: {
|
|
181
|
+
default: 'none',
|
|
182
|
+
[HOVER]: { default: null, [media.hover]: 'underline' }
|
|
183
|
+
},
|
|
184
|
+
textUnderlineOffset: '0.2em'
|
|
185
|
+
},
|
|
186
|
+
// Stands over content, so it is one of the few things with a shadow
|
|
187
|
+
floating: {
|
|
188
|
+
color: {
|
|
189
|
+
default: colors.textMuted,
|
|
190
|
+
[HOVER]: { default: null, [media.hover]: colors.text }
|
|
191
|
+
},
|
|
192
|
+
backgroundColor: colors.bgRaised,
|
|
193
|
+
boxShadow: {
|
|
194
|
+
default: `inset 0 0 0 1px ${colors.border}, 0 6px 16px -6px ${colors.shadow}`,
|
|
195
|
+
[HOVER]: {
|
|
196
|
+
default: null,
|
|
197
|
+
[media.hover]: `inset 0 0 0 1px ${colors.borderStrong}, 0 6px 16px -6px ${colors.shadow}`
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
// What cannot be undone, as a solid: the one press a dialog is asking for
|
|
139
202
|
danger: {
|
|
203
|
+
color: colors.bgRaised,
|
|
204
|
+
backgroundColor: colors.danger,
|
|
205
|
+
opacity: { default: null, [HOVER]: { default: null, [media.hover]: 0.88 } }
|
|
206
|
+
},
|
|
207
|
+
dangerOutline: {
|
|
140
208
|
color: colors.danger,
|
|
141
209
|
backgroundColor: {
|
|
142
210
|
default: 'transparent',
|
|
143
|
-
|
|
211
|
+
[HOVER]: {
|
|
144
212
|
default: null,
|
|
145
|
-
[
|
|
213
|
+
[media.hover]: `color-mix(in oklab, ${colors.danger} 12%, transparent)`
|
|
146
214
|
}
|
|
147
215
|
},
|
|
148
216
|
boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.danger} 45%, transparent)`
|
|
149
217
|
},
|
|
218
|
+
// Quiet until the pointer is on it: an icon that deletes
|
|
219
|
+
ghostDanger: {
|
|
220
|
+
color: {
|
|
221
|
+
default: colors.textMuted,
|
|
222
|
+
[HOVER]: { default: null, [media.hover]: colors.danger }
|
|
223
|
+
},
|
|
224
|
+
backgroundColor: {
|
|
225
|
+
default: 'transparent',
|
|
226
|
+
[HOVER]: {
|
|
227
|
+
default: null,
|
|
228
|
+
[media.hover]: `color-mix(in oklab, ${colors.danger} 12%, transparent)`
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
warningOutline: {
|
|
233
|
+
color: colors.warning,
|
|
234
|
+
backgroundColor: {
|
|
235
|
+
default: 'transparent',
|
|
236
|
+
[HOVER]: {
|
|
237
|
+
default: null,
|
|
238
|
+
[media.hover]: `color-mix(in oklab, ${colors.warning} 12%, transparent)`
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.warning} 45%, transparent)`
|
|
242
|
+
},
|
|
243
|
+
successOutline: {
|
|
244
|
+
color: colors.success,
|
|
245
|
+
backgroundColor: {
|
|
246
|
+
default: 'transparent',
|
|
247
|
+
[HOVER]: {
|
|
248
|
+
default: null,
|
|
249
|
+
[media.hover]: `color-mix(in oklab, ${colors.success} 12%, transparent)`
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
boxShadow: `inset 0 0 0 1px color-mix(in oklab, ${colors.success} 45%, transparent)`
|
|
253
|
+
},
|
|
150
254
|
|
|
151
255
|
// States
|
|
152
256
|
disabled: {
|
|
@@ -158,12 +262,15 @@
|
|
|
158
262
|
cursor: 'progress',
|
|
159
263
|
pointerEvents: 'none'
|
|
160
264
|
},
|
|
265
|
+
// As wide as the button, so in a wide one something inside can be pushed to the end
|
|
161
266
|
content: {
|
|
162
267
|
display: 'inline-flex',
|
|
163
268
|
alignItems: 'center',
|
|
164
269
|
justifyContent: 'center',
|
|
270
|
+
flexGrow: 1,
|
|
271
|
+
minWidth: 0,
|
|
165
272
|
gap: 'inherit',
|
|
166
|
-
transitionProperty: { default: 'opacity', [
|
|
273
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, filter' },
|
|
167
274
|
transitionDuration: motion.base,
|
|
168
275
|
transitionTimingFunction: motion.easeOut
|
|
169
276
|
},
|
|
@@ -171,7 +278,7 @@
|
|
|
171
278
|
// and not two things overlapping
|
|
172
279
|
contentHidden: {
|
|
173
280
|
opacity: 0,
|
|
174
|
-
filter: { default: null, [
|
|
281
|
+
filter: { default: null, [media.motion]: 'blur(2px)' }
|
|
175
282
|
},
|
|
176
283
|
// The spinner fades in as the label fades out. It leaves at once: when the
|
|
177
284
|
// work is done, the label should be back without delay.
|
|
@@ -181,20 +288,88 @@
|
|
|
181
288
|
display: 'grid',
|
|
182
289
|
placeItems: 'center',
|
|
183
290
|
opacity: { default: 1, '@starting-style': 0 },
|
|
184
|
-
scale: { default: null, [
|
|
185
|
-
transitionProperty: { default: 'opacity', [
|
|
291
|
+
scale: { default: null, [media.motion]: { default: 1, '@starting-style': 0.9 } },
|
|
292
|
+
transitionProperty: { default: 'opacity', [media.motion]: 'opacity, scale' },
|
|
186
293
|
transitionDuration: motion.base,
|
|
187
294
|
transitionTimingFunction: motion.easeOut
|
|
188
295
|
}
|
|
189
296
|
});
|
|
190
297
|
|
|
191
|
-
const iconStyles = {
|
|
298
|
+
const iconStyles = {
|
|
299
|
+
micro: styles.iconMicro,
|
|
300
|
+
xs: styles.iconXs,
|
|
301
|
+
sm: styles.iconSm,
|
|
302
|
+
md: styles.iconMd,
|
|
303
|
+
lg: styles.iconLg
|
|
304
|
+
};
|
|
305
|
+
const variantStyles = {
|
|
306
|
+
primary: styles.primary,
|
|
307
|
+
secondary: styles.secondary,
|
|
308
|
+
soft: styles.soft,
|
|
309
|
+
ghost: styles.ghost,
|
|
310
|
+
bare: styles.bare,
|
|
311
|
+
link: styles.link,
|
|
312
|
+
floating: styles.floating,
|
|
313
|
+
danger: styles.danger,
|
|
314
|
+
'danger-outline': styles.dangerOutline,
|
|
315
|
+
'ghost-danger': styles.ghostDanger,
|
|
316
|
+
'warning-outline': styles.warningOutline,
|
|
317
|
+
'success-outline': styles.successOutline
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* A button as markup, as the component draws one that is neither loading nor disabled:
|
|
322
|
+
* for the parts of Markdown that are written as a string. `attributes` are written as
|
|
323
|
+
* given, so they must be escaped already, and `inner` is markup.
|
|
324
|
+
*/
|
|
325
|
+
export function buttonHtml(options: {
|
|
326
|
+
variant: NonNullable<ButtonProps['variant']>;
|
|
327
|
+
size: NonNullable<ButtonProps['size']>;
|
|
328
|
+
iconOnly?: boolean;
|
|
329
|
+
shape?: ButtonShape;
|
|
330
|
+
sx?: Sx;
|
|
331
|
+
attributes?: string;
|
|
332
|
+
inner: string;
|
|
333
|
+
/**
|
|
334
|
+
* Without the element the component keeps around a button's contents (which it hides
|
|
335
|
+
* while the button is loading): for a button that holds one icon and is never loading.
|
|
336
|
+
*/
|
|
337
|
+
bare?: boolean;
|
|
338
|
+
}): string {
|
|
339
|
+
const { attributes = '', inner, bare = false } = options;
|
|
340
|
+
const name = buttonClass(options);
|
|
341
|
+
return bare
|
|
342
|
+
? `<button type="button"${attributes} class="${name}">${inner}</button>`
|
|
343
|
+
: `<button type="button"${attributes} class="${name}"><span class="${contentClass}">${inner}</span></button>`;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** The classes of a button that is neither loading nor disabled. */
|
|
347
|
+
export function buttonClass(options: {
|
|
348
|
+
variant: NonNullable<ButtonProps['variant']>;
|
|
349
|
+
size: NonNullable<ButtonProps['size']>;
|
|
350
|
+
iconOnly?: boolean;
|
|
351
|
+
shape?: ButtonShape;
|
|
352
|
+
sx?: Sx;
|
|
353
|
+
}): string {
|
|
354
|
+
const { variant, size, iconOnly = false, shape = 'default', sx } = options;
|
|
355
|
+
return classes(
|
|
356
|
+
styles.base,
|
|
357
|
+
shared.focusable,
|
|
358
|
+
styles[size],
|
|
359
|
+
iconOnly && iconStyles[size],
|
|
360
|
+
(shape === 'pill' || variant === 'floating') && styles.pill,
|
|
361
|
+
variantStyles[variant],
|
|
362
|
+
sx
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
const contentClass = classes(styles.content);
|
|
192
366
|
</script>
|
|
193
367
|
|
|
194
368
|
<script lang="ts">
|
|
195
369
|
let {
|
|
196
370
|
variant = 'secondary',
|
|
197
371
|
size = 'md',
|
|
372
|
+
shape = 'default',
|
|
198
373
|
loading = false,
|
|
199
374
|
disabled = false,
|
|
200
375
|
iconOnly = false,
|
|
@@ -216,7 +391,8 @@
|
|
|
216
391
|
shared.focusable,
|
|
217
392
|
styles[size],
|
|
218
393
|
iconOnly && iconStyles[size],
|
|
219
|
-
styles
|
|
394
|
+
(shape === 'pill' || variant === 'floating') && styles.pill,
|
|
395
|
+
variantStyles[variant],
|
|
220
396
|
disabled && styles.disabled,
|
|
221
397
|
loading && styles.loading,
|
|
222
398
|
sx
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
import { type Sx } from '../../internal/sx.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* `primary` is the one solid; `secondary` an edge; `soft` a fill of the accent. `ghost` has
|
|
6
|
+
* a fill only under the pointer, `bare` never has one, and `link` is words that underline.
|
|
7
|
+
* `floating` stands over content. The rest say what pressing them does: `danger` (solid),
|
|
8
|
+
* `danger-outline`, `ghost-danger`, `warning-outline` and `success-outline`.
|
|
9
|
+
*/
|
|
10
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'bare' | 'link' | 'floating' | 'danger' | 'danger-outline' | 'ghost-danger' | 'warning-outline' | 'success-outline';
|
|
11
|
+
export type ButtonSize = 'micro' | 'xs' | 'sm' | 'md' | 'lg';
|
|
12
|
+
export type ButtonShape = 'default' | 'pill';
|
|
6
13
|
export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'children'> & {
|
|
7
14
|
variant?: ButtonVariant;
|
|
8
15
|
size?: ButtonSize;
|
|
16
|
+
/** `pill` rounds the ends fully: for a chip, or a button that floats. */
|
|
17
|
+
shape?: ButtonShape;
|
|
9
18
|
/** Shows a spinner and blocks interaction while keeping the button's width. */
|
|
10
19
|
loading?: boolean;
|
|
11
20
|
disabled?: boolean;
|
|
@@ -17,6 +26,33 @@ export type ButtonProps = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'chi
|
|
|
17
26
|
ref?: HTMLButtonElement | HTMLAnchorElement | null;
|
|
18
27
|
children?: Snippet;
|
|
19
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* A button as markup, as the component draws one that is neither loading nor disabled:
|
|
31
|
+
* for the parts of Markdown that are written as a string. `attributes` are written as
|
|
32
|
+
* given, so they must be escaped already, and `inner` is markup.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buttonHtml(options: {
|
|
35
|
+
variant: NonNullable<ButtonProps['variant']>;
|
|
36
|
+
size: NonNullable<ButtonProps['size']>;
|
|
37
|
+
iconOnly?: boolean;
|
|
38
|
+
shape?: ButtonShape;
|
|
39
|
+
sx?: Sx;
|
|
40
|
+
attributes?: string;
|
|
41
|
+
inner: string;
|
|
42
|
+
/**
|
|
43
|
+
* Without the element the component keeps around a button's contents (which it hides
|
|
44
|
+
* while the button is loading): for a button that holds one icon and is never loading.
|
|
45
|
+
*/
|
|
46
|
+
bare?: boolean;
|
|
47
|
+
}): string;
|
|
48
|
+
/** The classes of a button that is neither loading nor disabled. */
|
|
49
|
+
export declare function buttonClass(options: {
|
|
50
|
+
variant: NonNullable<ButtonProps['variant']>;
|
|
51
|
+
size: NonNullable<ButtonProps['size']>;
|
|
52
|
+
iconOnly?: boolean;
|
|
53
|
+
shape?: ButtonShape;
|
|
54
|
+
sx?: Sx;
|
|
55
|
+
}): string;
|
|
20
56
|
declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
|
|
21
57
|
type Button = ReturnType<typeof Button>;
|
|
22
58
|
export default Button;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { shared } from '../../internal/shared.js';
|
|
6
6
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
7
7
|
import { colors, font, motion, radius, space } from '../../tokens.stylex.js';
|
|
8
|
+
import { media } from '../../media.stylex.js';
|
|
8
9
|
|
|
9
10
|
export type CardVariant = 'raised' | 'outlined' | 'filled';
|
|
10
11
|
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
@@ -25,29 +26,24 @@
|
|
|
25
26
|
children?: Snippet;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
// StyleX needs these in the same file to evaluate them at build time
|
|
29
|
-
const HOVER = '@media (hover: hover) and (pointer: fine)';
|
|
30
|
-
const MOTION = '@media (prefers-reduced-motion: no-preference)';
|
|
31
|
-
|
|
32
29
|
const styles = stylex.create({
|
|
33
30
|
base: {
|
|
34
31
|
boxSizing: 'border-box',
|
|
35
32
|
minWidth: 0,
|
|
36
|
-
borderRadius: radius.
|
|
33
|
+
borderRadius: radius.card,
|
|
37
34
|
color: colors.text,
|
|
38
35
|
fontFamily: font.body
|
|
39
36
|
},
|
|
37
|
+
// Three ways to hold something: a surface a step above the page, a line alone, a fill alone
|
|
40
38
|
raised: {
|
|
41
39
|
backgroundColor: colors.bgRaised,
|
|
42
|
-
boxShadow: `inset 0 0 0 1px ${colors.
|
|
40
|
+
boxShadow: `inset 0 0 0 1px ${colors.border}`
|
|
43
41
|
},
|
|
44
42
|
outlined: {
|
|
45
|
-
|
|
46
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}`
|
|
43
|
+
boxShadow: `inset 0 0 0 1px ${colors.border}`
|
|
47
44
|
},
|
|
48
45
|
filled: {
|
|
49
|
-
backgroundColor: colors.
|
|
50
|
-
boxShadow: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`
|
|
46
|
+
backgroundColor: colors.fillSunken
|
|
51
47
|
},
|
|
52
48
|
none: { padding: 0 },
|
|
53
49
|
sm: { padding: space.x3 },
|
|
@@ -61,52 +57,42 @@
|
|
|
61
57
|
cursor: 'pointer',
|
|
62
58
|
WebkitTapHighlightColor: 'transparent',
|
|
63
59
|
// Press feedback, smaller than a button's, as a card is much larger
|
|
64
|
-
scale: { default: null, ':active': { default: null, [
|
|
60
|
+
scale: { default: null, ':active': { default: null, [media.motion]: 0.99 } },
|
|
65
61
|
transitionProperty: {
|
|
66
62
|
default: 'background-color, box-shadow',
|
|
67
|
-
[
|
|
63
|
+
[media.motion]: 'scale, background-color, box-shadow'
|
|
68
64
|
},
|
|
69
65
|
transitionDuration: motion.base,
|
|
70
66
|
transitionTimingFunction: {
|
|
71
67
|
default: 'ease',
|
|
72
|
-
[
|
|
68
|
+
[media.motion]: `${motion.easeOut}, ease, ease`
|
|
73
69
|
}
|
|
74
70
|
},
|
|
75
|
-
// On hover
|
|
71
|
+
// On hover its edge firms up, as a control's does
|
|
76
72
|
raisedLink: {
|
|
77
|
-
backgroundColor:
|
|
78
|
-
default: colors.bgRaised,
|
|
79
|
-
':hover': { default: null, [HOVER]: colors.surfaceRaised }
|
|
80
|
-
},
|
|
73
|
+
backgroundColor: colors.bgRaised,
|
|
81
74
|
boxShadow: {
|
|
82
|
-
default: `inset 0 0 0 1px ${colors.
|
|
75
|
+
default: `inset 0 0 0 1px ${colors.border}`,
|
|
83
76
|
':hover': {
|
|
84
77
|
default: null,
|
|
85
|
-
[
|
|
78
|
+
[media.hover]: `inset 0 0 0 1px ${colors.borderStrong}`
|
|
86
79
|
}
|
|
87
80
|
}
|
|
88
81
|
},
|
|
89
82
|
outlinedLink: {
|
|
90
83
|
backgroundColor: {
|
|
91
|
-
default:
|
|
92
|
-
':hover': { default: null, [
|
|
84
|
+
default: 'transparent',
|
|
85
|
+
':hover': { default: null, [media.hover]: colors.fillHover }
|
|
93
86
|
},
|
|
94
87
|
boxShadow: {
|
|
95
|
-
default: `inset 0 0 0 1px ${colors.
|
|
96
|
-
':hover': { default: null, [
|
|
88
|
+
default: `inset 0 0 0 1px ${colors.border}`,
|
|
89
|
+
':hover': { default: null, [media.hover]: `inset 0 0 0 1px ${colors.borderStrong}` }
|
|
97
90
|
}
|
|
98
91
|
},
|
|
99
92
|
filledLink: {
|
|
100
93
|
backgroundColor: {
|
|
101
|
-
default: colors.
|
|
102
|
-
':hover': { default: null, [
|
|
103
|
-
},
|
|
104
|
-
boxShadow: {
|
|
105
|
-
default: `inset 0 0 0 1px ${colors.line}, inset 0 1px 2px ${colors.shade}`,
|
|
106
|
-
':hover': {
|
|
107
|
-
default: null,
|
|
108
|
-
[HOVER]: `inset 0 0 0 1px ${colors.lineStrong}, inset 0 1px 2px ${colors.shade}`
|
|
109
|
-
}
|
|
94
|
+
default: colors.fillSunken,
|
|
95
|
+
':hover': { default: null, [media.hover]: colors.fillSelected }
|
|
110
96
|
}
|
|
111
97
|
}
|
|
112
98
|
});
|