@fragments-sdk/ui 0.8.5 → 0.8.7

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 (114) hide show
  1. package/fragments.json +1 -1
  2. package/package.json +2 -2
  3. package/src/blocks/AccountSettings.block.ts +1 -1
  4. package/src/blocks/ActivityFeed.block.ts +1 -1
  5. package/src/blocks/ChatInterface.block.ts +1 -1
  6. package/src/blocks/ChatMessages.block.ts +1 -1
  7. package/src/blocks/CheckoutForm.block.ts +1 -1
  8. package/src/blocks/ContactForm.block.ts +1 -1
  9. package/src/blocks/DashboardLayout.block.ts +1 -1
  10. package/src/blocks/DashboardPage.block.ts +1 -1
  11. package/src/blocks/DataTable.block.ts +1 -1
  12. package/src/blocks/EmptyState.block.ts +1 -1
  13. package/src/blocks/FAQSection.block.ts +1 -1
  14. package/src/blocks/FeatureGrid.block.ts +1 -1
  15. package/src/blocks/HeroSection.block.ts +1 -1
  16. package/src/blocks/LoginForm.block.ts +1 -1
  17. package/src/blocks/NavigationHeader.block.ts +1 -1
  18. package/src/blocks/PricingComparison.block.ts +1 -1
  19. package/src/blocks/ProductCard.block.ts +1 -1
  20. package/src/blocks/RegistrationForm.block.ts +1 -1
  21. package/src/blocks/SettingsPanel.block.ts +1 -1
  22. package/src/blocks/ShoppingCart.block.ts +1 -1
  23. package/src/blocks/StatsCard.block.ts +1 -1
  24. package/src/blocks/ThinkingStates.block.ts +1 -1
  25. package/src/components/Accordion/Accordion.fragment.tsx +1 -1
  26. package/src/components/Alert/Alert.fragment.tsx +1 -1
  27. package/src/components/AppShell/AppShell.fragment.tsx +11 -11
  28. package/src/components/Avatar/Avatar.fragment.tsx +1 -1
  29. package/src/components/Avatar/index.tsx +9 -1
  30. package/src/components/Badge/Badge.fragment.tsx +1 -1
  31. package/src/components/Box/Box.fragment.tsx +1 -1
  32. package/src/components/Breadcrumbs/Breadcrumbs.fragment.tsx +1 -1
  33. package/src/components/Button/Button.fragment.tsx +1 -1
  34. package/src/components/ButtonGroup/ButtonGroup.fragment.tsx +1 -1
  35. package/src/components/Card/Card.fragment.tsx +1 -1
  36. package/src/components/Chart/Chart.fragment.tsx +1 -1
  37. package/src/components/Checkbox/Checkbox.fragment.tsx +1 -1
  38. package/src/components/Chip/Chip.fragment.tsx +1 -1
  39. package/src/components/Chip/index.tsx +2 -0
  40. package/src/components/CodeBlock/CodeBlock.fragment.tsx +1 -1
  41. package/src/components/Collapsible/Collapsible.fragment.tsx +1 -1
  42. package/src/components/ColorPicker/ColorPicker.fragment.tsx +1 -1
  43. package/src/components/ColorPicker/index.tsx +2 -0
  44. package/src/components/Combobox/Combobox.fragment.tsx +1 -1
  45. package/src/components/Combobox/index.tsx +2 -0
  46. package/src/components/ConversationList/ConversationList.fragment.tsx +1 -1
  47. package/src/components/DatePicker/DatePicker.fragment.tsx +10 -9
  48. package/src/components/DatePicker/index.tsx +2 -0
  49. package/src/components/Dialog/Dialog.fragment.tsx +1 -1
  50. package/src/components/EmptyState/EmptyState.fragment.tsx +1 -1
  51. package/src/components/Field/Field.fragment.tsx +1 -1
  52. package/src/components/Fieldset/Fieldset.fragment.tsx +1 -1
  53. package/src/components/Form/Form.fragment.tsx +1 -1
  54. package/src/components/Grid/Grid.fragment.tsx +1 -1
  55. package/src/components/Header/Header.fragment.tsx +1 -1
  56. package/src/components/Icon/Icon.fragment.tsx +1 -1
  57. package/src/components/Image/Image.fragment.tsx +1 -1
  58. package/src/components/Image/index.tsx +10 -0
  59. package/src/components/Input/Input.fragment.tsx +1 -1
  60. package/src/components/Input/index.tsx +2 -0
  61. package/src/components/Link/Link.fragment.tsx +1 -1
  62. package/src/components/List/List.fragment.tsx +1 -1
  63. package/src/components/Listbox/Listbox.fragment.tsx +1 -1
  64. package/src/components/Listbox/index.tsx +6 -1
  65. package/src/components/Loading/Loading.fragment.tsx +1 -1
  66. package/src/components/Markdown/Markdown.fragment.tsx +1 -1
  67. package/src/components/Menu/Menu.fragment.tsx +55 -5
  68. package/src/components/Menu/Menu.module.scss +21 -10
  69. package/src/components/Menu/Menu.test.tsx +126 -3
  70. package/src/components/Menu/index.tsx +85 -11
  71. package/src/components/Message/Message.fragment.tsx +1 -1
  72. package/src/components/Message/Message.module.scss +2 -1
  73. package/src/components/NavigationMenu/NavigationMenu.fragment.tsx +1 -1
  74. package/src/components/NavigationMenu/index.tsx +1 -0
  75. package/src/components/Popover/Popover.fragment.tsx +1 -1
  76. package/src/components/Progress/Progress.fragment.tsx +1 -1
  77. package/src/components/Prompt/Prompt.fragment.tsx +1 -1
  78. package/src/components/RadioGroup/RadioGroup.fragment.tsx +1 -1
  79. package/src/components/ScrollArea/ScrollArea.fragment.tsx +1 -1
  80. package/src/components/ScrollArea/index.tsx +2 -0
  81. package/src/components/Select/Select.fragment.tsx +1 -1
  82. package/src/components/Select/index.tsx +2 -0
  83. package/src/components/Separator/Separator.fragment.tsx +1 -1
  84. package/src/components/Sidebar/Sidebar.fragment.tsx +2 -2
  85. package/src/components/Sidebar/index.tsx +2 -0
  86. package/src/components/Skeleton/Skeleton.fragment.tsx +1 -1
  87. package/src/components/Slider/Slider.fragment.tsx +1 -1
  88. package/src/components/Slider/index.tsx +2 -0
  89. package/src/components/Stack/Stack.fragment.tsx +1 -1
  90. package/src/components/Table/Table.fragment.tsx +1 -1
  91. package/src/components/Table/index.tsx +2 -0
  92. package/src/components/TableOfContents/TableOfContents.fragment.tsx +1 -1
  93. package/src/components/Tabs/Tabs.fragment.tsx +1 -1
  94. package/src/components/Text/Text.fragment.tsx +1 -1
  95. package/src/components/Textarea/Textarea.fragment.tsx +1 -1
  96. package/src/components/Theme/Theme.fragment.tsx +1 -1
  97. package/src/components/ThinkingIndicator/ThinkingIndicator.fragment.tsx +1 -1
  98. package/src/components/Toast/Toast.fragment.tsx +1 -1
  99. package/src/components/Toast/index.tsx +2 -0
  100. package/src/components/Toggle/Toggle.fragment.tsx +1 -1
  101. package/src/components/ToggleGroup/ToggleGroup.fragment.tsx +1 -1
  102. package/src/components/Tooltip/Tooltip.fragment.tsx +1 -1
  103. package/src/components/VisuallyHidden/VisuallyHidden.fragment.tsx +1 -1
  104. package/src/styles/globals.scss +65 -7
  105. package/src/tokens/_computed.scss +1 -1
  106. package/src/tokens/_density.scss +1 -1
  107. package/src/tokens/_derive.scss +1 -1
  108. package/src/tokens/_index.scss +1 -1
  109. package/src/tokens/_mixins.scss +1 -1
  110. package/src/tokens/_palettes.scss +1 -1
  111. package/src/tokens/_radius.scss +1 -1
  112. package/src/tokens/_seeds.scss +1 -1
  113. package/src/tokens/_variables.scss +2 -2
  114. package/src/utils/a11y.tsx +2 -10
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import { Select as BaseSelect } from '@base-ui/react/select';
3
5
  import styles from './Select.module.scss';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Separator } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Sidebar, SidebarProvider, useSidebar } from '.';
