@refraction-ui/astro 0.18.1 → 0.20.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.
Files changed (78) hide show
  1. package/dist/action-list/action-list.styles.ts +33 -0
  2. package/dist/action-list/action-list.ts +31 -0
  3. package/dist/action-list/index.ts +16 -0
  4. package/dist/analytics-sink-app-insights/app-insights-sink.ts +1 -1
  5. package/dist/analytics-sink-posthog/client-sdk-sink.ts +1 -1
  6. package/dist/analytics-sink-posthog/replay.ts +1 -1
  7. package/dist/astro-action-list/ActionList.astro +12 -0
  8. package/dist/astro-action-list/ActionListItem.astro +62 -0
  9. package/dist/astro-action-list/index.ts +1 -0
  10. package/dist/astro-avatar/Avatar.astro +5 -4
  11. package/dist/astro-callout/Callout.astro +4 -1
  12. package/dist/astro-card/Card.astro +3 -2
  13. package/dist/astro-card/CardTitle.astro +6 -4
  14. package/dist/astro-data-table/DataTable.astro +7 -3
  15. package/dist/astro-funnel-chart/FunnelChart.astro +64 -0
  16. package/dist/astro-funnel-chart/index.ts +1 -0
  17. package/dist/astro-line-chart/LineChart.astro +82 -0
  18. package/dist/astro-line-chart/index.ts +1 -0
  19. package/dist/astro-native-select/NativeSelect.astro +26 -0
  20. package/dist/astro-native-select/index.ts +1 -0
  21. package/dist/astro-page-header/PageHeader.astro +46 -0
  22. package/dist/astro-page-header/index.ts +1 -0
  23. package/dist/astro-stat-grid/StatGrid.astro +23 -19
  24. package/dist/astro-table/Table.astro +21 -0
  25. package/dist/astro-table/TableCaption.astro +9 -0
  26. package/dist/astro-table/TableCell.astro +13 -0
  27. package/dist/astro-table/TableHead.astro +13 -0
  28. package/dist/astro-table/TableRow.astro +9 -0
  29. package/dist/astro-table/index.ts +1 -0
  30. package/dist/avatar/avatar.styles.ts +7 -2
  31. package/dist/avatar/avatar.ts +8 -3
  32. package/dist/avatar/index.ts +1 -0
  33. package/dist/badge/badge.styles.ts +6 -1
  34. package/dist/badge/badge.ts +24 -2
  35. package/dist/button/button.styles.ts +10 -4
  36. package/dist/button/button.ts +4 -1
  37. package/dist/callout/callout.ts +12 -3
  38. package/dist/card/card.styles.ts +10 -1
  39. package/dist/card/card.ts +14 -0
  40. package/dist/card/index.ts +3 -0
  41. package/dist/data-table/data-table.styles.ts +18 -0
  42. package/dist/data-table/data-table.ts +49 -7
  43. package/dist/data-table/index.ts +8 -0
  44. package/dist/diff-viewer/diff-viewer.styles.ts +3 -0
  45. package/dist/funnel-chart/funnel-chart.styles.ts +16 -0
  46. package/dist/funnel-chart/funnel-chart.ts +68 -0
  47. package/dist/funnel-chart/index.ts +10 -0
  48. package/dist/index.ts +6 -0
  49. package/dist/input/input.styles.ts +2 -2
  50. package/dist/line-chart/index.ts +20 -0
  51. package/dist/line-chart/line-chart.styles.ts +16 -0
  52. package/dist/line-chart/line-chart.ts +215 -0
  53. package/dist/logger/faro-engine.ts +2 -2
  54. package/dist/native-select/index.ts +6 -0
  55. package/dist/native-select/native-select.styles.ts +30 -0
  56. package/dist/native-select/native-select.ts +5 -0
  57. package/dist/page-header/index.ts +15 -0
  58. package/dist/page-header/page-header.styles.ts +21 -0
  59. package/dist/page-header/page-header.ts +27 -0
  60. package/dist/progress-display/progress-display.styles.ts +1 -1
  61. package/dist/select/index.ts +2 -0
  62. package/dist/select/select.styles.ts +9 -3
  63. package/dist/select/select.ts +11 -3
  64. package/dist/separator/index.ts +2 -0
  65. package/dist/separator/separator.styles.ts +17 -2
  66. package/dist/shared/cn.ts +6 -3
  67. package/dist/slide-viewer/slide-viewer.styles.ts +2 -0
  68. package/dist/stat-grid/index.ts +9 -0
  69. package/dist/stat-grid/stat-grid.styles.ts +73 -6
  70. package/dist/stat-grid/stat-grid.ts +25 -5
  71. package/dist/sticky-note/sticky-note.styles.ts +2 -0
  72. package/dist/table/index.ts +16 -0
  73. package/dist/table/table.styles.ts +72 -0
  74. package/dist/table/table.ts +24 -0
  75. package/dist/tabs/index.ts +1 -0
  76. package/dist/tabs/tabs.ts +29 -0
  77. package/dist/textarea/textarea.styles.ts +2 -2
  78. package/package.json +7 -1
