@douglasneuroinformatics/libui 2.0.0-beta.10 → 2.0.0-beta.12
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 +14 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +12 -12
- package/dist/components/index.js.map +1 -1
- package/dist/i18n.d.ts +171 -3
- package/dist/i18n.js +11 -6
- package/dist/i18n.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,20 @@ designed as a generic implementation.
|
|
|
40
40
|
pnpm install @douglasneuroinformatics/libui
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
**tailwind.config.cjs**
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
const baseConfig = require('@douglasneuroinformatics/libui/tailwind.config.cjs');
|
|
49
|
+
|
|
50
|
+
/** @type {import('tailwindcss').Config} */
|
|
51
|
+
module.exports {
|
|
52
|
+
content: [...baseConfig.content, './src/**/*.{js,ts,jsx,tsx}'],
|
|
53
|
+
presets: [baseConfig]
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
43
57
|
## Contributing
|
|
44
58
|
|
|
45
59
|
We welcome contributions! If you're interested in improving the library or adding new features, please refer to our contribution guide.
|
|
@@ -869,8 +869,9 @@ type LanguageToggleProps = {
|
|
|
869
869
|
options: {
|
|
870
870
|
[key: string]: string;
|
|
871
871
|
};
|
|
872
|
+
variant?: ButtonProps['variant'];
|
|
872
873
|
};
|
|
873
|
-
declare const LanguageToggle: ({ align, options }
|
|
874
|
+
declare const LanguageToggle: ({ align, options, variant }: LanguageToggleProps) => react_jsx_runtime.JSX.Element;
|
|
874
875
|
|
|
875
876
|
type LegacyDropdownOptions = {
|
|
876
877
|
[key: string]: string;
|
package/dist/components/index.js
CHANGED
|
@@ -2306,7 +2306,7 @@ var RecordArrayField = memo(function RecordArrayField2({
|
|
|
2306
2306
|
setValue: setArrayValue,
|
|
2307
2307
|
value: arrayValue
|
|
2308
2308
|
}) {
|
|
2309
|
-
const { t } = useTranslation4();
|
|
2309
|
+
const { t } = useTranslation4("libui");
|
|
2310
2310
|
const createNewRecord = () => Object.fromEntries(Object.keys(fieldset).map((fieldName) => [fieldName, void 0]));
|
|
2311
2311
|
useEffect6(() => {
|
|
2312
2312
|
setArrayValue([createNewRecord()]);
|
|
@@ -2493,7 +2493,7 @@ var Form = ({
|
|
|
2493
2493
|
validationSchema,
|
|
2494
2494
|
...props
|
|
2495
2495
|
}) => {
|
|
2496
|
-
const { t } = useTranslation5();
|
|
2496
|
+
const { t } = useTranslation5("libui");
|
|
2497
2497
|
const [rootError, setRootError] = useState5(null);
|
|
2498
2498
|
const [errors, setErrors] = useState5({});
|
|
2499
2499
|
const [values, setValues] = useState5(
|
|
@@ -2612,10 +2612,10 @@ var HoverCard = Object.assign(Root14, {
|
|
|
2612
2612
|
import { LanguagesIcon } from "lucide-react";
|
|
2613
2613
|
import { useTranslation as useTranslation6 } from "react-i18next";
|
|
2614
2614
|
import { jsx as jsx118, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
2615
|
-
var LanguageToggle = ({ align
|
|
2616
|
-
const { i18n } = useTranslation6();
|
|
2615
|
+
var LanguageToggle = ({ align = "start", options = {}, variant = "outline" }) => {
|
|
2616
|
+
const { i18n } = useTranslation6("libui");
|
|
2617
2617
|
return /* @__PURE__ */ jsxs40(DropdownMenu, { children: [
|
|
2618
|
-
/* @__PURE__ */ jsx118(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx118(Button, { size: "icon", variant
|
|
2618
|
+
/* @__PURE__ */ jsx118(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx118(Button, { size: "icon", variant, children: /* @__PURE__ */ jsx118(LanguagesIcon, {}) }) }),
|
|
2619
2619
|
/* @__PURE__ */ jsx118(DropdownMenu.Content, { align, children: Object.keys(options).map((option) => /* @__PURE__ */ jsx118(DropdownMenu.Item, { onClick: () => void i18n.changeLanguage(option), children: options[option] }, option)) })
|
|
2620
2620
|
] });
|
|
2621
2621
|
};
|
|
@@ -3051,7 +3051,7 @@ import { jsx as jsx126, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
|
3051
3051
|
var LegacyClientTable = ({ data, ...props }) => {
|
|
3052
3052
|
const [currentPage, setCurrentPage] = useState7(1);
|
|
3053
3053
|
const [entriesPerPage] = useState7(10);
|
|
3054
|
-
const { t } = useTranslation7();
|
|
3054
|
+
const { t } = useTranslation7("libui");
|
|
3055
3055
|
const pageCount = Math.ceil(data.length / entriesPerPage);
|
|
3056
3056
|
const firstEntry = data.length === 0 ? 0 : (currentPage - 1) * entriesPerPage + 1;
|
|
3057
3057
|
const lastEntry = Math.min(firstEntry + entriesPerPage - 1, data.length);
|
|
@@ -3059,7 +3059,7 @@ var LegacyClientTable = ({ data, ...props }) => {
|
|
|
3059
3059
|
return /* @__PURE__ */ jsxs48("div", { children: [
|
|
3060
3060
|
/* @__PURE__ */ jsx126(LegacyTable, { data: currentEntries, ...props }),
|
|
3061
3061
|
/* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between px-1 py-3", children: [
|
|
3062
|
-
/* @__PURE__ */ jsx126("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx126("p", { className: "text-sm font-medium text-muted-foreground", children: t("
|
|
3062
|
+
/* @__PURE__ */ jsx126("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx126("p", { className: "text-sm font-medium text-muted-foreground", children: t("pagination.info", {
|
|
3063
3063
|
first: firstEntry,
|
|
3064
3064
|
last: lastEntry,
|
|
3065
3065
|
total: data.length
|
|
@@ -3073,7 +3073,7 @@ var LegacyClientTable = ({ data, ...props }) => {
|
|
|
3073
3073
|
onClick: () => {
|
|
3074
3074
|
setCurrentPage(currentPage - 1);
|
|
3075
3075
|
},
|
|
3076
|
-
children: t("
|
|
3076
|
+
children: t("pagination.previous")
|
|
3077
3077
|
}
|
|
3078
3078
|
),
|
|
3079
3079
|
/* @__PURE__ */ jsx126(
|
|
@@ -3084,7 +3084,7 @@ var LegacyClientTable = ({ data, ...props }) => {
|
|
|
3084
3084
|
onClick: () => {
|
|
3085
3085
|
setCurrentPage(currentPage + 1);
|
|
3086
3086
|
},
|
|
3087
|
-
children: t("
|
|
3087
|
+
children: t("pagination.next")
|
|
3088
3088
|
}
|
|
3089
3089
|
)
|
|
3090
3090
|
] })
|
|
@@ -3135,7 +3135,7 @@ function LineGraphComponent({
|
|
|
3135
3135
|
lines,
|
|
3136
3136
|
xAxis
|
|
3137
3137
|
}) {
|
|
3138
|
-
const { i18n } = useTranslation8();
|
|
3138
|
+
const { i18n } = useTranslation8("libui");
|
|
3139
3139
|
const [theme] = useTheme();
|
|
3140
3140
|
return /* @__PURE__ */ jsx127(ResponsiveContainer, { height: 400, width: "100%", children: /* @__PURE__ */ jsxs49(LineChart, { data: [...data], margin: { bottom: 5, left: 15, right: 15, top: 5 }, children: [
|
|
3141
3141
|
/* @__PURE__ */ jsx127(CartesianGrid, { stroke: "#64748b", strokeDasharray: "5 5" }),
|
|
@@ -3432,7 +3432,7 @@ var NotificationIcon = ({ type }) => {
|
|
|
3432
3432
|
// src/components/NotificationHub/NotificationHub.tsx
|
|
3433
3433
|
import { jsx as jsx140, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
3434
3434
|
var NotificationHub = ({ timeout = 5e3 }) => {
|
|
3435
|
-
const { t } = useTranslation9();
|
|
3435
|
+
const { t } = useTranslation9("libui");
|
|
3436
3436
|
const { dismissNotification, notifications } = useNotificationsStore();
|
|
3437
3437
|
return /* @__PURE__ */ jsx140("div", { className: "fixed bottom-0 z-50 w-full print:hidden", children: /* @__PURE__ */ jsx140(AnimatePresence3, { children: notifications.map((item) => /* @__PURE__ */ jsx140(
|
|
3438
3438
|
motion3.div,
|
|
@@ -3631,7 +3631,7 @@ import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
|
3631
3631
|
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
3632
3632
|
import { jsx as jsx152, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
3633
3633
|
var SearchBar = ({ className, onClick, onValueChange, placeholder, value }) => {
|
|
3634
|
-
const { t } = useTranslation12();
|
|
3634
|
+
const { t } = useTranslation12("libui");
|
|
3635
3635
|
return /* @__PURE__ */ jsxs57("form", { className: cn("relative", className), children: [
|
|
3636
3636
|
/* @__PURE__ */ jsx152(SearchIcon2, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
3637
3637
|
/* @__PURE__ */ jsx152(
|