@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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentProps } from 'react';
3
- import { ButtonProps as ButtonProps$1, ItemProps, SelectProps as SelectProps$1, SearchFieldProps, Input, SliderProps, SliderTrackProps, SliderThumbProps, SliderTrackRenderProps, SwitchProps, ProgressBarProps as ProgressBarProps$1, TextFieldProps, RadioGroupProps, RadioProps, LabelProps, NumberFieldProps, Group } from 'react-aria-components';
3
+ import { ButtonProps as ButtonProps$1, ItemProps, SelectProps as SelectProps$1, SearchFieldProps, Input, SliderProps, SliderTrackProps, SliderThumbProps, SliderTrackRenderProps, SwitchProps, ProgressBarProps as ProgressBarProps$1, TextFieldProps, RadioGroupProps, RadioProps, LabelProps, NumberFieldProps, Group, HeadingProps, DialogTriggerProps, ModalOverlayProps, DialogProps } from 'react-aria-components';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
 
6
6
  interface ButtonProps extends ButtonProps$1 {
@@ -80,4 +80,16 @@ interface SpinnerProps {
80
80
  }
81
81
  declare function Spinner({ className }: SpinnerProps): react_jsx_runtime.JSX.Element;
82
82
 
83
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, Item, Label, NumberField, ProgressBar, Radio, RadioGroup, SearchField, Select, Slider, SliderLabel, Spinner, Switch, TextField };
83
+ interface ModalProps extends Omit<ModalOverlayProps, "children"> {
84
+ modalOverlayClassName?: ModalOverlayProps["className"];
85
+ dialogProps?: Omit<DialogProps, "children">;
86
+ children?: DialogProps["children"];
87
+ }
88
+ declare function Modal({ modalOverlayClassName, dialogProps, children, className, ...modalProps }: ModalProps): react_jsx_runtime.JSX.Element;
89
+ declare function Heading(props: HeadingProps): react_jsx_runtime.JSX.Element;
90
+ declare function DialogButtons({ children }: {
91
+ children: React.ReactNode;
92
+ }): react_jsx_runtime.JSX.Element;
93
+ declare function DialogTrigger(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
94
+
95
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, DialogButtons, DialogTrigger, Heading, Item, Label, Modal, NumberField, ProgressBar, Radio, RadioGroup, SearchField, Select, Slider, SliderLabel, Spinner, Switch, TextField };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentProps } from 'react';
3
- import { ButtonProps as ButtonProps$1, ItemProps, SelectProps as SelectProps$1, SearchFieldProps, Input, SliderProps, SliderTrackProps, SliderThumbProps, SliderTrackRenderProps, SwitchProps, ProgressBarProps as ProgressBarProps$1, TextFieldProps, RadioGroupProps, RadioProps, LabelProps, NumberFieldProps, Group } from 'react-aria-components';
3
+ import { ButtonProps as ButtonProps$1, ItemProps, SelectProps as SelectProps$1, SearchFieldProps, Input, SliderProps, SliderTrackProps, SliderThumbProps, SliderTrackRenderProps, SwitchProps, ProgressBarProps as ProgressBarProps$1, TextFieldProps, RadioGroupProps, RadioProps, LabelProps, NumberFieldProps, Group, HeadingProps, DialogTriggerProps, ModalOverlayProps, DialogProps } from 'react-aria-components';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
 
