@umami/react-zen 0.192.0 → 0.195.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/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +65 -49
- package/dist/index.mjs +39 -23
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -405,17 +405,18 @@ declare function Grid({ display, justifyContent, justifyItems, alignContent, ali
|
|
|
405
405
|
|
|
406
406
|
interface DataCardProps extends GridProps {
|
|
407
407
|
data?: {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
value: string;
|
|
408
|
+
label: ReactNode;
|
|
409
|
+
value: any;
|
|
411
410
|
}[];
|
|
411
|
+
labelWidth?: string;
|
|
412
412
|
}
|
|
413
|
-
declare function DataCard({ data, ...props }: DataCardProps): react.JSX.Element;
|
|
413
|
+
declare function DataCard({ data, labelWidth, ...props }: DataCardProps): react.JSX.Element;
|
|
414
414
|
|
|
415
415
|
interface DataTableProps extends TableProps {
|
|
416
416
|
data?: any[];
|
|
417
|
+
displayMode?: 'table' | 'cards';
|
|
417
418
|
}
|
|
418
|
-
declare function DataTable({ data, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
|
+
declare function DataTable({ data, displayMode, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
420
|
interface DataColumnProps extends Omit<HTMLAttributes<any>, 'children'> {
|
|
420
421
|
id: string;
|
|
421
422
|
label?: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -405,17 +405,18 @@ declare function Grid({ display, justifyContent, justifyItems, alignContent, ali
|
|
|
405
405
|
|
|
406
406
|
interface DataCardProps extends GridProps {
|
|
407
407
|
data?: {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
value: string;
|
|
408
|
+
label: ReactNode;
|
|
409
|
+
value: any;
|
|
411
410
|
}[];
|
|
411
|
+
labelWidth?: string;
|
|
412
412
|
}
|
|
413
|
-
declare function DataCard({ data, ...props }: DataCardProps): react.JSX.Element;
|
|
413
|
+
declare function DataCard({ data, labelWidth, ...props }: DataCardProps): react.JSX.Element;
|
|
414
414
|
|
|
415
415
|
interface DataTableProps extends TableProps {
|
|
416
416
|
data?: any[];
|
|
417
|
+
displayMode?: 'table' | 'cards';
|
|
417
418
|
}
|
|
418
|
-
declare function DataTable({ data, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
|
+
declare function DataTable({ data, displayMode, className, children, ...props }: DataTableProps): react.JSX.Element;
|
|
419
420
|
interface DataColumnProps extends Omit<HTMLAttributes<any>, 'children'> {
|
|
420
421
|
id: string;
|
|
421
422
|
label?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -34,8 +34,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
// node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
|
|
35
35
|
var require_use_sync_external_store_shim_production = __commonJS({
|
|
36
36
|
"node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(exports) {
|
|
37
|
-
var
|
|
38
|
-
var React5 =
|
|
37
|
+
var import_react200 = __toESM(require("react"));
|
|
38
|
+
var React5 = import_react200.default;
|
|
39
39
|
function is2(x, y) {
|
|
40
40
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
41
41
|
}
|
|
@@ -87,7 +87,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
87
87
|
// node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
88
88
|
var require_use_sync_external_store_shim_development = __commonJS({
|
|
89
89
|
"node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
|
|
90
|
-
var
|
|
90
|
+
var import_react200 = __toESM(require("react"));
|
|
91
91
|
(function() {
|
|
92
92
|
function is2(x, y) {
|
|
93
93
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
@@ -141,7 +141,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
141
141
|
return getSnapshot();
|
|
142
142
|
}
|
|
143
143
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
144
|
-
var React5 =
|
|
144
|
+
var React5 = import_react200.default, objectIs = "function" === typeof Object.is ? Object.is : is2, useState20 = React5.useState, useEffect13 = React5.useEffect, useLayoutEffect3 = React5.useLayoutEffect, useDebugValue = React5.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
145
145
|
exports.useSyncExternalStore = void 0 !== React5.useSyncExternalStore ? React5.useSyncExternalStore : shim;
|
|
146
146
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
147
147
|
})();
|
|
@@ -33271,20 +33271,21 @@ function Container({
|
|
|
33271
33271
|
}
|
|
33272
33272
|
|
|
33273
33273
|
// src/components/DataCard.tsx
|
|
33274
|
+
var import_react188 = require("react");
|
|
33274
33275
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
33275
|
-
function DataCard({ data = [], ...props }) {
|
|
33276
|
+
function DataCard({ data = [], labelWidth = "auto", ...props }) {
|
|
33276
33277
|
const rows = mapIdProperty(data);
|
|
33277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Grid, { width: "100%", ...props, children: rows.map((row) => {
|
|
33278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
33279
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33280
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", children: row?.value }) })
|
|
33281
|
-
] },
|
|
33278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Grid, { width: "100%", columns: `${labelWidth} 1fr`, border: true, borderRadius: "3", padding: "6", ...props, children: rows.map((row, index) => {
|
|
33279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react188.Fragment, { children: [
|
|
33280
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", border: "bottom", borderColor: "4", paddingRight: "6", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33281
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Row, { paddingY: "3", border: "bottom", borderColor: "4", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { size: "3", children: row?.value }) })
|
|
33282
|
+
] }, index);
|
|
33282
33283
|
}) });
|
|
33283
33284
|
}
|
|
33284
33285
|
|
|
33285
33286
|
// src/components/DataTable.tsx
|
|
33286
33287
|
var import_classnames28 = __toESM(require_classnames());
|
|
33287
|
-
var
|
|
33288
|
+
var import_react189 = require("react");
|
|
33288
33289
|
|
|
33289
33290
|
// src/components/Table.tsx
|
|
33290
33291
|
var import_classnames27 = __toESM(require_classnames());
|
|
@@ -33343,11 +33344,17 @@ var DataTable_default = { "datatable": "DataTable_datatable__MWRkN", "cell": "Da
|
|
|
33343
33344
|
|
|
33344
33345
|
// src/components/DataTable.tsx
|
|
33345
33346
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
33346
|
-
var
|
|
33347
|
-
function DataTable({
|
|
33347
|
+
var import_react190 = require("react");
|
|
33348
|
+
function DataTable({
|
|
33349
|
+
data = [],
|
|
33350
|
+
displayMode = "table",
|
|
33351
|
+
className,
|
|
33352
|
+
children,
|
|
33353
|
+
...props
|
|
33354
|
+
}) {
|
|
33348
33355
|
const rows = mapIdProperty(data);
|
|
33349
33356
|
const widths = [];
|
|
33350
|
-
const columns =
|
|
33357
|
+
const columns = import_react189.Children.map(children, (child) => {
|
|
33351
33358
|
if (child) {
|
|
33352
33359
|
widths.push(child?.props?.width || "1fr");
|
|
33353
33360
|
return { ...child?.props };
|
|
@@ -33355,12 +33362,21 @@ function DataTable({ data = [], className, children, ...props }) {
|
|
|
33355
33362
|
return null;
|
|
33356
33363
|
})?.filter((n) => n);
|
|
33357
33364
|
const gridTemplateColumns2 = widths.join(" ");
|
|
33365
|
+
if (displayMode === "cards") {
|
|
33366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Grid, { id: "grid", width: "100%", gap: "6", children: rows.map((row, index) => {
|
|
33367
|
+
const items = columns?.filter(({ hidden }) => !hidden).map(({ id, label, children: children2 }) => {
|
|
33368
|
+
const value = typeof children2 === "function" ? children2(row, index) : children2 ?? row[id];
|
|
33369
|
+
return { id, label, value };
|
|
33370
|
+
});
|
|
33371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DataCard, { data: items }, `${row.id}-${index}`);
|
|
33372
|
+
}) });
|
|
33373
|
+
}
|
|
33358
33374
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Table2, { ...props, className: (0, import_classnames28.default)(DataTable_default.datatable, className), children: [
|
|
33359
33375
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
33360
33376
|
if (hidden) {
|
|
33361
33377
|
return null;
|
|
33362
33378
|
}
|
|
33363
|
-
return /* @__PURE__ */ (0,
|
|
33379
|
+
return /* @__PURE__ */ (0, import_react190.createElement)(TableColumn, { ...columnProps, key: id, id }, label);
|
|
33364
33380
|
}) }),
|
|
33365
33381
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TableBody, { children: rows.map((row, index) => {
|
|
33366
33382
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TableRow, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, as, hidden, className: className2, children: children2, ...cellProps }) => {
|
|
@@ -33368,14 +33384,14 @@ function DataTable({ data = [], className, children, ...props }) {
|
|
|
33368
33384
|
return null;
|
|
33369
33385
|
}
|
|
33370
33386
|
const value = typeof children2 === "function" ? children2(row, index) : children2 || row[id];
|
|
33371
|
-
return /* @__PURE__ */ (0,
|
|
33387
|
+
return /* @__PURE__ */ (0, import_react190.createElement)(
|
|
33372
33388
|
TableCell,
|
|
33373
33389
|
{
|
|
33374
33390
|
...cellProps,
|
|
33375
33391
|
key: id,
|
|
33376
33392
|
className: (0, import_classnames28.default)(DataTable_default.cell, className2)
|
|
33377
33393
|
},
|
|
33378
|
-
as ? (0,
|
|
33394
|
+
as ? (0, import_react189.createElement)(as, {}, value) : value
|
|
33379
33395
|
);
|
|
33380
33396
|
}) }, index);
|
|
33381
33397
|
}) })
|
|
@@ -33402,7 +33418,7 @@ function Dots({ size = "md", className, ...props }) {
|
|
|
33402
33418
|
}
|
|
33403
33419
|
|
|
33404
33420
|
// src/components/FloatingTooltip.tsx
|
|
33405
|
-
var
|
|
33421
|
+
var import_react191 = require("react");
|
|
33406
33422
|
var import_classnames31 = __toESM(require_classnames());
|
|
33407
33423
|
|
|
33408
33424
|
// src/components/Tooltip.tsx
|
|
@@ -33429,8 +33445,8 @@ var FloatingTooltip_default = { "floating": "FloatingTooltip_floating__ZjM4N" };
|
|
|
33429
33445
|
// src/components/FloatingTooltip.tsx
|
|
33430
33446
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
33431
33447
|
function FloatingTooltip({ className, style, children, ...props }) {
|
|
33432
|
-
const [position, setPosition] = (0,
|
|
33433
|
-
(0,
|
|
33448
|
+
const [position, setPosition] = (0, import_react191.useState)({ x: -1e3, y: -1e3 });
|
|
33449
|
+
(0, import_react191.useEffect)(() => {
|
|
33434
33450
|
const handler = (e) => {
|
|
33435
33451
|
setPosition({ x: e.clientX, y: e.clientY });
|
|
33436
33452
|
};
|
|
@@ -33486,7 +33502,7 @@ function Heading2({
|
|
|
33486
33502
|
}
|
|
33487
33503
|
|
|
33488
33504
|
// src/components/HoverTrigger.tsx
|
|
33489
|
-
var
|
|
33505
|
+
var import_react192 = require("react");
|
|
33490
33506
|
|
|
33491
33507
|
// css-modules:E:\dev\umami-react-zen\src\components\HoverTrigger.module.css
|
|
33492
33508
|
var HoverTrigger_default = { "wrapper": "HoverTrigger_wrapper__NGFlN" };
|
|
@@ -33502,12 +33518,12 @@ function HoverTrigger({
|
|
|
33502
33518
|
children
|
|
33503
33519
|
}) {
|
|
33504
33520
|
const [triggerElement, popupElement] = children;
|
|
33505
|
-
const triggerRef = (0,
|
|
33506
|
-
const [open, setOpen] = (0,
|
|
33507
|
-
const isOverMenu = (0,
|
|
33508
|
-
const isOverButton = (0,
|
|
33509
|
-
const timeout = (0,
|
|
33510
|
-
(0,
|
|
33521
|
+
const triggerRef = (0, import_react192.useRef)(null);
|
|
33522
|
+
const [open, setOpen] = (0, import_react192.useState)(isOpen);
|
|
33523
|
+
const isOverMenu = (0, import_react192.useRef)(false);
|
|
33524
|
+
const isOverButton = (0, import_react192.useRef)(false);
|
|
33525
|
+
const timeout = (0, import_react192.useRef)(null);
|
|
33526
|
+
(0, import_react192.useEffect)(() => {
|
|
33511
33527
|
if (isOpen !== open) {
|
|
33512
33528
|
setOpen(isOpen);
|
|
33513
33529
|
}
|
|
@@ -33615,7 +33631,7 @@ function Image({
|
|
|
33615
33631
|
}
|
|
33616
33632
|
|
|
33617
33633
|
// src/components/InlineEditField.tsx
|
|
33618
|
-
var
|
|
33634
|
+
var import_react193 = require("react");
|
|
33619
33635
|
var import_classnames34 = __toESM(require_classnames());
|
|
33620
33636
|
|
|
33621
33637
|
// css-modules:E:\dev\umami-react-zen\src\components\InlineEditField.module.css
|
|
@@ -33634,8 +33650,8 @@ function InlineEditField({
|
|
|
33634
33650
|
onCancel,
|
|
33635
33651
|
...props
|
|
33636
33652
|
}) {
|
|
33637
|
-
const [value, setValue] = (0,
|
|
33638
|
-
const [edit, setEdit] = (0,
|
|
33653
|
+
const [value, setValue] = (0, import_react193.useState)(defaultValue);
|
|
33654
|
+
const [edit, setEdit] = (0, import_react193.useState)(defaultEdit);
|
|
33639
33655
|
const handleEdit = () => setEdit(true);
|
|
33640
33656
|
const handleChange = (e) => {
|
|
33641
33657
|
const val = e.target.value;
|
|
@@ -33646,7 +33662,7 @@ function InlineEditField({
|
|
|
33646
33662
|
setEdit(false);
|
|
33647
33663
|
onCommit?.(value);
|
|
33648
33664
|
};
|
|
33649
|
-
const handleCancel = (0,
|
|
33665
|
+
const handleCancel = (0, import_react193.useCallback)(() => {
|
|
33650
33666
|
setEdit(false);
|
|
33651
33667
|
setValue(defaultValue);
|
|
33652
33668
|
onCancel?.();
|
|
@@ -33786,7 +33802,7 @@ function Modal2({
|
|
|
33786
33802
|
}
|
|
33787
33803
|
|
|
33788
33804
|
// src/components/Navbar.tsx
|
|
33789
|
-
var
|
|
33805
|
+
var import_react194 = require("react");
|
|
33790
33806
|
var import_classnames38 = __toESM(require_classnames());
|
|
33791
33807
|
|
|
33792
33808
|
// css-modules:E:\dev\umami-react-zen\src\components\Navbar.module.css
|
|
@@ -33794,16 +33810,16 @@ var Navbar_default = { "nav": "Navbar_nav__ZjEwM", "item": "Navbar_item__MWVhZ",
|
|
|
33794
33810
|
|
|
33795
33811
|
// src/components/Navbar.tsx
|
|
33796
33812
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
33797
|
-
var NavbarContext = (0,
|
|
33813
|
+
var NavbarContext = (0, import_react194.createContext)(void 0);
|
|
33798
33814
|
var useNavigationContext = () => {
|
|
33799
|
-
const context = (0,
|
|
33815
|
+
const context = (0, import_react194.useContext)(NavbarContext);
|
|
33800
33816
|
if (!context) {
|
|
33801
33817
|
throw new Error("useNavigationContext must be used within a Navbar");
|
|
33802
33818
|
}
|
|
33803
33819
|
return context;
|
|
33804
33820
|
};
|
|
33805
33821
|
function Navbar({ showArrow = true, className, children, ...props }) {
|
|
33806
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
33822
|
+
const [activeMenu, setActiveMenu] = (0, import_react194.useState)("");
|
|
33807
33823
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NavbarContext.Provider, { value: { activeMenu, setActiveMenu }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { ...props, className: (0, import_classnames38.default)(Navbar_default.nav, className), children }) });
|
|
33808
33824
|
}
|
|
33809
33825
|
function NavbarItem({ label, children, className, ...props }) {
|
|
@@ -33821,7 +33837,7 @@ function NavbarItem({ label, children, className, ...props }) {
|
|
|
33821
33837
|
}
|
|
33822
33838
|
|
|
33823
33839
|
// src/components/NavMenu.tsx
|
|
33824
|
-
var
|
|
33840
|
+
var import_react195 = require("react");
|
|
33825
33841
|
var import_classnames39 = __toESM(require_classnames());
|
|
33826
33842
|
|
|
33827
33843
|
// css-modules:E:\dev\umami-react-zen\src\components\NavMenu.module.css
|
|
@@ -33829,7 +33845,7 @@ var NavMenu_default = { "navmenu": "NavMenu_navmenu__MzRmN", "item": "NavMenu_it
|
|
|
33829
33845
|
|
|
33830
33846
|
// src/components/NavMenu.tsx
|
|
33831
33847
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
33832
|
-
var NavMenuContext = (0,
|
|
33848
|
+
var NavMenuContext = (0, import_react195.createContext)(null);
|
|
33833
33849
|
function NavMenu({
|
|
33834
33850
|
itemBackgroundColor = "2",
|
|
33835
33851
|
muteItems,
|
|
@@ -33855,7 +33871,7 @@ function NavMenuGroup({
|
|
|
33855
33871
|
children,
|
|
33856
33872
|
...props
|
|
33857
33873
|
}) {
|
|
33858
|
-
const [minimized, setMinimized] = (0,
|
|
33874
|
+
const [minimized, setMinimized] = (0, import_react195.useState)(!!isMinimized);
|
|
33859
33875
|
const handleClick = () => {
|
|
33860
33876
|
if (allowMinimize) {
|
|
33861
33877
|
setMinimized((state) => !state);
|
|
@@ -33891,7 +33907,7 @@ function NavMenuGroup({
|
|
|
33891
33907
|
);
|
|
33892
33908
|
}
|
|
33893
33909
|
function NavMenuItem({ isSelected, className, children, ...props }) {
|
|
33894
|
-
const { itemBackgroundColor } = (0,
|
|
33910
|
+
const { itemBackgroundColor } = (0, import_react195.useContext)(NavMenuContext);
|
|
33895
33911
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
33896
33912
|
Row,
|
|
33897
33913
|
{
|
|
@@ -33905,11 +33921,11 @@ function NavMenuItem({ isSelected, className, children, ...props }) {
|
|
|
33905
33921
|
}
|
|
33906
33922
|
|
|
33907
33923
|
// src/components/PasswordField.tsx
|
|
33908
|
-
var
|
|
33924
|
+
var import_react196 = require("react");
|
|
33909
33925
|
var import_classnames40 = __toESM(require_classnames());
|
|
33910
33926
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
33911
33927
|
function PasswordField({ label, className, ...props }) {
|
|
33912
|
-
const [show, setShow] = (0,
|
|
33928
|
+
const [show, setShow] = (0, import_react196.useState)(false);
|
|
33913
33929
|
const type = show ? "text" : "password";
|
|
33914
33930
|
const handleShowPassword = () => setShow((state) => !state);
|
|
33915
33931
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
@@ -34016,7 +34032,7 @@ function Radio2({ children, className, ...props }) {
|
|
|
34016
34032
|
}
|
|
34017
34033
|
|
|
34018
34034
|
// src/components/SearchField.tsx
|
|
34019
|
-
var
|
|
34035
|
+
var import_react197 = require("react");
|
|
34020
34036
|
var import_classnames45 = __toESM(require_classnames());
|
|
34021
34037
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
34022
34038
|
function SearchField2({
|
|
@@ -34030,7 +34046,7 @@ function SearchField2({
|
|
|
34030
34046
|
className,
|
|
34031
34047
|
...props
|
|
34032
34048
|
}) {
|
|
34033
|
-
const [search, setSearch] = (0,
|
|
34049
|
+
const [search, setSearch] = (0, import_react197.useState)(defaultValue);
|
|
34034
34050
|
const searchValue = useDebounce(search, delay);
|
|
34035
34051
|
const handleChange = (value2) => {
|
|
34036
34052
|
setSearch(value2);
|
|
@@ -34044,7 +34060,7 @@ function SearchField2({
|
|
|
34044
34060
|
onSearch?.("");
|
|
34045
34061
|
onChange?.("");
|
|
34046
34062
|
};
|
|
34047
|
-
(0,
|
|
34063
|
+
(0, import_react197.useEffect)(() => {
|
|
34048
34064
|
if (delay > 0) {
|
|
34049
34065
|
onSearch?.(searchValue);
|
|
34050
34066
|
}
|
|
@@ -34069,7 +34085,7 @@ function SearchField2({
|
|
|
34069
34085
|
}
|
|
34070
34086
|
|
|
34071
34087
|
// src/components/Select.tsx
|
|
34072
|
-
var
|
|
34088
|
+
var import_react198 = require("react");
|
|
34073
34089
|
var import_classnames46 = __toESM(require_classnames());
|
|
34074
34090
|
|
|
34075
34091
|
// css-modules:E:\dev\umami-react-zen\src\components\Select.module.css
|
|
@@ -34097,7 +34113,7 @@ function Select2({
|
|
|
34097
34113
|
children,
|
|
34098
34114
|
...props
|
|
34099
34115
|
}) {
|
|
34100
|
-
const [search, setSearch] = (0,
|
|
34116
|
+
const [search, setSearch] = (0, import_react198.useState)("");
|
|
34101
34117
|
const handleChange = (e) => {
|
|
34102
34118
|
onSelectionChange?.(e);
|
|
34103
34119
|
onChange?.(e);
|
|
@@ -34162,7 +34178,7 @@ function Select2({
|
|
|
34162
34178
|
}
|
|
34163
34179
|
|
|
34164
34180
|
// src/components/Sidebar.tsx
|
|
34165
|
-
var
|
|
34181
|
+
var import_react199 = require("react");
|
|
34166
34182
|
var import_classnames47 = __toESM(require_classnames());
|
|
34167
34183
|
|
|
34168
34184
|
// css-modules:E:\dev\umami-react-zen\src\components\Sidebar.module.css
|
|
@@ -34170,7 +34186,7 @@ var Sidebar_default = { "sidebar": "Sidebar_sidebar__NDg2N", "header": "Sidebar_
|
|
|
34170
34186
|
|
|
34171
34187
|
// src/components/Sidebar.tsx
|
|
34172
34188
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
34173
|
-
var SidebarContext = (0,
|
|
34189
|
+
var SidebarContext = (0, import_react199.createContext)(null);
|
|
34174
34190
|
function Sidebar({
|
|
34175
34191
|
itemBackgroundColor = "2",
|
|
34176
34192
|
isCollapsed,
|
|
@@ -34226,7 +34242,7 @@ function SidebarItem({
|
|
|
34226
34242
|
children,
|
|
34227
34243
|
...props
|
|
34228
34244
|
}) {
|
|
34229
|
-
const { isCollapsed, itemBackgroundColor } = (0,
|
|
34245
|
+
const { isCollapsed, itemBackgroundColor } = (0, import_react199.useContext)(SidebarContext);
|
|
34230
34246
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)($4e3b923658d69c60$export$8c610744efcf8a1d, { delay: 0, closeDelay: 0, isDisabled: !isCollapsed, children: [
|
|
34231
34247
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)($f645667febf57a63$export$35a3bebf7ef2d934, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
34232
34248
|
Row,
|
package/dist/index.mjs
CHANGED
|
@@ -33149,14 +33149,15 @@ function Container({
|
|
|
33149
33149
|
}
|
|
33150
33150
|
|
|
33151
33151
|
// src/components/DataCard.tsx
|
|
33152
|
+
import { Fragment as Fragment8 } from "react";
|
|
33152
33153
|
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
33153
|
-
function DataCard({ data = [], ...props }) {
|
|
33154
|
+
function DataCard({ data = [], labelWidth = "auto", ...props }) {
|
|
33154
33155
|
const rows = mapIdProperty(data);
|
|
33155
|
-
return /* @__PURE__ */ jsx41(Grid, { width: "100%", ...props, children: rows.map((row) => {
|
|
33156
|
-
return /* @__PURE__ */ jsxs22(
|
|
33157
|
-
/* @__PURE__ */ jsx41(Row, { paddingY: "3", children: /* @__PURE__ */ jsx41(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33158
|
-
/* @__PURE__ */ jsx41(Row, { paddingY: "3", children: /* @__PURE__ */ jsx41(Text, { size: "3", children: row?.value }) })
|
|
33159
|
-
] },
|
|
33156
|
+
return /* @__PURE__ */ jsx41(Grid, { width: "100%", columns: `${labelWidth} 1fr`, border: true, borderRadius: "3", padding: "6", ...props, children: rows.map((row, index) => {
|
|
33157
|
+
return /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
33158
|
+
/* @__PURE__ */ jsx41(Row, { paddingY: "3", border: "bottom", borderColor: "4", paddingRight: "6", children: /* @__PURE__ */ jsx41(Text, { size: "3", weight: "bold", children: row?.label }) }),
|
|
33159
|
+
/* @__PURE__ */ jsx41(Row, { paddingY: "3", border: "bottom", borderColor: "4", children: /* @__PURE__ */ jsx41(Text, { size: "3", children: row?.value }) })
|
|
33160
|
+
] }, index);
|
|
33160
33161
|
}) });
|
|
33161
33162
|
}
|
|
33162
33163
|
|
|
@@ -33222,7 +33223,13 @@ var DataTable_default = { "datatable": "DataTable_datatable__MWRkN", "cell": "Da
|
|
|
33222
33223
|
// src/components/DataTable.tsx
|
|
33223
33224
|
import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
33224
33225
|
import { createElement as createElement8 } from "react";
|
|
33225
|
-
function DataTable({
|
|
33226
|
+
function DataTable({
|
|
33227
|
+
data = [],
|
|
33228
|
+
displayMode = "table",
|
|
33229
|
+
className,
|
|
33230
|
+
children,
|
|
33231
|
+
...props
|
|
33232
|
+
}) {
|
|
33226
33233
|
const rows = mapIdProperty(data);
|
|
33227
33234
|
const widths = [];
|
|
33228
33235
|
const columns = Children2.map(children, (child) => {
|
|
@@ -33233,6 +33240,15 @@ function DataTable({ data = [], className, children, ...props }) {
|
|
|
33233
33240
|
return null;
|
|
33234
33241
|
})?.filter((n) => n);
|
|
33235
33242
|
const gridTemplateColumns2 = widths.join(" ");
|
|
33243
|
+
if (displayMode === "cards") {
|
|
33244
|
+
return /* @__PURE__ */ jsx43(Grid, { id: "grid", width: "100%", gap: "6", children: rows.map((row, index) => {
|
|
33245
|
+
const items = columns?.filter(({ hidden }) => !hidden).map(({ id, label, children: children2 }) => {
|
|
33246
|
+
const value = typeof children2 === "function" ? children2(row, index) : children2 ?? row[id];
|
|
33247
|
+
return { id, label, value };
|
|
33248
|
+
});
|
|
33249
|
+
return /* @__PURE__ */ jsx43(DataCard, { data: items }, `${row.id}-${index}`);
|
|
33250
|
+
}) });
|
|
33251
|
+
}
|
|
33236
33252
|
return /* @__PURE__ */ jsxs23(Table2, { ...props, className: (0, import_classnames28.default)(DataTable_default.datatable, className), children: [
|
|
33237
33253
|
/* @__PURE__ */ jsx43(TableHeader, { style: { gridTemplateColumns: gridTemplateColumns2 }, children: columns?.map(({ id, label, as, hidden, width, ...columnProps }) => {
|
|
33238
33254
|
if (hidden) {
|
|
@@ -33370,7 +33386,7 @@ import { useRef as useRef8, useState as useState13, useEffect as useEffect11 } f
|
|
|
33370
33386
|
var HoverTrigger_default = { "wrapper": "HoverTrigger_wrapper__NGFlN" };
|
|
33371
33387
|
|
|
33372
33388
|
// src/components/HoverTrigger.tsx
|
|
33373
|
-
import { Fragment as
|
|
33389
|
+
import { Fragment as Fragment9, jsx as jsx48, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
33374
33390
|
var CLOSE_DELAY = 500;
|
|
33375
33391
|
function HoverTrigger({
|
|
33376
33392
|
isOpen,
|
|
@@ -33421,7 +33437,7 @@ function HoverTrigger({
|
|
|
33421
33437
|
}
|
|
33422
33438
|
}, closeDelay);
|
|
33423
33439
|
};
|
|
33424
|
-
return /* @__PURE__ */ jsxs26(
|
|
33440
|
+
return /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
33425
33441
|
/* @__PURE__ */ jsx48("div", { ref: triggerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: triggerElement }),
|
|
33426
33442
|
/* @__PURE__ */ jsx48(Popover2, { isOpen: open, isNonModal: true, triggerRef, children: /* @__PURE__ */ jsx48(
|
|
33427
33443
|
"div",
|
|
@@ -33590,7 +33606,7 @@ var import_classnames36 = __toESM(require_classnames());
|
|
|
33590
33606
|
var Menu_default = { "menu": "Menu_menu__YTM5N", "separator": "Menu_separator__YjFhN", "section": "Menu_section__NWFlM", "header": "Menu_header__YzJkN", "item": "Menu_item__NGRkO", "checkmark": "Menu_checkmark__MWQ1O", "hideCheckmark": "Menu_hideCheckmark__YzBhM", "label": "Menu_label__NGMxM", "content": "Menu_content__MTA2O" };
|
|
33591
33607
|
|
|
33592
33608
|
// src/components/Menu.tsx
|
|
33593
|
-
import { Fragment as
|
|
33609
|
+
import { Fragment as Fragment10, jsx as jsx53, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
33594
33610
|
function Menu2({ className, children, ...props }) {
|
|
33595
33611
|
return /* @__PURE__ */ jsx53($3674c52c6b3c5bce$export$d9b273488cd8ce6f, { ...props, className: (0, import_classnames36.default)(Menu_default.menu, className), children });
|
|
33596
33612
|
}
|
|
@@ -33624,7 +33640,7 @@ function MenuSection({
|
|
|
33624
33640
|
maxHeight,
|
|
33625
33641
|
overflow: maxHeight ? "auto" : void 0
|
|
33626
33642
|
};
|
|
33627
|
-
return /* @__PURE__ */ jsxs30(
|
|
33643
|
+
return /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
33628
33644
|
title && /* @__PURE__ */ jsx53($72a5793c14baf454$export$8b251419efc915eb, { className: Menu_default.header, children: title }),
|
|
33629
33645
|
/* @__PURE__ */ jsx53(
|
|
33630
33646
|
$3674c52c6b3c5bce$export$4b1545b4f2016d26,
|
|
@@ -33789,12 +33805,12 @@ function NavMenuItem({ isSelected, className, children, ...props }) {
|
|
|
33789
33805
|
// src/components/PasswordField.tsx
|
|
33790
33806
|
import { useState as useState17 } from "react";
|
|
33791
33807
|
var import_classnames40 = __toESM(require_classnames());
|
|
33792
|
-
import { Fragment as
|
|
33808
|
+
import { Fragment as Fragment11, jsx as jsx57, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
33793
33809
|
function PasswordField({ label, className, ...props }) {
|
|
33794
33810
|
const [show, setShow] = useState17(false);
|
|
33795
33811
|
const type = show ? "text" : "password";
|
|
33796
33812
|
const handleShowPassword = () => setShow((state) => !state);
|
|
33797
|
-
return /* @__PURE__ */ jsxs33(
|
|
33813
|
+
return /* @__PURE__ */ jsxs33(Fragment11, { children: [
|
|
33798
33814
|
label && /* @__PURE__ */ jsx57(Label2, { children: label }),
|
|
33799
33815
|
/* @__PURE__ */ jsxs33($bcdf0525bf22703d$export$2c73285ae9390cec, { "aria-label": "Password", ...props, className: (0, import_classnames40.default)(TextField_default.field, className), children: [
|
|
33800
33816
|
/* @__PURE__ */ jsx57($3985021b0ad6602f$export$f5b8910cec6cf069, { type }),
|
|
@@ -33822,10 +33838,10 @@ var import_classnames42 = __toESM(require_classnames());
|
|
|
33822
33838
|
var ProgressBar_default = { "progressbar": "ProgressBar_progressbar__YzdlO", "track": "ProgressBar_track__YzgzY", "fill": "ProgressBar_fill__ZTJlM", "value": "ProgressBar_value__NDk1Z" };
|
|
33823
33839
|
|
|
33824
33840
|
// src/components/ProgressBar.tsx
|
|
33825
|
-
import { Fragment as
|
|
33841
|
+
import { Fragment as Fragment12, jsx as jsx59, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
33826
33842
|
function ProgressBar2({ className, showPercentage, ...props }) {
|
|
33827
33843
|
return /* @__PURE__ */ jsx59($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames42.default)(ProgressBar_default.progressbar, className), children: ({ percentage = 0, valueText }) => {
|
|
33828
|
-
return /* @__PURE__ */ jsxs34(
|
|
33844
|
+
return /* @__PURE__ */ jsxs34(Fragment12, { children: [
|
|
33829
33845
|
/* @__PURE__ */ jsx59("div", { className: ProgressBar_default.track, children: /* @__PURE__ */ jsx59("div", { className: ProgressBar_default.fill, style: { width: `${percentage}%` } }) }),
|
|
33830
33846
|
showPercentage && /* @__PURE__ */ jsx59("div", { className: ProgressBar_default.value, children: valueText })
|
|
33831
33847
|
] });
|
|
@@ -33839,13 +33855,13 @@ var import_classnames43 = __toESM(require_classnames());
|
|
|
33839
33855
|
var ProgressCircle_default = { "progresscircle": "ProgressCircle_progresscircle__NGMyY", "track": "ProgressCircle_track__YzY2M", "fill": "ProgressCircle_fill__ZmMzM", "value": "ProgressCircle_value__YjM0Y" };
|
|
33840
33856
|
|
|
33841
33857
|
// src/components/ProgressCircle.tsx
|
|
33842
|
-
import { Fragment as
|
|
33858
|
+
import { Fragment as Fragment13, jsx as jsx60, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
33843
33859
|
function ProgressCircle({ className, showPercentage, ...props }) {
|
|
33844
33860
|
return /* @__PURE__ */ jsx60($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames43.default)(ProgressCircle_default.progresscircle, className), children: ({ percentage = 0, valueText }) => {
|
|
33845
33861
|
const radius = 45;
|
|
33846
33862
|
const circumference = radius * 2 * Math.PI;
|
|
33847
33863
|
const offset = circumference - percentage / 100 * circumference;
|
|
33848
|
-
return /* @__PURE__ */ jsxs35(
|
|
33864
|
+
return /* @__PURE__ */ jsxs35(Fragment13, { children: [
|
|
33849
33865
|
/* @__PURE__ */ jsxs35("svg", { viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
33850
33866
|
/* @__PURE__ */ jsx60("circle", { className: ProgressCircle_default.track, cx: "50", cy: "50", r: "45" }),
|
|
33851
33867
|
/* @__PURE__ */ jsx60(
|
|
@@ -33900,7 +33916,7 @@ function Radio2({ children, className, ...props }) {
|
|
|
33900
33916
|
// src/components/SearchField.tsx
|
|
33901
33917
|
import { useState as useState18, useEffect as useEffect12 } from "react";
|
|
33902
33918
|
var import_classnames45 = __toESM(require_classnames());
|
|
33903
|
-
import { Fragment as
|
|
33919
|
+
import { Fragment as Fragment14, jsx as jsx62, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
33904
33920
|
function SearchField2({
|
|
33905
33921
|
label,
|
|
33906
33922
|
placeholder,
|
|
@@ -33931,7 +33947,7 @@ function SearchField2({
|
|
|
33931
33947
|
onSearch?.(searchValue);
|
|
33932
33948
|
}
|
|
33933
33949
|
}, [searchValue, delay]);
|
|
33934
|
-
return /* @__PURE__ */ jsxs37(
|
|
33950
|
+
return /* @__PURE__ */ jsxs37(Fragment14, { children: [
|
|
33935
33951
|
label && /* @__PURE__ */ jsx62(Label2, { children: label }),
|
|
33936
33952
|
/* @__PURE__ */ jsxs37(
|
|
33937
33953
|
$440f4836bcb56932$export$b94867ecbd698f21,
|
|
@@ -34135,7 +34151,7 @@ var import_classnames48 = __toESM(require_classnames());
|
|
|
34135
34151
|
var Slider_default = { "slider": "Slider_slider__MjBhO", "header": "Slider_header__ZTE2M", "track": "Slider_track__ODk5M", "fill": "Slider_fill__YzdhM", "thumb": "Slider_thumb__NGEzM" };
|
|
34136
34152
|
|
|
34137
34153
|
// src/components/Slider.tsx
|
|
34138
|
-
import { Fragment as
|
|
34154
|
+
import { Fragment as Fragment15, jsx as jsx65, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
34139
34155
|
function Slider2({ className, showValue = true, label, ...props }) {
|
|
34140
34156
|
return /* @__PURE__ */ jsxs40($6f909507e6374d18$export$472062a354075cee, { ...props, className: (0, import_classnames48.default)(Slider_default.slider, className), children: [
|
|
34141
34157
|
/* @__PURE__ */ jsxs40("div", { className: Slider_default.header, children: [
|
|
@@ -34144,7 +34160,7 @@ function Slider2({ className, showValue = true, label, ...props }) {
|
|
|
34144
34160
|
] }),
|
|
34145
34161
|
/* @__PURE__ */ jsx65($6f909507e6374d18$export$105594979f116971, { className: Slider_default.track, children: ({ state }) => {
|
|
34146
34162
|
const isHorizontal = state.orientation === "horizontal";
|
|
34147
|
-
return /* @__PURE__ */ jsxs40(
|
|
34163
|
+
return /* @__PURE__ */ jsxs40(Fragment15, { children: [
|
|
34148
34164
|
/* @__PURE__ */ jsx65(
|
|
34149
34165
|
"div",
|
|
34150
34166
|
{
|
|
@@ -34269,10 +34285,10 @@ var import_classnames52 = __toESM(require_classnames());
|
|
|
34269
34285
|
var Toggle_default = { "toggle": "Toggle_toggle__OWVjZ" };
|
|
34270
34286
|
|
|
34271
34287
|
// src/components/Toggle.tsx
|
|
34272
|
-
import { Fragment as
|
|
34288
|
+
import { Fragment as Fragment16, jsx as jsx70, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
34273
34289
|
function Toggle({ label, children, className, ...props }) {
|
|
34274
34290
|
const isSelected = typeof props.value !== "undefined" ? !!props.value : void 0;
|
|
34275
|
-
return /* @__PURE__ */ jsxs44(
|
|
34291
|
+
return /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
34276
34292
|
label && /* @__PURE__ */ jsx70(Label2, { children: label }),
|
|
34277
34293
|
/* @__PURE__ */ jsx70(
|
|
34278
34294
|
$efde0372d7a700fe$export$d2b052e7b4be1756,
|