@kumix/ui 0.4.0 → 0.4.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 +15 -15
- package/dist/components/agents/approval-card/index.d.ts +2 -0
- package/dist/components/agents/approval-card/index.d.ts.map +1 -1
- package/dist/components/agents/approval-card/index.js +2 -0
- package/dist/components/agents/approval-card/index.js.map +1 -1
- package/dist/components/agents/citations.d.ts +14 -2
- package/dist/components/agents/citations.d.ts.map +1 -1
- package/dist/components/agents/citations.js +11 -7
- package/dist/components/agents/citations.js.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
- package/dist/components/agents/loading-states/reasoning-text.js +3 -0
- package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
- package/dist/components/charts/bump-chart/context.js +1 -2
- package/dist/components/charts/bump-chart/plot.js +1 -2
- package/dist/components/charts/bump-chart/point.js +1 -1
- package/dist/components/charts/bump-chart/series.d.ts +1 -0
- package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
- package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/context.js +69 -0
- package/dist/components/charts/candlestick-chart/context.js.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
- package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/legend.js +56 -0
- package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
- package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart/plot.js +218 -0
- package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
- package/dist/components/charts/candlestick-chart.d.ts +18 -0
- package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
- package/dist/components/charts/candlestick-chart.js +34 -0
- package/dist/components/charts/candlestick-chart.js.map +1 -0
- package/dist/components/charts/composition-chart/context.js +1 -2
- package/dist/components/charts/composition-chart/plot.js +1 -1
- package/dist/components/charts/donut-chart/center.d.ts +16 -0
- package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/center.js +78 -0
- package/dist/components/charts/donut-chart/center.js.map +1 -0
- package/dist/components/charts/donut-chart/context.d.ts +68 -0
- package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/context.js +2 -0
- package/dist/components/charts/donut-chart/legend.d.ts +17 -0
- package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/legend.js +85 -0
- package/dist/components/charts/donut-chart/legend.js.map +1 -0
- package/dist/components/charts/donut-chart/plot.d.ts +10 -0
- package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
- package/dist/components/charts/donut-chart/plot.js +108 -0
- package/dist/components/charts/donut-chart/plot.js.map +1 -0
- package/dist/components/charts/donut-chart.d.ts +22 -0
- package/dist/components/charts/donut-chart.d.ts.map +1 -0
- package/dist/components/charts/donut-chart.js +37 -0
- package/dist/components/charts/donut-chart.js.map +1 -0
- package/dist/components/charts/funnel-chart.d.ts.map +1 -1
- package/dist/components/charts/funnel-chart.js +1 -2
- package/dist/components/charts/funnel-chart.js.map +1 -1
- package/dist/components/charts/heat-calendar/tooltip.js +1 -1
- package/dist/components/charts/liquidity-heatmap.js +1 -1
- package/dist/components/charts/order-book/depth-row.d.ts +8 -2
- package/dist/components/charts/order-book/depth-row.d.ts.map +1 -1
- package/dist/components/charts/order-book/depth-row.js +11 -3
- package/dist/components/charts/order-book/depth-row.js.map +1 -1
- package/dist/components/charts/order-book.d.ts +33 -1
- package/dist/components/charts/order-book.d.ts.map +1 -1
- package/dist/components/charts/order-book.js +92 -17
- package/dist/components/charts/order-book.js.map +1 -1
- package/dist/components/charts/price-target-fan/tooltip.js +1 -1
- package/dist/components/charts/returns-calendar/tooltip.js +1 -1
- package/dist/components/charts/status-bar/tooltip.js +1 -1
- package/dist/components/charts/treemap/tooltip.js +1 -1
- package/dist/components/charts/volume-profile/tooltip.js +1 -1
- package/dist/components/custom/confirm-dialog.d.ts +1 -0
- package/dist/components/custom/toast.d.ts +1 -0
- package/dist/components/motion/action-swap.d.ts.map +1 -1
- package/dist/components/motion/action-swap.js +3 -0
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/animated-sidebar.d.ts +1 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +1 -2
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
- package/dist/components/motion/availability-scheduler/day-row.js +2 -2
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.d.ts +1 -0
- package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
- package/dist/components/motion/bounce-sidebar.js +34 -42
- package/dist/components/motion/bounce-sidebar.js.map +1 -1
- package/dist/components/motion/button/stateful.d.ts.map +1 -1
- package/dist/components/motion/button/stateful.js +3 -0
- package/dist/components/motion/button/stateful.js.map +1 -1
- package/dist/components/motion/card.d.ts +44 -0
- package/dist/components/motion/card.d.ts.map +1 -0
- package/dist/components/motion/card.js +122 -0
- package/dist/components/motion/card.js.map +1 -0
- package/dist/components/motion/checkbox.d.ts +3 -1
- package/dist/components/motion/checkbox.d.ts.map +1 -1
- package/dist/components/motion/checkbox.js +18 -6
- package/dist/components/motion/checkbox.js.map +1 -1
- package/dist/components/motion/color-picker.d.ts +110 -0
- package/dist/components/motion/color-picker.d.ts.map +1 -0
- package/dist/components/motion/color-picker.js +1053 -0
- package/dist/components/motion/color-picker.js.map +1 -0
- package/dist/components/motion/color-selector.d.ts.map +1 -1
- package/dist/components/motion/color-selector.js +9 -2
- package/dist/components/motion/color-selector.js.map +1 -1
- package/dist/components/motion/combobox/content.d.ts +1 -0
- package/dist/components/motion/command-palette.js +2 -2
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/context-menu.d.ts +1 -0
- package/dist/components/motion/digit-swap.d.ts +9 -1
- package/dist/components/motion/digit-swap.d.ts.map +1 -1
- package/dist/components/motion/digit-swap.js +18 -7
- package/dist/components/motion/digit-swap.js.map +1 -1
- package/dist/components/motion/expandable-control.d.ts +1 -0
- package/dist/components/motion/knockout-wheel.d.ts.map +1 -1
- package/dist/components/motion/knockout-wheel.js +1 -2
- package/dist/components/motion/knockout-wheel.js.map +1 -1
- package/dist/components/motion/morphing-search-chips.d.ts +54 -0
- package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
- package/dist/components/motion/morphing-search-chips.js +599 -0
- package/dist/components/motion/morphing-search-chips.js.map +1 -0
- package/dist/components/motion/multi-select/content.d.ts +1 -0
- package/dist/components/motion/not-found/shared.d.ts +1 -0
- package/dist/components/motion/number-ticker.d.ts +6 -1
- package/dist/components/motion/number-ticker.d.ts.map +1 -1
- package/dist/components/motion/number-ticker.js +19 -9
- package/dist/components/motion/number-ticker.js.map +1 -1
- package/dist/components/motion/parallax.js.map +1 -1
- package/dist/components/motion/popover-morph.d.ts +1 -0
- package/dist/components/motion/popover-morph.js +3 -0
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.d.ts +1 -0
- package/dist/components/motion/prediction-market-card.js +2 -3
- package/dist/components/motion/prediction-market-card.js.map +1 -1
- package/dist/components/motion/radio.d.ts +3 -1
- package/dist/components/motion/radio.d.ts.map +1 -1
- package/dist/components/motion/radio.js +17 -5
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/scroll-progress.d.ts +1 -0
- package/dist/components/motion/shader-background.d.ts +1 -0
- package/dist/components/motion/sortable-list.d.ts +1 -0
- package/dist/components/motion/sortable-stack.js +1 -2
- package/dist/components/motion/tabs.d.ts +1 -0
- package/dist/components/motion/text-reveal.d.ts +1 -0
- package/dist/components/motion/tooltip/positioner.d.ts +8 -26
- package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
- package/dist/components/motion/tooltip/positioner.js +1 -2
- package/dist/components/motion/tooltip.d.ts +62 -20
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +1 -135
- package/dist/components/motion/wallet-card/account-avatar.js +1 -2
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/color-picker.d.ts +280 -0
- package/dist/components/reui/color-picker.d.ts.map +1 -0
- package/dist/components/reui/color-picker.js +2013 -0
- package/dist/components/reui/color-picker.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +43 -21
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +9 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +12 -8
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +52 -13
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +35 -41
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +168 -5
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +203 -69
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +39 -0
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +33 -1
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts +1 -0
- package/dist/components/reui/date-selector.js +1 -1
- package/dist/components/reui/emoji-picker.d.ts +367 -0
- package/dist/components/reui/emoji-picker.d.ts.map +1 -0
- package/dist/components/reui/emoji-picker.js +1768 -0
- package/dist/components/reui/emoji-picker.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/file-type.d.ts +496 -0
- package/dist/components/reui/file-type.d.ts.map +1 -0
- package/dist/components/reui/file-type.js +964 -0
- package/dist/components/reui/file-type.js.map +1 -0
- package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.d.ts +5 -1
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-chip.js +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/icon-tile.js +8 -7
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/kanban.d.ts.map +1 -1
- package/dist/components/reui/kanban.js +1 -1
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.d.ts +3 -3
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/reui/scrollspy.d.ts +1 -0
- package/dist/components/reui/time-picker.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +3 -3
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/direction.js +1 -2
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/message-scroller.d.ts.map +1 -1
- package/dist/components/ui/questionnaire.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/context-tTdLKYNf.js +99 -0
- package/dist/context-tTdLKYNf.js.map +1 -0
- package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-BXUh52bu.js} +2 -2
- package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-BXUh52bu.js.map} +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
- package/dist/hooks/use-hover-gesture.d.ts +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +1 -0
- package/dist/hooks/use-scroll-position.d.ts +1 -0
- package/dist/hooks/use-slider-input.d.ts +1 -0
- package/dist/hooks/use-viewport.d.ts +1 -0
- package/dist/lib/tick-sound.d.ts +1 -0
- package/dist/model-NSIg2p7a.d.ts +20 -0
- package/dist/model-NSIg2p7a.d.ts.map +1 -0
- package/dist/model-_mRyI6V9.d.ts +18 -0
- package/dist/model-_mRyI6V9.d.ts.map +1 -0
- package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
- package/dist/positioner-3r3cfkqT.js.map +1 -0
- package/dist/tooltip-Bam5KeYe.js +535 -0
- package/dist/tooltip-Bam5KeYe.js.map +1 -0
- package/dist/use-position-DOi1gVL0.d.ts +32 -0
- package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/components/motion/tooltip.js.map +0 -1
- package/dist/model-DfeFradZ.d.ts +0 -9
- package/dist/model-DfeFradZ.d.ts.map +0 -1
- package/dist/positioner-3mCqiebN.js.map +0 -1
|
@@ -0,0 +1,964 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "@kumix/utils";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
//#region src/components/reui/file-type.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The color of a format with no brand or family color of its own. A solid page
|
|
8
|
+
* in it read as a dark slab beside the colored ones, so it fills lighter, and
|
|
9
|
+
* its glyph turns dark gray, where white would fade on the pale page.
|
|
10
|
+
*/
|
|
11
|
+
const NEUTRAL = "text-zinc-500 [--file-type-fill:color-mix(in_oklab,currentColor_45%,white)] [--file-type-glyph:color-mix(in_oklab,currentColor_80%,black)]";
|
|
12
|
+
/** Yellow takes dark text, as the JavaScript logo does: white on it stays
|
|
13
|
+
* under 3:1 until the 700 step. */
|
|
14
|
+
const YELLOW = "text-yellow-500 [--file-type-foreground:var(--color-yellow-950)]";
|
|
15
|
+
/** The family colors, which a format without a brand color of its own takes. */
|
|
16
|
+
const CATEGORY_COLORS = {
|
|
17
|
+
archive: NEUTRAL,
|
|
18
|
+
audio: "text-pink-600",
|
|
19
|
+
code: "text-blue-600",
|
|
20
|
+
design: "text-purple-600",
|
|
21
|
+
document: "text-blue-600",
|
|
22
|
+
empty: NEUTRAL,
|
|
23
|
+
executable: NEUTRAL,
|
|
24
|
+
file: NEUTRAL,
|
|
25
|
+
folder: "text-violet-600",
|
|
26
|
+
font: NEUTRAL,
|
|
27
|
+
image: "text-violet-600",
|
|
28
|
+
presentation: "text-red-600",
|
|
29
|
+
spreadsheet: "text-green-600",
|
|
30
|
+
video: "text-blue-600"
|
|
31
|
+
};
|
|
32
|
+
const CATEGORY_NAMES = {
|
|
33
|
+
archive: "Archive",
|
|
34
|
+
audio: "Audio file",
|
|
35
|
+
code: "Code file",
|
|
36
|
+
design: "Design file",
|
|
37
|
+
document: "Document",
|
|
38
|
+
empty: "File",
|
|
39
|
+
executable: "Application",
|
|
40
|
+
file: "File",
|
|
41
|
+
folder: "Folder",
|
|
42
|
+
font: "Font file",
|
|
43
|
+
image: "Image",
|
|
44
|
+
presentation: "Presentation",
|
|
45
|
+
spreadsheet: "Spreadsheet",
|
|
46
|
+
video: "Video"
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Known extensions. A format takes its brand's color (Word blue, Excel green,
|
|
50
|
+
* the GitHub language colors for code), else its family's, and a format with
|
|
51
|
+
* neither (archives, plain text, data, fonts, installers) is neutral. Every
|
|
52
|
+
* color is the 600 step, so the set reads as one palette with white label
|
|
53
|
+
* text at 3:1 or better.
|
|
54
|
+
*/
|
|
55
|
+
const FILE_TYPE_EXTENSIONS = {
|
|
56
|
+
pdf: {
|
|
57
|
+
category: "document",
|
|
58
|
+
color: "text-orange-600"
|
|
59
|
+
},
|
|
60
|
+
doc: {
|
|
61
|
+
category: "document",
|
|
62
|
+
color: "text-blue-600"
|
|
63
|
+
},
|
|
64
|
+
docx: {
|
|
65
|
+
category: "document",
|
|
66
|
+
color: "text-blue-600"
|
|
67
|
+
},
|
|
68
|
+
odt: {
|
|
69
|
+
category: "document",
|
|
70
|
+
color: "text-blue-600"
|
|
71
|
+
},
|
|
72
|
+
rtf: {
|
|
73
|
+
category: "document",
|
|
74
|
+
color: "text-blue-600"
|
|
75
|
+
},
|
|
76
|
+
pages: {
|
|
77
|
+
category: "document",
|
|
78
|
+
color: "text-amber-600"
|
|
79
|
+
},
|
|
80
|
+
txt: {
|
|
81
|
+
category: "document",
|
|
82
|
+
color: NEUTRAL
|
|
83
|
+
},
|
|
84
|
+
md: {
|
|
85
|
+
category: "document",
|
|
86
|
+
color: NEUTRAL
|
|
87
|
+
},
|
|
88
|
+
log: {
|
|
89
|
+
category: "document",
|
|
90
|
+
color: NEUTRAL
|
|
91
|
+
},
|
|
92
|
+
xls: {
|
|
93
|
+
category: "spreadsheet",
|
|
94
|
+
color: "text-green-600"
|
|
95
|
+
},
|
|
96
|
+
xlsx: {
|
|
97
|
+
category: "spreadsheet",
|
|
98
|
+
color: "text-green-600"
|
|
99
|
+
},
|
|
100
|
+
xlsm: {
|
|
101
|
+
category: "spreadsheet",
|
|
102
|
+
color: "text-green-600"
|
|
103
|
+
},
|
|
104
|
+
ods: {
|
|
105
|
+
category: "spreadsheet",
|
|
106
|
+
color: "text-green-600"
|
|
107
|
+
},
|
|
108
|
+
csv: {
|
|
109
|
+
category: "spreadsheet",
|
|
110
|
+
color: "text-green-600"
|
|
111
|
+
},
|
|
112
|
+
tsv: {
|
|
113
|
+
category: "spreadsheet",
|
|
114
|
+
color: "text-green-600"
|
|
115
|
+
},
|
|
116
|
+
ppt: {
|
|
117
|
+
category: "presentation",
|
|
118
|
+
color: "text-red-600"
|
|
119
|
+
},
|
|
120
|
+
pptx: {
|
|
121
|
+
category: "presentation",
|
|
122
|
+
color: "text-red-600"
|
|
123
|
+
},
|
|
124
|
+
odp: {
|
|
125
|
+
category: "presentation",
|
|
126
|
+
color: "text-red-600"
|
|
127
|
+
},
|
|
128
|
+
key: {
|
|
129
|
+
category: "presentation",
|
|
130
|
+
color: "text-blue-600"
|
|
131
|
+
},
|
|
132
|
+
png: {
|
|
133
|
+
category: "image",
|
|
134
|
+
color: YELLOW
|
|
135
|
+
},
|
|
136
|
+
jpg: {
|
|
137
|
+
category: "image",
|
|
138
|
+
color: "text-violet-600"
|
|
139
|
+
},
|
|
140
|
+
jpeg: {
|
|
141
|
+
category: "image",
|
|
142
|
+
color: "text-violet-600"
|
|
143
|
+
},
|
|
144
|
+
gif: {
|
|
145
|
+
category: "image",
|
|
146
|
+
color: "text-violet-600"
|
|
147
|
+
},
|
|
148
|
+
webp: {
|
|
149
|
+
category: "image",
|
|
150
|
+
color: "text-violet-600"
|
|
151
|
+
},
|
|
152
|
+
avif: {
|
|
153
|
+
category: "image",
|
|
154
|
+
color: "text-violet-600"
|
|
155
|
+
},
|
|
156
|
+
heic: {
|
|
157
|
+
category: "image",
|
|
158
|
+
color: "text-violet-600"
|
|
159
|
+
},
|
|
160
|
+
bmp: {
|
|
161
|
+
category: "image",
|
|
162
|
+
color: "text-violet-600"
|
|
163
|
+
},
|
|
164
|
+
tif: {
|
|
165
|
+
category: "image",
|
|
166
|
+
color: "text-violet-600"
|
|
167
|
+
},
|
|
168
|
+
tiff: {
|
|
169
|
+
category: "image",
|
|
170
|
+
color: "text-violet-600"
|
|
171
|
+
},
|
|
172
|
+
ico: {
|
|
173
|
+
category: "image",
|
|
174
|
+
color: "text-violet-600"
|
|
175
|
+
},
|
|
176
|
+
raw: {
|
|
177
|
+
category: "image",
|
|
178
|
+
color: NEUTRAL
|
|
179
|
+
},
|
|
180
|
+
svg: {
|
|
181
|
+
category: "image",
|
|
182
|
+
color: YELLOW
|
|
183
|
+
},
|
|
184
|
+
mp4: {
|
|
185
|
+
category: "video",
|
|
186
|
+
color: "text-blue-600"
|
|
187
|
+
},
|
|
188
|
+
mov: {
|
|
189
|
+
category: "video",
|
|
190
|
+
color: "text-blue-600"
|
|
191
|
+
},
|
|
192
|
+
avi: {
|
|
193
|
+
category: "video",
|
|
194
|
+
color: "text-blue-600"
|
|
195
|
+
},
|
|
196
|
+
mkv: {
|
|
197
|
+
category: "video",
|
|
198
|
+
color: "text-blue-600"
|
|
199
|
+
},
|
|
200
|
+
webm: {
|
|
201
|
+
category: "video",
|
|
202
|
+
color: "text-blue-600"
|
|
203
|
+
},
|
|
204
|
+
mpeg: {
|
|
205
|
+
category: "video",
|
|
206
|
+
color: "text-blue-600"
|
|
207
|
+
},
|
|
208
|
+
mpg: {
|
|
209
|
+
category: "video",
|
|
210
|
+
color: "text-blue-600"
|
|
211
|
+
},
|
|
212
|
+
wmv: {
|
|
213
|
+
category: "video",
|
|
214
|
+
color: "text-blue-600"
|
|
215
|
+
},
|
|
216
|
+
mp3: {
|
|
217
|
+
category: "audio",
|
|
218
|
+
color: "text-pink-600"
|
|
219
|
+
},
|
|
220
|
+
wav: {
|
|
221
|
+
category: "audio",
|
|
222
|
+
color: "text-pink-600"
|
|
223
|
+
},
|
|
224
|
+
aac: {
|
|
225
|
+
category: "audio",
|
|
226
|
+
color: "text-pink-600"
|
|
227
|
+
},
|
|
228
|
+
flac: {
|
|
229
|
+
category: "audio",
|
|
230
|
+
color: "text-pink-600"
|
|
231
|
+
},
|
|
232
|
+
ogg: {
|
|
233
|
+
category: "audio",
|
|
234
|
+
color: "text-pink-600"
|
|
235
|
+
},
|
|
236
|
+
m4a: {
|
|
237
|
+
category: "audio",
|
|
238
|
+
color: "text-pink-600"
|
|
239
|
+
},
|
|
240
|
+
aiff: {
|
|
241
|
+
category: "audio",
|
|
242
|
+
color: "text-pink-600"
|
|
243
|
+
},
|
|
244
|
+
js: {
|
|
245
|
+
category: "code",
|
|
246
|
+
color: YELLOW
|
|
247
|
+
},
|
|
248
|
+
jsx: {
|
|
249
|
+
category: "code",
|
|
250
|
+
color: YELLOW
|
|
251
|
+
},
|
|
252
|
+
mjs: {
|
|
253
|
+
category: "code",
|
|
254
|
+
color: YELLOW
|
|
255
|
+
},
|
|
256
|
+
ts: {
|
|
257
|
+
category: "code",
|
|
258
|
+
color: "text-blue-600"
|
|
259
|
+
},
|
|
260
|
+
tsx: {
|
|
261
|
+
category: "code",
|
|
262
|
+
color: "text-blue-600"
|
|
263
|
+
},
|
|
264
|
+
html: {
|
|
265
|
+
category: "code",
|
|
266
|
+
color: "text-orange-600"
|
|
267
|
+
},
|
|
268
|
+
htm: {
|
|
269
|
+
category: "code",
|
|
270
|
+
color: "text-orange-600"
|
|
271
|
+
},
|
|
272
|
+
css: {
|
|
273
|
+
category: "code",
|
|
274
|
+
color: "text-purple-600"
|
|
275
|
+
},
|
|
276
|
+
scss: {
|
|
277
|
+
category: "code",
|
|
278
|
+
color: "text-pink-600"
|
|
279
|
+
},
|
|
280
|
+
json: {
|
|
281
|
+
category: "code",
|
|
282
|
+
color: NEUTRAL
|
|
283
|
+
},
|
|
284
|
+
xml: {
|
|
285
|
+
category: "code",
|
|
286
|
+
color: NEUTRAL
|
|
287
|
+
},
|
|
288
|
+
yaml: {
|
|
289
|
+
category: "code",
|
|
290
|
+
color: NEUTRAL
|
|
291
|
+
},
|
|
292
|
+
yml: {
|
|
293
|
+
category: "code",
|
|
294
|
+
color: NEUTRAL
|
|
295
|
+
},
|
|
296
|
+
sql: {
|
|
297
|
+
category: "code",
|
|
298
|
+
color: NEUTRAL
|
|
299
|
+
},
|
|
300
|
+
py: {
|
|
301
|
+
category: "code",
|
|
302
|
+
color: "text-blue-600"
|
|
303
|
+
},
|
|
304
|
+
java: {
|
|
305
|
+
category: "code",
|
|
306
|
+
color: "text-orange-600"
|
|
307
|
+
},
|
|
308
|
+
php: {
|
|
309
|
+
category: "code",
|
|
310
|
+
color: "text-indigo-600"
|
|
311
|
+
},
|
|
312
|
+
rb: {
|
|
313
|
+
category: "code",
|
|
314
|
+
color: "text-red-600"
|
|
315
|
+
},
|
|
316
|
+
go: {
|
|
317
|
+
category: "code",
|
|
318
|
+
color: "text-cyan-600"
|
|
319
|
+
},
|
|
320
|
+
rs: {
|
|
321
|
+
category: "code",
|
|
322
|
+
color: "text-orange-600"
|
|
323
|
+
},
|
|
324
|
+
c: {
|
|
325
|
+
category: "code",
|
|
326
|
+
color: NEUTRAL
|
|
327
|
+
},
|
|
328
|
+
cpp: {
|
|
329
|
+
category: "code",
|
|
330
|
+
color: "text-blue-600"
|
|
331
|
+
},
|
|
332
|
+
h: {
|
|
333
|
+
category: "code",
|
|
334
|
+
color: NEUTRAL
|
|
335
|
+
},
|
|
336
|
+
cs: {
|
|
337
|
+
category: "code",
|
|
338
|
+
color: "text-purple-600"
|
|
339
|
+
},
|
|
340
|
+
sh: {
|
|
341
|
+
category: "code",
|
|
342
|
+
color: "text-green-600"
|
|
343
|
+
},
|
|
344
|
+
rss: {
|
|
345
|
+
category: "code",
|
|
346
|
+
color: "text-orange-600"
|
|
347
|
+
},
|
|
348
|
+
zip: {
|
|
349
|
+
category: "archive",
|
|
350
|
+
color: NEUTRAL
|
|
351
|
+
},
|
|
352
|
+
rar: {
|
|
353
|
+
category: "archive",
|
|
354
|
+
color: NEUTRAL
|
|
355
|
+
},
|
|
356
|
+
"7z": {
|
|
357
|
+
category: "archive",
|
|
358
|
+
color: NEUTRAL
|
|
359
|
+
},
|
|
360
|
+
tar: {
|
|
361
|
+
category: "archive",
|
|
362
|
+
color: NEUTRAL
|
|
363
|
+
},
|
|
364
|
+
gz: {
|
|
365
|
+
category: "archive",
|
|
366
|
+
color: NEUTRAL
|
|
367
|
+
},
|
|
368
|
+
tgz: {
|
|
369
|
+
category: "archive",
|
|
370
|
+
color: NEUTRAL
|
|
371
|
+
},
|
|
372
|
+
bz2: {
|
|
373
|
+
category: "archive",
|
|
374
|
+
color: NEUTRAL
|
|
375
|
+
},
|
|
376
|
+
fig: {
|
|
377
|
+
category: "design",
|
|
378
|
+
color: "text-purple-600"
|
|
379
|
+
},
|
|
380
|
+
sketch: {
|
|
381
|
+
category: "design",
|
|
382
|
+
color: "text-amber-600"
|
|
383
|
+
},
|
|
384
|
+
psd: {
|
|
385
|
+
category: "design",
|
|
386
|
+
color: "text-sky-600"
|
|
387
|
+
},
|
|
388
|
+
ai: {
|
|
389
|
+
category: "design",
|
|
390
|
+
color: "text-orange-600"
|
|
391
|
+
},
|
|
392
|
+
eps: {
|
|
393
|
+
category: "design",
|
|
394
|
+
color: "text-purple-600"
|
|
395
|
+
},
|
|
396
|
+
indd: {
|
|
397
|
+
category: "design",
|
|
398
|
+
color: "text-pink-600"
|
|
399
|
+
},
|
|
400
|
+
aep: {
|
|
401
|
+
category: "design",
|
|
402
|
+
color: "text-violet-600"
|
|
403
|
+
},
|
|
404
|
+
xd: {
|
|
405
|
+
category: "design",
|
|
406
|
+
color: "text-fuchsia-600"
|
|
407
|
+
},
|
|
408
|
+
exe: {
|
|
409
|
+
category: "executable",
|
|
410
|
+
color: NEUTRAL
|
|
411
|
+
},
|
|
412
|
+
msi: {
|
|
413
|
+
category: "executable",
|
|
414
|
+
color: NEUTRAL
|
|
415
|
+
},
|
|
416
|
+
dmg: {
|
|
417
|
+
category: "executable",
|
|
418
|
+
color: NEUTRAL
|
|
419
|
+
},
|
|
420
|
+
apk: {
|
|
421
|
+
category: "executable",
|
|
422
|
+
color: "text-green-600"
|
|
423
|
+
},
|
|
424
|
+
deb: {
|
|
425
|
+
category: "executable",
|
|
426
|
+
color: "text-rose-600"
|
|
427
|
+
},
|
|
428
|
+
iso: {
|
|
429
|
+
category: "executable",
|
|
430
|
+
color: NEUTRAL
|
|
431
|
+
},
|
|
432
|
+
app: {
|
|
433
|
+
category: "executable",
|
|
434
|
+
color: NEUTRAL
|
|
435
|
+
},
|
|
436
|
+
ttf: {
|
|
437
|
+
category: "font",
|
|
438
|
+
color: NEUTRAL
|
|
439
|
+
},
|
|
440
|
+
otf: {
|
|
441
|
+
category: "font",
|
|
442
|
+
color: NEUTRAL
|
|
443
|
+
},
|
|
444
|
+
woff: {
|
|
445
|
+
category: "font",
|
|
446
|
+
color: NEUTRAL
|
|
447
|
+
},
|
|
448
|
+
woff2: {
|
|
449
|
+
category: "font",
|
|
450
|
+
color: NEUTRAL
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
/** The families that can be passed as a `type` on their own, glyph only. */
|
|
454
|
+
const FILE_TYPE_CATEGORIES = [
|
|
455
|
+
"archive",
|
|
456
|
+
"audio",
|
|
457
|
+
"code",
|
|
458
|
+
"design",
|
|
459
|
+
"document",
|
|
460
|
+
"empty",
|
|
461
|
+
"executable",
|
|
462
|
+
"folder",
|
|
463
|
+
"font",
|
|
464
|
+
"image",
|
|
465
|
+
"presentation",
|
|
466
|
+
"spreadsheet",
|
|
467
|
+
"video"
|
|
468
|
+
];
|
|
469
|
+
const FILE_TYPE_EXTENSION_NAMES = Object.keys(FILE_TYPE_EXTENSIONS);
|
|
470
|
+
const extensions = FILE_TYPE_EXTENSIONS;
|
|
471
|
+
/** `Object.hasOwn` would fail to typecheck in an app below the ES2022 lib. */
|
|
472
|
+
function has(record, key) {
|
|
473
|
+
return Object.hasOwn(record, key);
|
|
474
|
+
}
|
|
475
|
+
function isCategory(value) {
|
|
476
|
+
return FILE_TYPE_CATEGORIES.includes(value);
|
|
477
|
+
}
|
|
478
|
+
function resolveFileType(type) {
|
|
479
|
+
const key = (type ?? "").trim().toLowerCase().replace(/^\.+/, "");
|
|
480
|
+
if (!key || key === "empty") return {
|
|
481
|
+
type: "empty",
|
|
482
|
+
category: "empty",
|
|
483
|
+
color: CATEGORY_COLORS.empty
|
|
484
|
+
};
|
|
485
|
+
const extension = has(extensions, key) ? extensions[key] : null;
|
|
486
|
+
if (extension) return {
|
|
487
|
+
type: key,
|
|
488
|
+
category: extension.category,
|
|
489
|
+
label: key.toUpperCase(),
|
|
490
|
+
color: extension.color
|
|
491
|
+
};
|
|
492
|
+
if (isCategory(key)) return {
|
|
493
|
+
type: key,
|
|
494
|
+
category: key,
|
|
495
|
+
color: CATEGORY_COLORS[key]
|
|
496
|
+
};
|
|
497
|
+
return {
|
|
498
|
+
type: key,
|
|
499
|
+
category: "file",
|
|
500
|
+
label: key.toUpperCase(),
|
|
501
|
+
color: CATEGORY_COLORS.file
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* MIME types whose subtype does not name the extension. Anything else under
|
|
506
|
+
* image/, video/, audio/ or font/ falls back to its family.
|
|
507
|
+
*/
|
|
508
|
+
const MIME_TYPES = {
|
|
509
|
+
"application/pdf": "pdf",
|
|
510
|
+
"application/msword": "doc",
|
|
511
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
512
|
+
"application/vnd.oasis.opendocument.text": "odt",
|
|
513
|
+
"application/rtf": "rtf",
|
|
514
|
+
"application/vnd.ms-excel": "xls",
|
|
515
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
516
|
+
"application/vnd.oasis.opendocument.spreadsheet": "ods",
|
|
517
|
+
"application/vnd.ms-powerpoint": "ppt",
|
|
518
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
519
|
+
"application/vnd.oasis.opendocument.presentation": "odp",
|
|
520
|
+
"application/vnd.ms-excel.sheet.macroenabled.12": "xlsm",
|
|
521
|
+
"application/vnd.apple.keynote": "key",
|
|
522
|
+
"application/zip": "zip",
|
|
523
|
+
"application/x-zip-compressed": "zip",
|
|
524
|
+
"application/vnd.rar": "rar",
|
|
525
|
+
"application/x-rar-compressed": "rar",
|
|
526
|
+
"application/x-7z-compressed": "7z",
|
|
527
|
+
"application/x-tar": "tar",
|
|
528
|
+
"application/gzip": "gz",
|
|
529
|
+
"application/x-gzip": "gz",
|
|
530
|
+
"application/x-bzip2": "bz2",
|
|
531
|
+
"application/json": "json",
|
|
532
|
+
"application/xml": "xml",
|
|
533
|
+
"application/yaml": "yaml",
|
|
534
|
+
"application/x-yaml": "yaml",
|
|
535
|
+
"application/rss+xml": "rss",
|
|
536
|
+
"application/javascript": "js",
|
|
537
|
+
"application/x-httpd-php": "php",
|
|
538
|
+
"application/x-sh": "sh",
|
|
539
|
+
"application/x-msdownload": "exe",
|
|
540
|
+
"application/x-msi": "msi",
|
|
541
|
+
"application/vnd.android.package-archive": "apk",
|
|
542
|
+
"application/vnd.debian.binary-package": "deb",
|
|
543
|
+
"application/x-apple-diskimage": "dmg",
|
|
544
|
+
"application/x-iso9660-image": "iso",
|
|
545
|
+
"application/x-font-ttf": "ttf",
|
|
546
|
+
"application/font-woff": "woff",
|
|
547
|
+
"application/postscript": "eps",
|
|
548
|
+
"application/vnd.adobe.photoshop": "psd",
|
|
549
|
+
"image/vnd.adobe.photoshop": "psd",
|
|
550
|
+
"image/jpeg": "jpg",
|
|
551
|
+
"image/svg+xml": "svg",
|
|
552
|
+
"image/x-icon": "ico",
|
|
553
|
+
"image/vnd.microsoft.icon": "ico",
|
|
554
|
+
"video/quicktime": "mov",
|
|
555
|
+
"video/x-msvideo": "avi",
|
|
556
|
+
"video/x-matroska": "mkv",
|
|
557
|
+
"audio/mpeg": "mp3",
|
|
558
|
+
"audio/wav": "wav",
|
|
559
|
+
"audio/x-wav": "wav",
|
|
560
|
+
"audio/mp4": "m4a",
|
|
561
|
+
"audio/x-m4a": "m4a",
|
|
562
|
+
"audio/x-flac": "flac",
|
|
563
|
+
"audio/x-aiff": "aiff",
|
|
564
|
+
"video/x-ms-wmv": "wmv",
|
|
565
|
+
"text/plain": "txt",
|
|
566
|
+
"text/markdown": "md",
|
|
567
|
+
"text/x-markdown": "md",
|
|
568
|
+
"text/x-python": "py",
|
|
569
|
+
"text/x-c": "c",
|
|
570
|
+
"text/yaml": "yaml",
|
|
571
|
+
"text/csv": "csv",
|
|
572
|
+
"text/tab-separated-values": "tsv",
|
|
573
|
+
"text/html": "html",
|
|
574
|
+
"text/css": "css",
|
|
575
|
+
"text/javascript": "js",
|
|
576
|
+
"text/xml": "xml"
|
|
577
|
+
};
|
|
578
|
+
const MIME_FAMILIES = {
|
|
579
|
+
image: "image",
|
|
580
|
+
video: "video",
|
|
581
|
+
audio: "audio",
|
|
582
|
+
font: "font",
|
|
583
|
+
text: "txt"
|
|
584
|
+
};
|
|
585
|
+
const MIME_PATTERN = /^(application|audio|font|image|message|model|multipart|text|video)\/[\w.+-]+$/;
|
|
586
|
+
const URL_ORIGIN = /^[a-z][\w+.-]*:\/\/[^/]*/;
|
|
587
|
+
/**
|
|
588
|
+
* A value ending in an extension or a slash carries no query or hash. An
|
|
589
|
+
* extension has a letter, so "?v=1.2" is still a query.
|
|
590
|
+
*/
|
|
591
|
+
const NAME_END = /(\.\d*[a-z][a-z\d]*|[\\/])$/;
|
|
592
|
+
/**
|
|
593
|
+
* Resolves a file name, path, URL, bare extension or MIME type to a `type`.
|
|
594
|
+
* A path ending in a slash is a folder; a name without an extension is an
|
|
595
|
+
* empty file; an unknown extension is returned as is and renders neutral.
|
|
596
|
+
*/
|
|
597
|
+
function getFileType(value) {
|
|
598
|
+
let input = value.trim().toLowerCase();
|
|
599
|
+
if (URL_ORIGIN.test(input)) {
|
|
600
|
+
input = input.split(/[?#]/)[0].replace(URL_ORIGIN, "");
|
|
601
|
+
if (input === "/") return "empty";
|
|
602
|
+
} else if (!NAME_END.test(input)) input = input.split(/[?#]/)[0];
|
|
603
|
+
if (!input) return "empty";
|
|
604
|
+
if (input.endsWith("/") || input.endsWith("\\")) return "folder";
|
|
605
|
+
const mime = input.split(";")[0].trim();
|
|
606
|
+
if (MIME_PATTERN.test(mime)) {
|
|
607
|
+
if (has(MIME_TYPES, mime)) return MIME_TYPES[mime];
|
|
608
|
+
const [family, subtype] = mime.split("/");
|
|
609
|
+
const tail = subtype.slice(subtype.lastIndexOf(".") + 1);
|
|
610
|
+
if (subtype.includes(".") && has(extensions, tail)) return tail;
|
|
611
|
+
if (has(extensions, subtype) && (family === "application" || family === "text" || extensions[subtype].category === family)) return subtype;
|
|
612
|
+
return has(MIME_FAMILIES, family) ? MIME_FAMILIES[family] : "empty";
|
|
613
|
+
}
|
|
614
|
+
const name = input.split(/[\\/]/).pop() ?? "";
|
|
615
|
+
const dot = name.lastIndexOf(".");
|
|
616
|
+
if (dot <= 0) {
|
|
617
|
+
const bare = name.slice(dot + 1);
|
|
618
|
+
return resolveFileType(bare).category === "file" ? "empty" : bare;
|
|
619
|
+
}
|
|
620
|
+
return name.slice(dot + 1) || "empty";
|
|
621
|
+
}
|
|
622
|
+
/** The family of any `type`, for grouping or filtering a file list. */
|
|
623
|
+
function getFileTypeCategory(type) {
|
|
624
|
+
return resolveFileType(type).category;
|
|
625
|
+
}
|
|
626
|
+
const STROKE = { vectorEffect: "non-scaling-stroke" };
|
|
627
|
+
const GLYPHS = {
|
|
628
|
+
document: /* @__PURE__ */ jsx("path", {
|
|
629
|
+
...STROKE,
|
|
630
|
+
d: "M8 12h8M8 15h5.5M8 18h7"
|
|
631
|
+
}),
|
|
632
|
+
spreadsheet: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("rect", {
|
|
633
|
+
...STROKE,
|
|
634
|
+
x: "7.5",
|
|
635
|
+
y: "11",
|
|
636
|
+
width: "9",
|
|
637
|
+
height: "8",
|
|
638
|
+
rx: "1"
|
|
639
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
640
|
+
...STROKE,
|
|
641
|
+
d: "M7.5 14.5h9M11 11v8"
|
|
642
|
+
})] }),
|
|
643
|
+
presentation: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("rect", {
|
|
644
|
+
...STROKE,
|
|
645
|
+
x: "7",
|
|
646
|
+
y: "11",
|
|
647
|
+
width: "10",
|
|
648
|
+
height: "5.5",
|
|
649
|
+
rx: "1"
|
|
650
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
651
|
+
...STROKE,
|
|
652
|
+
d: "m9.5 19.5 2.5-3 2.5 3"
|
|
653
|
+
})] }),
|
|
654
|
+
image: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
655
|
+
...STROKE,
|
|
656
|
+
d: "m7 19.5 3.5-5.5 2.75 3.75 1.25-1.75 2.5 3.5Z"
|
|
657
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
658
|
+
...STROKE,
|
|
659
|
+
cx: "14.25",
|
|
660
|
+
cy: "12",
|
|
661
|
+
r: "1.25"
|
|
662
|
+
})] }),
|
|
663
|
+
video: /* @__PURE__ */ jsx("path", {
|
|
664
|
+
...STROKE,
|
|
665
|
+
d: "M9.5 11v8l7-4Z"
|
|
666
|
+
}),
|
|
667
|
+
audio: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
668
|
+
...STROKE,
|
|
669
|
+
d: "M12.5 18v-7l3 1.5"
|
|
670
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
671
|
+
...STROKE,
|
|
672
|
+
cx: "10.75",
|
|
673
|
+
cy: "18",
|
|
674
|
+
r: "1.75"
|
|
675
|
+
})] }),
|
|
676
|
+
code: /* @__PURE__ */ jsx("path", {
|
|
677
|
+
...STROKE,
|
|
678
|
+
d: "m10 12-3 3 3 3m4-6 3 3-3 3"
|
|
679
|
+
}),
|
|
680
|
+
archive: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("rect", {
|
|
681
|
+
...STROKE,
|
|
682
|
+
x: "7",
|
|
683
|
+
y: "11",
|
|
684
|
+
width: "10",
|
|
685
|
+
height: "3",
|
|
686
|
+
rx: "0.75"
|
|
687
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
688
|
+
...STROKE,
|
|
689
|
+
d: "M8 14v4.5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V14M11 16.5h2"
|
|
690
|
+
})] }),
|
|
691
|
+
design: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
692
|
+
...STROKE,
|
|
693
|
+
cx: "10.5",
|
|
694
|
+
cy: "13",
|
|
695
|
+
r: "2.5"
|
|
696
|
+
}), /* @__PURE__ */ jsx("rect", {
|
|
697
|
+
...STROKE,
|
|
698
|
+
x: "12",
|
|
699
|
+
y: "14.5",
|
|
700
|
+
width: "5",
|
|
701
|
+
height: "5",
|
|
702
|
+
rx: "1"
|
|
703
|
+
})] }),
|
|
704
|
+
executable: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ jsx("rect", {
|
|
706
|
+
...STROKE,
|
|
707
|
+
x: "7.5",
|
|
708
|
+
y: "10.75",
|
|
709
|
+
width: "3.5",
|
|
710
|
+
height: "3.5",
|
|
711
|
+
rx: "0.75"
|
|
712
|
+
}),
|
|
713
|
+
/* @__PURE__ */ jsx("rect", {
|
|
714
|
+
...STROKE,
|
|
715
|
+
x: "13",
|
|
716
|
+
y: "10.75",
|
|
717
|
+
width: "3.5",
|
|
718
|
+
height: "3.5",
|
|
719
|
+
rx: "0.75"
|
|
720
|
+
}),
|
|
721
|
+
/* @__PURE__ */ jsx("rect", {
|
|
722
|
+
...STROKE,
|
|
723
|
+
x: "7.5",
|
|
724
|
+
y: "16.25",
|
|
725
|
+
width: "3.5",
|
|
726
|
+
height: "3.5",
|
|
727
|
+
rx: "0.75"
|
|
728
|
+
}),
|
|
729
|
+
/* @__PURE__ */ jsx("rect", {
|
|
730
|
+
...STROKE,
|
|
731
|
+
x: "13",
|
|
732
|
+
y: "16.25",
|
|
733
|
+
width: "3.5",
|
|
734
|
+
height: "3.5",
|
|
735
|
+
rx: "0.75"
|
|
736
|
+
})
|
|
737
|
+
] }),
|
|
738
|
+
font: /* @__PURE__ */ jsx("path", {
|
|
739
|
+
...STROKE,
|
|
740
|
+
d: "M8.5 12.5V11h7v1.5M12 11v8m-1.5 0h3"
|
|
741
|
+
}),
|
|
742
|
+
folder: /* @__PURE__ */ jsx("path", {
|
|
743
|
+
...STROKE,
|
|
744
|
+
d: "M7 12a1 1 0 0 1 1-1h2.25a1 1 0 0 1 .8.4l.9 1.1H16a1 1 0 0 1 1 1V18a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1Z"
|
|
745
|
+
})
|
|
746
|
+
};
|
|
747
|
+
/** The page: 16 by 20 units with 2-unit corners and a rounded 6-unit fold. */
|
|
748
|
+
const PAGE_PATH = "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7.586a2 2 0 0 1 1.414.586l4.414 4.414A2 2 0 0 1 20 8.414V20a2 2 0 0 1-2 2Z";
|
|
749
|
+
const FOLD_PATH = "M14 2v5a1 1 0 0 0 1 1h5";
|
|
750
|
+
/** The folded corner, traced along the page edge so it never leaves the page. */
|
|
751
|
+
const FLAP_PATH = "M13.586 2a2 2 0 0 1 1.414.586l4.414 4.414A2 2 0 0 1 20 8.414V8h-5a1 1 0 0 1-1-1V2Z";
|
|
752
|
+
/**
|
|
753
|
+
* Lyra and Sera square every radius, so the page, its fold and the flap square
|
|
754
|
+
* too: both shapes render, and a per-style variable shows one. Outside a style
|
|
755
|
+
* the var() fallback keeps the rounded page.
|
|
756
|
+
*/
|
|
757
|
+
const PAGE_PATH_SQUARE = "M4 22V2h10l6 6v14Z";
|
|
758
|
+
const FOLD_PATH_SQUARE = "M14 2v6h6";
|
|
759
|
+
const FLAP_PATH_SQUARE = "M14 2l6 6h-6Z";
|
|
760
|
+
const ROUND = "[display:var(--file-type-round,inline)]";
|
|
761
|
+
const SQUARE = "[display:var(--file-type-square,none)]";
|
|
762
|
+
/**
|
|
763
|
+
* CSS variable architecture, all read from the root:
|
|
764
|
+
*
|
|
765
|
+
* --file-type-size box width and height, set by `size`
|
|
766
|
+
* --file-type-stroke line width; unset, 1px up to 40px, then proportional
|
|
767
|
+
* --file-type-border page outline in outline, light and mono; unset, 40%
|
|
768
|
+
* muted-foreground, 65% up to 20px
|
|
769
|
+
* --file-type-fill solid page; unset, the type color
|
|
770
|
+
* --file-type-glyph glyph, custom icon and label in solid; unset, the
|
|
771
|
+
* foreground
|
|
772
|
+
* --file-type-foreground label text, and the glyph in solid
|
|
773
|
+
* --file-type-radius label corners; unset, the style's own (below)
|
|
774
|
+
*
|
|
775
|
+
* The root is an inline-size container and everything inside is measured in
|
|
776
|
+
* `cqw` against it, so a plain Tailwind size class (`size-20`, `size-full`)
|
|
777
|
+
* resizes the label and stroke with the box, not just the box. The label band
|
|
778
|
+
* is the same shape on every type at every size (the Figma's 40px geometry in
|
|
779
|
+
* percent); its text is 24% of the width (9.6px at 40px), so the capitals
|
|
780
|
+
* fill half the band, and shrinks only when its characters would run past
|
|
781
|
+
* the band. `--file-type-chars` carries the length for that fit; 0.72em is a
|
|
782
|
+
* wide uppercase character, measured on WOFF2 and MPEG. Up to 20px the band
|
|
783
|
+
* grows, the text turns semibold at a third of the box (5.8px at the 18px
|
|
784
|
+
* mini), and the outline darkens,
|
|
785
|
+
* or a row icon reads as a smudge.
|
|
786
|
+
*
|
|
787
|
+
* Browsers draw text on a whole-pixel baseline, which left capitals up to
|
|
788
|
+
* half a pixel off center. The band's margin moves it onto that baseline
|
|
789
|
+
* instead (`round()` against the label's own `1cap`), so a consumer's `top-*`
|
|
790
|
+
* still places it; a browser without `round()` or `cap` keeps the plain
|
|
791
|
+
* position.
|
|
792
|
+
*
|
|
793
|
+
* The type color is the root's text color, so one `text-*` class recolors a
|
|
794
|
+
* type.
|
|
795
|
+
*/
|
|
796
|
+
const fileTypeVariants = cva([
|
|
797
|
+
"@container relative inline-block shrink-0 select-none align-middle leading-none",
|
|
798
|
+
"size-(--file-type-size)",
|
|
799
|
+
"[--file-type-foreground:white]"
|
|
800
|
+
], {
|
|
801
|
+
variants: { size: {
|
|
802
|
+
mini: "[--file-type-size:--spacing(4.5)]",
|
|
803
|
+
xs: "[--file-type-size:--spacing(6)]",
|
|
804
|
+
sm: "[--file-type-size:--spacing(8)]",
|
|
805
|
+
default: "[--file-type-size:--spacing(10)]",
|
|
806
|
+
lg: "[--file-type-size:--spacing(12)]",
|
|
807
|
+
xl: "[--file-type-size:--spacing(14)]"
|
|
808
|
+
} },
|
|
809
|
+
defaultVariants: { size: "default" }
|
|
810
|
+
});
|
|
811
|
+
/**
|
|
812
|
+
* Every type in `mono`: the theme's muted gray in place of its own color, with
|
|
813
|
+
* the label text in the page color so it reads in both themes.
|
|
814
|
+
*/
|
|
815
|
+
const MONO = "text-muted-foreground [--file-type-foreground:var(--background)]";
|
|
816
|
+
const PAGE_CLASS = {
|
|
817
|
+
outline: "fill-transparent stroke-(color:--file-type-outline)",
|
|
818
|
+
light: "fill-muted stroke-(color:--file-type-outline)",
|
|
819
|
+
solid: "fill-[var(--file-type-fill,currentColor)] stroke-[var(--file-type-fill,currentColor)]",
|
|
820
|
+
mono: "fill-transparent stroke-(color:--file-type-outline)"
|
|
821
|
+
};
|
|
822
|
+
const FOLD_CLASS = {
|
|
823
|
+
outline: "stroke-(color:--file-type-outline)",
|
|
824
|
+
light: "stroke-(color:--file-type-outline)",
|
|
825
|
+
solid: "stroke-white/45",
|
|
826
|
+
mono: "stroke-(color:--file-type-outline)"
|
|
827
|
+
};
|
|
828
|
+
/**
|
|
829
|
+
* Solid paints the glyph in the foreground and mono in its gray, already light
|
|
830
|
+
* on a dark page. The others use the type color, lifted toward white in dark
|
|
831
|
+
* mode: a 1px line in a 600 shade is near 3:1 on a near-black page, while the
|
|
832
|
+
* label keeps the shade its white text needs.
|
|
833
|
+
*/
|
|
834
|
+
const GLYPH_CLASS = {
|
|
835
|
+
outline: "dark:text-[color-mix(in_oklab,currentColor_70%,white)]",
|
|
836
|
+
light: "dark:text-[color-mix(in_oklab,currentColor_70%,white)]",
|
|
837
|
+
solid: "text-[color:var(--file-type-glyph,var(--file-type-foreground))]",
|
|
838
|
+
mono: ""
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* The label overhangs the page's left edge, so it is a band in front of the
|
|
842
|
+
* sheet. Solid has no band: the text sits on the filled page in the glyph's
|
|
843
|
+
* color, across the page's width (x 4 to 20). Every label up to 4 characters
|
|
844
|
+
* takes one size (20.5cqw, 8.2px at 40px), so a row of mixed types reads
|
|
845
|
+
* even; a longer one shrinks at 0.8em a character (0.9em in semibold up to
|
|
846
|
+
* 20px, where each label fits on its own). Measured, WMV runs 0.875em and
|
|
847
|
+
* WEBM 0.79em: at 20.5cqw WEBM spends most of the side padding, and 21cqw
|
|
848
|
+
* would put it on the page edge, so this is the ceiling.
|
|
849
|
+
* The band's radius is bespoke chrome in the ReUI Badge's proportions per
|
|
850
|
+
* style: 10cqw (4px at 40px) where the badge is `rounded-sm` on 20px, a pill
|
|
851
|
+
* in the round styles, square in lyra and sera. The pill pads 30% of its
|
|
852
|
+
* height a side (20% elsewhere) so the round ends clear the text, and the text
|
|
853
|
+
* fit reads the same padding. A label wider than the fit expects (WEBM: W and M
|
|
854
|
+
* run past 0.72em) spends that extra padding, centered, before it truncates,
|
|
855
|
+
* and never grows past the band's own 95% cap, so a smaller `px-*` from
|
|
856
|
+
* `labelClassName` still ends in a whole ellipsis. The no-style fallbacks
|
|
857
|
+
* live in the `var()`s, not in bare rungs: the registry flattens each ladder
|
|
858
|
+
* to one bare rung per style, and a second one would win or lose on class
|
|
859
|
+
* order. The capitals are trimmed to their own height (`text-box`), so they
|
|
860
|
+
* center in the band whatever the font's ascent; the padding keeps a
|
|
861
|
+
* descender from clipping.
|
|
862
|
+
*/
|
|
863
|
+
const LABEL_TEXT_CLASS = {
|
|
864
|
+
outline: "text-(color:--file-type-foreground)",
|
|
865
|
+
light: "text-(color:--file-type-foreground)",
|
|
866
|
+
solid: "max-w-[calc(200cqw/3)] text-[color:var(--file-type-glyph,var(--file-type-foreground))]",
|
|
867
|
+
mono: "text-(color:--file-type-foreground)"
|
|
868
|
+
};
|
|
869
|
+
const LABEL_CLASS = {
|
|
870
|
+
outline: "bg-current",
|
|
871
|
+
light: "bg-current",
|
|
872
|
+
solid: "left-1/6 w-2/3 px-[3cqw] text-[length:min(20.5cqw,calc(65.6cqw/(var(--file-type-chars)*0.8)))] @max-[21px]:px-0 @max-[21px]:text-[length:min(32.5cqw,5.8px,calc(66cqw/(var(--file-type-chars)*0.9)))]",
|
|
873
|
+
mono: "bg-current"
|
|
874
|
+
};
|
|
875
|
+
function FileType({ type, variant = "outline", size = "default", label, glyph, icon, labelClassName, className, ...props }) {
|
|
876
|
+
const resolved = resolveFileType(type);
|
|
877
|
+
const text = label !== void 0 ? label : resolved.label;
|
|
878
|
+
const hasText = text !== void 0 && text !== null && text !== "";
|
|
879
|
+
const typeName = resolved.label ? `${resolved.label} file` : CATEGORY_NAMES[resolved.category];
|
|
880
|
+
const name = typeof label === "string" && label && label.toUpperCase() !== resolved.label ? `${label}, ${typeName}` : typeName;
|
|
881
|
+
const hasIcon = icon !== void 0 && icon !== null && icon !== false;
|
|
882
|
+
const showLabel = hasText && !glyph && !hasIcon;
|
|
883
|
+
const glyphNode = showLabel || hasIcon ? null : GLYPHS[resolved.category];
|
|
884
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
885
|
+
role: "img",
|
|
886
|
+
"aria-label": name,
|
|
887
|
+
"data-slot": "file-type",
|
|
888
|
+
"data-type": resolved.type,
|
|
889
|
+
"data-category": resolved.category,
|
|
890
|
+
"data-variant": variant,
|
|
891
|
+
"data-size": size,
|
|
892
|
+
className: cn(fileTypeVariants({ size }), variant === "mono" ? MONO : resolved.color, className),
|
|
893
|
+
...props,
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
896
|
+
"data-slot": "file-type-icon",
|
|
897
|
+
viewBox: "0 0 24 24",
|
|
898
|
+
fill: "none",
|
|
899
|
+
stroke: "currentColor",
|
|
900
|
+
strokeLinecap: "round",
|
|
901
|
+
strokeLinejoin: "round",
|
|
902
|
+
"aria-hidden": "true",
|
|
903
|
+
focusable: "false",
|
|
904
|
+
className: cn("absolute inset-0 size-full overflow-visible @max-[21px]:[--file-type-outline:var(--file-type-border,color-mix(in_oklab,var(--muted-foreground)_65%,transparent))] [--file-type-outline:var(--file-type-border,color-mix(in_oklab,var(--muted-foreground)_40%,transparent))] [stroke-width:var(--file-type-stroke,max(1px,2.5cqw))]", "[--file-type-round:inline]", "[--file-type-square:none]"),
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsx("path", {
|
|
907
|
+
...STROKE,
|
|
908
|
+
d: PAGE_PATH,
|
|
909
|
+
className: cn(PAGE_CLASS[variant], ROUND)
|
|
910
|
+
}),
|
|
911
|
+
/* @__PURE__ */ jsx("path", {
|
|
912
|
+
...STROKE,
|
|
913
|
+
d: PAGE_PATH_SQUARE,
|
|
914
|
+
strokeLinejoin: "miter",
|
|
915
|
+
className: cn(PAGE_CLASS[variant], SQUARE)
|
|
916
|
+
}),
|
|
917
|
+
variant === "solid" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
|
|
918
|
+
d: FLAP_PATH,
|
|
919
|
+
className: cn("fill-white/30 stroke-none", ROUND)
|
|
920
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
921
|
+
d: FLAP_PATH_SQUARE,
|
|
922
|
+
className: cn("fill-white/30 stroke-none", SQUARE)
|
|
923
|
+
})] }) : null,
|
|
924
|
+
/* @__PURE__ */ jsx("path", {
|
|
925
|
+
...STROKE,
|
|
926
|
+
d: FOLD_PATH,
|
|
927
|
+
className: cn(FOLD_CLASS[variant], ROUND)
|
|
928
|
+
}),
|
|
929
|
+
/* @__PURE__ */ jsx("path", {
|
|
930
|
+
...STROKE,
|
|
931
|
+
d: FOLD_PATH_SQUARE,
|
|
932
|
+
strokeLinejoin: "miter",
|
|
933
|
+
className: cn(FOLD_CLASS[variant], SQUARE)
|
|
934
|
+
}),
|
|
935
|
+
glyphNode ? /* @__PURE__ */ jsx("g", {
|
|
936
|
+
"data-slot": "file-type-glyph",
|
|
937
|
+
stroke: "currentColor",
|
|
938
|
+
className: cn("origin-[12px_15px] @max-[21px]:scale-100 scale-75", GLYPH_CLASS[variant]),
|
|
939
|
+
children: glyphNode
|
|
940
|
+
}) : null
|
|
941
|
+
]
|
|
942
|
+
}),
|
|
943
|
+
hasIcon ? /* @__PURE__ */ jsx("span", {
|
|
944
|
+
"data-slot": "file-type-custom-icon",
|
|
945
|
+
"aria-hidden": "true",
|
|
946
|
+
className: cn("-translate-1/2 absolute top-[62.5%] left-1/2 flex @max-[21px]:size-[50cqw] size-[37.5cqw] items-center justify-center [&>svg]:size-full", GLYPH_CLASS[variant]),
|
|
947
|
+
children: icon
|
|
948
|
+
}) : null,
|
|
949
|
+
showLabel ? /* @__PURE__ */ jsx("span", {
|
|
950
|
+
"data-slot": "file-type-label",
|
|
951
|
+
style: { "--file-type-chars": typeof text === "string" ? text.length : 4 },
|
|
952
|
+
className: cn("absolute top-(--file-type-label-y) left-[5%] flex h-(--file-type-label-h) max-w-[95%] items-center justify-center overflow-hidden whitespace-nowrap rounded-(--file-type-radius,var(--file-type-label-radius,10cqw)) px-(--file-type-label-px,7cqw) font-medium", "text-[min(24cqw,calc((95cqw-2*var(--file-type-label-px,7cqw))/(var(--file-type-chars)*0.72)))] [--file-type-label-h:35%] [--file-type-label-y:45%]", "supports-[margin:round(1cap,1px)]:mt-[calc(round(nearest,calc(var(--file-type-label-y)+(var(--file-type-label-h)+1cap)/2),1px)-var(--file-type-label-y)-(var(--file-type-label-h)+1cap)/2)]", "@max-[21px]:px-[4cqw] @max-[21px]:font-semibold @max-[21px]:text-[min(32.5cqw,5.8px,calc(87cqw/(var(--file-type-chars)*0.88)))] @max-[21px]:[--file-type-label-h:45%] @max-[21px]:[--file-type-label-y:40%]", "[--file-type-label-radius:10cqw]", "[--file-type-label-px:7cqw]", LABEL_CLASS[variant], labelClassName),
|
|
953
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
954
|
+
className: cn("@max-[21px]:max-w-full max-w-[min(95cqw,calc(100%+2*max(0px,var(--file-type-label-px,7cqw)-7cqw)))] shrink-0 truncate py-[0.25em] [text-box:trim-both_cap_alphabetic]", LABEL_TEXT_CLASS[variant]),
|
|
955
|
+
children: text
|
|
956
|
+
})
|
|
957
|
+
}) : null
|
|
958
|
+
]
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
//#endregion
|
|
962
|
+
export { FILE_TYPE_CATEGORIES, FILE_TYPE_EXTENSION_NAMES, FileType, fileTypeVariants, getFileType, getFileTypeCategory };
|
|
963
|
+
|
|
964
|
+
//# sourceMappingURL=file-type.js.map
|