6
6
  interface ButtonProps extends ButtonProps$1 {
@@ -80,4 +80,16 @@ interface SpinnerProps {
80
80
  }
81
81
  declare function Spinner({ className }: SpinnerProps): react_jsx_runtime.JSX.Element;
82
82
 
83
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, Item, Label, NumberField, ProgressBar, Radio, RadioGroup, SearchField, Select, Slider, SliderLabel, Spinner, Switch, TextField };
83
+ interface ModalProps extends Omit<ModalOverlayProps, "children"> {
84
+ modalOverlayClassName?: ModalOverlayProps["className"];
85
+ dialogProps?: Omit<DialogProps, "children">;
86
+ children?: DialogProps["children"];
87
+ }
88
+ declare function Modal({ modalOverlayClassName, dialogProps, children, className, ...modalProps }: ModalProps): react_jsx_runtime.JSX.Element;
89
+ declare function Heading(props: HeadingProps): react_jsx_runtime.JSX.Element;
90
+ declare function DialogButtons({ children }: {
91
+ children: React.ReactNode;
92
+ }): react_jsx_runtime.JSX.Element;
93
+ declare function DialogTrigger(props: DialogTriggerProps): react_jsx_runtime.JSX.Element;
94
+
95
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, DialogButtons, DialogTrigger, Heading, Item, Label, Modal, NumberField, ProgressBar, Radio, RadioGroup, SearchField, Select, Slider, SliderLabel, Spinner, Switch, TextField };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { twMerge } from "tailwind-merge";
8
8
  // src/utilities/border.tsx
9
9
  var borderClassName = "from-[#785b28] via-[#c89c3c] to-[#c8aa6e] bg-gradient-to-t";
10
10
  var borderHoverClassName = "from-[#c89c3c] via-[#dcc188] to-[#f0e6d8]";
11
- var borderPressedClassName = "from-[#694f27] via-[#694f27] to-[#463817]";
11
+ var borderPressedClassName = "from-lol-gold-600 via-lol-gold-600 to-lol-gold-700";
12
12
  var borderDisabledClassName = "from-[#5c5b57] via-[#5c5b57] to-[#5c5b57]";
13
13
 
14
14
  // src/components/button.tsx
