@syscore/ui-library 1.4.0 → 1.5.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.ts CHANGED
@@ -170,6 +170,12 @@ import { navigationMenuTriggerStyle } from '../client/components/ui/navigation-m
170
170
  import { NavItem } from '../client/components/ui/navigation';
171
171
  import { NavLogo } from '../client/components/icons/NavLogo';
172
172
  import { Option as Option_2 } from '../client/components/ui/search';
173
+ import { PageHeader } from '../client/components/ui/page-header';
174
+ import { PageHeaderBadge } from '../client/components/ui/page-header';
175
+ import { PageHeaderDescription } from '../client/components/ui/page-header';
176
+ import { PageHeaderLeftContent } from '../client/components/ui/page-header';
177
+ import { PageHeaderTitle } from '../client/components/ui/page-header';
178
+ import { PageHeaderTopSection } from '../client/components/ui/page-header';
173
179
  import { Pagination } from '../client/components/ui/pagination';
174
180
  import { PaginationContent } from '../client/components/ui/pagination';
175
181
  import { PaginationEllipsis } from '../client/components/ui/pagination';
@@ -238,6 +244,14 @@ import { Slider } from '../client/components/ui/slider';
238
244
  import { Toaster as Sonner } from '../client/components/ui/sonner';
239
245
  import { StandardLogo } from '../client/components/icons/StandardLogo';
240
246
  import { StandardNavigation } from '../client/components/ui/standard-navigation';
247
+ import { StandardTable } from '../client/components/ui/standard-table';
248
+ import { StandardTableContainer } from '../client/components/ui/standard-table';
249
+ import { StandardTableContent } from '../client/components/ui/standard-table';
250
+ import { StandardTableHeader } from '../client/components/ui/standard-table';
251
+ import { StandardTableHeaderRow } from '../client/components/ui/standard-table';
252
+ import { StandardTableListRow } from '../client/components/ui/standard-table';
253
+ import { StandardTableRow } from '../client/components/ui/standard-table';
254
+ import { StandardTableTrigger } from '../client/components/ui/standard-table';
241
255
  import { Switch } from '../client/components/ui/switch';
242
256
  import { Tab } from '../client/hooks/use-tabs';
243
257
  import { Table } from '../client/components/ui/table';
@@ -648,6 +662,18 @@ export { NavLogo }
648
662
 
649
663
  export { Option_2 as Option }
650
664
 
665
+ export { PageHeader }
666
+
667
+ export { PageHeaderBadge }
668
+
669
+ export { PageHeaderDescription }
670
+
671
+ export { PageHeaderLeftContent }
672
+
673
+ export { PageHeaderTitle }
674
+
675
+ export { PageHeaderTopSection }
676
+
651
677
  export { Pagination }
652
678
 
653
679
  export { PaginationContent }
@@ -784,6 +810,22 @@ export { StandardLogo }
784
810
 
785
811
  export { StandardNavigation }
786
812
 
813
+ export { StandardTable }
814
+
815
+ export { StandardTableContainer }
816
+
817
+ export { StandardTableContent }
818
+
819
+ export { StandardTableHeader }
820
+
821
+ export { StandardTableHeaderRow }
822
+
823
+ export { StandardTableListRow }
824
+
825
+ export { StandardTableRow }
826
+
827
+ export { StandardTableTrigger }
828
+
787
829
  export { Switch }
788
830
 
789
831
  export { Tab }
package/dist/index.es.js CHANGED
@@ -4629,6 +4629,363 @@ const CodeBadge = ({ code, className, style }) => {
4629
4629
  }
4630
4630
  );
4631
4631
  };
