@clubmed/trident-ui 1.3.0-rc.2 → 1.3.0-rc.4
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 +14 -0
- package/molecules/Buttons/v2/Button.d.ts +8 -8
- package/molecules/Forms/Switch.js +18 -16
- package/molecules/Forms/Switch.js.map +1 -1
- package/molecules/Tag.d.ts +4 -2
- package/molecules/Tag.js +18 -15
- package/molecules/Tag.js.map +1 -1
- package/package.json +14 -9
- package/types/Colors.d.ts +2 -0
- package/types/Colors.js +2 -0
- package/types/Colors.js.map +1 -0
- package/types/Direction.d.ts +1 -0
- package/types/Direction.js +2 -0
- package/types/Direction.js.map +1 -0
- package/types/LiteralUnion.d.ts +1 -0
- package/types/LiteralUnion.js +2 -0
- package/types/LiteralUnion.js.map +1 -0
- package/types/ScrollerLabels.d.ts +4 -0
- package/types/ScrollerLabels.js +2 -0
- package/types/ScrollerLabels.js.map +1 -0
- package/types/Theme.d.ts +2 -0
- package/types/Theme.js +2 -0
- package/types/Theme.js.map +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.js +5 -0
- package/types/index.js.map +1 -0
- package/types/Colors.d.js +0 -2
- package/types/Colors.d.js.map +0 -1
- package/types/Direction.d.js +0 -2
- package/types/Direction.d.js.map +0 -1
- package/types/LiteralUnion.d.js +0 -2
- package/types/LiteralUnion.d.js.map +0 -1
- package/types/ScrollerLabels.d.js +0 -2
- package/types/ScrollerLabels.d.js.map +0 -1
- package/types/Theme.d.js +0 -2
- package/types/Theme.d.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# ClubMed React UI components changelog
|
|
2
2
|
|
|
3
|
+
# [1.3.0-rc.4](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-rc.3...v1.3.0-rc.4) (2025-08-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **package:** update paths for utils to point to helpers ([8c22658](https://scm.clubmed.com/clubmed/ui/trident-ui/-/commit/8c22658c483592f2dbd2450122f04fd9f265802b))
|
|
9
|
+
|
|
10
|
+
# [1.3.0-rc.3](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-rc.2...v1.3.0-rc.3) (2025-08-14)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **tag:** add iconWidth prop and default width handling; update Switch styles ([9e4cc95](https://scm.clubmed.com/clubmed/ui/trident-ui/-/commit/9e4cc957c539f3adc26046f1e029af0f42cbe90d))
|
|
16
|
+
|
|
3
17
|
# [1.3.0-rc.2](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-rc.1...v1.3.0-rc.2) (2025-08-11)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -18,7 +18,7 @@ export interface ReactButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'a'
|
|
|
18
18
|
type AnyButtonProps = ButtonProps | ButtonAnchorProps | FakeButtonProps | ReactButtonProps;
|
|
19
19
|
export declare function useButton({ component, disabled, ...props }: AnyButtonProps): {
|
|
20
20
|
attrs: {
|
|
21
|
-
color?: import('../../../types
|
|
21
|
+
color?: import('../../../types').Colors;
|
|
22
22
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
23
23
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
24
24
|
iconWidth?: string;
|
|
@@ -303,7 +303,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
303
303
|
formTarget?: string | undefined | undefined;
|
|
304
304
|
'data-name': string;
|
|
305
305
|
} | {
|
|
306
|
-
color?: import('../../../types
|
|
306
|
+
color?: import('../../../types').Colors;
|
|
307
307
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
308
308
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
309
309
|
iconWidth?: string;
|
|
@@ -587,7 +587,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
587
587
|
target?: import('react').HTMLAttributeAnchorTarget | undefined;
|
|
588
588
|
'data-name': string;
|
|
589
589
|
} | {
|
|
590
|
-
color?: import('../../../types
|
|
590
|
+
color?: import('../../../types').Colors;
|
|
591
591
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
592
592
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
593
593
|
iconWidth?: string;
|
|
@@ -863,7 +863,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
863
863
|
onTransitionEndCapture?: import('react').TransitionEventHandler<HTMLSpanElement> | undefined;
|
|
864
864
|
'data-name': string;
|
|
865
865
|
} | {
|
|
866
|
-
color?: import('../../../types
|
|
866
|
+
color?: import('../../../types').Colors;
|
|
867
867
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
868
868
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
869
869
|
iconWidth?: string;
|
|
@@ -1149,7 +1149,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
1149
1149
|
Cmp: FunctionComponent<PropsWithChildren<any>>;
|
|
1150
1150
|
} | {
|
|
1151
1151
|
attrs: {
|
|
1152
|
-
color?: import('../../../types
|
|
1152
|
+
color?: import('../../../types').Colors;
|
|
1153
1153
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
1154
1154
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
1155
1155
|
iconWidth?: string;
|
|
@@ -1435,7 +1435,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
1435
1435
|
'data-name': string;
|
|
1436
1436
|
disabled: boolean | undefined;
|
|
1437
1437
|
} | {
|
|
1438
|
-
color?: import('../../../types
|
|
1438
|
+
color?: import('../../../types').Colors;
|
|
1439
1439
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
1440
1440
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
1441
1441
|
iconWidth?: string;
|
|
@@ -1720,7 +1720,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
1720
1720
|
'data-name': string;
|
|
1721
1721
|
disabled: boolean | undefined;
|
|
1722
1722
|
} | {
|
|
1723
|
-
color?: import('../../../types
|
|
1723
|
+
color?: import('../../../types').Colors;
|
|
1724
1724
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
1725
1725
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
1726
1726
|
iconWidth?: string;
|
|
@@ -1998,7 +1998,7 @@ export declare function useButton({ component, disabled, ...props }: AnyButtonPr
|
|
|
1998
1998
|
type: string;
|
|
1999
1999
|
disabled: boolean | undefined;
|
|
2000
2000
|
} | {
|
|
2001
|
-
color?: import('../../../types
|
|
2001
|
+
color?: import('../../../types').Colors;
|
|
2002
2002
|
icon?: import('@clubmed/trident-icons').IconicNames;
|
|
2003
2003
|
iconType?: import('@clubmed/trident-icons').IconicTypes;
|
|
2004
2004
|
iconWidth?: string;
|
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { c as x } from "../../chunks/index.js";
|
|
3
3
|
import { useValue as f } from "../../hooks/useValue.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { useId as w } from "react";
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
id:
|
|
9
|
-
name: a =
|
|
10
|
-
className:
|
|
6
|
+
function C(s) {
|
|
7
|
+
const n = w(), {
|
|
8
|
+
id: o = n,
|
|
9
|
+
name: a = o,
|
|
10
|
+
className: i,
|
|
11
11
|
checked: h,
|
|
12
12
|
disabled: t,
|
|
13
|
-
width:
|
|
13
|
+
width: l = 56,
|
|
14
14
|
onChange: d,
|
|
15
15
|
tabIndex: m = 0,
|
|
16
16
|
children: p
|
|
17
|
-
} =
|
|
17
|
+
} = s, { value: r, setValue: u } = f({
|
|
18
18
|
initialValue: h,
|
|
19
19
|
name: a,
|
|
20
20
|
onChange: d
|
|
21
21
|
});
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ c(
|
|
23
23
|
"label",
|
|
24
24
|
{
|
|
25
|
-
className: x(
|
|
25
|
+
className: x(i, "relative flex items-center gap-[10px]", {
|
|
26
|
+
"text-b2": !i?.includes("text-"),
|
|
27
|
+
"font-semibold": !i?.includes("font-"),
|
|
26
28
|
"text-grey": t,
|
|
27
29
|
"cursor-pointer": !t
|
|
28
30
|
}),
|
|
29
31
|
"data-testid": "SwitchContainer",
|
|
30
32
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ c("span", { className: "relative", children: [
|
|
32
34
|
/* @__PURE__ */ e(
|
|
33
35
|
"input",
|
|
34
36
|
{
|
|
35
37
|
type: "checkbox",
|
|
36
38
|
name: a,
|
|
37
39
|
tabIndex: m,
|
|
38
|
-
checked:
|
|
40
|
+
checked: r,
|
|
39
41
|
disabled: t,
|
|
40
42
|
role: "switch",
|
|
41
43
|
className: "absolute w-full h-full opacity-0 cursor-pointer",
|
|
42
44
|
onChange: () => {
|
|
43
|
-
!t && u(!
|
|
45
|
+
!t && u(!r);
|
|
44
46
|
},
|
|
45
47
|
"data-name": "Switch"
|
|
46
48
|
}
|
|
47
49
|
),
|
|
48
|
-
/* @__PURE__ */ e("span", { style: { height:
|
|
50
|
+
/* @__PURE__ */ e("span", { style: { height: l * 4 / 7, width: l }, children: /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: l * 3 / 7, children: /* @__PURE__ */ c("g", { children: [
|
|
49
51
|
/* @__PURE__ */ e("circle", { cx: 12, cy: 12, r: 12, fill: "hsl(var(--color-white))" }),
|
|
50
52
|
/* @__PURE__ */ e("circle", { cx: 12, cy: 12, r: 4, fill: "hsl(var(--color-grey))" })
|
|
51
53
|
] }) }) })
|
|
52
54
|
] }),
|
|
53
|
-
/* @__PURE__ */ e("span", {
|
|
55
|
+
/* @__PURE__ */ e("span", { children: p })
|
|
54
56
|
]
|
|
55
57
|
}
|
|
56
58
|
);
|
|
57
59
|
}
|
|
58
60
|
export {
|
|
59
|
-
|
|
61
|
+
C as Switch
|
|
60
62
|
};
|
|
61
63
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../lib/molecules/Forms/Switch.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useValue } from '@/hooks/useValue.js';\nimport './controls.css';\nimport type { FormControlProps } from './FormControl.js';\nimport { useId } from 'react';\n\nexport interface SwitchProps extends FormControlProps<boolean> {\n width?: number;\n}\n\nexport function Switch(props: SwitchProps) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n checked: initialChecked,\n disabled,\n width = 56,\n onChange,\n tabIndex = 0,\n children,\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n initialValue: initialChecked,\n name,\n onChange,\n });\n\n return (\n <label\n className={classnames(className, 'relative flex items-center gap-[10px]', {\n 'text-grey': disabled,\n 'cursor-pointer': !disabled,\n })}\n data-testid=\"SwitchContainer\"\n >\n <span className=\"relative\">\n <input\n type=\"checkbox\"\n name={name}\n tabIndex={tabIndex}\n checked={checked}\n disabled={disabled}\n role=\"switch\"\n className=\"absolute w-full h-full opacity-0 cursor-pointer\"\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n data-name=\"Switch\"\n />\n\n <span style={{ height: (width * 4) / 7, width }}>\n <svg viewBox=\"0 0 24 24\" width={(width * 3) / 7}>\n <g>\n <circle cx={12} cy={12} r={12} fill=\"hsl(var(--color-white))\" />\n <circle cx={12} cy={12} r={4} fill=\"hsl(var(--color-grey))\" />\n </g>\n </svg>\n </span>\n </span>\n\n <span
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../lib/molecules/Forms/Switch.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useValue } from '@/hooks/useValue.js';\nimport './controls.css';\nimport type { FormControlProps } from './FormControl.js';\nimport { useId } from 'react';\n\nexport interface SwitchProps extends FormControlProps<boolean> {\n width?: number;\n}\n\nexport function Switch(props: SwitchProps) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n checked: initialChecked,\n disabled,\n width = 56,\n onChange,\n tabIndex = 0,\n children,\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n initialValue: initialChecked,\n name,\n onChange,\n });\n\n return (\n <label\n className={classnames(className, 'relative flex items-center gap-[10px]', {\n 'text-b2': !className?.includes('text-'),\n 'font-semibold': !className?.includes('font-'),\n 'text-grey': disabled,\n 'cursor-pointer': !disabled,\n })}\n data-testid=\"SwitchContainer\"\n >\n <span className=\"relative\">\n <input\n type=\"checkbox\"\n name={name}\n tabIndex={tabIndex}\n checked={checked}\n disabled={disabled}\n role=\"switch\"\n className=\"absolute w-full h-full opacity-0 cursor-pointer\"\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n data-name=\"Switch\"\n />\n\n <span style={{ height: (width * 4) / 7, width }}>\n <svg viewBox=\"0 0 24 24\" width={(width * 3) / 7}>\n <g>\n <circle cx={12} cy={12} r={12} fill=\"hsl(var(--color-white))\" />\n <circle cx={12} cy={12} r={4} fill=\"hsl(var(--color-grey))\" />\n </g>\n </svg>\n </span>\n </span>\n\n <span>{children}</span>\n </label>\n );\n}\n"],"names":["Switch","props","internalId","useId","id","name","className","initialChecked","disabled","width","onChange","tabIndex","children","checked","setValue","useValue","jsxs","classnames","jsx"],"mappings":";;;;;AAUO,SAASA,EAAOC,GAAoB;AACzC,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,SAASC;AAAA,IACT,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,EAAA,IACEX,GA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,EAAA;AAGtB;"}
|
package/molecules/Tag.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IconicNames } from '@clubmed/trident-icons';
|
|
2
|
-
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
3
3
|
import { BgColor, BorderColor, TextColor } from '../helpers/colors/colors.js';
|
|
4
4
|
import { LiteralUnion } from '../types/LiteralUnion';
|
|
5
|
-
|
|
5
|
+
import { IconProps } from '../atoms/Icons/contexts/IconsContext';
|
|
6
|
+
export interface TagProps extends Omit<ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
6
7
|
/**
|
|
7
8
|
* Additional class names
|
|
8
9
|
*/
|
|
@@ -35,6 +36,7 @@ export interface TagProps {
|
|
|
35
36
|
* Icon class name
|
|
36
37
|
*/
|
|
37
38
|
iconClassName?: string;
|
|
39
|
+
iconWidth?: IconProps['width'];
|
|
38
40
|
/**
|
|
39
41
|
* Label class name
|
|
40
42
|
*/
|
package/molecules/Tag.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Icon as
|
|
1
|
+
import { jsxs as y, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as N } from "@clubmed/trident-icons";
|
|
3
3
|
import { c as n } from "../chunks/index.js";
|
|
4
|
-
import { getBorderColor as
|
|
5
|
-
const
|
|
4
|
+
import { getBorderColor as j, getBgColor as B, getTextColor as I } from "../helpers/colors/colors.js";
|
|
5
|
+
const q = ({
|
|
6
6
|
className: i,
|
|
7
7
|
backgroundColor: l = "saffron",
|
|
8
8
|
border: m = l,
|
|
@@ -11,14 +11,18 @@ const z = ({
|
|
|
11
11
|
label: e = "",
|
|
12
12
|
theme: r = "both",
|
|
13
13
|
iconClassName: d,
|
|
14
|
-
labelClassName: b
|
|
14
|
+
labelClassName: b,
|
|
15
|
+
iconWidth: h,
|
|
16
|
+
...f
|
|
15
17
|
}) => {
|
|
16
18
|
if (!e && !t)
|
|
17
19
|
return null;
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
const x = j(m), g = B(l), w = I(c), a = !!t, o = r === "both" && !a ? "label" : r, p = o === "both" || o === "swap" || o === "unfold" || o === "none", u = a && (o === "icon" || p), C = o === "label" || o === "pill" || p;
|
|
21
|
+
return /* @__PURE__ */ y(
|
|
20
22
|
"span",
|
|
21
23
|
{
|
|
24
|
+
role: "note",
|
|
25
|
+
...f,
|
|
22
26
|
"data-name": "Tag",
|
|
23
27
|
className: n(
|
|
24
28
|
"box-border inline-flex items-center justify-center gap-x-4 whitespace-nowrap rounded-pill border align-middle font-sans font-semibold",
|
|
@@ -34,24 +38,23 @@ const z = ({
|
|
|
34
38
|
"sm:px-16": o === "swap",
|
|
35
39
|
"sm:pe-16 sm:ps-12": o === "unfold"
|
|
36
40
|
},
|
|
37
|
-
h,
|
|
38
|
-
f,
|
|
39
41
|
x,
|
|
42
|
+
g,
|
|
43
|
+
w,
|
|
40
44
|
i
|
|
41
45
|
),
|
|
42
46
|
title: e,
|
|
43
|
-
role: "note",
|
|
44
47
|
children: [
|
|
45
48
|
o === "monogram" && /* @__PURE__ */ s("span", { className: "size-24 text-center leading-[1.5rem]", children: e }),
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
u && /* @__PURE__ */ s(
|
|
50
|
+
N,
|
|
48
51
|
{
|
|
49
|
-
width: "1.5rem",
|
|
52
|
+
width: h ?? "1.5rem",
|
|
50
53
|
name: t,
|
|
51
54
|
className: n({ "sm:hidden": o === "swap" }, d)
|
|
52
55
|
}
|
|
53
56
|
),
|
|
54
|
-
|
|
57
|
+
C && /* @__PURE__ */ s(
|
|
55
58
|
"span",
|
|
56
59
|
{
|
|
57
60
|
className: n(
|
|
@@ -68,6 +71,6 @@ const z = ({
|
|
|
68
71
|
);
|
|
69
72
|
};
|
|
70
73
|
export {
|
|
71
|
-
|
|
74
|
+
q as Tag
|
|
72
75
|
};
|
|
73
76
|
//# sourceMappingURL=Tag.js.map
|
package/molecules/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../lib/molecules/Tag.tsx"],"sourcesContent":["import { Icon, type IconicNames } from '@clubmed/trident-icons';\nimport classNames from 'classnames';\nimport type { FunctionComponent } from 'react';\n\nimport {\n type BgColor,\n type BorderColor,\n getBgColor,\n getBorderColor,\n getTextColor,\n type TextColor,\n} from '@/helpers/colors/colors.js';\nimport type { LiteralUnion } from '@/types/LiteralUnion';\n\nexport interface TagProps {\n /**\n * Additional class names\n */\n className?: string;\n /**\n * Background color\n */\n backgroundColor?: LiteralUnion<BgColor>;\n /**\n * Text color\n */\n color?: LiteralUnion<TextColor>;\n /**\n * Border color\n */\n border?: LiteralUnion<BorderColor>;\n /**\n * Optional icon name\n */\n icon?: IconicNames;\n /**\n * Tag label\n */\n label?: string;\n /**\n * theme mode\n */\n theme?: 'icon' | 'label' | 'both' | 'swap' | 'unfold' | 'monogram' | 'pill' | 'none';\n /**\n * Icon class name\n */\n iconClassName?: string;\n /**\n * Label class name\n */\n labelClassName?: string;\n}\n\nexport const Tag: FunctionComponent<TagProps> = ({\n className,\n backgroundColor = 'saffron',\n border = backgroundColor,\n color = 'black',\n icon,\n label = '',\n theme = 'both',\n iconClassName,\n labelClassName,\n}) => {\n if (!label && !icon) {\n return null;\n }\n\n const borderColor = getBorderColor(border);\n const bgColor = getBgColor(backgroundColor);\n const textColor = getTextColor(color);\n\n const hasIcon = !!icon;\n const mode = theme === 'both' && !hasIcon ? 'label' : theme;\n\n const withBoth = mode === 'both' || mode === 'swap' || mode === 'unfold' || mode === 'none';\n const withIcon = hasIcon && (mode === 'icon' || withBoth);\n const withLabel = mode === 'label' || mode === 'pill' || withBoth;\n\n return (\n <span\n data-name=\"Tag\"\n className={classNames(\n 'box-border inline-flex items-center justify-center gap-x-4 whitespace-nowrap rounded-pill border align-middle font-sans font-semibold',\n {\n 'text-b4': mode !== 'pill',\n 'text-b5': mode === 'pill',\n },\n {\n 'p-4': mode !== 'label' && mode !== 'both',\n 'px-16 py-6': mode === 'label',\n 'py-4 pe-16 ps-12': mode === 'both',\n 'px-8 py-4': mode === 'pill',\n 'sm:px-16': mode === 'swap',\n 'sm:pe-16 sm:ps-12': mode === 'unfold',\n },\n borderColor,\n bgColor,\n textColor,\n className,\n )}\n title={label}\n
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../lib/molecules/Tag.tsx"],"sourcesContent":["import { Icon, type IconicNames } from '@clubmed/trident-icons';\nimport classNames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport {\n type BgColor,\n type BorderColor,\n getBgColor,\n getBorderColor,\n getTextColor,\n type TextColor,\n} from '@/helpers/colors/colors.js';\nimport type { LiteralUnion } from '@/types/LiteralUnion';\nimport type { IconProps } from '@/atoms/Icons/contexts/IconsContext';\n\nexport interface TagProps extends Omit<ComponentPropsWithoutRef<'span'>, 'color'> {\n /**\n * Additional class names\n */\n className?: string;\n /**\n * Background color\n */\n backgroundColor?: LiteralUnion<BgColor>;\n /**\n * Text color\n */\n color?: LiteralUnion<TextColor>;\n /**\n * Border color\n */\n border?: LiteralUnion<BorderColor>;\n /**\n * Optional icon name\n */\n icon?: IconicNames;\n /**\n * Tag label\n */\n label?: string;\n /**\n * theme mode\n */\n theme?: 'icon' | 'label' | 'both' | 'swap' | 'unfold' | 'monogram' | 'pill' | 'none';\n /**\n * Icon class name\n */\n iconClassName?: string;\n iconWidth?: IconProps['width'];\n /**\n * Label class name\n */\n labelClassName?: string;\n}\n\nexport const Tag: FunctionComponent<TagProps> = ({\n className,\n backgroundColor = 'saffron',\n border = backgroundColor,\n color = 'black',\n icon,\n label = '',\n theme = 'both',\n iconClassName,\n labelClassName,\n iconWidth,\n ...attrs\n}) => {\n if (!label && !icon) {\n return null;\n }\n\n const borderColor = getBorderColor(border);\n const bgColor = getBgColor(backgroundColor);\n const textColor = getTextColor(color);\n\n const hasIcon = !!icon;\n const mode = theme === 'both' && !hasIcon ? 'label' : theme;\n\n const withBoth = mode === 'both' || mode === 'swap' || mode === 'unfold' || mode === 'none';\n const withIcon = hasIcon && (mode === 'icon' || withBoth);\n const withLabel = mode === 'label' || mode === 'pill' || withBoth;\n\n return (\n <span\n role=\"note\"\n {...attrs}\n data-name=\"Tag\"\n className={classNames(\n 'box-border inline-flex items-center justify-center gap-x-4 whitespace-nowrap rounded-pill border align-middle font-sans font-semibold',\n {\n 'text-b4': mode !== 'pill',\n 'text-b5': mode === 'pill',\n },\n {\n 'p-4': mode !== 'label' && mode !== 'both',\n 'px-16 py-6': mode === 'label',\n 'py-4 pe-16 ps-12': mode === 'both',\n 'px-8 py-4': mode === 'pill',\n 'sm:px-16': mode === 'swap',\n 'sm:pe-16 sm:ps-12': mode === 'unfold',\n },\n borderColor,\n bgColor,\n textColor,\n className,\n )}\n title={label}\n >\n {mode === 'monogram' && <span className=\"size-24 text-center leading-[1.5rem]\">{label}</span>}\n {withIcon && (\n <Icon\n width={iconWidth ?? '1.5rem'}\n name={icon}\n className={classNames({ 'sm:hidden': mode === 'swap' }, iconClassName)}\n />\n )}\n {withLabel && (\n <span\n className={classNames(\n {\n 'hidden sm:block': mode === 'swap' || mode === 'unfold',\n },\n labelClassName,\n )}\n >\n {label}\n </span>\n )}\n </span>\n );\n};\n"],"names":["Tag","className","backgroundColor","border","color","icon","label","theme","iconClassName","labelClassName","iconWidth","attrs","borderColor","getBorderColor","bgColor","getBgColor","textColor","getTextColor","hasIcon","mode","withBoth","withIcon","withLabel","jsxs","classNames","jsx","Icon"],"mappings":";;;;AAuDO,MAAMA,IAAmC,CAAC;AAAA,EAC/C,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,QAAAC,IAASD;AAAA,EACT,OAAAE,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,eAAAC;AAAA,E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AAA,cACT;AAAA,gBACE,mBAAmBL,MAAS,UAAUA,MAAS;AAAA,cAAA;AAAA,cAEjDV;AAAA,YAAA;AAAA,YAGD,UAAAH;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clubmed/trident-ui",
|
|
3
|
-
"version": "1.3.0-rc.
|
|
3
|
+
"version": "1.3.0-rc.4",
|
|
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",
|
|
@@ -88,9 +88,14 @@
|
|
|
88
88
|
"default": "./types/*.js"
|
|
89
89
|
},
|
|
90
90
|
"./utils/*": {
|
|
91
|
-
"types": "./
|
|
92
|
-
"import": "./
|
|
93
|
-
"default": "./
|
|
91
|
+
"types": "./helpers/*.d.ts",
|
|
92
|
+
"import": "./helpers/*.js",
|
|
93
|
+
"default": "./helpers/*.js"
|
|
94
|
+
},
|
|
95
|
+
"./helpers/*": {
|
|
96
|
+
"types": "./helpers/*.d.ts",
|
|
97
|
+
"import": "./helpers/*.js",
|
|
98
|
+
"default": "./helpers/*.js"
|
|
94
99
|
}
|
|
95
100
|
},
|
|
96
101
|
"scripts": {
|
package/types/Colors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Colors.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Direction = 'ltr' | 'rtl';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Direction.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiteralUnion.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollerLabels.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types/Theme.d.ts
ADDED
package/types/Theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Theme.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types/index.d.ts
ADDED
package/types/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/types/Colors.d.js
DELETED
package/types/Colors.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Colors.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types/Direction.d.js
DELETED
package/types/Direction.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Direction.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types/LiteralUnion.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiteralUnion.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollerLabels.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/types/Theme.d.js
DELETED
package/types/Theme.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|