@@ -464,23 +464,48 @@ function ProgressBar({
464
464
  // src/components/accordion.tsx
465
465
  import { createContext, useState, useContext } from "react";
466
466
  import { twMerge as twMerge7 } from "tailwind-merge";
467
+
468
+ // src/utilities/css-id.tsx
469
+ import { useId } from "react";
470
+ function useCssId() {
471
+ return useId().replaceAll(":", "");
472
+ }
473
+
474
+ // src/utilities/view-transition.tsx
475
+ import { flushSync } from "react-dom";
476
+ function startViewTransition(callback) {
477
+ if (document.startViewTransition) {
478
+ document.startViewTransition(() => {
479
+ flushSync(callback);
480
+ });
481
+ } else {
482
+ callback();
483
+ }
484
+ }
485
+
486
+ // src/components/accordion.tsx
467
487
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
468
488
  function Accordion({ children, className }) {
469
489
  const [activeItem, setActiveItem] = useState("");
490
+ const id = useCssId();
470
491
  return /* @__PURE__ */ jsx7(
471
492
  AccordionContext.Provider,
472
493
  {
473
494
  value: {
474
495
  activeItem,
475
- setActiveItem
496
+ setActiveItem,
497
+ id
476
498
  },
477
499
  children: /* @__PURE__ */ jsx7(
478
500
  "div",
479
501
  {
480
502
  className: twMerge7(
481
- "bg-lol-blue-950 border-lol-gold-500 overflow-hidden rounded border",
503
+ "bg-lol-blue-950 border-lol-gold-500 rounded border",
482
504
  className
483
505
  ),
506
+ style: {
507
+ viewTransitionName: `${id}`
508
+ },
484
509
  children
485
510
  }
486
511
  )
@@ -491,7 +516,7 @@ function AccordionTrigger({
491
516
  children,
492
517
  className
493
518
  }) {
494
- const { setActiveItem, activeItem } = useContext(AccordionContext);
519
+ const { setActiveItem, activeItem, id } = useContext(AccordionContext);
495
520
  const { item } = useContext(AccordionItemContext);
496
521
  return /* @__PURE__ */ jsxs6(
497
522
  "button",
@@ -501,7 +526,12 @@ function AccordionTrigger({
501
526
  className
502
527
  ),
503
528
  onClick: () => {
504
- setActiveItem((currentItem) => currentItem === item ? "" : item);
529
+ startViewTransition(() => {
530
+ setActiveItem((currentItem) => currentItem === item ? "" : item);
531
+ });
532
+ },
533
+ style: {
534
+ viewTransitionName: `${id}-${item}`
505
535
  },
506
536
  children: [
507
537
  /* @__PURE__ */ jsx7(
@@ -736,14 +766,99 @@ function Spinner({ className }) {
736
766
  }
737
767
  );
738
768
  }
769
+
770
+ // src/components/modal.tsx
771
+ import {
772
+ Modal as AriaModal,
773
+ Dialog,
774
+ DialogTrigger as AriaDialogTrigger,
775
+ Heading as AriaHeading,
776
+ ModalOverlay
777
+ } from "react-aria-components";
778
+ import { twMerge as twMerge13 } from "tailwind-merge";
779
+ import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
780
+ function Modal({
781
+ modalOverlayClassName,
782
+ dialogProps = {},
783
+ children,
784
+ className,
785
+ ...modalProps
786
+ }) {
787
+ return /* @__PURE__ */ jsx13(
788
+ ModalOverlay,
789
+ {
790
+ ...modalProps,
791
+ className: (values) => {
792
+ return twMerge13(
793
+ "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",
794
+ resolveClassname(modalOverlayClassName, values)
795
+ );
796
+ },
797
+ children: /* @__PURE__ */ jsx13(
798
+ AriaModal,
799
+ {
800
+ ...modalProps,
801
+ className: (values) => twMerge13("w-full max-w-md", resolveClassname(className, values)),
802
+ children: /* @__PURE__ */ jsx13(
803
+ Dialog,
804
+ {
805
+ role: "alertdialog",
806
+ ...dialogProps,
807
+ className: twMerge13(
808
+ "outline-none relative max-h-screen py-4",
809
+ dialogProps.className
810
+ ),
811
+ children: (dialogRenderProps) => /* @__PURE__ */ jsxs8(Fragment5, { children: [
812
+ /* @__PURE__ */ jsx13("div", { className: "relative h-1", children: /* @__PURE__ */ jsx13("div", { className: "border-lol-gold-700 border bg-black absolute border-b-0 rounded-full h-full left-5 right-5" }) }),
813
+ /* @__PURE__ */ jsx13(
814
+ "div",
815
+ {
816
+ className: twMerge13(
817
+ "text-left align-middle shadow-xl p-0.5 bg-gradient-to-t",
818
+ borderPressedClassName
819
+ ),
820
+ children: /* @__PURE__ */ jsx13("div", { className: "bg-black", children: typeof children === "function" ? children(dialogRenderProps) : children })
821
+ }
822
+ ),
823
+ /* @__PURE__ */ jsx13("div", { className: "relative h-1", children: /* @__PURE__ */ jsx13("div", { className: "border-lol-gold-600 border bg-black absolute border-t-0 rounded-full h-full left-5 right-5" }) })
824
+ ] })
825
+ }
826
+ )
827
+ }
828
+ )
829
+ }
830
+ );
831
+ }
832
+ function Heading(props) {
833
+ return /* @__PURE__ */ jsx13(
834
+ AriaHeading,
835
+ {
836
+ ...props,
837
+ className: twMerge13(
838
+ "text-lol-gold-100 uppercase font-beaufort font-bold text-lg",
839
+ props.className
840
+ )
841
+ }
842
+ );
843
+ }
844
+ function DialogButtons({ children }) {
845
+ return /* @__PURE__ */ jsx13("div", { className: "flex justify-center translate-y-0.5", children: /* @__PURE__ */ jsx13("div", { className: "flex gap-1 bg-black px-1", children }) });
846
+ }
847
+ function DialogTrigger(props) {
848
+ return /* @__PURE__ */ jsx13(AriaDialogTrigger, { ...props });
849
+ }
739
850
  export {
740
851
  Accordion,
741
852
  AccordionContent,
742
853
  AccordionItem,
743
854
  AccordionTrigger,
744
855
  Button,
856
+ DialogButtons,
857
+ DialogTrigger,
858
+ Heading,
745
859
  Item,
746
860
  Label3 as Label,
861
+ Modal,
747
862
  NumberField,
748
863
  ProgressBar,
749
864
  Radio,