@refraction-ui/astro 0.15.0 → 0.15.2

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.
Files changed (132) hide show
  1. package/dist/astro-accordion/Accordion.astro +7 -0
  2. package/dist/astro-accordion/Accordion.stories.ts +10 -4
  3. package/dist/astro-ai/AIScript.astro +1 -1
  4. package/dist/astro-analytics/Analytics.stories.ts +5 -3
  5. package/dist/astro-analytics/AnalyticsScript.astro +1 -1
  6. package/dist/astro-animated-text/AnimatedText.stories.ts +7 -3
  7. package/dist/astro-app-shell/AppShell.stories.ts +14 -3
  8. package/dist/astro-auth/Auth.stories.ts +8 -3
  9. package/dist/astro-avatar/Avatar.stories.ts +6 -3
  10. package/dist/astro-avatar-group/AvatarGroup.stories.ts +10 -3
  11. package/dist/astro-badge/Badge.stories.ts +7 -7
  12. package/dist/astro-bottom-nav/BottomNav.stories.ts +6 -3
  13. package/dist/astro-breadcrumbs/Breadcrumbs.stories.ts +9 -3
  14. package/dist/astro-button/Button.stories.ts +9 -3
  15. package/dist/astro-calendar/Calendar.stories.ts +9 -3
  16. package/dist/astro-callout/Callout.stories.ts +6 -3
  17. package/dist/astro-card/Card.stories.ts +6 -3
  18. package/dist/astro-card-grid/CardGrid.stories.ts +5 -3
  19. package/dist/astro-carousel/Carousel.astro +7 -0
  20. package/dist/astro-carousel/Carousel.stories.ts +10 -4
  21. package/dist/astro-charts/Charts.stories.ts +9 -4
  22. package/dist/astro-checkbox/Checkbox.stories.ts +9 -3
  23. package/dist/astro-code-block/CodeBlock.stories.ts +5 -3
  24. package/dist/astro-code-editor/CodeEditor.astro +1 -1
  25. package/dist/astro-code-editor/CodeEditor.stories.ts +10 -3
  26. package/dist/astro-collapsible/Collapsible.stories.ts +7 -3
  27. package/dist/astro-command/Command.stories.ts +6 -3
  28. package/dist/astro-command-input/CommandInput.stories.ts +5 -3
  29. package/dist/astro-content-protection/ContentProtection.stories.ts +9 -3
  30. package/dist/astro-conversation/Chat.astro +1 -1
  31. package/dist/astro-conversation/Conversation.stories.ts +7 -3
  32. package/dist/astro-data-table/DataTable.astro +1 -1
  33. package/dist/astro-data-table/DataTable.stories.ts +15 -3
  34. package/dist/astro-date-picker/DatePicker.astro +39 -355
  35. package/dist/astro-date-picker/DatePicker.stories.ts +11 -3
  36. package/dist/astro-device-frame/DeviceFrame.stories.ts +7 -3
  37. package/dist/astro-dialog/Dialog.stories.ts +7 -3
  38. package/dist/astro-diff-viewer/DiffViewer.stories.ts +19 -3
  39. package/dist/astro-dropdown-menu/DropdownMenu.stories.ts +6 -3
  40. package/dist/astro-emoji-picker/EmojiPicker.stories.ts +5 -3
  41. package/dist/astro-feedback-dialog/FeedbackDialog.stories.ts +6 -3
  42. package/dist/astro-file-tree/FileTree.stories.ts +5 -3
  43. package/dist/astro-file-upload/FileUpload.stories.ts +9 -3
  44. package/dist/astro-floating-reactions/FloatingReactions.astro +1 -1
  45. package/dist/astro-footer/Footer.stories.ts +7 -3
  46. package/dist/astro-icon-system/IconSystem.stories.ts +5 -3
  47. package/dist/astro-inline-editor/InlineEditor.stories.ts +5 -3
  48. package/dist/astro-input/Input.stories.ts +11 -3
  49. package/dist/astro-input-group/InputGroup.stories.ts +6 -3
  50. package/dist/astro-install-prompt/InstallPrompt.stories.ts +9 -3
  51. package/dist/astro-keyboard-shortcut/KeyboardShortcut.stories.ts +7 -3
  52. package/dist/astro-language-selector/LanguageSelector.stories.ts +11 -3
  53. package/dist/astro-link-card/LinkCard.stories.ts +5 -3
  54. package/dist/astro-logger/Logger.stories.ts +10 -3
  55. package/dist/astro-logger/TelemetryScript.astro +1 -1
  56. package/dist/astro-markdown-renderer/MarkdownRenderer.stories.ts +8 -3
  57. package/dist/astro-mascot/Mascot.astro +274 -0
  58. package/dist/astro-mascot/Mascot.stories.ts +46 -0
  59. package/dist/astro-mascot/index.ts +11 -0
  60. package/dist/astro-mobile-nav/MobileNav.stories.ts +6 -3
  61. package/dist/astro-navbar/Navbar.stories.ts +16 -3
  62. package/dist/astro-otp-input/OtpInput.stories.ts +20 -3
  63. package/dist/astro-pagination/Pagination.stories.ts +3 -3
  64. package/dist/astro-password-input/PasswordInput.stories.ts +29 -0
  65. package/dist/astro-payment/Payment.stories.ts +8 -3
  66. package/dist/astro-popover/Popover.stories.ts +10 -3
  67. package/dist/astro-popover/PopoverClose.stories.ts +17 -0
  68. package/dist/astro-popover/PopoverContent.stories.ts +19 -0
  69. package/dist/astro-popover/PopoverTrigger.stories.ts +17 -0
  70. package/dist/astro-presence-indicator/PresenceIndicator.stories.ts +14 -3
  71. package/dist/astro-progress-display/BadgeDisplay.astro +1 -1
  72. package/dist/astro-progress-display/BadgeDisplay.stories.ts +17 -0
  73. package/dist/astro-progress-display/ProgressBar.stories.ts +21 -0
  74. package/dist/astro-progress-display/StatsGrid.astro +1 -1
  75. package/dist/astro-progress-display/StatsGrid.stories.ts +19 -0
  76. package/dist/astro-radio/RadioGroup.stories.ts +25 -0
  77. package/dist/astro-radio/RadioItem.stories.ts +23 -0
  78. package/dist/astro-reaction-bar/ReactionBar.astro +1 -1
  79. package/dist/astro-reaction-bar/ReactionBar.stories.ts +10 -3
  80. package/dist/astro-resizable-layout/ResizableDivider.stories.ts +19 -0
  81. package/dist/astro-resizable-layout/ResizableLayout.stories.ts +18 -3
  82. package/dist/astro-resizable-layout/ResizablePane.stories.ts +21 -0
  83. package/dist/astro-rich-editor/RichEditor.stories.ts +20 -3
  84. package/dist/astro-search-bar/SearchBar.stories.ts +14 -3
  85. package/dist/astro-search-bar/SearchResultItem.stories.ts +17 -0
  86. package/dist/astro-search-bar/SearchResults.stories.ts +17 -0
  87. package/dist/astro-segmented-control/SegmentedControl.stories.ts +23 -0
  88. package/dist/astro-segmented-control/SegmentedControlItem.stories.ts +25 -0
  89. package/dist/astro-select/Select.stories.ts +16 -3
  90. package/dist/astro-select/SelectContent.stories.ts +17 -0
  91. package/dist/astro-select/SelectItem.stories.ts +23 -0
  92. package/dist/astro-select/SelectTrigger.stories.ts +21 -0
  93. package/dist/astro-separator/Separator.stories.ts +23 -0
  94. package/dist/astro-sidebar/Sidebar.astro +1 -1
  95. package/dist/astro-sidebar/Sidebar.stories.ts +14 -3
  96. package/dist/astro-skeleton/Skeleton.stories.ts +14 -3
  97. package/dist/astro-skeleton/SkeletonText.stories.ts +19 -0
  98. package/dist/astro-skip-to-content/SkipToContent.stories.ts +3 -3
  99. package/dist/astro-slide-viewer/SlideViewer.stories.ts +14 -3
  100. package/dist/astro-social-auth-button/SocialAuthButton.stories.ts +23 -0
  101. package/dist/astro-social-auth-button/SocialAuthRow.stories.ts +17 -0
  102. package/dist/astro-status-indicator/StatusIndicator.stories.ts +14 -3
  103. package/dist/astro-steps/Steps.stories.ts +3 -3
  104. package/dist/astro-switch/Switch.stories.ts +14 -3
  105. package/dist/astro-table-of-contents/TableOfContents.stories.ts +8 -3
  106. package/dist/astro-tabs/Tabs.stories.ts +12 -3
  107. package/dist/astro-tabs/TabsContent.stories.ts +21 -0
  108. package/dist/astro-tabs/TabsList.stories.ts +17 -0
  109. package/dist/astro-tabs/TabsTrigger.stories.ts +21 -0
  110. package/dist/astro-textarea/Textarea.stories.ts +22 -3
  111. package/dist/astro-theme/ThemeScript.stories.ts +23 -0
  112. package/dist/astro-theme/ThemeToggle.stories.ts +21 -0
  113. package/dist/astro-thread-view/ThreadView.astro +1 -1
  114. package/dist/astro-thread-view/ThreadView.stories.ts +10 -3
  115. package/dist/astro-toast/Toast.stories.ts +16 -3
  116. package/dist/astro-toast/Toaster.stories.ts +17 -0
  117. package/dist/astro-tooltip/Tooltip.stories.ts +10 -3
  118. package/dist/astro-tooltip/TooltipContent.stories.ts +19 -0
  119. package/dist/astro-tooltip/TooltipTrigger.stories.ts +17 -0
  120. package/dist/astro-version-selector/VersionSelector.astro +2 -2
  121. package/dist/astro-version-selector/VersionSelector.stories.ts +12 -3
  122. package/dist/astro-video-grid/VideoGrid.astro +1 -1
  123. package/dist/astro-video-player/VideoPlayer.stories.ts +16 -3
  124. package/dist/astro-voice-pill/VoicePill.stories.ts +24 -3
  125. package/dist/astro-waveform/Waveform.stories.ts +26 -3
  126. package/dist/date-picker/date-picker.styles.ts +1 -1
  127. package/dist/date-picker/date-picker.ts +3 -1
  128. package/dist/index.ts +1 -0
  129. package/dist/mascot/index.ts +2 -0
  130. package/dist/mascot/mascot.styles.ts +33 -0
  131. package/dist/mascot/mascot.ts +121 -0
  132. package/package.json +2 -1
