@lolmath/ui 2.1.0 → 2.3.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.cjs CHANGED
@@ -25,8 +25,12 @@ __export(src_exports, {
25
25
  AccordionItem: () => AccordionItem,
26
26
  AccordionTrigger: () => AccordionTrigger,
27
27
  Button: () => Button,
28
+ DialogButtons: () => DialogButtons,
29
+ DialogTrigger: () => DialogTrigger,
30
+ Heading: () => Heading,
28
31
  Item: () => Item,
29
32
  Label: () => Label3,
33
+ Modal: () => Modal,
30
34
  NumberField: () => NumberField,
31
35
  ProgressBar: () => ProgressBar,
32
36
  Radio: () => Radio,
@@ -49,7 +53,7 @@ var import_tailwind_merge = require("tailwind-merge");
49
53
  // src/utilities/border.tsx
50
54
  var borderClassName = "from-[#785b28] via-[#c89c3c] to-[#c8aa6e] bg-gradient-to-t";
51
55
  var borderHoverClassName = "from-[#c89c3c] via-[#dcc188] to-[#f0e6d8]";
52
- var borderPressedClassName = "from-[#694f27] via-[#694f27] to-[#463817]";
56
+ var borderPressedClassName = "from-lol-gold-600 via-lol-gold-600 to-lol-gold-700";
53
57
  var borderDisabledClassName = "from-[#5c5b57] via-[#5c5b57] to-[#5c5b57]";
54
58
 
55
59
  // src/components/button.tsx
@@ -482,25 +486,50 @@ function ProgressBar({
482
486
  }
483
487
 
484
488
  // src/components/accordion.tsx
485
- var import_react2 = require("react");
489
+ var import_react3 = require("react");
486
490
  var import_tailwind_merge7 = require("tailwind-merge");
491
+
492
+ // src/utilities/css-id.tsx
493
+ var import_react2 = require("react");
494
+ function useCssId() {
495
+ return (0, import_react2.useId)().replaceAll(":", "");
496
+ }
497
+
498
+ // src/utilities/view-transition.tsx
499
+ var import_react_dom = require("react-dom");
500
+ function startViewTransition(callback) {
501
+ if (document.startViewTransition) {
502
+ document.startViewTransition(() => {
503
+ (0, import_react_dom.flushSync)(callback);
504
+ });
505
+ } else {
506
+ callback();
507
+ }
508
+ }
509
+
510
+ // src/components/accordion.tsx
487
511
  var import_jsx_runtime7 = require("react/jsx-runtime");
488
512
  function Accordion({ children, className }) {
489
- const [activeItem, setActiveItem] = (0, import_react2.useState)("");
513
+ const [activeItem, setActiveItem] = (0, import_react3.useState)("");
514
+ const id = useCssId();
490
515
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
491
516
  AccordionContext.Provider,
492
517
  {
493
518
  value: {
494
519
  activeItem,
495
- setActiveItem
520
+ setActiveItem,
521
+ id
496
522
  },
497
523
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
498
524
  "div",
499
525
  {
500
526
  className: (0, import_tailwind_merge7.twMerge)(
501
- "bg-lol-blue-950 border-lol-gold-500 overflow-hidden rounded border",
527
+ "bg-lol-blue-950 border-lol-gold-500 rounded border",
502
528
  className
503
529
  ),
530
+ style: {
531
+ viewTransitionName: `${id}`
532
+ },
504
533
  children
505
534
  }
506
535
  )
@@ -511,8 +540,8 @@ function AccordionTrigger({
511
540
  children,
512
541
  className
513
542
  }) {
514
- const { setActiveItem, activeItem } = (0, import_react2.useContext)(AccordionContext);
515
- const { item } = (0, import_react2.useContext)(AccordionItemContext);
543
+ const { setActiveItem, activeItem, id } = (0, import_react3.useContext)(AccordionContext);
544
+ const { item } = (0, import_react3.useContext)(AccordionItemContext);
516
545
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
517
546
  "button",
518
547
  {
@@ -521,7 +550,12 @@ function AccordionTrigger({
521
550
  className
522
551
  ),
523
552
  onClick: () => {
524
- setActiveItem((currentItem) => currentItem === item ? "" : item);
553
+ startViewTransition(() => {
554
+ setActiveItem((currentItem) => currentItem === item ? "" : item);
555
+ });
556
+ },
557
+ style: {
558
+ viewTransitionName: `${id}-${item}`
525
559
  },
526
560
  children: [
527
561
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -551,15 +585,15 @@ function AccordionItem({ children, value }) {
551
585
  );
552
586
  }
553
587
  function AccordionContent({ children }) {
554
- const { activeItem } = (0, import_react2.useContext)(AccordionContext);
555
- const { item } = (0, import_react2.useContext)(AccordionItemContext);
588
+ const { activeItem } = (0, import_react3.useContext)(AccordionContext);
589
+ const { item } = (0, import_react3.useContext)(AccordionItemContext);
556
590
  if (activeItem !== item) {
557
591
  return null;
558
592
  }
559
593
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-lol-blue-900 border-lol-gold-500 font-spiegel text-lol-blue-100 border-t px-5 py-2", children });
560
594
  }
561
- var AccordionContext = (0, import_react2.createContext)(void 0);
562
- var AccordionItemContext = (0, import_react2.createContext)(void 0);
595
+ var AccordionContext = (0, import_react3.createContext)(void 0);
596
+ var AccordionItemContext = (0, import_react3.createContext)(void 0);
563
597
 
564
598
  // src/components/text-field.tsx
565
599
  var import_react_aria_components7 = require("react-aria-components");
@@ -743,6 +777,81 @@ function Spinner({ className }) {
743
777
  }
744
778
  );
745
779
  }
780
+
781
+ // src/components/modal.tsx
782
+ var import_react_aria_components11 = require("react-aria-components");
783
+ var import_tailwind_merge13 = require("tailwind-merge");
784
+ var import_jsx_runtime13 = require("react/jsx-runtime");
785
+ function Modal({
786
+ modalOverlayClassName,
787
+ dialogProps = {},
788
+ children,
789
+ className,
790
+ ...modalProps
791
+ }) {
792
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
793
+ import_react_aria_components11.ModalOverlay,
794
+ {
795
+ ...modalProps,
796
+ className: (values) => {
797
+ return (0, import_tailwind_merge13.twMerge)(
798
+ "fixed inset-0 z-10 overflow-y-auto bg-black bg-opacity-25 flex min-h-full items-center justify-center text-center backdrop-blur flex-col px-4",
799
+ resolveClassname(modalOverlayClassName, values)
800
+ );
801
+ },
802
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
803
+ import_react_aria_components11.Modal,
804
+ {
805
+ ...modalProps,
806
+ className: (values) => (0, import_tailwind_merge13.twMerge)("w-full max-w-md", resolveClassname(className, values)),
807
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
808
+ import_react_aria_components11.Dialog,
809
+ {
810
+ role: "alertdialog",
811
+ ...dialogProps,
812
+ className: (0, import_tailwind_merge13.twMerge)(
813
+ "outline-none relative max-h-screen py-4",
814
+ dialogProps.className
815
+ ),
816
+ children: (dialogRenderProps) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
817
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative h-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "border-lol-gold-700 border bg-black absolute border-b-0 rounded-full h-full left-5 right-5" }) }),
818
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
819
+ "div",
820
+ {
821
+ className: (0, import_tailwind_merge13.twMerge)(
822
+ "text-left align-middle shadow-xl p-0.5 bg-gradient-to-t",
823
+ borderPressedClassName
824
+ ),
825
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "bg-black", children: typeof children === "function" ? children(dialogRenderProps) : children })
826
+ }
827
+ ),
828
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "relative h-1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "border-lol-gold-600 border bg-black absolute border-t-0 rounded-full h-full left-5 right-5" }) })
829
+ ] })
830
+ }
831
+ )
832
+ }
833
+ )
834
+ }
835
+ );
836
+ }
837
+ function Heading(props) {
838
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
839
+ import_react_aria_components11.Heading,
840
+ {
841
+ ...props,
842
+ className: (0, import_tailwind_merge13.twMerge)(
843
+ "text-lol-gold-100 uppercase font-beaufort font-bold text-lg",
844
+ props.className
845
+ )
846
+ }
847
+ );
848
+ }
849
+ function DialogButtons({ children }) {
850
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex justify-center translate-y-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex gap-1 bg-black px-1", children }) });
851
+ }
852
+ function DialogTrigger(props) {
853
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_aria_components11.DialogTrigger, { ...props });
854
+ }
746
855
  // Annotate the CommonJS export names for ESM import in node:
747
856
  0 && (module.exports = {
748
857
  Accordion,
@@ -750,8 +859,12 @@ function Spinner({ className }) {
750
859
  AccordionItem,
751
860
  AccordionTrigger,
752
861
  Button,
862
+ DialogButtons,
863
+ DialogTrigger,
864
+ Heading,
753
865
  Item,
754
866
  Label,
867
+ Modal,
755
868
  NumberField,
756
869
  ProgressBar,
757
870
  Radio,