@papernote/ui 1.10.18 → 1.10.20

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 (37) hide show
  1. package/dist/components/Alert.d.ts +1 -1
  2. package/dist/components/Alert.d.ts.map +1 -1
  3. package/dist/components/Badge.d.ts +1 -1
  4. package/dist/components/Badge.d.ts.map +1 -1
  5. package/dist/components/BottomNavigation.d.ts +6 -0
  6. package/dist/components/BottomNavigation.d.ts.map +1 -1
  7. package/dist/components/Menu.d.ts +6 -0
  8. package/dist/components/Menu.d.ts.map +1 -1
  9. package/dist/components/Sidebar.d.ts +6 -0
  10. package/dist/components/Sidebar.d.ts.map +1 -1
  11. package/dist/components/StatusBadge.d.ts +1 -1
  12. package/dist/components/StatusBadge.d.ts.map +1 -1
  13. package/dist/components/Tabs.d.ts +13 -1
  14. package/dist/components/Tabs.d.ts.map +1 -1
  15. package/dist/components/Text.d.ts +2 -1
  16. package/dist/components/Text.d.ts.map +1 -1
  17. package/dist/index.d.ts +36 -5
  18. package/dist/index.esm.js +23 -8
  19. package/dist/index.esm.js.map +1 -1
  20. package/dist/index.js +23 -8
  21. package/dist/index.js.map +1 -1
  22. package/dist/styles.css +10 -0
  23. package/package.json +1 -1
  24. package/src/components/Alert.stories.tsx +20 -7
  25. package/src/components/Alert.tsx +7 -1
  26. package/src/components/Badge.stories.tsx +18 -7
  27. package/src/components/Badge.tsx +3 -1
  28. package/src/components/BottomNavigation.stories.tsx +57 -0
  29. package/src/components/BottomNavigation.tsx +10 -2
  30. package/src/components/Menu.tsx +10 -0
  31. package/src/components/Sidebar.stories.tsx +83 -0
  32. package/src/components/Sidebar.tsx +18 -3
  33. package/src/components/StatusBadge.tsx +7 -2
  34. package/src/components/Tabs.stories.tsx +126 -0
  35. package/src/components/Tabs.tsx +17 -0
  36. package/src/components/Text.stories.tsx +30 -6
  37. package/src/components/Text.tsx +5 -3
@@ -18,6 +18,12 @@ export interface Tab {
18
18
  badgeVariant?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
19
19
  /** Whether this individual tab can be closed (overrides global closeable) */
20
20
  closeable?: boolean;
21
+ /**
22
+ * Custom data attributes to spread on the tab trigger element.
23
+ * Useful for product tours (e.g., Driver.js) and E2E testing (Playwright, Cypress).
24
+ * @example { 'data-tour': 'tab-settings', 'data-testid': 'settings-tab' }
25
+ */
26
+ dataAttributes?: Record<string, string>;
21
27
  }
22
28
 
