@oondemand/oon-core-front 0.7.35 → 0.7.36

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.
@@ -4167,6 +4167,7 @@ function CoreUsersAccess() {
4167
4167
 
4168
4168
  // src/components/ui-v2/CorePrimitives.tsx
4169
4169
  import { Badge as Badge5, Box as Box16, Button as Button11, Flex as Flex10, Heading as Heading9, SimpleGrid as SimpleGrid6, Spinner as Spinner3, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
4170
+ import { useId, useRef as useRef5, useState as useState12 } from "react";
4170
4171
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
4171
4172
  function CorePage({ children }) {
4172
4173
  return /* @__PURE__ */ jsx20(Box16, { color: "text.primary", children });
@@ -4224,11 +4225,54 @@ function CoreErrorState({ title = "N\xE3o foi poss\xEDvel carregar", description
4224
4225
  ] });
4225
4226
  }
4226
4227
  function CoreTabs({ items, value: value2, onChange }) {
4227
- const active = value2 ?? items[0]?.id;
4228
+ const baseId = useId();
4229
+ const tabRefs = useRef5([]);
4230
+ const [internal, setInternal] = useState12(items[0]?.id);
4231
+ const active = value2 ?? (items.some((item) => item.id === internal) ? internal : items[0]?.id);
4228
4232
  const selected = items.find((item) => item.id === active);
4233
+ const select = (id) => {
4234
+ if (value2 === void 0) setInternal(id);
4235
+ onChange?.(id);
4236
+ };
4237
+ const onKeyDown = (event, index) => {
4238
+ const last = items.length - 1;
4239
+ const target = event.key === "ArrowRight" ? index === last ? 0 : index + 1 : event.key === "ArrowLeft" ? index === 0 ? last : index - 1 : event.key === "Home" ? 0 : event.key === "End" ? last : -1;
4240
+ if (target < 0) return;
4241
+ event.preventDefault();
4242
+ select(items[target].id);
4243
+ tabRefs.current[target]?.focus();
4244
+ };
4229
4245
  return /* @__PURE__ */ jsxs17(Box16, { children: [
4230
- /* @__PURE__ */ jsx20(Flex10, { gap: 2, borderBottomWidth: "1px", borderColor: "border.default", mb: 4, children: items.map((item) => /* @__PURE__ */ jsx20(Button11, { variant: item.id === active ? "solid" : "ghost", onClick: () => onChange?.(item.id), children: item.label }, item.id)) }),
4231
- selected?.content
4246
+ /* @__PURE__ */ jsx20(Flex10, { role: "tablist", gap: 1, borderBottomWidth: "1px", borderColor: "border.default", mb: 4, overflowX: "auto", children: items.map((item, index) => {
4247
+ const isActive = item.id === active;
4248
+ return /* @__PURE__ */ jsx20(
4249
+ Button11,
4250
+ {
4251
+ ref: (el) => {
4252
+ tabRefs.current[index] = el;
4253
+ },
4254
+ id: `${baseId}-tab-${item.id}`,
4255
+ role: "tab",
4256
+ "aria-selected": isActive,
4257
+ "aria-controls": `${baseId}-panel-${item.id}`,
4258
+ tabIndex: isActive ? 0 : -1,
4259
+ variant: "ghost",
4260
+ borderRadius: "0",
4261
+ mb: "-1px",
4262
+ borderBottomWidth: "2px",
4263
+ borderColor: "transparent",
4264
+ borderBottomColor: isActive ? "brand.solid" : "transparent",
4265
+ color: isActive ? "text.primary" : "text.muted",
4266
+ fontWeight: isActive ? "600" : "500",
4267
+ _hover: { bg: "surface.hover", color: "text.primary" },
4268
+ onClick: () => select(item.id),
4269
+ onKeyDown: (event) => onKeyDown(event, index),
4270
+ children: item.label
4271
+ },
4272
+ item.id
4273
+ );
4274
+ }) }),
4275
+ selected ? /* @__PURE__ */ jsx20(Box16, { role: "tabpanel", id: `${baseId}-panel-${selected.id}`, "aria-labelledby": `${baseId}-tab-${selected.id}`, color: "text.primary", children: selected.content }) : null
4232
4276
  ] });
4233
4277
  }
4234
4278
  function CoreSummaryCards2({ items }) {
@@ -4406,7 +4450,7 @@ function CorePage2({ page, registry }) {
4406
4450
  }
4407
4451
 
4408
4452
  // src/components/CoreTransactionalEmail.tsx
4409
- import { useEffect as useEffect7, useMemo as useMemo9, useState as useState12 } from "react";
4453
+ import { useEffect as useEffect7, useMemo as useMemo9, useState as useState13 } from "react";
4410
4454
  import { Badge as Badge6, Box as Box19, Button as Button13, Flex as Flex12, Heading as Heading11, IconButton as IconButton3, Input as Input8, Stack as Stack10, Text as Text20, Textarea as Textarea3 } from "@chakra-ui/react";
4411
4455
  import { useMutation as useMutation5, useQuery as useQuery11, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
4412
4456
  import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
@@ -4455,26 +4499,26 @@ function parseObject(source, message) {
4455
4499
  function CoreTransactionalEmail() {
4456
4500
  const { http } = useOonApi();
4457
4501
  const cache = useQueryClient6();
4458
- const [tab, setTab] = useState12("config");
4459
- const [error, setError] = useState12("");
4460
- const [notice, setNotice] = useState12("");
4461
- const [configurationDraft, setConfigurationDraft] = useState12({
4502
+ const [tab, setTab] = useState13("config");
4503
+ const [error, setError] = useState13("");
4504
+ const [notice, setNotice] = useState13("");
4505
+ const [configurationDraft, setConfigurationDraft] = useState13({
4462
4506
  apiKey: "",
4463
4507
  senderEmail: "",
4464
4508
  senderName: "",
4465
4509
  replyTo: ""
4466
4510
  });
4467
- const [configurationTestRecipient, setConfigurationTestRecipient] = useState12("");
4468
- const [loadedConfigurationKey, setLoadedConfigurationKey] = useState12("");
4469
- const [templateDraft, setTemplateDraft] = useState12(EMPTY_DRAFT);
4470
- const [editingBase, setEditingBase] = useState12(null);
4471
- const [previewTarget, setPreviewTarget] = useState12(null);
4472
- const [previewVariables, setPreviewVariables] = useState12("{}");
4473
- const [testTarget, setTestTarget] = useState12(null);
4474
- const [templateTest, setTemplateTest] = useState12({ to: "", variables: "{}" });
4475
- const [templateModalOpen, setTemplateModalOpen] = useState12(false);
4476
- const [templateModalTab, setTemplateModalTab] = useState12("versions");
4477
- const [managedTemplateCode, setManagedTemplateCode] = useState12("");
4511
+ const [configurationTestRecipient, setConfigurationTestRecipient] = useState13("");
4512
+ const [loadedConfigurationKey, setLoadedConfigurationKey] = useState13("");
4513
+ const [templateDraft, setTemplateDraft] = useState13(EMPTY_DRAFT);
4514
+ const [editingBase, setEditingBase] = useState13(null);
4515
+ const [previewTarget, setPreviewTarget] = useState13(null);
4516
+ const [previewVariables, setPreviewVariables] = useState13("{}");
4517
+ const [testTarget, setTestTarget] = useState13(null);
4518
+ const [templateTest, setTemplateTest] = useState13({ to: "", variables: "{}" });
4519
+ const [templateModalOpen, setTemplateModalOpen] = useState13(false);
4520
+ const [templateModalTab, setTemplateModalTab] = useState13("versions");
4521
+ const [managedTemplateCode, setManagedTemplateCode] = useState13("");
4478
4522
  const health = useQuery11({
4479
4523
  queryKey: ["transactional-email", "health"],
4480
4524
  queryFn: async () => (await http.get("/core/transactional-email/health")).data
@@ -5419,7 +5463,7 @@ import {
5419
5463
  Stack as Stack11,
5420
5464
  Text as Text21
5421
5465
  } from "@chakra-ui/react";
5422
- import { useState as useState13 } from "react";
5466
+ import { useState as useState14 } from "react";
5423
5467
  import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
5424
5468
  var STATUS = {
5425
5469
  contract: {
@@ -5595,7 +5639,7 @@ function CoreDataTable({ columns, rows, rowKey, loading, error, empty, search, f
5595
5639
  ] });
5596
5640
  }
5597
5641
  function CoreDetailDrawer({ open, onClose, title, status, tabs, actions, children }) {
5598
- const [tab, setTab] = useState13(tabs?.[0]?.id);
5642
+ const [tab, setTab] = useState14(tabs?.[0]?.id);
5599
5643
  const active = tabs?.find((item) => item.id === tab) ?? tabs?.[0];
5600
5644
  return /* @__PURE__ */ jsx24(Drawer.Root, { open, onOpenChange: (event) => {
5601
5645
  if (!event.open) onClose();
@@ -5649,7 +5693,7 @@ function CoreConfirmDialog({ open, title, effect, confirmLabel = "Confirmar", ca
5649
5693
  }
5650
5694
  function CoreTechnicalDetails({ items, label = "Detalhes t\xE9cnicos" }) {
5651
5695
  const visible = items.filter((item) => item.value !== void 0 && item.value !== null && item.value !== "");
5652
- const [copied, setCopied] = useState13(null);
5696
+ const [copied, setCopied] = useState14(null);
5653
5697
  if (!visible.length) return null;
5654
5698
  const copy = async (text, key) => {
5655
5699
  try {
@@ -5744,4 +5788,4 @@ export {
5744
5788
  CoreOrganizationSwitcher,
5745
5789
  coreInitials
5746
5790
  };
5747
- //# sourceMappingURL=chunk-INIAEP7H.js.map
5791
+ //# sourceMappingURL=chunk-4J7L5PIO.js.map