@bysages/react 0.4.1 → 0.4.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/dist/components/ai-prompt-input/index.mjs +2 -11
- package/dist/components/calendar/index.d.mts +18 -7
- package/dist/components/calendar/index.mjs +78 -42
- package/dist/components/chip/index.d.mts +1 -1
- package/dist/components/form/index.d.mts +48 -2
- package/dist/components/pagination/index.d.mts +2 -0
- package/dist/components/pagination/index.mjs +30 -5
- package/dist/components/progress/index.d.mts +2 -2
- package/dist/components/progress/index.mjs +20 -4
- package/dist/components/steps/index.d.mts +5 -1
- package/dist/components/steps/index.mjs +6 -4
- package/dist/components/table/index.d.mts +2 -0
- package/dist/components/table/index.mjs +1 -0
- package/dist/components/tag/index.d.mts +33 -0
- package/dist/components/tag/index.mjs +69 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/package.json +2 -2
- package/dist/index-PsgGWW3m.d.mts +0 -1819
|
@@ -12,18 +12,9 @@ const arrowUpIcon = iconNode("arrow-up", {
|
|
|
12
12
|
width: 14,
|
|
13
13
|
height: 14
|
|
14
14
|
});
|
|
15
|
-
const stopIcon =
|
|
16
|
-
viewBox: "0 0 16 16",
|
|
15
|
+
const stopIcon = iconNode("square", {
|
|
17
16
|
width: 14,
|
|
18
|
-
height: 14
|
|
19
|
-
"aria-hidden": "true",
|
|
20
|
-
children: /* @__PURE__ */ jsx("rect", {
|
|
21
|
-
x: 4.5,
|
|
22
|
-
y: 4.5,
|
|
23
|
-
width: 7,
|
|
24
|
-
height: 7,
|
|
25
|
-
fill: "currentColor"
|
|
26
|
-
})
|
|
17
|
+
height: 14
|
|
27
18
|
});
|
|
28
19
|
/** An empty slot leaves no part in the anatomy — the bare vessel keeps
|
|
29
20
|
* its single-line posture. */
|
|
@@ -2,18 +2,29 @@ import { DatePicker as DatePicker$1 } from "../date-picker/index.mjs";
|
|
|
2
2
|
import { HTMLAttributes } from "react";
|
|
3
3
|
import { DatePickerRootProps } from "@ark-ui/react/date-picker";
|
|
4
4
|
//#region src/components/calendar/index.d.ts
|
|
5
|
-
export interface CalendarProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
export interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> {
|
|
6
6
|
/** Selected date(s) — an array, as the machine speaks in ranges. */
|
|
7
7
|
value?: DatePickerRootProps["value"];
|
|
8
|
+
defaultValue?: DatePickerRootProps["defaultValue"];
|
|
8
9
|
min?: DatePickerRootProps["min"];
|
|
9
10
|
max?: DatePickerRootProps["max"];
|
|
11
|
+
/** compact keeps the popup's measure; full gives cells room for content. */
|
|
12
|
+
variant?: "compact" | "full";
|
|
13
|
+
/** month is the day grid; year starts on a month overview. */
|
|
14
|
+
mode?: "month" | "year";
|
|
15
|
+
selectionMode?: DatePickerRootProps["selectionMode"];
|
|
16
|
+
startOfWeek?: number;
|
|
17
|
+
fixedWeeks?: boolean;
|
|
18
|
+
showWeekNumbers?: boolean;
|
|
19
|
+
outsideDaySelectable?: boolean;
|
|
20
|
+
closeOnSelect?: boolean;
|
|
21
|
+
minView?: DatePickerRootProps["minView"];
|
|
22
|
+
maxView?: DatePickerRootProps["maxView"];
|
|
10
23
|
onValueChange?: (value: NonNullable<DatePickerRootProps["value"]>) => void;
|
|
11
24
|
}
|
|
12
|
-
/** The date-picker's
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
* Ark's own contract. */
|
|
17
|
-
declare function CalendarImpl({ value, min, max, onValueChange, children, ...rest }: CalendarProps): import("react").JSX.Element;
|
|
25
|
+
/** The date-picker's grid standing on the page. Compact is the popup's
|
|
26
|
+
* quiet card; full opens it into a dashboard calendar. Year mode starts
|
|
27
|
+
* on a month overview; choosing a month drills into its day grid. */
|
|
28
|
+
declare function CalendarImpl({ value, defaultValue, min, max, variant, mode, selectionMode, startOfWeek, fixedWeeks, showWeekNumbers, outsideDaySelectable, closeOnSelect, minView, maxView, onValueChange, children, ...rest }: CalendarProps): import("react").JSX.Element;
|
|
18
29
|
export declare const Calendar: typeof CalendarImpl & typeof DatePicker$1;
|
|
19
30
|
//#endregion
|
|
@@ -2,7 +2,7 @@ import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
|
2
2
|
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
3
3
|
import { DatePicker as DatePicker$1 } from "../date-picker/index.mjs";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { DatePicker } from "@ark-ui/react/date-picker";
|
|
7
7
|
//#region src/components/calendar/index.tsx
|
|
8
8
|
function chevron(dir) {
|
|
@@ -11,81 +11,117 @@ function chevron(dir) {
|
|
|
11
11
|
height: 16
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
/** The date-picker's
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
* Ark's own contract. */
|
|
19
|
-
function CalendarImpl({ value, min, max, onValueChange, children, ...rest }) {
|
|
14
|
+
/** The date-picker's grid standing on the page. Compact is the popup's
|
|
15
|
+
* quiet card; full opens it into a dashboard calendar. Year mode starts
|
|
16
|
+
* on a month overview; choosing a month drills into its day grid. */
|
|
17
|
+
function CalendarImpl({ value, defaultValue, min, max, variant = "compact", mode = "month", selectionMode, startOfWeek, fixedWeeks = false, showWeekNumbers = false, outsideDaySelectable = true, closeOnSelect = true, minView, maxView, onValueChange, children, ...rest }) {
|
|
20
18
|
injectComponentStyle("calendar");
|
|
21
19
|
injectComponentStyle("date-picker");
|
|
22
20
|
const hostId = useElementId("calendar", rest);
|
|
23
21
|
const title = (dp) => {
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
if (dp.view === "
|
|
22
|
+
const date = dp.focusedValue;
|
|
23
|
+
if (!date) return "";
|
|
24
|
+
if (dp.view === "month") return dp.format(date, { year: "numeric" });
|
|
25
|
+
if (dp.view === "day") return dp.format(date, {
|
|
27
26
|
month: "long",
|
|
28
27
|
year: "numeric"
|
|
29
28
|
});
|
|
30
|
-
|
|
31
|
-
const decade = Math.floor(d.year / 10) * 10;
|
|
29
|
+
const decade = Math.floor(date.year / 10) * 10;
|
|
32
30
|
return `${decade} - ${decade + 9}`;
|
|
33
31
|
};
|
|
34
|
-
const header = /* @__PURE__ */ jsx("div", {
|
|
32
|
+
const header = (dp) => /* @__PURE__ */ jsx("div", {
|
|
35
33
|
"data-scope": "calendar",
|
|
36
34
|
"data-part": "header",
|
|
37
35
|
children: /* @__PURE__ */ jsxs(DatePicker.ViewControl, { children: [
|
|
38
36
|
/* @__PURE__ */ jsx(DatePicker.PrevTrigger, { children: chevron("left") }),
|
|
39
|
-
/* @__PURE__ */ jsx(DatePicker.Context, { children: (
|
|
37
|
+
/* @__PURE__ */ jsx(DatePicker.Context, { children: (context) => /* @__PURE__ */ jsx(DatePicker.ViewTrigger, { children: title(context) }) }),
|
|
38
|
+
variant === "full" && dp ? todayTrigger(dp) : null,
|
|
40
39
|
/* @__PURE__ */ jsx(DatePicker.NextTrigger, { children: chevron("right") })
|
|
41
40
|
] })
|
|
42
41
|
});
|
|
42
|
+
const todayTrigger = (dp) => /* @__PURE__ */ jsx("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
"data-scope": "calendar",
|
|
45
|
+
"data-part": "today-trigger",
|
|
46
|
+
onClick: () => {
|
|
47
|
+
dp.selectToday();
|
|
48
|
+
if (mode === "year" && dp.view === "month") dp.setView("day");
|
|
49
|
+
},
|
|
50
|
+
children: "Today"
|
|
51
|
+
});
|
|
52
|
+
const dayTable = (dp) => {
|
|
53
|
+
const weeks = dp.weeks;
|
|
54
|
+
return /* @__PURE__ */ jsxs(DatePicker.Table, { children: [/* @__PURE__ */ jsx(DatePicker.TableHead, { children: /* @__PURE__ */ jsxs(DatePicker.TableRow, { children: [showWeekNumbers ? /* @__PURE__ */ jsx(DatePicker.WeekNumberHeaderCell, { children: "Wk" }) : null, dp.weekDays.map((day, id) => /* @__PURE__ */ jsx(DatePicker.TableHeader, {
|
|
55
|
+
"aria-label": day.long,
|
|
56
|
+
children: day.narrow
|
|
57
|
+
}, id))] }) }), /* @__PURE__ */ jsx(DatePicker.TableBody, { children: weeks.map((week, id) => /* @__PURE__ */ jsxs(DatePicker.TableRow, { children: [showWeekNumbers ? /* @__PURE__ */ jsx(DatePicker.WeekNumberCell, {
|
|
58
|
+
weekIndex: id,
|
|
59
|
+
week,
|
|
60
|
+
children: dp.getWeekNumber(week)
|
|
61
|
+
}, "week") : null, week.map((day, cellId) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
62
|
+
value: day,
|
|
63
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: day.day })
|
|
64
|
+
}, cellId))] }, id)) })] });
|
|
65
|
+
};
|
|
66
|
+
const monthGrid = (dp, columns) => /* @__PURE__ */ jsx(DatePicker.Table, {
|
|
67
|
+
columns,
|
|
68
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableBody, { children: dp.getMonthsGrid({
|
|
69
|
+
columns,
|
|
70
|
+
format: columns === 4 ? "short" : "long"
|
|
71
|
+
}).map((months, id) => /* @__PURE__ */ jsx(DatePicker.TableRow, { children: months.map((month, monthId) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
72
|
+
value: month.value,
|
|
73
|
+
columns,
|
|
74
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: month.label })
|
|
75
|
+
}, monthId)) }, id)) })
|
|
76
|
+
});
|
|
77
|
+
const yearGrid = (dp) => /* @__PURE__ */ jsx(DatePicker.Table, {
|
|
78
|
+
columns: 3,
|
|
79
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableBody, { children: dp.getYearsGrid({ columns: 3 }).map((years, id) => /* @__PURE__ */ jsx(DatePicker.TableRow, { children: years.map((year, yearId) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
80
|
+
value: year.value,
|
|
81
|
+
columns: 3,
|
|
82
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: year.label })
|
|
83
|
+
}, yearId)) }, id)) })
|
|
84
|
+
});
|
|
43
85
|
return /* @__PURE__ */ jsxs("div", {
|
|
44
86
|
...rest,
|
|
45
87
|
"data-scope": "calendar",
|
|
46
88
|
"data-part": "root",
|
|
89
|
+
"data-variant": variant,
|
|
90
|
+
"data-mode": mode,
|
|
47
91
|
children: [/* @__PURE__ */ jsxs(DatePicker.Root, {
|
|
48
92
|
id: `${hostId}:date-picker`,
|
|
49
93
|
open: true,
|
|
50
|
-
closeOnSelect: true,
|
|
51
94
|
inline: true,
|
|
95
|
+
closeOnSelect,
|
|
96
|
+
outsideDaySelectable,
|
|
52
97
|
...value !== void 0 ? { value } : {},
|
|
98
|
+
...defaultValue !== void 0 ? { defaultValue } : {},
|
|
53
99
|
...min !== void 0 ? { min } : {},
|
|
54
100
|
...max !== void 0 ? { max } : {},
|
|
101
|
+
...selectionMode !== void 0 ? { selectionMode } : {},
|
|
102
|
+
...startOfWeek !== void 0 ? { startOfWeek } : {},
|
|
103
|
+
fixedWeeks: fixedWeeks || variant === "full",
|
|
104
|
+
showWeekNumbers,
|
|
105
|
+
...minView !== void 0 ? { minView } : {},
|
|
106
|
+
...maxView !== void 0 ? { maxView } : {},
|
|
107
|
+
...mode === "year" ? {
|
|
108
|
+
defaultView: "month",
|
|
109
|
+
maxView: "month"
|
|
110
|
+
} : {},
|
|
55
111
|
onValueChange: (details) => onValueChange?.(details.value),
|
|
56
112
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ jsx(DatePicker.View, {
|
|
58
114
|
view: "day",
|
|
59
|
-
children:
|
|
60
|
-
"aria-label": day.long,
|
|
61
|
-
children: day.narrow
|
|
62
|
-
}, id)) }) }) }), /* @__PURE__ */ jsx(DatePicker.TableBody, { children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => dp.weeks.map((week, id) => /* @__PURE__ */ jsx(DatePicker.TableRow, { children: week.map((day, id2) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
63
|
-
value: day,
|
|
64
|
-
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: day.day })
|
|
65
|
-
}, id2)) }, id)) }) })] })]
|
|
115
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => /* @__PURE__ */ jsxs(Fragment, { children: [header(dp), dayTable(dp)] }) })
|
|
66
116
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ jsx(DatePicker.View, {
|
|
68
118
|
view: "month",
|
|
69
|
-
children:
|
|
70
|
-
columns: 3,
|
|
71
|
-
children: /* @__PURE__ */ jsx(DatePicker.TableBody, { children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => dp.getMonthsGrid({ columns: 3 }).map((months, id) => /* @__PURE__ */ jsx(DatePicker.TableRow, { children: months.map((month, id2) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
72
|
-
value: month.value,
|
|
73
|
-
columns: 3,
|
|
74
|
-
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: month.label })
|
|
75
|
-
}, id2)) }, id)) }) })
|
|
76
|
-
})]
|
|
119
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => /* @__PURE__ */ jsxs(Fragment, { children: [header(dp), monthGrid(dp, mode === "year" ? 4 : 3)] }) })
|
|
77
120
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
121
|
+
mode === "month" ? /* @__PURE__ */ jsx(DatePicker.View, {
|
|
79
122
|
view: "year",
|
|
80
|
-
children:
|
|
81
|
-
|
|
82
|
-
children: /* @__PURE__ */ jsx(DatePicker.TableBody, { children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => dp.getYearsGrid({ columns: 3 }).map((years, id) => /* @__PURE__ */ jsx(DatePicker.TableRow, { children: years.map((year, id2) => /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
83
|
-
value: year.value,
|
|
84
|
-
columns: 3,
|
|
85
|
-
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, { children: year.label })
|
|
86
|
-
}, id2)) }, id)) }) })
|
|
87
|
-
})]
|
|
88
|
-
})
|
|
123
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: (dp) => /* @__PURE__ */ jsxs(Fragment, { children: [header(), yearGrid(dp)] }) })
|
|
124
|
+
}) : null
|
|
89
125
|
]
|
|
90
126
|
}), children]
|
|
91
127
|
});
|
|
@@ -5,7 +5,7 @@ import { HTMLAttributes } from "react";
|
|
|
5
5
|
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
6
6
|
value: number;
|
|
7
7
|
max?: number;
|
|
8
|
-
tone?: "ink" | "
|
|
8
|
+
tone?: "ink" | "primary" | "success" | "warning" | "danger" | "info";
|
|
9
9
|
variant?: "solid" | "subtle" | "outline";
|
|
10
10
|
}
|
|
11
11
|
declare function ChipImpl({ value, max, tone, variant, ...rest }: ChipProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ComponentType, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { FieldApi, FormApi, useField, useForm } from "@tanstack/react-form";
|
|
3
|
+
//#region src/components/form/index.d.ts
|
|
4
|
+
/** The seam this family passes the engine through — the members the
|
|
5
|
+
* components drive, with the engine's field-name generics opened to
|
|
6
|
+
* `any`. The engine ships no "any form" alias: its loosest, `FormLikeAPI`,
|
|
7
|
+
* still pins names to `string`, which a concrete form's literal names
|
|
8
|
+
* cannot satisfy. */
|
|
9
|
+
interface AnyFormApi {
|
|
10
|
+
handleSubmit(): Promise<unknown>;
|
|
11
|
+
setFieldMeta(field: any, updater: (prev: any) => any): void;
|
|
12
|
+
Field: ComponentType<any>;
|
|
13
|
+
}
|
|
14
|
+
/** The form element itself: native submit interception handing the event
|
|
15
|
+
* to the engine, one grid, one spacing voice. */
|
|
16
|
+
export interface FormProps extends HTMLAttributes<HTMLFormElement> {
|
|
17
|
+
form: AnyFormApi;
|
|
18
|
+
}
|
|
19
|
+
declare function FormImpl({ form, children, ...rest }: FormProps): import("react").JSX.Element;
|
|
20
|
+
export declare const Form: typeof FormImpl & {
|
|
21
|
+
Root: typeof FormImpl;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The named slot in the grid: label, control, hint — and the engine's
|
|
25
|
+
* errors for this name, shown through the same parts the standalone
|
|
26
|
+
* Field family styles. The children may be a render receiving the live
|
|
27
|
+
* TanStack field (value, handleChange, handleBlur, full state), so every
|
|
28
|
+
* capability the engine has is right there where the control is wired.
|
|
29
|
+
* Without a Form above it degrades to a plain labelled field.
|
|
30
|
+
*/
|
|
31
|
+
export interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
32
|
+
form?: AnyFormApi;
|
|
33
|
+
name: string;
|
|
34
|
+
/** The engine's validator slots for this name (onChange, onBlur, ...). */
|
|
35
|
+
validators?: any;
|
|
36
|
+
label?: string;
|
|
37
|
+
hint?: string;
|
|
38
|
+
required?: boolean;
|
|
39
|
+
invalid?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
children?: ReactNode | ((field: any) => ReactNode);
|
|
42
|
+
}
|
|
43
|
+
declare function FormFieldImpl({ form: formProp, name, label, hint, required, invalid, disabled, children, ...rest }: FormFieldProps): import("react").JSX.Element;
|
|
44
|
+
export declare const FormField: typeof FormFieldImpl & {
|
|
45
|
+
Root: typeof FormFieldImpl;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { type FieldApi, type FormApi, useField, useForm };
|
|
@@ -21,6 +21,8 @@ type PaginationFacadeProps = {
|
|
|
21
21
|
siblingCount?: number;
|
|
22
22
|
label?: string;
|
|
23
23
|
size?: "sm" | "md" | "lg";
|
|
24
|
+
/** full is the page-seal ladder; simple keeps prev, the count, next. */
|
|
25
|
+
variant?: "default" | "simple";
|
|
24
26
|
className?: string;
|
|
25
27
|
style?: CSSProperties;
|
|
26
28
|
onValueChange?: (page: number) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
2
|
import { t as useElementId } from "../../id-C37UYLwJ.mjs";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Pagination as Pagination$1 } from "@ark-ui/react/pagination";
|
|
6
6
|
//#region src/components/pagination/index.tsx
|
|
7
7
|
function PaginationRoot(props) {
|
|
@@ -19,8 +19,8 @@ const PaginationNextTrigger = Pagination$1.NextTrigger;
|
|
|
19
19
|
/** The complete pagination bar behind one page: count and page size become
|
|
20
20
|
* the visible ladder, with edge semantics left to anatomy. */
|
|
21
21
|
function PaginationFacade(props) {
|
|
22
|
-
const { value, defaultValue, count = 0, pageSize, defaultPageSize, siblingCount = 1, label, size = "md", className, style, onValueChange } = props;
|
|
23
|
-
return /* @__PURE__ */
|
|
22
|
+
const { value, defaultValue, count = 0, pageSize, defaultPageSize, siblingCount = 1, label, size = "md", variant = "default", className, style, onValueChange } = props;
|
|
23
|
+
return /* @__PURE__ */ jsx(PaginationRoot, {
|
|
24
24
|
size,
|
|
25
25
|
"aria-label": label,
|
|
26
26
|
count,
|
|
@@ -29,10 +29,35 @@ function PaginationFacade(props) {
|
|
|
29
29
|
...pageSize === void 0 ? {} : { pageSize },
|
|
30
30
|
...defaultPageSize === void 0 ? {} : { defaultPageSize },
|
|
31
31
|
siblingCount,
|
|
32
|
+
"data-variant": variant === "simple" ? variant : void 0,
|
|
32
33
|
className,
|
|
33
34
|
style,
|
|
34
35
|
onPageChange: (event) => onValueChange?.(event.page),
|
|
35
|
-
children: [
|
|
36
|
+
children: variant === "simple" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx(PaginationPrevTrigger, {
|
|
38
|
+
"aria-label": "Previous page",
|
|
39
|
+
children: iconNode("chevron-left", {
|
|
40
|
+
width: 14,
|
|
41
|
+
height: 14
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(Pagination$1.Context, { children: (pagination) => /* @__PURE__ */ jsxs("span", {
|
|
45
|
+
"data-scope": "pagination",
|
|
46
|
+
"data-part": "status",
|
|
47
|
+
children: [
|
|
48
|
+
pagination.page,
|
|
49
|
+
" / ",
|
|
50
|
+
pagination.totalPages
|
|
51
|
+
]
|
|
52
|
+
}) }),
|
|
53
|
+
/* @__PURE__ */ jsx(PaginationNextTrigger, {
|
|
54
|
+
"aria-label": "Next page",
|
|
55
|
+
children: iconNode("chevron-right", {
|
|
56
|
+
width: 14,
|
|
57
|
+
height: 14
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
61
|
/* @__PURE__ */ jsx(PaginationPrevTrigger, {
|
|
37
62
|
"aria-label": "Previous page",
|
|
38
63
|
children: iconNode("chevron-left", {
|
|
@@ -55,7 +80,7 @@ function PaginationFacade(props) {
|
|
|
55
80
|
height: 14
|
|
56
81
|
})
|
|
57
82
|
})
|
|
58
|
-
]
|
|
83
|
+
] })
|
|
59
84
|
});
|
|
60
85
|
}
|
|
61
86
|
const Pagination = Object.assign(PaginationFacade, {
|
|
@@ -16,14 +16,14 @@ type ProgressFacadeProps = {
|
|
|
16
16
|
min?: number;
|
|
17
17
|
max?: number;
|
|
18
18
|
label?: string;
|
|
19
|
-
variant?: "linear" | "circle";
|
|
19
|
+
variant?: "linear" | "circle" | "dashboard";
|
|
20
20
|
size?: "sm" | "md" | "lg";
|
|
21
21
|
className?: string;
|
|
22
22
|
style?: CSSProperties;
|
|
23
23
|
onValueChange?: (value: number | null) => void;
|
|
24
24
|
};
|
|
25
25
|
/** The complete progress behind one value: a labelled linear groove by
|
|
26
|
-
* default, with
|
|
26
|
+
* default, with circular and dashboard dials for compact status. */
|
|
27
27
|
declare function ProgressFacade(props: ProgressFacadeProps): import("react").JSX.Element;
|
|
28
28
|
export declare const Progress: typeof ProgressFacade & Omit<typeof Progress$1, "Root"> & {
|
|
29
29
|
Root: typeof ProgressRoot;
|
|
@@ -15,9 +15,15 @@ function ProgressRoot(props) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
/** The complete progress behind one value: a labelled linear groove by
|
|
18
|
-
* default, with
|
|
18
|
+
* default, with circular and dashboard dials for compact status. */
|
|
19
19
|
function ProgressFacade(props) {
|
|
20
20
|
const { value, defaultValue, min, max, label, variant = "linear", size = "md", className, style, onValueChange } = props;
|
|
21
|
+
const dashboardPercent = (() => {
|
|
22
|
+
const lower = min ?? 0;
|
|
23
|
+
const upper = max ?? 100;
|
|
24
|
+
const percent = ((value ?? defaultValue ?? lower + (upper - lower) / 2) - lower) / (upper - lower) * 100;
|
|
25
|
+
return !Number.isFinite(percent) ? 0 : Math.min(100, Math.max(0, percent));
|
|
26
|
+
})();
|
|
21
27
|
return /* @__PURE__ */ jsxs(ProgressRoot, {
|
|
22
28
|
size,
|
|
23
29
|
"data-variant": variant,
|
|
@@ -30,11 +36,21 @@ function ProgressFacade(props) {
|
|
|
30
36
|
onValueChange: (event) => onValueChange?.(event.value),
|
|
31
37
|
children: [
|
|
32
38
|
label ? /* @__PURE__ */ jsx(Progress$1.Label, { children: label }) : null,
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
39
|
+
variant === "dashboard" ? /* @__PURE__ */ jsxs("div", {
|
|
40
|
+
"data-scope": "progress",
|
|
41
|
+
"data-part": "view",
|
|
42
|
+
"data-view": "dashboard",
|
|
43
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
"data-scope": "progress",
|
|
46
|
+
"data-part": "dash-ring",
|
|
47
|
+
style: { "--percent": String(dashboardPercent) }
|
|
48
|
+
}), /* @__PURE__ */ jsx(Progress$1.ValueText, {})]
|
|
49
|
+
}) : variant === "circle" ? /* @__PURE__ */ jsx(ProgressView, {
|
|
35
50
|
view: "circle",
|
|
36
51
|
children: /* @__PURE__ */ jsx(Progress$1.Circle, { children: /* @__PURE__ */ jsx(Progress$1.CircleRange, {}) })
|
|
37
|
-
}) : /* @__PURE__ */ jsx(Progress$1.Track, { children: /* @__PURE__ */ jsx(Progress$1.Range, {}) })
|
|
52
|
+
}) : /* @__PURE__ */ jsx(Progress$1.Track, { children: /* @__PURE__ */ jsx(Progress$1.Range, {}) }),
|
|
53
|
+
variant !== "dashboard" ? /* @__PURE__ */ jsx(Progress$1.ValueText, {}) : null
|
|
38
54
|
]
|
|
39
55
|
});
|
|
40
56
|
}
|
|
@@ -4,6 +4,8 @@ import { Steps as Steps$1 } from "@ark-ui/react/steps";
|
|
|
4
4
|
type StepsRootProps = ComponentProps<typeof Steps$1.Root> & {
|
|
5
5
|
/** One rung of the control-height ladder every indicator stands on. */
|
|
6
6
|
size?: "sm" | "md" | "lg";
|
|
7
|
+
/** Default renders numbered seals; dot reduces each step to a bead. */
|
|
8
|
+
variant?: "default" | "dot";
|
|
7
9
|
};
|
|
8
10
|
declare function StepsRoot(props: StepsRootProps): import("react").JSX.Element;
|
|
9
11
|
type StepsItem = {
|
|
@@ -17,10 +19,12 @@ export interface StepsFacadeProps {
|
|
|
17
19
|
orientation?: "horizontal" | "vertical";
|
|
18
20
|
/** One rung of the control-height ladder every indicator stands on. */
|
|
19
21
|
size?: "sm" | "md" | "lg";
|
|
22
|
+
/** Default renders numbered seals; dot reduces each step to a bead. */
|
|
23
|
+
variant?: "default" | "dot";
|
|
20
24
|
className?: string;
|
|
21
25
|
onStepChange?: (step: number) => void;
|
|
22
26
|
}
|
|
23
|
-
declare function StepsFacade({ items, step, defaultStep, linear, orientation, size, className, onStepChange }: StepsFacadeProps): import("react").JSX.Element;
|
|
27
|
+
declare function StepsFacade({ items, step, defaultStep, linear, orientation, size, variant, className, onStepChange }: StepsFacadeProps): import("react").JSX.Element;
|
|
24
28
|
declare namespace StepsFacade {
|
|
25
29
|
var displayName: string;
|
|
26
30
|
}
|
|
@@ -5,27 +5,29 @@ import { Steps as Steps$1 } from "@ark-ui/react/steps";
|
|
|
5
5
|
//#region src/components/steps/index.tsx
|
|
6
6
|
function StepsRoot(props) {
|
|
7
7
|
const id = useElementId("steps", props);
|
|
8
|
-
const { size = "md", ...rest } = props;
|
|
8
|
+
const { size = "md", variant = "default", ...rest } = props;
|
|
9
9
|
return /* @__PURE__ */ jsx(Steps$1.Root, {
|
|
10
10
|
...rest,
|
|
11
11
|
id,
|
|
12
|
-
"data-size": size
|
|
12
|
+
"data-size": size,
|
|
13
|
+
"data-variant": variant === "dot" ? variant : void 0
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
function StepsFacade({ items, step, defaultStep = 0, linear = false, orientation = "horizontal", size = "md", className, onStepChange }) {
|
|
16
|
+
function StepsFacade({ items, step, defaultStep = 0, linear = false, orientation = "horizontal", size = "md", variant = "default", className, onStepChange }) {
|
|
16
17
|
return /* @__PURE__ */ jsx(StepsRoot, {
|
|
17
18
|
className,
|
|
18
19
|
size,
|
|
19
20
|
count: items.length,
|
|
20
21
|
linear,
|
|
21
22
|
orientation,
|
|
23
|
+
variant,
|
|
22
24
|
defaultStep,
|
|
23
25
|
...step === void 0 ? {} : { step },
|
|
24
26
|
onStepChange: (details) => onStepChange?.(details.step),
|
|
25
27
|
children: /* @__PURE__ */ jsx(Steps$1.List, { children: items.map((item, index) => /* @__PURE__ */ jsxs(Steps$1.Item, {
|
|
26
28
|
index,
|
|
27
29
|
role: "presentation",
|
|
28
|
-
children: [/* @__PURE__ */ jsxs(Steps$1.Trigger, { children: [/* @__PURE__ */ jsx(Steps$1.Indicator, { children: String(index + 1) }), item.title] }), /* @__PURE__ */ jsx(Steps$1.Separator, {})]
|
|
30
|
+
children: [/* @__PURE__ */ jsxs(Steps$1.Trigger, { children: [/* @__PURE__ */ jsx(Steps$1.Indicator, { children: variant === "dot" ? null : String(index + 1) }), item.title] }), /* @__PURE__ */ jsx(Steps$1.Separator, {})]
|
|
29
31
|
}, item.title)) })
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -61,6 +61,8 @@ export interface DataTableProps {
|
|
|
61
61
|
initialSorting?: SortingState;
|
|
62
62
|
globalFilterPlaceholder?: string;
|
|
63
63
|
emptyText?: string;
|
|
64
|
+
/** Band every other body row so wide measures keep the eye on line. */
|
|
65
|
+
striped?: boolean;
|
|
64
66
|
/** Allow dragging header cells onto each other to reorder columns and
|
|
65
67
|
* body rows onto each other to reorder data — with `tree`, row drops
|
|
66
68
|
* read as before / inside / after, so a drop can also nest a branch
|
|
@@ -638,6 +638,7 @@ function DataTableImpl(rawProps) {
|
|
|
638
638
|
"data-scope": "table",
|
|
639
639
|
"data-part": "root",
|
|
640
640
|
"data-reorderable": reorderable || void 0,
|
|
641
|
+
"data-striped": props.striped || void 0,
|
|
641
642
|
style: {
|
|
642
643
|
"--bs-table-row-height": `calc(${rowHeight}px * var(--bs-density-scale, 1))`,
|
|
643
644
|
...props.style
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
//#region src/components/tag/index.d.ts
|
|
3
|
+
export interface TagProps extends Omit<HTMLAttributes<HTMLElement>, "defaultValue"> {
|
|
4
|
+
/** The pigment the tag is inked with; ink is the solemn default,
|
|
5
|
+
* and the fixed pigments speak for their meaning. */
|
|
6
|
+
tone?: "ink" | "primary" | "success" | "warning" | "danger" | "info";
|
|
7
|
+
/** How the tag rests: a solid fill, an outline shell, a subtle
|
|
8
|
+
* wash. The pressed state always reads as solid. */
|
|
9
|
+
variant?: "solid" | "outline" | "subtle";
|
|
10
|
+
/** Render the tag as a pressed button the consumer can toggle. */
|
|
11
|
+
checkable?: boolean;
|
|
12
|
+
/** The pressed state held from outside; omit it and the tag keeps
|
|
13
|
+
* its own state from `defaultValue`. */
|
|
14
|
+
value?: boolean;
|
|
15
|
+
defaultValue?: boolean;
|
|
16
|
+
/** Render the quiet removal seal. */
|
|
17
|
+
closable?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onValueChange?: (checked: boolean) => void;
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
}
|
|
22
|
+
/** A small named seal for filtering and cataloguing. The resting shape
|
|
23
|
+
* is a span; `checkable` raises it to a pressed button, and `closable`
|
|
24
|
+
* hangs the removal seal inside — dismissal stays the consumer's state,
|
|
25
|
+
* the way the banner's does. */
|
|
26
|
+
declare function TagImpl({ tone, variant, checkable, value, defaultValue, closable, disabled, onValueChange, onClose, children, ...rest }: TagProps): import("react").JSX.Element;
|
|
27
|
+
declare namespace TagImpl {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const Tag: typeof TagImpl & {
|
|
31
|
+
Root: typeof TagImpl;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as iconNode } from "../../icon-BALgGtNK.mjs";
|
|
2
|
+
import { t as withSelfRoot } from "../../family-DE_GQeeM.mjs";
|
|
3
|
+
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
//#region src/components/tag/index.tsx
|
|
7
|
+
/** A small named seal for filtering and cataloguing. The resting shape
|
|
8
|
+
* is a span; `checkable` raises it to a pressed button, and `closable`
|
|
9
|
+
* hangs the removal seal inside — dismissal stays the consumer's state,
|
|
10
|
+
* the way the banner's does. */
|
|
11
|
+
function TagImpl({ tone = "ink", variant = "solid", checkable = false, value, defaultValue = false, closable = false, disabled = false, onValueChange, onClose, children, ...rest }) {
|
|
12
|
+
injectComponentStyle("tag");
|
|
13
|
+
const [internalChecked, setInternalChecked] = useState(defaultValue);
|
|
14
|
+
const checked = value ?? internalChecked;
|
|
15
|
+
const toggle = () => {
|
|
16
|
+
if (disabled) return;
|
|
17
|
+
const next = !checked;
|
|
18
|
+
setInternalChecked(next);
|
|
19
|
+
onValueChange?.(next);
|
|
20
|
+
};
|
|
21
|
+
const dismiss = (event) => {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
if (disabled) return;
|
|
24
|
+
onClose?.();
|
|
25
|
+
};
|
|
26
|
+
const pressed = checkable && checked;
|
|
27
|
+
const closeControl = closable ? checkable ? /* @__PURE__ */ jsx("span", {
|
|
28
|
+
"data-scope": "tag",
|
|
29
|
+
"data-part": "close",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
onClick: dismiss,
|
|
32
|
+
children: iconNode("x")
|
|
33
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
34
|
+
"data-scope": "tag",
|
|
35
|
+
"data-part": "close",
|
|
36
|
+
type: "button",
|
|
37
|
+
"aria-label": "Remove",
|
|
38
|
+
disabled,
|
|
39
|
+
onClick: dismiss,
|
|
40
|
+
children: iconNode("x")
|
|
41
|
+
}) : null;
|
|
42
|
+
const partProps = {
|
|
43
|
+
...rest,
|
|
44
|
+
"data-scope": "tag",
|
|
45
|
+
"data-part": "root",
|
|
46
|
+
"data-tone": tone,
|
|
47
|
+
"data-variant": variant,
|
|
48
|
+
...checkable ? { "data-checkable": "true" } : {},
|
|
49
|
+
...pressed ? { "data-checked": "true" } : {},
|
|
50
|
+
...disabled ? { "data-disabled": "true" } : {}
|
|
51
|
+
};
|
|
52
|
+
if (checkable) return /* @__PURE__ */ jsxs("button", {
|
|
53
|
+
...partProps,
|
|
54
|
+
type: "button",
|
|
55
|
+
"aria-pressed": checked,
|
|
56
|
+
disabled,
|
|
57
|
+
onClick: toggle,
|
|
58
|
+
children: [children, closeControl]
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
61
|
+
...partProps,
|
|
62
|
+
...disabled ? { "aria-disabled": "true" } : {},
|
|
63
|
+
children: [children, closeControl]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
TagImpl.displayName = "STag";
|
|
67
|
+
const Tag = withSelfRoot(TagImpl);
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Tag };
|