@vkzstudio/muza-ui 1.0.41 → 1.0.43

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.
@@ -21,7 +21,15 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
21
21
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'icon';
22
22
  /** Stretches button to fill its container width. @default false */
23
23
  fullWidth?: boolean;
24
- /** Renders children as the child element instead of a `<button>`. */
24
+ /**
25
+ * When true, merges Button props/styles onto the single child element via
26
+ * Radix `Slot` (e.g. `<Button asChild><Link href="/">Home</Link></Button>`
27
+ * renders an `<a>` with all button styling and click target). Icons and the
28
+ * `loading` spinner are injected as siblings of the child's original content.
29
+ * Note: `disabled` has no effect on non-`<button>` children — use
30
+ * `aria-disabled` on the child instead.
31
+ * @default false
32
+ */
25
33
  asChild?: boolean;
26
34
  /** React node displayed as an icon. Position controlled by `iconPosition`. */
27
35
  icon?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;GAIG;AACH,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,IAAI,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAChE;;;;OAIG;IACH,OAAO,CAAC,EACJ,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,YAAY,CAAA;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM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AAO,CAAC,EAAE,OAAO,CAAA;IACjB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,6HAA6H;IAC7H,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAC9B,qIAAqI;IACrI,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,wFAAwF;IACxF,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wFAAwF;IACxF,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,QAAA,MAAM,MAAM,uFAqFX,CAAA;AAGD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
@@ -1,71 +1,76 @@
1
- import { jsxs as N, jsx as m } from "react/jsx-runtime";
2
- import * as d from "react";
1
+ import { jsxs as j, jsx as o } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { Slot as v, Slottable as u } from "@radix-ui/react-slot";
3
4
  import "class-variance-authority";