23
29
  export interface TabsProps {
@@ -274,6 +280,12 @@ export interface TabsTriggerProps {
274
280
  badgeVariant?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
275
281
  /** Additional class name */
276
282
  className?: string;
283
+ /**
284
+ * Custom data attributes to spread on the tab trigger element.
285
+ * Useful for product tours (e.g., Driver.js) and E2E testing (Playwright, Cypress).
286
+ * @example { 'data-tour': 'tab-settings', 'data-testid': 'settings-tab' }
287
+ */
288
+ dataAttributes?: Record<string, string>;
277
289
  }
278
290
 
279
291
  /**
@@ -287,6 +299,7 @@ export function TabsTrigger({
287
299
  badge,
288
300
  badgeVariant = 'info',
289
301
  className = '',
302
+ dataAttributes,
290
303
  }: TabsTriggerProps) {
291
304
  const { activeTab, setActiveTab, variant, orientation, size, registerTab, unregisterTab } = useTabsContext();
292
305
  const isActive = activeTab === value;
@@ -332,6 +345,8 @@ export function TabsTrigger({
332
345
  focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-500 focus-visible:ring-offset-1
333
346
  ${className}
334
347
  `}
348
+ data-testid={dataAttributes?.['data-testid'] || `tab-${value}`}
349
+ {...dataAttributes}
335
350
  >
336
351
  {icon && <span className={`flex-shrink-0 ${sizeClasses[size].icon}`}>{icon}</span>}
337
352
  <span>{children}</span>
@@ -660,6 +675,8 @@ export default function Tabs({
660
675
  focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-500 focus-visible:ring-offset-1
661
676
  group
662
677
  `}
678
+ data-testid={tab.dataAttributes?.['data-testid'] || `tab-${tab.id}`}
679
+ {...tab.dataAttributes}
663
680
  >
664
681
  {tab.icon && <span className={`flex-shrink-0 ${sizeClasses[size].icon}`}>{tab.icon}</span>}
665
682
  <span className={isTabCloseable ? 'mr-1' : ''}>{tab.label}</span>
@@ -16,7 +16,7 @@ Text component for consistent typography across the application.
16
16
  - **Semantic elements**: Render as p, span, div, h1-h6, or label
17
17
  - **Size scale**: xs, sm, base, lg, xl, 2xl
18
18
  - **Weight options**: normal, medium, semibold, bold
19
- - **Color variants**: primary, secondary, muted, accent, error, success, warning
19
+ - **Color variants**: primary, secondary, muted, accent, error, success, warning, caution
20
20
  - **Text alignment**: left, center, right
21
21
  - **Truncation**: Single line truncate or multi-line clamp (1-6 lines)
22
22
  - **Transform**: uppercase, lowercase, capitalize
@@ -61,7 +61,7 @@ import { Text } from 'notebook-ui';
61
61
  },
62
62
  color: {
63
63
  control: 'select',
64
- options: ['primary', 'secondary', 'muted', 'accent', 'error', 'success', 'warning'],
64
+ options: ['primary', 'secondary', 'muted', 'accent', 'error', 'success', 'warning', 'caution'],
65
65
  description: 'Text color',
66
66
  },
67
67
  align: {
@@ -120,7 +120,9 @@ export const Weights: Story = {
120
120
  };
121
121
 
122
122
  /**
123
- * All available color variants including the new `warning` color.
123
+ * All available color variants including `warning` and `caution` colors.
124
+ * - **warning**: Urgent attention needed (brighter amber)
125
+ * - **caution**: Informational, exploratory states like sandbox/demo mode (darker, subdued amber)
124
126
  */
125
127
  export const Colors: Story = {
126
128
  render: () => (
@@ -130,15 +132,16 @@ export const Colors: Story = {
130
132
  <Text color="muted">Muted - Subdued text</Text>
131
133
  <Text color="accent">Accent - Branded color</Text>
132
134
  <Text color="success">Success - Positive feedback</Text>
133
- <Text color="warning">Warning - Caution messages</Text>
135
+ <Text color="warning">Warning - Urgent attention</Text>
136
+ <Text color="caution">Caution - Informational, exploratory</Text>
134
137
  <Text color="error">Error - Error messages</Text>
135
138
  </Stack>
136
139
  ),
137
140
  };
138
141
 
139
142
  /**
140
- * The warning color is useful for displaying caution messages,
141
- * threshold alerts, or status indicators that need attention.
143
+ * The warning color is useful for urgent alerts, threshold warnings,
144
+ * or status indicators that need immediate attention.
142
145
  */
143
146
  export const WarningColor: Story = {
144
147
  render: () => (
@@ -156,6 +159,27 @@ export const WarningColor: Story = {
156
159
  ),
157
160
  };
158
161
 
162
+ /**
163
+ * The caution color is for informational states that need context but aren't alarming.
164
+ * Use for demo/sandbox modes, wash sale notices, or exploratory features.
165
+ * It's calmer than warning - inviting users to explore safely.
166
+ */
167
+ export const CautionColor: Story = {
168
+ render: () => (
169
+ <Stack spacing="md">
170
+ <Text color="caution" size="lg" weight="semibold">
171
+ Demo Mode: Changes will not be saved
172
+ </Text>
173
+ <Text color="caution">
174
+ This is a sandbox environment for testing
175
+ </Text>
176
+ <Text color="caution" size="sm">
177
+ Wash sale: Cost basis adjusted for tax purposes
178
+ </Text>
179
+ </Stack>
180
+ ),
181
+ };
182
+
159
183
  export const Alignment: Story = {
160
184
  render: () => (
161
185
  <Stack spacing="sm" style={{ width: '300px' }}>
@@ -23,7 +23,7 @@ export interface TextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'colo
23
23
  /** Weight variant */
24
24
  weight?: 'normal' | 'medium' | 'semibold' | 'bold';
25
25
  /** Color variant */
26
- color?: 'primary' | 'secondary' | 'muted' | 'accent' | 'error' | 'success' | 'warning';
26
+ color?: 'primary' | 'secondary' | 'muted' | 'accent' | 'error' | 'success' | 'warning' | 'caution';
27
27
  /** Text alignment */
28
28
  align?: 'left' | 'center' | 'right';
29
29
  /** Truncate text with ellipsis (single line) */
@@ -54,9 +54,10 @@ export interface TextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'colo
54
54
  * <Text size="lg" weight="semibold" color="primary">
55
55
  * Hello World
56
56
  * </Text>
57
- *
57
+ *
58
58
  * <Text color="warning">Warning message</Text>
59
- *
59
+ * <Text color="caution">Caution message (informational, not alarming)</Text>
60
+ *
60
61
  * // With ref
61
62
  * const textRef = useRef<HTMLParagraphElement>(null);
62
63
  * <Text ref={textRef}>Measurable text</Text>
@@ -130,6 +131,7 @@ export const Text = forwardRef<HTMLElement, TextProps>(({
130
131
  error: 'text-error-600',
131
132
  success: 'text-success-600',
132
133
  warning: 'text-warning-600',
134
+ caution: 'text-warning-700',
133
135
  };
134
136
 
135
137
  const alignClasses = {