laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
51 lines (50 loc) • 1.51 kB
JavaScript
"use client";
import { jsx as w } from "react/jsx-runtime";
import { useState as t, createContext as E, useContext as M } from "react";
const s = E(void 0), R = ({
children: e,
onConfirmedCells: a,
editConfirmLabel: r = "Salva",
editCancelLabel: l = "Annulla",
editRestoreDefaultLabel: n = "Ripristina Default",
initialEditMode: i = !1,
showDefaultActionButton: u = !1,
cellEditTitleLabel: c = "Modifica valore",
cellEditModifiedLabel: d = "Valore modificato",
cellConfirmButtonLabel: f = "Conferma",
cellCancelButtonLabel: C = "Annulla",
cellResetButtonLabel: D = "Ripristina"
}) => {
const [m, v] = t({}), [x, b] = t({}), [p, T] = t(i), o = {
editedCells: m,
setEditedCells: v,
toDefaultCells: x,
setToDefaultCells: b,
editMode: p,
setEditMode: T,
onConfirmedCells: a,
// Etichette per i pulsanti principali
editConfirmLabel: r,
editCancelLabel: l,
editRestoreDefaultLabel: n,
showDefaultActionButton: u,
// Etichette per i pulsanti dell'EditableInput
cellEditTitleLabel: c,
cellEditModifiedLabel: d,
cellConfirmButtonLabel: f,
cellCancelButtonLabel: C,
cellResetButtonLabel: D
};
return /* @__PURE__ */ w(s.Provider, { value: o, children: typeof e == "function" ? e(o) : e });
}, S = () => {
const e = M(s);
if (!e)
throw new Error(
"useDataCrossTable must be used within a DataCrossTableProvider"
);
return e;
};
export {
R as DataCrossTableProvider,
S as useDataCrossTable
};