nexaas-ui-components 1.0.19 → 1.0.20

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.cjs CHANGED
@@ -76,8 +76,8 @@ var sizes = {
76
76
  icon: "text-[16px]"
77
77
  },
78
78
  sm: {
79
- text: "h-[32px]",
80
- icon: "text-[14px]"
79
+ text: "h-[32px] text-[12px]",
80
+ icon: "text-[12px]"
81
81
  },
82
82
  md: {
83
83
  text: "h-[38px]",
@@ -4311,23 +4311,326 @@ function DataTable({
4311
4311
  )
4312
4312
  ] });
4313
4313
  }
4314
+ var Accordion = ({ title, children, open = false }) => {
4315
+ const [isOpen, setOpen] = React4.useState(open);
4316
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(
4317
+ "div",
4318
+ {
4319
+ className: clsx9__default.default(
4320
+ {
4321
+ ["border-neutral-200"]: !isOpen,
4322
+ ["border-rose-700"]: isOpen
4323
+ },
4324
+ "flex flex-col w-full px-3 py-2 shadow-input border rounded-lg"
4325
+ ),
4326
+ children: [
4327
+ /* @__PURE__ */ jsxRuntime.jsxs(
4328
+ "button",
4329
+ {
4330
+ onClick: () => {
4331
+ setOpen((state) => !state);
4332
+ },
4333
+ type: "button",
4334
+ className: "flex items-center justify-between w-full ",
4335
+ children: [
4336
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title }),
4337
+ /* @__PURE__ */ jsxRuntime.jsx(
4338
+ "i",
4339
+ {
4340
+ className: clsx9__default.default(
4341
+ {
4342
+ ["transform rotate-[180deg]"]: isOpen
4343
+ },
4344
+ "duration-300 uil uil-angle-down text-[30px]"
4345
+ )
4346
+ }
4347
+ )
4348
+ ]
4349
+ }
4350
+ ),
4351
+ /* @__PURE__ */ jsxRuntime.jsx(
4352
+ react.Transition,
4353
+ {
4354
+ show: isOpen,
4355
+ enter: "ease-in duration-300",
4356
+ enterFrom: "opacity-0",
4357
+ enterTo: "opacity-100",
4358
+ leave: "ease-out duration-300",
4359
+ leaveFrom: "opacity-100",
4360
+ leaveTo: "opacity-0",
4361
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4362
+ "div",
4363
+ {
4364
+ className: `${isOpen ? "flex opacity-100" : "hidden opacity-0"} overflow-auto table-scroll`,
4365
+ children
4366
+ }
4367
+ )
4368
+ }
4369
+ )
4370
+ ]
4371
+ }
4372
+ ) });
4373
+ };
4374
+ function CopyPopover({ children, valueToCopy }) {
4375
+ const [copied, setCopied] = React4.useState(false);
4376
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4377
+ "div",
4378
+ {
4379
+ className: "flex items-center gap-1",
4380
+ onClick: async () => {
4381
+ setCopied(true);
4382
+ navigator.clipboard.writeText(valueToCopy);
4383
+ },
4384
+ onMouseLeave: () => setTimeout(() => setCopied(false), 500),
4385
+ children: [
4386
+ /* @__PURE__ */ jsxRuntime.jsxs(
4387
+ "div",
4388
+ {
4389
+ className: "flex items-center gap-1",
4390
+ "data-tooltip-id": "copy-id",
4391
+ "data-tooltip-content": copied ? "Copiado" : "Copiar",
4392
+ "data-tooltip-place": "top",
4393
+ children: [
4394
+ /* @__PURE__ */ jsxRuntime.jsx(Popover3, { id: "copy-id" }),
4395
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-neutral-400 text-xs", children })
4396
+ ]
4397
+ }
4398
+ ),
4399
+ /* @__PURE__ */ jsxRuntime.jsxs(
4400
+ "div",
4401
+ {
4402
+ "data-tooltip-id": "icon-id",
4403
+ "data-tooltip-content": copied ? "Copiado" : "Copiar",
4404
+ "data-tooltip-place": "top",
4405
+ children: [
4406
+ /* @__PURE__ */ jsxRuntime.jsx(Popover3, { id: "icon-id" }),
4407
+ /* @__PURE__ */ jsxRuntime.jsx("i", { className: "uil uil-copy text-base text-blue-500 cursor-pointer -mt-[1px]" })
4408
+ ]
4409
+ }
4410
+ )
4411
+ ]
4412
+ }
4413
+ ) });
4414
+ }
4415
+ var Menu = ({ triggerElement, children, className }) => {
4416
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Menu, { as: "div", className: "relative h-full cursor-pointer", children: [
4417
+ /* @__PURE__ */ jsxRuntime.jsx(
4418
+ react.MenuButton,
4419
+ {
4420
+ as: "div",
4421
+ className: "flex rounded-full text-sm h-full w-full items-center",
4422
+ children: triggerElement
4423
+ }
4424
+ ),
4425
+ /* @__PURE__ */ jsxRuntime.jsx(
4426
+ react.Transition,
4427
+ {
4428
+ as: React4.Fragment,
4429
+ enter: "transition ease-out duration-200",
4430
+ enterFrom: "transform opacity-0 scale-95",
4431
+ enterTo: "transform opacity-100 scale-100",
4432
+ leave: "transition ease-in duration-75",
4433
+ leaveFrom: "transform opacity-100 scale-100",
4434
+ leaveTo: "transform opacity-0 scale-95",
4435
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4436
+ react.MenuItems,
4437
+ {
4438
+ className: `border-[0.5px] mt-1 color-neutral-300 flex min-w-[200px] flex-col gap-y-2 p-3 absolute right-0 z-[999] rounded-lg shadow-[2px_4px_8px_rgba(57,60,77,0.1)] bg-white cursor-default ${className}`,
4439
+ children
4440
+ }
4441
+ )
4442
+ }
4443
+ )
4444
+ ] });
4445
+ };
4446
+ var Item = ({ index, isActive, onClick, children }) => {
4447
+ return /* @__PURE__ */ jsxRuntime.jsx(react.MenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
4448
+ "div",
4449
+ {
4450
+ className: clsx9__default.default(
4451
+ "h-[36px] p-2 rounded-lg items-center cursor-pointer flex whitespace-nowrap no-underline ",
4452
+ {
4453
+ "bg-[#009EDB] hover:bg-[#009EDB] hover:text-[#FFFFFF] text-[#FFFFFF]": isActive
4454
+ },
4455
+ {
4456
+ "hover:bg-neutral-100 text-paragraph": !isActive
4457
+ }
4458
+ ),
4459
+ tabIndex: index,
4460
+ role: "button",
4461
+ onClick,
4462
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 w-full items-center whitespace-nowrap", children })
4463
+ }
4464
+ ) }, index);
4465
+ };
4466
+ var EditableButton = ({
4467
+ children,
4468
+ button,
4469
+ onClose
4470
+ }) => {
4471
+ const [showModal, setShowModal] = React4.useState(false);
4472
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col relative", children: [
4473
+ /* @__PURE__ */ jsxRuntime.jsx(
4474
+ "div",
4475
+ {
4476
+ className: "group flex gap-[5px] items-center cursor-pointer",
4477
+ onClick: () => setShowModal(!showModal),
4478
+ children: button
4479
+ }
4480
+ ),
4481
+ showModal && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-[294px] p-2 bg-white border border-neutral-300 top-14 absolute z-50 rounded-lg", children: [
4482
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3", children }),
4483
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-3 pb-1 border-t border-neutral-200 flex items-center justify-end gap-2", children: [
4484
+ /* @__PURE__ */ jsxRuntime.jsx(
4485
+ Button,
4486
+ {
4487
+ variant: "secondary",
4488
+ size: "sm",
4489
+ onClick: () => setShowModal(false),
4490
+ children: "Cancelar"
4491
+ }
4492
+ ),
4493
+ /* @__PURE__ */ jsxRuntime.jsx(
4494
+ Button,
4495
+ {
4496
+ variant: "primary",
4497
+ size: "sm",
4498
+ onClick: () => {
4499
+ setShowModal(false);
4500
+ if (onClose) onClose();
4501
+ },
4502
+ children: "Aplicar"
4503
+ }
4504
+ )
4505
+ ] })
4506
+ ] })
4507
+ ] });
4508
+ };
4509
+ var EditableText = ({
4510
+ control,
4511
+ name = "",
4512
+ emptyLabel,
4513
+ children,
4514
+ onApply,
4515
+ value,
4516
+ hideEditIcon,
4517
+ truncate
4518
+ }) => {
4519
+ const [showModal, setShowModal] = React4.useState(false);
4520
+ const truncateText = (str, max, len) => {
4521
+ return str.length > max ? str.substring(0, len) + "..." : str;
4522
+ };
4523
+ return /* @__PURE__ */ jsxRuntime.jsx(
4524
+ reactHookForm.Controller,
4525
+ {
4526
+ control,
4527
+ name,
4528
+ render: ({ field }) => {
4529
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col relative", children: [
4530
+ /* @__PURE__ */ jsxRuntime.jsxs(
4531
+ "div",
4532
+ {
4533
+ className: "group flex gap-[5px] items-baseline cursor-pointer z-[500]",
4534
+ onClick: () => setShowModal(!showModal),
4535
+ children: [
4536
+ value && field.value ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: truncate ? value(truncateText(field.value, 14, 12)) : value(field.value) }) : field.value ? /* @__PURE__ */ jsxRuntime.jsx(
4537
+ "label",
4538
+ {
4539
+ className: clsx9__default.default(
4540
+ {
4541
+ ["text-label"]: !field.value,
4542
+ ["text-paragraph"]: field.value
4543
+ },
4544
+ "text-p-md group-hover:underline group-hover:underline-offset-[3px] cursor-pointer decoration-blue-500"
4545
+ ),
4546
+ children: "Preenchido"
4547
+ }
4548
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4549
+ "label",
4550
+ {
4551
+ className: clsx9__default.default(
4552
+ {
4553
+ ["text-label"]: !field.value,
4554
+ ["text-paragraph"]: field.value
4555
+ },
4556
+ "text-p-md group-hover:underline group-hover:underline-offset-[3px] cursor-pointer decoration-blue-500"
4557
+ ),
4558
+ children: emptyLabel ? emptyLabel : "N\xE3o informado"
4559
+ }
4560
+ ),
4561
+ !hideEditIcon && /* @__PURE__ */ jsxRuntime.jsx(
4562
+ "i",
4563
+ {
4564
+ style: { fontSize: "14px" },
4565
+ className: "uil uil-pen text-sm text-blue-500"
4566
+ }
4567
+ )
4568
+ ]
4569
+ }
4570
+ ),
4571
+ showModal && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4572
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[160px] md:w-[294px] p-2 bg-white border border-neutral-300 absolute z-[500] rounded-lg", children: [
4573
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pb-3 ", children }),
4574
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pt-3 pb-1 border-t border-neutral-200 flex flex-col md:flex-row md:items-center md:justify-end gap-2", children: [
4575
+ /* @__PURE__ */ jsxRuntime.jsx(
4576
+ Button,
4577
+ {
4578
+ variant: "secondary",
4579
+ size: "sm",
4580
+ onClick: () => setShowModal(false),
4581
+ children: "Cancelar"
4582
+ }
4583
+ ),
4584
+ /* @__PURE__ */ jsxRuntime.jsx(
4585
+ Button,
4586
+ {
4587
+ variant: "primary",
4588
+ size: "sm",
4589
+ onClick: () => {
4590
+ setShowModal(false);
4591
+ onApply && onApply();
4592
+ },
4593
+ children: "Salvar"
4594
+ }
4595
+ )
4596
+ ] })
4597
+ ] }),
4598
+ /* @__PURE__ */ jsxRuntime.jsx(
4599
+ "div",
4600
+ {
4601
+ className: "fixed top-0 bottom-0 left-0 right-0 z-40",
4602
+ onClick: () => setShowModal(false)
4603
+ }
4604
+ )
4605
+ ] })
4606
+ ] });
4607
+ }
4608
+ }
4609
+ );
4610
+ };
4314
4611
 