@@ -4,7 +4,7 @@ export const datePickerTriggerStyles =
4
4
  'inline-flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring cursor-pointer'
5
5
 
6
6
  export const datePickerDropdownStyles =
7
- 'absolute z-50 mt-1 rounded-md border bg-popover p-4 text-popover-foreground shadow-md'
7
+ 'absolute z-50 mt-1 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md'
8
8
 
9
9
  export const datePickerGridStyles = 'w-full border-collapse'
10
10
 
@@ -24,6 +24,8 @@ export interface DatePickerProps {
24
24
  defaultOpen?: boolean
25
25
  /** Callback when open changes */
26
26
  onOpenChange?: (open: boolean) => void
27
+ /** The currently displayed month (controlled) */
28
+ currentMonth?: Date
27
29
  }
28
30
 
29
31
  export interface DatePickerState {
@@ -149,7 +151,7 @@ export function createDatePicker(props: DatePickerProps = {}): DatePickerAPI {
149
151
 
150
152
  const today = new Date()
151
153
  let internalOpen = controlledOpen ?? defaultOpen
152
- let currentMonth = value ? startOfMonth(value) : startOfMonth(today)
154
+ let currentMonth = props.currentMonth ?? (value ? startOfMonth(value) : startOfMonth(today))
153
155
  let view: DatePickerView = 'calendar'
154
156
  const hours = value ? value.getHours() : 0
155
157
  const minutes = value ? value.getMinutes() : 0
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,2 @@
1
+ export * from './mascot.ts'
2
+ export * from './mascot.styles.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.0",
3
+ "version": "0.15.2",
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:*",