@hanzo/ui 8.27.8 → 8.27.10
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 +2 -1
- package/dist/backends/gui/3d-card.cjs +100 -0
- package/dist/backends/gui/3d-card.d.ts +59 -0
- package/dist/backends/gui/3d-card.d.ts.map +1 -0
- package/dist/backends/gui/3d-card.js +92 -0
- package/dist/backends/gui/3d-card.js.map +1 -0
- package/dist/backends/gui/3d-marquee.cjs +225 -0
- package/dist/backends/gui/3d-marquee.d.ts +114 -0
- package/dist/backends/gui/3d-marquee.d.ts.map +1 -0
- package/dist/backends/gui/3d-marquee.js +190 -0
- package/dist/backends/gui/3d-marquee.js.map +1 -0
- package/dist/backends/gui/3d-pin.cjs +51 -0
- package/dist/backends/gui/3d-pin.d.ts +14 -0
- package/dist/backends/gui/3d-pin.d.ts.map +1 -0
- package/dist/backends/gui/3d-pin.js +49 -0
- package/dist/backends/gui/3d-pin.js.map +1 -0
- package/dist/backends/gui/advanced-chart.cjs +61 -0
- package/dist/backends/gui/advanced-chart.d.ts +38 -0
- package/dist/backends/gui/advanced-chart.d.ts.map +1 -0
- package/dist/backends/gui/advanced-chart.js +59 -0
- package/dist/backends/gui/advanced-chart.js.map +1 -0
- package/dist/backends/gui/alert.cjs +106 -0
- package/dist/backends/gui/alert.d.ts +39 -0
- package/dist/backends/gui/alert.d.ts.map +1 -0
- package/dist/backends/gui/alert.js +102 -0
- package/dist/backends/gui/alert.js.map +1 -0
- package/dist/backends/gui/android.cjs +52 -0
- package/dist/backends/gui/android.d.ts +16 -0
- package/dist/backends/gui/android.d.ts.map +1 -0
- package/dist/backends/gui/android.js +50 -0
- package/dist/backends/gui/android.js.map +1 -0
- package/dist/backends/gui/animated-beam.cjs +97 -0
- package/dist/backends/gui/animated-beam.d.ts +57 -0
- package/dist/backends/gui/animated-beam.d.ts.map +1 -0
- package/dist/backends/gui/animated-beam.js +62 -0
- package/dist/backends/gui/animated-beam.js.map +1 -0
- package/dist/backends/gui/animated-cursor.cjs +183 -0
- package/dist/backends/gui/animated-cursor.d.ts +42 -0
- package/dist/backends/gui/animated-cursor.d.ts.map +1 -0
- package/dist/backends/gui/animated-cursor.js +181 -0
- package/dist/backends/gui/animated-cursor.js.map +1 -0
- package/dist/backends/gui/animated-testimonials.cjs +109 -0
- package/dist/backends/gui/animated-testimonials.d.ts +23 -0
- package/dist/backends/gui/animated-testimonials.d.ts.map +1 -0
- package/dist/backends/gui/animated-testimonials.js +74 -0
- package/dist/backends/gui/animated-testimonials.js.map +1 -0
- package/dist/backends/gui/animated-tooltip.cjs +100 -0
- package/dist/backends/gui/animated-tooltip.d.ts +15 -0
- package/dist/backends/gui/animated-tooltip.d.ts.map +1 -0
- package/dist/backends/gui/animated-tooltip.js +65 -0
- package/dist/backends/gui/animated-tooltip.js.map +1 -0
- package/dist/backends/gui/announcement.cjs +54 -0
- package/dist/backends/gui/announcement.d.ts +26 -0
- package/dist/backends/gui/announcement.d.ts.map +1 -0
- package/dist/backends/gui/announcement.js +52 -0
- package/dist/backends/gui/announcement.js.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.cjs +198 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts +45 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.js +162 -0
- package/dist/backends/gui/apple-cards-carousel.js.map +1 -0
- package/dist/backends/gui/apple-hello-effect.cjs +38 -0
- package/dist/backends/gui/apple-hello-effect.d.ts +9 -0
- package/dist/backends/gui/apple-hello-effect.d.ts.map +1 -0
- package/dist/backends/gui/apple-hello-effect.js +36 -0
- package/dist/backends/gui/apple-hello-effect.js.map +1 -0
- package/dist/backends/gui/banner.cjs +108 -0
- package/dist/backends/gui/banner.d.ts +33 -0
- package/dist/backends/gui/banner.d.ts.map +1 -0
- package/dist/backends/gui/banner.js +106 -0
- package/dist/backends/gui/banner.js.map +1 -0
- package/dist/backends/gui/calendar.cjs +152 -0
- package/dist/backends/gui/calendar.d.ts +41 -0
- package/dist/backends/gui/calendar.d.ts.map +1 -0
- package/dist/backends/gui/calendar.js +151 -0
- package/dist/backends/gui/calendar.js.map +1 -0
- package/dist/backends/gui/choicebox.cjs +50 -0
- package/dist/backends/gui/choicebox.d.ts +33 -0
- package/dist/backends/gui/choicebox.d.ts.map +1 -0
- package/dist/backends/gui/choicebox.js +49 -0
- package/dist/backends/gui/choicebox.js.map +1 -0
- package/dist/backends/gui/code-block.cjs +120 -0
- package/dist/backends/gui/code-block.d.ts +22 -0
- package/dist/backends/gui/code-block.d.ts.map +1 -0
- package/dist/backends/gui/code-block.js +118 -0
- package/dist/backends/gui/code-block.js.map +1 -0
- package/dist/backends/gui/code-editor.cjs +195 -0
- package/dist/backends/gui/code-editor.d.ts +43 -0
- package/dist/backends/gui/code-editor.d.ts.map +1 -0
- package/dist/backends/gui/code-editor.js +160 -0
- package/dist/backends/gui/code-editor.js.map +1 -0
- package/dist/backends/gui/code-tabs.cjs +21 -0
- package/dist/backends/gui/code-tabs.d.ts +22 -0
- package/dist/backends/gui/code-tabs.d.ts.map +1 -0
- package/dist/backends/gui/code-tabs.js +19 -0
- package/dist/backends/gui/code-tabs.js.map +1 -0
- package/dist/backends/gui/color-picker.cjs +141 -0
- package/dist/backends/gui/color-picker.d.ts +25 -0
- package/dist/backends/gui/color-picker.d.ts.map +1 -0
- package/dist/backends/gui/color-picker.js +139 -0
- package/dist/backends/gui/color-picker.js.map +1 -0
- package/dist/backends/gui/combobox.cjs +42 -0
- package/dist/backends/gui/combobox.d.ts +39 -0
- package/dist/backends/gui/combobox.d.ts.map +1 -0
- package/dist/backends/gui/combobox.js +40 -0
- package/dist/backends/gui/combobox.js.map +1 -0
- package/dist/backends/gui/company-profile.cjs +43 -0
- package/dist/backends/gui/company-profile.d.ts +33 -0
- package/dist/backends/gui/company-profile.d.ts.map +1 -0
- package/dist/backends/gui/company-profile.js +41 -0
- package/dist/backends/gui/company-profile.js.map +1 -0
- package/dist/backends/gui/comparison.cjs +43 -0
- package/dist/backends/gui/comparison.d.ts +16 -0
- package/dist/backends/gui/comparison.d.ts.map +1 -0
- package/dist/backends/gui/comparison.js +41 -0
- package/dist/backends/gui/comparison.js.map +1 -0
- package/dist/backends/gui/credit-card.cjs +80 -0
- package/dist/backends/gui/credit-card.d.ts +21 -0
- package/dist/backends/gui/credit-card.d.ts.map +1 -0
- package/dist/backends/gui/credit-card.js +78 -0
- package/dist/backends/gui/credit-card.js.map +1 -0
- package/dist/backends/gui/crypto-market.cjs +128 -0
- package/dist/backends/gui/crypto-market.d.ts +52 -0
- package/dist/backends/gui/crypto-market.d.ts.map +1 -0
- package/dist/backends/gui/crypto-market.js +126 -0
- package/dist/backends/gui/crypto-market.js.map +1 -0
- package/dist/backends/gui/crypto-screener.cjs +55 -0
- package/dist/backends/gui/crypto-screener.d.ts +42 -0
- package/dist/backends/gui/crypto-screener.d.ts.map +1 -0
- package/dist/backends/gui/crypto-screener.js +53 -0
- package/dist/backends/gui/crypto-screener.js.map +1 -0
- package/dist/backends/gui/cursor.cjs +40 -0
- package/dist/backends/gui/cursor.d.ts +16 -0
- package/dist/backends/gui/cursor.d.ts.map +1 -0
- package/dist/backends/gui/cursor.js +38 -0
- package/dist/backends/gui/cursor.js.map +1 -0
- package/dist/backends/gui/data-table.cjs +211 -0
- package/dist/backends/gui/data-table.d.ts +71 -0
- package/dist/backends/gui/data-table.d.ts.map +1 -0
- package/dist/backends/gui/data-table.js +175 -0
- package/dist/backends/gui/data-table.js.map +1 -0
- package/dist/backends/gui/date-picker.cjs +66 -0
- package/dist/backends/gui/date-picker.d.ts +29 -0
- package/dist/backends/gui/date-picker.d.ts.map +1 -0
- package/dist/backends/gui/date-picker.js +64 -0
- package/dist/backends/gui/date-picker.js.map +1 -0
- package/dist/backends/gui/desktop-spotlight.cjs +46 -0
- package/dist/backends/gui/desktop-spotlight.d.ts +34 -0
- package/dist/backends/gui/desktop-spotlight.d.ts.map +1 -0
- package/dist/backends/gui/desktop-spotlight.js +44 -0
- package/dist/backends/gui/desktop-spotlight.js.map +1 -0
- package/dist/backends/gui/desktop-window.cjs +180 -0
- package/dist/backends/gui/desktop-window.d.ts +51 -0
- package/dist/backends/gui/desktop-window.d.ts.map +1 -0
- package/dist/backends/gui/desktop-window.js +177 -0
- package/dist/backends/gui/desktop-window.js.map +1 -0
- package/dist/backends/gui/desktop.cjs +238 -0
- package/dist/backends/gui/desktop.d.ts +109 -0
- package/dist/backends/gui/desktop.d.ts.map +1 -0
- package/dist/backends/gui/desktop.js +199 -0
- package/dist/backends/gui/desktop.js.map +1 -0
- package/dist/backends/gui/dialog-stack.cjs +26 -0
- package/dist/backends/gui/dialog-stack.d.ts +23 -0
- package/dist/backends/gui/dialog-stack.d.ts.map +1 -0
- package/dist/backends/gui/dialog-stack.js +24 -0
- package/dist/backends/gui/dialog-stack.js.map +1 -0
- package/dist/backends/gui/dock.cjs +99 -0
- package/dist/backends/gui/dock.d.ts +41 -0
- package/dist/backends/gui/dock.d.ts.map +1 -0
- package/dist/backends/gui/dock.js +96 -0
- package/dist/backends/gui/dock.js.map +1 -0
- package/dist/backends/gui/dropzone.cjs +142 -0
- package/dist/backends/gui/dropzone.d.ts +12 -0
- package/dist/backends/gui/dropzone.d.ts.map +1 -0
- package/dist/backends/gui/dropzone.js +140 -0
- package/dist/backends/gui/dropzone.js.map +1 -0
- package/dist/backends/gui/editor.cjs +80 -0
- package/dist/backends/gui/editor.d.ts +23 -0
- package/dist/backends/gui/editor.d.ts.map +1 -0
- package/dist/backends/gui/editor.js +45 -0
- package/dist/backends/gui/editor.js.map +1 -0
- package/dist/backends/gui/empty.cjs +71 -0
- package/dist/backends/gui/empty.d.ts +43 -0
- package/dist/backends/gui/empty.d.ts.map +1 -0
- package/dist/backends/gui/empty.js +63 -0
- package/dist/backends/gui/empty.js.map +1 -0
- package/dist/backends/gui/financials.cjs +45 -0
- package/dist/backends/gui/financials.d.ts +36 -0
- package/dist/backends/gui/financials.d.ts.map +1 -0
- package/dist/backends/gui/financials.js +43 -0
- package/dist/backends/gui/financials.js.map +1 -0
- package/dist/backends/gui/forex-market.cjs +21 -0
- package/dist/backends/gui/forex-market.d.ts +17 -0
- package/dist/backends/gui/forex-market.d.ts.map +1 -0
- package/dist/backends/gui/forex-market.js +19 -0
- package/dist/backends/gui/forex-market.js.map +1 -0
- package/dist/backends/gui/forex-screener.cjs +57 -0
- package/dist/backends/gui/forex-screener.d.ts +45 -0
- package/dist/backends/gui/forex-screener.d.ts.map +1 -0
- package/dist/backends/gui/forex-screener.js +55 -0
- package/dist/backends/gui/forex-screener.js.map +1 -0
- package/dist/backends/gui/gantt.cjs +50 -0
- package/dist/backends/gui/gantt.d.ts +19 -0
- package/dist/backends/gui/gantt.d.ts.map +1 -0
- package/dist/backends/gui/gantt.js +49 -0
- package/dist/backends/gui/gantt.js.map +1 -0
- package/dist/backends/gui/index.cjs +108 -1
- package/dist/backends/gui/index.d.ts +41 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +41 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/canvas.cjs +3 -3
- package/dist/canvas.js +3 -3
- package/dist/canvas.js.map +1 -1
- package/dist/gallery.html +2 -2
- package/dist/grid.cjs +19 -43
- package/dist/grid.d.ts +36 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +19 -43
- package/dist/grid.js.map +1 -1
- package/dist/index.cjs +70 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +70 -1
- package/dist/index.node.js +3 -0
- package/dist/product/ChunkGuard.cjs +58 -0
- package/dist/product/ChunkGuard.d.ts +7 -0
- package/dist/product/ChunkGuard.d.ts.map +1 -0
- package/dist/product/ChunkGuard.js +56 -0
- package/dist/product/ChunkGuard.js.map +1 -0
- package/dist/product/DetailPane.cjs +46 -0
- package/dist/product/DetailPane.d.ts +47 -0
- package/dist/product/DetailPane.d.ts.map +1 -0
- package/dist/product/DetailPane.js +43 -0
- package/dist/product/DetailPane.js.map +1 -0
- package/dist/product/Fact.cjs +19 -0
- package/dist/product/Fact.d.ts +23 -0
- package/dist/product/Fact.d.ts.map +1 -0
- package/dist/product/Fact.js +17 -0
- package/dist/product/Fact.js.map +1 -0
- package/dist/product/chunkGuard.logic.cjs +54 -0
- package/dist/product/chunkGuard.logic.d.ts +26 -0
- package/dist/product/chunkGuard.logic.d.ts.map +1 -0
- package/dist/product/chunkGuard.logic.js +49 -0
- package/dist/product/chunkGuard.logic.js.map +1 -0
- package/dist/product/index.cjs +10 -0
- package/dist/product/index.d.ts +3 -0
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +10 -0
- package/dist/product/index.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Combobox = Combobox;
|
|
5
|
+
exports.ComboboxWithIcons = ComboboxWithIcons;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Combobox — a searchable single-select built from `Popover` + `Command`.
|
|
9
|
+
*
|
|
10
|
+
* A `Button` trigger shows the selected option's label (or a placeholder), a
|
|
11
|
+
* filterable list drops from it, and picking an already-selected row clears
|
|
12
|
+
* the value. `Popover` owns open state, `Command` owns the search/selection
|
|
13
|
+
* state machine — this file is composition, not a new primitive.
|
|
14
|
+
*/
|
|
15
|
+
const react_1 = require("react");
|
|
16
|
+
const gui_1 = require("@hanzo/gui");
|
|
17
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
18
|
+
const button_1 = require("./button.cjs");
|
|
19
|
+
const command_1 = require("./command.cjs");
|
|
20
|
+
const popover_1 = require("./popover.cjs");
|
|
21
|
+
function Combobox({ options, value, onChange, placeholder = 'Select option...', searchPlaceholder = 'Search...', emptyText = 'No option found.', disabled, width = 200, ...contentProps }) {
|
|
22
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
23
|
+
const id = (0, react_1.useId)();
|
|
24
|
+
const selected = options.find((option) => option.value === value);
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: open, onOpenChange: setOpen, children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { "data-slot": "combobox-trigger", role: "combobox", "aria-expanded": open, "aria-controls": id, variant: "outline", disabled: disabled, width: width, justify: "space-between", children: [selected ? selected.label : placeholder, (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronsUpDown, { size: 16, opacity: 0.5, shrink: 0 })] }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { id: id, "data-slot": "combobox-content", p: 0, width: width, ...contentProps, children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: searchPlaceholder }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: emptyText }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: options.map((option) => ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { value: option.value, onSelect: (current) => {
|
|
26
|
+
onChange?.(current === value ? '' : current);
|
|
27
|
+
setOpen(false);
|
|
28
|
+
}, children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 16, opacity: option.value === value ? 1 : 0, shrink: 0 }), option.label] }, option.value))) })] })] }) })] }));
|
|
29
|
+
}
|
|
30
|
+
function ComboboxWithIcons({ options, value, onChange, placeholder = 'Select option...', searchPlaceholder = 'Search...', emptyText = 'No option found.', disabled, width = 200, ...contentProps }) {
|
|
31
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
32
|
+
const id = (0, react_1.useId)();
|
|
33
|
+
const selected = options.find((option) => option.value === value);
|
|
34
|
+
const SelectedIcon = selected?.icon;
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: open, onOpenChange: setOpen, children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(button_1.Button, { "data-slot": "combobox-trigger", role: "combobox", "aria-expanded": open, "aria-controls": id, variant: "outline", disabled: disabled, width: width, justify: "flex-start", children: selected && SelectedIcon ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", children: [(0, jsx_runtime_1.jsx)(SelectedIcon, { size: 16 }), selected.label] })) : (placeholder) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { id: id, "data-slot": "combobox-content", p: 0, width: width, ...contentProps, children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: searchPlaceholder }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: emptyText }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: options.map((option) => {
|
|
36
|
+
const Icon = option.icon;
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { value: option.value, onSelect: (current) => {
|
|
38
|
+
onChange?.(current === value ? '' : current);
|
|
39
|
+
setOpen(false);
|
|
40
|
+
}, children: [(0, jsx_runtime_1.jsx)(Icon, { size: 16 }), option.label] }, option.value));
|
|
41
|
+
}) })] })] }) })] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combobox — a searchable single-select built from `Popover` + `Command`.
|
|
3
|
+
*
|
|
4
|
+
* A `Button` trigger shows the selected option's label (or a placeholder), a
|
|
5
|
+
* filterable list drops from it, and picking an already-selected row clears
|
|
6
|
+
* the value. `Popover` owns open state, `Command` owns the search/selection
|
|
7
|
+
* state machine — this file is composition, not a new primitive.
|
|
8
|
+
*/
|
|
9
|
+
import { type ComponentProps, type ComponentType } from 'react';
|
|
10
|
+
import { PopoverContent } from './popover.js';
|
|
11
|
+
export type ComboboxOption = {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
export type ComboboxProps = Omit<ComponentProps<typeof PopoverContent>, 'children' | 'onChange'> & {
|
|
16
|
+
options: ComboboxOption[];
|
|
17
|
+
value?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
searchPlaceholder?: string;
|
|
21
|
+
emptyText?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
declare function Combobox({ options, value, onChange, placeholder, searchPlaceholder, emptyText, disabled, width, ...contentProps }: ComboboxProps): import("react").JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* A `Combobox` row that carries an icon beside its label — the "set status"
|
|
27
|
+
* pattern where each option also draws a glyph in the trigger once picked.
|
|
28
|
+
*/
|
|
29
|
+
export type ComboboxIconOption = ComboboxOption & {
|
|
30
|
+
icon: ComponentType<{
|
|
31
|
+
size?: number;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
export type ComboboxWithIconsProps = Omit<ComboboxProps, 'options'> & {
|
|
35
|
+
options: ComboboxIconOption[];
|
|
36
|
+
};
|
|
37
|
+
declare function ComboboxWithIcons({ options, value, onChange, placeholder, searchPlaceholder, emptyText, disabled, width, ...contentProps }: ComboboxWithIconsProps): import("react").JSX.Element;
|
|
38
|
+
export { Combobox, ComboboxWithIcons };
|
|
39
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/combobox.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,aAA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EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Combobox — a searchable single-select built from `Popover` + `Command`.
|
|
5
|
+
*
|
|
6
|
+
* A `Button` trigger shows the selected option's label (or a placeholder), a
|
|
7
|
+
* filterable list drops from it, and picking an already-selected row clears
|
|
8
|
+
* the value. `Popover` owns open state, `Command` owns the search/selection
|
|
9
|
+
* state machine — this file is composition, not a new primitive.
|
|
10
|
+
*/
|
|
11
|
+
import { useId, useState } from 'react';
|
|
12
|
+
import { XStack } from '@hanzo/gui';
|
|
13
|
+
import { Check, ChevronsUpDown } from '@hanzogui/lucide-icons-2';
|
|
14
|
+
import { Button } from './button.js';
|
|
15
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from './command.js';
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from './popover.js';
|
|
17
|
+
function Combobox({ options, value, onChange, placeholder = 'Select option...', searchPlaceholder = 'Search...', emptyText = 'No option found.', disabled, width = 200, ...contentProps }) {
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const id = useId();
|
|
20
|
+
const selected = options.find((option) => option.value === value);
|
|
21
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { "data-slot": "combobox-trigger", role: "combobox", "aria-expanded": open, "aria-controls": id, variant: "outline", disabled: disabled, width: width, justify: "space-between", children: [selected ? selected.label : placeholder, _jsx(ChevronsUpDown, { size: 16, opacity: 0.5, shrink: 0 })] }) }), _jsx(PopoverContent, { id: id, "data-slot": "combobox-content", p: 0, width: width, ...contentProps, children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: searchPlaceholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: emptyText }), _jsx(CommandGroup, { children: options.map((option) => (_jsxs(CommandItem, { value: option.value, onSelect: (current) => {
|
|
22
|
+
onChange?.(current === value ? '' : current);
|
|
23
|
+
setOpen(false);
|
|
24
|
+
}, children: [_jsx(Check, { size: 16, opacity: option.value === value ? 1 : 0, shrink: 0 }), option.label] }, option.value))) })] })] }) })] }));
|
|
25
|
+
}
|
|
26
|
+
function ComboboxWithIcons({ options, value, onChange, placeholder = 'Select option...', searchPlaceholder = 'Search...', emptyText = 'No option found.', disabled, width = 200, ...contentProps }) {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const id = useId();
|
|
29
|
+
const selected = options.find((option) => option.value === value);
|
|
30
|
+
const SelectedIcon = selected?.icon;
|
|
31
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { "data-slot": "combobox-trigger", role: "combobox", "aria-expanded": open, "aria-controls": id, variant: "outline", disabled: disabled, width: width, justify: "flex-start", children: selected && SelectedIcon ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SelectedIcon, { size: 16 }), selected.label] })) : (placeholder) }) }), _jsx(PopoverContent, { id: id, "data-slot": "combobox-content", p: 0, width: width, ...contentProps, children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: searchPlaceholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: emptyText }), _jsx(CommandGroup, { children: options.map((option) => {
|
|
32
|
+
const Icon = option.icon;
|
|
33
|
+
return (_jsxs(CommandItem, { value: option.value, onSelect: (current) => {
|
|
34
|
+
onChange?.(current === value ? '' : current);
|
|
35
|
+
setOpen(false);
|
|
36
|
+
}, children: [_jsx(Icon, { size: 16 }), option.label] }, option.value));
|
|
37
|
+
}) })] })] }) })] }));
|
|
38
|
+
}
|
|
39
|
+
export { Combobox, ComboboxWithIcons };
|
|
40
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","s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,KAAK,EACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE;gDACpB,QAAQ,EAAE,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;gDAC5C,OAAO,CAAC,KAAK,CAAC,CAAA;4CAChB,CAAC,aAED,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,GAAI,EACjB,MAAM,CAAC,KAAK,KARR,MAAM,CAAC,KAAK,CASL,CACf,CAAA;oCACH,CAAC,CAAC,GACW,IACH,IACN,GACK,IACT,CACX,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CompanyProfile = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* CompanyProfile — a TradingView company-profile widget for one symbol, in a
|
|
8
|
+
* gui frame.
|
|
9
|
+
*
|
|
10
|
+
* The description, sector, and shareholder rows are TradingView's, drawn
|
|
11
|
+
* inside TradingView's own document, so the widget is an `<iframe>` and
|
|
12
|
+
* nothing here draws a pixel of it. What this owns is the frame around it and
|
|
13
|
+
* the settings the widget opens with — symbol, locale, theme — written into
|
|
14
|
+
* the iframe's address the way TradingView's own embed script writes them:
|
|
15
|
+
* `/embed-widget/symbol-profile/?locale=…#<settings as JSON>`. Nothing is
|
|
16
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
17
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
18
|
+
*
|
|
19
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
20
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
21
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
22
|
+
* widget on screen.
|
|
23
|
+
*/
|
|
24
|
+
const gui_1 = require("@hanzo/gui");
|
|
25
|
+
const slot_1 = require("./slot.cjs");
|
|
26
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/symbol-profile/?locale=';
|
|
27
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
28
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', height = 400, locale = 'en', colorTheme = 'dark', isTransparent = false, }) => ({
|
|
29
|
+
symbol,
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
colorTheme,
|
|
33
|
+
isTransparent,
|
|
34
|
+
});
|
|
35
|
+
const CompanyProfile = ({ symbol, width, height, locale = 'en', colorTheme, isTransparent, ...props }) => {
|
|
36
|
+
const s = settings({ symbol, width, height, locale, colorTheme, isTransparent });
|
|
37
|
+
const src = `${EMBED}${locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('company-profile'), "data-symbol": s.symbol, "data-color-theme": s.colorTheme,
|
|
39
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
40
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
41
|
+
width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: gui_1.isWeb && ((0, jsx_runtime_1.jsx)("iframe", { src: src, title: `${s.symbol} company profile`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
42
|
+
};
|
|
43
|
+
exports.CompanyProfile = CompanyProfile;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompanyProfile — a TradingView company-profile widget for one symbol, in a
|
|
3
|
+
* gui frame.
|
|
4
|
+
*
|
|
5
|
+
* The description, sector, and shareholder rows are TradingView's, drawn
|
|
6
|
+
* inside TradingView's own document, so the widget is an `<iframe>` and
|
|
7
|
+
* nothing here draws a pixel of it. What this owns is the frame around it and
|
|
8
|
+
* the settings the widget opens with — symbol, locale, theme — written into
|
|
9
|
+
* the iframe's address the way TradingView's own embed script writes them:
|
|
10
|
+
* `/embed-widget/symbol-profile/?locale=…#<settings as JSON>`. Nothing is
|
|
11
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
12
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
13
|
+
*
|
|
14
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
15
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
16
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
17
|
+
* widget on screen.
|
|
18
|
+
*/
|
|
19
|
+
import { type YStackProps } from '@hanzo/gui';
|
|
20
|
+
export type CompanyProfileTheme = 'light' | 'dark';
|
|
21
|
+
export interface CompanyProfileProps extends Omit<YStackProps, 'width' | 'height' | 'colorTheme'> {
|
|
22
|
+
/** The symbol to describe, exchange-qualified. */
|
|
23
|
+
symbol?: string;
|
|
24
|
+
width?: string | number;
|
|
25
|
+
height?: string | number;
|
|
26
|
+
locale?: string;
|
|
27
|
+
/** The widget's own palette; independent of the surrounding gui theme. */
|
|
28
|
+
colorTheme?: CompanyProfileTheme;
|
|
29
|
+
isTransparent?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const CompanyProfile: ({ symbol, width, height, locale, colorTheme, isTransparent, ...props }: CompanyProfileProps) => import("react").JSX.Element;
|
|
32
|
+
export { CompanyProfile };
|
|
33
|
+
//# sourceMappingURL=company-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company-profile.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/company-profile.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAA;AAElD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC/F,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAoBD,QAAA,MAAM,cAAc,2EAQjB,mBAAmB,gCA6BrB,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* CompanyProfile — a TradingView company-profile widget for one symbol, in a
|
|
5
|
+
* gui frame.
|
|
6
|
+
*
|
|
7
|
+
* The description, sector, and shareholder rows are TradingView's, drawn
|
|
8
|
+
* inside TradingView's own document, so the widget is an `<iframe>` and
|
|
9
|
+
* nothing here draws a pixel of it. What this owns is the frame around it and
|
|
10
|
+
* the settings the widget opens with — symbol, locale, theme — written into
|
|
11
|
+
* the iframe's address the way TradingView's own embed script writes them:
|
|
12
|
+
* `/embed-widget/symbol-profile/?locale=…#<settings as JSON>`. Nothing is
|
|
13
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
14
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
15
|
+
*
|
|
16
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
17
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
18
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
19
|
+
* widget on screen.
|
|
20
|
+
*/
|
|
21
|
+
import { YStack, isWeb } from '@hanzo/gui';
|
|
22
|
+
import { slot } from './slot.js';
|
|
23
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/symbol-profile/?locale=';
|
|
24
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
25
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', height = 400, locale = 'en', colorTheme = 'dark', isTransparent = false, }) => ({
|
|
26
|
+
symbol,
|
|
27
|
+
width,
|
|
28
|
+
height,
|
|
29
|
+
colorTheme,
|
|
30
|
+
isTransparent,
|
|
31
|
+
});
|
|
32
|
+
const CompanyProfile = ({ symbol, width, height, locale = 'en', colorTheme, isTransparent, ...props }) => {
|
|
33
|
+
const s = settings({ symbol, width, height, locale, colorTheme, isTransparent });
|
|
34
|
+
const src = `${EMBED}${locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
35
|
+
return (_jsx(YStack, { ...slot('company-profile'), "data-symbol": s.symbol, "data-color-theme": s.colorTheme,
|
|
36
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
37
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
38
|
+
width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: `${s.symbol} company profile`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
39
|
+
};
|
|
40
|
+
export { CompanyProfile };
|
|
41
|
+
//# sourceMappingURL=company-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company-profile.js","sourceRoot":"","sources":["../../../src/backends/gui/company-profile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAe7B,MAAM,KAAK,GAAG,yEAAyE,CAAA;AAEvF,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,EAChB,MAAM,GAAG,aAAa,EACtB,KAAK,GAAG,MA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,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Comparison = Comparison;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* Comparison — a pricing/feature table laid out as one column per plan.
|
|
8
|
+
*
|
|
9
|
+
* Each column lists the same rows in the same order; a row's value is either a
|
|
10
|
+
* boolean (rendered as a check or a cross) or a string (rendered as text), so
|
|
11
|
+
* a caller mixes "Users: 25" with "Support: yes" in one column without two
|
|
12
|
+
* component shapes. `highlighted` marks the plan the table wants to sell.
|
|
13
|
+
*
|
|
14
|
+
* Layout is `../../grid`'s real CSS grid — equal tracks, one per column — with
|
|
15
|
+
* `YStack`/`XStack` for the card and its rows.
|
|
16
|
+
*/
|
|
17
|
+
const gui_1 = require("@hanzo/gui");
|
|
18
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
19
|
+
const grid_1 = require("../../grid.cjs");
|
|
20
|
+
const slot_1 = require("./slot.cjs");
|
|
21
|
+
const ICON = 20;
|
|
22
|
+
const Card = (0, gui_1.styled)(gui_1.YStack, {
|
|
23
|
+
name: 'ComparisonColumn',
|
|
24
|
+
p: '$5',
|
|
25
|
+
rounded: '$4',
|
|
26
|
+
borderWidth: 1,
|
|
27
|
+
borderColor: '$borderColor',
|
|
28
|
+
gap: '$4',
|
|
29
|
+
variants: {
|
|
30
|
+
highlighted: {
|
|
31
|
+
true: {
|
|
32
|
+
borderColor: '$color9',
|
|
33
|
+
shadowColor: '$shadowColor',
|
|
34
|
+
shadowRadius: 12,
|
|
35
|
+
shadowOffset: { width: 0, height: 4 },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const Row = ({ item }) => ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('comparison-item'), items: "center", gap: "$3", children: [typeof item.value === 'boolean' ? (item.value ? ((0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { ...(0, slot_1.slot)('comparison-item-check'), size: ICON, color: "$green9" })) : ((0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, { ...(0, slot_1.slot)('comparison-item-cross'), size: ICON, color: "$red9" }))) : ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { ...(0, slot_1.slot)('comparison-item-value'), fontWeight: "600", children: item.value })), (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$3", children: item.label })] }));
|
|
41
|
+
function Comparison({ columns }) {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...(0, slot_1.slot)('comparison'), style: { overflowX: 'auto' }, children: (0, jsx_runtime_1.jsx)(grid_1.Grid, { columns: columns.length, gap: "$4", children: columns.map((column, index) => ((0, jsx_runtime_1.jsxs)(Card, { ...(0, slot_1.slot)('comparison-column'), "data-highlighted": column.highlighted ? '' : undefined, highlighted: column.highlighted, children: [(0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$6", fontWeight: "600", children: column.title }), (0, jsx_runtime_1.jsx)(gui_1.YStack, { gap: "$3", children: column.items.map((item, itemIndex) => ((0, jsx_runtime_1.jsx)(Row, { item: item }, item.label || itemIndex))) })] }, column.title || index))) }) }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ComparisonItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: boolean | string;
|
|
4
|
+
}
|
|
5
|
+
export interface ComparisonColumn {
|
|
6
|
+
title: string;
|
|
7
|
+
items: ComparisonItem[];
|
|
8
|
+
/** Marks the plan the table wants to sell: a raised border and shadow. */
|
|
9
|
+
highlighted?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ComparisonProps {
|
|
12
|
+
columns: ComparisonColumn[];
|
|
13
|
+
children?: never;
|
|
14
|
+
}
|
|
15
|
+
export declare function Comparison({ columns }: ComparisonProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB;AA6CD,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,eAAe,+BAwBtD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Comparison — a pricing/feature table laid out as one column per plan.
|
|
5
|
+
*
|
|
6
|
+
* Each column lists the same rows in the same order; a row's value is either a
|
|
7
|
+
* boolean (rendered as a check or a cross) or a string (rendered as text), so
|
|
8
|
+
* a caller mixes "Users: 25" with "Support: yes" in one column without two
|
|
9
|
+
* component shapes. `highlighted` marks the plan the table wants to sell.
|
|
10
|
+
*
|
|
11
|
+
* Layout is `../../grid`'s real CSS grid — equal tracks, one per column — with
|
|
12
|
+
* `YStack`/`XStack` for the card and its rows.
|
|
13
|
+
*/
|
|
14
|
+
import { SizableText, YStack, XStack, styled } from '@hanzo/gui';
|
|
15
|
+
import { Check, X } from '@hanzogui/lucide-icons-2';
|
|
16
|
+
import { Grid } from '../../grid.js';
|
|
17
|
+
import { slot } from './slot.js';
|
|
18
|
+
const ICON = 20;
|
|
19
|
+
const Card = styled(YStack, {
|
|
20
|
+
name: 'ComparisonColumn',
|
|
21
|
+
p: '$5',
|
|
22
|
+
rounded: '$4',
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
borderColor: '$borderColor',
|
|
25
|
+
gap: '$4',
|
|
26
|
+
variants: {
|
|
27
|
+
highlighted: {
|
|
28
|
+
true: {
|
|
29
|
+
borderColor: '$color9',
|
|
30
|
+
shadowColor: '$shadowColor',
|
|
31
|
+
shadowRadius: 12,
|
|
32
|
+
shadowOffset: { width: 0, height: 4 },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const Row = ({ item }) => (_jsxs(XStack, { ...slot('comparison-item'), items: "center", gap: "$3", children: [typeof item.value === 'boolean' ? (item.value ? (_jsx(Check, { ...slot('comparison-item-check'), size: ICON, color: "$green9" })) : (_jsx(X, { ...slot('comparison-item-cross'), size: ICON, color: "$red9" }))) : (_jsx(SizableText, { ...slot('comparison-item-value'), fontWeight: "600", children: item.value })), _jsx(SizableText, { size: "$3", children: item.label })] }));
|
|
38
|
+
export function Comparison({ columns }) {
|
|
39
|
+
return (_jsx("div", { ...slot('comparison'), style: { overflowX: 'auto' }, children: _jsx(Grid, { columns: columns.length, gap: "$4", children: columns.map((column, index) => (_jsxs(Card, { ...slot('comparison-column'), "data-highlighted": column.highlighted ? '' : undefined, highlighted: column.highlighted, children: [_jsx(SizableText, { size: "$6", fontWeight: "600", children: column.title }), _jsx(YStack, { gap: "$3", children: column.items.map((item, itemIndex) => (_jsx(Row, { item: item }, item.label || itemIndex))) })] }, column.title || index))) }) }));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=comparison.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison.js","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;GAUG;AACH,O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ACF,KAAC,WAAW,OAAK,IAAI,CAAC,uBAAuB,CAAC,EAAE,UAAU,EAAC,KAAK,YAC7D,IAAI,CAAC,KAAK,GACC,CACf,EACD,KAAC,WAAW,IAAC,IAAI,EAAC,IAAI,YAAE,IAAI,CAAC,KAAK,GAAe,IAC1C,CACV,CAAA;AAED,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAmB;IACrD,OAAO,CACL,iBAAS,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,YACvD,KAAC,IAAI,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAC,IAAI,YACpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,MAAC,IAAI,OAEC,IAAI,CAAC,mBAAmB,CAAC,sBACX,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EACrD,WAAW,EAAE,MAAM,CAAC,WAAW,aAE/B,KAAC,WAAW,IAAC,IAAI,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,YACpC,MAAM,CAAC,KAAK,GACD,EACd,KAAC,MAAM,IAAC,GAAG,EAAC,IAAI,YACb,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CACrC,KAAC,GAAG,IAA+B,IAAI,EAAE,IAAI,IAAnC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAgB,CAClD,CAAC,GACK,KAZJ,MAAM,CAAC,KAAK,IAAI,KAAK,CAarB,CACR,CAAC,GACG,GACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CreditCard = CreditCard;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* CreditCard — a payment-card face at the standard 1.586:1 ratio, showing a
|
|
8
|
+
* number, a holder name, an expiry and an optional CVV.
|
|
9
|
+
*
|
|
10
|
+
* `default` is a dark plate (a chip icon, the number, holder and expiry);
|
|
11
|
+
* `minimal` is the same layout on a bordered surface, for a page that already
|
|
12
|
+
* carries its own color.
|
|
13
|
+
*/
|
|
14
|
+
const gui_1 = require("@hanzo/gui");
|
|
15
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
16
|
+
const slot_1 = require("./slot.cjs");
|
|
17
|
+
const RATIO = 1.586;
|
|
18
|
+
const Frame = (0, gui_1.styled)(gui_1.YStack, {
|
|
19
|
+
name: 'CreditCard',
|
|
20
|
+
position: 'relative',
|
|
21
|
+
width: '100%',
|
|
22
|
+
maxW: 384,
|
|
23
|
+
rounded: '$6',
|
|
24
|
+
p: '$6',
|
|
25
|
+
justify: 'space-between',
|
|
26
|
+
variants: {
|
|
27
|
+
variant: {
|
|
28
|
+
default: {
|
|
29
|
+
bg: '$ink',
|
|
30
|
+
borderWidth: 0,
|
|
31
|
+
shadowColor: '$dim',
|
|
32
|
+
shadowRadius: 24,
|
|
33
|
+
shadowOpacity: 0.35,
|
|
34
|
+
},
|
|
35
|
+
minimal: {
|
|
36
|
+
bg: '$background',
|
|
37
|
+
borderWidth: 2,
|
|
38
|
+
borderColor: '$borderColor',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: { variant: 'default' },
|
|
43
|
+
});
|
|
44
|
+
const Row = (0, gui_1.styled)(gui_1.XStack, { name: 'CreditCardRow', justify: 'space-between', items: 'flex-start' });
|
|
45
|
+
const Label = (0, gui_1.styled)(gui_1.SizableText, {
|
|
46
|
+
name: 'CreditCardLabel',
|
|
47
|
+
size: '$1',
|
|
48
|
+
variants: {
|
|
49
|
+
variant: {
|
|
50
|
+
default: { color: '$sunken', opacity: 0.7 },
|
|
51
|
+
minimal: { color: '$quiet' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const Value = (0, gui_1.styled)(gui_1.SizableText, {
|
|
56
|
+
name: 'CreditCardValue',
|
|
57
|
+
size: '$3',
|
|
58
|
+
fontWeight: '600',
|
|
59
|
+
variants: {
|
|
60
|
+
variant: {
|
|
61
|
+
default: { color: '$sunken' },
|
|
62
|
+
minimal: { color: '$color' },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const Number = (0, gui_1.styled)(gui_1.SizableText, {
|
|
67
|
+
name: 'CreditCardNumber',
|
|
68
|
+
size: '$5',
|
|
69
|
+
letterSpacing: 3,
|
|
70
|
+
variants: {
|
|
71
|
+
variant: {
|
|
72
|
+
default: { color: '$sunken' },
|
|
73
|
+
minimal: { color: '$color' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
function CreditCard({ number = '•••• •••• •••• ••••', name = 'CARD HOLDER', expiry = 'MM/YY', cvv, variant = 'default', ...props }) {
|
|
78
|
+
const resolved = variant ?? 'default';
|
|
79
|
+
return ((0, jsx_runtime_1.jsxs)(Frame, { ...(0, slot_1.slot)('credit-card'), "data-variant": resolved, variant: resolved, aspectRatio: RATIO, ...props, children: [(0, jsx_runtime_1.jsxs)(Row, { children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.CreditCard, { size: 40, color: resolved === 'default' ? '$sunken' : '$ink' }), cvv && ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('credit-card-cvv'), bg: resolved === 'default' ? '$hover' : '$panel', rounded: "$2", px: "$2", py: "$1", children: (0, jsx_runtime_1.jsxs)(Label, { ...(0, slot_1.slot)('credit-card-cvv-value'), variant: resolved, children: ["CVV: ", cvv] }) }))] }), (0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$4", children: [(0, jsx_runtime_1.jsx)(Number, { ...(0, slot_1.slot)('credit-card-number'), variant: resolved, children: number }), (0, jsx_runtime_1.jsxs)(Row, { items: "flex-end", children: [(0, jsx_runtime_1.jsxs)(gui_1.YStack, { children: [(0, jsx_runtime_1.jsx)(Label, { variant: resolved, children: "Card Holder" }), (0, jsx_runtime_1.jsx)(Value, { ...(0, slot_1.slot)('credit-card-name'), variant: resolved, children: name })] }), (0, jsx_runtime_1.jsxs)(gui_1.YStack, { items: "flex-end", children: [(0, jsx_runtime_1.jsx)(Label, { variant: resolved, children: "Expires" }), (0, jsx_runtime_1.jsx)(Value, { ...(0, slot_1.slot)('credit-card-expiry'), variant: resolved, children: expiry })] })] })] })] }));
|
|
80
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
export type CreditCardVariant = 'default' | 'minimal';
|
|
3
|
+
declare const Frame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
4
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
5
|
+
fullscreen?: boolean | undefined;
|
|
6
|
+
variant?: "default" | "minimal" | undefined;
|
|
7
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
8
|
+
export type CreditCardProps = Omit<ComponentProps<typeof Frame>, 'variant' | 'children'> & {
|
|
9
|
+
/** The card number, formatted or masked by the caller. */
|
|
10
|
+
number?: string;
|
|
11
|
+
/** The name printed on the card. */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** MM/YY expiry, printed as given. */
|
|
14
|
+
expiry?: string;
|
|
15
|
+
/** Security code, shown only when set. */
|
|
16
|
+
cvv?: string;
|
|
17
|
+
variant?: CreditCardVariant | null;
|
|
18
|
+
};
|
|
19
|
+
export declare function CreditCard({ number, name, expiry, cvv, variant, ...props }: CreditCardProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=credit-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-card.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/credit-card.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAA;AAIrD,QAAA,MAAM,KAAK;;;;8CA2BT,CAAA;AA0CF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IACzF,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACnC,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,MAA8B,EAC9B,IAAoB,EACpB,MAAgB,EAChB,GAAG,EACH,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,eAAe,+BAgDjB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* CreditCard — a payment-card face at the standard 1.586:1 ratio, showing a
|
|
5
|
+
* number, a holder name, an expiry and an optional CVV.
|
|
6
|
+
*
|
|
7
|
+
* `default` is a dark plate (a chip icon, the number, holder and expiry);
|
|
8
|
+
* `minimal` is the same layout on a bordered surface, for a page that already
|
|
9
|
+
* carries its own color.
|
|
10
|
+
*/
|
|
11
|
+
import { SizableText, XStack, YStack, styled } from '@hanzo/gui';
|
|
12
|
+
import { CreditCard as CreditCardIcon } from '@hanzogui/lucide-icons-2';
|
|
13
|
+
import { slot } from './slot.js';
|
|
14
|
+
const RATIO = 1.586;
|
|
15
|
+
const Frame = styled(YStack, {
|
|
16
|
+
name: 'CreditCard',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
width: '100%',
|
|
19
|
+
maxW: 384,
|
|
20
|
+
rounded: '$6',
|
|
21
|
+
p: '$6',
|
|
22
|
+
justify: 'space-between',
|
|
23
|
+
variants: {
|
|
24
|
+
variant: {
|
|
25
|
+
default: {
|
|
26
|
+
bg: '$ink',
|
|
27
|
+
borderWidth: 0,
|
|
28
|
+
shadowColor: '$dim',
|
|
29
|
+
shadowRadius: 24,
|
|
30
|
+
shadowOpacity: 0.35,
|
|
31
|
+
},
|
|
32
|
+
minimal: {
|
|
33
|
+
bg: '$background',
|
|
34
|
+
borderWidth: 2,
|
|
35
|
+
borderColor: '$borderColor',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: { variant: 'default' },
|
|
40
|
+
});
|
|
41
|
+
const Row = styled(XStack, { name: 'CreditCardRow', justify: 'space-between', items: 'flex-start' });
|
|
42
|
+
const Label = styled(SizableText, {
|
|
43
|
+
name: 'CreditCardLabel',
|
|
44
|
+
size: '$1',
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
default: { color: '$sunken', opacity: 0.7 },
|
|
48
|
+
minimal: { color: '$quiet' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const Value = styled(SizableText, {
|
|
53
|
+
name: 'CreditCardValue',
|
|
54
|
+
size: '$3',
|
|
55
|
+
fontWeight: '600',
|
|
56
|
+
variants: {
|
|
57
|
+
variant: {
|
|
58
|
+
default: { color: '$sunken' },
|
|
59
|
+
minimal: { color: '$color' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
const Number = styled(SizableText, {
|
|
64
|
+
name: 'CreditCardNumber',
|
|
65
|
+
size: '$5',
|
|
66
|
+
letterSpacing: 3,
|
|
67
|
+
variants: {
|
|
68
|
+
variant: {
|
|
69
|
+
default: { color: '$sunken' },
|
|
70
|
+
minimal: { color: '$color' },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
export function CreditCard({ number = '•••• •••• •••• ••••', name = 'CARD HOLDER', expiry = 'MM/YY', cvv, variant = 'default', ...props }) {
|
|
75
|
+
const resolved = variant ?? 'default';
|
|
76
|
+
return (_jsxs(Frame, { ...slot('credit-card'), "data-variant": resolved, variant: resolved, aspectRatio: RATIO, ...props, children: [_jsxs(Row, { children: [_jsx(CreditCardIcon, { size: 40, color: resolved === 'default' ? '$sunken' : '$ink' }), cvv && (_jsx(XStack, { ...slot('credit-card-cvv'), bg: resolved === 'default' ? '$hover' : '$panel', rounded: "$2", px: "$2", py: "$1", children: _jsxs(Label, { ...slot('credit-card-cvv-value'), variant: resolved, children: ["CVV: ", cvv] }) }))] }), _jsxs(YStack, { gap: "$4", children: [_jsx(Number, { ...slot('credit-card-number'), variant: resolved, children: number }), _jsxs(Row, { items: "flex-end", children: [_jsxs(YStack, { children: [_jsx(Label, { variant: resolved, children: "Card Holder" }), _jsx(Value, { ...slot('credit-card-name'), variant: resolved, children: name })] }), _jsxs(YStack, { items: "flex-end", children: [_jsx(Label, { variant: resolved, children: "Expires" }), _jsx(Value, { ...slot('credit-card-expiry'), variant: resolved, children: expiry })] })] })] })] }));
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=credit-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-card.js","sourceRoot":"","sources":["../../../src/backends/gui/credit-card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAA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