@leonardaustin/ui 0.25.0 → 0.26.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/README.md +11 -0
- package/dist/components/app-shell/AppShell.d.ts +3 -3
- package/dist/components/app-shell/AppShell.js +82 -0
- package/dist/components/app-shell/AuthLayout.d.ts +3 -3
- package/dist/components/app-shell/AuthLayout.js +16 -0
- package/dist/components/app-shell/BackLink.d.ts +3 -3
- package/dist/components/app-shell/BackLink.js +19 -0
- package/dist/components/app-shell/BottomNav.d.ts +3 -2
- package/dist/components/app-shell/BottomNav.js +37 -0
- package/dist/components/app-shell/Breadcrumbs.d.ts +3 -2
- package/dist/components/app-shell/Breadcrumbs.js +46 -0
- package/dist/components/app-shell/CommandPalette.d.ts +3 -2
- package/dist/components/app-shell/CommandPalette.js +119 -0
- package/dist/components/app-shell/MobileDrawer.d.ts +3 -3
- package/dist/components/app-shell/MobileDrawer.js +128 -0
- package/dist/components/app-shell/Sidebar.d.ts +3 -3
- package/dist/components/app-shell/Sidebar.js +355 -0
- package/dist/components/app-shell/ThemeMenu.d.ts +3 -2
- package/dist/components/app-shell/ThemeMenu.js +273 -0
- package/dist/components/app-shell/TopBar.d.ts +3 -3
- package/dist/components/app-shell/TopBar.js +129 -0
- package/dist/components/app-shell/commandPaletteEvents.js +16 -0
- package/dist/components/app-shell/navigation.js +21 -0
- package/dist/components/app-shell/themeMenuEvents.js +7 -0
- package/dist/components/charts/AreaChart.d.ts +4 -3
- package/dist/components/charts/AreaChart.js +217 -0
- package/dist/components/charts/BarChart.d.ts +4 -3
- package/dist/components/charts/BarChart.js +91 -0
- package/dist/components/charts/DonutChart.d.ts +4 -3
- package/dist/components/charts/DonutChart.js +172 -0
- package/dist/components/charts/RadarChart.d.ts +4 -3
- package/dist/components/charts/RadarChart.js +142 -0
- package/dist/components/charts/RadialBarChart.d.ts +4 -3
- package/dist/components/charts/RadialBarChart.js +219 -0
- package/dist/components/charts/SparkLine.d.ts +4 -3
- package/dist/components/charts/SparkLine.js +39 -0
- package/dist/components/charts/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/StackedBarChart.js +249 -0
- package/dist/components/charts/VerticalBarChart.d.ts +4 -3
- package/dist/components/charts/VerticalBarChart.js +143 -0
- package/dist/components/charts/chartUtils.js +68 -0
- package/dist/components/tables/ColumnPicker.d.ts +3 -3
- package/dist/components/tables/ColumnPicker.js +59 -0
- package/dist/components/tables/Pagination.d.ts +3 -3
- package/dist/components/tables/Pagination.js +56 -0
- package/dist/components/tables/ResourceTable.d.ts +3 -3
- package/dist/components/tables/ResourceTable.js +88 -0
- package/dist/components/tables/Table.js +95 -0
- package/dist/components/tables/sortRows.js +11 -0
- package/dist/components/ui/Accordion.d.ts +2 -1
- package/dist/components/ui/Accordion.js +35 -0
- package/dist/components/ui/Alert.d.ts +3 -2
- package/dist/components/ui/Alert.js +51 -0
- package/dist/components/ui/AttachmentList.d.ts +5 -5
- package/dist/components/ui/AttachmentList.js +90 -0
- package/dist/components/ui/AudioPlayer.d.ts +5 -2
- package/dist/components/ui/AudioPlayer.js +447 -0
- package/dist/components/ui/AuthCard.d.ts +3 -3
- package/dist/components/ui/AuthCard.js +39 -0
- package/dist/components/ui/AuthorByline.d.ts +3 -3
- package/dist/components/ui/AuthorByline.js +23 -0
- package/dist/components/ui/Avatar.d.ts +3 -2
- package/dist/components/ui/Avatar.js +36 -0
- package/dist/components/ui/Badge.d.ts +3 -2
- package/dist/components/ui/Badge.js +47 -0
- package/dist/components/ui/Button.d.ts +3 -3
- package/dist/components/ui/Button.js +83 -0
- package/dist/components/ui/Calendar.d.ts +3 -3
- package/dist/components/ui/Calendar.js +344 -0
- package/dist/components/ui/CalendarGrid.d.ts +3 -2
- package/dist/components/ui/CalendarGrid.js +136 -0
- package/dist/components/ui/Card.d.ts +6 -5
- package/dist/components/ui/Card.js +53 -0
- package/dist/components/ui/CharacterCount.d.ts +3 -3
- package/dist/components/ui/CharacterCount.js +27 -0
- package/dist/components/ui/Checkbox.d.ts +10 -8
- package/dist/components/ui/Checkbox.js +52 -0
- package/dist/components/ui/CodeInput.d.ts +7 -4
- package/dist/components/ui/CodeInput.js +97 -0
- package/dist/components/ui/Combobox.d.ts +8 -6
- package/dist/components/ui/Combobox.js +213 -0
- package/dist/components/ui/CopyButton.d.ts +1 -1
- package/dist/components/ui/CopyButton.js +57 -0
- package/dist/components/ui/DangerZone.d.ts +3 -3
- package/dist/components/ui/DangerZone.js +23 -0
- package/dist/components/ui/DatePartsInput.d.ts +6 -4
- package/dist/components/ui/DatePartsInput.js +138 -0
- package/dist/components/ui/DatePicker.d.ts +9 -4
- package/dist/components/ui/DatePicker.js +84 -0
- package/dist/components/ui/DateRangePicker.d.ts +7 -4
- package/dist/components/ui/DateRangePicker.js +143 -0
- package/dist/components/ui/DateTimePicker.d.ts +7 -4
- package/dist/components/ui/DateTimePicker.js +267 -0
- package/dist/components/ui/DetailPanel.d.ts +3 -3
- package/dist/components/ui/DetailPanel.js +183 -0
- package/dist/components/ui/Dialog.d.ts +3 -3
- package/dist/components/ui/Dialog.js +411 -0
- package/dist/components/ui/DialogActions.d.ts +3 -3
- package/dist/components/ui/DialogActions.js +35 -0
- package/dist/components/ui/Disclosure.d.ts +3 -3
- package/dist/components/ui/Disclosure.js +45 -0
- package/dist/components/ui/DividerLabel.d.ts +3 -3
- package/dist/components/ui/DividerLabel.js +20 -0
- package/dist/components/ui/DropdownMenu.d.ts +3 -3
- package/dist/components/ui/DropdownMenu.js +229 -0
- package/dist/components/ui/EmptyState.d.ts +3 -3
- package/dist/components/ui/EmptyState.js +31 -0
- package/dist/components/ui/ErrorBoundary.js +46 -0
- package/dist/components/ui/FieldContext.js +8 -0
- package/dist/components/ui/Fieldset.d.ts +2 -2
- package/dist/components/ui/Fieldset.js +39 -0
- package/dist/components/ui/FilterButton.d.ts +4 -7
- package/dist/components/ui/FilterButton.js +17 -0
- package/dist/components/ui/FilterDropdown.d.ts +4 -4
- package/dist/components/ui/FilterDropdown.js +18 -0
- package/dist/components/ui/FormField.d.ts +4 -4
- package/dist/components/ui/FormField.js +68 -0
- package/dist/components/ui/Grid.d.ts +1 -1
- package/dist/components/ui/Grid.js +19 -0
- package/dist/components/ui/GridItem.d.ts +1 -1
- package/dist/components/ui/GridItem.js +16 -0
- package/dist/components/ui/Inline.d.ts +1 -1
- package/dist/components/ui/Inline.js +24 -0
- package/dist/components/ui/Kbd.d.ts +3 -2
- package/dist/components/ui/Kbd.js +13 -0
- package/dist/components/ui/ListItemLink.d.ts +3 -3
- package/dist/components/ui/ListItemLink.js +44 -0
- package/dist/components/ui/LoadingSpinner.d.ts +3 -2
- package/dist/components/ui/LoadingSpinner.js +19 -0
- package/dist/components/ui/MessageBubble.d.ts +2 -2
- package/dist/components/ui/MessageBubble.js +41 -0
- package/dist/components/ui/MetadataGrid.d.ts +5 -3
- package/dist/components/ui/MetadataGrid.js +76 -0
- package/dist/components/ui/MetricCard.d.ts +3 -3
- package/dist/components/ui/MetricCard.js +51 -0
- package/dist/components/ui/NavTabs.d.ts +2 -2
- package/dist/components/ui/NavTabs.js +29 -0
- package/dist/components/ui/OAuthButton.d.ts +2 -2
- package/dist/components/ui/OAuthButton.js +55 -0
- package/dist/components/ui/OverlineLabel.d.ts +3 -3
- package/dist/components/ui/OverlineLabel.js +13 -0
- package/dist/components/ui/PageHeader.d.ts +3 -3
- package/dist/components/ui/PageHeader.js +33 -0
- package/dist/components/ui/PageSection.d.ts +3 -3
- package/dist/components/ui/PageSection.js +31 -0
- package/dist/components/ui/PaginationBar.d.ts +3 -3
- package/dist/components/ui/PaginationBar.js +62 -0
- package/dist/components/ui/PasswordInput.d.ts +3 -3
- package/dist/components/ui/PasswordInput.js +62 -0
- package/dist/components/ui/PasswordRequirements.d.ts +3 -2
- package/dist/components/ui/PasswordRequirements.js +34 -0
- package/dist/components/ui/Popover.d.ts +3 -3
- package/dist/components/ui/Popover.js +53 -0
- package/dist/components/ui/ProfileHeader.d.ts +3 -3
- package/dist/components/ui/ProfileHeader.js +54 -0
- package/dist/components/ui/ProgressBar.d.ts +3 -3
- package/dist/components/ui/ProgressBar.js +42 -0
- package/dist/components/ui/ProseContent.d.ts +3 -3
- package/dist/components/ui/ProseContent.js +13 -0
- package/dist/components/ui/QrCode.d.ts +3 -3
- package/dist/components/ui/QrCode.js +47 -0
- package/dist/components/ui/Radio.d.ts +9 -6
- package/dist/components/ui/Radio.js +58 -0
- package/dist/components/ui/RadioPill.d.ts +7 -4
- package/dist/components/ui/RadioPill.js +53 -0
- package/dist/components/ui/ReorderList.d.ts +3 -3
- package/dist/components/ui/ReorderList.js +123 -0
- package/dist/components/ui/SearchInput.d.ts +7 -5
- package/dist/components/ui/SearchInput.js +49 -0
- package/dist/components/ui/SectionHeader.d.ts +3 -3
- package/dist/components/ui/SectionHeader.js +13 -0
- package/dist/components/ui/Select.d.ts +4 -4
- package/dist/components/ui/Select.js +117 -0
- package/dist/components/ui/SelectDropdown.d.ts +8 -3
- package/dist/components/ui/SelectDropdown.js +206 -0
- package/dist/components/ui/SettingRow.d.ts +5 -5
- package/dist/components/ui/SettingRow.js +25 -0
- package/dist/components/ui/SideSheet.d.ts +3 -3
- package/dist/components/ui/SideSheet.js +164 -0
- package/dist/components/ui/Skeleton.d.ts +3 -3
- package/dist/components/ui/Skeleton.js +18 -0
- package/dist/components/ui/Slider.d.ts +11 -6
- package/dist/components/ui/Slider.js +58 -0
- package/dist/components/ui/SplitPaneLayout.d.ts +5 -5
- package/dist/components/ui/SplitPaneLayout.js +22 -0
- package/dist/components/ui/Stack.d.ts +1 -1
- package/dist/components/ui/Stack.js +18 -0
- package/dist/components/ui/StatusDot.d.ts +3 -2
- package/dist/components/ui/StatusDot.js +24 -0
- package/dist/components/ui/StepProgress.d.ts +3 -2
- package/dist/components/ui/StepProgress.js +33 -0
- package/dist/components/ui/Tabs.d.ts +5 -5
- package/dist/components/ui/Tabs.js +63 -0
- package/dist/components/ui/TextInput.d.ts +4 -4
- package/dist/components/ui/TextInput.js +57 -0
- package/dist/components/ui/Textarea.d.ts +3 -3
- package/dist/components/ui/Textarea.js +59 -0
- package/dist/components/ui/ThemePreview.d.ts +3 -3
- package/dist/components/ui/ThemePreview.js +28 -0
- package/dist/components/ui/TimeInput.d.ts +7 -6
- package/dist/components/ui/TimeInput.js +22 -0
- package/dist/components/ui/Timeline.d.ts +3 -2
- package/dist/components/ui/Timeline.js +29 -0
- package/dist/components/ui/Toast.js +121 -0
- package/dist/components/ui/Toggle.d.ts +5 -3
- package/dist/components/ui/Toggle.js +34 -0
- package/dist/components/ui/Toolbar.d.ts +3 -3
- package/dist/components/ui/Toolbar.js +70 -0
- package/dist/components/ui/Tooltip.js +91 -0
- package/dist/components/ui/TranscriptLine.d.ts +3 -3
- package/dist/components/ui/TranscriptLine.js +40 -0
- package/dist/components/ui/UploadDropzone.d.ts +3 -5
- package/dist/components/ui/UploadDropzone.js +55 -0
- package/dist/components/ui/badgeColors.js +5 -0
- package/dist/components/ui/calendar/AgendaView.js +140 -0
- package/dist/components/ui/calendar/MonthView.js +321 -0
- package/dist/components/ui/calendar/TimeGrid.js +501 -0
- package/dist/components/ui/calendar/TimelineView.js +311 -0
- package/dist/components/ui/calendar/context.js +10 -0
- package/dist/components/ui/calendar/items.js +152 -0
- package/dist/components/ui/calendar/types.js +38 -0
- package/dist/components/ui/calendar/useGridInteraction.js +393 -0
- package/dist/components/ui/useFieldControl.d.ts +1 -1
- package/dist/components/ui/useFieldControl.js +17 -0
- package/dist/config/theme.js +219 -0
- package/dist/core.css +2933 -0
- package/dist/hooks/useAnchoredPopup.js +162 -0
- package/dist/hooks/useApplyTheme.js +16 -0
- package/dist/hooks/useControllableState.d.ts +14 -0
- package/dist/hooks/useControllableState.js +10 -0
- package/dist/hooks/useDismiss.js +24 -0
- package/dist/hooks/useFocusTrap.js +42 -0
- package/dist/hooks/useOverlayStack.js +23 -0
- package/dist/hooks/usePopover.js +47 -0
- package/dist/hooks/usePortalContainer.js +14 -0
- package/dist/hooks/useSettings.js +8 -0
- package/dist/hooks/useTheme.js +8 -0
- package/dist/hooks/useTypeahead.js +19 -0
- package/dist/index.js +133 -12884
- package/dist/lib/anchorPlacement.js +75 -0
- package/dist/lib/calendar.js +666 -0
- package/dist/lib/cn.js +228 -0
- package/dist/lib/codeInput.js +51 -0
- package/dist/lib/dateParts.js +31 -0
- package/dist/lib/dialogDrag.js +45 -0
- package/dist/lib/dialogResize.js +47 -0
- package/dist/lib/formatDate.js +29 -0
- package/dist/lib/formatMediaTime.js +7 -0
- package/dist/lib/layout.js +29 -0
- package/dist/lib/math.js +6 -0
- package/dist/lib/mergeRefs.d.ts +6 -0
- package/dist/lib/mergeRefs.js +17 -0
- package/dist/lib/months.js +30 -0
- package/dist/lib/overlayStack.js +47 -0
- package/dist/lib/panelResize.js +8 -0
- package/dist/lib/passwordRequirements.js +23 -0
- package/dist/lib/qrCode.js +570 -0
- package/dist/lib/tones.js +104 -0
- package/dist/lib/typeahead.js +31 -0
- package/dist/providers/ControlSizeContext.js +9 -0
- package/dist/providers/ControlSizeProvider.js +11 -0
- package/dist/providers/SettingsContext.js +53 -0
- package/dist/providers/SettingsProvider.js +249 -0
- package/dist/providers/ThemeContext.js +5 -0
- package/dist/providers/ThemeProvider.js +17 -0
- package/dist/providers/accentColors.js +75 -0
- package/dist/providers/themeClasses.d.ts +1 -0
- package/dist/providers/themeClasses.js +20 -0
- package/dist/styles.css +228 -176
- package/dist/themes/cyber-brutal-dark.css +53 -0
- package/dist/themes/cyber-brutal-light.css +75 -0
- package/dist/themes/glass-dark.css +217 -0
- package/dist/themes/glass-light.css +215 -0
- package/dist/themes/hashi.css +66 -0
- package/dist/themes/light-inverted.css +32 -0
- package/dist/themes/light.css +1 -0
- package/dist/themes/monokai.css +51 -0
- package/dist/themes/solarized.css +55 -0
- package/package.json +3 -1
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { createElement as t, useImperativeHandle as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/AudioPlayer.tsx
|
|
5
|
+
var s = {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
"aria-hidden": !0,
|
|
8
|
+
focusable: !1
|
|
9
|
+
}, ee = ({ forward: e, seconds: t, size: n }) => /* @__PURE__ */ o("svg", {
|
|
10
|
+
...s,
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
width: n,
|
|
13
|
+
height: n,
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeWidth: 1.8,
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
children: [/* @__PURE__ */ o("g", {
|
|
20
|
+
transform: e ? "translate(24 0) scale(-1 1)" : void 0,
|
|
21
|
+
children: [/* @__PURE__ */ a("path", { d: "M12 4.2A8.6 8.6 0 1 0 20.6 12.8" }), /* @__PURE__ */ a("path", { d: "M14.6 1.8 12 4.3l2.6 2.5" })]
|
|
22
|
+
}), /* @__PURE__ */ a("text", {
|
|
23
|
+
x: "12",
|
|
24
|
+
y: "16",
|
|
25
|
+
textAnchor: "middle",
|
|
26
|
+
fontSize: "8.6",
|
|
27
|
+
fontWeight: "600",
|
|
28
|
+
fill: "currentColor",
|
|
29
|
+
stroke: "none",
|
|
30
|
+
fontFamily: "inherit",
|
|
31
|
+
children: t
|
|
32
|
+
})]
|
|
33
|
+
}), c = {
|
|
34
|
+
pill: {
|
|
35
|
+
play: /* @__PURE__ */ a("svg", {
|
|
36
|
+
...s,
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
width: 20,
|
|
39
|
+
height: 20,
|
|
40
|
+
fill: "currentColor",
|
|
41
|
+
children: /* @__PURE__ */ a("path", { d: "M8 5v14l11-7z" })
|
|
42
|
+
}),
|
|
43
|
+
pause: /* @__PURE__ */ a("svg", {
|
|
44
|
+
...s,
|
|
45
|
+
viewBox: "0 0 24 24",
|
|
46
|
+
width: 20,
|
|
47
|
+
height: 20,
|
|
48
|
+
fill: "currentColor",
|
|
49
|
+
children: /* @__PURE__ */ a("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" })
|
|
50
|
+
}),
|
|
51
|
+
volume: /* @__PURE__ */ a("svg", {
|
|
52
|
+
...s,
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
width: 20,
|
|
55
|
+
height: 20,
|
|
56
|
+
fill: "currentColor",
|
|
57
|
+
children: /* @__PURE__ */ a("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z" })
|
|
58
|
+
}),
|
|
59
|
+
muted: /* @__PURE__ */ a("svg", {
|
|
60
|
+
...s,
|
|
61
|
+
viewBox: "0 0 24 24",
|
|
62
|
+
width: 20,
|
|
63
|
+
height: 20,
|
|
64
|
+
fill: "currentColor",
|
|
65
|
+
children: /* @__PURE__ */ a("path", { d: "M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z" })
|
|
66
|
+
}),
|
|
67
|
+
download: /* @__PURE__ */ a("svg", {
|
|
68
|
+
...s,
|
|
69
|
+
viewBox: "0 0 24 24",
|
|
70
|
+
width: 20,
|
|
71
|
+
height: 20,
|
|
72
|
+
fill: "currentColor",
|
|
73
|
+
children: /* @__PURE__ */ a("path", { d: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" })
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
glass: {
|
|
77
|
+
play: /* @__PURE__ */ a("svg", {
|
|
78
|
+
...s,
|
|
79
|
+
viewBox: "0 0 16 16",
|
|
80
|
+
width: 16,
|
|
81
|
+
height: 16,
|
|
82
|
+
fill: "currentColor",
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
strokeWidth: 1.2,
|
|
85
|
+
strokeLinejoin: "round",
|
|
86
|
+
children: /* @__PURE__ */ a("path", { d: "M2.6 1.4 13.2 8 2.6 14.6z" })
|
|
87
|
+
}),
|
|
88
|
+
pause: /* @__PURE__ */ o("svg", {
|
|
89
|
+
...s,
|
|
90
|
+
viewBox: "0 0 16 16",
|
|
91
|
+
width: 16,
|
|
92
|
+
height: 16,
|
|
93
|
+
fill: "currentColor",
|
|
94
|
+
children: [/* @__PURE__ */ a("rect", {
|
|
95
|
+
x: "2.6",
|
|
96
|
+
y: "1.6",
|
|
97
|
+
width: "3.6",
|
|
98
|
+
height: "12.8",
|
|
99
|
+
rx: "1"
|
|
100
|
+
}), /* @__PURE__ */ a("rect", {
|
|
101
|
+
x: "9.8",
|
|
102
|
+
y: "1.6",
|
|
103
|
+
width: "3.6",
|
|
104
|
+
height: "12.8",
|
|
105
|
+
rx: "1"
|
|
106
|
+
})]
|
|
107
|
+
}),
|
|
108
|
+
volume: /* @__PURE__ */ o("svg", {
|
|
109
|
+
...s,
|
|
110
|
+
viewBox: "0 0 22 16",
|
|
111
|
+
width: 26,
|
|
112
|
+
height: 18,
|
|
113
|
+
fill: "none",
|
|
114
|
+
stroke: "currentColor",
|
|
115
|
+
strokeWidth: 1.3,
|
|
116
|
+
strokeLinecap: "round",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ a("path", {
|
|
119
|
+
d: "M1.5 5.6h3L8.6 2v12L4.5 10.4h-3z",
|
|
120
|
+
fill: "currentColor",
|
|
121
|
+
stroke: "none"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ a("path", { d: "M11.4 5.6a3.4 3.4 0 0 1 0 4.8" }),
|
|
124
|
+
/* @__PURE__ */ a("path", { d: "M14.2 3.8a6.4 6.4 0 0 1 0 8.4" }),
|
|
125
|
+
/* @__PURE__ */ a("path", { d: "M17 2.2a9 9 0 0 1 0 11.6" })
|
|
126
|
+
]
|
|
127
|
+
}),
|
|
128
|
+
muted: /* @__PURE__ */ o("svg", {
|
|
129
|
+
...s,
|
|
130
|
+
viewBox: "0 0 22 16",
|
|
131
|
+
width: 26,
|
|
132
|
+
height: 18,
|
|
133
|
+
fill: "none",
|
|
134
|
+
stroke: "currentColor",
|
|
135
|
+
strokeWidth: 1.3,
|
|
136
|
+
strokeLinecap: "round",
|
|
137
|
+
children: [/* @__PURE__ */ a("path", {
|
|
138
|
+
d: "M1.5 5.6h3L8.6 2v12L4.5 10.4h-3z",
|
|
139
|
+
fill: "currentColor",
|
|
140
|
+
stroke: "none"
|
|
141
|
+
}), /* @__PURE__ */ a("path", { d: "m12 5.8 5 4.4M17 5.8l-5 4.4" })]
|
|
142
|
+
}),
|
|
143
|
+
download: /* @__PURE__ */ a("svg", {
|
|
144
|
+
...s,
|
|
145
|
+
viewBox: "0 0 16 16",
|
|
146
|
+
width: 16,
|
|
147
|
+
height: 16,
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
strokeWidth: 1.4,
|
|
151
|
+
strokeLinecap: "round",
|
|
152
|
+
strokeLinejoin: "round",
|
|
153
|
+
children: /* @__PURE__ */ a("path", { d: "M8 1.8v8M4.6 7l3.4 3.4L11.4 7M2.8 13.6h10.4" })
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
function l(e, t) {
|
|
158
|
+
let n = Number.isFinite(e) && e > 0 ? Math.floor(e) : 0, r = Math.floor(n / 3600), i = Math.floor(n % 3600 / 60), a = String(n % 60).padStart(2, "0");
|
|
159
|
+
return r > 0 ? `${r}:${String(i).padStart(2, "0")}:${a}` : `${t ? String(i).padStart(2, "0") : i}:${a}`;
|
|
160
|
+
}
|
|
161
|
+
function u(e) {
|
|
162
|
+
return /* @__PURE__ */ t(d, {
|
|
163
|
+
...e,
|
|
164
|
+
key: e.src
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function d({ src: t, title: s = "Audio recording", preload: u = "metadata", onTimeUpdate: d, onError: f, downloadHref: p, downloadName: m, variant: h = "plain", skipSeconds: g = !1, showMute: _ = !1, keyboardShortcuts: v = !0, playbackRates: y = [
|
|
168
|
+
1,
|
|
169
|
+
1.25,
|
|
170
|
+
1.5,
|
|
171
|
+
2
|
|
172
|
+
], className: te, appearance: b = "pill", controls: ne, ref: x, ...S }) {
|
|
173
|
+
let C = r(null), w = r(!1), T = r(null), [E, D] = i(!1), [re, O] = i(u !== "none"), [k, A] = i(), [j, M] = i(0), [N, P] = i(0), [F, I] = i(!1), [L, R] = i(1), [z, ie] = i(1), B = [...new Set([1, ...y.filter((e) => Number.isFinite(e) && e > 0)])].sort((e, t) => e - t), V = j <= 0 || !!k, H = j > 0 ? Math.min(100, Math.max(0, N / j * 100)) : 0, U = typeof g == "number" && Number.isFinite(g) && g > 0, W = U ? g : 10, G = b === "glass", K = c[b], q = [...new Set(ne ?? [
|
|
174
|
+
...U ? ["skipBack"] : [],
|
|
175
|
+
"play",
|
|
176
|
+
...U ? ["skipForward"] : [],
|
|
177
|
+
...b === "glass" ? [
|
|
178
|
+
"currentTime",
|
|
179
|
+
"progress",
|
|
180
|
+
"duration"
|
|
181
|
+
] : ["time", "progress"],
|
|
182
|
+
..._ ? ["mute"] : [],
|
|
183
|
+
"speed",
|
|
184
|
+
...p ? ["download"] : []
|
|
185
|
+
])];
|
|
186
|
+
async function J() {
|
|
187
|
+
let e = C.current;
|
|
188
|
+
if (!(!e || k || !t)) {
|
|
189
|
+
if (!e.paused) {
|
|
190
|
+
e.pause();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
await e.play();
|
|
195
|
+
} catch (t) {
|
|
196
|
+
C.current === e && !(t instanceof DOMException && t.name === "AbortError") && Y(t);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function Y(e) {
|
|
201
|
+
C.current?.pause();
|
|
202
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Unable to load or play audio.");
|
|
203
|
+
A(t.message), O(!1), D(!1), f?.(t);
|
|
204
|
+
}
|
|
205
|
+
function X(e) {
|
|
206
|
+
let t = C.current;
|
|
207
|
+
if (!t || !Number.isFinite(e) || k) return;
|
|
208
|
+
if (!w.current) {
|
|
209
|
+
let n = T.current === null && u === "none";
|
|
210
|
+
T.current = e, n && (t.preload = "metadata", t.load());
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
let n = t.duration;
|
|
214
|
+
if (!Number.isFinite(n) || n <= 0) return;
|
|
215
|
+
let r = Math.min(n, Math.max(0, e));
|
|
216
|
+
try {
|
|
217
|
+
t.currentTime = r, P(r), d?.(r);
|
|
218
|
+
} catch (e) {
|
|
219
|
+
Y(e);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
n(x, () => ({ seekTo: X }));
|
|
223
|
+
function Z() {
|
|
224
|
+
let e = C.current?.duration;
|
|
225
|
+
M(e && Number.isFinite(e) && e > 0 ? e : 0), O(!1);
|
|
226
|
+
}
|
|
227
|
+
function ae(e) {
|
|
228
|
+
if (v && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && (e.key === " " || e.key.toLowerCase() === "k")) {
|
|
229
|
+
e.preventDefault(), e.repeat || J();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
let t = {
|
|
233
|
+
ArrowRight: 5,
|
|
234
|
+
ArrowUp: 5,
|
|
235
|
+
ArrowLeft: -5,
|
|
236
|
+
ArrowDown: -5,
|
|
237
|
+
PageUp: 30,
|
|
238
|
+
PageDown: -30
|
|
239
|
+
}, n = e.key === "Home" ? 0 : e.key === "End" ? j : t[e.key] === void 0 ? void 0 : N + t[e.key];
|
|
240
|
+
n !== void 0 && (e.preventDefault(), X(n));
|
|
241
|
+
}
|
|
242
|
+
let Q = l(N, G), $ = l(j, G);
|
|
243
|
+
function oe(e) {
|
|
244
|
+
switch (e) {
|
|
245
|
+
case "skipBack":
|
|
246
|
+
case "skipForward": {
|
|
247
|
+
let t = e === "skipForward";
|
|
248
|
+
return /* @__PURE__ */ a("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: "ui-audio-icon-btn ui-audio-skip",
|
|
251
|
+
"aria-label": `${t ? "Forward" : "Back"} ${W} seconds`,
|
|
252
|
+
disabled: V,
|
|
253
|
+
onClick: () => X(N + (t ? W : -W)),
|
|
254
|
+
children: /* @__PURE__ */ a(ee, {
|
|
255
|
+
forward: t,
|
|
256
|
+
seconds: W,
|
|
257
|
+
size: b === "glass" ? 18 : 24
|
|
258
|
+
})
|
|
259
|
+
}, e);
|
|
260
|
+
}
|
|
261
|
+
case "play": return /* @__PURE__ */ a("button", {
|
|
262
|
+
type: "button",
|
|
263
|
+
className: "ui-audio-play",
|
|
264
|
+
"aria-label": E ? "Pause" : "Play",
|
|
265
|
+
disabled: !!k || !t,
|
|
266
|
+
onClick: J,
|
|
267
|
+
children: E ? K.pause : K.play
|
|
268
|
+
}, e);
|
|
269
|
+
case "time": return /* @__PURE__ */ o("span", {
|
|
270
|
+
className: "ui-audio-clock ui-audio-time",
|
|
271
|
+
children: [
|
|
272
|
+
Q,
|
|
273
|
+
" / ",
|
|
274
|
+
$
|
|
275
|
+
]
|
|
276
|
+
}, e);
|
|
277
|
+
case "currentTime": return /* @__PURE__ */ a("span", {
|
|
278
|
+
className: "ui-audio-clock",
|
|
279
|
+
children: Q
|
|
280
|
+
}, e);
|
|
281
|
+
case "duration": return /* @__PURE__ */ a("span", {
|
|
282
|
+
className: "ui-audio-clock",
|
|
283
|
+
children: $
|
|
284
|
+
}, e);
|
|
285
|
+
case "progress": return /* @__PURE__ */ a("div", {
|
|
286
|
+
className: "ui-audio-progress",
|
|
287
|
+
children: /* @__PURE__ */ o("div", {
|
|
288
|
+
className: "ui-audio-track",
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ a("input", {
|
|
291
|
+
type: "range",
|
|
292
|
+
className: "ui-audio-seek",
|
|
293
|
+
"aria-label": "Seek",
|
|
294
|
+
"aria-valuetext": `${Q} of ${$}`,
|
|
295
|
+
min: 0,
|
|
296
|
+
max: j,
|
|
297
|
+
step: "any",
|
|
298
|
+
value: N,
|
|
299
|
+
disabled: V,
|
|
300
|
+
onChange: (e) => X(Number(e.target.value)),
|
|
301
|
+
onKeyDown: ae
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ a("div", {
|
|
304
|
+
className: "ui-audio-fill",
|
|
305
|
+
"aria-hidden": "true",
|
|
306
|
+
style: { width: `${H}%` }
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ a("div", {
|
|
309
|
+
className: "ui-audio-thumb",
|
|
310
|
+
"aria-hidden": "true",
|
|
311
|
+
style: { left: `calc(${H}% - var(--ui-audio-thumb) / 2)` }
|
|
312
|
+
})
|
|
313
|
+
]
|
|
314
|
+
})
|
|
315
|
+
}, e);
|
|
316
|
+
case "speed": return /* @__PURE__ */ a("div", {
|
|
317
|
+
className: "ui-audio-select",
|
|
318
|
+
children: /* @__PURE__ */ a("select", {
|
|
319
|
+
"aria-label": "Playback speed",
|
|
320
|
+
value: String(z),
|
|
321
|
+
disabled: !!k,
|
|
322
|
+
onChange: (e) => {
|
|
323
|
+
let t = Number(e.target.value);
|
|
324
|
+
try {
|
|
325
|
+
C.current && (C.current.playbackRate = t), ie(t);
|
|
326
|
+
} catch {
|
|
327
|
+
e.target.value = String(z);
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
children: B.map((e) => /* @__PURE__ */ a("option", {
|
|
331
|
+
value: String(e),
|
|
332
|
+
children: `${e}x`
|
|
333
|
+
}, e))
|
|
334
|
+
})
|
|
335
|
+
}, e);
|
|
336
|
+
case "mute":
|
|
337
|
+
case "volume": {
|
|
338
|
+
let n = /* @__PURE__ */ a("button", {
|
|
339
|
+
type: "button",
|
|
340
|
+
className: "ui-audio-icon-btn",
|
|
341
|
+
"aria-label": F ? "Unmute" : "Mute",
|
|
342
|
+
"aria-pressed": F,
|
|
343
|
+
disabled: !!k || !t,
|
|
344
|
+
onClick: () => {
|
|
345
|
+
let e = C.current;
|
|
346
|
+
e && (e.muted = !e.muted, I(e.muted));
|
|
347
|
+
},
|
|
348
|
+
children: F ? K.muted : K.volume
|
|
349
|
+
}, "toggle");
|
|
350
|
+
return e === "mute" ? /* @__PURE__ */ a("span", {
|
|
351
|
+
className: "ui-audio-mute",
|
|
352
|
+
children: n
|
|
353
|
+
}, e) : /* @__PURE__ */ o("div", {
|
|
354
|
+
className: "ui-audio-volume",
|
|
355
|
+
children: [n, /* @__PURE__ */ a("div", {
|
|
356
|
+
className: "ui-audio-volume-popup",
|
|
357
|
+
children: /* @__PURE__ */ a("input", {
|
|
358
|
+
className: "ui-audio-volume-slider",
|
|
359
|
+
type: "range",
|
|
360
|
+
min: 0,
|
|
361
|
+
max: 1,
|
|
362
|
+
step: .05,
|
|
363
|
+
value: L,
|
|
364
|
+
"aria-label": "Volume",
|
|
365
|
+
"aria-valuetext": `${Math.round(L * 100)}%`,
|
|
366
|
+
disabled: !!k || !t,
|
|
367
|
+
onChange: (e) => {
|
|
368
|
+
let t = C.current;
|
|
369
|
+
if (!t) return;
|
|
370
|
+
let n = Number(e.target.value);
|
|
371
|
+
t.volume = n, n > 0 && t.muted && (t.muted = !1), R(t.volume), I(t.muted);
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
})]
|
|
375
|
+
}, e);
|
|
376
|
+
}
|
|
377
|
+
case "download": return p ? /* @__PURE__ */ a("a", {
|
|
378
|
+
href: p,
|
|
379
|
+
download: m ?? "",
|
|
380
|
+
className: "ui-audio-icon-btn",
|
|
381
|
+
"aria-label": "Download recording",
|
|
382
|
+
title: "Download recording",
|
|
383
|
+
children: K.download
|
|
384
|
+
}, e) : null;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return /* @__PURE__ */ o("div", {
|
|
388
|
+
...S,
|
|
389
|
+
role: "group",
|
|
390
|
+
"aria-label": s,
|
|
391
|
+
className: e("ui-audio", h === "card" && "ui-audio-card", b === "glass" ? "ui-audio-glass" : "ui-audio-pill", te),
|
|
392
|
+
children: [
|
|
393
|
+
h === "card" && /* @__PURE__ */ a("p", {
|
|
394
|
+
className: "ui-audio-title",
|
|
395
|
+
children: s
|
|
396
|
+
}),
|
|
397
|
+
/* @__PURE__ */ a("audio", {
|
|
398
|
+
ref: C,
|
|
399
|
+
src: t,
|
|
400
|
+
preload: u,
|
|
401
|
+
onLoadStart: () => {
|
|
402
|
+
O(!0), A(void 0);
|
|
403
|
+
},
|
|
404
|
+
onLoadedMetadata: () => {
|
|
405
|
+
w.current = !0, Z();
|
|
406
|
+
let e = T.current;
|
|
407
|
+
T.current = null, e !== null && X(e);
|
|
408
|
+
},
|
|
409
|
+
onDurationChange: Z,
|
|
410
|
+
onCanPlay: () => O(!1),
|
|
411
|
+
onSuspend: () => O(!1),
|
|
412
|
+
onWaiting: () => O(!0),
|
|
413
|
+
onPlaying: () => {
|
|
414
|
+
D(!0), O(!1);
|
|
415
|
+
},
|
|
416
|
+
onVolumeChange: (e) => {
|
|
417
|
+
I(e.currentTarget.muted), R(e.currentTarget.volume);
|
|
418
|
+
},
|
|
419
|
+
onPause: () => D(!1),
|
|
420
|
+
onEnded: () => D(!1),
|
|
421
|
+
onError: () => Y(/* @__PURE__ */ Error("Unable to load audio recording.")),
|
|
422
|
+
onTimeUpdate: (e) => {
|
|
423
|
+
let t = e.currentTarget.currentTime;
|
|
424
|
+
P(t), d?.(t);
|
|
425
|
+
}
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ a("div", {
|
|
428
|
+
className: "ui-audio-row",
|
|
429
|
+
children: q.map((e) => oe(e))
|
|
430
|
+
}),
|
|
431
|
+
k ? /* @__PURE__ */ a("p", {
|
|
432
|
+
role: "alert",
|
|
433
|
+
className: "ui-audio-error",
|
|
434
|
+
children: k
|
|
435
|
+
}) : re ? /* @__PURE__ */ o("p", {
|
|
436
|
+
role: "status",
|
|
437
|
+
className: "ui-audio-status",
|
|
438
|
+
children: [/* @__PURE__ */ a("span", {
|
|
439
|
+
className: "ui-audio-spinner",
|
|
440
|
+
"aria-hidden": "true"
|
|
441
|
+
}), "Loading audio…"]
|
|
442
|
+
}) : null
|
|
443
|
+
]
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
export { u as AudioPlayer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ElementType, ReactNode } from "react";
|
|
2
|
-
export interface AuthCardProps {
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType, ReactNode } from "react";
|
|
2
|
+
export interface AuthCardProps extends Omit<ComponentPropsWithRef<"div">, "title" | "children"> {
|
|
3
3
|
/** Heading shown at the top of the card. */
|
|
4
4
|
title: string;
|
|
5
5
|
/** Secondary line shown below the title. */
|
|
@@ -13,4 +13,4 @@ export interface AuthCardProps {
|
|
|
13
13
|
/** Additional utility classes for the outer wrapper. */
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function AuthCard({ title, subtitle, icon: Icon, children, footer, className, }: AuthCardProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function AuthCard({ title, subtitle, icon: Icon, children, footer, className, ref, ...rest }: AuthCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/AuthCard.tsx
|
|
4
|
+
function r({ title: r, subtitle: i, icon: a, children: o, footer: s, className: c, ref: l, ...u }) {
|
|
5
|
+
return /* @__PURE__ */ t("div", {
|
|
6
|
+
ref: l,
|
|
7
|
+
...u,
|
|
8
|
+
className: e("relative z-10 w-full max-w-sm", c),
|
|
9
|
+
children: /* @__PURE__ */ n("div", {
|
|
10
|
+
className: "bg-bg-secondary border-border rounded-lg border p-8 shadow-lg",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ n("div", {
|
|
13
|
+
className: "mb-6 flex flex-col items-center",
|
|
14
|
+
children: [
|
|
15
|
+
a && /* @__PURE__ */ t("div", {
|
|
16
|
+
className: "bg-accent-muted mb-3 flex h-12 w-12 items-center justify-center rounded-xl",
|
|
17
|
+
children: /* @__PURE__ */ t(a, { className: "text-accent h-6 w-6" })
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ t("h1", {
|
|
20
|
+
className: "text-text-primary text-lg font-semibold",
|
|
21
|
+
children: r
|
|
22
|
+
}),
|
|
23
|
+
i && /* @__PURE__ */ t("p", {
|
|
24
|
+
className: "text-text-secondary mt-1 text-xs",
|
|
25
|
+
children: i
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
o,
|
|
30
|
+
s && /* @__PURE__ */ t("p", {
|
|
31
|
+
className: "text-text-secondary mt-6 text-center text-xs",
|
|
32
|
+
children: s
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { r as AuthCard };
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
* />
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
import type { ReactNode } from "react";
|
|
32
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
33
33
|
export type AuthorBylineSize = "sm" | "md";
|
|
34
|
-
export interface AuthorBylineProps {
|
|
34
|
+
export interface AuthorBylineProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
35
35
|
/** Author display name. */
|
|
36
36
|
name: string;
|
|
37
37
|
/**
|
|
@@ -53,4 +53,4 @@ export interface AuthorBylineProps {
|
|
|
53
53
|
/** Additional utility classes for the root container. */
|
|
54
54
|
className?: string;
|
|
55
55
|
}
|
|
56
|
-
export declare function AuthorByline({ name, meta, nameAppend, size, className, }: AuthorBylineProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare function AuthorByline({ name, meta, nameAppend, size, className, ref, ...rest }: AuthorBylineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { Avatar as t } from "./Avatar.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/AuthorByline.tsx
|
|
5
|
+
function i({ name: i, meta: a, nameAppend: o, size: s = "sm", className: c, ref: l, ...u }) {
|
|
6
|
+
return /* @__PURE__ */ r("div", {
|
|
7
|
+
ref: l,
|
|
8
|
+
...u,
|
|
9
|
+
className: e("flex items-center gap-2", c),
|
|
10
|
+
children: [/* @__PURE__ */ n(t, {
|
|
11
|
+
name: i,
|
|
12
|
+
size: "sm"
|
|
13
|
+
}), /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ r("p", {
|
|
14
|
+
className: e("text-text-primary font-label font-medium", s === "md" ? "text-xs" : "text-2xs"),
|
|
15
|
+
children: [i, o]
|
|
16
|
+
}), a && /* @__PURE__ */ n("p", {
|
|
17
|
+
className: "text-text-tertiary font-label text-2xs",
|
|
18
|
+
children: a
|
|
19
|
+
})] })]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { i as AuthorByline };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
1
2
|
export type AvatarSize = "xs" | "sm" | "md" | "lg";
|
|
2
|
-
export interface AvatarProps {
|
|
3
|
+
export interface AvatarProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
3
4
|
/** Person's name; yields the initials, a stable background colour and the accessible label. */
|
|
4
5
|
name: string;
|
|
5
6
|
/** Image URL; when set, the photo replaces the initials. */
|
|
@@ -9,4 +10,4 @@ export interface AvatarProps {
|
|
|
9
10
|
/** Additional utility classes for the root element. */
|
|
10
11
|
className?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare function Avatar({ name, src, size, className }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function Avatar({ name, src, size, className, style, ref, ...rest }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/Avatar.tsx
|
|
4
|
+
var n = {
|
|
5
|
+
xs: "w-5 h-5 text-2xs",
|
|
6
|
+
sm: "w-7 h-7 text-2xs",
|
|
7
|
+
md: "w-10 h-10 text-xs",
|
|
8
|
+
lg: "w-16 h-16 text-lg"
|
|
9
|
+
};
|
|
10
|
+
function r(e) {
|
|
11
|
+
return e.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
let t = 0;
|
|
15
|
+
for (let n = 0; n < e.length; n++) t = e.charCodeAt(n) + ((t << 5) - t);
|
|
16
|
+
return `hsl(${Math.abs(t) % 360}, 50%, 40%)`;
|
|
17
|
+
}
|
|
18
|
+
function a({ name: a, src: o, size: s = "md", className: c, style: l, ref: u, ...d }) {
|
|
19
|
+
return /* @__PURE__ */ t("div", {
|
|
20
|
+
ref: u,
|
|
21
|
+
...d,
|
|
22
|
+
className: e("text-text-on-avatar flex shrink-0 items-center justify-center rounded-full font-semibold", n[s], c),
|
|
23
|
+
style: {
|
|
24
|
+
backgroundColor: o ? void 0 : i(a),
|
|
25
|
+
...l
|
|
26
|
+
},
|
|
27
|
+
"aria-label": a,
|
|
28
|
+
children: o ? /* @__PURE__ */ t("img", {
|
|
29
|
+
src: o,
|
|
30
|
+
alt: a,
|
|
31
|
+
className: "h-full w-full rounded-full object-cover"
|
|
32
|
+
}) : r(a)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { a as Avatar };
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* <Badge color="blue" selected={on} onClick={() => setOn(!on)}>Design</Badge>
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
import { type HTMLAttributes, type MouseEventHandler, type ReactNode } from "react";
|
|
14
|
+
import { type HTMLAttributes, type MouseEventHandler, type ReactNode, type Ref } from "react";
|
|
15
15
|
import type { BadgeColor } from "./badgeColors";
|
|
16
16
|
export type { BadgeColor } from "./badgeColors";
|
|
17
17
|
export type BadgeVariant = "soft" | "outline";
|
|
@@ -22,6 +22,7 @@ export type BadgeSize = "xs" | "sm" | "md";
|
|
|
22
22
|
* `onClick` is given, otherwise `<span>`.
|
|
23
23
|
*/
|
|
24
24
|
export interface BadgeProps extends Omit<HTMLAttributes<HTMLElement>, "color" | "onClick"> {
|
|
25
|
+
ref?: Ref<HTMLElement>;
|
|
25
26
|
/**
|
|
26
27
|
* Semantic colour. Defaults to `gray`, or to `accent` when `selected` is
|
|
27
28
|
* set. For a toggle (`selected` set) this is the colour shown while
|
|
@@ -57,4 +58,4 @@ export interface BadgeProps extends Omit<HTMLAttributes<HTMLElement>, "color" |
|
|
|
57
58
|
disabled?: boolean;
|
|
58
59
|
children?: ReactNode;
|
|
59
60
|
}
|
|
60
|
-
export declare
|
|
61
|
+
export declare function Badge(props: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { tones as t } from "../../lib/tones.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/Badge.tsx
|
|
6
|
+
var a = "font-label inline-flex items-center rounded-md font-medium", o = {
|
|
7
|
+
xs: "text-2xs gap-1 px-1.5",
|
|
8
|
+
sm: "text-2xs gap-1.5 px-2 py-0.5",
|
|
9
|
+
md: "text-xs gap-1.5 px-2.5 py-1"
|
|
10
|
+
}, s = {
|
|
11
|
+
xs: "h-1.5 w-1.5",
|
|
12
|
+
sm: "h-1.5 w-1.5",
|
|
13
|
+
md: "h-2 w-2"
|
|
14
|
+
}, c = "cursor-pointer transition-colors duration-[100ms] focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-40", l = {
|
|
15
|
+
soft: "hover:text-text-primary",
|
|
16
|
+
outline: "hover:border-border-strong hover:text-text-primary"
|
|
17
|
+
}, u = !1;
|
|
18
|
+
function d() {
|
|
19
|
+
let e = !1;
|
|
20
|
+
try {
|
|
21
|
+
e = process.env.NODE_ENV !== "production";
|
|
22
|
+
} catch {}
|
|
23
|
+
!e || u || (u = !0, console.warn("[Badge] `selected` needs `onClick`; without it the badge renders as a static span and `selected` is ignored."));
|
|
24
|
+
}
|
|
25
|
+
function f(u) {
|
|
26
|
+
let { color: f, variant: p = "soft", size: m = "sm", dot: h, selected: g, onClick: _, disabled: v, className: y, children: b, ref: x, ...S } = u;
|
|
27
|
+
g !== void 0 && !_ && d();
|
|
28
|
+
let C = _ ? g : void 0, w = C !== void 0, T = t[w && !C ? "gray" : f ?? (w ? "accent" : "gray")], E = e(a, o[m], p === "outline" ? e("border", T.outline) : T.soft, C && (p === "outline" ? T.fill : "ring"), _ && c, w && !C && l[p], v && !_ && "opacity-40", y), D = /* @__PURE__ */ i(n, { children: [h && /* @__PURE__ */ r("span", { className: e(s[m], "rounded-full", T.dot) }), b] });
|
|
29
|
+
return _ ? /* @__PURE__ */ r("button", {
|
|
30
|
+
...S,
|
|
31
|
+
ref: x,
|
|
32
|
+
type: "button",
|
|
33
|
+
disabled: v,
|
|
34
|
+
...w && { "aria-pressed": C },
|
|
35
|
+
onClick: _,
|
|
36
|
+
className: E,
|
|
37
|
+
children: D
|
|
38
|
+
}) : /* @__PURE__ */ r("span", {
|
|
39
|
+
...S,
|
|
40
|
+
...v && { "aria-disabled": !0 },
|
|
41
|
+
ref: x,
|
|
42
|
+
className: E,
|
|
43
|
+
children: D
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { f as Badge };
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
* `secondary` and `ghost` toggles use an accent tint and ring. An `icon`
|
|
39
39
|
* toggle uses a neutral hover surface and keeps caller-supplied icon colors.
|
|
40
40
|
*/
|
|
41
|
-
import { type
|
|
41
|
+
import { type ComponentPropsWithRef, type ElementType, type ReactNode } from "react";
|
|
42
42
|
import { type ControlSize } from "../../providers/ControlSizeContext";
|
|
43
43
|
/** Visual treatment for Button. */
|
|
44
44
|
export type ButtonVariant = "primary" | "secondary" | "danger" | "ghost" | "icon" | "link";
|
|
45
45
|
/** Visual size for Button. */
|
|
46
46
|
export type ButtonSize = "xs" | "sm" | "md" | "lg";
|
|
47
|
-
export interface ButtonProps extends
|
|
47
|
+
export interface ButtonProps extends ComponentPropsWithRef<"button"> {
|
|
48
48
|
/**
|
|
49
49
|
* Visual style. `primary` for the main action, `secondary` (default) for
|
|
50
50
|
* neutral actions, `danger` for destructive ones, `ghost` for low-emphasis
|
|
@@ -82,4 +82,4 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
82
82
|
hideLabel?: boolean | "sm" | "md" | "lg";
|
|
83
83
|
children?: ReactNode;
|
|
84
84
|
}
|
|
85
|
-
export declare
|
|
85
|
+
export declare function Button({ variant, size, controlSize, loading, pressed, icon: Icon, hideLabel, className, children, disabled, ref, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|