@grandbazar/ui-baza 1.1.4 → 1.2.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
@@ -20,6 +20,27 @@ function classNames(...classes) {
20
20
  return classes.filter(Boolean).join(" ");
21
21
  }
22
22
 
23
+ function composeEventHandlers(childHandler, parentHandler) {
24
+ return (event) => {
25
+ childHandler?.(event);
26
+ if (!event.defaultPrevented) {
27
+ parentHandler?.(event);
28
+ }
29
+ };
30
+ }
31
+
32
+ function composeRefs(...refs) {
33
+ return (node) => {
34
+ for (const ref of refs) {
35
+ if (typeof ref === "function") {
36
+ ref(node);
37
+ } else if (ref != null) {
38
+ ref.current = node;
39
+ }
40
+ }
41
+ };
42
+ }
43
+
23
44
  function createRange(start, length) {
24
45
  return Array.from({ length }, (_, index) => start + index);
25
46
  }
@@ -27,38 +48,38 @@ function createRange(start, length) {
27
48
  const badge = "_badge_p5h5n_2";
28
49
  const primary$3 = "_primary_p5h5n_9";
29
50
  const secondary$4 = "_secondary_p5h5n_13";
30
- const accent$2 = "_accent_p5h5n_18";
51
+ const accent$3 = "_accent_p5h5n_18";
31
52
  const violet = "_violet_p5h5n_23";
32
53
  const pink = "_pink_p5h5n_28";
33
54
  const red$1 = "_red_p5h5n_33";
34
55
  const orange = "_orange_p5h5n_38";
35
56
  const green = "_green_p5h5n_43";
36
- const neutral$2 = "_neutral_p5h5n_48";
37
- const lg$5 = "_lg_p5h5n_53";
38
- const md$8 = "_md_p5h5n_60";
39
- const styles$t = {
57
+ const neutral$3 = "_neutral_p5h5n_48";
58
+ const lg$6 = "_lg_p5h5n_53";
59
+ const md$9 = "_md_p5h5n_60";
60
+ const styles$u = {
40
61
  badge: badge,
41
62
  primary: primary$3,
42
63
  secondary: secondary$4,
43
- accent: accent$2,
64
+ accent: accent$3,
44
65
  violet: violet,
45
66
  pink: pink,
46
67
  red: red$1,
47
68
  orange: orange,
48
69
  green: green,
49
- neutral: neutral$2,
50
- lg: lg$5,
51
- md: md$8
70
+ neutral: neutral$3,
71
+ lg: lg$6,
72
+ md: md$9
52
73
  };
53
74
 
54
75
  function Badge({ children, className, size = "lg", color = "accent", mode = "primary", ...props }) {
55
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames(styles$t.badge, styles$t[size], styles$t[color], styles$t[mode], className), ...props, children });
76
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames(styles$u.badge, styles$u[size], styles$u[color], styles$u[mode], className), ...props, children });
56
77
  }
57
78
 
58
79
  const badgeTabsItem = "_badgeTabsItem_10lit_2";
59
80
  const primary$2 = "_primary_10lit_18";
60
81
  const secondary$3 = "_secondary_10lit_36";
