@nocoo/basalt 2.0.3 → 2.1.2
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 +134 -15
- package/ai/COMPATIBILITY.md +180 -0
- package/ai/INTEGRATION.md +1760 -0
- package/ai/RECIPES.md +161 -0
- package/ai/USAGE.md +99 -0
- package/ai/registry.json +38099 -0
- package/ai/sources.json +10 -0
- package/dist/assets/brand-mark.d.ts +1 -0
- package/dist/assets/brand-mark.js +7 -0
- package/dist/assets/brand-mark.js.map +1 -0
- package/dist/charts/area.d.ts +58 -5
- package/dist/charts/area.js +20 -12
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.d.ts +54 -5
- package/dist/charts/bar.js +16 -10
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.d.ts +18 -1
- package/dist/charts/bullet.js +6 -3
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/charts.d.ts +58 -5
- package/dist/charts/charts.js +13 -2
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.d.ts +7 -0
- package/dist/charts/config.js +5 -1
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +58 -5
- package/dist/charts/custom-chart.js +13 -2
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/donut.d.ts +18 -1
- package/dist/charts/donut.js +6 -3
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +40 -3
- package/dist/charts/frame.js +55 -28
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.d.ts +18 -1
- package/dist/charts/funnel.js +5 -1
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.d.ts +18 -1
- package/dist/charts/gauge.js +38 -20
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +54 -5
- package/dist/charts/grouped-bar.js +16 -10
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.d.ts +61 -0
- package/dist/charts/heatmap-calendar.js +287 -96
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.d.ts +99 -0
- package/dist/charts/heatmap-matrix.js +249 -0
- package/dist/charts/heatmap-matrix.js.map +1 -0
- package/dist/charts/line.d.ts +66 -5
- package/dist/charts/line.js +37 -30
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.d.ts +1 -0
- package/dist/charts/palette.js +7 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.d.ts +18 -1
- package/dist/charts/radar.js +26 -19
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sankey.d.ts +18 -1
- package/dist/charts/sankey.js +4 -1
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.d.ts +5 -7
- package/dist/charts/series.js.map +1 -1
- package/dist/charts/slot-bar.d.ts +38 -6
- package/dist/charts/slot-bar.js +5 -2
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.d.ts +35 -5
- package/dist/charts/sparkline.js +22 -18
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.d.ts +58 -5
- package/dist/charts/stacked-bar.js +19 -12
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.d.ts +51 -1
- package/dist/charts/stat-card.js +66 -39
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.d.ts +3 -0
- package/dist/charts/timeline.js +4 -3
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.d.ts +58 -5
- package/dist/charts/timeseries.js +13 -2
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.d.ts +57 -0
- package/dist/charts/tooltip.js +119 -2
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.d.ts +117 -2
- package/dist/components/accordion.js +20 -13
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +131 -13
- package/dist/components/alert-dialog.js +12 -9
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.js +18 -17
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.js +15 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.d.ts +4 -0
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +76 -3
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +15 -1
- package/dist/components/badge.js +13 -12
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.d.ts +88 -2
- package/dist/components/banner.js +41 -40
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js +14 -8
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.d.ts +10 -0
- package/dist/components/battery-meter.js +56 -0
- package/dist/components/battery-meter.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +27 -7
- package/dist/components/breadcrumbs.js +21 -20
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +48 -2
- package/dist/components/button.js +87 -36
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.d.ts +7 -0
- package/dist/components/chat-bubble.js +14 -13
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.d.ts +7 -3
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.d.ts +6 -1
- package/dist/components/chat-header.js +17 -16
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.d.ts +7 -2
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/checkbox.js +84 -53
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.d.ts +13 -2
- package/dist/components/clipboard-text.js +4 -4
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/collapsible.d.ts +58 -15
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/command-palette.d.ts +151 -61
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +1 -1
- package/dist/components/confirm-dialog.js +6 -4
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/context-menu.d.ts +210 -2
- package/dist/components/context-menu.js +7 -4
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.d.ts +40 -2
- package/dist/components/data-table.js +168 -120
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +53 -2
- package/dist/components/date-picker.js +387 -219
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.d.ts +7 -1
- package/dist/components/delete-resource.js +22 -18
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js +16 -15
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.d.ts +141 -12
- package/dist/components/dialog.js +42 -38
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.d.ts +1 -1
- package/dist/components/dock.js +39 -58
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +229 -15
- package/dist/components/dropdown-menu.js +9 -6
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.d.ts +33 -0
- package/dist/components/editable-nav-item.js +90 -0
- package/dist/components/editable-nav-item.js.map +1 -0
- package/dist/components/empty.d.ts +22 -2
- package/dist/components/empty.js +22 -13
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.js +31 -30
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +37 -0
- package/dist/components/file-dropzone.js +103 -0
- package/dist/components/file-dropzone.js.map +1 -0
- package/dist/components/filter-bar.d.ts +34 -0
- package/dist/components/filter-bar.js +52 -0
- package/dist/components/filter-bar.js.map +1 -0
- package/dist/components/flow.js +19 -18
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.d.ts +3 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.d.ts +111 -1
- package/dist/components/hover-card.js +9 -6
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.d.ts +34 -0
- package/dist/components/icon-picker.js +77 -0
- package/dist/components/icon-picker.js.map +1 -0
- package/dist/components/inline-editable.d.ts +46 -0
- package/dist/components/inline-editable.js +124 -0
- package/dist/components/inline-editable.js.map +1 -0
- package/dist/components/input-area.js +3 -3
- package/dist/components/input-group.js +7 -7
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +18 -17
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.d.ts +10 -2
- package/dist/components/layer-card.js +71 -68
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/loader.d.ts +10 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu-bar.d.ts +174 -6
- package/dist/components/menu-bar.js +33 -29
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.d.ts +27 -2
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.d.ts +64 -0
- package/dist/components/multi-select.js +218 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +88 -5
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js +6 -5
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.js +23 -21
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +7 -7
- package/dist/components/popover.d.ts +136 -16
- package/dist/components/popover.js +32 -28
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +38 -37
- package/dist/components/radio.js.map +1 -1
- package/dist/components/resource-list.d.ts +26 -1
- package/dist/components/resource-list.js +28 -15
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.d.ts +27 -0
- package/dist/components/responsive-master-detail.js +85 -0
- package/dist/components/responsive-master-detail.js.map +1 -0
- package/dist/components/section-rule.js +23 -22
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/select.d.ts +27 -3
- package/dist/components/select.js +11 -11
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +115 -11
- package/dist/components/sheet.js +37 -30
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts +109 -17
- package/dist/components/sidebar.js +112 -111
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +22 -2
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.d.ts +61 -1
- package/dist/components/slider.js +31 -15
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js +16 -15
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js +78 -47
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js +18 -17
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js +20 -19
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.d.ts +9 -3
- package/dist/components/table.js +19 -18
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +29 -22
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.d.ts +58 -0
- package/dist/components/tag-badge.js +72 -0
- package/dist/components/tag-badge.js.map +1 -0
- package/dist/components/tag-color-picker.d.ts +20 -0
- package/dist/components/tag-color-picker.js +42 -0
- package/dist/components/tag-color-picker.js.map +1 -0
- package/dist/components/text.js +17 -16
- package/dist/components/text.js.map +1 -1
- package/dist/components/toast.d.ts +173 -3
- package/dist/components/toast.js +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +88 -2
- package/dist/components/toggle-group.js +32 -31
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.d.ts +35 -2
- package/dist/components/toggle.js +12 -11
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +144 -6
- package/dist/components/tooltip.js +9 -6
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js +193 -132
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.d.ts +51 -0
- package/dist/components/upload-queue.js +116 -0
- package/dist/components/upload-queue.js.map +1 -0
- package/dist/providers/accent.d.ts +46 -2
- package/dist/providers/accent.js +358 -172
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/link.d.ts +14 -4
- package/dist/providers/link.js.map +1 -1
- package/dist/providers/theme.d.ts +38 -2
- package/dist/providers/theme.js +160 -27
- package/dist/providers/theme.js.map +1 -1
- package/dist/styles/base.css +83 -0
- package/dist/styles/standalone.css +699 -120
- package/dist/styles/tailwind.css +21 -7
- package/dist/styles/tokens.css +145 -91
- package/dist/utils/control-surface.d.ts +2 -1
- package/dist/utils/control-surface.js +4 -4
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/selection-indicator.js +2 -2
- package/dist/utils/selection-indicator.js.map +1 -1
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":[],"sources":["../../src/components/autocomplete.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type AutocompleteItem = TypeaheadItem;\n\nexport type AutocompleteProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Suggestions shown as the query matches. Values outside the list are allowed.\n\t */\n\titems: AutocompleteItem[];\n\t/**\n\t * The controlled value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the value changes, including freeform text.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Search…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Autocomplete({\n\titems,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n\tplaceholder = \"Search…\",\n\tdisabled,\n\tloading,\n\tsize,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\t...rest\n}: AutocompleteProps) {\n\treturn (\n\t\t<TypeaheadField\n\t\t\titems={items}\n\t\t\tvalue={value}\n\t\t\tdefaultValue={defaultValue}\n\t\t\tonValueChange={onValueChange}\n\t\t\tname={name}\n\t\t\tplaceholder={placeholder}\n\t\t\tdisabled={disabled}\n\t\t\tloading={loading}\n\t\t\tsize={size}\n\t\t\tclassName={className}\n\t\t\tid={id}\n\t\t\tallowFreeform\n\t\t\taria-label={ariaLabel}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\taria-invalid={ariaInvalid}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":[],"sources":["../../src/components/autocomplete.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type AutocompleteItem = TypeaheadItem;\n\nexport type AutocompleteProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Suggestions shown as the query matches. Values outside the list are allowed.\n\t *\n\t * Note: When focus leaves the field (via pointer click or Tab/Shift+Tab navigation),\n\t * any uncommitted text or matching suggestion is committed once without stealing focus\n\t * back to the input, allowing natural focus traversal.\n\t */\n\titems: AutocompleteItem[];\n\t/**\n\t * The controlled value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the value changes, including freeform text.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Search…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Autocomplete({\n\titems,\n\tvalue,\n\tdefaultValue,\n\tonValueChange,\n\tname,\n\tplaceholder = \"Search…\",\n\tdisabled,\n\tloading,\n\tsize,\n\tclassName,\n\tid,\n\t\"aria-label\": ariaLabel,\n\t\"aria-describedby\": ariaDescribedBy,\n\t\"aria-invalid\": ariaInvalid,\n\t...rest\n}: AutocompleteProps) {\n\treturn (\n\t\t<TypeaheadField\n\t\t\titems={items}\n\t\t\tvalue={value}\n\t\t\tdefaultValue={defaultValue}\n\t\t\tonValueChange={onValueChange}\n\t\t\tname={name}\n\t\t\tplaceholder={placeholder}\n\t\t\tdisabled={disabled}\n\t\t\tloading={loading}\n\t\t\tsize={size}\n\t\t\tclassName={className}\n\t\t\tid={id}\n\t\t\tallowFreeform\n\t\t\taria-label={ariaLabel}\n\t\t\taria-describedby={ariaDescribedBy}\n\t\t\taria-invalid={ariaInvalid}\n\t\t\t{...rest}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;AAwDA,SAAgB,EAAa,EAC5B,UACA,UACA,iBACA,kBACA,SACA,iBAAc,WACd,aACA,YACA,SACA,cACA,OACA,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,GAAG,KACkB;CACrB,OACC,kBAAC,GAAD;EACQ;EACA;EACO;EACC;EACT;EACO;EACH;EACD;EACH;EACK;EACP;EACJ,eAAA;EACA,cAAY;EACZ,oBAAkB;EAClB,gBAAc;EACd,GAAI;CACJ,CAAA;AAEH"}
|
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type AvatarProps = Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, "asChild"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const Avatar: React.ForwardRefExoticComponent<Omit<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref">, "asChild"> & {
|
|
11
|
+
/**
|
|
12
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
17
|
+
export type AvatarImageProps = Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>, "asChild" | "onLoadingStatusChange" | "src" | "alt"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Image source URL for the avatar image.
|
|
25
|
+
*/
|
|
26
|
+
src?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["src"];
|
|
27
|
+
/**
|
|
28
|
+
* Text description of the image for accessibility and screen readers.
|
|
29
|
+
*/
|
|
30
|
+
alt?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["alt"];
|
|
31
|
+
/**
|
|
32
|
+
* A callback providing the current loading status of the image ('idle' | 'loading' | 'loaded' | 'error').
|
|
33
|
+
*/
|
|
34
|
+
onLoadingStatusChange?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["onLoadingStatusChange"];
|
|
35
|
+
};
|
|
36
|
+
export declare const AvatarImage: React.ForwardRefExoticComponent<Omit<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref">, "alt" | "asChild" | "onLoadingStatusChange" | "src"> & {
|
|
37
|
+
/**
|
|
38
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Image source URL for the avatar image.
|
|
44
|
+
*/
|
|
45
|
+
src?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["src"];
|
|
46
|
+
/**
|
|
47
|
+
* Text description of the image for accessibility and screen readers.
|
|
48
|
+
*/
|
|
49
|
+
alt?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["alt"];
|
|
50
|
+
/**
|
|
51
|
+
* A callback providing the current loading status of the image ('idle' | 'loading' | 'loaded' | 'error').
|
|
52
|
+
*/
|
|
53
|
+
onLoadingStatusChange?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>["onLoadingStatusChange"];
|
|
54
|
+
} & React.RefAttributes<HTMLImageElement>>;
|
|
55
|
+
export type AvatarFallbackProps = Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>, "asChild" | "delayMs"> & {
|
|
56
|
+
/**
|
|
57
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Useful for delaying rendering so it only appears for those with slower connections.
|
|
63
|
+
* Unset by default, rendering immediately without delay.
|
|
64
|
+
*/
|
|
65
|
+
delayMs?: number;
|
|
66
|
+
};
|
|
67
|
+
export declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref">, "asChild" | "delayMs"> & {
|
|
68
|
+
/**
|
|
69
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
asChild?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Useful for delaying rendering so it only appears for those with slower connections.
|
|
75
|
+
* Unset by default, rendering immediately without delay.
|
|
76
|
+
*/
|
|
77
|
+
delayMs?: number;
|
|
78
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../src/components/avatar.tsx"],"sourcesContent":["import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../src/components/avatar.tsx"],"sourcesContent":["import * as AvatarPrimitive from \"@radix-ui/react-avatar\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport type AvatarProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>,\n\t\"asChild\"\n> & {\n\t/**\n\t * Change the default rendered element for the one passed as a child, merging their props and behavior.\n\t * @default false\n\t */\n\tasChild?: boolean;\n};\n\nexport const Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n\t({ className, ...props }, ref) => (\n\t\t<AvatarPrimitive.Root\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"relative flex h-9 w-9 shrink-0 overflow-hidden rounded-full\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nexport type AvatarImageProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>,\n\t\"asChild\" | \"onLoadingStatusChange\" | \"src\" | \"alt\"\n> & {\n\t/**\n\t * Change the default rendered element for the one passed as a child, merging their props and behavior.\n\t * @default false\n\t */\n\tasChild?: boolean;\n\t/**\n\t * Image source URL for the avatar image.\n\t */\n\tsrc?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>[\"src\"];\n\t/**\n\t * Text description of the image for accessibility and screen readers.\n\t */\n\talt?: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>[\"alt\"];\n\t/**\n\t * A callback providing the current loading status of the image ('idle' | 'loading' | 'loaded' | 'error').\n\t */\n\tonLoadingStatusChange?: React.ComponentPropsWithoutRef<\n\t\ttypeof AvatarPrimitive.Image\n\t>[\"onLoadingStatusChange\"];\n};\n\nexport const AvatarImage = React.forwardRef<\n\tReact.ElementRef<typeof AvatarPrimitive.Image>,\n\tAvatarImageProps\n>(({ className, ...props }, ref) => (\n\t<AvatarPrimitive.Image\n\t\tref={ref}\n\t\tclassName={cn(\"aspect-square h-full w-full\", className)}\n\t\t{...props}\n\t/>\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nexport type AvatarFallbackProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>,\n\t\"asChild\" | \"delayMs\"\n> & {\n\t/**\n\t * Change the default rendered element for the one passed as a child, merging their props and behavior.\n\t * @default false\n\t */\n\tasChild?: boolean;\n\t/**\n\t * Useful for delaying rendering so it only appears for those with slower connections.\n\t * Unset by default, rendering immediately without delay.\n\t */\n\tdelayMs?: number;\n};\n\nexport const AvatarFallback = React.forwardRef<\n\tReact.ElementRef<typeof AvatarPrimitive.Fallback>,\n\tAvatarFallbackProps\n>(({ className, ...props }, ref) => (\n\t<AvatarPrimitive.Fallback\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-full w-full items-center justify-center rounded-full bg-basalt-muted text-xs\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n"],"mappings":";;;;;;AAeA,IAAa,IAAS,EAAM,YAC1B,EAAE,cAAW,GAAG,KAAS,MACzB,kBAAC,EAAgB,MAAjB;CACM;CACL,WAAW,EAAG,+DAA+D,CAAS;CACtF,GAAI;AACJ,CAAA,CAEH;AACA,EAAO,cAAc,EAAgB,KAAK;AA2B1C,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAgB,OAAjB;CACM;CACL,WAAW,EAAG,+BAA+B,CAAS;CACtD,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAgB,MAAM;AAkBhD,IAAa,IAAiB,EAAM,YAGjC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAgB,UAAjB;CACM;CACL,WAAW,EACV,uFACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAe,cAAc,EAAgB,SAAS"}
|
|
@@ -3,7 +3,21 @@ import type * as React from "react";
|
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
4
|
variant?: "blue" | "default" | "destructive" | "error" | "info" | "orange" | "outline" | "purple" | "red" | "secondary" | "success" | "teal" | "warning" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
-
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
6
|
+
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, Omit<VariantProps<typeof badgeVariants>, "variant"> {
|
|
7
|
+
/**
|
|
8
|
+
* Visual style variant for the badge.
|
|
9
|
+
*
|
|
10
|
+
* Note: Supports standard semantic tones and decorative color tokens.
|
|
11
|
+
* Pass null to omit variant styling.
|
|
12
|
+
*
|
|
13
|
+
* @default "default"
|
|
14
|
+
*/
|
|
15
|
+
variant?: VariantProps<typeof badgeVariants>["variant"];
|
|
16
|
+
/**
|
|
17
|
+
* Renders a small circular dot indicator before children.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
7
21
|
dot?: boolean;
|
|
8
22
|
}
|
|
9
23
|
export declare function Badge({ className, variant, dot, children, ...props }: BadgeProps): React.JSX.Element;
|
package/dist/components/badge.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { cva as n } from "class-variance-authority";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/badge.tsx
|
|
6
|
-
var
|
|
7
|
+
var a = n("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium", {
|
|
7
8
|
variants: { variant: {
|
|
8
9
|
default: "border-transparent bg-basalt-primary text-basalt-primary-foreground",
|
|
9
10
|
secondary: "border-transparent bg-basalt-secondary text-basalt-foreground",
|
|
@@ -15,23 +16,23 @@ var i = t("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 te
|
|
|
15
16
|
error: "border-transparent bg-basalt-danger-tint text-basalt-danger",
|
|
16
17
|
red: "border-transparent bg-basalt-danger text-white",
|
|
17
18
|
orange: "border-transparent bg-basalt-warning text-white",
|
|
18
|
-
teal: "border-transparent bg-basalt-
|
|
19
|
+
teal: "border-transparent bg-basalt-badge-teal text-white",
|
|
19
20
|
blue: "border-transparent bg-basalt-info text-white",
|
|
20
|
-
purple: "border-transparent bg-basalt-
|
|
21
|
+
purple: "border-transparent bg-basalt-badge-purple text-white"
|
|
21
22
|
} },
|
|
22
23
|
defaultVariants: { variant: "default" }
|
|
23
24
|
});
|
|
24
|
-
function
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
className: e(
|
|
27
|
-
...
|
|
28
|
-
children: [
|
|
25
|
+
function o({ className: n, variant: o, dot: s, children: c, ...l }) {
|
|
26
|
+
return /* @__PURE__ */ i("span", {
|
|
27
|
+
className: e(t, a({ variant: o }), n),
|
|
28
|
+
...l,
|
|
29
|
+
children: [s ? /* @__PURE__ */ r("span", {
|
|
29
30
|
className: "size-1.5 rounded-full bg-current",
|
|
30
31
|
"aria-hidden": "true"
|
|
31
|
-
}) : null,
|
|
32
|
+
}) : null, c]
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
//#endregion
|
|
35
|
-
export {
|
|
36
|
+
export { o as Badge };
|
|
36
37
|
|
|
37
38
|
//# sourceMappingURL=badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","names":[],"sources":["../../src/components/badge.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../utils/cn\";\n\nconst badgeVariants = cva(\n\t\"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"border-transparent bg-basalt-primary text-basalt-primary-foreground\",\n\t\t\t\tsecondary: \"border-transparent bg-basalt-secondary text-basalt-foreground\",\n\t\t\t\tdestructive: \"border-transparent bg-basalt-destructive text-basalt-destructive-foreground\",\n\t\t\t\toutline: \"border-basalt-border text-basalt-foreground\",\n\t\t\t\tinfo: \"border-transparent bg-basalt-info-tint text-basalt-info\",\n\t\t\t\tsuccess: \"border-transparent bg-basalt-heatmap-green-3 text-white\",\n\t\t\t\twarning: \"border-transparent bg-basalt-warning-tint text-basalt-warning\",\n\t\t\t\terror: \"border-transparent bg-basalt-danger-tint text-basalt-danger\",\n\t\t\t\tred: \"border-transparent bg-basalt-danger text-white\",\n\t\t\t\torange: \"border-transparent bg-basalt-warning text-white\",\n\t\t\t\tteal: \"border-transparent bg-basalt-
|
|
1
|
+
{"version":3,"file":"badge.js","names":[],"sources":["../../src/components/badge.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nconst badgeVariants = cva(\n\t\"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: \"border-transparent bg-basalt-primary text-basalt-primary-foreground\",\n\t\t\t\tsecondary: \"border-transparent bg-basalt-secondary text-basalt-foreground\",\n\t\t\t\tdestructive: \"border-transparent bg-basalt-destructive text-basalt-destructive-foreground\",\n\t\t\t\toutline: \"border-basalt-border text-basalt-foreground\",\n\t\t\t\tinfo: \"border-transparent bg-basalt-info-tint text-basalt-info\",\n\t\t\t\tsuccess: \"border-transparent bg-basalt-heatmap-green-3 text-white\",\n\t\t\t\twarning: \"border-transparent bg-basalt-warning-tint text-basalt-warning\",\n\t\t\t\terror: \"border-transparent bg-basalt-danger-tint text-basalt-danger\",\n\t\t\t\tred: \"border-transparent bg-basalt-danger text-white\",\n\t\t\t\torange: \"border-transparent bg-basalt-warning text-white\",\n\t\t\t\tteal: \"border-transparent bg-basalt-badge-teal text-white\",\n\t\t\t\tblue: \"border-transparent bg-basalt-info text-white\",\n\t\t\t\tpurple: \"border-transparent bg-basalt-badge-purple text-white\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { variant: \"default\" },\n\t},\n);\n\nexport interface BadgeProps\n\textends React.HTMLAttributes<HTMLSpanElement>,\n\t\tOmit<VariantProps<typeof badgeVariants>, \"variant\"> {\n\t/**\n\t * Visual style variant for the badge.\n\t *\n\t * Note: Supports standard semantic tones and decorative color tokens.\n\t * Pass null to omit variant styling.\n\t *\n\t * @default \"default\"\n\t */\n\tvariant?: VariantProps<typeof badgeVariants>[\"variant\"];\n\n\t/**\n\t * Renders a small circular dot indicator before children.\n\t *\n\t * @default false\n\t */\n\tdot?: boolean;\n}\n\nexport function Badge({ className, variant, dot, children, ...props }: BadgeProps) {\n\treturn (\n\t\t<span className={cn(BASALT_UI_CLASS, badgeVariants({ variant }), className)} {...props}>\n\t\t\t{dot ? <span className=\"size-1.5 rounded-full bg-current\" aria-hidden=\"true\" /> : null}\n\t\t\t{children}\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAKA,IAAM,IAAgB,EACrB,0FACA;CACC,UAAU,EACT,SAAS;EACR,SAAS;EACT,WAAW;EACX,aAAa;EACb,SAAS;EACT,MAAM;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,QAAQ;EACR,MAAM;EACN,MAAM;EACN,QAAQ;CACT,EACD;CACA,iBAAiB,EAAE,SAAS,UAAU;AACvC,CACD;AAuBA,SAAgB,EAAM,EAAE,cAAW,YAAS,QAAK,aAAU,GAAG,KAAqB;CAClF,OACC,kBAAC,QAAD;EAAM,WAAW,EAAG,GAAiB,EAAc,EAAE,WAAQ,CAAC,GAAG,CAAS;EAAG,GAAI;EAAjF,UAAA,CACE,IAAM,kBAAC,QAAD;GAAM,WAAU;GAAmC,eAAY;EAAQ,CAAA,IAAI,MACjF,CACI;;AAER"}
|
|
@@ -5,14 +5,100 @@ declare const bannerVariants: (props?: ({
|
|
|
5
5
|
variant?: "alert" | "default" | "error" | "secondary" | null | undefined;
|
|
6
6
|
size?: "base" | "sm" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
-
export interface BannerProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof bannerVariants> {
|
|
8
|
+
export interface BannerProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "children">, Omit<VariantProps<typeof bannerVariants>, "variant" | "size"> {
|
|
9
|
+
/**
|
|
10
|
+
* Visual tone variant of the banner.
|
|
11
|
+
*
|
|
12
|
+
* Note: Defaults to "default" (informational). Passing null falls back to "default".
|
|
13
|
+
*
|
|
14
|
+
* @default "default"
|
|
15
|
+
*/
|
|
16
|
+
variant?: VariantProps<typeof bannerVariants>["variant"];
|
|
17
|
+
/**
|
|
18
|
+
* Sizing preset controlling padding geometry and action placement.
|
|
19
|
+
*
|
|
20
|
+
* Note: Defaults to "base". In compact mode ("sm"), only direct `<Banner.Action>` elements
|
|
21
|
+
* are placed in the trailing slot, while other action content renders inline next to the description.
|
|
22
|
+
* Passing null falls back to "base".
|
|
23
|
+
*
|
|
24
|
+
* @default "base"
|
|
25
|
+
*/
|
|
26
|
+
size?: VariantProps<typeof bannerVariants>["size"];
|
|
27
|
+
/**
|
|
28
|
+
* Primary heading text.
|
|
29
|
+
*
|
|
30
|
+
* Note: When present (or when description is present), structured mode is enabled
|
|
31
|
+
* and standard children are not rendered.
|
|
32
|
+
*/
|
|
9
33
|
title?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Secondary copy rendered below the title.
|
|
36
|
+
*/
|
|
10
37
|
description?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Visual icon rendered before the banner content.
|
|
40
|
+
*/
|
|
11
41
|
icon?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Trailing or inline call-to-action slot.
|
|
44
|
+
* Pass `<Banner.Action>` elements for contextual styling.
|
|
45
|
+
* In compact mode ("sm"), only direct `<Banner.Action>` elements are placed in the trailing slot,
|
|
46
|
+
* while other action content renders inline next to the description.
|
|
47
|
+
*/
|
|
12
48
|
action?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Unstructured child content rendered only when both title and description are null or undefined.
|
|
51
|
+
* When title or description is non-null/non-undefined (including empty string or false),
|
|
52
|
+
* structured mode is active and children are ignored.
|
|
53
|
+
*/
|
|
54
|
+
children?: HTMLAttributes<HTMLDivElement>["children"];
|
|
55
|
+
}
|
|
56
|
+
export interface BannerActionProps extends Omit<ButtonProps, "variant" | "size" | "asChild" | "type" | "loading" | "icon" | "children"> {
|
|
57
|
+
/**
|
|
58
|
+
* Visual style variant. Preserves "ghost" and "secondary"; all other values
|
|
59
|
+
* are mapped contextually to "destructive" (when parent Banner variant is "error")
|
|
60
|
+
* or "default".
|
|
61
|
+
*
|
|
62
|
+
* Note: Ordinary function component without forwarded ref.
|
|
63
|
+
*
|
|
64
|
+
* @default "default"
|
|
65
|
+
*/
|
|
66
|
+
variant?: ButtonProps["variant"];
|
|
67
|
+
/**
|
|
68
|
+
* Sizing preset. When unspecified or null, resolves to "icon" if children are omitted,
|
|
69
|
+
* null, or an empty string, "sm" when parent Banner is compact ("sm"), or "default" otherwise.
|
|
70
|
+
* When iconOnly mode is resolved, an additional "size-8" class is attached.
|
|
71
|
+
*/
|
|
72
|
+
size?: ButtonProps["size"];
|
|
73
|
+
/**
|
|
74
|
+
* Pass control to child element slot.
|
|
75
|
+
*
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
asChild?: ButtonProps["asChild"];
|
|
79
|
+
/**
|
|
80
|
+
* Button type attribute.
|
|
81
|
+
*
|
|
82
|
+
* @default "button"
|
|
83
|
+
*/
|
|
84
|
+
type?: ButtonProps["type"];
|
|
85
|
+
/**
|
|
86
|
+
* Display loading spinner and disable interactions.
|
|
87
|
+
*
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
loading?: ButtonProps["loading"];
|
|
91
|
+
/**
|
|
92
|
+
* Optional leading icon slot.
|
|
93
|
+
*/
|
|
94
|
+
icon?: ButtonProps["icon"];
|
|
95
|
+
/**
|
|
96
|
+
* Action label content. When null, undefined, or empty string, enables iconOnly sizing mode.
|
|
97
|
+
*/
|
|
98
|
+
children?: ButtonProps["children"];
|
|
13
99
|
}
|
|
14
100
|
declare function BannerRoot({ className, variant, size, title, description, icon, action, children, ...props }: BannerProps): import("react").JSX.Element;
|
|
15
|
-
export declare function BannerAction({ className, variant, size, icon, children, ...props }:
|
|
101
|
+
export declare function BannerAction({ className, variant, size, icon, children, ...props }: BannerActionProps): import("react").JSX.Element;
|
|
16
102
|
export declare namespace BannerAction {
|
|
17
103
|
var displayName: string;
|
|
18
104
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { Children as r, createContext as i, useContext as a } from "react";
|
|
6
|
+
import { cva as o } from "class-variance-authority";
|
|
7
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/banner.tsx
|
|
8
|
-
var
|
|
9
|
+
var u = o("flex w-full items-start gap-3 rounded-basalt-md text-sm", {
|
|
9
10
|
variants: {
|
|
10
11
|
variant: {
|
|
11
12
|
default: "bg-basalt-info-tint text-basalt-info",
|
|
@@ -22,67 +23,67 @@ var l = a("flex w-full items-start gap-3 rounded-basalt-md text-sm", {
|
|
|
22
23
|
variant: "default",
|
|
23
24
|
size: "base"
|
|
24
25
|
}
|
|
25
|
-
}),
|
|
26
|
+
}), d = i({
|
|
26
27
|
variant: "default",
|
|
27
28
|
size: "base"
|
|
28
29
|
});
|
|
29
|
-
function
|
|
30
|
-
return typeof e == "object" && !!e && "type" in e && e.type ===
|
|
30
|
+
function f(e) {
|
|
31
|
+
return typeof e == "object" && !!e && "type" in e && e.type === m;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
function p({ className: n, variant: i = "default", size: a = "base", title: o, description: p, icon: m, action: h, children: g, ..._ }) {
|
|
34
|
+
let v = i ?? "default", y = a ?? "base", b = o != null || p != null, x = r.toArray(h), S = x.filter(f), C = x.filter((e) => !f(e)), w = y === "sm" ? S : [...C, ...S], T = y === "sm" ? C : [];
|
|
35
|
+
return /* @__PURE__ */ c(d.Provider, {
|
|
35
36
|
value: {
|
|
36
|
-
variant:
|
|
37
|
-
size:
|
|
37
|
+
variant: v,
|
|
38
|
+
size: y
|
|
38
39
|
},
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
className: e(
|
|
41
|
-
variant:
|
|
42
|
-
size:
|
|
43
|
-
}),
|
|
44
|
-
...
|
|
40
|
+
children: /* @__PURE__ */ l("div", {
|
|
41
|
+
className: e(t, u({
|
|
42
|
+
variant: v,
|
|
43
|
+
size: y
|
|
44
|
+
}), n),
|
|
45
|
+
..._,
|
|
45
46
|
children: [
|
|
46
|
-
|
|
47
|
+
m ? /* @__PURE__ */ c("span", {
|
|
47
48
|
className: "mt-0.5 inline-flex shrink-0 [&_svg]:size-5",
|
|
48
|
-
children:
|
|
49
|
+
children: m
|
|
49
50
|
}) : null,
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ l("div", {
|
|
51
52
|
className: "min-w-0 flex-1 space-y-0.5",
|
|
52
53
|
children: [
|
|
53
|
-
|
|
54
|
+
o ? /* @__PURE__ */ c("p", {
|
|
54
55
|
className: "font-medium",
|
|
55
|
-
children:
|
|
56
|
+
children: o
|
|
56
57
|
}) : null,
|
|
57
|
-
|
|
58
|
-
className: e(
|
|
59
|
-
children: [
|
|
60
|
-
}) :
|
|
61
|
-
|
|
58
|
+
p ? /* @__PURE__ */ l("div", {
|
|
59
|
+
className: e(v === "secondary" ? "text-basalt-muted-foreground" : "text-current"),
|
|
60
|
+
children: [p, T.length > 0 ? /* @__PURE__ */ l(s, { children: [" ", T] }) : null]
|
|
61
|
+
}) : T.length > 0 ? /* @__PURE__ */ c("div", { children: T }) : null,
|
|
62
|
+
b ? null : g
|
|
62
63
|
]
|
|
63
64
|
}),
|
|
64
|
-
|
|
65
|
+
w.length > 0 ? /* @__PURE__ */ c("div", {
|
|
65
66
|
className: "flex shrink-0 items-center gap-2",
|
|
66
|
-
children:
|
|
67
|
+
children: w
|
|
67
68
|
}) : null
|
|
68
69
|
]
|
|
69
70
|
})
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
let
|
|
74
|
-
return /* @__PURE__ */
|
|
73
|
+
function m({ className: t, variant: r = "default", size: i, icon: o, children: s, ...l }) {
|
|
74
|
+
let u = a(d), f = r === "ghost" ? "ghost" : r === "secondary" ? "secondary" : u.variant === "error" ? "destructive" : "default", p = s == null || s === "";
|
|
75
|
+
return /* @__PURE__ */ c(n, {
|
|
75
76
|
variant: f,
|
|
76
|
-
size:
|
|
77
|
+
size: i ?? (p ? "icon" : u.size === "sm" ? "sm" : "default"),
|
|
77
78
|
icon: o,
|
|
78
|
-
className: e(p && "size-8",
|
|
79
|
+
className: e(p && "size-8", t),
|
|
79
80
|
...l,
|
|
80
|
-
children:
|
|
81
|
+
children: s
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
var
|
|
84
|
+
m.displayName = "Banner.Action";
|
|
85
|
+
var h = Object.assign(p, { Action: m });
|
|
85
86
|
//#endregion
|
|
86
|
-
export {
|
|
87
|
+
export { h as Banner, m as BannerAction };
|
|
87
88
|
|
|
88
89
|
//# sourceMappingURL=banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.js","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport { Children, createContext, type HTMLAttributes, type ReactNode, useContext } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button, type ButtonProps } from \"./button\";\n\nconst bannerVariants = cva(\"flex w-full items-start gap-3 rounded-basalt-md text-sm\", {\n\tvariants: {\n\t\tvariant: {\n\t\t\tdefault: \"bg-basalt-info-tint text-basalt-info\",\n\t\t\talert: \"bg-basalt-warning-tint text-basalt-warning\",\n\t\t\terror: \"bg-basalt-danger-tint text-basalt-danger\",\n\t\t\tsecondary: \"bg-basalt-muted text-basalt-foreground\",\n\t\t},\n\t\tsize: {\n\t\t\tbase: \"px-4 py-3\",\n\t\t\tsm: \"px-3 py-2\",\n\t\t},\n\t},\n\tdefaultVariants: { variant: \"default\", size: \"base\" },\n});\n\ntype BannerVariant = NonNullable<VariantProps<typeof bannerVariants>[\"variant\"]>;\ntype BannerSize = NonNullable<VariantProps<typeof bannerVariants>[\"size\"]>;\n\nconst BannerContext = createContext<{ variant: BannerVariant; size: BannerSize }>({\n\tvariant: \"default\",\n\tsize: \"base\",\n});\n\nexport interface BannerProps\n\textends HTMLAttributes<HTMLDivElement>,\n\t\
|
|
1
|
+
{"version":3,"file":"banner.js","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport { Children, createContext, type HTMLAttributes, type ReactNode, useContext } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\nimport { Button, type ButtonProps } from \"./button\";\n\nconst bannerVariants = cva(\"flex w-full items-start gap-3 rounded-basalt-md text-sm\", {\n\tvariants: {\n\t\tvariant: {\n\t\t\tdefault: \"bg-basalt-info-tint text-basalt-info\",\n\t\t\talert: \"bg-basalt-warning-tint text-basalt-warning\",\n\t\t\terror: \"bg-basalt-danger-tint text-basalt-danger\",\n\t\t\tsecondary: \"bg-basalt-muted text-basalt-foreground\",\n\t\t},\n\t\tsize: {\n\t\t\tbase: \"px-4 py-3\",\n\t\t\tsm: \"px-3 py-2\",\n\t\t},\n\t},\n\tdefaultVariants: { variant: \"default\", size: \"base\" },\n});\n\ntype BannerVariant = NonNullable<VariantProps<typeof bannerVariants>[\"variant\"]>;\ntype BannerSize = NonNullable<VariantProps<typeof bannerVariants>[\"size\"]>;\n\nconst BannerContext = createContext<{ variant: BannerVariant; size: BannerSize }>({\n\tvariant: \"default\",\n\tsize: \"base\",\n});\n\nexport interface BannerProps\n\textends Omit<HTMLAttributes<HTMLDivElement>, \"title\" | \"children\">,\n\t\tOmit<VariantProps<typeof bannerVariants>, \"variant\" | \"size\"> {\n\t/**\n\t * Visual tone variant of the banner.\n\t *\n\t * Note: Defaults to \"default\" (informational). Passing null falls back to \"default\".\n\t *\n\t * @default \"default\"\n\t */\n\tvariant?: VariantProps<typeof bannerVariants>[\"variant\"];\n\n\t/**\n\t * Sizing preset controlling padding geometry and action placement.\n\t *\n\t * Note: Defaults to \"base\". In compact mode (\"sm\"), only direct `<Banner.Action>` elements\n\t * are placed in the trailing slot, while other action content renders inline next to the description.\n\t * Passing null falls back to \"base\".\n\t *\n\t * @default \"base\"\n\t */\n\tsize?: VariantProps<typeof bannerVariants>[\"size\"];\n\n\t/**\n\t * Primary heading text.\n\t *\n\t * Note: When present (or when description is present), structured mode is enabled\n\t * and standard children are not rendered.\n\t */\n\ttitle?: string;\n\n\t/**\n\t * Secondary copy rendered below the title.\n\t */\n\tdescription?: ReactNode;\n\n\t/**\n\t * Visual icon rendered before the banner content.\n\t */\n\ticon?: ReactNode;\n\n\t/**\n\t * Trailing or inline call-to-action slot.\n\t * Pass `<Banner.Action>` elements for contextual styling.\n\t * In compact mode (\"sm\"), only direct `<Banner.Action>` elements are placed in the trailing slot,\n\t * while other action content renders inline next to the description.\n\t */\n\taction?: ReactNode;\n\n\t/**\n\t * Unstructured child content rendered only when both title and description are null or undefined.\n\t * When title or description is non-null/non-undefined (including empty string or false),\n\t * structured mode is active and children are ignored.\n\t */\n\tchildren?: HTMLAttributes<HTMLDivElement>[\"children\"];\n}\n\nexport interface BannerActionProps\n\textends Omit<\n\t\tButtonProps,\n\t\t\"variant\" | \"size\" | \"asChild\" | \"type\" | \"loading\" | \"icon\" | \"children\"\n\t> {\n\t/**\n\t * Visual style variant. Preserves \"ghost\" and \"secondary\"; all other values\n\t * are mapped contextually to \"destructive\" (when parent Banner variant is \"error\")\n\t * or \"default\".\n\t *\n\t * Note: Ordinary function component without forwarded ref.\n\t *\n\t * @default \"default\"\n\t */\n\tvariant?: ButtonProps[\"variant\"];\n\n\t/**\n\t * Sizing preset. When unspecified or null, resolves to \"icon\" if children are omitted,\n\t * null, or an empty string, \"sm\" when parent Banner is compact (\"sm\"), or \"default\" otherwise.\n\t * When iconOnly mode is resolved, an additional \"size-8\" class is attached.\n\t */\n\tsize?: ButtonProps[\"size\"];\n\n\t/**\n\t * Pass control to child element slot.\n\t *\n\t * @default false\n\t */\n\tasChild?: ButtonProps[\"asChild\"];\n\n\t/**\n\t * Button type attribute.\n\t *\n\t * @default \"button\"\n\t */\n\ttype?: ButtonProps[\"type\"];\n\n\t/**\n\t * Display loading spinner and disable interactions.\n\t *\n\t * @default false\n\t */\n\tloading?: ButtonProps[\"loading\"];\n\n\t/**\n\t * Optional leading icon slot.\n\t */\n\ticon?: ButtonProps[\"icon\"];\n\n\t/**\n\t * Action label content. When null, undefined, or empty string, enables iconOnly sizing mode.\n\t */\n\tchildren?: ButtonProps[\"children\"];\n}\n\nfunction isBannerAction(node: ReactNode): boolean {\n\treturn (\n\t\ttypeof node === \"object\" &&\n\t\tnode !== null &&\n\t\t\"type\" in node &&\n\t\t(node as { type: unknown }).type === BannerAction\n\t);\n}\n\nfunction BannerRoot({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"base\",\n\ttitle,\n\tdescription,\n\ticon,\n\taction,\n\tchildren,\n\t...props\n}: BannerProps) {\n\tconst resolvedVariant = variant ?? \"default\";\n\tconst resolvedSize = size ?? \"base\";\n\tconst structured = title != null || description != null;\n\tconst nodes = Children.toArray(action);\n\tconst ctas = nodes.filter(isBannerAction);\n\tconst other = nodes.filter((node) => !isBannerAction(node));\n\tconst trailing = resolvedSize === \"sm\" ? ctas : [...other, ...ctas];\n\tconst inlineActions = resolvedSize === \"sm\" ? other : [];\n\n\treturn (\n\t\t<BannerContext.Provider value={{ variant: resolvedVariant, size: resolvedSize }}>\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\tbannerVariants({ variant: resolvedVariant, size: resolvedSize }),\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{icon ? <span className=\"mt-0.5 inline-flex shrink-0 [&_svg]:size-5\">{icon}</span> : null}\n\t\t\t\t<div className=\"min-w-0 flex-1 space-y-0.5\">\n\t\t\t\t\t{title ? <p className=\"font-medium\">{title}</p> : null}\n\t\t\t\t\t{description ? (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\tresolvedVariant === \"secondary\" ? \"text-basalt-muted-foreground\" : \"text-current\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t\t{inlineActions.length > 0 ? <> {inlineActions}</> : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : inlineActions.length > 0 ? (\n\t\t\t\t\t\t<div>{inlineActions}</div>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{structured ? null : children}\n\t\t\t\t</div>\n\t\t\t\t{trailing.length > 0 ? (\n\t\t\t\t\t<div className=\"flex shrink-0 items-center gap-2\">{trailing}</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</BannerContext.Provider>\n\t);\n}\n\nexport function BannerAction({\n\tclassName,\n\tvariant = \"default\",\n\tsize,\n\ticon,\n\tchildren,\n\t...props\n}: BannerActionProps) {\n\tconst banner = useContext(BannerContext);\n\tconst mapped =\n\t\tvariant === \"ghost\"\n\t\t\t? \"ghost\"\n\t\t\t: variant === \"secondary\"\n\t\t\t\t? \"secondary\"\n\t\t\t\t: banner.variant === \"error\"\n\t\t\t\t\t? \"destructive\"\n\t\t\t\t\t: \"default\";\n\tconst iconOnly = children == null || children === \"\";\n\treturn (\n\t\t<Button\n\t\t\tvariant={mapped}\n\t\t\tsize={size ?? (iconOnly ? \"icon\" : banner.size === \"sm\" ? \"sm\" : \"default\")}\n\t\t\ticon={icon}\n\t\t\tclassName={cn(iconOnly && \"size-8\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</Button>\n\t);\n}\nBannerAction.displayName = \"Banner.Action\";\n\nexport const Banner = Object.assign(BannerRoot, { Action: BannerAction });\n"],"mappings":";;;;;;;;AAMA,IAAM,IAAiB,EAAI,2DAA2D;CACrF,UAAU;EACT,SAAS;GACR,SAAS;GACT,OAAO;GACP,OAAO;GACP,WAAW;EACZ;EACA,MAAM;GACL,MAAM;GACN,IAAI;EACL;CACD;CACA,iBAAiB;EAAE,SAAS;EAAW,MAAM;CAAO;AACrD,CAAC,GAKK,IAAgB,EAA4D;CACjF,SAAS;CACT,MAAM;AACP,CAAC;AAkHD,SAAS,EAAe,GAA0B;CACjD,OACC,OAAO,KAAS,cAChB,KACA,UAAU,KACT,EAA2B,SAAS;AAEvC;AAEA,SAAS,EAAW,EACnB,cACA,aAAU,WACV,UAAO,QACP,UACA,gBACA,SACA,WACA,aACA,GAAG,KACY;CACf,IAAM,IAAkB,KAAW,WAC7B,IAAe,KAAQ,QACvB,IAAa,KAAS,QAAQ,KAAe,MAC7C,IAAQ,EAAS,QAAQ,CAAM,GAC/B,IAAO,EAAM,OAAO,CAAc,GAClC,IAAQ,EAAM,QAAQ,MAAS,CAAC,EAAe,CAAI,CAAC,GACpD,IAAW,MAAiB,OAAO,IAAO,CAAC,GAAG,GAAO,GAAG,CAAI,GAC5D,IAAgB,MAAiB,OAAO,IAAQ,CAAC;CAEvD,OACC,kBAAC,EAAc,UAAf;EAAwB,OAAO;GAAE,SAAS;GAAiB,MAAM;EAAa;EAC7E,UAAA,kBAAC,OAAD;GACC,WAAW,EACV,GACA,EAAe;IAAE,SAAS;IAAiB,MAAM;GAAa,CAAC,GAC/D,CACD;GACA,GAAI;GANL,UAAA;IAQE,IAAO,kBAAC,QAAD;KAAM,WAAU;KAA8C,UAAA;IAAW,CAAA,IAAI;IACrF,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,IAAQ,kBAAC,KAAD;OAAG,WAAU;OAAe,UAAA;MAAS,CAAA,IAAI;MACjD,IACA,kBAAC,OAAD;OACC,WAAW,EACV,MAAoB,cAAc,iCAAiC,cACpE;OAHD,UAAA,CAKE,GACA,EAAc,SAAS,IAAI,kBAAA,GAAA,EAAA,UAAA,CAAE,KAAE,CAAgB,EAAA,CAAA,IAAI,IAChD;MACF,CAAA,IAAA,EAAc,SAAS,IAC1B,kBAAC,OAAD,EAAA,UAAM,EAAmB,CAAA,IACtB;MACH,IAAa,OAAO;KACjB;;IACJ,EAAS,SAAS,IAClB,kBAAC,OAAD;KAAK,WAAU;KAAoC,UAAA;IAAc,CAAA,IAC9D;GACA;;CACkB,CAAA;AAE1B;AAEA,SAAgB,EAAa,EAC5B,cACA,aAAU,WACV,SACA,SACA,aACA,GAAG,KACkB;CACrB,IAAM,IAAS,EAAW,CAAa,GACjC,IACL,MAAY,UACT,UACA,MAAY,cACX,cACA,EAAO,YAAY,UAClB,gBACA,WACA,IAAW,KAAY,QAAQ,MAAa;CAClD,OACC,kBAAC,GAAD;EACC,SAAS;EACT,MAAM,MAAS,IAAW,SAAS,EAAO,SAAS,OAAO,OAAO;EAC3D;EACN,WAAW,EAAG,KAAY,UAAU,CAAS;EAC7C,GAAI;EAEH;CACM,CAAA;AAEV;AACA,EAAa,cAAc;AAE3B,IAAa,IAAS,OAAO,OAAO,GAAY,EAAE,QAAQ,EAAa,CAAC"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { basaltMarkPng as t } from "../assets/brand-mark.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/basalt-mark.tsx
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
className: e("h-5 w-5
|
|
9
|
-
|
|
6
|
+
function i({ className: i, ...a }) {
|
|
7
|
+
return /* @__PURE__ */ r("svg", {
|
|
8
|
+
className: e("h-5 w-5", i),
|
|
9
|
+
viewBox: "0 0 128 128",
|
|
10
|
+
role: "img",
|
|
10
11
|
"aria-label": "Basalt",
|
|
11
|
-
...
|
|
12
|
+
...a,
|
|
13
|
+
children: [/* @__PURE__ */ n("title", { children: "Basalt" }), /* @__PURE__ */ n("image", {
|
|
14
|
+
href: t,
|
|
15
|
+
width: "128",
|
|
16
|
+
height: "128"
|
|
17
|
+
})]
|
|
12
18
|
});
|
|
13
19
|
}
|
|
14
20
|
//#endregion
|
|
15
|
-
export {
|
|
21
|
+
export { i as BasaltMark };
|
|
16
22
|
|
|
17
23
|
//# sourceMappingURL=basalt-mark.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basalt-mark.js","names":[],"sources":["../../src/components/basalt-mark.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"basalt-mark.js","names":[],"sources":["../../src/components/basalt-mark.tsx"],"sourcesContent":["import type { SVGAttributes } from \"react\";\nimport { basaltMarkPng } from \"../assets/brand-mark\";\nimport { cn } from \"../utils/cn\";\n\nexport type BasaltMarkProps = Omit<SVGAttributes<SVGSVGElement>, \"className\"> & {\n\t/**\n\t * Additional classes for the mark.\n\t */\n\tclassName?: string;\n};\n\nexport function BasaltMark({ className, ...props }: BasaltMarkProps) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={cn(\"h-5 w-5\", className)}\n\t\t\tviewBox=\"0 0 128 128\"\n\t\t\trole=\"img\"\n\t\t\taria-label=\"Basalt\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<title>Basalt</title>\n\t\t\t<image href={basaltMarkPng} width=\"128\" height=\"128\" />\n\t\t</svg>\n\t);\n}\n"],"mappings":";;;;;AAWA,SAAgB,EAAW,EAAE,cAAW,GAAG,KAA0B;CACpE,OACC,kBAAC,OAAD;EACC,WAAW,EAAG,WAAW,CAAS;EAClC,SAAQ;EACR,MAAK;EACL,cAAW;EACX,GAAI;EALL,UAAA,CAOC,kBAAC,SAAD,EAAA,UAAO,SAAa,CAAA,GACpB,kBAAC,SAAD;GAAO,MAAM;GAAe,OAAM;GAAM,QAAO;EAAO,CAAA,CAClD;;AAEP"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
export interface BatteryMeterProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
/** Battery charge in percent, clamped to 0–100. Non-finite readings are unavailable. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** Accessible name of the battery. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Device state, also announced with the value. @default "discharging" */
|
|
8
|
+
status?: "charging" | "discharging" | "offline";
|
|
9
|
+
}
|
|
10
|
+
export declare function BatteryMeter({ value, label, status, className, ...props }: BatteryMeterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { BASALT_UI_CLASS as t } from "../utils/control-surface.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/battery-meter.tsx
|
|
6
|
+
function i({ value: i, label: a, status: o = "discharging", className: s, ...c }) {
|
|
7
|
+
let l = o !== "offline" && Number.isFinite(i), u = l ? Math.min(100, Math.max(0, i)) : 0, d = u <= 20 ? "bg-basalt-danger" : u <= 50 ? "bg-basalt-warning" : "bg-basalt-primary";
|
|
8
|
+
return /* @__PURE__ */ r("div", {
|
|
9
|
+
className: e(t, "inline-flex items-center gap-2 text-xs tabular-nums", s),
|
|
10
|
+
...c,
|
|
11
|
+
children: [
|
|
12
|
+
l ? /* @__PURE__ */ n("meter", {
|
|
13
|
+
className: "sr-only",
|
|
14
|
+
min: 0,
|
|
15
|
+
max: 100,
|
|
16
|
+
low: 20,
|
|
17
|
+
high: 80,
|
|
18
|
+
optimum: 100,
|
|
19
|
+
value: u,
|
|
20
|
+
"aria-label": `${a}, ${o}`
|
|
21
|
+
}) : /* @__PURE__ */ r("span", {
|
|
22
|
+
className: "sr-only",
|
|
23
|
+
children: [a, ": unavailable"]
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ r("span", {
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: "relative inline-flex h-4 w-9 gap-0.5 rounded-sm border border-basalt-muted-foreground/60 p-0.5",
|
|
28
|
+
children: [[
|
|
29
|
+
0,
|
|
30
|
+
1,
|
|
31
|
+
2,
|
|
32
|
+
3
|
|
33
|
+
].map((t) => /* @__PURE__ */ n("span", {
|
|
34
|
+
className: "relative flex-1 overflow-hidden rounded-[1px] bg-basalt-muted",
|
|
35
|
+
children: /* @__PURE__ */ n("span", {
|
|
36
|
+
className: e("absolute inset-y-0 left-0", d),
|
|
37
|
+
style: { width: `${Math.min(100, Math.max(0, u - t * 25) * 4)}%` }
|
|
38
|
+
})
|
|
39
|
+
}, t)), /* @__PURE__ */ n("span", { className: "absolute -right-1 top-1 h-1.5 w-0.5 rounded-r-sm bg-basalt-muted-foreground/60" })]
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ n("span", {
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
className: "min-w-9 text-basalt-foreground",
|
|
44
|
+
children: l ? `${Math.round(u)}%` : "Offline"
|
|
45
|
+
}),
|
|
46
|
+
o === "charging" && l ? /* @__PURE__ */ n("span", {
|
|
47
|
+
className: "text-basalt-muted-foreground",
|
|
48
|
+
children: "Charging"
|
|
49
|
+
}) : null
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { i as BatteryMeter };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=battery-meter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"battery-meter.js","names":[],"sources":["../../src/components/battery-meter.tsx"],"sourcesContent":["import type { HTMLAttributes } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport interface BatteryMeterProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n\t/** Battery charge in percent, clamped to 0–100. Non-finite readings are unavailable. */\n\tvalue: number;\n\t/** Accessible name of the battery. */\n\tlabel: string;\n\t/** Device state, also announced with the value. @default \"discharging\" */\n\tstatus?: \"charging\" | \"discharging\" | \"offline\";\n}\n\nexport function BatteryMeter({\n\tvalue,\n\tlabel,\n\tstatus = \"discharging\",\n\tclassName,\n\t...props\n}: BatteryMeterProps) {\n\tconst available = status !== \"offline\" && Number.isFinite(value);\n\tconst charge = available ? Math.min(100, Math.max(0, value)) : 0;\n\tconst color =\n\t\tcharge <= 20 ? \"bg-basalt-danger\" : charge <= 50 ? \"bg-basalt-warning\" : \"bg-basalt-primary\";\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"inline-flex items-center gap-2 text-xs tabular-nums\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{available ? (\n\t\t\t\t<meter\n\t\t\t\t\tclassName=\"sr-only\"\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tlow={20}\n\t\t\t\t\thigh={80}\n\t\t\t\t\toptimum={100}\n\t\t\t\t\tvalue={charge}\n\t\t\t\t\taria-label={`${label}, ${status}`}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<span className=\"sr-only\">{label}: unavailable</span>\n\t\t\t)}\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"relative inline-flex h-4 w-9 gap-0.5 rounded-sm border border-basalt-muted-foreground/60 p-0.5\"\n\t\t\t>\n\t\t\t\t{[0, 1, 2, 3].map((segment) => (\n\t\t\t\t\t<span\n\t\t\t\t\t\tkey={segment}\n\t\t\t\t\t\tclassName=\"relative flex-1 overflow-hidden rounded-[1px] bg-basalt-muted\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName={cn(\"absolute inset-y-0 left-0\", color)}\n\t\t\t\t\t\t\tstyle={{ width: `${Math.min(100, Math.max(0, charge - segment * 25) * 4)}%` }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t))}\n\t\t\t\t<span className=\"absolute -right-1 top-1 h-1.5 w-0.5 rounded-r-sm bg-basalt-muted-foreground/60\" />\n\t\t\t</span>\n\t\t\t<span aria-hidden=\"true\" className=\"min-w-9 text-basalt-foreground\">\n\t\t\t\t{available ? `${Math.round(charge)}%` : \"Offline\"}\n\t\t\t</span>\n\t\t\t{status === \"charging\" && available ? (\n\t\t\t\t<span className=\"text-basalt-muted-foreground\">Charging</span>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AAaA,SAAgB,EAAa,EAC5B,UACA,UACA,YAAS,eACT,cACA,GAAG,KACkB;CACrB,IAAM,IAAY,MAAW,aAAa,OAAO,SAAS,CAAK,GACzD,IAAS,IAAY,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,CAAK,CAAC,IAAI,GACzD,IACL,KAAU,KAAK,qBAAqB,KAAU,KAAK,sBAAsB;CAC1E,OACC,kBAAC,OAAD;EACC,WAAW,EACV,GACA,uDACA,CACD;EACA,GAAI;EANL,UAAA;GAQE,IACA,kBAAC,SAAD;IACC,WAAU;IACV,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,OAAO;IACP,cAAY,GAAG,EAAM,IAAI;GACzB,CAAA,IAED,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CAA2B,GAAM,eAAmB;;GAErD,kBAAC,QAAD;IACC,eAAY;IACZ,WAAU;IAFX,UAAA,CAIE;KAAC;KAAG;KAAG;KAAG;IAAC,CAAC,CAAC,KAAK,MAClB,kBAAC,QAAD;KAEC,WAAU;KAEV,UAAA,kBAAC,QAAD;MACC,WAAW,EAAG,6BAA6B,CAAK;MAChD,OAAO,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,IAAS,IAAU,EAAE,IAAI,CAAC,EAAE,GAAG;KAC5E,CAAA;IACI,GAPA,CAOA,CACN,GACD,kBAAC,QAAD,EAAM,WAAU,iFAAkF,CAAA,CAC7F;;GACN,kBAAC,QAAD;IAAM,eAAY;IAAO,WAAU;IACjC,UAAA,IAAY,GAAG,KAAK,MAAM,CAAM,EAAE,KAAK;GACnC,CAAA;GACL,MAAW,cAAc,IACzB,kBAAC,QAAD;IAAM,WAAU;IAA+B,UAAA;GAAc,CAAA,IAC1D;EACA;;AAEP"}
|