@clubmed/trident-ui 1.3.0-beta.8 → 1.3.0-beta.9
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/CHANGELOG.md +13 -0
- package/molecules/Buttons/Button.d.ts +4 -0
- package/molecules/Buttons/Button.js +12 -10
- package/molecules/Buttons/Button.js.map +1 -1
- package/molecules/Buttons/ButtonAnchor.d.ts +5 -0
- package/molecules/Buttons/ButtonAnchor.js +13 -10
- package/molecules/Buttons/ButtonAnchor.js.map +1 -1
- package/molecules/Buttons/FakeButton.d.ts +7 -6
- package/molecules/Buttons/FakeButton.js +5 -24
- package/molecules/Buttons/FakeButton.js.map +1 -1
- package/molecules/Buttons/InertButton.d.ts +1 -1
- package/molecules/Buttons/InertButton.js +9 -8
- package/molecules/Buttons/InertButton.js.map +1 -1
- package/molecules/Buttons/v2/Button.d.ts +2285 -6
- package/molecules/Buttons/v2/Button.js +51 -26
- package/molecules/Buttons/v2/Button.js.map +1 -1
- package/package.json +1 -1
- package/molecules/Buttons/v2/ButtonAnchor.d.ts +0 -12
- package/molecules/Buttons/v2/ButtonAnchor.js +0 -32
- package/molecules/Buttons/v2/ButtonAnchor.js.map +0 -1
|
@@ -1,32 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { getButtonClasses as
|
|
5
|
-
import { ButtonContent as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { c as l } from "../../../chunks/index.js";
|
|
4
|
+
import { getButtonClasses as B } from "./Button.type.js";
|
|
5
|
+
import { ButtonContent as c } from "../ButtonContent.js";
|
|
6
|
+
function p({ component: t, disabled: r, ...a }) {
|
|
7
|
+
return t === "a" || "href" in a || typeof t == "object" ? {
|
|
8
|
+
attrs: {
|
|
9
|
+
"data-name": "ButtonAnchor",
|
|
10
|
+
"aria-disabled": r ? "true" : void 0,
|
|
11
|
+
...a
|
|
12
|
+
},
|
|
13
|
+
Cmp: "a"
|
|
14
|
+
} : t === "span" || t === "div" ? {
|
|
15
|
+
attrs: {
|
|
16
|
+
"data-name": "FakeButton",
|
|
17
|
+
"aria-disabled": r ? "true" : void 0,
|
|
18
|
+
...a
|
|
19
|
+
},
|
|
20
|
+
Cmp: "span"
|
|
21
|
+
} : {
|
|
22
|
+
attrs: {
|
|
23
|
+
"data-name": "Button",
|
|
24
|
+
type: "button",
|
|
25
|
+
disabled: r,
|
|
26
|
+
...a
|
|
27
|
+
},
|
|
28
|
+
Cmp: "button"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const C = ({
|
|
32
|
+
className: t,
|
|
33
|
+
children: r,
|
|
34
|
+
color: a = "saffron",
|
|
11
35
|
icon: e,
|
|
12
|
-
iconWidth:
|
|
13
|
-
size:
|
|
14
|
-
theme:
|
|
36
|
+
iconWidth: o,
|
|
37
|
+
size: s = "medium",
|
|
38
|
+
theme: u = "solid",
|
|
15
39
|
variant: i = "pill",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
...m
|
|
41
|
+
}) => {
|
|
42
|
+
const { Cmp: f, attrs: d } = p(m);
|
|
43
|
+
return /* @__PURE__ */ n(
|
|
44
|
+
f,
|
|
45
|
+
{
|
|
46
|
+
...d,
|
|
47
|
+
className: l(B({ color: a, size: s, theme: u, variant: i }), t),
|
|
48
|
+
children: /* @__PURE__ */ n(c, { icon: e, iconWidth: o, children: r })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
C.displayName = "Button";
|
|
29
53
|
export {
|
|
30
|
-
|
|
54
|
+
C as Button,
|
|
55
|
+
p as useButton
|
|
31
56
|
};
|
|
32
57
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../lib/molecules/Buttons/v2/Button.tsx"],"sourcesContent":["'use client';\nimport classnames from 'classnames';\nimport type {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../lib/molecules/Buttons/v2/Button.tsx"],"sourcesContent":["'use client';\nimport classnames from 'classnames';\nimport type {\n ComponentPropsWithoutRef,\n FunctionComponent,\n PropsWithChildren,\n ReactElement,\n ReactPortal,\n} from 'react';\n\nimport { type ButtonProps as Btn, getButtonClasses } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {\n component?: 'button';\n}\n\nexport interface ButtonAnchorProps extends Btn, Omit<ComponentPropsWithoutRef<'a'>, 'color'> {\n component: 'a';\n disabled?: boolean;\n}\n\nexport interface FakeButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'span'>, 'color'> {\n component: 'span' | 'div';\n disabled?: boolean;\n}\n// For Button with React Router Link or similar components\nexport interface ReactButtonProps\n extends Btn,\n Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'color'> {\n component: ReactElement | ReactPortal;\n disabled?: boolean;\n}\n\ntype AnyButtonProps = ButtonProps | ButtonAnchorProps | FakeButtonProps | ReactButtonProps;\n\nexport function useButton({ component, disabled, ...props }: AnyButtonProps) {\n if (component === 'a' || 'href' in props || typeof component === 'object') {\n return {\n attrs: {\n 'data-name': 'ButtonAnchor',\n 'aria-disabled': disabled ? 'true' : undefined,\n ...props,\n },\n Cmp: 'a' as unknown as FunctionComponent<PropsWithChildren<any>>,\n };\n }\n\n if (component === 'span' || component === 'div') {\n return {\n attrs: {\n 'data-name': 'FakeButton',\n 'aria-disabled': disabled ? 'true' : undefined,\n ...props,\n },\n Cmp: 'span' as unknown as FunctionComponent<PropsWithChildren<any>>,\n };\n }\n\n return {\n attrs: {\n 'data-name': 'Button',\n type: 'button',\n disabled,\n ...props,\n },\n Cmp: 'button' as unknown as FunctionComponent<PropsWithChildren<any>>,\n };\n}\n\n// Main Button component that handles both button and anchor functionality\nexport const Button: FunctionComponent<AnyButtonProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n ...props\n}) => {\n const { Cmp, attrs } = useButton(props);\n\n return (\n <Cmp\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </Cmp>\n );\n};\n\nButton.displayName = 'Button';\n"],"names":["useButton","component","disabled","props","Button","className","children","color","icon","iconWidth","size","theme","variant","Cmp","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;AAsCO,SAASA,EAAU,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,KAAyB;AAC3E,SAAIF,MAAc,OAAO,UAAUE,KAAS,OAAOF,KAAc,WACxD;AAAA,IACL,OAAO;AAAA,MACL,aAAa;AAAA,MACb,iBAAiBC,IAAW,SAAS;AAAA,MACrC,GAAGC;AAAA,IAAA;AAAA,IAEL,KAAK;AAAA,EAAA,IAILF,MAAc,UAAUA,MAAc,QACjC;AAAA,IACL,OAAO;AAAA,MACL,aAAa;AAAA,MACb,iBAAiBC,IAAW,SAAS;AAAA,MACrC,GAAGC;AAAA,IAAA;AAAA,IAEL,KAAK;AAAA,EAAA,IAIF;AAAA,IACL,OAAO;AAAA,MACL,aAAa;AAAA,MACb,MAAM;AAAA,MACN,UAAAD;AAAA,MACA,GAAGC;AAAA,IAAA;AAAA,IAEL,KAAK;AAAA,EAAA;AAET;AAGO,MAAMC,IAA4C,CAAC;AAAA,EACxD,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,GAAGT;AACL,MAAM;AACJ,QAAM,EAAE,KAAAU,GAAK,OAAAC,MAAUd,EAAUG,CAAK;AAEtC,SACE,gBAAAY;AAAA,IAACF;AAAA,IAAA;AAAA,MACE,GAAGC;AAAA,MACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAV,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,MAElF,UAAA,gBAAAU,EAACG,GAAA,EAAc,MAAAV,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAF,EAAO,cAAc;"}
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
-
import { type ButtonProps } from './Button.type';
|
|
3
|
-
import './Button.css';
|
|
4
|
-
export interface ButtonAnchorProps extends ButtonProps, Omit<ComponentPropsWithoutRef<'a'>, 'color'> {
|
|
5
|
-
href: string;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated use `data-testid` instead
|
|
8
|
-
*/
|
|
9
|
-
dataTestId?: string;
|
|
10
|
-
component?: FunctionComponent<PropsWithChildren<any>> | string;
|
|
11
|
-
}
|
|
12
|
-
export declare const ButtonAnchor: FunctionComponent<ButtonAnchorProps>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { c as u } from "../../../chunks/index.js";
|
|
4
|
-
import { getButtonClasses as d } from "./Button.type.js";
|
|
5
|
-
import { ButtonContent as f } from "../ButtonContent.js";
|
|
6
|
-
/* empty css */
|
|
7
|
-
const j = ({
|
|
8
|
-
className: o,
|
|
9
|
-
children: m,
|
|
10
|
-
color: n = "saffron",
|
|
11
|
-
icon: r,
|
|
12
|
-
iconWidth: s,
|
|
13
|
-
size: a = "medium",
|
|
14
|
-
theme: e = "solid",
|
|
15
|
-
variant: i = "pill",
|
|
16
|
-
component: c = "a",
|
|
17
|
-
dataTestId: p,
|
|
18
|
-
...l
|
|
19
|
-
}) => /* @__PURE__ */ t(
|
|
20
|
-
c,
|
|
21
|
-
{
|
|
22
|
-
"data-testid": p,
|
|
23
|
-
...l,
|
|
24
|
-
className: u(d({ color: n, size: a, theme: e, variant: i }), o),
|
|
25
|
-
"data-name": "ButtonAnchor",
|
|
26
|
-
children: /* @__PURE__ */ t(f, { icon: r, iconWidth: s, children: m })
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
export {
|
|
30
|
-
j as ButtonAnchor
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=ButtonAnchor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAnchor.js","sources":["../../../../lib/molecules/Buttons/v2/ButtonAnchor.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonAnchorProps\n extends ButtonProps,\n Omit<ComponentPropsWithoutRef<'a'>, 'color'> {\n href: string;\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n component = 'a',\n dataTestId,\n ...attrs\n}) => {\n const Cmp = component as FunctionComponent<PropsWithChildren<ButtonAnchorProps>>;\n return (\n <Cmp\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"ButtonAnchor\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </Cmp>\n );\n};\n"],"names":["ButtonAnchor","className","children","color","icon","iconWidth","size","theme","variant","component","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAsBO,MAAMA,IAAqD,CAAC;AAAA,EACjE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,YAAAC;AAAA,EACA,GAAGC;AACL,MAGI,gBAAAC;AAAA,EAFUH;AAAA,EAET;AAAA,IACC,eAAaC;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAX,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAW,EAACG,GAAA,EAAc,MAAAX,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|