4
- import { ButtonLoader as B } from "./ButtonLoader.js";
5
- import { buttonVariants as g } from "./buttonVariants.js";
6
- import { cn as f } from "../../utils/cn.js";
7
- import { Typography as j } from "../Typography/Typography.js";
8
- const w = d.forwardRef(
5
+ import { ButtonLoader as w } from "./ButtonLoader.js";
6
+ import { buttonVariants as E } from "./buttonVariants.js";
7
+ import { cn as c } from "../../utils/cn.js";
8
+ import { Typography as R } from "../Typography/Typography.js";
9
+ const S = m.forwardRef(
9
10
  ({
10
- className: i,
11
- variant: u,
12
- size: t,
13
- fullWidth: c,
14
- asChild: l = !1,
15
- icon: a,
16
- iconPosition: p = "start",
11
+ className: y,
12
+ variant: b,
13
+ size: a,
14
+ fullWidth: x,
15
+ asChild: p = !1,
16
+ icon: r,
17
+ iconPosition: n = "start",
17
18
  secondIcon: s,
18
- ghost: y = !1,
19
- danger: e = !1,
20
- loading: o = !1,
21
- children: r,
19
+ ghost: d = !1,
20
+ danger: f = !1,
21
+ loading: e = !1,
22
+ children: t,
22
23
  ...h
23
- }, x) => {
24
- const b = l ? "span" : "button", n = t === "icon" || y;
25
- return /* @__PURE__ */ N(
26
- b,
24
+ }, N) => {
25
+ const g = p ? v : "button", i = a === "icon" || d, l = (L) => /* @__PURE__ */ o(
26
+ R,
27
27
  {
28
- className: f(
29
- g({
30
- variant: u,
31
- size: t,
32
- fullWidth: c,
33
- iconOnly: t === "icon" || !r,
34
- ghost: n,
35
- danger: e,
36
- loading: o,
37
- className: i
28
+ variant: "cta",
29
+ size: a === "sm" || a === "xs" ? "sm" : "base",
30
+ weight: "medium",
31
+ component: "span",
32
+ fixY: !0,
33
+ className: c("transition-opacity", {
34
+ "opacity-0": e
35
+ }),
36
+ children: L
37
+ }
38
+ ), B = () => p ? m.isValidElement(t) ? /* @__PURE__ */ o(u, { children: m.cloneElement(
39
+ t,
40
+ void 0,
41
+ l(t.props.children)
42
+ ) }) : /* @__PURE__ */ o(u, { children: t }) : t && l(t);
43
+ return /* @__PURE__ */ j(
44
+ g,
45
+ {
46
+ className: c(
47
+ E({
48
+ variant: b,
49
+ size: a,
50
+ fullWidth: x,
51
+ iconOnly: a === "icon" || !t,
52
+ ghost: i,
53
+ danger: f,
54
+ loading: e,
55
+ className: y
38
56
  })
39
57
  ),
40
- ref: x,
41
- "data-ghost": n,
42
- "data-danger": e,
58
+ ref: N,
59
+ "data-ghost": i,
60
+ "data-danger": f,
43
61
  ...h,
44
62
  children: [
45
- o && /* @__PURE__ */ m("span", { className: "absolute", children: /* @__PURE__ */ m(B, {}) }),
46
- (s || p === "start") && a,
47
- r && /* @__PURE__ */ m(
48
- j,
49
- {
50
- variant: "cta",
51
- size: t == "sm" || t == "xs" ? "sm" : "base",
52
- weight: "medium",
53
- component: "span",
54
- fixY: !0,
55
- className: f("transition-opacity", {
56
- "opacity-0": o
57
- }),
58
- children: r
59
- }
60
- ),
61
- s || p === "end" && a
63
+ e && /* @__PURE__ */ o("span", { className: "absolute", children: /* @__PURE__ */ o(w, {}) }),
64
+ (s || n === "start") && r,
65
+ B(),
66
+ s || n === "end" && r
62
67
  ]
63
68
  }
64
69
  );
65
70
  }
66
71
  );
67
- w.displayName = "Button";
72
+ S.displayName = "Button";
68
73
  export {
69
- w as Button,
70
- g as buttonVariants
74
+ S as Button,
75
+ E as buttonVariants
71
76
  };
@@ -13,5 +13,7 @@ export declare const AllSizes: Story;
13
13
  export declare const InteractiveStates: Story;
14
14
  export declare const IconExamples: Story;
15
15
  export declare const WithSecondIcon: Story;
16
+ export declare const AsChildAnchor: Story;
17
+ export declare const AsChildEdgeCases: Story;
16
18
  export declare const ResponsiveExample: Story;
17
19
  //# sourceMappingURL=Button.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAU3D,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AAoBnD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAoF7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAetB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAoCtB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAgBvB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAyCzB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAkDtB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAmF/B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA8D1B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAgB5B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAgC/B,CAAA"}
1
+ {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.stories.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAW3D,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AAoBnD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAqF7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAetB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAoCtB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAgBvB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAyCzB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAkDtB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAmF/B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA8D1B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAgB5B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAgB3B,CAAA;AAaD,eAAO,MAAM,gBAAgB,EAAE,KAmL9B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAgC/B,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { DateRange } from 'react-day-picker';
3
3
  import { CalendarBaseProps } from '../Calendar';
4
+ import { PopoverContentProps } from '../Popover/Popover';
4
5
  import { Presets } from './utils/getDateRange';
5
6
  /**
6
7
  * Props for the DatePicker component.
@@ -64,6 +65,17 @@ export type DatePickerProps = {
64
65
  side?: 'top' | 'right' | 'bottom' | 'left';
65
66
  /** Prevents the popover from overflowing viewport boundaries. @default true */
66
67
  avoidCollisions?: boolean;
68
+ /**
69
+ * Additional props forwarded to the underlying {@link PopoverContent}.
70
+ * Use for fine-tuning positioning (`sideOffset`, `alignOffset`, `sticky`,
71
+ * `hideWhenDetached`) or intercepting Radix events (`onOpenAutoFocus`,
72
+ * `onCloseAutoFocus`, `onEscapeKeyDown`, `onPointerDownOutside`, etc.).
73
+ *
74
+ * Props already exposed on DatePicker (`align` via `alignCalendar`, `side`,
75
+ * `avoidCollisions`, `className` via `classNames.popoverContent`) are
76
+ * intentionally excluded.
77
+ */
78
+ popoverContentProps?: Omit<PopoverContentProps, 'align' | 'side' | 'avoidCollisions' | 'className'>;
67
79
  /** Replaces the default Input trigger with a custom rendered element. */
68
80
  renderCustomTrigger?: () => ReactNode;
69
81
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjD,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,sBAAsB,CAAA;AAGjE;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,qFAAqF;IACrF,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;IAC1C;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;KAAE,EAAE,CAAA;IACnE,2FAA2F;IAC3F,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,iD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;IAC/B,4GAA4G;IAC5G,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAC3C,2DAA2D;IAC3D,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,UAAU,8GA6PtB,CAAA"}
@@ -1,22 +1,22 @@
1
- import { jsx as n, jsxs as rt } from "react/jsx-runtime";
2
- import { forwardRef as ot, useState as k, useRef as E, useEffect as et } from "react";
3
- import { useIsDesktop as it } from "../../hooks/use-is-desktop.js";
4
- import { useIsMobile as ft } from "../../hooks/use-is-mobile.js";
5
- import { Popover as pt, PopoverTrigger as ct, PopoverContent as nt } from "../Popover/Popover.js";
6
- import { getDateRange as dt } from "./utils/getDateRange.js";
7
- import { resolveOneDayRange as ut } from "./utils/resolveOneDayRange.js";
8
- import { Input as bt } from "../Input/Input.js";
9
- import { formatDate as st } from "../Calendar/utils/formatDate.js";
10
- import { formatDateRange as xt } from "../Calendar/utils/formatDateRange.js";
11
- import { Calendar as Y } from "../Calendar/Calendar.js";
1
+ import { jsx as n, jsxs as ot } from "react/jsx-runtime";
2
+ import { forwardRef as et, useState as k, useRef as Y, useEffect as it } from "react";
3
+ import { useIsDesktop as ft } from "../../hooks/use-is-desktop.js";
4
+ import { useIsMobile as ct } from "../../hooks/use-is-mobile.js";
5
+ import { Popover as pt, PopoverTrigger as nt, PopoverContent as dt } from "../Popover/Popover.js";
6
+ import { getDateRange as ut } from "./utils/getDateRange.js";
7
+ import { resolveOneDayRange as bt } from "./utils/resolveOneDayRange.js";
8
+ import { Input as st } from "../Input/Input.js";
9
+ import { formatDate as xt } from "../Calendar/utils/formatDate.js";
10
+ import { formatDateRange as lt } from "../Calendar/utils/formatDateRange.js";
11
+ import { Calendar as A } from "../Calendar/Calendar.js";
12
12
  import { cn as l } from "../../utils/cn.js";
13
- import { typographyVariants as lt } from "../Typography/Typography.js";
14
- import { CalendarBold as yt } from "@solar-icons/react-perf";
15
- const vt = ot(
13
+ import { typographyVariants as yt } from "../Typography/Typography.js";
14
+ import { CalendarBold as mt } from "@solar-icons/react-perf";
15
+ const vt = et(
16
16
  ({
17
17
  alignCalendar: G,
18
18
  mode: y,
19
- allowedPresets: v,
19
+ allowedPresets: m,
20
20
  dateFormatter: H,
21
21
  value: e,
22
22
  defaultValue: b,
@@ -31,39 +31,40 @@ const vt = ot(
31
31
  placeholder: Q,
32
32
  avoidCollisions: T = !0,
33
33
  side: U = "bottom",
34
+ popoverContentProps: W,
34
35
  renderCustomTrigger: S,
35
36
  immediateCommit: f,
36
37
  allowOneDayRange: B,
37
38
  shouldResetToDefaultValue: I,
38
39
  required: x,
39
- disableRequiredAsterisk: W,
40
- numberOfMonths: X,
41
- hideNavigation: Z,
42
- hideCaption: _,
43
- hideWeekdays: $,
44
- showOutsideDays: V,
45
- hideBottomText: q,
46
- hideResetButton: w,
47
- hideBottomBar: O,
48
- ...g
49
- }, a) => {
50
- const N = it(), h = ft(), [C, M] = k(!1), P = typeof s == "boolean" ? s : C, [F, p] = k(
40
+ disableRequiredAsterisk: X,
41
+ numberOfMonths: Z,
42
+ hideNavigation: _,
43
+ hideCaption: $,
44
+ hideWeekdays: V,
45
+ showOutsideDays: q,
46
+ hideBottomText: w,
47
+ hideResetButton: O,
48
+ hideBottomBar: g,
49
+ ...a
50
+ }, N) => {
51
+ const h = ft(), C = ct(), [tt, M] = k(!1), P = typeof s == "boolean" ? s : tt, [j, c] = k(
51
52
  e ?? b
52
- ), [i, u] = k(e ?? b), j = E(!1), m = E(
53
+ ), [i, u] = k(e ?? b), z = Y(!1), v = Y(
53
54
  e ?? b
54
55
  );
55
- et(() => {
56
- if (!j.current) {
57
- j.current = !0;
56
+ it(() => {
57
+ if (!z.current) {
58
+ z.current = !0;
58
59
  return;
59
60
  }
60
- p(e), u(e), P || (m.current = e);
61
+ c(e), u(e), P || (v.current = e);
61
62
  }, [e]);
62
- const tt = v == null ? void 0 : v.map((t) => /* @__PURE__ */ n(
63
+ const rt = m == null ? void 0 : m.map((t) => /* @__PURE__ */ n(
63
64
  "button",
64
65
  {
65
66
  className: l(
66
- lt({
67
+ yt({
67
68
  variant: "cta",
68
69
  weight: "medium",
69
70
  size: "sm",
@@ -76,41 +77,41 @@ const vt = ot(
76
77
  o == null ? void 0 : o.leftPanelButton
77
78
  ),
78
79
  onClick: () => {
79
- const c = dt(t.type);
80
- u(c), f && (p(c), r == null || r(c));
80
+ const p = ut(t.type);
81
+ u(p), f && (c(p), r == null || r(p));
81
82
  },
82
83
  children: t.name
83
84
  },
84
85
  t.type
85
- )), D = H ?? (y === "single" ? st : xt), z = f ? e !== void 0 ? e : i : F, A = {
86
- ...g,
87
- numberOfMonths: X ?? (N ? 2 : 1),
88
- hideNavigation: Z,
89
- hideCaption: _,
90
- hideWeekdays: $,
91
- showOutsideDays: V,
92
- hideBottomText: q,
93
- hideResetButton: w,
94
- hideBottomBar: f ? O : void 0,
86
+ )), D = H ?? (y === "single" ? xt : lt), F = f ? e !== void 0 ? e : i : j, E = {
87
+ ...a,
88
+ numberOfMonths: Z ?? (h ? 2 : 1),
89
+ hideNavigation: _,
90
+ hideCaption: $,
91
+ hideWeekdays: V,
92
+ showOutsideDays: q,
93
+ hideBottomText: w,
94
+ hideResetButton: O,
95
+ hideBottomBar: f ? g : void 0,
95
96
  required: x,
96
97
  onReset: () => {
97
- const t = I ? b : f ? m.current : F;
98
- u(t), f && (p(t), r == null || r(t));
98
+ const t = I ? b : f ? v.current : j;
99
+ u(t), f && (c(t), r == null || r(t));
99
100
  },
100
101
  onConfirm: () => {
101
- f ? p(i) : (i !== void 0 || I || x === !1) && (p(i), r == null || r(i)), s === void 0 && M(!1), d == null || d(!1);
102
+ f ? c(i) : (i !== void 0 || I || x === !1) && (c(i), r == null || r(i)), s === void 0 && M(!1), d == null || d(!1);
102
103
  }
103
104
  };
104
- return /* @__PURE__ */ rt(
105
+ return /* @__PURE__ */ ot(
105
106
  pt,
106
107
  {
107
108
  open: P,
108
109
  onOpenChange: (t) => {
109
- t && (m.current = e ?? i), s === void 0 && M(t), d == null || d(t);
110
+ t && (v.current = e ?? i), s === void 0 && M(t), d == null || d(t);
110
111
  },
111
112
  children: [
112
113
  /* @__PURE__ */ n(
113
- ct,
114
+ nt,
114
115
  {
115
116
  className: l(
116
117
  "group cursor-pointer rounded-full text-left outline-0",
@@ -118,10 +119,10 @@ const vt = ot(
118
119
  ),
119
120
  disabled: R,
120
121
  children: S ? S() : /* @__PURE__ */ n(
121
- bt,
122
+ st,
122
123
  {
123
- ref: a,
124
- value: z ? D(z) : "",
124
+ ref: N,
125
+ value: F ? D(F) : "",
125
126
  placeholder: Q,
126
127
  error: J,
127
128
  disabled: R,
@@ -129,52 +130,52 @@ const vt = ot(
129
130
  hint: K,
130
131
  tabIndex: -1,
131
132
  required: x,
132
- disableRequiredAsterisk: W,
133
+ disableRequiredAsterisk: X,
133
134
  className: l(
134
135
  "pointer-events-none",
135
136
  o == null ? void 0 : o.input,
136
137
  "group-hover:border-comp-input-stroke-hover group-focus-visible:border-comp-input-stroke-focused"
137
138
  ),
138
- suffix: /* @__PURE__ */ n(yt, { className: "size-icon-medium text-icon-dark-secondary-def" })
139
+ suffix: /* @__PURE__ */ n(mt, { className: "size-icon-medium text-icon-dark-secondary-def" })
139
140
  }
140
141
  )
141
142
  }
142
143
  ),
143
144
  /* @__PURE__ */ n(
144
- nt,
145
+ dt,
145
146
  {
147
+ ...W,
146
148
  className: l("flex w-auto p-0", o == null ? void 0 : o.popoverContent),
147
149
  align: G,
148
150
  side: U,
149
151
  avoidCollisions: T,
150
- onOpenAutoFocus: (t) => t.preventDefault(),
151
152
  children: y === "single" ? /* @__PURE__ */ n(
152
- Y,
153
+ A,
153
154
  {
154
- ...A,
155
+ ...E,
155
156
  mode: "single",
156
157
  selected: i,
157
158
  onSelect: f ? (t) => {
158
- u(t), p(t), r == null || r(t);
159
+ u(t), c(t), r == null || r(t);
159
160
  } : u,
160
161
  dateFormatter: D
161
162
  }
162
163
  ) : /* @__PURE__ */ n(
163
- Y,
164
+ A,
164
165
  {
165
- ...A,
166
+ ...E,
166
167
  mode: "range",
167
168
  min: B ? 1 : void 0,
168
169
  selected: i,
169
170
  onSelect: (t) => {
170
- const c = B ? ut(
171
+ const p = B ? bt(
171
172
  i,
172
173
  t,
173
174
  x
174
175
  ) : t;
175
- u(c), f && (p(c), r == null || r(c));
176
+ u(p), f && (c(p), r == null || r(p));
176
177
  },
177
- leftPanelChildren: y === "range" && !h && tt,
178
+ leftPanelChildren: y === "range" && !C && rt,
178
179
  dateRangeFormatter: D
179
180
  }
180
181
  )
@@ -17,7 +17,12 @@ export interface EdgeButtonProps extends React.ButtonHTMLAttributes<HTMLButtonEl
17
17
  */
18
18
  disabled?: boolean;
19
19
  /**
20
- * Renders as a span element instead of button (useful for composing with other libraries).
20
+ * When true, merges EdgeButton props/styles onto the single child element via
21
+ * Radix `Slot` (e.g. `<EdgeButton asChild><a href="/help">Help</a></EdgeButton>`
22
+ * renders an `<a>` with all button styling and click target). The leading icon
23
+ * and text are injected as siblings of the child's original content.
24
+ * Note: `disabled` has no effect on non-`<button>` children — use
25
+ * `aria-disabled` on the child instead.
21
26
  * @default false
22
27
  */
23
28
  asChild?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeButton.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeButton/EdgeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,QAAA,MAAM,kBAAkB;;8EAwBvB,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,eACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,QAAA,MAAM,UAAU,2FAuCf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAA"}
1
+ {"version":3,"file":"EdgeButton.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeButton/EdgeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,QAAA,MAAM,kBAAkB;;8EAwBvB,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,eACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,QAAA,MAAM,UAAU,2FAmFf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAA"}
@@ -1,10 +1,11 @@
1
- import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
- import d from "react";
3
- import { cva as u } from "class-variance-authority";
4
- import { sharedButtonVariants as o } from "../Button/buttonVariants.js";
5
- import { cn as l } from "../../utils/cn.js";
6
- import { Typography as f } from "../Typography/Typography.js";
7
- const z = u(
1
+ import { jsx as e, jsxs as i, Fragment as a } from "react/jsx-runtime";
2
+ import s from "react";
3
+ import { Slot as h, Slottable as l } from "@radix-ui/react-slot";
4
+ import { cva as x } from "class-variance-authority";
5
+ import { sharedButtonVariants as d } from "../Button/buttonVariants.js";
6
+ import { cn as y } from "../../utils/cn.js";
7
+ import { Typography as j } from "../Typography/Typography.js";
8
+ const _ = x(
8
9
  [
9
10
  "inline-flex items-center justify-center",
10
11
  "h-comp-help-button-h gap-comp-button-gap px-comp-help-button-p",
@@ -12,7 +13,7 @@ const z = u(
12
13
  "&>svg]:duration-250 transition-colors duration-250 [&>svg]:transition-opacity",
13
14
  "[&>svg]:size-icon-medium",
14
15
  "disabled:pointer-events-none",
15
- ...o.primary
16
+ ...d.primary
16
17
  ],
17
18
  {
18
19
  variants: {
@@ -28,45 +29,68 @@ const z = u(
28
29
  disabled: !1
29
30
  }
30
31
  }
31
- ), g = d.forwardRef(
32
- ({ onClick: e, disabled: t, text: i, className: r, asChild: a, icon: s, ...n }, p) => /* @__PURE__ */ m(
33
- a ? "span" : "button",
34
- {
35
- ref: p,
36
- type: "button",
37
- onClick: t ? void 0 : e,
38
- disabled: t,
39
- className: l(
40
- "inline-flex items-center justify-center",
41
- "h-comp-help-button-h gap-comp-button-gap px-comp-help-button-p",
42
- "rounded-tl-2xl",
43
- "cursor-pointer disabled:pointer-events-none",
44
- "&>svg]:duration-250 transition-colors duration-250 [&>svg]:transition-opacity",
45
- "[&>svg]:size-icon-medium",
46
- ...o.primary,
47
- r
48
- ),
49
- ...n,
50
- children: [
51
- s,
52
- /* @__PURE__ */ c(
53
- f,
54
- {
55
- component: "span",
56
- size: "base",
57
- variant: "cta",
58
- weight: "medium",
59
- fixY: !0,
60
- children: i
61
- }
32
+ ), B = s.forwardRef(
33
+ ({
34
+ onClick: u,
35
+ disabled: p,
36
+ text: m,
37
+ className: c,
38
+ asChild: n,
39
+ icon: o,
40
+ children: t,
41
+ ...f
42
+ }, b) => {
43
+ const g = n ? h : "button", r = m ? /* @__PURE__ */ e(
44
+ j,
45
+ {
46
+ component: "span",
47
+ size: "base",
48
+ variant: "cta",
49
+ weight: "medium",
50
+ fixY: !0,
51
+ children: m
52
+ }
53
+ ) : null, v = () => n ? s.isValidElement(t) ? /* @__PURE__ */ e(l, { children: s.cloneElement(
54
+ t,
55
+ void 0,
56
+ /* @__PURE__ */ i(a, { children: [
57
+ o,
58
+ r,
59
+ t.props.children
60
+ ] })
61
+ ) }) : /* @__PURE__ */ i(a, { children: [
62
+ o,
63
+ r,
64
+ /* @__PURE__ */ e(l, { children: t })
65
+ ] }) : /* @__PURE__ */ i(a, { children: [
66
+ o,
67
+ r,
68
+ t
69
+ ] });
70
+ return /* @__PURE__ */ e(
71
+ g,
72
+ {
73
+ ref: b,
74
+ onClick: p ? void 0 : u,
75
+ ...n ? {} : { type: "button", disabled: p },
76
+ className: y(
77
+ "inline-flex items-center justify-center",
78
+ "h-comp-help-button-h gap-comp-button-gap px-comp-help-button-p",
79
+ "rounded-tl-2xl",
80
+ "cursor-pointer disabled:pointer-events-none",
81
+ "&>svg]:duration-250 transition-colors duration-250 [&>svg]:transition-opacity",
82
+ "[&>svg]:size-icon-medium",
83
+ ...d.primary,
84
+ c
62
85
  ),
63
- n.children
64
- ]
65
- }
66
- )
86
+ ...f,
87
+ children: v()
88
+ }
89
+ );
90
+ }
67
91
  );
68
- g.displayName = "EdgeButton";
92
+ B.displayName = "EdgeButton";
69
93
  export {
70
- g as EdgeButton,
71
- z as edgeButtonVariants
94
+ B as EdgeButton,
95
+ _ as edgeButtonVariants
72
96
  };
@@ -8,4 +8,6 @@ export declare const WithIcon: Story;
8
8
  export declare const InteractiveStates: Story;
9
9
  export declare const Accessibility: Story;
10
10
  export declare const Playground: Story;
11
+ export declare const AsChildAnchor: Story;
12
+ export declare const AsChildEdgeCases: Story;
11
13
  //# sourceMappingURL=EdgeButton.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeButton.stories.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeButton/EdgeButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAkGjC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KActB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAqD/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAmD3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA"}
1
+ {"version":3,"file":"EdgeButton.stories.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeButton/EdgeButton.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAkGjC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KActB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAqD/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAmD3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAe3B,CAAA;AAaD,eAAO,MAAM,gBAAgB,EAAE,KA+H9B,CAAA"}