@lolmath/ui 2.3.0 → 2.4.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
@@ -41,6 +41,10 @@ __export(src_exports, {
41
41
  SliderLabel: () => SliderLabel,
42
42
  Spinner: () => Spinner,
43
43
  Switch: () => Switch,
44
+ Tab: () => Tab,
45
+ TabList: () => TabList,
46
+ TabPanel: () => TabPanel,
47
+ Tabs: () => Tabs,
44
48
  TextField: () => TextField
45
49
  });
46
50
  module.exports = __toCommonJS(src_exports);
@@ -524,7 +528,7 @@ function Accordion({ children, className }) {
524
528
  "div",
525
529
  {
526
530
  className: (0, import_tailwind_merge7.twMerge)(
527
- "bg-lol-blue-950 border-lol-gold-500 rounded border",
531
+ "bg-lol-blue-950 border-lol-gold-500 rounded border overflow-hidden",
528
532
  className
529
533
  ),
530
534
  style: {
@@ -852,6 +856,69 @@ function DialogButtons({ children }) {
852
856
  function DialogTrigger(props) {
853
857
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_aria_components11.DialogTrigger, { ...props });
854
858
  }
859
+
860
+ // src/components/tabs.tsx
861
+ var import_react_aria_components12 = require("react-aria-components");
862
+ var import_tailwind_merge14 = require("tailwind-merge");
863
+ var import_react4 = require("react");
864
+ var import_jsx_runtime14 = require("react/jsx-runtime");
865
+ function Tabs({ onSelectionChange, ...rest }) {
866
+ const id = useCssId();
867
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabsContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
868
+ import_react_aria_components12.Tabs,
869
+ {
870
+ ...rest,
871
+ onSelectionChange: (key) => {
872
+ startViewTransition(() => {
873
+ onSelectionChange?.(key);
874
+ });
875
+ }
876
+ }
877
+ ) });
878
+ }
879
+ function TabList({ ...rest }) {
880
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_aria_components12.TabList, { ...rest, className: () => "flex gap-0 -ml-4" });
881
+ }
882
+ function Tab({ children, ...rest }) {
883
+ const { id } = useTabsContext();
884
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
885
+ import_react_aria_components12.Tab,
886
+ {
887
+ ...rest,
888
+ className: (values) => (0, import_tailwind_merge14.twMerge)(
889
+ "font-beaufort text-lol-gold-300 uppercase font-medium text-xs tracking-widest px-4 relative py-1 cursor-pointer select-none",
890
+ (values.isSelected || values.isHovered) && "text-lol-gold-50",
891
+ values.isPressed && "text-lol-gold-500",
892
+ values.isDisabled && "text-lol-gray-500 cursor-default"
893
+ ),
894
+ children: (values) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
895
+ typeof children === "function" ? children(values) : children,
896
+ values.isSelected && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
897
+ "div",
898
+ {
899
+ style: {
900
+ viewTransitionName: `tab-indicator-${id}`
901
+ },
902
+ className: (0, import_tailwind_merge14.twMerge)(
903
+ "h-px bg-gradient-to-r from-transparent via-lol-gold-200 to-transparent absolute bottom-0 w-full left-0"
904
+ )
905
+ }
906
+ )
907
+ ] })
908
+ }
909
+ );
910
+ }
911
+ function TabPanel({ ...rest }) {
912
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_aria_components12.TabPanel, { ...rest });
913
+ }
914
+ var TabsContext = (0, import_react4.createContext)(void 0);
915
+ function useTabsContext() {
916
+ const context = (0, import_react4.useContext)(TabsContext);
917
+ if (context === void 0) {
918
+ throw new Error("useTabsContext must be used within a Tabs");
919
+ }
920
+ return context;
921
+ }
855
922
  // Annotate the CommonJS export names for ESM import in node:
856
923
  0 && (module.exports = {
857
924
  Accordion,
@@ -875,6 +942,10 @@ function DialogTrigger(props) {
875
942
  SliderLabel,
876
943
  Spinner,
877
944
  Switch,
945
+ Tab,
946
+ TabList,
947
+ TabPanel,
948
+ Tabs,
878
949
  TextField
879
950
  });
880
951
  //# sourceMappingURL=index.cjs.map