@heigin/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +15 -0
- package/README.md +28 -2
- package/dist/base.css +44 -0
- package/dist/components/crm/activity-timeline.d.ts +23 -0
- package/dist/components/crm/activity-timeline.js +41 -0
- package/dist/components/crm/approval-card.d.ts +33 -0
- package/dist/components/crm/approval-card.js +101 -0
- package/dist/components/crm/channel-mark.d.ts +10 -0
- package/dist/components/crm/channel-mark.js +57 -0
- package/dist/components/crm/conversation-list-item.d.ts +23 -0
- package/dist/components/crm/conversation-list-item.js +62 -0
- package/dist/components/crm/crm.module.js +161 -0
- package/dist/components/crm/deal-stage.d.ts +13 -0
- package/dist/components/crm/deal-stage.js +27 -0
- package/dist/components/crm/detail-list.d.ts +17 -0
- package/dist/components/crm/detail-list.js +35 -0
- package/dist/components/crm/filter-chip.d.ts +16 -0
- package/dist/components/crm/filter-chip.js +45 -0
- package/dist/components/crm/filter-toolbar.d.ts +16 -0
- package/dist/components/crm/filter-toolbar.js +42 -0
- package/dist/components/crm/metric-card.d.ts +30 -0
- package/dist/components/crm/metric-card.js +61 -0
- package/dist/components/crm/money-value.d.ts +9 -0
- package/dist/components/crm/money-value.js +27 -0
- package/dist/components/crm/page-header.d.ts +11 -0
- package/dist/components/crm/page-header.js +28 -0
- package/dist/components/crm/record-header.d.ts +22 -0
- package/dist/components/crm/record-header.js +53 -0
- package/dist/components/crm/sidebar-nav.d.ts +33 -0
- package/dist/components/crm/sidebar-nav.js +53 -0
- package/dist/components/crm/sla-clock.d.ts +11 -0
- package/dist/components/crm/sla-clock.js +41 -0
- package/dist/components/crm/status-badge.d.ts +94 -0
- package/dist/components/crm/status-badge.js +106 -0
- package/dist/components/crm/task-row.d.ts +18 -0
- package/dist/components/crm/task-row.js +52 -0
- package/dist/components/crm/trust-rung-badge.d.ts +14 -0
- package/dist/components/crm/trust-rung-badge.js +35 -0
- package/dist/components/ui/alert-dialog.d.ts +22 -0
- package/dist/components/ui/alert-dialog.js +87 -0
- package/dist/components/ui/avatar.d.ts +13 -0
- package/dist/components/ui/avatar.js +38 -0
- package/dist/components/ui/avatar.module.js +17 -0
- package/dist/components/ui/badge.d.ts +12 -0
- package/dist/components/ui/badge.js +28 -0
- package/dist/components/ui/badge.module.js +25 -0
- package/dist/components/ui/button.d.ts +19 -0
- package/dist/components/ui/button.js +39 -0
- package/dist/components/ui/button.module.js +27 -0
- package/dist/components/ui/card.d.ts +19 -0
- package/dist/components/ui/card.js +35 -0
- package/dist/components/ui/card.module.js +23 -0
- package/dist/components/ui/checkbox.d.ts +11 -0
- package/dist/components/ui/checkbox.js +47 -0
- package/dist/components/ui/choice.module.js +28 -0
- package/dist/components/ui/dialog.d.ts +32 -0
- package/dist/components/ui/dialog.js +67 -0
- package/dist/components/ui/dialog.module.js +39 -0
- package/dist/components/ui/drawer.d.ts +20 -0
- package/dist/components/ui/drawer.js +44 -0
- package/dist/components/ui/dropdown-menu.d.ts +38 -0
- package/dist/components/ui/dropdown-menu.js +66 -0
- package/dist/components/ui/empty-state.d.ts +12 -0
- package/dist/components/ui/empty-state.js +33 -0
- package/dist/components/ui/empty-state.module.js +19 -0
- package/dist/components/ui/field.d.ts +38 -0
- package/dist/components/ui/field.js +77 -0
- package/dist/components/ui/field.module.js +17 -0
- package/dist/components/ui/icon-button.d.ts +9 -0
- package/dist/components/ui/icon-button.js +21 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.js +23 -0
- package/dist/components/ui/input.module.js +25 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +34 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +26 -0
- package/dist/components/ui/pagination.d.ts +13 -0
- package/dist/components/ui/pagination.js +55 -0
- package/dist/components/ui/popover.d.ts +17 -0
- package/dist/components/ui/popover.js +41 -0
- package/dist/components/ui/popup.module.js +39 -0
- package/dist/components/ui/radio-group.d.ts +18 -0
- package/dist/components/ui/radio-group.js +50 -0
- package/dist/components/ui/search-input.d.ts +15 -0
- package/dist/components/ui/search-input.js +64 -0
- package/dist/components/ui/select.d.ts +27 -0
- package/dist/components/ui/select.js +71 -0
- package/dist/components/ui/skeleton.d.ts +12 -0
- package/dist/components/ui/skeleton.js +23 -0
- package/dist/components/ui/skeleton.module.js +15 -0
- package/dist/components/ui/spinner.d.ts +8 -0
- package/dist/components/ui/spinner.js +19 -0
- package/dist/components/ui/spinner.module.js +13 -0
- package/dist/components/ui/switch.d.ts +10 -0
- package/dist/components/ui/switch.js +35 -0
- package/dist/components/ui/table.d.ts +52 -0
- package/dist/components/ui/table.js +143 -0
- package/dist/components/ui/table.module.js +42 -0
- package/dist/components/ui/tabs.d.ts +25 -0
- package/dist/components/ui/tabs.js +47 -0
- package/dist/components/ui/tabs.module.js +21 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.js +23 -0
- package/dist/components/ui/toast.d.ts +30 -0
- package/dist/components/ui/toast.js +81 -0
- package/dist/components/ui/toast.module.js +21 -0
- package/dist/components/ui/tooltip.d.ts +18 -0
- package/dist/components/ui/tooltip.js +30 -0
- package/dist/components/ui/visually-hidden.d.ts +3 -0
- package/dist/components/ui/visually-hidden.js +26 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +50 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.js +7 -0
- package/dist/lib/format.d.ts +6 -0
- package/dist/lib/format.js +33 -0
- package/dist/styles.css +2317 -0
- package/dist/tailwind.css +82 -0
- package/dist/tokens.css +131 -0
- package/dist/tokens.d.ts +339 -0
- package/dist/tokens.js +790 -0
- package/package.json +54 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import field_module_default from "./field.module.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/ui/field.tsx
|
|
8
|
+
var FieldContext = React.createContext(null);
|
|
9
|
+
/** Read the surrounding Field's ids and state. Returns `null` outside a Field. */
|
|
10
|
+
function useField() {
|
|
11
|
+
return React.useContext(FieldContext);
|
|
12
|
+
}
|
|
13
|
+
/** Merge Field-provided accessibility props with props set directly on a control. */
|
|
14
|
+
function useFieldControlProps(props) {
|
|
15
|
+
const field = useField();
|
|
16
|
+
if (!field) return props;
|
|
17
|
+
return {
|
|
18
|
+
...props,
|
|
19
|
+
id: props.id ?? field.controlId,
|
|
20
|
+
"aria-describedby": cn(field.describedBy, props["aria-describedby"]) || void 0,
|
|
21
|
+
"aria-invalid": props["aria-invalid"] ?? (field.invalid || void 0),
|
|
22
|
+
required: props.required ?? (field.required || void 0),
|
|
23
|
+
disabled: props.disabled ?? (field.disabled || void 0)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Labels a single form control and wires up `id`, `aria-describedby`, `aria-invalid`,
|
|
28
|
+
* `required` and `disabled` for HeiGin inputs placed inside it.
|
|
29
|
+
*/
|
|
30
|
+
var Field = React.forwardRef(function Field({ label, description, error, required = false, disabled = false, hideLabel = false, id, className, children, ...props }, ref) {
|
|
31
|
+
const autoId = React.useId();
|
|
32
|
+
const controlId = id ?? `hg-field-${autoId}`;
|
|
33
|
+
const descriptionId = description ? `${controlId}-description` : void 0;
|
|
34
|
+
const errorId = error ? `${controlId}-error` : void 0;
|
|
35
|
+
const value = {
|
|
36
|
+
controlId,
|
|
37
|
+
describedBy: cn(descriptionId, errorId) || void 0,
|
|
38
|
+
invalid: Boolean(error),
|
|
39
|
+
required,
|
|
40
|
+
disabled
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
ref,
|
|
44
|
+
className: cn(field_module_default.field, className),
|
|
45
|
+
"data-invalid": error ? "" : void 0,
|
|
46
|
+
"data-disabled": disabled ? "" : void 0,
|
|
47
|
+
...props,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("label", {
|
|
50
|
+
htmlFor: controlId,
|
|
51
|
+
className: cn(field_module_default.label, hideLabel && field_module_default.srOnly),
|
|
52
|
+
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: field_module_default.required,
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
children: "*"
|
|
56
|
+
})]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx(FieldContext.Provider, {
|
|
59
|
+
value,
|
|
60
|
+
children
|
|
61
|
+
}),
|
|
62
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
63
|
+
id: descriptionId,
|
|
64
|
+
className: field_module_default.description,
|
|
65
|
+
children: description
|
|
66
|
+
}),
|
|
67
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
68
|
+
id: errorId,
|
|
69
|
+
className: field_module_default.error,
|
|
70
|
+
role: "alert",
|
|
71
|
+
children: error
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
//#endregion
|
|
77
|
+
export { Field, useField, useFieldControlProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/components/ui/field.module.css
|
|
2
|
+
var field = "hg-field-module_field_zZgop";
|
|
3
|
+
var label = "hg-field-module_label_kvI4d";
|
|
4
|
+
var required = "hg-field-module_required_EgaB2";
|
|
5
|
+
var description = "hg-field-module_description_wLtmA";
|
|
6
|
+
var error = "hg-field-module_error_3UVZC";
|
|
7
|
+
var srOnly = "hg-field-module_srOnly_rcFj4";
|
|
8
|
+
var field_module_default = {
|
|
9
|
+
field,
|
|
10
|
+
label,
|
|
11
|
+
required,
|
|
12
|
+
description,
|
|
13
|
+
error,
|
|
14
|
+
srOnly
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { field_module_default as default, description, error, field, label, required, srOnly };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type ButtonProps } from "./button.js";
|
|
3
|
+
export interface IconButtonProps extends Omit<ButtonProps, "leadingIcon" | "trailingIcon" | "children" | "fullWidth"> {
|
|
4
|
+
/** Required accessible name: icon-only controls have no visible text. Also shown as a native tooltip. */
|
|
5
|
+
label: string;
|
|
6
|
+
icon: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Square, icon-only button. `label` becomes the accessible name. Defaults to the `ghost` variant. */
|
|
9
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ui/icon-button.tsx
|
|
7
|
+
/** Square, icon-only button. `label` becomes the accessible name. Defaults to the `ghost` variant. */
|
|
8
|
+
var IconButton = React.forwardRef(function IconButton({ label, icon, variant = "ghost", className, ...props }, ref) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
10
|
+
ref,
|
|
11
|
+
variant,
|
|
12
|
+
"aria-label": label,
|
|
13
|
+
title: label,
|
|
14
|
+
"data-icon-only": "",
|
|
15
|
+
className,
|
|
16
|
+
...props,
|
|
17
|
+
children: icon
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { IconButton };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
size?: "sm" | "md" | "lg";
|
|
4
|
+
/** Marks the control invalid without a Field. Inside a Field, pass `error` to the Field instead. */
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Single-line text input. Inherits id, description and error wiring from a surrounding `Field`. */
|
|
8
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { useFieldControlProps } from "./field.js";
|
|
5
|
+
import input_module_default from "./input.module.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/input.tsx
|
|
9
|
+
/** Single-line text input. Inherits id, description and error wiring from a surrounding `Field`. */
|
|
10
|
+
var Input = React.forwardRef(function Input({ size = "md", invalid, className, type = "text", ...props }, ref) {
|
|
11
|
+
const fieldProps = useFieldControlProps({
|
|
12
|
+
...props,
|
|
13
|
+
"aria-invalid": invalid || props["aria-invalid"] || void 0
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx("input", {
|
|
16
|
+
ref,
|
|
17
|
+
type,
|
|
18
|
+
className: cn(input_module_default.control, size !== "md" && input_module_default[size], className),
|
|
19
|
+
...fieldProps
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Input };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/components/ui/input.module.css
|
|
2
|
+
var control = "hg-input-module_control_RdnYI";
|
|
3
|
+
var sm = "hg-input-module_sm_5IY2B";
|
|
4
|
+
var lg = "hg-input-module_lg_sSMJv";
|
|
5
|
+
var textarea = "hg-input-module_textarea_-GW58";
|
|
6
|
+
var wrapper = "hg-input-module_wrapper_8EXfW";
|
|
7
|
+
var hasTrailing = "hg-input-module_hasTrailing_cuUAS";
|
|
8
|
+
var leading = "hg-input-module_leading_ZL-52";
|
|
9
|
+
var trailing = "hg-input-module_trailing_iqAjl";
|
|
10
|
+
var clear = "hg-input-module_clear_Dhtx6";
|
|
11
|
+
var native = "hg-input-module_native_zdXSk";
|
|
12
|
+
var input_module_default = {
|
|
13
|
+
control,
|
|
14
|
+
sm,
|
|
15
|
+
lg,
|
|
16
|
+
textarea,
|
|
17
|
+
wrapper,
|
|
18
|
+
hasTrailing,
|
|
19
|
+
leading,
|
|
20
|
+
trailing,
|
|
21
|
+
clear,
|
|
22
|
+
native
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { clear, control, input_module_default as default, hasTrailing, leading, lg, native, sm, textarea, trailing, wrapper };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/kbd.tsx
|
|
5
|
+
var kbdStyle = {
|
|
6
|
+
display: "inline-flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
minWidth: 18,
|
|
9
|
+
height: 18,
|
|
10
|
+
padding: "0 4px",
|
|
11
|
+
border: "var(--hg-border-width) solid var(--hg-color-border)",
|
|
12
|
+
borderBottomWidth: 2,
|
|
13
|
+
borderRadius: "var(--hg-radius-sm)",
|
|
14
|
+
background: "var(--hg-color-surface)",
|
|
15
|
+
color: "var(--hg-color-muted)",
|
|
16
|
+
fontFamily: "var(--hg-font-family-sans)",
|
|
17
|
+
fontSize: "var(--hg-font-size-xs)",
|
|
18
|
+
fontWeight: "var(--hg-font-weight-medium)",
|
|
19
|
+
lineHeight: 1,
|
|
20
|
+
justifyContent: "center"
|
|
21
|
+
};
|
|
22
|
+
/** Keyboard key hint, e.g. <Kbd>⌘K</Kbd>. */
|
|
23
|
+
function Kbd({ className, style, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
25
|
+
className: cn(className),
|
|
26
|
+
style: {
|
|
27
|
+
...kbdStyle,
|
|
28
|
+
...style
|
|
29
|
+
},
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { Kbd };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface NativeSelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> {
|
|
3
|
+
size?: "sm" | "md" | "lg";
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Native <select> with the input chrome — what production uses for filters ("All statuses")
|
|
8
|
+
* and form fields (Owner). Best on mobile and for long, simple lists. Use Select for rich options.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NativeSelect: React.ForwardRefExoticComponent<NativeSelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { useFieldControlProps } from "./field.js";
|
|
5
|
+
import input_module_default from "./input.module.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/native-select.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Native <select> with the input chrome — what production uses for filters ("All statuses")
|
|
11
|
+
* and form fields (Owner). Best on mobile and for long, simple lists. Use Select for rich options.
|
|
12
|
+
*/
|
|
13
|
+
var NativeSelect = React.forwardRef(function NativeSelect({ size = "md", invalid, className, children, ...props }, ref) {
|
|
14
|
+
const fieldProps = useFieldControlProps({
|
|
15
|
+
...props,
|
|
16
|
+
"aria-invalid": invalid || props["aria-invalid"] || void 0
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx("select", {
|
|
19
|
+
ref,
|
|
20
|
+
className: cn(input_module_default.control, input_module_default.native, size !== "md" && input_module_default[size], className),
|
|
21
|
+
...fieldProps,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { NativeSelect };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
/** 1-based current page. */
|
|
4
|
+
page: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
totalItems: number;
|
|
7
|
+
onPageChange: (page: number) => void;
|
|
8
|
+
/** Formats the range label. Default: "1–20 of 134". */
|
|
9
|
+
formatRange?: (from: number, to: number, total: number) => string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Previous/next pager with a live range label. Controlled. */
|
|
13
|
+
export declare function Pagination({ page, pageSize, totalItems, onPageChange, formatRange, className }: PaginationProps): React.JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { IconButton } from "./icon-button.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
8
|
+
//#region src/components/ui/pagination.tsx
|
|
9
|
+
var numberFormat = new Intl.NumberFormat("en-IN");
|
|
10
|
+
/** Previous/next pager with a live range label. Controlled. */
|
|
11
|
+
function Pagination({ page, pageSize, totalItems, onPageChange, formatRange, className }) {
|
|
12
|
+
const pageCount = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
13
|
+
const from = totalItems === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
14
|
+
const to = Math.min(page * pageSize, totalItems);
|
|
15
|
+
const label = formatRange ? formatRange(from, to, totalItems) : `${numberFormat.format(from)}–${numberFormat.format(to)} of ${numberFormat.format(totalItems)}`;
|
|
16
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
17
|
+
"aria-label": "Pagination",
|
|
18
|
+
className: cn(className),
|
|
19
|
+
style: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "flex-end",
|
|
23
|
+
gap: "var(--hg-space-2)"
|
|
24
|
+
},
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", {
|
|
27
|
+
"aria-live": "polite",
|
|
28
|
+
style: {
|
|
29
|
+
fontSize: "var(--hg-font-size-sm)",
|
|
30
|
+
color: "var(--hg-color-muted)",
|
|
31
|
+
fontVariantNumeric: "tabular-nums"
|
|
32
|
+
},
|
|
33
|
+
children: label
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
36
|
+
label: "Previous page",
|
|
37
|
+
icon: /* @__PURE__ */ jsx(ChevronLeft, { strokeWidth: 1.6 }),
|
|
38
|
+
variant: "secondary",
|
|
39
|
+
size: "sm",
|
|
40
|
+
disabled: page <= 1,
|
|
41
|
+
onClick: () => onPageChange(page - 1)
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
44
|
+
label: "Next page",
|
|
45
|
+
icon: /* @__PURE__ */ jsx(ChevronRight, { strokeWidth: 1.6 }),
|
|
46
|
+
variant: "secondary",
|
|
47
|
+
size: "sm",
|
|
48
|
+
disabled: page >= pageCount,
|
|
49
|
+
onClick: () => onPageChange(page + 1)
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Pagination };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
3
|
+
/** Root of a popover. Accepts `open`, `defaultOpen` and `onOpenChange`. */
|
|
4
|
+
export declare const Popover: typeof BasePopover.Root;
|
|
5
|
+
/** Opens the popover. Use `render={<Button />}` to render a HeiGin Button. */
|
|
6
|
+
export declare const PopoverTrigger: BasePopover.Trigger;
|
|
7
|
+
/** Closes the popover. Use `render={<Button />}` to render a HeiGin Button. */
|
|
8
|
+
export declare const PopoverClose: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export interface PopoverContentProps extends Omit<React.ComponentPropsWithoutRef<typeof BasePopover.Popup>, "className" | "title"> {
|
|
10
|
+
title?: React.ReactNode;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
13
|
+
align?: "start" | "center" | "end";
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Non-modal floating panel for small amounts of interactive content. Focus moves into it on open and returns on close. */
|
|
17
|
+
export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import popup_module_default from "./popup.module.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Popover } from "@base-ui/react/popover";
|
|
8
|
+
//#region src/components/ui/popover.tsx
|
|
9
|
+
/** Root of a popover. Accepts `open`, `defaultOpen` and `onOpenChange`. */
|
|
10
|
+
var Popover$1 = Popover.Root;
|
|
11
|
+
/** Opens the popover. Use `render={<Button />}` to render a HeiGin Button. */
|
|
12
|
+
var PopoverTrigger = Popover.Trigger;
|
|
13
|
+
/** Closes the popover. Use `render={<Button />}` to render a HeiGin Button. */
|
|
14
|
+
var PopoverClose = Popover.Close;
|
|
15
|
+
/** Non-modal floating panel for small amounts of interactive content. Focus moves into it on open and returns on close. */
|
|
16
|
+
var PopoverContent = React.forwardRef(function PopoverContent({ title, description, side = "bottom", align = "start", className, children, ...props }, ref) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
18
|
+
className: popup_module_default.positioner,
|
|
19
|
+
side,
|
|
20
|
+
align,
|
|
21
|
+
sideOffset: 6,
|
|
22
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
23
|
+
ref,
|
|
24
|
+
className: cn(popup_module_default.popup, popup_module_default.popover, className),
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
title && /* @__PURE__ */ jsx(Popover.Title, {
|
|
28
|
+
className: popup_module_default.popoverTitle,
|
|
29
|
+
children: title
|
|
30
|
+
}),
|
|
31
|
+
description && /* @__PURE__ */ jsx(Popover.Description, {
|
|
32
|
+
className: popup_module_default.popoverDescription,
|
|
33
|
+
children: description
|
|
34
|
+
}),
|
|
35
|
+
children
|
|
36
|
+
]
|
|
37
|
+
})
|
|
38
|
+
}) });
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Popover$1 as Popover, PopoverClose, PopoverContent, PopoverTrigger };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/components/ui/popup.module.css
|
|
2
|
+
var positioner = "hg-popup-module_positioner_wWIIK";
|
|
3
|
+
var popup = "hg-popup-module_popup_XmXGo";
|
|
4
|
+
var item = "hg-popup-module_item_4gTK2";
|
|
5
|
+
var itemDanger = "hg-popup-module_itemDanger_GrxOr";
|
|
6
|
+
var itemText = "hg-popup-module_itemText_F4pTW";
|
|
7
|
+
var itemIndicator = "hg-popup-module_itemIndicator_V1eTv";
|
|
8
|
+
var shortcut = "hg-popup-module_shortcut_jVdJU";
|
|
9
|
+
var separator = "hg-popup-module_separator_qNz-Q";
|
|
10
|
+
var groupLabel = "hg-popup-module_groupLabel_9E-9i";
|
|
11
|
+
var trigger = "hg-popup-module_trigger_z1Rv-";
|
|
12
|
+
var value = "hg-popup-module_value_s0L5f";
|
|
13
|
+
var chevron = "hg-popup-module_chevron_AJCjt";
|
|
14
|
+
var tooltip = "hg-popup-module_tooltip_pmkOa";
|
|
15
|
+
var tooltipPositioner = "hg-popup-module_tooltipPositioner_0F6lh";
|
|
16
|
+
var popover = "hg-popup-module_popover_NzuyH";
|
|
17
|
+
var popoverTitle = "hg-popup-module_popoverTitle_ida4W";
|
|
18
|
+
var popoverDescription = "hg-popup-module_popoverDescription_eCF90";
|
|
19
|
+
var popup_module_default = {
|
|
20
|
+
positioner,
|
|
21
|
+
popup,
|
|
22
|
+
item,
|
|
23
|
+
itemDanger,
|
|
24
|
+
itemText,
|
|
25
|
+
itemIndicator,
|
|
26
|
+
shortcut,
|
|
27
|
+
separator,
|
|
28
|
+
groupLabel,
|
|
29
|
+
trigger,
|
|
30
|
+
value,
|
|
31
|
+
chevron,
|
|
32
|
+
tooltip,
|
|
33
|
+
tooltipPositioner,
|
|
34
|
+
popover,
|
|
35
|
+
popoverTitle,
|
|
36
|
+
popoverDescription
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { chevron, popup_module_default as default, groupLabel, item, itemDanger, itemIndicator, itemText, popover, popoverDescription, popoverTitle, popup, positioner, separator, shortcut, tooltip, tooltipPositioner, trigger, value };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
3
|
+
export interface RadioOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface RadioGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof BaseRadioGroup>, "className" | "render" | "children" | "onValueChange"> {
|
|
10
|
+
/** Group label, rendered as the accessible name. */
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
options: RadioOption[];
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
orientation?: "vertical" | "horizontal";
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A labelled set of mutually exclusive options. Arrow keys move between options. */
|
|
18
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import choice_module_default from "./choice.module.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
8
|
+
import { Radio } from "@base-ui/react/radio";
|
|
9
|
+
//#region src/components/ui/radio-group.tsx
|
|
10
|
+
/** A labelled set of mutually exclusive options. Arrow keys move between options. */
|
|
11
|
+
var RadioGroup$1 = React.forwardRef(function RadioGroup$2({ label, options, onValueChange, orientation = "vertical", className, disabled, ...props }, ref) {
|
|
12
|
+
const labelId = React.useId();
|
|
13
|
+
return /* @__PURE__ */ jsxs(RadioGroup, {
|
|
14
|
+
ref,
|
|
15
|
+
"aria-labelledby": labelId,
|
|
16
|
+
"data-orientation": orientation,
|
|
17
|
+
disabled,
|
|
18
|
+
onValueChange: (value) => onValueChange?.(value),
|
|
19
|
+
className: cn(choice_module_default.group, className),
|
|
20
|
+
...props,
|
|
21
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
22
|
+
id: labelId,
|
|
23
|
+
className: choice_module_default.legend,
|
|
24
|
+
children: label
|
|
25
|
+
}), options.map((option) => {
|
|
26
|
+
const isDisabled = disabled || option.disabled;
|
|
27
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
28
|
+
className: choice_module_default.choice,
|
|
29
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Radio.Root, {
|
|
31
|
+
value: option.value,
|
|
32
|
+
disabled: isDisabled,
|
|
33
|
+
className: choice_module_default.radio,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Radio.Indicator, { className: choice_module_default.radioDot })
|
|
35
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
36
|
+
className: choice_module_default.text,
|
|
37
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: choice_module_default.label,
|
|
39
|
+
children: option.label
|
|
40
|
+
}), option.description && /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: choice_module_default.description,
|
|
42
|
+
children: option.description
|
|
43
|
+
})]
|
|
44
|
+
})]
|
|
45
|
+
}, option.value);
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { RadioGroup$1 as RadioGroup };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SearchInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "onChange"> {
|
|
3
|
+
value: string;
|
|
4
|
+
onValueChange: (value: string) => void;
|
|
5
|
+
/** Called when the user presses Enter. */
|
|
6
|
+
onSearch?: (value: string) => void;
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
/** Accessible name for the clear button. */
|
|
9
|
+
clearLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Controlled search field with a leading icon and a clear button.
|
|
13
|
+
* Escape clears the value. Needs an accessible name: wrap it in a `Field` or pass `aria-label`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../../lib/cn.js";
|
|
4
|
+
import { useFieldControlProps } from "./field.js";
|
|
5
|
+
import input_module_default from "./input.module.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Search, X } from "lucide-react";
|
|
9
|
+
//#region src/components/ui/search-input.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Controlled search field with a leading icon and a clear button.
|
|
12
|
+
* Escape clears the value. Needs an accessible name: wrap it in a `Field` or pass `aria-label`.
|
|
13
|
+
*/
|
|
14
|
+
var SearchInput = React.forwardRef(function SearchInput({ value, onValueChange, onSearch, size = "md", clearLabel = "Clear search", className, onKeyDown, ...props }, ref) {
|
|
15
|
+
const innerRef = React.useRef(null);
|
|
16
|
+
React.useImperativeHandle(ref, () => innerRef.current);
|
|
17
|
+
const fieldProps = useFieldControlProps(props);
|
|
18
|
+
const hasValue = value.length > 0;
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: cn(input_module_default.wrapper, className),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: input_module_default.leading,
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children: /* @__PURE__ */ jsx(Search, { strokeWidth: 1.6 })
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsx("input", {
|
|
28
|
+
ref: innerRef,
|
|
29
|
+
type: "search",
|
|
30
|
+
value,
|
|
31
|
+
onChange: (event) => onValueChange(event.target.value),
|
|
32
|
+
onKeyDown: (event) => {
|
|
33
|
+
onKeyDown?.(event);
|
|
34
|
+
if (event.defaultPrevented) return;
|
|
35
|
+
if (event.key === "Enter") onSearch?.(value);
|
|
36
|
+
if (event.key === "Escape" && hasValue) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
onValueChange("");
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
className: cn(input_module_default.control, size !== "md" && input_module_default[size], hasValue && input_module_default.hasTrailing),
|
|
42
|
+
...fieldProps
|
|
43
|
+
}),
|
|
44
|
+
hasValue && !props.disabled && !props.readOnly && /* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: input_module_default.trailing,
|
|
46
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
className: input_module_default.clear,
|
|
49
|
+
"aria-label": clearLabel,
|
|
50
|
+
onClick: () => {
|
|
51
|
+
onValueChange("");
|
|
52
|
+
innerRef.current?.focus();
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
55
|
+
strokeWidth: 1.6,
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export { SearchInput };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectProps {
|
|
8
|
+
options: SelectOption[];
|
|
9
|
+
value?: string | null;
|
|
10
|
+
defaultValue?: string | null;
|
|
11
|
+
onValueChange?: (value: string | null) => void;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
/** Form field name; a hidden input is rendered for native form submission. */
|
|
17
|
+
name?: string;
|
|
18
|
+
size?: "sm" | "md" | "lg";
|
|
19
|
+
id?: string;
|
|
20
|
+
"aria-label"?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Single-value select with a custom listbox. Works inside a `Field` (label, description, error).
|
|
25
|
+
* For long, searchable lists use a combobox instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLButtonElement>>;
|