@seij/common-ui 0.1.6 → 0.1.8
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 +0 -1
- package/dist/init/SeijUIProvider.d.ts.map +1 -1
- package/dist/init/SeijUIProvider.js.map +1 -1
- package/dist/lib/applicationshell/ApplicationShell.d.ts +73 -2
- package/dist/lib/applicationshell/ApplicationShell.d.ts.map +1 -1
- package/dist/lib/applicationshell/ApplicationShell.js +75 -70
- package/dist/lib/applicationshell/ApplicationShell.js.map +1 -1
- package/dist/lib/applicationshell/ApplicationShellHamburger.d.ts +4 -0
- package/dist/lib/applicationshell/ApplicationShellHamburger.d.ts.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellHamburger.js +17 -0
- package/dist/lib/applicationshell/ApplicationShellHamburger.js.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellPanelContract.d.ts +5 -0
- package/dist/lib/applicationshell/ApplicationShellPanelContract.d.ts.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellPanelContract.js +19 -0
- package/dist/lib/applicationshell/ApplicationShellPanelContract.js.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellRails.d.ts +11 -0
- package/dist/lib/applicationshell/ApplicationShellRails.d.ts.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellRails.js +111 -0
- package/dist/lib/applicationshell/ApplicationShellRails.js.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellSidebar.d.ts +18 -0
- package/dist/lib/applicationshell/ApplicationShellSidebar.d.ts.map +1 -0
- package/dist/lib/applicationshell/ApplicationShellSidebar.js +52 -0
- package/dist/lib/applicationshell/ApplicationShellSidebar.js.map +1 -0
- package/dist/lib/applicationshell/TitleBar.d.ts +6 -2
- package/dist/lib/applicationshell/TitleBar.d.ts.map +1 -1
- package/dist/lib/applicationshell/TitleBar.js +39 -33
- package/dist/lib/applicationshell/TitleBar.js.map +1 -1
- package/dist/lib/button_bar/ButtonBar.d.ts.map +1 -1
- package/dist/lib/button_bar/ButtonBar.js.map +1 -1
- package/dist/lib/commons/currencysymbol.js.map +1 -1
- package/dist/lib/errorbox/ErrorBox.js +6 -6
- package/dist/lib/errorbox/ErrorBox.js.map +1 -1
- package/dist/lib/i18n/i18n.detect.d.ts.map +1 -1
- package/dist/lib/i18n/i18n.react.d.ts.map +1 -1
- package/dist/lib/i18n/i18n.react.js.map +1 -1
- package/dist/lib/i18n/i18n.types.d.ts.map +1 -1
- package/dist/lib/i18n/index.d.ts.map +1 -1
- package/dist/lib/inlineedit/InlineEdit.js +12 -12
- package/dist/lib/inlineedit/InlineEdit.js.map +1 -1
- package/dist/lib/listview/ListView.js +25 -24
- package/dist/lib/listview/ListView.js.map +1 -1
- package/dist/lib/localdate/InputLocalDate.js +3 -2
- package/dist/lib/localdate/InputLocalDate.js.map +1 -1
- package/dist/lib/month/InputMonth.js +9 -8
- package/dist/lib/month/InputMonth.js.map +1 -1
- package/dist/lib/navigation/Navigation.d.ts +5 -1
- package/dist/lib/navigation/Navigation.d.ts.map +1 -1
- package/dist/lib/navigation/Navigation.js +24 -26
- package/dist/lib/navigation/Navigation.js.map +1 -1
- package/dist/lib/navigation/Navigation.types.d.ts +59 -17
- package/dist/lib/navigation/Navigation.types.d.ts.map +1 -1
- package/dist/lib/responsive/useMobile.d.ts +2 -0
- package/dist/lib/responsive/useMobile.d.ts.map +1 -0
- package/dist/lib/responsive/useMobile.js +12 -0
- package/dist/lib/responsive/useMobile.js.map +1 -0
- package/dist/lib/view_layout/ViewTitle.d.ts.map +1 -1
- package/dist/lib/view_layout/ViewTitle.js +22 -25
- package/dist/lib/view_layout/ViewTitle.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLocalDate.js","sources":["../../../src/lib/localdate/InputLocalDate.tsx"],"sourcesContent":["import { Input, makeStyles } from \"@fluentui/react-components\";\nimport { LocalDate } from \"@seij/common-types\";\nimport { forwardRef, InputHTMLAttributes, useCallback, useEffect, useState } from \"react\";\nimport { Rifm } from \"rifm\";\nimport { useI18n } from \"../i18n
|
|
1
|
+
{"version":3,"file":"InputLocalDate.js","sources":["../../../src/lib/localdate/InputLocalDate.tsx"],"sourcesContent":["import { Input, makeStyles } from \"@fluentui/react-components\";\nimport { LocalDate } from \"@seij/common-types\";\nimport { forwardRef, InputHTMLAttributes, useCallback, useEffect, useState } from \"react\";\nimport { Rifm } from \"rifm\";\nimport { useI18n } from \"../i18n\";\n\nconst useStyles = makeStyles({\n root: {\n width: \"8em\",\n \"> input\": {\n textAlign: \"right\",\n },\n },\n});\n\nconst parseDigits = (string: string): string => (string.match(/\\d+/g) || []).join(\"\");\nconst formatDate = (string: string): string => {\n const digits = parseDigits(string);\n const chars = digits.split(\"\");\n return chars.reduce((r, v, index) => (index === 2 || index === 4 ? `${r}/${v}` : `${r}${v}`), \"\").substr(0, 10);\n};\n\nconst formatDateWithAppend = (string: string): string => {\n const res = formatDate(string);\n\n if (string.endsWith(\"/\")) {\n if (res.length === 2) {\n return `${res}/`;\n }\n\n if (res.length === 5) {\n return `${res}/`;\n }\n }\n return res;\n};\nconst appendHyphen = (v: string): string => (v.length === 2 || v.length === 5 ? `${v}/` : v);\n\n/**\n * Input field for local dates with automatic adding of /\n * Values are in ISO8601 date part only\n *\n * Controlled component only\n *\n * @param props same props as an input\n * @return {JSX.Element}\n */\nexport interface InputLocalDateProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"value\" | \"onChange\"> {\n value?: string;\n onValueChange?: (value: LocalDate) => void;\n}\n\nexport const InputLocalDate = forwardRef<HTMLInputElement, InputLocalDateProps>((props, ref) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onValueChange, value = \"\", children, size, defaultValue, type, ...delegatedProps } = props;\n const classNames = useStyles();\n const { localDatePlaceholder, localDateFormattedToISO, localDateISOToFormattedInput } = useI18n();\n const [formattedA, setFormattedA] = useState(localDateISOToFormattedInput(value));\n const [normalizedValue, setNormalizedValue] = useState(value);\n\n useEffect(() => {\n if (value !== normalizedValue) {\n setNormalizedValue(value);\n setFormattedA(localDateISOToFormattedInput(value));\n }\n });\n\n const handleChange = useCallback(\n (inputValue: string) => {\n setFormattedA(inputValue);\n const parsed = localDateFormattedToISO(inputValue);\n if (parsed !== normalizedValue) {\n setNormalizedValue(parsed);\n if (onValueChange) onValueChange(parsed);\n }\n },\n [setFormattedA, normalizedValue, setNormalizedValue, onValueChange, localDateFormattedToISO],\n );\n return (\n <Rifm\n accept={/\\d+/g}\n mask={10 <= formattedA.length}\n format={formatDateWithAppend}\n append={appendHyphen}\n value={formattedA}\n onChange={handleChange}\n >\n {({ value, onChange }) => (\n <Input\n placeholder={localDatePlaceholder()}\n className={classNames.root}\n value={value}\n onChange={onChange}\n ref={ref}\n {...delegatedProps}\n />\n )}\n </Rifm>\n );\n});\n"],"names":["useStyles","makeStyles","parseDigits","string","formatDate","r","v","index","formatDateWithAppend","res","appendHyphen","InputLocalDate","forwardRef","props","ref","onValueChange","value","children","size","defaultValue","type","delegatedProps","classNames","localDatePlaceholder","localDateFormattedToISO","localDateISOToFormattedInput","useI18n","formattedA","setFormattedA","useState","normalizedValue","setNormalizedValue","useEffect","handleChange","useCallback","inputValue","parsed","jsx","Rifm","onChange","Input"],"mappings":";;;;;;AAMA,MAAMA,IAAYC,EAAW;AAAA,EAC3B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,MACT,WAAW;AAAA,IAAA;AAAA,EACb;AAEJ,CAAC,GAEKC,IAAc,CAACC,OAA4BA,EAAO,MAAM,MAAM,KAAK,CAAA,GAAI,KAAK,EAAE,GAC9EC,IAAa,CAACD,MACHD,EAAYC,CAAM,EACZ,MAAM,EAAE,EAChB,OAAO,CAACE,GAAGC,GAAGC,MAAWA,MAAU,KAAKA,MAAU,IAAI,GAAGF,CAAC,IAAIC,CAAC,KAAK,GAAGD,CAAC,GAAGC,CAAC,IAAK,EAAE,EAAE,OAAO,GAAG,EAAE,GAG1GE,I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AET,UAAA,CAAC,EAAE,OAAAjB,GAAO,UAAAuB,QACT,gBAAAF;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,aAAajB,EAAA;AAAA,UACb,WAAWD,EAAW;AAAA,UACtB,OAAON;AAAAA,UACP,UAAAuB;AAAA,UACA,KAAAzB;AAAA,UACC,GAAGO;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import "../i18n/i18n.service.js";
|
|
4
|
+
import { useI18n as a } from "../i18n/i18n.react.js";
|
|
5
|
+
import { InputSelect as i } from "../select/InputSelect.js";
|
|
6
|
+
const g = (r) => {
|
|
7
|
+
const { value: l, onValueChange: m, required: h, ...c } = r, { monthList: t, t: o } = a(), p = u(() => {
|
|
7
8
|
const e = t().map((n) => ({ code: "" + n.code, label: n.label }));
|
|
8
9
|
return [{ code: "", label: "-- " + o("InputSelect_select") + " --" }, ...e];
|
|
9
10
|
}, [t, o]);
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ s(i, { options: p, value: "" + l, onValueChange: (e) => m(parseInt(e)), ...c });
|
|
11
12
|
};
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
g as InputMonth
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=InputMonth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputMonth.js","sources":["../../../src/lib/month/InputMonth.tsx"],"sourcesContent":["import { Month } from \"@seij/common-types\";\nimport React, { useMemo } from \"react\";\nimport { useI18n } from \"../i18n
|
|
1
|
+
{"version":3,"file":"InputMonth.js","sources":["../../../src/lib/month/InputMonth.tsx"],"sourcesContent":["import { Month } from \"@seij/common-types\";\nimport React, { useMemo } from \"react\";\nimport { useI18n } from \"../i18n\";\nimport { InputSelect } from \"../select/InputSelect\";\n\ntype HTMLInputElementCurated = Omit<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n \"value\" | \"defaultValue\" | \"onChange\" | \"children\"\n>;\n\nexport interface InputMonthProps extends HTMLInputElementCurated {\n value: Month;\n onValueChange: (value: Month) => unknown;\n}\n\n/**\n * Permet de saisir un mois.\n */\nexport const InputMonth: React.FC<InputMonthProps> = (props) => {\n const { value, onValueChange, required, ...other } = props;\n const { monthList, t } = useI18n();\n const options = useMemo(() => {\n const months = monthList().map((it) => ({ code: \"\" + it.code, label: it.label }));\n const emptyValueSelect = t(\"InputSelect_select\");\n return [{ code: \"\", label: \"-- \" + emptyValueSelect + \" --\" }, ...months];\n }, [monthList, t]);\n\n return (\n <InputSelect options={options} value={\"\" + value} onValueChange={(v) => onValueChange(parseInt(v))} {...other} />\n );\n};\n"],"names":["InputMonth","props","value","onValueChange","required","other","monthList","t","useI18n","options","useMemo","months","it","jsx","InputSelect","v"],"mappings":";;;;;AAkBO,MAAMA,IAAwC,CAACC,MAAU;AAC9D,QAAM,EAAE,OAAAC,GAAO,eAAAC,GAAe,UAAAC,GAAU,GAAGC,MAAUJ,GAC/C,EAAE,WAAAK,GAAW,GAAAC,EAAA,IAAMC,EAAA,GACnBC,IAAUC,EAAQ,MAAM;AAC5B,UAAMC,IAASL,EAAA,EAAY,IAAI,CAACM,OAAQ,EAAE,MAAM,KAAKA,EAAG,MAAM,OAAOA,EAAG,QAAQ;AAEhF,WAAO,CAAC,EAAE,MAAM,IAAI,OAAO,QADFL,EAAE,oBAAoB,IACO,SAAS,GAAGI,CAAM;AAAA,EAC1E,GAAG,CAACL,GAAWC,CAAC,CAAC;AAEjB,SACE,gBAAAM,EAACC,GAAA,EAAY,SAAAL,GAAkB,OAAO,KAAKP,GAAO,eAAe,CAACa,MAAMZ,EAAc,SAASY,CAAC,CAAC,GAAI,GAAGV,GAAO;AAEnH;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NavigationTreeItem } from './Navigation.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Displays a navigation menu.
|
|
4
|
+
*
|
|
5
|
+
* Current implementation is limited to 2 hierarchical levels (direct items or group/items).
|
|
6
|
+
*
|
|
7
|
+
* This will be improved later.
|
|
4
8
|
*/
|
|
5
9
|
export declare function Navigation({ items, }: {
|
|
6
10
|
/** Liste des items du menu */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation/Navigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation/Navigation.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,kBAAkB,EAInB,MAAM,oBAAoB,CAAC;AAK5B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,GACN,EAAE;IACD,8BAA8B;IAC9B,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,2CAYA"}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { NavDivider as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
function
|
|
1
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { NavDivider as v, NavItem as d, NavCategory as l, NavCategoryItem as s, NavSubItemGroup as f, NavSubItem as I } from "@fluentui/react-components";
|
|
3
|
+
import { createContext as g, useMemo as N, useContext as a } from "react";
|
|
4
|
+
import { createNavigationTreeItemServiceImpl as c } from "./NavigationService.js";
|
|
5
|
+
import { Icon as m } from "@seij/common-ui-icons";
|
|
6
|
+
const o = g(c([]));
|
|
7
|
+
function D({
|
|
8
8
|
items: e
|
|
9
9
|
}) {
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */
|
|
10
|
+
const i = N(() => c(e), [e]), n = i.findTopLevelItems();
|
|
11
|
+
return /* @__PURE__ */ t(o.Provider, { value: i, children: n.map((r) => /* @__PURE__ */ t(C, { id: r.id }, r.id)) });
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
return
|
|
13
|
+
function C({ id: e }) {
|
|
14
|
+
const n = a(o).findById(e);
|
|
15
|
+
return n.type === "divider" ? /* @__PURE__ */ t(x, { item: n }) : n.type === "page" ? /* @__PURE__ */ t(h, { item: n }) : n.type === "group" ? /* @__PURE__ */ t(y, { item: n }) : null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
function x({ item: e }) {
|
|
18
|
+
return /* @__PURE__ */ t(v, {});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
20
|
+
function y({ item: e }) {
|
|
21
|
+
const n = a(o).findChildren(e.id);
|
|
22
|
+
return /* @__PURE__ */ p(l, { value: e.id, children: [
|
|
23
|
+
/* @__PURE__ */ t(s, { icon: /* @__PURE__ */ t(m, { name: e.icon ?? "empty", size: 20 }), children: e.label }),
|
|
24
|
+
/* @__PURE__ */ t(f, { children: n.map((r) => {
|
|
25
|
+
const u = r;
|
|
26
|
+
return /* @__PURE__ */ t(I, { value: r.id, children: u.label }, r.id);
|
|
27
27
|
}) })
|
|
28
28
|
] });
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
return /* @__PURE__ */ n(v, { value: e.id, icon: /* @__PURE__ */ n(r, {}), children: /* @__PURE__ */ n(I, { children: e.label }) });
|
|
30
|
+
function h({ item: e }) {
|
|
31
|
+
return /* @__PURE__ */ t(d, { value: e.id, icon: /* @__PURE__ */ t(m, { name: e.icon ?? "empty", size: 20 }), children: e.label });
|
|
33
32
|
}
|
|
34
|
-
const z = o(S, h), A = o(x, y), H = o(N, F), l = o(R, T), J = o(k, P), K = o(D, E), Q = o(O, j), d = ({ iconName: e }) => e ? e === "dashboard" ? z : e === "users" ? A : e === "customers" ? H : e === "signout" ? J : e === "signin" ? K : e === "buildingBank" ? Q : l : l;
|
|
35
33
|
export {
|
|
36
|
-
|
|
34
|
+
D as Navigation
|
|
37
35
|
};
|
|
38
36
|
//# sourceMappingURL=Navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.js","sources":["../../../src/lib/navigation/Navigation.tsx"],"sourcesContent":["import {\n NavCategory,\n NavCategoryItem,\n NavDivider,\n NavItem,\n NavSubItem,\n NavSubItemGroup,\n
|
|
1
|
+
{"version":3,"file":"Navigation.js","sources":["../../../src/lib/navigation/Navigation.tsx"],"sourcesContent":["import {\n NavCategory,\n NavCategoryItem,\n NavDivider,\n NavItem,\n NavSubItem,\n NavSubItemGroup,\n} from \"@fluentui/react-components\";\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport {\n NavigationTreeItem,\n NavigationTreeItemDivider,\n NavigationTreeItemGroup,\n NavigationTreeItemPage,\n} from \"./Navigation.types\";\nimport { createNavigationTreeItemServiceImpl, NavigationTreeItemService } from \"./NavigationService\";\nimport { Icon } from \"@seij/common-ui-icons\";\n\nconst itemsService = createContext<NavigationTreeItemService>(createNavigationTreeItemServiceImpl([]));\n/**\n * Displays a navigation menu.\n *\n * Current implementation is limited to 2 hierarchical levels (direct items or group/items).\n *\n * This will be improved later.\n */\nexport function Navigation({\n items,\n}: {\n /** Liste des items du menu */\n items: NavigationTreeItem[];\n}) {\n const service = useMemo(() => createNavigationTreeItemServiceImpl(items), [items]);\n\n const topLevelItems = service.findTopLevelItems();\n\n return (\n <itemsService.Provider value={service}>\n {topLevelItems.map((it) => (\n <NavigationTreeItemComponent key={it.id} id={it.id} />\n ))}\n </itemsService.Provider>\n );\n}\n\nfunction NavigationTreeItemComponent({ id }: { id: string }) {\n const ctx = useContext(itemsService);\n const item = ctx.findById(id);\n\n if (item.type === \"divider\") return <NavigationTreeItemDividerComponent item={item as NavigationTreeItemDivider} />;\n if (item.type === \"page\") return <NavigationTreeItemPageComponent item={item as NavigationTreeItemPage} />;\n if (item.type === \"group\") return <NavigationTreeItemGroupComponent item={item as NavigationTreeItemGroup} />;\n return null;\n}\n\nfunction NavigationTreeItemDividerComponent({ item }: { item: NavigationTreeItemDivider }) {\n return <NavDivider />;\n}\nfunction NavigationTreeItemGroupComponent({ item }: { item: NavigationTreeItemGroup }) {\n const ctx = useContext(itemsService);\n const itemChildren = ctx.findChildren(item.id);\n return (\n <NavCategory value={item.id}>\n <NavCategoryItem icon={<Icon name={item.icon ?? \"empty\"} size={20} />}>{item.label}</NavCategoryItem>\n <NavSubItemGroup>\n {itemChildren.map((child) => {\n const page = child as NavigationTreeItemPage;\n return (\n <NavSubItem key={child.id} value={child.id}>\n {page.label}\n </NavSubItem>\n );\n })}\n </NavSubItemGroup>\n </NavCategory>\n );\n}\nfunction NavigationTreeItemPageComponent({ item }: { item: NavigationTreeItemPage }) {\n return (\n <NavItem value={item.id} icon={<Icon name={item.icon ?? \"empty\"} size={20} />}>\n {item.label}\n </NavItem>\n );\n}\n"],"names":["itemsService","createContext","createNavigationTreeItemServiceImpl","Navigation","items","service","useMemo","topLevelItems","it","jsx","NavigationTreeItemComponent","id","item","useContext","NavigationTreeItemDividerComponent","NavigationTreeItemPageComponent","NavigationTreeItemGroupComponent","NavDivider","itemChildren","jsxs","NavCategory","NavCategoryItem","Icon","NavSubItemGroup","child","page","NavSubItem","NavItem"],"mappings":";;;;;AAmBA,MAAMA,IAAeC,EAAyCC,EAAoC,CAAA,CAAE,CAAC;AAQ9F,SAASC,EAAW;AAAA,EACzB,OAAAC;AACF,GAGG;AACD,QAAMC,IAAUC,EAAQ,MAAMJ,EAAoCE,CAAK,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AAQ,SAAS,MAAM,GAAA,CAAI,GACxE,YAAK,OACR;AAEJ;"}
|
|
@@ -1,48 +1,90 @@
|
|
|
1
|
+
import { IconName } from '@seij/common-ui-icons';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* All icon names supported by the Navigation menu.
|
|
4
|
+
*
|
|
5
|
+
* These are semantic identifiers consumed by the UI layer to render a visual
|
|
6
|
+
* icon next to a navigation entry. Keep this list in sync with the icon set
|
|
7
|
+
* actually available in the navigation component.
|
|
3
8
|
*/
|
|
4
|
-
export type NavigationTreeIconName =
|
|
9
|
+
export type NavigationTreeIconName = IconName;
|
|
5
10
|
/**
|
|
6
|
-
*
|
|
11
|
+
* Kind of a navigation item.
|
|
12
|
+
*
|
|
13
|
+
* - "group": non-clickable category that can contain items
|
|
14
|
+
* - "page": clickable leaf that may navigate to `path`
|
|
15
|
+
* - "divider": visual separator between items in the same level
|
|
7
16
|
*/
|
|
8
17
|
export type NavigationTreeItemType = "group" | "page" | "divider";
|
|
9
18
|
/**
|
|
10
|
-
*
|
|
19
|
+
* Visibility rule for an item depending on authentication status.
|
|
20
|
+
*
|
|
21
|
+
* - "loggedout": show only when the user is NOT authenticated
|
|
22
|
+
* - "loggedin": show only when the user IS authenticated
|
|
11
23
|
*/
|
|
12
24
|
export type NavigationTreeItemRule = "loggedout" | "loggedin";
|
|
13
25
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
26
|
+
* A navigation tree item definition. Provide a flat list of items — the
|
|
27
|
+
* component will use `parentId` (for pages) to reconstruct the hierarchy.
|
|
28
|
+
*
|
|
29
|
+
* The goal is to be able to get navigation items as serializable DTO from backends and plugins.
|
|
30
|
+
*
|
|
31
|
+
* Notes
|
|
32
|
+
* - Use `NavigationTreeItemGroup` to create non-clickable categories.
|
|
33
|
+
* - Use `NavigationTreeItemPage` for actual leaf entries that may have a `path`.
|
|
34
|
+
* - Use `NavigationTreeItemDivider` to insert visual separators within a group.
|
|
16
35
|
*/
|
|
17
36
|
export type NavigationTreeItem = NavigationTreeItemPage | NavigationTreeItemGroup | NavigationTreeItemDivider;
|
|
18
37
|
export interface NavigationTreeItemBase {
|
|
19
|
-
/**
|
|
38
|
+
/** Unique identifier of the navigation entry. Stable across renders. */
|
|
20
39
|
id: string;
|
|
21
|
-
/**
|
|
40
|
+
/** Item kind: group, page, or divider. */
|
|
22
41
|
type: NavigationTreeItemType;
|
|
23
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Optional visibility rule based on authentication status.
|
|
44
|
+
*
|
|
45
|
+
* The rule is used by security layers when they are availble, it means that, using just "common-ui"
|
|
46
|
+
* it doesn't do anything, but "@seij/common-auth" uses it to filter out items.
|
|
47
|
+
*
|
|
48
|
+
* Participates in the goal of having navigation items coming from a backend or plugins in serializable formats.
|
|
49
|
+
**/
|
|
24
50
|
rule?: NavigationTreeItemRule;
|
|
25
51
|
}
|
|
26
52
|
export interface NavigationTreeItemPage extends NavigationTreeItemBase {
|
|
27
|
-
/**
|
|
53
|
+
/** Display label shown in the navigation. */
|
|
28
54
|
label: string;
|
|
29
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Optional description placed just under the label (not rendered in the UI by default).
|
|
57
|
+
* Can be used for help text or tooltips depending on the consumer.
|
|
58
|
+
*/
|
|
30
59
|
description?: string;
|
|
31
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Parent group id, or null if the page is at the root level.
|
|
62
|
+
*
|
|
63
|
+
* Example: parentId = "admin" to place the page under the "Admin" group.
|
|
64
|
+
*/
|
|
32
65
|
parentId: string | null;
|
|
33
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Route path to navigate to when the item is selected. If omitted, the item is still
|
|
68
|
+
* selectable but no automatic navigation will occur; you may handle it manually.
|
|
69
|
+
*/
|
|
34
70
|
path?: string;
|
|
35
|
-
/**
|
|
71
|
+
/** Optional icon to render next to the label. */
|
|
36
72
|
icon?: NavigationTreeIconName;
|
|
37
73
|
}
|
|
38
74
|
export interface NavigationTreeItemGroup extends NavigationTreeItemBase {
|
|
39
|
-
/**
|
|
75
|
+
/** Display label for the group header. */
|
|
40
76
|
label: string;
|
|
41
|
-
/**
|
|
77
|
+
/** Optional description (not rendered in the UI by default). */
|
|
42
78
|
description?: string;
|
|
43
|
-
/**
|
|
79
|
+
/** Optional icon to render next to the group label. */
|
|
44
80
|
icon?: NavigationTreeIconName;
|
|
45
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Visual separator between items.
|
|
84
|
+
*
|
|
85
|
+
* Only the base fields are used: set `type: "divider"` and a unique `id`.
|
|
86
|
+
* Other base fields like `rule` may still control visibility.
|
|
87
|
+
*/
|
|
46
88
|
export interface NavigationTreeItemDivider extends NavigationTreeItemBase {
|
|
47
89
|
}
|
|
48
90
|
//# sourceMappingURL=Navigation.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.types.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation/Navigation.types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Navigation.types.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation/Navigation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,uBAAuB,GAAG,yBAAyB,CAAC;AAE9G,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,IAAI,EAAE,sBAAsB,CAAC;IAC7B;;;;;;;QAOI;IACJ,IAAI,CAAC,EAAE,sBAAsB,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,CAAC,EAAE,sBAAsB,CAAC;CAC/B;AACD,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;IACrE,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,IAAI,CAAC,EAAE,sBAAsB,CAAC;CAC/B;AACD;;;;;GAKG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMobile.d.ts","sourceRoot":"","sources":["../../../src/lib/responsive/useMobile.tsx"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,UAAU,SAAM,WAa3C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useState as r, useEffect as c } from "react";
|
|
2
|
+
function a(e = 768) {
|
|
3
|
+
const [i, s] = r(() => window.innerWidth < e);
|
|
4
|
+
return c(() => {
|
|
5
|
+
const t = window.matchMedia(`(max-width: ${e}px)`), n = (o) => s(o.matches);
|
|
6
|
+
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
7
|
+
}, [e]), i;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
a as useIsMobile
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useMobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMobile.js","sources":["../../../src/lib/responsive/useMobile.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport function useIsMobile(breakpoint = 768) {\n const [isMobile, setIsMobile] = useState(() => window.innerWidth < breakpoint);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(`(max-width: ${breakpoint}px)`);\n\n const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches);\n mediaQuery.addEventListener(\"change\", handler);\n\n return () => mediaQuery.removeEventListener(\"change\", handler);\n }, [breakpoint]);\n\n return isMobile;\n}\n"],"names":["useIsMobile","breakpoint","isMobile","setIsMobile","useState","useEffect","mediaQuery","handler","e"],"mappings":";AAEO,SAASA,EAAYC,IAAa,KAAK;AAC5C,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,MAAM,OAAO,aAAaH,CAAU;AAE7E,SAAAI,EAAU,MAAM;AACd,UAAMC,IAAa,OAAO,WAAW,eAAeL,CAAU,KAAK,GAE7DM,IAAU,CAACC,MAA2BL,EAAYK,EAAE,OAAO;AACjE,WAAAF,EAAW,iBAAiB,UAAUC,CAAO,GAEtC,MAAMD,EAAW,oBAAoB,UAAUC,CAAO;AAAA,EAC/D,GAAG,CAACN,CAAU,CAAC,GAERC;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTitle.d.ts","sourceRoot":"","sources":["../../../src/lib/view_layout/ViewTitle.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewTitle.d.ts","sourceRoot":"","sources":["../../../src/lib/view_layout/ViewTitle.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;CAC9C;AAmCD;;GAEG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,MAAM,EACN,OAAO,GACR,EAAE;IACD,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;IACpB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,2CAuDA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { makeStyles as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const v =
|
|
1
|
+
import { jsxs as r, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as y, Button as c, Title3 as x, Menu as b, MenuTrigger as g, MenuPopover as k, MenuList as C, MenuItem as I } from "@fluentui/react-components";
|
|
3
|
+
import { isFunction as A } from "lodash-es";
|
|
4
|
+
import { Icon as s } from "@seij/common-ui-icons";
|
|
5
|
+
const v = y({
|
|
6
6
|
root: {
|
|
7
7
|
display: "flex",
|
|
8
8
|
align: "center",
|
|
@@ -34,37 +34,34 @@ const v = h({
|
|
|
34
34
|
justifyContent: "flex-end"
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
function
|
|
37
|
+
function S({
|
|
38
38
|
children: l,
|
|
39
39
|
onBack: t,
|
|
40
40
|
actions: i
|
|
41
41
|
}) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
(i ?? []).find((
|
|
42
|
+
const a = v(), o = A(t), m = (i ?? []).filter((e) => e.type === "ADDITIONAL"), p = (i ?? []).filter((e) => e.type === "SECONDARY"), f = (i ?? []).filter((e) => e.type === "PRIMARY"), u = () => {
|
|
43
|
+
o && t && t();
|
|
44
|
+
}, d = async (e) => {
|
|
45
|
+
(i ?? []).find((h) => h.id === e)?.onClick();
|
|
46
46
|
};
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ n("div", { className:
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
p.length > 0 && p.map((e) => /* @__PURE__ */ n(
|
|
52
|
-
|
|
47
|
+
return /* @__PURE__ */ r("div", { className: a.root, children: [
|
|
48
|
+
o && /* @__PURE__ */ n("div", { className: a.backButton, children: /* @__PURE__ */ n(c, { icon: /* @__PURE__ */ n(s, { name: "back" }), appearance: "subtle", onClick: u }) }),
|
|
49
|
+
/* @__PURE__ */ n("div", { className: a.title, children: /* @__PURE__ */ n(x, { children: l }) }),
|
|
50
|
+
/* @__PURE__ */ r("div", { className: a.actions, children: [
|
|
51
|
+
p.length > 0 && p.map((e) => /* @__PURE__ */ n(c, { disabled: e.disabled, appearance: "secondary", onClick: () => d(e.id), children: e.label }, e.id)),
|
|
52
|
+
f.length > 0 && f.map((e) => /* @__PURE__ */ n(c, { disabled: e.disabled, appearance: "primary", onClick: () => d(e.id), children: e.label }, e.id))
|
|
53
53
|
] }),
|
|
54
|
-
/* @__PURE__ */ n("div", { className:
|
|
55
|
-
/* @__PURE__ */ n(
|
|
56
|
-
/* @__PURE__ */ n(
|
|
54
|
+
/* @__PURE__ */ n("div", { className: a.moreActions, children: m.length > 0 && /* @__PURE__ */ r(b, { positioning: { autoSize: !0 }, children: [
|
|
55
|
+
/* @__PURE__ */ n(g, { disableButtonEnhancement: !0, children: /* @__PURE__ */ n(c, { icon: /* @__PURE__ */ n(s, { name: "more_menu_vertical" }) }) }),
|
|
56
|
+
/* @__PURE__ */ n(k, { children: /* @__PURE__ */ n(C, { children: m.map((e) => /* @__PURE__ */ n(M, { action: e, onClick: d }, e.id)) }) })
|
|
57
57
|
] }) })
|
|
58
58
|
] });
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return /* @__PURE__ */ n("span", {});
|
|
62
|
-
}
|
|
63
|
-
function L({ action: l, onClick: t }) {
|
|
60
|
+
function M({ action: l, onClick: t }) {
|
|
64
61
|
let i;
|
|
65
|
-
return l.icon === "plus" ? i =
|
|
62
|
+
return l.icon === "plus" ? i = /* @__PURE__ */ n(s, { name: "add" }) : l.icon === "trash" ? i = /* @__PURE__ */ n(s, { name: "delete" }) : i = /* @__PURE__ */ n(s, { name: "empty" }), /* @__PURE__ */ n(I, { disabled: l.disabled, onClick: () => t(l.id), icon: i, children: l.label });
|
|
66
63
|
}
|
|
67
64
|
export {
|
|
68
|
-
|
|
65
|
+
S as ViewTitle
|
|
69
66
|
};
|
|
70
67
|
//# sourceMappingURL=ViewTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTitle.js","sources":["../../../src/lib/view_layout/ViewTitle.tsx"],"sourcesContent":["import {\n Button,\n makeStyles,\n Menu,\n MenuItem,\n MenuList,\n MenuPopover,\n MenuTrigger,\n Title3,\n} from \"@fluentui/react-components\";\nimport {
|
|
1
|
+
{"version":3,"file":"ViewTitle.js","sources":["../../../src/lib/view_layout/ViewTitle.tsx"],"sourcesContent":["import {\n Button,\n makeStyles,\n Menu,\n MenuItem,\n MenuList,\n MenuPopover,\n MenuTrigger,\n Title3,\n} from \"@fluentui/react-components\";\n\nimport { isFunction } from \"lodash-es\";\nimport { ReactNode } from \"react\";\nimport { Icon } from \"@seij/common-ui-icons\";\n\nexport interface Action {\n id: string;\n label: string;\n icon?: \"plus\" | \"trash\";\n onClick: () => any;\n disabled?: boolean;\n type: \"PRIMARY\" | \"SECONDARY\" | \"ADDITIONAL\";\n}\n\nconst useStyles = makeStyles({\n root: {\n display: \"flex\",\n align: \"center\",\n justify: \"space-between\",\n justifyContent: \"center\",\n height: \"48px\",\n },\n title: {\n flex: 1,\n display: \"flex\",\n alignItems: \"center\",\n },\n backButton: {\n flex: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n },\n actions: {\n flex: 0,\n display: \"flex\",\n alignItems: \"center\",\n },\n moreActions: {\n flex: 0,\n display: \"flex\",\n alignItems: \"center\",\n minWidth: \"48px\",\n justifyContent: \"flex-end\",\n },\n});\n\n/**\n * Zone de titre d'une vue\n */\nexport function ViewTitle({\n children,\n onBack,\n actions,\n}: {\n /** Titre de la vue (en tout cas ce que l'on met dans la zone de titre) */\n children: ReactNode;\n /** Si spécifié, on ajoute une fleche \"back\" pour revenir en arrière */\n onBack?: () => void;\n /** Liste d'actions a ajouter à droite dans la zone d'actions */\n actions?: Action[];\n}) {\n const styles = useStyles();\n\n const displayBackButton = isFunction(onBack);\n const additionalList = (actions ?? []).filter((it) => it.type === \"ADDITIONAL\");\n const secondaryList = (actions ?? []).filter((it) => it.type === \"SECONDARY\");\n const primary = (actions ?? []).filter((it) => it.type === \"PRIMARY\");\n const handleBack = () => {\n if (displayBackButton && onBack) onBack();\n };\n const handleClick = async (id: string) => {\n (actions ?? []).find((it) => it.id === id)?.onClick();\n };\n return (\n <div className={styles.root}>\n {displayBackButton && (\n <div className={styles.backButton}>\n <Button icon={<Icon name={\"back\"} />} appearance=\"subtle\" onClick={handleBack} />\n </div>\n )}\n <div className={styles.title}>\n <Title3>{children}</Title3>\n </div>\n <div className={styles.actions}>\n {secondaryList.length > 0 &&\n secondaryList.map((it) => (\n <Button key={it.id} disabled={it.disabled} appearance=\"secondary\" onClick={() => handleClick(it.id)}>\n {it.label}\n </Button>\n ))}\n {primary.length > 0 &&\n primary.map((it) => (\n <Button key={it.id} disabled={it.disabled} appearance=\"primary\" onClick={() => handleClick(it.id)}>\n {it.label}\n </Button>\n ))}\n </div>\n <div className={styles.moreActions}>\n {additionalList.length > 0 && (\n <Menu positioning={{ autoSize: true }}>\n <MenuTrigger disableButtonEnhancement>\n <Button icon={<Icon name=\"more_menu_vertical\" />} />\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {additionalList.map((it) => (\n <AdditionalActionMenuItem key={it.id} action={it} onClick={handleClick} />\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n )}\n </div>\n </div>\n );\n}\n\nfunction AdditionalActionMenuItem({ action, onClick }: { action: Action; onClick: (id: string) => void }) {\n let icon: any;\n if (action.icon === \"plus\") {\n icon = <Icon name=\"add\" />;\n } else if (action.icon === \"trash\") {\n icon = <Icon name=\"delete\" />;\n } else {\n icon = <Icon name=\"empty\" />;\n }\n return (\n <MenuItem disabled={action.disabled} onClick={() => onClick(action.id)} icon={icon}>\n {action.label}\n </MenuItem>\n );\n}\n"],"names":["useStyles","makeStyles","ViewTitle","children","onBack","actions","styles","displayBackButton","isFunction","additionalList","it","secondaryList","primary","handleBack","handleClick","id","jsxs","Button","jsx","Icon","Title3","Menu","MenuTrigger","MenuPopover","MenuList","AdditionalActionMenuItem","action","onClick","icon","MenuItem"],"mappings":";;;;AAwBA,MAAMA,IAAYC,EAAW;AAAA,EAC3B,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,QAAQ;AAAA,EAAA;AAAA,EAEV,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,EAAA;AAAA,EAEd,YAAY;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,EAAA;AAAA,EAElB,SAAS;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,EAAA;AAAA,EAEd,aAAa;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,gBAAgB;AAAA,EAAA;AAEpB,CAAC;AAKM,SAASC,EAAU;AAAA,EACxB,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AACF,GAOG;AACD,QAAMC,IAASN,EAAA,GAETO,IAAoBC,EAAWJ,CAAM,GACrCK,KAAkBJ,KAAW,IAAI,OAAO,CAACK,MAAOA,EAAG,SAAS,YAAY,G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UAAU,MAC7B,UAAA;AAAA,MAAA,gBAAAH,EAACI,GAAA,EAAY,0BAAwB,IACnC,UAAA,gBAAAJ,EAACD,GAAA,EAAO,MAAM,gBAAAC,EAACC,GAAA,EAAK,MAAK,qBAAA,CAAqB,EAAA,CAAI,GACpD;AAAA,wBACCI,GAAA,EACC,UAAA,gBAAAL,EAACM,KACE,UAAAf,EAAe,IAAI,CAACC,MACnB,gBAAAQ,EAACO,GAAA,EAAqC,QAAQf,GAAI,SAASI,EAAA,GAA5BJ,EAAG,EAAsC,CACzE,GACH,EAAA,CACF;AAAA,IAAA,EAAA,CACF,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;AAEA,SAASe,EAAyB,EAAE,QAAAC,GAAQ,SAAAC,KAA8D;AACxG,MAAIC;AACJ,SAAIF,EAAO,SAAS,SAClBE,IAAO,gBAAAV,EAACC,GAAA,EAAK,MAAK,MAAA,CAAM,IACfO,EAAO,SAAS,UACzBE,IAAO,gBAAAV,EAACC,GAAA,EAAK,MAAK,SAAA,CAAS,IAE3BS,IAAO,gBAAAV,EAACC,GAAA,EAAK,MAAK,QAAA,CAAQ,GAG1B,gBAAAD,EAACW,GAAA,EAAS,UAAUH,EAAO,UAAU,SAAS,MAAMC,EAAQD,EAAO,EAAE,GAAG,MAAAE,GACrE,YAAO,OACV;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seij/common-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@fluentui/react-components": "9.72.9",
|
|
12
|
-
"@fluentui/react-icons": "2.0.316",
|
|
13
12
|
"i18next-browser-languagedetector": "8.2.0",
|
|
14
13
|
"@seij/common-types": "0.1.3",
|
|
15
|
-
"
|
|
16
|
-
"i18next-icu": "2.4.1",
|
|
14
|
+
"@seij/common-ui-icons": "0.1.2",
|
|
17
15
|
"lodash-es": "4.17.22",
|
|
16
|
+
"i18next": "25.7.3",
|
|
18
17
|
"date-fns": "4.1.0",
|
|
18
|
+
"i18next-icu": "2.4.1",
|
|
19
19
|
"rifm": "0.12.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|