UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

52 lines (51 loc) 1.73 kB
import { jsxs as m, jsx as t } from "react/jsx-runtime"; import "react"; import { Input as f, Button as v, Message as c } from "semantic-ui-react"; import { connect as x } from "react-redux"; import { setEmail as S, newsletterSubscription as C } from "../reducers/embeddable.js"; const I = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, P = (e) => { const a = () => { const { email: s, list: i, tag: b } = e; e.onSubmit({ email: s, list: i, tag: b }); }, { status: l, editing: o, list: k, placeholder: d = "enter your email address", successmessage: u = "Thanks", failuremessage: g = "Something didn't go well", label: p = "Send", tag: y, email: r, onChange: h } = e; let n = ""; (l === "OK" || o) && (n = /* @__PURE__ */ t(c, { success: !0, children: /* @__PURE__ */ t("p", { children: u }) })), (l === "ERROR" || o) && (n = /* @__PURE__ */ t(c, { negative: !0, children: /* @__PURE__ */ t("p", { children: g }) })); const w = I.test(r); return /* @__PURE__ */ m("div", { className: "viz newsLetter", children: [ /* @__PURE__ */ m("div", { className: "viz newsLetter form", children: [ /* @__PURE__ */ t( f, { icon: "envelope", name: "email", value: r, onChange: (s, i) => h(i.value), iconPosition: "left", placeholder: d } ), /* @__PURE__ */ t(v, { disabled: !w, primary: !0, onClick: (s) => a(), children: p }) ] }), n ] }); }, R = (e, a) => ({ status: e.getIn(["embeddable", "newsletter", "status"]), email: e.getIn(["embeddable", "newsletter", "email"]) }), j = { onSubmit: C, onChange: S }, T = x(R, j)(P); export { T as default };