4
4
  import { Button } from '../Button';
5
5
 
@@ -81,7 +81,7 @@ const mainContentStyle: React.CSSProperties = {
81
81
  };
82
82
 
83
83
  const demoContainerStyle: React.CSSProperties = {
84
- height: '400px',
84
+ minHeight: '100vh',
85
85
  display: 'flex',
86
86
  width: '100%',
87
87
  };
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import styles from './Sidebar.module.scss';
3
5
  import { Tooltip } from '../Tooltip';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Skeleton } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Slider } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import { Field } from '@base-ui/react/field';
3
5
  import { Slider as BaseSlider } from '@base-ui/react/slider';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Stack } from '.';
4
4
  import { Button } from '../Button';
5
5
  import { Badge } from '../Badge';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Table, createColumns } from '.';
4
4
  import { Badge } from '../Badge';
5
5
 
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  // Import globals to ensure CSS variables are defined
3
5
  import '../../styles/globals.scss';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { TableOfContents } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Tabs } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Text } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Textarea } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { ThemeProvider, ThemeToggle, useTheme } from '.';
4
4
 
5
5
  // Demo component to show hook usage
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { ThinkingIndicator } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Toast, ToastProvider, useToast } from '.';
4
4
 
5
5
  // Demo component that triggers toasts
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import styles from './Toast.module.scss';
3
5
  // Import globals to ensure CSS variables are defined
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Switch } from '.';
4
4
 
