@refraction-ui/astro 0.15.0 → 0.15.1
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/astro-accordion/Accordion.astro +7 -0
- package/dist/astro-accordion/Accordion.stories.ts +10 -4
- package/dist/astro-ai/AIScript.astro +1 -1
- package/dist/astro-analytics/Analytics.stories.ts +5 -3
- package/dist/astro-analytics/AnalyticsScript.astro +1 -1
- package/dist/astro-animated-text/AnimatedText.stories.ts +7 -3
- package/dist/astro-app-shell/AppShell.stories.ts +14 -3
- package/dist/astro-auth/Auth.stories.ts +8 -3
- package/dist/astro-avatar/Avatar.stories.ts +6 -3
- package/dist/astro-avatar-group/AvatarGroup.stories.ts +10 -3
- package/dist/astro-badge/Badge.stories.ts +7 -7
- package/dist/astro-bottom-nav/BottomNav.stories.ts +6 -3
- package/dist/astro-breadcrumbs/Breadcrumbs.stories.ts +9 -3
- package/dist/astro-button/Button.stories.ts +9 -3
- package/dist/astro-calendar/Calendar.stories.ts +9 -3
- package/dist/astro-callout/Callout.stories.ts +6 -3
- package/dist/astro-card/Card.stories.ts +6 -3
- package/dist/astro-card-grid/CardGrid.stories.ts +5 -3
- package/dist/astro-carousel/Carousel.astro +7 -0
- package/dist/astro-carousel/Carousel.stories.ts +10 -4
- package/dist/astro-charts/Charts.stories.ts +9 -4
- package/dist/astro-checkbox/Checkbox.stories.ts +9 -3
- package/dist/astro-code-block/CodeBlock.stories.ts +5 -3
- package/dist/astro-code-editor/CodeEditor.astro +1 -1
- package/dist/astro-code-editor/CodeEditor.stories.ts +10 -3
- package/dist/astro-collapsible/Collapsible.stories.ts +7 -3
- package/dist/astro-command/Command.stories.ts +6 -3
- package/dist/astro-command-input/CommandInput.stories.ts +5 -3
- package/dist/astro-content-protection/ContentProtection.stories.ts +9 -3
- package/dist/astro-conversation/Chat.astro +1 -1
- package/dist/astro-conversation/Conversation.stories.ts +7 -3
- package/dist/astro-data-table/DataTable.astro +1 -1
- package/dist/astro-data-table/DataTable.stories.ts +15 -3
- package/dist/astro-date-picker/DatePicker.stories.ts +11 -3
- package/dist/astro-device-frame/DeviceFrame.stories.ts +7 -3
- package/dist/astro-dialog/Dialog.stories.ts +7 -3
- package/dist/astro-diff-viewer/DiffViewer.stories.ts +19 -3
- package/dist/astro-dropdown-menu/DropdownMenu.stories.ts +6 -3
- package/dist/astro-emoji-picker/EmojiPicker.stories.ts +5 -3
- package/dist/astro-feedback-dialog/FeedbackDialog.stories.ts +6 -3
- package/dist/astro-file-tree/FileTree.stories.ts +5 -3
- package/dist/astro-file-upload/FileUpload.stories.ts +9 -3
- package/dist/astro-floating-reactions/FloatingReactions.astro +1 -1
- package/dist/astro-footer/Footer.stories.ts +7 -3
- package/dist/astro-icon-system/IconSystem.stories.ts +5 -3
- package/dist/astro-inline-editor/InlineEditor.stories.ts +5 -3
- package/dist/astro-input/Input.stories.ts +11 -3
- package/dist/astro-input-group/InputGroup.stories.ts +6 -3
- package/dist/astro-install-prompt/InstallPrompt.stories.ts +9 -3
- package/dist/astro-keyboard-shortcut/KeyboardShortcut.stories.ts +7 -3
- package/dist/astro-language-selector/LanguageSelector.stories.ts +11 -3
- package/dist/astro-link-card/LinkCard.stories.ts +5 -3
- package/dist/astro-logger/Logger.stories.ts +10 -3
- package/dist/astro-logger/TelemetryScript.astro +1 -1
- package/dist/astro-markdown-renderer/MarkdownRenderer.stories.ts +8 -3
- package/dist/astro-mascot/Mascot.astro +274 -0
- package/dist/astro-mascot/Mascot.stories.ts +46 -0
- package/dist/astro-mascot/index.ts +11 -0
- package/dist/astro-mobile-nav/MobileNav.stories.ts +6 -3
- package/dist/astro-navbar/Navbar.stories.ts +16 -3
- package/dist/astro-otp-input/OtpInput.stories.ts +20 -3
- package/dist/astro-pagination/Pagination.stories.ts +3 -3
- package/dist/astro-password-input/PasswordInput.stories.ts +29 -0
- package/dist/astro-payment/Payment.stories.ts +8 -3
- package/dist/astro-popover/Popover.stories.ts +10 -3
- package/dist/astro-popover/PopoverClose.stories.ts +17 -0
- package/dist/astro-popover/PopoverContent.stories.ts +19 -0
- package/dist/astro-popover/PopoverTrigger.stories.ts +17 -0
- package/dist/astro-presence-indicator/PresenceIndicator.stories.ts +14 -3
- package/dist/astro-progress-display/BadgeDisplay.astro +1 -1
- package/dist/astro-progress-display/BadgeDisplay.stories.ts +17 -0
- package/dist/astro-progress-display/ProgressBar.stories.ts +21 -0
- package/dist/astro-progress-display/StatsGrid.astro +1 -1
- package/dist/astro-progress-display/StatsGrid.stories.ts +19 -0
- package/dist/astro-radio/RadioGroup.stories.ts +25 -0
- package/dist/astro-radio/RadioItem.stories.ts +23 -0
- package/dist/astro-reaction-bar/ReactionBar.astro +1 -1
- package/dist/astro-reaction-bar/ReactionBar.stories.ts +10 -3
- package/dist/astro-resizable-layout/ResizableDivider.stories.ts +19 -0
- package/dist/astro-resizable-layout/ResizableLayout.stories.ts +18 -3
- package/dist/astro-resizable-layout/ResizablePane.stories.ts +21 -0
- package/dist/astro-rich-editor/RichEditor.stories.ts +20 -3
- package/dist/astro-search-bar/SearchBar.stories.ts +14 -3
- package/dist/astro-search-bar/SearchResultItem.stories.ts +17 -0
- package/dist/astro-search-bar/SearchResults.stories.ts +17 -0
- package/dist/astro-segmented-control/SegmentedControl.stories.ts +23 -0
- package/dist/astro-segmented-control/SegmentedControlItem.stories.ts +25 -0
- package/dist/astro-select/Select.stories.ts +16 -3
- package/dist/astro-select/SelectContent.stories.ts +17 -0
- package/dist/astro-select/SelectItem.stories.ts +23 -0
- package/dist/astro-select/SelectTrigger.stories.ts +21 -0
- package/dist/astro-separator/Separator.stories.ts +23 -0
- package/dist/astro-sidebar/Sidebar.astro +1 -1
- package/dist/astro-sidebar/Sidebar.stories.ts +14 -3
- package/dist/astro-skeleton/Skeleton.stories.ts +14 -3
- package/dist/astro-skeleton/SkeletonText.stories.ts +19 -0
- package/dist/astro-skip-to-content/SkipToContent.stories.ts +3 -3
- package/dist/astro-slide-viewer/SlideViewer.stories.ts +14 -3
- package/dist/astro-social-auth-button/SocialAuthButton.stories.ts +23 -0
- package/dist/astro-social-auth-button/SocialAuthRow.stories.ts +17 -0
- package/dist/astro-status-indicator/StatusIndicator.stories.ts +14 -3
- package/dist/astro-steps/Steps.stories.ts +3 -3
- package/dist/astro-switch/Switch.stories.ts +14 -3
- package/dist/astro-table-of-contents/TableOfContents.stories.ts +8 -3
- package/dist/astro-tabs/Tabs.stories.ts +12 -3
- package/dist/astro-tabs/TabsContent.stories.ts +21 -0
- package/dist/astro-tabs/TabsList.stories.ts +17 -0
- package/dist/astro-tabs/TabsTrigger.stories.ts +21 -0
- package/dist/astro-textarea/Textarea.stories.ts +22 -3
- package/dist/astro-theme/ThemeScript.stories.ts +23 -0
- package/dist/astro-theme/ThemeToggle.stories.ts +21 -0
- package/dist/astro-thread-view/ThreadView.astro +1 -1
- package/dist/astro-thread-view/ThreadView.stories.ts +10 -3
- package/dist/astro-toast/Toast.stories.ts +16 -3
- package/dist/astro-toast/Toaster.stories.ts +17 -0
- package/dist/astro-tooltip/Tooltip.stories.ts +10 -3
- package/dist/astro-tooltip/TooltipContent.stories.ts +19 -0
- package/dist/astro-tooltip/TooltipTrigger.stories.ts +17 -0
- package/dist/astro-version-selector/VersionSelector.astro +2 -2
- package/dist/astro-version-selector/VersionSelector.stories.ts +12 -3
- package/dist/astro-video-grid/VideoGrid.astro +1 -1
- package/dist/astro-video-player/VideoPlayer.stories.ts +16 -3
- package/dist/astro-voice-pill/VoicePill.stories.ts +24 -3
- package/dist/astro-waveform/Waveform.stories.ts +26 -3
- package/dist/index.ts +1 -0
- package/dist/mascot/index.ts +2 -0
- package/dist/mascot/mascot.styles.ts +33 -0
- package/dist/mascot/mascot.ts +121 -0
- package/package.json +2 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import Component from './Tooltip.astro'
|
|
2
2
|
|
|
3
|
-
// Auto-generated baseline story. Renders the component with empty args;
|
|
4
|
-
// components that require props show a render error (enrich by hand as needed).
|
|
5
3
|
const meta = {
|
|
6
4
|
title: 'Astro/Tooltip',
|
|
7
5
|
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
delayDuration: { control: 'number' },
|
|
8
|
+
default: { control: 'text' },
|
|
9
|
+
},
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export default meta
|
|
11
13
|
|
|
12
|
-
export const Default = {
|
|
14
|
+
export const Default = {
|
|
15
|
+
args: {
|
|
16
|
+
delayDuration: 0,
|
|
17
|
+
default: '<span>default content</span>',
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Component from './TooltipContent.astro'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Astro/TooltipContent',
|
|
5
|
+
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
side: { control: 'text' },
|
|
8
|
+
default: { control: 'text' },
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
|
|
14
|
+
export const Default = {
|
|
15
|
+
args: {
|
|
16
|
+
side: '',
|
|
17
|
+
default: '<span>default content</span>',
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Component from './TooltipTrigger.astro'
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Astro/TooltipTrigger',
|
|
5
|
+
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
default: { control: 'text' },
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
default: '<span>default content</span>',
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -23,7 +23,7 @@ const {
|
|
|
23
23
|
} = Astro.props
|
|
24
24
|
|
|
25
25
|
const api = createVersionSelector({ value, versions })
|
|
26
|
-
const selectedOpt = versions.find((v) => v.value === value)
|
|
26
|
+
const selectedOpt = (versions || []).find((v) => v.value === value)
|
|
27
27
|
const displayLabel = selectedOpt ? selectedOpt.label : placeholder
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -106,7 +106,7 @@ const displayLabel = selectedOpt ? selectedOpt.label : placeholder
|
|
|
106
106
|
selectedValue = value
|
|
107
107
|
root.setAttribute('data-rfr-version-value', value)
|
|
108
108
|
|
|
109
|
-
const opt = versions.find((v) => v.value === value)
|
|
109
|
+
const opt = (versions || []).find((v) => v.value === value)
|
|
110
110
|
label.textContent = opt ? opt.label : placeholder
|
|
111
111
|
|
|
112
112
|
// Update latest badge on trigger
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import Component from './VersionSelector.astro'
|
|
2
2
|
|
|
3
|
-
// Auto-generated baseline story. Renders the component with empty args;
|
|
4
|
-
// components that require props show a render error (enrich by hand as needed).
|
|
5
3
|
const meta = {
|
|
6
4
|
title: 'Astro/VersionSelector',
|
|
7
5
|
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
value: { control: 'text' },
|
|
8
|
+
versions: { control: 'text' },
|
|
9
|
+
placeholder: { control: 'text' },
|
|
10
|
+
},
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export default meta
|
|
11
14
|
|
|
12
|
-
export const Default = {
|
|
15
|
+
export const Default = {
|
|
16
|
+
args: {
|
|
17
|
+
value: '',
|
|
18
|
+
versions: '',
|
|
19
|
+
placeholder: '',
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -53,7 +53,7 @@ const gridStyle =
|
|
|
53
53
|
|
|
54
54
|
const spotlightParticipant =
|
|
55
55
|
effectiveLayout === 'speaker'
|
|
56
|
-
? (participants.find((p) => p.id === spotlightId) ?? participants[0])
|
|
56
|
+
? ((participants || []).find((p) => p.id === spotlightId) ?? participants[0])
|
|
57
57
|
: undefined
|
|
58
58
|
|
|
59
59
|
const filmstrip =
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import Component from './VideoPlayer.astro'
|
|
2
2
|
|
|
3
|
-
// Auto-generated baseline story. Renders the component with empty args;
|
|
4
|
-
// components that require props show a render error (enrich by hand as needed).
|
|
5
3
|
const meta = {
|
|
6
4
|
title: 'Astro/VideoPlayer',
|
|
7
5
|
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
src: { control: 'text' },
|
|
8
|
+
poster: { control: 'text' },
|
|
9
|
+
autoplay: { control: 'boolean' },
|
|
10
|
+
muted: { control: 'boolean' },
|
|
11
|
+
controls: { control: 'boolean' },
|
|
12
|
+
},
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
export default meta
|
|
11
16
|
|
|
12
|
-
export const Default = {
|
|
17
|
+
export const Default = {
|
|
18
|
+
args: {
|
|
19
|
+
src: '',
|
|
20
|
+
poster: '',
|
|
21
|
+
autoplay: false,
|
|
22
|
+
muted: false,
|
|
23
|
+
controls: false,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import Component from './VoicePill.astro'
|
|
2
2
|
|
|
3
|
-
// Auto-generated baseline story. Renders the component with empty args;
|
|
4
|
-
// components that require props show a render error (enrich by hand as needed).
|
|
5
3
|
const meta = {
|
|
6
4
|
title: 'Astro/VoicePill',
|
|
7
5
|
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
speaker: { control: 'text' },
|
|
8
|
+
label: { control: 'text' },
|
|
9
|
+
sub: { control: 'text' },
|
|
10
|
+
subtitle: { control: 'text' },
|
|
11
|
+
intensity: { control: 'number' },
|
|
12
|
+
muted: { control: 'boolean' },
|
|
13
|
+
position: { control: 'text' },
|
|
14
|
+
showMuteButton: { control: 'boolean' },
|
|
15
|
+
avatar: { control: 'text' },
|
|
16
|
+
},
|
|
8
17
|
}
|
|
9
18
|
|
|
10
19
|
export default meta
|
|
11
20
|
|
|
12
|
-
export const Default = {
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
speaker: '',
|
|
24
|
+
label: '',
|
|
25
|
+
sub: '',
|
|
26
|
+
subtitle: '',
|
|
27
|
+
intensity: 0,
|
|
28
|
+
muted: false,
|
|
29
|
+
position: '',
|
|
30
|
+
showMuteButton: false,
|
|
31
|
+
avatar: '<span>avatar content</span>',
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import Component from './Waveform.astro'
|
|
2
2
|
|
|
3
|
-
// Auto-generated baseline story. Renders the component with empty args;
|
|
4
|
-
// components that require props show a render error (enrich by hand as needed).
|
|
5
3
|
const meta = {
|
|
6
4
|
title: 'Astro/Waveform',
|
|
7
5
|
component: Component,
|
|
6
|
+
argTypes: {
|
|
7
|
+
samples: { control: 'text' },
|
|
8
|
+
intensity: { control: 'number' },
|
|
9
|
+
amplitude: { control: 'number' },
|
|
10
|
+
variant: { control: 'select', options: ['default', 'secondary', 'destructive', 'outline', 'ghost', 'link'] },
|
|
11
|
+
height: { control: 'number' },
|
|
12
|
+
width: { control: 'number' },
|
|
13
|
+
barCount: { control: 'number' },
|
|
14
|
+
smoothing: { control: 'number' },
|
|
15
|
+
color: { control: 'text' },
|
|
16
|
+
paused: { control: 'boolean' },
|
|
17
|
+
},
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
export default meta
|
|
11
21
|
|
|
12
|
-
export const Default = {
|
|
22
|
+
export const Default = {
|
|
23
|
+
args: {
|
|
24
|
+
samples: '',
|
|
25
|
+
intensity: 0,
|
|
26
|
+
amplitude: 0,
|
|
27
|
+
variant: 'default',
|
|
28
|
+
height: 0,
|
|
29
|
+
width: 0,
|
|
30
|
+
barCount: 0,
|
|
31
|
+
smoothing: 0,
|
|
32
|
+
color: '',
|
|
33
|
+
paused: false,
|
|
34
|
+
},
|
|
35
|
+
}
|
package/dist/index.ts
CHANGED
|
@@ -67,6 +67,7 @@ export * from './astro-logger/index.ts';
|
|
|
67
67
|
export * from './astro-markdown-renderer/index.ts';
|
|
68
68
|
export * from './astro-marquee-strip/index.ts';
|
|
69
69
|
export * from './astro-mastery-bar/index.ts';
|
|
70
|
+
export * from './astro-mascot/index.ts';
|
|
70
71
|
export * from './astro-mini-map/index.ts';
|
|
71
72
|
export * from './astro-mobile-nav/index.ts';
|
|
72
73
|
export * from './astro-navbar/index.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cva } from '../shared/index.ts'
|
|
2
|
+
import type { TokenContract } from '../shared/index.ts'
|
|
3
|
+
|
|
4
|
+
export const mascotTokens: TokenContract = {
|
|
5
|
+
name: 'mascot',
|
|
6
|
+
tokens: {
|
|
7
|
+
primary: { variable: '--rfr-mascot-primary', fallback: '138 60% 51%' },
|
|
8
|
+
secondary: { variable: '--rfr-mascot-secondary', fallback: '138 60% 83%' },
|
|
9
|
+
accent: { variable: '--rfr-mascot-accent', fallback: '26 100% 67%' },
|
|
10
|
+
stroke: { variable: '--rfr-mascot-stroke', fallback: '139 59% 16%' },
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const mascotVariants = cva({
|
|
15
|
+
base: 'inline-block select-none transition-all duration-300',
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: 'w-24 h-auto',
|
|
19
|
+
md: 'w-36 h-auto',
|
|
20
|
+
lg: 'w-48 h-auto',
|
|
21
|
+
xl: 'w-64 h-auto',
|
|
22
|
+
},
|
|
23
|
+
animation: {
|
|
24
|
+
none: '',
|
|
25
|
+
bounce: 'motion-safe:animate-bounce',
|
|
26
|
+
float: 'rfr-mascot-float',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: 'md',
|
|
31
|
+
animation: 'none',
|
|
32
|
+
},
|
|
33
|
+
})
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { AccessibilityProps } from '../shared/index.ts'
|
|
2
|
+
|
|
3
|
+
export type MascotMood = 'happy' | 'think' | 'wave'
|
|
4
|
+
export type MascotAnimation = 'none' | 'bounce' | 'float'
|
|
5
|
+
export type MascotSize = 'sm' | 'md' | 'lg' | 'xl'
|
|
6
|
+
|
|
7
|
+
export interface MascotProps {
|
|
8
|
+
mood?: MascotMood
|
|
9
|
+
animation?: MascotAnimation
|
|
10
|
+
size?: MascotSize
|
|
11
|
+
animate?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface MascotAPI {
|
|
15
|
+
/** ARIA attributes to spread on the root element */
|
|
16
|
+
ariaProps: Record<string, string | number | boolean>
|
|
17
|
+
/** Data attributes for CSS styling hooks and states */
|
|
18
|
+
dataAttributes: Record<string, string>
|
|
19
|
+
/** Active mascot state configuration */
|
|
20
|
+
state: {
|
|
21
|
+
mood: MascotMood
|
|
22
|
+
animation: MascotAnimation
|
|
23
|
+
size: MascotSize
|
|
24
|
+
animate: boolean
|
|
25
|
+
}
|
|
26
|
+
/** Mood styles mapping moods to CSS custom properties */
|
|
27
|
+
style: Record<string, string>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Maps mascot moods ('happy', 'think', 'wave') to CSS custom properties (variables).
|
|
32
|
+
*/
|
|
33
|
+
export function getMascotMoodStyles(mood: MascotMood): Record<string, string> {
|
|
34
|
+
switch (mood) {
|
|
35
|
+
case 'happy':
|
|
36
|
+
return {
|
|
37
|
+
'--rfr-mascot-shell': 'var(--primary, 138 60% 51%)',
|
|
38
|
+
'--rfr-mascot-shell-rim': 'var(--primary-700, 138 58% 36%)',
|
|
39
|
+
'--rfr-mascot-belly': 'var(--primary-200, 138 60% 83%)',
|
|
40
|
+
'--rfr-mascot-skin': 'var(--primary-400, 138 59% 63%)',
|
|
41
|
+
'--rfr-mascot-skin-d': 'var(--primary-600, 138 58% 43%)',
|
|
42
|
+
'--rfr-mascot-scute': 'var(--sunshine, 42 100% 62%)',
|
|
43
|
+
'--rfr-mascot-scute-alt': 'var(--primary-300, 138 59% 74%)',
|
|
44
|
+
'--rfr-mascot-cheek': 'var(--accent-solid, 26 100% 67%)',
|
|
45
|
+
}
|
|
46
|
+
case 'think':
|
|
47
|
+
return {
|
|
48
|
+
// Indigo / purple tones
|
|
49
|
+
'--rfr-mascot-shell': '250 65% 55%',
|
|
50
|
+
'--rfr-mascot-shell-rim': '250 65% 40%',
|
|
51
|
+
'--rfr-mascot-belly': '250 65% 85%',
|
|
52
|
+
'--rfr-mascot-skin': '250 65% 72%',
|
|
53
|
+
'--rfr-mascot-skin-d': '250 65% 62%',
|
|
54
|
+
'--rfr-mascot-scute': '280 65% 60%',
|
|
55
|
+
'--rfr-mascot-scute-alt': '280 65% 50%',
|
|
56
|
+
'--rfr-mascot-cheek': '320 80% 65%',
|
|
57
|
+
}
|
|
58
|
+
case 'wave':
|
|
59
|
+
return {
|
|
60
|
+
// Orange / warm tones
|
|
61
|
+
'--rfr-mascot-shell': '24 85% 50%',
|
|
62
|
+
'--rfr-mascot-shell-rim': '24 85% 40%',
|
|
63
|
+
'--rfr-mascot-belly': '24 85% 85%',
|
|
64
|
+
'--rfr-mascot-skin': '24 85% 68%',
|
|
65
|
+
'--rfr-mascot-skin-d': '24 85% 58%',
|
|
66
|
+
'--rfr-mascot-scute': '160 60% 45%',
|
|
67
|
+
'--rfr-mascot-scute-alt': '160 60% 35%',
|
|
68
|
+
'--rfr-mascot-cheek': '15 90% 65%',
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Creates a cleanup-enabled interval timer for Tobi's blinking state.
|
|
75
|
+
* Blinks for 150ms every 4000ms.
|
|
76
|
+
*/
|
|
77
|
+
export function startMascotBlinkInterval(
|
|
78
|
+
onBlinkChange: (isBlinking: boolean) => void,
|
|
79
|
+
intervalMs = 4000,
|
|
80
|
+
durationMs = 150,
|
|
81
|
+
): () => void {
|
|
82
|
+
const timer = setInterval(() => {
|
|
83
|
+
onBlinkChange(true)
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
onBlinkChange(false)
|
|
86
|
+
}, durationMs)
|
|
87
|
+
}, intervalMs)
|
|
88
|
+
|
|
89
|
+
return () => {
|
|
90
|
+
clearInterval(timer)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function createMascot(props: MascotProps = {}): MascotAPI {
|
|
95
|
+
const { mood = 'happy', animation = 'none', size = 'md', animate = true } = props
|
|
96
|
+
|
|
97
|
+
const ariaProps: Record<string, string | number | boolean> = {
|
|
98
|
+
role: 'img',
|
|
99
|
+
'aria-label': `Tobi the Tortoise feeling ${mood}`,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const dataAttributes: Record<string, string> = {
|
|
103
|
+
'data-slot': 'mascot',
|
|
104
|
+
'data-mood': mood,
|
|
105
|
+
'data-animation': animation,
|
|
106
|
+
'data-size': size,
|
|
107
|
+
'data-animate': animate ? 'true' : 'false',
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
ariaProps,
|
|
112
|
+
dataAttributes,
|
|
113
|
+
state: {
|
|
114
|
+
mood,
|
|
115
|
+
animation,
|
|
116
|
+
size,
|
|
117
|
+
animate,
|
|
118
|
+
},
|
|
119
|
+
style: getMascotMoodStyles(mood),
|
|
120
|
+
}
|
|
121
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refraction-ui/astro",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "All Refraction UI Astro components in one package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"@refraction-ui/astro-markdown-renderer": "workspace:*",
|
|
88
88
|
"@refraction-ui/astro-marquee-strip": "workspace:*",
|
|
89
89
|
"@refraction-ui/astro-mastery-bar": "workspace:*",
|
|
90
|
+
"@refraction-ui/astro-mascot": "workspace:*",
|
|
90
91
|
"@refraction-ui/astro-mini-map": "workspace:*",
|
|
91
92
|
"@refraction-ui/astro-mobile-nav": "workspace:*",
|
|
92
93
|
"@refraction-ui/astro-navbar": "workspace:*",
|