@@ -14,6 +14,8 @@ export const stickyNoteVariants = cva({
14
14
  'min-w-[160px] min-h-[120px]',
15
15
  ].join(' '),
16
16
  variants: {
17
+ // Named paper colors are product semantics (physical sticky notes),
18
+ // not status tones — deliberately not routed through the theme tokens.
17
19
  color: {
18
20
  yellow: 'bg-yellow-100 text-yellow-900',
19
21
  pink: 'bg-pink-100 text-pink-900',
@@ -0,0 +1,16 @@
1
+ export {
2
+ createTable,
3
+ type TableDensity,
4
+ type TableAlign,
5
+ type TableHeadTone,
6
+ type TableAPI,
7
+ } from './table.js'
8
+
9
+ export {
10
+ tableContainerClass,
11
+ tableRootVariants,
12
+ tableCaptionClass,
13
+ tableRowClass,
14
+ tableHeadVariants,
15
+ tableCellVariants,
16
+ } from './table.styles.js'
@@ -0,0 +1,72 @@
1
+ import { cva } from '../shared/index.ts'
2
+
3
+ /** Scroll container: a wide table scrolls inside it instead of the page. */
4
+ export const tableContainerClass = 'relative w-full overflow-x-auto'
5
+
6
+ /** The `<table>`. `fixed` pins column widths to the header row. */
7
+ export const tableRootVariants = cva({
8
+ base: 'w-full caption-bottom border-collapse text-sm',
9
+ variants: {
10
+ fixed: {
11
+ true: 'table-fixed',
12
+ false: '',
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ fixed: 'false',
17
+ },
18
+ })
19
+
20
+ /** Caption under the table. */
21
+ export const tableCaptionClass = 'mt-2 text-xs text-muted-foreground'
22
+
23
+ /** Body rows: a hairline between rows, none after the last. */
24
+ export const tableRowClass = 'border-b border-border-subtle last:border-b-0'
25
+
26
+ const align = {
27
+ start: 'text-start',
28
+ center: 'text-center',
29
+ end: 'text-end',
30
+ }
31
+
32
+ /** Header cell: subtle surface, rule under it. */
33
+ export const tableHeadVariants = cva({
34
+ base: 'border-b border-border-subtle bg-surface-subtle align-middle',
35
+ variants: {
36
+ align,
37
+ tone: {
38
+ default: 'text-xs font-medium text-muted-foreground',
39
+ eyebrow: 'text-[11px] font-semibold uppercase tracking-wider text-muted-foreground',
40
+ },
41
+ density: {
42
+ compact: 'h-8 px-2',
43
+ default: 'h-9 px-3',
44
+ },
45
+ },
46
+ defaultVariants: {
47
+ align: 'start',
48
+ tone: 'default',
49
+ density: 'default',
50
+ },
51
+ })
52
+
53
+ /** Data cell. */
54
+ export const tableCellVariants = cva({
55
+ base: 'align-middle',
56
+ variants: {
57
+ align,
58
+ density: {
59
+ compact: 'px-2 py-1.5',
60
+ default: 'px-3 py-2.5',
61
+ },
62
+ numeric: {
63
+ true: 'tabular-nums whitespace-nowrap',
64
+ false: '',
65
+ },
66
+ },
67
+ defaultVariants: {
68
+ align: 'start',
69
+ density: 'default',
70
+ numeric: 'false',
71
+ },
72
+ })
@@ -0,0 +1,24 @@
1
+ /** Cell padding for every cell of a table. */
2
+ export type TableDensity = 'compact' | 'default'
3
+ /** Horizontal alignment of a header or data cell (logical, RTL-safe). */
4
+ export type TableAlign = 'start' | 'center' | 'end'
5
+ /** Look of header cells: `eyebrow` is small uppercase tracked text. */
6
+ export type TableHeadTone = 'default' | 'eyebrow'
7
+
8
+ export interface TableAPI {
9
+ /** Data attributes for styling hooks. */
10
+ dataAttributes: Record<string, string>
11
+ }
12
+
13
+ /** Framework-agnostic data attributes for the table root. */
14
+ export function createTable(
15
+ props: { density?: TableDensity; headTone?: TableHeadTone } = {},
16
+ ): TableAPI {
17
+ return {
18
+ dataAttributes: {
19
+ 'data-slot': 'table',
20
+ 'data-density': props.density ?? 'default',
21
+ 'data-head-tone': props.headTone ?? 'default',
22
+ },
23
+ }
24
+ }
@@ -1,5 +1,6 @@
1
1
  export {
2
2
  createTabs,
3
+ getNextTabIndex,
3
4
  type TabsProps,
4
5
  type TabsAPI,
5
6
  type TabsState,
package/dist/tabs/tabs.ts CHANGED
@@ -131,3 +131,32 @@ export function createTabs(props: TabsProps = {}): TabsAPI {
131
131
  idPrefix,
132
132
  }
133
133
  }
134
+
135
+ /**
136
+ * Roving-focus target for a key press inside a tab list (WAI-ARIA Tabs
137
+ * pattern). Given the index of the focused tab among the ENABLED tabs, returns
138
+ * the index to move to, or `null` when the key is not a navigation key for this
139
+ * orientation. Arrow keys wrap; Home/End jump to the ends.
140
+ */
141
+ export function getNextTabIndex(
142
+ current: number,
143
+ key: string,
144
+ count: number,
145
+ orientation: 'horizontal' | 'vertical' = 'horizontal',
146
+ ): number | null {
147
+ if (count === 0) return null
148
+ const prev = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp'
149
+ const next = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown'
150
+ switch (key) {
151
+ case next:
152
+ return current < 0 ? 0 : (current + 1) % count
153
+ case prev:
154
+ return current < 0 ? count - 1 : (current - 1 + count) % count
155
+ case 'Home':
156
+ return 0
157
+ case 'End':
158
+ return count - 1
159
+ default:
160
+ return null
161
+ }
162
+ }
@@ -1,11 +1,11 @@
1
1
  import { cva } from '../shared/index.ts'
2
2
 
3
3
  export const textareaVariants = cva({
4
- base: 'flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
4
+ base: 'flex w-full rounded-md border border-input bg-transparent px-3 py-2 shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
5
5
  variants: {
6
6
  size: {
7
7
  sm: 'min-h-[40px] text-xs',
8
- default: 'min-h-[60px]',
8
+ default: 'min-h-[60px] text-sm',
9
9
  lg: 'min-h-[80px] text-base',
10
10
  },
11
11
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refraction-ui/astro",
3
- "version": "0.18.1",
3
+ "version": "0.20.0",
4
4
  "description": "All Refraction UI Astro components in one package",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,6 +22,7 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@refraction-ui/astro-accordion": "workspace:*",
25
+ "@refraction-ui/astro-action-list": "workspace:*",
25
26
  "@refraction-ui/astro-ai": "workspace:*",
26
27
  "@refraction-ui/astro-analytics": "workspace:*",
27
28
  "@refraction-ui/astro-animated-text": "workspace:*",
@@ -71,6 +72,7 @@
71
72
  "@refraction-ui/astro-floating-reactions": "workspace:*",
72
73
  "@refraction-ui/astro-flow-editor": "workspace:*",
73
74
  "@refraction-ui/astro-footer": "workspace:*",
75
+ "@refraction-ui/astro-funnel-chart": "workspace:*",
74
76
  "@refraction-ui/astro-graph-view": "workspace:*",
75
77
  "@refraction-ui/astro-icon-system": "workspace:*",
76
78
  "@refraction-ui/astro-infinite-canvas": "workspace:*",
@@ -81,6 +83,7 @@
81
83
  "@refraction-ui/astro-kanban-board": "workspace:*",
82
84
  "@refraction-ui/astro-keyboard-shortcut": "workspace:*",
83
85
  "@refraction-ui/astro-language-selector": "workspace:*",
86
+ "@refraction-ui/astro-line-chart": "workspace:*",
84
87
  "@refraction-ui/astro-link-card": "workspace:*",
85
88
  "@refraction-ui/astro-live-captions": "workspace:*",
86
89
  "@refraction-ui/astro-live-cursors": "workspace:*",
@@ -93,9 +96,11 @@
93
96
  "@refraction-ui/astro-mastery-bar": "workspace:*",
94
97
  "@refraction-ui/astro-mini-map": "workspace:*",
95
98
  "@refraction-ui/astro-mobile-nav": "workspace:*",
99
+ "@refraction-ui/astro-native-select": "workspace:*",
96
100
  "@refraction-ui/astro-navbar": "workspace:*",
97
101
  "@refraction-ui/astro-numbered-steps": "workspace:*",
98
102
  "@refraction-ui/astro-otp-input": "workspace:*",
103
+ "@refraction-ui/astro-page-header": "workspace:*",
99
104
  "@refraction-ui/astro-pagination": "workspace:*",
100
105
  "@refraction-ui/astro-password-input": "workspace:*",
101
106
  "@refraction-ui/astro-payment": "workspace:*",
@@ -128,6 +133,7 @@
128
133
  "@refraction-ui/astro-steps": "workspace:*",
129
134
  "@refraction-ui/astro-sticky-note": "workspace:*",
130
135
  "@refraction-ui/astro-switch": "workspace:*",
136
+ "@refraction-ui/astro-table": "workspace:*",
131
137
  "@refraction-ui/astro-table-of-contents": "workspace:*",
132
138
  "@refraction-ui/astro-tabs": "workspace:*",
133
139
  "@refraction-ui/astro-terminal": "workspace:*",