4632
+ const PageHeader = React.forwardRef(
4633
+ ({ children, className, ...props }, ref) => {
4634
+ return /* @__PURE__ */ jsx("header", { ref, className: cn("page-header", className), ...props, children });
4635
+ }
4636
+ );
4637
+ PageHeader.displayName = "PageHeader";
4638
+ const PageHeaderTopSection = React.forwardRef(({ children, className, ...props }, ref) => {
4639
+ return /* @__PURE__ */ jsx(
4640
+ "div",
4641
+ {
4642
+ ref,
4643
+ className: cn("page-header-top-section", className),
4644
+ ...props,
4645
+ children
4646
+ }
4647
+ );
4648
+ });
4649
+ PageHeaderTopSection.displayName = "PageHeaderTopSection";
4650
+ const PageHeaderLeftContent = React.forwardRef(({ children, className, ...props }, ref) => {
4651
+ return /* @__PURE__ */ jsx(
4652
+ "div",
4653
+ {
4654
+ ref,
4655
+ className: cn("page-header-left-content", className),
4656
+ ...props,
4657
+ children
4658
+ }
4659
+ );
4660
+ });
4661
+ PageHeaderLeftContent.displayName = "PageHeaderLeftContent";
4662
+ const PageHeaderBadge = React.forwardRef(
4663
+ ({ children, animated = false, show = true, className, style, ...props }, ref) => {
4664
+ if (animated) {
4665
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: show && /* @__PURE__ */ jsx(
4666
+ motion.div,
4667
+ {
4668
+ initial: { opacity: 0, scale: 0.8 },
4669
+ animate: { opacity: 1, scale: 1 },
4670
+ exit: { opacity: 0, scale: 0.8 },
4671
+ transition: { duration: 0.2 },
4672
+ className,
4673
+ style,
4674
+ children
4675
+ }
4676
+ ) });
4677
+ }
4678
+ if (!show) return null;
4679
+ return /* @__PURE__ */ jsx("div", { ref, className, style, ...props, children });
4680
+ }
4681
+ );
4682
+ PageHeaderBadge.displayName = "PageHeaderBadge";
4683
+ const PageHeaderTitle = React.forwardRef(({ children, className, ...props }, ref) => {
4684
+ return /* @__PURE__ */ jsx("h1", { ref, className: cn("page-header-title", className), ...props, children });
4685
+ });
4686
+ PageHeaderTitle.displayName = "PageHeaderTitle";
4687
+ const PageHeaderDescription = React.forwardRef(({ children, className, ...props }, ref) => {
4688
+ return /* @__PURE__ */ jsx(
4689
+ "p",
4690
+ {
4691
+ ref,
4692
+ className: cn("page-header-description", className),
4693
+ ...props,
4694
+ children
4695
+ }
4696
+ );
4697
+ });
4698
+ PageHeaderDescription.displayName = "PageHeaderDescription";
4699
+ const StandardTableContext = React.createContext(null);
4700
+ const StandardTableRowContext = React.createContext(null);
4701
+ function useStandardTable() {
4702
+ const context = React.useContext(StandardTableContext);
4703
+ if (!context) {
4704
+ throw new Error(
4705
+ "StandardTable components must be used within <StandardTable>"
4706
+ );
4707
+ }
4708
+ return context;
4709
+ }
4710
+ function useStandardTableRow() {
4711
+ const context = React.useContext(StandardTableRowContext);
4712
+ if (!context) {
4713
+ throw new Error(
4714
+ "StandardTableTrigger and StandardTableContent must be used within <StandardTableRow>"
4715
+ );
4716
+ }
4717
+ return context;
4718
+ }
4719
+ const StandardTable = React.forwardRef(
4720
+ ({
4721
+ allowMultiple = false,
4722
+ defaultExpanded,
4723
+ expandedValues: controlledExpandedValues,
4724
+ onExpandedChange,
4725
+ children,
4726
+ className,
4727
+ ...props
4728
+ }, ref) => {
4729
+ const getInitialExpanded = () => {
4730
+ if (!defaultExpanded) return /* @__PURE__ */ new Set();
4731
+ if (Array.isArray(defaultExpanded)) return new Set(defaultExpanded);
4732
+ return /* @__PURE__ */ new Set([defaultExpanded]);
4733
+ };
4734
+ const [uncontrolledExpandedValues, setUncontrolledExpandedValues] = React.useState(getInitialExpanded);
4735
+ const [isAllExpanded, setIsAllExpanded] = React.useState(false);
4736
+ const isControlled = controlledExpandedValues !== void 0;
4737
+ const expandedValues = isControlled ? controlledExpandedValues : uncontrolledExpandedValues;
4738
+ const hasAnyExpanded = React.useMemo(
4739
+ () => isAllExpanded || expandedValues.size > 0,
4740
+ [isAllExpanded, expandedValues]
4741
+ );
4742
+ const isExpanded = React.useCallback(
4743
+ (value) => isAllExpanded || expandedValues.has(value),
4744
+ [isAllExpanded, expandedValues]
4745
+ );
4746
+ const toggle = React.useCallback(
4747
+ (value) => {
4748
+ const newValues = new Set(expandedValues);
4749
+ if (newValues.has(value)) {
4750
+ newValues.delete(value);
4751
+ } else {
4752
+ if (!allowMultiple) {
4753
+ newValues.clear();
4754
+ }
4755
+ newValues.add(value);
4756
+ }
4757
+ if (!isControlled) {
4758
+ setUncontrolledExpandedValues(newValues);
4759
+ }
4760
+ onExpandedChange == null ? void 0 : onExpandedChange(newValues);
4761
+ setIsAllExpanded(false);
4762
+ },
4763
+ [allowMultiple, expandedValues, isControlled, onExpandedChange]
4764
+ );
4765
+ const expandAll = React.useCallback(() => {
4766
+ setIsAllExpanded(true);
4767
+ const emptySet = /* @__PURE__ */ new Set();
4768
+ if (!isControlled) {
4769
+ setUncontrolledExpandedValues(emptySet);
4770
+ }
4771
+ onExpandedChange == null ? void 0 : onExpandedChange(emptySet);
4772
+ }, [isControlled, onExpandedChange]);
4773
+ const collapseAll = React.useCallback(() => {
4774
+ setIsAllExpanded(false);
4775
+ const emptySet = /* @__PURE__ */ new Set();
4776
+ if (!isControlled) {
4777
+ setUncontrolledExpandedValues(emptySet);
4778
+ }
4779
+ onExpandedChange == null ? void 0 : onExpandedChange(emptySet);
4780
+ }, [isControlled, onExpandedChange]);
4781
+ const contextValue = React.useMemo(
4782
+ () => ({
4783
+ expandedValues,
4784
+ isExpanded,
4785
+ toggle,
4786
+ expandAll,
4787
+ collapseAll,
4788
+ hasAnyExpanded,
4789
+ allowMultiple
4790
+ }),
4791
+ [
4792
+ expandedValues,
4793
+ isExpanded,
4794
+ toggle,
4795
+ expandAll,
4796
+ collapseAll,
4797
+ hasAnyExpanded,
4798
+ allowMultiple
4799
+ ]
4800
+ );
4801
+ return /* @__PURE__ */ jsx(StandardTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
4802
+ "div",
4803
+ {
4804
+ ref,
4805
+ className: cn(
4806
+ "border border-blue-200 rounded-xl overflow-hidden",
4807
+ className
4808
+ ),
4809
+ ...props,
4810
+ children
4811
+ }
4812
+ ) });
4813
+ }
4814
+ );
4815
+ StandardTable.displayName = "StandardTable";
4816
+ const StandardTableHeader = React.forwardRef(({ title, hasExpanded, onToggleAll, className }, ref) => {
4817
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("standard-table-header", className), children: [
4818
+ /* @__PURE__ */ jsx("h2", { className: "standard-table-header__title body-large", children: title }),
4819
+ onToggleAll && /* @__PURE__ */ jsx(
4820
+ motion.div,
4821
+ {
4822
+ animate: { rotate: hasExpanded ? 180 : 0 },
4823
+ transition: { duration: 0.2 },
4824
+ className: "mx-6",
4825
+ children: /* @__PURE__ */ jsx(Button, { size: "icon", onClick: onToggleAll, children: /* @__PURE__ */ jsx(UtilityChevronDown, {}) })
4826
+ }
4827
+ )
4828
+ ] });
4829
+ });
4830
+ StandardTableHeader.displayName = "StandardTableHeader";
4831
+ const StandardTableHeaderRow = React.forwardRef(({ title, className }, ref) => {
4832
+ const { hasAnyExpanded, expandAll, collapseAll } = useStandardTable();
4833
+ const handleToggleAll = React.useCallback(() => {
4834
+ if (hasAnyExpanded) {
4835
+ collapseAll();
4836
+ } else {
4837
+ expandAll();
4838
+ }
4839
+ }, [hasAnyExpanded, collapseAll, expandAll]);
4840
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("standard-table-header", className), children: [
4841
+ /* @__PURE__ */ jsx("h2", { className: "standard-table-header__title body-large", children: title }),
4842
+ /* @__PURE__ */ jsx(
4843
+ motion.div,
4844
+ {
4845
+ animate: { rotate: hasAnyExpanded ? 180 : 0 },
4846
+ transition: { duration: 0.2 },
4847
+ style: { willChange: "transform" },
4848
+ children: /* @__PURE__ */ jsx(Button, { size: "icon", onClick: handleToggleAll, children: /* @__PURE__ */ jsx(UtilityChevronDown, {}) })
4849
+ }
4850
+ )
4851
+ ] });
4852
+ });
4853
+ StandardTableHeaderRow.displayName = "StandardTableHeaderRow";
4854
+ const StandardTableRow = React.forwardRef(({ value, children, className, ...props }, ref) => {
4855
+ const { isExpanded: isExpandedFn } = useStandardTable();
4856
+ const isExpanded = isExpandedFn(value);
4857
+ const rowContextValue = React.useMemo(
4858
+ () => ({ value, isExpanded }),
4859
+ [value, isExpanded]
4860
+ );
4861
+ return /* @__PURE__ */ jsx(StandardTableRowContext.Provider, { value: rowContextValue, children: /* @__PURE__ */ jsx("div", { ref, className: cn("standard-table-row", className), ...props, children }) });
4862
+ });
4863
+ StandardTableRow.displayName = "StandardTableRow";
4864
+ const StandardTableRowHeader = React.forwardRef(({ children, className, onClick, ...props }, ref) => {
4865
+ return /* @__PURE__ */ jsx(
4866
+ "div",
4867
+ {
4868
+ ref,
4869
+ onClick,
4870
+ className: cn("standard-table-row-header", className),
4871
+ ...props,
4872
+ children
4873
+ }
4874
+ );
4875
+ });
4876
+ StandardTableRowHeader.displayName = "StandardTableRowHeader";
4877
+ const StandardTableTrigger = React.forwardRef(({ className, onClick, ...props }, ref) => {
4878
+ const { toggle } = useStandardTable();
4879
+ const { value, isExpanded } = useStandardTableRow();
4880
+ const handleClick = React.useCallback(
4881
+ (e) => {
4882
+ e.stopPropagation();
4883
+ toggle(value);
4884
+ onClick == null ? void 0 : onClick(e);
4885
+ },
4886
+ [toggle, value, onClick]
4887
+ );
4888
+ return /* @__PURE__ */ jsx(
4889
+ motion.div,
4890
+ {
4891
+ animate: { rotate: isExpanded ? 180 : 0 },
4892
+ transition: { duration: 0.2 },
4893
+ style: { willChange: "transform" },
4894
+ children: /* @__PURE__ */ jsx(
4895
+ Button,
4896
+ {
4897
+ ref,
4898
+ size: "icon",
4899
+ variant: "clear",
4900
+ onClick: handleClick,
4901
+ className: cn("standard-table-trigger", className),
4902
+ ...props,
4903
+ children: /* @__PURE__ */ jsx(UtilityChevronDown, {})
4904
+ }
4905
+ )
4906
+ }
4907
+ );
4908
+ });
4909
+ StandardTableTrigger.displayName = "StandardTableTrigger";
4910
+ const StandardTableContent = React.forwardRef(({ children, className, ...props }, ref) => {
4911
+ const { isExpanded } = useStandardTableRow();
4912
+ return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isExpanded && /* @__PURE__ */ jsx(
4913
+ motion.div,
4914
+ {
4915
+ initial: { height: 0, opacity: 0 },
4916
+ animate: { height: "auto", opacity: 1 },
4917
+ exit: { height: 0, opacity: 0 },
4918
+ transition: { duration: 0.3, ease: [0.25, 0.46, 0.45, 0.94] },
4919
+ className: cn("standard-table-content", className),
4920
+ style: { willChange: "opacity" },
4921
+ children: /* @__PURE__ */ jsx(
4922
+ "div",
4923
+ {
4924
+ ref,
4925
+ className: "standard-table-content__inner",
4926
+ ...props,
4927
+ children
4928
+ }
4929
+ )
4930
+ }
4931
+ ) });
4932
+ });
4933
+ StandardTableContent.displayName = "StandardTableContent";
4934
+ const StandardTableListRow = React.forwardRef(
4935
+ ({
4936
+ icon,
4937
+ badge,
4938
+ title,
4939
+ titleClassName,
4940
+ rightContent,
4941
+ onClick,
4942
+ className,
4943
+ variant: variant2 = "default",
4944
+ ...props
4945
+ }, ref) => {
4946
+ return /* @__PURE__ */ jsxs(
4947
+ "div",
4948
+ {
4949
+ ref,
4950
+ onClick,
4951
+ className: cn(
4952
+ "standard-table-list-row",
4953
+ variant2 === "default" ? "standard-table-list-row--default" : "standard-table-list-row--nested",
4954
+ className
4955
+ ),
4956
+ ...props,
4957
+ children: [
4958
+ icon,
4959
+ badge,
4960
+ /* @__PURE__ */ jsx(
4961
+ "span",
4962
+ {
4963
+ className: cn(
4964
+ "standard-table-list-row__title",
4965
+ titleClassName || "body-large"
4966
+ ),
4967
+ children: title
4968
+ }
4969
+ ),
4970
+ rightContent
4971
+ ]
4972
+ }
4973
+ );
4974
+ }
4975
+ );
4976
+ StandardTableListRow.displayName = "StandardTableListRow";
4977
+ const StandardTableContainer = React.forwardRef(({ children, className, ...props }, ref) => {
4978
+ return /* @__PURE__ */ jsx(
4979
+ "section",
4980
+ {
4981
+ ref,
4982
+ className: cn("standard-table-container", className),
4983
+ ...props,
4984
+ children
4985
+ }
4986
+ );
4987
+ });
4988
+ StandardTableContainer.displayName = "StandardTableContainer";
4632
4989
  const Toaster = ({ ...props }) => {
4633
4990
  const { theme = "system" } = useTheme();
4634
4991
  return /* @__PURE__ */ jsx(
@@ -9597,6 +9954,12 @@ export {
9597
9954
  NavigationMenuLink,
9598
9955
  NavigationMenuList,
9599
9956
  NavigationMenuTrigger,
9957
+ PageHeader,
9958
+ PageHeaderBadge,
9959
+ PageHeaderDescription,
9960
+ PageHeaderLeftContent,
9961
+ PageHeaderTitle,
9962
+ PageHeaderTopSection,
9600
9963
  Pagination,
9601
9964
  PaginationContent,
9602
9965
  PaginationEllipsis,
@@ -9665,6 +10028,14 @@ export {
9665
10028
  Toaster as Sonner,
9666
10029
  StandardLogo,
9667
10030
  StandardNavigation,
10031
+ StandardTable,
10032
+ StandardTableContainer,
10033
+ StandardTableContent,
10034
+ StandardTableHeader,
10035
+ StandardTableHeaderRow,
10036
+ StandardTableListRow,
10037
+ StandardTableRow,
10038
+ StandardTableTrigger,
9668
10039
  Switch,
9669
10040
  Table,
9670
10041
  TableBody,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syscore/ui-library",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "A comprehensive React component library built with Radix UI, Tailwind CSS, and TypeScript",
5
5
  "private": false,
6
6
  "type": "module",