@clubmed/trident-ui 1.3.0-beta.7 → 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.
@@ -1,32 +1,57 @@
1
1
  "use client";
2
- import { jsx as t } from "react/jsx-runtime";
3
- import { c as p } from "../../../chunks/index.js";
4
- import { getButtonClasses as c } from "./Button.type.js";
5
- import { ButtonContent as d } from "../ButtonContent.js";
6
- /* empty css */
7
- const g = ({
8
- className: o,
9
- children: n,
10
- color: s = "saffron",
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: m,
13
- size: r = "medium",
14
- theme: a = "solid",
36
+ iconWidth: o,
37
+ size: s = "medium",
38
+ theme: u = "solid",
15
39
  variant: i = "pill",
16
- dataTestId: u,
17
- ...l
18
- }) => /* @__PURE__ */ t(
19
- "button",
20
- {
21
- type: "button",
22
- "data-testid": u,
23
- ...l,
24
- className: p(c({ color: s, size: r, theme: a, variant: i }), o),
25
- "data-name": "Button",
26
- children: /* @__PURE__ */ t(d, { icon: e, iconWidth: m, children: n })
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
- g as Button
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 { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps as Btn } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n dataTestId,\n ...attrs\n}) => {\n return (\n <button\n type=\"button\"\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"Button\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </button>\n );\n};\n"],"names":["Button","className","children","color","icon","iconWidth","size","theme","variant","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAgBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,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,YAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,eAAaF;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAV,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAU,EAACG,GAAA,EAAc,MAAAV,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@clubmed/trident-ui",
3
- "version": "1.3.0-beta.7",
3
+ "version": "1.3.0-beta.9",
4
4
  "type": "module",
5
5
  "description": "Shared ClubMed React UI components",
6
6
  "keywords": [
@@ -51,16 +51,16 @@
51
51
  "import": "./molecules/Forms/Checkboxes/index.js",
52
52
  "default": "./molecules/Forms/Checkboxes/index.js"
53
53
  },
54
- "./molecules/Forms/Radios": {
55
- "types": "./molecules/Forms/Radios/index.d.ts",
56
- "import": "./molecules/Forms/Radios/index.js",
57
- "default": "./molecules/Forms/Radios/index.js"
58
- },
59
54
  "./molecules/Forms/Password": {
60
55
  "types": "./molecules/Forms/Password/index.d.ts",
61
56
  "import": "./molecules/Forms/Password/index.js",
62
57
  "default": "./molecules/Forms/Password/index.js"
63
58
  },
59
+ "./molecules/Forms/Radios": {
60
+ "types": "./molecules/Forms/Radios/index.d.ts",
61
+ "import": "./molecules/Forms/Radios/index.js",
62
+ "default": "./molecules/Forms/Radios/index.js"
63
+ },
64
64
  "./fonts/*": "./fonts/*",
65
65
  "./atoms/*": {
66
66
  "types": "./atoms/*.d.ts",
@@ -102,9 +102,7 @@
102
102
  "build:exports": "NODE_NO_WARNINGS=1 node --loader ts-node/esm tools/exports-builder/index.ts"
103
103
  },
104
104
  "dependencies": {
105
- "@clubmed/trident-icons": ">=1.0.1",
106
105
  "@juggle/resize-observer": "^3.4.0",
107
- "@react-spring/web": "^9.7.3",
108
106
  "@use-gesture/react": "^10.2.26",
109
107
  "@whitespace/storybook-addon-html": "6.0.5",
110
108
  "build": "^0.1.4",
@@ -118,6 +116,8 @@
118
116
  "use-resize-observer": "^9.1.0"
119
117
  },
120
118
  "devDependencies": {
119
+ "@react-spring/web": "^9.7.3",
120
+ "@clubmed/trident-icons": ">=1.0.1",
121
121
  "@commitlint/cli": "18.6.1",
122
122
  "@commitlint/config-conventional": "18.6.2",
123
123
  "@netsells/storybook-mockdate": "^0.3.2",
@@ -181,7 +181,26 @@
181
181
  "peerDependencies": {
182
182
  "react": ">=17.0.2",
183
183
  "react-dom": ">=17.0.2",
184
- "tailwindcss": ">=3.3.5"
184
+ "tailwindcss": ">=3.3.5",
185
+ "@clubmed/trident-icons": ">=1.0.1",
186
+ "@react-spring/web": ">=9"
187
+ },
188
+ "peerDependenciesMeta": {
189
+ "@clubmed/trident-icons": {
190
+ "optional": false
191
+ },
192
+ "react": {
193
+ "optional": false
194
+ },
195
+ "react-dom": {
196
+ "optional": false
197
+ },
198
+ "tailwindcss": {
199
+ "optional": false
200
+ },
201
+ "@react-spring/web": {
202
+ "optional": false
203
+ }
185
204
  },
186
205
  "sideEffects": [
187
206
  "**/*.css"
@@ -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;"}