4612
+ exports.Accordion = Accordion;
4315
4613
  exports.Badge = Badge;
4316
4614
  exports.Button = Button;
4317
4615
  exports.ButtonLink = ButtonLink;
4318
4616
  exports.Calendar = Calendar;
4319
4617
  exports.Checkbox = Checkbox;
4618
+ exports.CopyPopover = CopyPopover;
4320
4619
  exports.DataTable = DataTable;
4321
4620
  exports.DataTablePagination = DataTablePagination;
4322
4621
  exports.DatePickerInput = DatePickerInput;
4622
+ exports.EditableButton = EditableButton;
4623
+ exports.EditableText = EditableText;
4323
4624
  exports.FilterCalendar = FilterCalendar;
4324
4625
  exports.FilterOptions = FilterOptions;
4325
4626
  exports.Input = Input;
4326
4627
  exports.InputMoney = InputMoney;
4327
4628
  exports.InputNumber = InputNumber;
4328
4629
  exports.InputPercentage = InputPercentage;
4630
+ exports.Item = Item;
4329
4631
  exports.Logo = Logo;
4330
4632
  exports.MaskedInput = MaskedInput;
4633
+ exports.Menu = Menu;
4331
4634
  exports.ModalDialog = ModalDialog;
4332
4635
  exports.PaginationSelect = PaginationSelect;
4333
4636
  exports.Popover = Popover3;