61
- const styles$s = {
82
+ const styles$t = {
62
83
  badgeTabsItem: badgeTabsItem,
63
84
  primary: primary$2,
64
85
  secondary: secondary$3
@@ -71,7 +92,7 @@ function BadgeTabsItem({ className, children, isActive, mode = "primary", ...pro
71
92
  type: "button",
72
93
  role: "tab",
73
94
  "aria-selected": Boolean(isActive),
74
- className: classNames(styles$s.badgeTabsItem, styles$s[mode], className),
95
+ className: classNames(styles$t.badgeTabsItem, styles$t[mode], className),
75
96
  ...props,
76
97
  children
77
98
  }
@@ -79,12 +100,12 @@ function BadgeTabsItem({ className, children, isActive, mode = "primary", ...pro
79
100
  }
80
101
 
81
102
  const badgeTabsRoot = "_badgeTabsRoot_1qkat_2";
82
- const styles$r = {
103
+ const styles$s = {
83
104
  badgeTabsRoot: badgeTabsRoot
84
105
  };
85
106
 
86
107
  function BadgeTabsRoot({ className, children, ...props }) {
87
- return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tablist", className: classNames(styles$r.badgeTabsRoot, className), ...props, children });
108
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tablist", className: classNames(styles$s.badgeTabsRoot, className), ...props, children });
88
109
  }
89
110
 
90
111
  function BadgeTabs(props) {
@@ -598,38 +619,56 @@ function IconYandex(props) {
598
619
  const breadcrumbs = "_breadcrumbs_1bfmb_2";
599
620
  const breadcrumbsItem = "_breadcrumbsItem_1bfmb_8";
600
621
  const defaultSeparator = "_defaultSeparator_1bfmb_14";
601
- const styles$q = {
622
+ const styles$r = {
602
623
  breadcrumbs: breadcrumbs,
603
624
  breadcrumbsItem: breadcrumbsItem,
604
625
  defaultSeparator: defaultSeparator
605
626
  };
606
627
 
628
+ function isEventHandler(key) {
629
+ return /^on[A-Z]/.test(key);
630
+ }
631
+
607
632
  function Slot({
608
633
  children,
634
+ ref,
609
635
  ...props
610
636
  }) {
611
637
  if (React.isValidElement(children)) {
612
638
  const childProps = children.props;
613
- const parentProps = props;
614
- const mergedProps = {
615
- ...childProps,
616
- ...parentProps,
617
- style: {
618
- ...childProps.style,
619
- ...parentProps.style
620
- },
621
- className: classNames(childProps.className, parentProps.className)
622
- };
639
+ const mergedProps = { ...childProps };
640
+ for (const key of Object.keys(props)) {
641
+ const parentValue = props[key];
642
+ const childValue = childProps[key];
643
+ if (key === "style") {
644
+ mergedProps.style = {
645
+ ...childValue,
646
+ ...parentValue
647
+ };
648
+ } else if (key === "className") {
649
+ mergedProps.className = classNames(childValue, parentValue);
650
+ } else if (isEventHandler(key) && typeof childValue === "function") {
651
+ mergedProps[key] = composeEventHandlers(
652
+ childValue,
653
+ parentValue
654
+ );
655
+ } else {
656
+ mergedProps[key] = parentValue;
657
+ }
658
+ }
659
+ if (ref) {
660
+ mergedProps.ref = composeRefs(childProps.ref, ref);
661
+ }
623
662
  return React.cloneElement(children, mergedProps);
624
663
  }
625
664
  if (React.Children.count(children) > 1) {
626
- React.Children.only(null);
665
+ throw new Error("Slot expects a single child element");
627
666
  }
628
667
  return null;
629
668
  }
630
669
 
631
670
  const breadcrumbItem = "_breadcrumbItem_cua4v_2";
632
- const styles$p = {
671
+ const styles$q = {
633
672
  breadcrumbItem: breadcrumbItem
634
673
  };
635
674
 
@@ -640,7 +679,7 @@ function BreadcrumbItem({ children, className, isActive, asChild, ...props }) {
640
679
  {
641
680
  "data-active": isActive,
642
681
  "data-disabled": props.disabled,
643
- className: classNames(styles$p.breadcrumbItem, className),
682
+ className: classNames(styles$q.breadcrumbItem, className),
644
683
  ...isActive && { "aria-current": "page" },
645
684
  ...!asChild && { type: "button" },
646
685
  ...props,
@@ -652,52 +691,95 @@ function BreadcrumbItem({ children, className, isActive, asChild, ...props }) {
652
691
  function Breadcrumbs({
653
692
  className,
654
693
  children,
655
- separator = /* @__PURE__ */ jsxRuntime.jsx(IconChevron, { className: styles$q.defaultSeparator })
694
+ separator = /* @__PURE__ */ jsxRuntime.jsx(IconChevron, { className: styles$r.defaultSeparator })
656
695
  }) {
657
696
  const childrenArray = Array.isArray(children) ? children : [children];
658
697
  const lastIndex = childrenArray.length - 1;
659
- return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "breadcrumb", className, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: styles$q.breadcrumbs, children: childrenArray.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
660
- /* @__PURE__ */ jsxRuntime.jsx("li", { className: styles$q.breadcrumbsItem, children: item }),
661
- index < lastIndex && /* @__PURE__ */ jsxRuntime.jsx("li", { className: styles$q.breadcrumbsItem, "aria-hidden": "true", children: separator })
698
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": "breadcrumb", className, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: styles$r.breadcrumbs, children: childrenArray.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
699
+ /* @__PURE__ */ jsxRuntime.jsx("li", { className: styles$r.breadcrumbsItem, children: item }),
700
+ index < lastIndex && /* @__PURE__ */ jsxRuntime.jsx("li", { className: styles$r.breadcrumbsItem, "aria-hidden": "true", children: separator })
662
701
  ] }, index)) }) });
663
702
  }
664
703
  Breadcrumbs.Item = BreadcrumbItem;
665
704
 
666
705
  const button = "_button_cmbkj_2";
667
- const accent$1 = "_accent_cmbkj_11";
706
+ const accent$2 = "_accent_cmbkj_11";
668
707
  const primary$1 = "_primary_cmbkj_12";
669
708
  const secondary$2 = "_secondary_cmbkj_30";
670
709
  const tertiary = "_tertiary_cmbkj_48";
671
710
  const line = "_line_cmbkj_49";
672
- const neutral$1 = "_neutral_cmbkj_78";
673
- const lg$4 = "_lg_cmbkj_145";
674
- const md$7 = "_md_cmbkj_153";
711
+ const neutral$2 = "_neutral_cmbkj_78";
712
+ const lg$5 = "_lg_cmbkj_145";
713
+ const md$8 = "_md_cmbkj_153";
675
714
  const sm$3 = "_sm_cmbkj_161";
676
- const styles$o = {
715
+ const styles$p = {
677
716
  button: button,
678
- accent: accent$1,
717
+ accent: accent$2,
679
718
  primary: primary$1,
680
719
  secondary: secondary$2,
681
720
  tertiary: tertiary,
682
721
  line: line,
722
+ neutral: neutral$2,
723
+ lg: lg$5,
724
+ md: md$8,
725
+ sm: sm$3
726
+ };
727
+
728
+ const buttonFunction = "_buttonFunction_o8iku_2";
729
+ const accent$1 = "_accent_o8iku_10";
730
+ const neutral$1 = "_neutral_o8iku_22";
731
+ const lg$4 = "_lg_o8iku_41";
732
+ const md$7 = "_md_o8iku_46";
733
+ const styles$o = {
734
+ buttonFunction: buttonFunction,
735
+ accent: accent$1,
683
736
  neutral: neutral$1,
684
737
  lg: lg$4,
685
- md: md$7,
686
- sm: sm$3
738
+ md: md$7
687
739
  };
688
740
 
741
+ function ButtonFunction({
742
+ children,
743
+ className,
744
+ color = "accent",
745
+ size = "lg",
746
+ asChild,
747
+ ...props
748
+ }) {
749
+ const Component = asChild ? Slot : "button";
750
+ return /* @__PURE__ */ jsxRuntime.jsx(
751
+ Component,
752
+ {
753
+ className: classNames(styles$o.buttonFunction, styles$o[color], styles$o[size], className),
754
+ ...props.disabled && { "data-disabled": true },
755
+ ...!asChild && { type: "button" },
756
+ ...props,
757
+ children
758
+ }
759
+ );
760
+ }
761
+
689
762
  function Button({
690
763
  children,
691
764
  className,
692
765
  color = "accent",
693
766
  size = "lg",
694
767
  mode = "primary",
695
- as = "button",
768
+ asChild,
696
769
  ...props
697
770
  }) {
698
- const commonClassNames = classNames(styles$o.button, styles$o[color], styles$o[size], styles$o[mode], className);
699
- return as === "button" ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: commonClassNames, type: "button", ...props, children }) : /* @__PURE__ */ jsxRuntime.jsx("a", { className: commonClassNames, ...props, children });
771
+ const Component = asChild ? Slot : "button";
772
+ return /* @__PURE__ */ jsxRuntime.jsx(
773
+ Component,
774
+ {
775
+ className: classNames(styles$p.button, styles$p[color], styles$p[size], styles$p[mode], className),
776
+ ...!asChild && { type: "button" },
777
+ ...props,
778
+ children
779
+ }
780
+ );
700
781
  }
782
+ Button.Function = ButtonFunction;
701
783
 
702
784
  const checkboxWrapper = "_checkboxWrapper_k1shg_2";
703
785
  const icon$2 = "_icon_k1shg_23";
package/dist/index.d.ts CHANGED
@@ -70,25 +70,31 @@ export declare namespace Breadcrumbs {
70
70
  }
71
71
 
72
72
  /**
73
- * Button renders a clickable button or anchor element with various styles.
74
- * Supports polymorphic rendering as either a button or anchor based on the 'as' prop.
73
+ * Button renders a clickable button element with various styles.
74
+ * Supports the asChild pattern for polymorphic rendering via Slot.
75
75
  *
76
76
  * @param color - Color variant of the button (accent, neutral)
77
77
  * @param size - Size of the button (lg, md, sm)
78
78
  * @param mode - Visual mode of the button (primary, secondary, tertiary, line)
79
- * @param as - Element type to render (button, a)
79
+ * @param asChild - When true, merges props onto the child element instead of rendering a button
80
80
  * @param children - Content to display inside the button
81
81
  */
82
- export declare function Button(props: TButtonAsButtonProps): React.JSX.Element;
82
+ export declare function Button({ children, className, color, size, mode, asChild, ...props }: TButtonProps): JSX.Element;
83
83
 
84
- export declare function Button(props: TButtonAsAnchorProps): React.JSX.Element;
84
+ export declare namespace Button {
85
+ var Function: typeof ButtonFunction;
86
+ }
85
87
 
86
88
  declare const BUTTON_COLORS: readonly ["accent", "neutral"];
87
89
 
90
+ declare const BUTTON_FUNCTION_SIZES: readonly ["lg", "md"];
91
+
88
92
  declare const BUTTON_MODES: readonly ["primary", "secondary", "line", "tertiary"];
89
93
 
90
94
  declare const BUTTON_SIZES: readonly ["lg", "md", "sm"];
91
95
 
96
+ declare function ButtonFunction({ children, className, color, size, asChild, ...props }: TButtonFunctionProps): JSX.Element;
97
+
92
98
  /**
93
99
  * Checkbox renders a checkbox input with label and state indicators.
94
100
  * Supports checked, unchecked, and indeterminate states with visual feedback.
@@ -499,23 +505,21 @@ declare type TBreadcrumbsProps = {
499
505
  separator?: default_2.ReactNode;
500
506
  };
501
507
 
502
- export declare type TButtonAsAnchorProps = TButtonCommonProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
503
- as: 'a';
504
- ref?: React.Ref<HTMLAnchorElement> | null;
505
- };
506
-
507
- export declare type TButtonAsButtonProps = TButtonCommonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
508
- as?: 'button';
509
- ref?: React.Ref<HTMLButtonElement> | null;
510
- };
511
-
512
508
  declare type TButtonCommonProps = {
513
509
  color?: TArrayElement<typeof BUTTON_COLORS>;
514
510
  size?: TArrayElement<typeof BUTTON_SIZES>;
515
511
  mode?: TArrayElement<typeof BUTTON_MODES>;
512
+ className?: string;
513
+ };
514
+
515
+ declare type TButtonFunctionProps = TAsChildProps<React.ButtonHTMLAttributes<HTMLButtonElement>> & {
516
+ color?: TArrayElement<typeof BUTTON_COLORS>;
517
+ size?: TArrayElement<typeof BUTTON_FUNCTION_SIZES>;
518
+ className?: string;
519
+ disabled?: boolean;
516
520
  };
517
521
 
518
- export declare type TButtonProps = TButtonAsButtonProps | TButtonAsAnchorProps;
522
+ export declare type TButtonProps = TAsChildProps<React.ButtonHTMLAttributes<HTMLButtonElement>> & TButtonCommonProps;
519
523
 
520
524
  export declare type TCalendarDay = {
521
525
  date: number;
package/dist/index.js CHANGED
@@ -16,6 +16,27 @@ function classNames(...classes) {
16
16
  return classes.filter(Boolean).join(" ");
17
17
  }
18
18
 
19
+ function composeEventHandlers(childHandler, parentHandler) {
20
+ return (event) => {
21
+ childHandler?.(event);
22
+ if (!event.defaultPrevented) {
23
+ parentHandler?.(event);
24
+ }
25
+ };
26
+ }
27
+
28
+ function composeRefs(...refs) {
29
+ return (node) => {
30
+ for (const ref of refs) {
31
+ if (typeof ref === "function") {
32
+ ref(node);
33
+ } else if (ref != null) {
34
+ ref.current = node;
35
+ }
36
+ }
37
+ };
38
+ }
39
+
19
40
  function createRange(start, length) {
20
41
  return Array.from({ length }, (_, index) => start + index);
21
42
  }
@@ -23,38 +44,38 @@ function createRange(start, length) {
23
44
  const badge = "_badge_p5h5n_2";
24
45
  const primary$3 = "_primary_p5h5n_9";
25
46
  const secondary$4 = "_secondary_p5h5n_13";
26
- const accent$2 = "_accent_p5h5n_18";
47
+ const accent$3 = "_accent_p5h5n_18";
27
48
  const violet = "_violet_p5h5n_23";
28
49
  const pink = "_pink_p5h5n_28";
29
50
  const red$1 = "_red_p5h5n_33";
30
51
  const orange = "_orange_p5h5n_38";
31
52
  const green = "_green_p5h5n_43";
32
- const neutral$2 = "_neutral_p5h5n_48";
33
- const lg$5 = "_lg_p5h5n_53";
34
- const md$8 = "_md_p5h5n_60";
35
- const styles$t = {
53
+ const neutral$3 = "_neutral_p5h5n_48";
54
+ const lg$6 = "_lg_p5h5n_53";
55
+ const md$9 = "_md_p5h5n_60";
56
+ const styles$u = {
36
57
  badge: badge,
37
58
  primary: primary$3,
38
59
  secondary: secondary$4,
39
- accent: accent$2,
60
+ accent: accent$3,
40
61
  violet: violet,
41
62
  pink: pink,
42
63
  red: red$1,
43
64
  orange: orange,
44
65
  green: green,
45
- neutral: neutral$2,
46
- lg: lg$5,
47
- md: md$8
66
+ neutral: neutral$3,
67
+ lg: lg$6,
68
+ md: md$9
48
69
  };
49
70
 
50
71
  function Badge({ children, className, size = "lg", color = "accent", mode = "primary", ...props }) {
51
- return /* @__PURE__ */ jsx("div", { className: classNames(styles$t.badge, styles$t[size], styles$t[color], styles$t[mode], className), ...props, children });
72
+ return /* @__PURE__ */ jsx("div", { className: classNames(styles$u.badge, styles$u[size], styles$u[color], styles$u[mode], className), ...props, children });
52
73
  }
53
74
 
54
75
  const badgeTabsItem = "_badgeTabsItem_10lit_2";
55
76
  const primary$2 = "_primary_10lit_18";
56
77
  const secondary$3 = "_secondary_10lit_36";
57
- const styles$s = {
78
+ const styles$t = {
58
79
  badgeTabsItem: badgeTabsItem,
59
80
  primary: primary$2,
60
81
  secondary: secondary$3
@@ -67,7 +88,7 @@ function BadgeTabsItem({ className, children, isActive, mode = "primary", ...pro
67
88
  type: "button",
68
89
  role: "tab",
69
90
  "aria-selected": Boolean(isActive),
70
- className: classNames(styles$s.badgeTabsItem, styles$s[mode], className),
91
+ className: classNames(styles$t.badgeTabsItem, styles$t[mode], className),
71
92
  ...props,
72
93
  children
73
94
  }
@@ -75,12 +96,12 @@ function BadgeTabsItem({ className, children, isActive, mode = "primary", ...pro
75
96
  }
76
97
 
77
98
  const badgeTabsRoot = "_badgeTabsRoot_1qkat_2";
78
- const styles$r = {
99
+ const styles$s = {
79
100
  badgeTabsRoot: badgeTabsRoot
80
101
  };
81
102
 
82
103
  function BadgeTabsRoot({ className, children, ...props }) {
83
- return /* @__PURE__ */ jsx("div", { role: "tablist", className: classNames(styles$r.badgeTabsRoot, className), ...props, children });
104
+ return /* @__PURE__ */ jsx("div", { role: "tablist", className: classNames(styles$s.badgeTabsRoot, className), ...props, children });
84
105
  }
85
106
 
86
107
  function BadgeTabs(props) {
@@ -594,38 +615,56 @@ function IconYandex(props) {
594
615
  const breadcrumbs = "_breadcrumbs_1bfmb_2";
595
616
  const breadcrumbsItem = "_breadcrumbsItem_1bfmb_8";
596
617
  const defaultSeparator = "_defaultSeparator_1bfmb_14";
597
- const styles$q = {
618
+ const styles$r = {
598
619
  breadcrumbs: breadcrumbs,
599
620
  breadcrumbsItem: breadcrumbsItem,
600
621
  defaultSeparator: defaultSeparator
601
622
  };
602
623
 
624
+ function isEventHandler(key) {
625
+ return /^on[A-Z]/.test(key);
626
+ }
627
+
603
628
  function Slot({
604
629
  children,
630
+ ref,
605
631
  ...props
606
632
  }) {
607
633
  if (isValidElement(children)) {
608
634
  const childProps = children.props;
609
- const parentProps = props;
610
- const mergedProps = {
611
- ...childProps,
612
- ...parentProps,
613
- style: {
614
- ...childProps.style,
615
- ...parentProps.style
616
- },
617
- className: classNames(childProps.className, parentProps.className)
618
- };
635
+ const mergedProps = { ...childProps };
636
+ for (const key of Object.keys(props)) {
637
+ const parentValue = props[key];
638
+ const childValue = childProps[key];
639
+ if (key === "style") {
640
+ mergedProps.style = {
641
+ ...childValue,
642
+ ...parentValue
643
+ };
644
+ } else if (key === "className") {
645
+ mergedProps.className = classNames(childValue, parentValue);
646
+ } else if (isEventHandler(key) && typeof childValue === "function") {
647
+ mergedProps[key] = composeEventHandlers(
648
+ childValue,
649
+ parentValue
650
+ );
651
+ } else {
652
+ mergedProps[key] = parentValue;
653
+ }
654
+ }
655
+ if (ref) {
656
+ mergedProps.ref = composeRefs(childProps.ref, ref);
657
+ }
619
658
  return cloneElement(children, mergedProps);
620
659
  }
621
660
  if (React.Children.count(children) > 1) {
622
- React.Children.only(null);
661
+ throw new Error("Slot expects a single child element");
623
662
  }
624
663
  return null;
625
664
  }
626
665
 
627
666
  const breadcrumbItem = "_breadcrumbItem_cua4v_2";
628
- const styles$p = {
667
+ const styles$q = {
629
668
  breadcrumbItem: breadcrumbItem
630
669
  };
631
670
 
@@ -636,7 +675,7 @@ function BreadcrumbItem({ children, className, isActive, asChild, ...props }) {
636
675
  {
637
676
  "data-active": isActive,
638
677
  "data-disabled": props.disabled,
639
- className: classNames(styles$p.breadcrumbItem, className),
678
+ className: classNames(styles$q.breadcrumbItem, className),
640
679
  ...isActive && { "aria-current": "page" },
641
680
  ...!asChild && { type: "button" },
642
681
  ...props,
@@ -648,52 +687,95 @@ function BreadcrumbItem({ children, className, isActive, asChild, ...props }) {
648
687
  function Breadcrumbs({
649
688
  className,
650
689
  children,
651
- separator = /* @__PURE__ */ jsx(IconChevron, { className: styles$q.defaultSeparator })
690
+ separator = /* @__PURE__ */ jsx(IconChevron, { className: styles$r.defaultSeparator })
652
691
  }) {
653
692
  const childrenArray = Array.isArray(children) ? children : [children];
654
693
  const lastIndex = childrenArray.length - 1;
655
- return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", className, children: /* @__PURE__ */ jsx("ol", { className: styles$q.breadcrumbs, children: childrenArray.map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
656
- /* @__PURE__ */ jsx("li", { className: styles$q.breadcrumbsItem, children: item }),
657
- index < lastIndex && /* @__PURE__ */ jsx("li", { className: styles$q.breadcrumbsItem, "aria-hidden": "true", children: separator })
694
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "breadcrumb", className, children: /* @__PURE__ */ jsx("ol", { className: styles$r.breadcrumbs, children: childrenArray.map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
695
+ /* @__PURE__ */ jsx("li", { className: styles$r.breadcrumbsItem, children: item }),
696
+ index < lastIndex && /* @__PURE__ */ jsx("li", { className: styles$r.breadcrumbsItem, "aria-hidden": "true", children: separator })
658
697
  ] }, index)) }) });
659
698
  }
660
699
  Breadcrumbs.Item = BreadcrumbItem;
661
700
 
662
701
  const button = "_button_cmbkj_2";
663
- const accent$1 = "_accent_cmbkj_11";
702
+ const accent$2 = "_accent_cmbkj_11";
664
703
  const primary$1 = "_primary_cmbkj_12";
665
704
  const secondary$2 = "_secondary_cmbkj_30";
666
705
  const tertiary = "_tertiary_cmbkj_48";
667
706
  const line = "_line_cmbkj_49";
668
- const neutral$1 = "_neutral_cmbkj_78";
669
- const lg$4 = "_lg_cmbkj_145";
670
- const md$7 = "_md_cmbkj_153";
707
+ const neutral$2 = "_neutral_cmbkj_78";
708
+ const lg$5 = "_lg_cmbkj_145";
709
+ const md$8 = "_md_cmbkj_153";
671
710
  const sm$3 = "_sm_cmbkj_161";
672
- const styles$o = {
711
+ const styles$p = {
673
712
  button: button,
674
- accent: accent$1,
713
+ accent: accent$2,
675
714
  primary: primary$1,
676
715
  secondary: secondary$2,
677
716
  tertiary: tertiary,
678
717
  line: line,
718
+ neutral: neutral$2,
719
+ lg: lg$5,
720
+ md: md$8,
721
+ sm: sm$3
722
+ };
723
+
724
+ const buttonFunction = "_buttonFunction_o8iku_2";
725
+ const accent$1 = "_accent_o8iku_10";
726
+ const neutral$1 = "_neutral_o8iku_22";
727
+ const lg$4 = "_lg_o8iku_41";
728
+ const md$7 = "_md_o8iku_46";
729
+ const styles$o = {
730
+ buttonFunction: buttonFunction,
731
+ accent: accent$1,
679
732
  neutral: neutral$1,
680
733
  lg: lg$4,
681
- md: md$7,
682
- sm: sm$3
734
+ md: md$7
683
735
  };
684
736
 
737
+ function ButtonFunction({
738
+ children,
739
+ className,
740
+ color = "accent",
741
+ size = "lg",
742
+ asChild,
743
+ ...props
744
+ }) {
745
+ const Component = asChild ? Slot : "button";
746
+ return /* @__PURE__ */ jsx(
747
+ Component,
748
+ {
749
+ className: classNames(styles$o.buttonFunction, styles$o[color], styles$o[size], className),
750
+ ...props.disabled && { "data-disabled": true },
751
+ ...!asChild && { type: "button" },
752
+ ...props,
753
+ children
754
+ }
755
+ );
756
+ }
757
+
685
758
  function Button({
686
759
  children,
687
760
  className,
688
761
  color = "accent",
689
762
  size = "lg",
690
763
  mode = "primary",
691
- as = "button",
764
+ asChild,
692
765
  ...props
693
766
  }) {
694
- const commonClassNames = classNames(styles$o.button, styles$o[color], styles$o[size], styles$o[mode], className);
695
- return as === "button" ? /* @__PURE__ */ jsx("button", { className: commonClassNames, type: "button", ...props, children }) : /* @__PURE__ */ jsx("a", { className: commonClassNames, ...props, children });
767
+ const Component = asChild ? Slot : "button";
768
+ return /* @__PURE__ */ jsx(
769
+ Component,
770
+ {
771
+ className: classNames(styles$p.button, styles$p[color], styles$p[size], styles$p[mode], className),
772
+ ...!asChild && { type: "button" },
773
+ ...props,
774
+ children
775
+ }
776
+ );
696
777
  }
778
+ Button.Function = ButtonFunction;
697
779
 
698
780
  const checkboxWrapper = "_checkboxWrapper_k1shg_2";
699
781
  const icon$2 = "_icon_k1shg_23";
package/dist/style.css CHANGED
@@ -702,6 +702,57 @@ textarea {
702
702
  }
703
703
  }
704
704
  }
705
+ @layer ui_baza_components {
706
+ ._buttonFunction_o8iku_2 {
707
+ display: flex;
708
+ align-items: center;
709
+ gap: var(--space-md);
710
+ font-weight: var(--font-weight-bold);
711
+ cursor: pointer;
712
+ transition: color var(--transition-duration-default) ease-in-out;
713
+
714
+ &._accent_o8iku_10 {
715
+ color: var(--color-accent);
716
+
717
+ &:hover {
718
+ color: var(--color-accent-900);
719
+ }
720
+
721
+ &:active {
722
+ color: var(--color-accent-800);
723
+ }
724
+ }
725
+
726
+ &._neutral_o8iku_22 {
727
+ color: var(--color-neutral);
728
+
729
+ &:hover {
730
+ color: var(--color-neutral-920);
731
+ }
732
+
733
+ &:active {
734
+ color: var(--color-neutral-880);
735
+ }
736
+ }
737
+
738
+ &:disabled,
739
+ &[data-disabled='true'] {
740
+ color: var(--color-neutral-340);
741
+ cursor: default;
742
+ pointer-events: none;
743
+ }
744
+
745
+ &._lg_o8iku_41 {
746
+ font-size: var(--size-md);
747
+ line-height: var(--line-height-lg);
748
+ }
749
+
750
+ &._md_o8iku_46 {
751
+ font-size: var(--size-sm);
752
+ line-height: var(--line-height-md);
753
+ }
754
+ }
755
+ }
705
756
  @layer ui_baza_components {
706
757
  ._checkboxWrapper_k1shg_2 {
707
758
  --checkbox-size: 24px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grandbazar/ui-baza",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "A lightweight and modular UI kit for building modern, accessible web interfaces. Designed for flexibility, scalability, and developer happiness.",
5
5
  "repository": {
6
6
  "type": "git",