@lolmath/ui 2.7.0 → 2.8.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,6 +25,7 @@ __export(src_exports, {
25
25
  AccordionItem: () => AccordionItem,
26
26
  AccordionTrigger: () => AccordionTrigger,
27
27
  Button: () => Button,
28
+ Card: () => Card,
28
29
  Checkbox: () => Checkbox,
29
30
  DialogButtons: () => DialogButtons,
30
31
  DialogTrigger: () => DialogTrigger,
@@ -49,7 +50,8 @@ __export(src_exports, {
49
50
  TextArea: () => TextArea,
50
51
  TextField: () => TextField,
51
52
  Tooltip: () => Tooltip,
52
- TooltipTrigger: () => import_react_aria_components16.TooltipTrigger
53
+ TooltipTrigger: () => import_react_aria_components16.TooltipTrigger,
54
+ borderInverted: () => borderInverted
53
55
  });
54
56
  module.exports = __toCommonJS(src_exports);
55
57
 
@@ -59,10 +61,10 @@ var import_react_aria_components = require("react-aria-components");
59
61
  var import_tailwind_merge = require("tailwind-merge");
60
62
 
61
63
  // src/utilities/border.tsx
62
- var borderClassName = "from-[#785b28] via-[#c89c3c] to-[#c8aa6e] bg-gradient-to-t";
63
- var borderHoverClassName = "from-[#c89c3c] via-[#dcc188] to-[#f0e6d8]";
64
- var borderPressedClassName = "from-lol-gold-600 via-lol-gold-600 to-lol-gold-700";
65
- var borderDisabledClassName = "from-[#5c5b57] via-[#5c5b57] to-[#5c5b57]";
64
+ var borderGradient = "from-[#785b28] via-[#c89c3c] to-[#c8aa6e] bg-gradient-to-t";
65
+ var borderGradientHover = "from-[#c89c3c] via-[#dcc188] to-[#f0e6d8]";
66
+ var borderGradientPressed = "from-lol-gold-600 via-lol-gold-600 to-lol-gold-700";
67
+ var borderGradientDisabled = "from-[#5c5b57] via-[#5c5b57] to-[#5c5b57]";
66
68
 
67
69
  // src/utilities/resolve-classname.ts
68
70
  function resolveClassname(className, values) {
@@ -71,7 +73,14 @@ function resolveClassname(className, values) {
71
73
 
72
74
  // src/components/button.tsx
73
75
  var import_jsx_runtime = require("react/jsx-runtime");
74
- function _Button({ children, className, priority = "secondary", ...props }, ref) {
76
+ function _Button({
77
+ children,
78
+ className,
79
+ priority = "secondary",
80
+ isRounded = false,
81
+ isSquared = false,
82
+ ...props
83
+ }, ref) {
75
84
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
85
  import_react_aria_components.Button,
77
86
  {
@@ -79,13 +88,18 @@ function _Button({ children, className, priority = "secondary", ...props }, ref)
79
88
  ...props,
80
89
  className: (values) => {
81
90
  return (0, import_tailwind_merge.twMerge)(
82
- "font-[beaufort] font-black uppercase transition-colors duration-200 outline-none bg-gradient-to-t",
83
- borderClassName,
84
- values.isHovered && borderHoverClassName,
85
- values.isPressed && borderPressedClassName,
86
- values.isDisabled && borderDisabledClassName,
87
- values.isFocused && "",
88
- values.isFocusVisible && "outline outline-yellow-50 outline-offset-2",
91
+ "transition-colors duration-200 outline-none",
92
+ (priority === "primary" || priority === "secondary") && [
93
+ "bg-gradient-to-t",
94
+ borderGradient,
95
+ values.isHovered && borderGradientHover,
96
+ values.isPressed && borderGradientPressed,
97
+ values.isDisabled && borderGradientDisabled,
98
+ values.isFocused && "",
99
+ values.isFocusVisible && "outline outline-yellow-50 outline-offset-2"
100
+ ],
101
+ isRounded && "rounded-full aspect-square",
102
+ isSquared && "aspect-square",
89
103
  resolveClassname(className, values)
90
104
  );
91
105
  },
@@ -94,17 +108,26 @@ function _Button({ children, className, priority = "secondary", ...props }, ref)
94
108
  "span",
95
109
  {
96
110
  className: (0, import_tailwind_merge.twMerge)(
97
- "block m-0.5 px-4 py-2 bg-lol-gray-950 transition-colors duration-200",
98
- priority === "primary" && "bg-gradient-to-b",
99
- "text-[#cdbe91] tracking-wide",
100
- values.isHovered && "text-lol-gold-100",
101
- values.isPressed && "text-lol-gray-500",
111
+ "block transition-colors duration-200 text-lol-gold-300 tracking-wide font-beaufort font-black uppercase",
112
+ (priority === "primary" || priority === "secondary") && [
113
+ "m-0.5 px-4 py-2 bg-lol-gray-950"
114
+ ],
115
+ priority === "primary" && "from-lol-gold-700 via-lol-gold-800 to-lol-gold-900 bg-gradient-to-b",
116
+ priority === "tertiary" && !isRounded && 'relative after:content-[""] after:absolute after:-top-2 after:-bottom-2 after:-left-2 after:-right-2',
117
+ (isSquared || isRounded) && "aspect-square p-1.5",
118
+ isRounded && "rounded-full",
119
+ values.isHovered && [
120
+ "text-lol-gold-100",
121
+ priority === "primary" && "from-lol-gold-700 via-lol-gold-600 to-lol-gold-600",
122
+ priority === "tertiary" && (isRounded || isSquared) && "bg-lol-gray-900"
123
+ ],
124
+ values.isPressed && [
125
+ "text-lol-gray-500",
126
+ priority === "primary" && "text-lol-gold-600 from-lol-gold-900 via-lol-gold-900 to-lol-gold-900"
127
+ ],
102
128
  values.isDisabled && "text-lol-gray-500",
103
129
  values.isFocused && "",
104
- values.isFocusVisible && "",
105
- priority === "primary" && "from-lol-gold-700 via-lol-gold-800 to-lol-gold-900",
106
- priority === "primary" && values.isHovered && "from-[#604522] via-[#846745] to-[#725634]",
107
- priority === "primary" && values.isPressed && "from-[#261b0d] via-[#261b0d] to-[#261b0d] text-[#67604c]"
130
+ values.isFocusVisible && ""
108
131
  ),
109
132
  children: typeof children === "function" ? children(values) : children
110
133
  }
@@ -141,10 +164,10 @@ function Select({
141
164
  {
142
165
  className: (buttonValues) => (0, import_tailwind_merge2.twMerge)(
143
166
  "inline-block outline-none",
144
- borderClassName,
145
- buttonValues.isHovered && borderHoverClassName,
146
- (buttonValues.isPressed || values.isOpen) && borderPressedClassName,
147
- buttonValues.isDisabled && borderDisabledClassName,
167
+ borderGradient,
168
+ buttonValues.isHovered && borderGradientHover,
169
+ (buttonValues.isPressed || values.isOpen) && borderGradientPressed,
170
+ buttonValues.isDisabled && borderGradientDisabled,
148
171
  buttonValues.isFocused && "",
149
172
  buttonValues.isFocusVisible && outlineClassName
150
173
  ),
@@ -214,7 +237,7 @@ function SearchField({
214
237
  className: (values) => {
215
238
  return (0, import_tailwind_merge3.twMerge)(
216
239
  "flex flex-col outline-none",
217
- borderClassName,
240
+ borderGradient,
218
241
  "focus-within:from-lol-gold-300 focus-within:via-lol-gold-200 focus-within:to-lol-gold-50",
219
242
  props.isDisabled && "from-lol-gray-700 via-lol-gray-700 to-lol-gray-700",
220
243
  resolveClassname(props.className, values)
@@ -413,10 +436,10 @@ function Switch({
413
436
  {
414
437
  className: (0, import_tailwind_merge5.twMerge)(
415
438
  "h-6 w-14 shrink-0 cursor-default rounded-full p-0.5",
416
- borderClassName,
417
- values.isHovered && borderHoverClassName,
418
- values.isPressed && borderPressedClassName,
419
- values.isDisabled && borderDisabledClassName,
439
+ borderGradient,
440
+ values.isHovered && borderGradientHover,
441
+ values.isPressed && borderGradientPressed,
442
+ values.isDisabled && borderGradientDisabled,
420
443
  values.isFocused && "",
421
444
  values.isFocusVisible && "outline outline-1 outline-offset-2 outline-yellow-50"
422
445
  ),
@@ -437,10 +460,10 @@ function Switch({
437
460
  className: (0, import_tailwind_merge5.twMerge)(
438
461
  "absolute -left-2 -top-1.5 h-8 w-8 rounded-full p-0.5 shadow-md ring-0 transition-[left] duration-200 ease-in-out",
439
462
  values.isSelected && "left-[calc(100%-1.75rem)]",
440
- borderClassName,
441
- values.isHovered && borderHoverClassName,
442
- values.isPressed && borderPressedClassName,
443
- values.isDisabled && borderDisabledClassName
463
+ borderGradient,
464
+ values.isHovered && borderGradientHover,
465
+ values.isPressed && borderGradientPressed,
466
+ values.isDisabled && borderGradientDisabled
444
467
  ),
445
468
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "block h-full w-full rounded-full bg-lol-gray-950" })
446
469
  }
@@ -465,7 +488,7 @@ function ProgressBar({
465
488
  ...props
466
489
  }) {
467
490
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_aria_components6.ProgressBar, { className: "flex w-56 flex-col gap-1 text-sm", ...props, children: ({ percentage, valueText }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
468
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex font-[beaufort] font-bold uppercase text-lol-gold-100", children: [
491
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex font-beaufort font-bold uppercase text-lol-gold-100", children: [
469
492
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_aria_components6.Label, { className: "flex-1 ", children: label ?? "Loading" }),
470
493
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: valueText })
471
494
  ] }),
@@ -473,7 +496,7 @@ function ProgressBar({
473
496
  "div",
474
497
  {
475
498
  className: (0, import_tailwind_merge6.twMerge)(
476
- borderClassName,
499
+ borderGradient,
477
500
  "-ml-0.5 -mr-1 h-3 rounded-full p-px"
478
501
  ),
479
502
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -535,7 +558,7 @@ function Accordion({ children, className }) {
535
558
  "div",
536
559
  {
537
560
  className: (0, import_tailwind_merge7.twMerge)(
538
- "bg-lol-blue-950 border-lol-gold-500 rounded border overflow-hidden",
561
+ "bg-lol-blue-950 border-lol-gold-500 border",
539
562
  className
540
563
  ),
541
564
  style: {
@@ -620,7 +643,7 @@ function TextField({
620
643
  ...props,
621
644
  className: (values) => (0, import_tailwind_merge8.twMerge)(
622
645
  "flex flex-col outline-none",
623
- borderClassName,
646
+ borderGradient,
624
647
  "focus-within:from-lol-gold-300 focus-within:via-lol-gold-200 focus-within:to-lol-gold-50",
625
648
  props.isDisabled && "from-lol-gray-700 via-lol-gray-700 to-lol-gray-700",
626
649
  resolveClassname(props.className, values)
@@ -729,7 +752,7 @@ function NumberField({
729
752
  const finalClassName = resolveClassname(groupProps.className, values);
730
753
  return (0, import_tailwind_merge11.twMerge)(
731
754
  "grid grid-cols-[auto_1fr_auto] outline-none gap-px p-px",
732
- borderClassName,
755
+ borderGradient,
733
756
  "focus-within:from-lol-gold-300 focus-within:via-lol-gold-200 focus-within:to-lol-gold-50",
734
757
  props.isDisabled && "from-lol-gray-700 via-lol-gray-700 to-lol-gray-700",
735
758
  finalClassName
@@ -824,7 +847,7 @@ function Modal({
824
847
  {
825
848
  className: (0, import_tailwind_merge13.twMerge)(
826
849
  "text-left align-middle shadow-xl p-0.5 bg-gradient-to-t",
827
- borderPressedClassName
850
+ borderGradientPressed
828
851
  ),
829
852
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "bg-black", children: typeof children === "function" ? children(dialogRenderProps) : children })
830
853
  }
@@ -992,7 +1015,7 @@ function TextArea({
992
1015
  ...props,
993
1016
  className: (values) => (0, import_tailwind_merge16.twMerge)(
994
1017
  "flex flex-col outline-none",
995
- borderClassName,
1018
+ borderGradient,
996
1019
  "focus-within:from-lol-gold-300 focus-within:via-lol-gold-200 focus-within:to-lol-gold-50",
997
1020
  props.isDisabled && "from-lol-gray-700 via-lol-gray-700 to-lol-gray-700",
998
1021
  resolveClassname(props.className, values)
@@ -1035,7 +1058,7 @@ function Tooltip({ children, ...props }) {
1035
1058
  ...props,
1036
1059
  className: (values) => (0, import_tailwind_merge17.twMerge)(
1037
1060
  `p-0.5 drop-shadow-lg bg-black`,
1038
- borderClassName,
1061
+ borderGradient,
1039
1062
  "w-[280px]",
1040
1063
  values.isEntering && "animate-in fade-in data-[placement=bottom]:slide-in-from-top-1 data-[placement=top]:slide-in-from-bottom-1 ease-out duration-200 fill-mode-forwards",
1041
1064
  values.isExiting && "animate-out fade-out data-[placement=bottom]:slide-out-to-top-1 data-[placement=top]:slide-out-to-bottom-1 ease-in duration-150 fill-mode-forwards",
@@ -1079,6 +1102,40 @@ function Tooltip({ children, ...props }) {
1079
1102
  }
1080
1103
  );
1081
1104
  }
1105
+
1106
+ // src/components/card.tsx
1107
+ var import_tailwind_merge18 = require("tailwind-merge");
1108
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1109
+ function Card({ children, className, style, borderProps }) {
1110
+ const r = `1rem`;
1111
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1112
+ "div",
1113
+ {
1114
+ ...borderProps ?? {},
1115
+ className: (0, import_tailwind_merge18.twMerge)("p-[3px]", borderGradient, borderProps?.className),
1116
+ style: {
1117
+ WebkitMask: borderInverted(r),
1118
+ mask: borderInverted(r),
1119
+ ...borderProps?.style ?? {}
1120
+ },
1121
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1122
+ "div",
1123
+ {
1124
+ className: (0, import_tailwind_merge18.twMerge)("bg-black w-full", className),
1125
+ style: {
1126
+ WebkitMask: borderInverted(r),
1127
+ mask: borderInverted(r),
1128
+ ...style ?? {}
1129
+ },
1130
+ children
1131
+ }
1132
+ )
1133
+ }
1134
+ );
1135
+ }
1136
+ function borderInverted(r) {
1137
+ return `radial-gradient(${r} at ${r} ${r},#0000 98%,#000) -${r} -${r}`;
1138
+ }
1082
1139
  // Annotate the CommonJS export names for ESM import in node:
1083
1140
  0 && (module.exports = {
1084
1141
  Accordion,
@@ -1086,6 +1143,7 @@ function Tooltip({ children, ...props }) {
1086
1143
  AccordionItem,
1087
1144
  AccordionTrigger,
1088
1145
  Button,
1146
+ Card,
1089
1147
  Checkbox,
1090
1148
  DialogButtons,
1091
1149
  DialogTrigger,
@@ -1110,6 +1168,7 @@ function Tooltip({ children, ...props }) {
1110
1168
  TextArea,
1111
1169
  TextField,
1112
1170
  Tooltip,
1113
- TooltipTrigger
1171
+ TooltipTrigger,
1172
+ borderInverted
1114
1173
  });
1115
1174
  //# sourceMappingURL=index.cjs.map