5
5
  // Stateful wrapper for interactive demos
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { ToggleGroup } from '.';
4
4
 
5
5
  function DefaultExample() {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { Tooltip } from '.';
4
4
  import { Button } from '../Button';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { defineFragment } from '@fragments/core';
2
+ import { defineFragment } from '@fragments-sdk/cli/core';
3
3
  import { VisuallyHidden } from '.';
4
4
 
5
5
  export default defineFragment({
@@ -1,14 +1,14 @@
1
1
  // ============================================
2
- // @fragments/ui Global Styles
2
+ // @fragments-sdk/ui Global Styles
3
3
  // ============================================
4
4
  // Import this file once in your app to set up CSS custom properties
5
- // for theming. This enables automatic dark mode support.
5
+ // for theming, plus base element resets for consistent rendering.
6
6
  //
7
7
  // Usage in your app:
8
- // import '@fragments/ui/styles/globals.scss';
8
+ // import '@fragments-sdk/ui/styles/globals.scss';
9
9
  //
10
10
  // Or in SCSS:
11
- // @use '@fragments/ui/styles/globals';
11
+ // @use '@fragments-sdk/ui/styles/globals';
12
12
  // ============================================
13
13
 
14
14
  @use '../tokens/variables' as *;
@@ -16,11 +16,70 @@
16
16
  // Output all CSS custom properties
17
17
  @include fui-css-variables;
18
18
 
19
+ // ============================================
20
+ // Box-Sizing Reset
21
+ // ============================================
22
+
23
+ *,
24
+ *::before,
25
+ *::after {
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ // ============================================
30
+ // Base Element Resets
31
+ // ============================================
32
+
33
+ html {
34
+ scroll-behavior: smooth;
35
+ }
36
+
37
+ body {
38
+ margin: 0;
39
+ font-family: var(--fui-font-sans, Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
40
+ background-color: var(--fui-bg-primary, #ffffff);
41
+ color: var(--fui-text-primary, #171717);
42
+ -webkit-font-smoothing: antialiased;
43
+ -moz-osx-font-smoothing: grayscale;
44
+ font-feature-settings: "rlig" 1, "calt" 1;
45
+ }
46
+
47
+ *::selection {
48
+ background-color: var(--fui-color-success-bg, rgba(16, 163, 127, 0.1));
49
+ color: var(--fui-text-primary, #171717);
50
+ }
51
+
52
+ // ============================================
53
+ // Scrollbar Styles
54
+ // ============================================
55
+
56
+ ::-webkit-scrollbar {
57
+ width: 6px;
58
+ height: 6px;
59
+ }
60
+
61
+ ::-webkit-scrollbar-track {
62
+ background-color: transparent;
63
+ }
64
+
65
+ ::-webkit-scrollbar-thumb {
66
+ background-color: var(--fui-text-tertiary, #8a8a8a);
67
+ border-radius: 9999px;
68
+ }
69
+
70
+ ::-webkit-scrollbar-thumb:hover {
71
+ background-color: var(--fui-text-secondary, #525252);
72
+ }
73
+
74
+ // Firefox scrollbar
75
+ * {
76
+ scrollbar-width: thin;
77
+ scrollbar-color: var(--fui-text-tertiary, #8a8a8a) transparent;
78
+ }
79
+
19
80
  // ============================================
20
81
  // Accessibility: Reduced Motion
21
82
  // ============================================
22
- // Respects user's system preference for reduced motion.
23
- // Disables animations and transitions globally when enabled.
24
83
 
25
84
  @media (prefers-reduced-motion: reduce) {
26
85
  *,
@@ -36,7 +95,6 @@
36
95
  // ============================================
37
96
  // Accessibility: Focus Visible
38
97
  // ============================================
39
- // Ensures focus indicators are only shown for keyboard navigation
40
98
 
41
99
  :focus:not(:focus-visible) {
42
100
  outline: none;
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Computed Tokens
2
+ // @fragments-sdk/ui Computed Tokens
3
3
  // ============================================
4
4
  //
5
5
  // This module imports seed values and derivation functions,
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Density Scales
2
+ // @fragments-sdk/ui Density Scales
3
3
  // ============================================
4
4
  //
5
5
  // Defines 3 density presets that control spacing and sizing.
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Token Derivation Functions
2
+ // @fragments-sdk/ui Token Derivation Functions
3
3
  // ============================================
4
4
  //
5
5
  // Functions that derive complete token sets from seed values.
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Design Tokens Index
2
+ // @fragments-sdk/ui Design Tokens Index
3
3
  // ============================================
4
4
  //
5
5
  // This module exports the complete token system.
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Shared Mixins
2
+ // @fragments-sdk/ui Shared Mixins
3
3
  // ============================================
4
4
 
5
5
  @use 'variables' as *;
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Elemental Palettes
2
+ // @fragments-sdk/ui Elemental Palettes
3
3
  // ============================================
4
4
  //
5
5
  // Defines 5 elemental palettes with 11 shades (50-950).
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Radius Styles
2
+ // @fragments-sdk/ui Radius Styles
3
3
  // ============================================
4
4
  //
5
5
  // Defines 5 radius style presets that control corner rounding.
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Design Token Seeds
2
+ // @fragments-sdk/ui Design Token Seeds
3
3
  // ============================================
4
4
  //
5
5
  // User-configurable seed tokens for the design system.
@@ -1,5 +1,5 @@
1
1
  // ============================================
2
- // @fragments/ui Design Tokens
2
+ // @fragments-sdk/ui Design Tokens
3
3
  // ============================================
4
4
  //
5
5
  // SEED-BASED DESIGN SYSTEM
@@ -21,7 +21,7 @@
21
21
  //
22
22
  // Example:
23
23
  // $fui-color-accent: #0066ff;
24
- // @use '@fragments/ui/tokens';
24
+ // @use '@fragments-sdk/ui/tokens';
25
25
  //
26
26
  // Or use CSS custom properties for runtime theming.
27
27
  // ============================================
@@ -143,11 +143,7 @@ export function useAnnounce(): {
143
143
  * ```
144
144
  */
145
145
  export function usePrefersReducedMotion(): boolean {
146
- const [prefersReducedMotion, setPrefersReducedMotion] = React.useState(() => {
147
- // SSR-safe default
148
- if (typeof window === 'undefined') return false;
149
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
150
- });
146
+ const [prefersReducedMotion, setPrefersReducedMotion] = React.useState(false);
151
147
 
152
148
  React.useEffect(() => {
153
149
  const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
@@ -184,11 +180,7 @@ export function usePrefersReducedMotion(): boolean {
184
180
  * ```
185
181
  */
186
182
  export function usePrefersContrast(): boolean {
187
- const [prefersContrast, setPrefersContrast] = React.useState(() => {
188
- // SSR-safe default
189
- if (typeof window === 'undefined') return false;
190
- return window.matchMedia('(prefers-contrast: more)').matches;
191
- });
183
+ const [prefersContrast, setPrefersContrast] = React.useState(false);
192
184
 
193
185
  React.useEffect(() => {
194
186
  const mediaQuery = window.matchMedia('(prefers-contrast: more)');