@clubmed/trident-ui 1.3.0-beta.12 → 1.3.0-beta.13
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/.npm/_logs/2025-08-08T15_19_22_167Z-debug-0.log +19 -0
- package/.npm/_logs/2025-08-08T15_19_22_257Z-debug-0.log +14 -0
- package/CHANGELOG.md +7 -0
- package/README.md +8 -0
- package/assets/{style.css → trident-ui.css} +1 -1
- package/atoms/Clickable/Clickable.d.ts +2 -2
- package/atoms/Heading/Heading.d.ts +1 -1
- package/atoms/Heading/HeadingGroup.d.ts +2 -2
- package/atoms/Icons/Iconics.d.ts +1 -1
- package/atoms/Icons/IconsResolver.d.ts +1 -1
- package/atoms/Icons/contexts/IconsContext.d.ts +1 -1
- package/atoms/Icons/svg/SvgIcon.d.ts +1 -1
- package/atoms/Icons/svg-use/SvgUseIcon.d.ts +1 -1
- package/atoms/Image/Image.d.ts +1 -1
- package/atoms/Image/Image.js +12 -12
- package/atoms/Image/Image.js.map +1 -1
- package/atoms/Prose/Prose.d.ts +2 -2
- package/chunks/ResizeObserver.js +1 -1
- package/chunks/ResizeObserver.js.map +1 -1
- package/chunks/_commonjsHelpers.js +19 -14
- package/chunks/_commonjsHelpers.js.map +1 -1
- package/chunks/index.js +36 -33
- package/chunks/index.js.map +1 -1
- package/chunks/plugin.js +57 -46
- package/chunks/plugin.js.map +1 -1
- package/contexts/Devices/Device.d.ts +3 -3
- package/contexts/Devices/hooks/useQueries.d.ts +2 -2
- package/contexts/Devices/reducers/reducer.d.ts +2 -2
- package/contexts/TridentUIConfig.d.ts +1 -1
- package/contexts/TridentUIConfig.js +1265 -653
- package/contexts/TridentUIConfig.js.map +1 -1
- package/helpers/colors/colors.d.ts +1 -1
- package/hooks/useKeyboardControls.d.ts +1 -1
- package/hooks/useResizeObserver.d.ts +1 -1
- package/hooks/useSafeBoop.d.ts +2 -2
- package/molecules/Arrows/Arrows.d.ts +2 -2
- package/molecules/Avatar.d.ts +1 -1
- package/molecules/Avatar.js +24 -24
- package/molecules/Avatar.js.map +1 -1
- package/molecules/Backdrop.d.ts +1 -1
- package/molecules/Breadcrumb.d.ts +2 -3
- package/molecules/Breadcrumb.js +25 -36
- package/molecules/Breadcrumb.js.map +1 -1
- package/molecules/Breadcrumb.themes.d.ts +1 -1
- package/molecules/Buttons/ArrowButton.d.ts +1 -1
- package/molecules/Buttons/Button.d.ts +3 -3
- package/molecules/Buttons/ButtonAnchor.d.ts +2 -2
- package/molecules/Buttons/ButtonContent.d.ts +2 -2
- package/molecules/Buttons/FakeButton.d.ts +2 -3
- package/molecules/Buttons/InertButton.d.ts +2 -2
- package/molecules/Buttons/v2/Button.d.ts +2081 -2082
- package/molecules/Buttons/v2/Button.type.d.ts +2 -2
- package/molecules/Cards/Card.d.ts +4 -4
- package/molecules/Cards/CardBackground.d.ts +2 -2
- package/molecules/Cards/CardBackground.js +17 -17
- package/molecules/Cards/CardBackground.js.map +1 -1
- package/molecules/Cards/CardBackgroundContext.d.ts +1 -1
- package/molecules/Cards/CardClickable.d.ts +1 -1
- package/molecules/Cards/ExpandableCard.d.ts +3 -3
- package/molecules/Cards/ExpandableCard.js +41 -41
- package/molecules/Cards/ExpandableCard.js.map +1 -1
- package/molecules/Cards/v2/Card.d.ts +1 -1
- package/molecules/Cards/v2/Card.js +13 -13
- package/molecules/Cards/v2/Card.js.map +1 -1
- package/molecules/Chip.d.ts +3 -3
- package/molecules/Chip.themes.d.ts +1 -1
- package/molecules/ElasticHeight.d.ts +1 -1
- package/molecules/ElasticHeight.js +20 -21
- package/molecules/ElasticHeight.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.d.ts +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js +43 -43
- package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkboxes.d.ts +2 -2
- package/molecules/Forms/DateField.d.ts +2 -2
- package/molecules/Forms/DateField.js +60 -61
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.d.ts +1 -2
- package/molecules/Forms/Filter.js +29 -29
- package/molecules/Forms/Filter.js.map +1 -1
- package/molecules/Forms/FormControl.d.ts +4 -4
- package/molecules/Forms/FormLabel.d.ts +1 -1
- package/molecules/Forms/NumberField.d.ts +278 -278
- package/molecules/Forms/Password/Password.d.ts +1 -1
- package/molecules/Forms/Password/ValidationMessage.d.ts +1 -1
- package/molecules/Forms/Radios/Radio.d.ts +1 -2
- package/molecules/Forms/Radios/Radio.js +30 -30
- package/molecules/Forms/Radios/Radio.js.map +1 -1
- package/molecules/Forms/Radios/RadioGroup.d.ts +2 -2
- package/molecules/Forms/Radios/RadioGroup.js +50 -52
- package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
- package/molecules/Forms/Range.d.ts +1 -2
- package/molecules/Forms/Range.js +118 -113
- package/molecules/Forms/Range.js.map +1 -1
- package/molecules/Forms/Select.d.ts +3 -3
- package/molecules/Forms/Switch.d.ts +1 -1
- package/molecules/Forms/TextField.d.ts +3 -3
- package/molecules/HamburgerIcon.d.ts +1 -1
- package/molecules/Link.d.ts +2 -2
- package/molecules/Loader.d.ts +1 -1
- package/molecules/Pagination.d.ts +2 -2
- package/molecules/Popin.d.ts +1 -1
- package/molecules/Spinner.d.ts +1 -1
- package/molecules/Tabs/Tab.d.ts +2 -3
- package/molecules/Tabs/Tab.js +41 -42
- package/molecules/Tabs/Tab.js.map +1 -1
- package/molecules/Tabs/TabList.d.ts +1 -1
- package/molecules/Tabs/TabList.js +21 -21
- package/molecules/Tabs/TabList.js.map +1 -1
- package/molecules/Tabs/TabPanel.d.ts +1 -1
- package/molecules/Tabs/TabPanel.js +13 -13
- package/molecules/Tabs/TabPanel.js.map +1 -1
- package/molecules/Tabs/Tabs.d.ts +1 -1
- package/molecules/Tabs/TabsBody.d.ts +1 -1
- package/molecules/Tabs/context/TabControl.d.ts +2 -2
- package/molecules/Tabs/hooks/tabControl.d.ts +5 -5
- package/molecules/Tag.d.ts +4 -4
- package/package.json +29 -32
- package/tailwind/plugins/animationDelay.d.ts +2 -2
- package/tailwind/plugins/hocus.d.ts +2 -2
- package/tailwind/plugins/lineClampFix.d.ts +2 -2
- package/tailwind/plugins/popover.d.ts +2 -2
- package/tailwind/plugins/startingStyle.d.ts +2 -2
- package/tailwind/plugins/transitionBehavior.d.ts +2 -2
- package/tailwind/tailwind.preset.d.ts +50 -50
- package/tests/helpers/device.d.ts +14 -0
- package/tests/helpers/device.js +13426 -0
- package/tests/helpers/device.js.map +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { IconicNames, IconicTypes } from '@clubmed/trident-icons';
|
|
2
|
+
import { Colors } from '../../../types/Colors';
|
|
3
3
|
export interface ButtonProps {
|
|
4
4
|
color?: Colors;
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { CardProps as CardPropsV2 } from './v2/Card';
|
|
3
|
+
import { IconicNames, IconicTypes } from '@clubmed/trident-icons';
|
|
4
|
+
import { ChipProps } from '../Chip';
|
|
5
5
|
interface CardProps extends Omit<CardPropsV2, 'theme'> {
|
|
6
6
|
title: string;
|
|
7
7
|
icon: IconicNames;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
|
+
import { ImageProps } from '../../atoms/Image/Image';
|
|
3
3
|
export type CardBackgroundProps = ComponentPropsWithoutRef<'div'> & Partial<ImageProps>;
|
|
4
4
|
export declare const CardBackground: FunctionComponent<CardBackgroundProps>;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsxs as a, Fragment as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as s } from "../../chunks/index.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Image as
|
|
5
|
-
import { CardBackgroundContext as
|
|
6
|
-
const
|
|
7
|
-
children:
|
|
8
|
-
className:
|
|
9
|
-
...
|
|
10
|
-
}) => /* @__PURE__ */
|
|
11
|
-
|
|
12
|
-
/* @__PURE__ */
|
|
4
|
+
import { Image as m } from "../../atoms/Image/Image.js";
|
|
5
|
+
import { CardBackgroundContext as l } from "./CardBackgroundContext.js";
|
|
6
|
+
const u = ({
|
|
7
|
+
children: o,
|
|
8
|
+
className: n,
|
|
9
|
+
...r
|
|
10
|
+
}) => /* @__PURE__ */ a(c, { children: [
|
|
11
|
+
r?.src && /* @__PURE__ */ e(m, { ...r, src: r.src, className: "h-full w-full object-cover" }),
|
|
12
|
+
/* @__PURE__ */ e(
|
|
13
13
|
"div",
|
|
14
14
|
{
|
|
15
|
-
...
|
|
16
|
-
className:
|
|
15
|
+
...r,
|
|
16
|
+
className: s(
|
|
17
17
|
"pointer-events-none absolute inset-0 flex flex-col rounded-16",
|
|
18
18
|
{
|
|
19
|
-
"bg-gradient-to-b from-transparent via-transparent to-black/40":
|
|
19
|
+
"bg-gradient-to-b from-transparent via-transparent to-black/40": r?.src
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
n
|
|
22
22
|
),
|
|
23
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ e(l.Provider, { value: { hasImage: !!r?.src }, children: o })
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
26
|
] });
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
u as CardBackground
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=CardBackground.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardBackground.js","sources":["../../../lib/molecules/Cards/CardBackground.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type ComponentPropsWithoutRef, type FunctionComponent } from 'react';\nimport { Image, type ImageProps } from '@/atoms/Image/Image';\nimport { CardBackgroundContext } from './CardBackgroundContext';\n\nexport type CardBackgroundProps = ComponentPropsWithoutRef<'div'> & Partial<ImageProps>;\n\nexport const CardBackground: FunctionComponent<CardBackgroundProps> = ({\n children,\n className,\n ...attrs\n}) => {\n return (\n <>\n {attrs?.src && <Image {...attrs} src={attrs.src} className=\"h-full w-full object-cover\" />}\n\n <div\n {...attrs}\n className={classnames(\n 'pointer-events-none absolute inset-0 flex flex-col rounded-16',\n {\n 'bg-gradient-to-b from-transparent via-transparent to-black/40': attrs?.src,\n },\n className,\n )}\n >\n <CardBackgroundContext.Provider value={{ hasImage: !!attrs?.src }}>\n {children}\n </CardBackgroundContext.Provider>\n </div>\n </>\n );\n};\n"],"names":["CardBackground","children","className","attrs","jsxs","Fragment","Image","jsx","classnames","CardBackgroundContext"],"mappings":";;;;;AAOO,MAAMA,IAAyD,CAAC;AAAA,EACrE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"CardBackground.js","sources":["../../../lib/molecules/Cards/CardBackground.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type ComponentPropsWithoutRef, type FunctionComponent } from 'react';\nimport { Image, type ImageProps } from '@/atoms/Image/Image';\nimport { CardBackgroundContext } from './CardBackgroundContext';\n\nexport type CardBackgroundProps = ComponentPropsWithoutRef<'div'> & Partial<ImageProps>;\n\nexport const CardBackground: FunctionComponent<CardBackgroundProps> = ({\n children,\n className,\n ...attrs\n}) => {\n return (\n <>\n {attrs?.src && <Image {...attrs} src={attrs.src} className=\"h-full w-full object-cover\" />}\n\n <div\n {...attrs}\n className={classnames(\n 'pointer-events-none absolute inset-0 flex flex-col rounded-16',\n {\n 'bg-gradient-to-b from-transparent via-transparent to-black/40': attrs?.src,\n },\n className,\n )}\n >\n <CardBackgroundContext.Provider value={{ hasImage: !!attrs?.src }}>\n {children}\n </CardBackgroundContext.Provider>\n </div>\n </>\n );\n};\n"],"names":["CardBackground","children","className","attrs","jsxs","Fragment","Image","jsx","classnames","CardBackgroundContext"],"mappings":";;;;;AAOO,MAAMA,IAAyD,CAAC;AAAA,EACrE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,EAAAF,GAAO,yBAAQG,GAAA,EAAO,GAAGH,GAAO,KAAKA,EAAM,KAAK,WAAU,6BAAA,CAA6B;AAAA,EAExF,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,WAAWK;AAAA,QACT;AAAA,QACA;AAAA,UACE,iEAAiEL,GAAO;AAAA,QAAA;AAAA,QAE1ED;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAK,EAACE,EAAsB,UAAtB,EAA+B,OAAO,EAAE,UAAU,CAAC,CAACN,GAAO,IAAA,GACzD,UAAAF,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AACF,GACF;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps, FunctionComponent } from 'react';
|
|
2
2
|
import { Heading } from '../../atoms/Heading/Heading';
|
|
3
3
|
import { Tag } from '../Tag';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { CardBackgroundProps } from './CardBackground';
|
|
5
|
+
import { CardProps } from './v2/Card';
|
|
6
6
|
export interface ExpandableCardProps extends Omit<CardProps<'article'>, 'onClick'> {
|
|
7
7
|
hLevel?: ComponentProps<typeof Heading>['level'];
|
|
8
8
|
image?: CardBackgroundProps;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as b, createElement as
|
|
4
|
-
import { c } from "../../chunks/index.js";
|
|
5
|
-
import { Clickable as
|
|
6
|
-
import { Tag as
|
|
7
|
-
import { CardBackground as
|
|
8
|
-
import { ElasticHeight as
|
|
9
|
-
import { Card as
|
|
10
|
-
import { HeadingGroup as
|
|
11
|
-
import { Button as
|
|
12
|
-
const
|
|
13
|
-
children:
|
|
14
|
-
className:
|
|
15
|
-
hLevel:
|
|
16
|
-
image:
|
|
17
|
-
onClick:
|
|
18
|
-
subtitle:
|
|
19
|
-
tags:
|
|
20
|
-
title:
|
|
21
|
-
component:
|
|
2
|
+
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useState as b, createElement as k } from "react";
|
|
4
|
+
import { c as s } from "../../chunks/index.js";
|
|
5
|
+
import { Clickable as w } from "../../atoms/Clickable/Clickable.js";
|
|
6
|
+
import { Tag as v } from "../Tag.js";
|
|
7
|
+
import { CardBackground as C } from "./CardBackground.js";
|
|
8
|
+
import { ElasticHeight as E } from "../ElasticHeight.js";
|
|
9
|
+
import { Card as g } from "./v2/Card.js";
|
|
10
|
+
import { HeadingGroup as N } from "../../atoms/Heading/HeadingGroup.js";
|
|
11
|
+
import { Button as B } from "../Buttons/v2/Button.js";
|
|
12
|
+
const q = ({
|
|
13
|
+
children: d,
|
|
14
|
+
className: i,
|
|
15
|
+
hLevel: c = 3,
|
|
16
|
+
image: t,
|
|
17
|
+
onClick: m,
|
|
18
|
+
subtitle: p,
|
|
19
|
+
tags: o,
|
|
20
|
+
title: l,
|
|
21
|
+
component: f = "article",
|
|
22
22
|
...x
|
|
23
23
|
}) => {
|
|
24
|
-
const h = !!
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
24
|
+
const h = !!l, [e, u] = b(!1);
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
26
|
+
g,
|
|
27
27
|
{
|
|
28
|
-
component:
|
|
28
|
+
component: f,
|
|
29
29
|
"data-name": "ExpandableCard",
|
|
30
30
|
"data-testid": "expandable-card",
|
|
31
31
|
...x,
|
|
32
|
-
className:
|
|
33
|
-
"data-open":
|
|
32
|
+
className: s({ "border-t-0": t?.src }, i),
|
|
33
|
+
"data-open": e,
|
|
34
34
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
35
|
+
/* @__PURE__ */ a(
|
|
36
|
+
w,
|
|
37
37
|
{
|
|
38
38
|
className: "group relative -m-1 block aspect-horizontal overflow-hidden rounded-16 text-start",
|
|
39
39
|
"data-testid": "expandable-card-clickable",
|
|
40
40
|
onClick: () => {
|
|
41
|
-
|
|
41
|
+
m?.(!e), u(!e);
|
|
42
42
|
},
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
!!
|
|
45
|
-
/* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ r(C, { ...t || {}, children: [
|
|
44
|
+
!!o?.length && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-4 self-start p-20", children: o?.map((n) => /* @__PURE__ */ k(v, { ...n, key: n.label })) }),
|
|
45
|
+
/* @__PURE__ */ r(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
|
-
className:
|
|
49
|
-
"text-white":
|
|
48
|
+
className: s("mt-auto flex justify-between gap-x-8 p-20", {
|
|
49
|
+
"text-white": t?.src
|
|
50
50
|
}),
|
|
51
51
|
children: [
|
|
52
|
-
h && /* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
|
|
52
|
+
h && /* @__PURE__ */ a(N, { subtitle: p, level: c, children: l }),
|
|
53
|
+
/* @__PURE__ */ a(
|
|
54
|
+
B,
|
|
55
55
|
{
|
|
56
56
|
component: "span",
|
|
57
57
|
className: "!transition duration-500",
|
|
58
|
-
color:
|
|
58
|
+
color: t?.src ? "white" : "black",
|
|
59
59
|
icon: "ArrowDefaultDown",
|
|
60
|
-
style: { rotate:
|
|
60
|
+
style: { rotate: e ? "-180deg" : "0deg" },
|
|
61
61
|
tabIndex: -1,
|
|
62
62
|
theme: "outline",
|
|
63
63
|
variant: "circle"
|
|
@@ -69,12 +69,12 @@ const F = ({
|
|
|
69
69
|
] })
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ a(E, { isExpanded: e, children: d })
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
76
|
};
|
|
77
77
|
export {
|
|
78
|
-
|
|
78
|
+
q as ExpandableCard
|
|
79
79
|
};
|
|
80
80
|
//# sourceMappingURL=ExpandableCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableCard.js","sources":["../../../lib/molecules/Cards/ExpandableCard.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport { type ComponentProps, type FunctionComponent, useState } from 'react';\n\nimport { Clickable } from '../../atoms/Clickable/Clickable';\nimport { Heading } from '../../atoms/Heading/Heading';\nimport { Tag } from '../Tag';\nimport { CardBackground, type CardBackgroundProps } from '@/molecules/Cards/CardBackground';\nimport { ElasticHeight } from '@/molecules/ElasticHeight';\nimport { Card, type CardProps } from '@/molecules/Cards/v2/Card';\nimport { HeadingGroup } from '@/atoms/Heading/HeadingGroup';\nimport { Button } from '@/molecules/Buttons/v2/Button';\n\nexport interface ExpandableCardProps extends Omit<CardProps<'article'>, 'onClick'> {\n hLevel?: ComponentProps<typeof Heading>['level'];\n image?: CardBackgroundProps;\n onClick?: (isExpanded: boolean) => void;\n subtitle?: string | null;\n tags?: ComponentProps<typeof Tag>[] | null;\n title: string;\n}\n\nexport const ExpandableCard: FunctionComponent<ExpandableCardProps> = ({\n children,\n className,\n hLevel = 3,\n image,\n onClick,\n subtitle,\n tags,\n title,\n component = 'article',\n ...attrs\n}) => {\n const hasTitle = Boolean(title);\n\n const [isExpanded, setIsExpanded] = useState(false);\n\n return (\n <Card<'article'>\n component={component}\n data-name=\"ExpandableCard\"\n data-testid=\"expandable-card\"\n {...attrs}\n className={classnames({ 'border-t-0': image?.src }, className)}\n data-open={isExpanded}\n >\n <Clickable\n className=\"group relative -m-1 block aspect-horizontal overflow-hidden rounded-16 text-start\"\n data-testid=\"expandable-card-clickable\"\n onClick={() => {\n onClick?.(!isExpanded);\n setIsExpanded(!isExpanded);\n }}\n >\n <CardBackground {...(image || {})}>\n {Boolean(tags?.length) && (\n <div className=\"flex flex-wrap gap-4 self-start p-20\">\n {tags?.map((tag) => <Tag {...tag} key={tag.label} />)}\n </div>\n )}\n <div\n className={classnames('mt-auto flex justify-between gap-x-8 p-20', {\n 'text-white': image?.src,\n })}\n >\n {hasTitle && (\n <HeadingGroup subtitle={subtitle} level={hLevel}>\n {title}\n </HeadingGroup>\n )}\n <Button\n component=\"span\"\n className=\"!transition duration-500\"\n color={image?.src ? 'white' : 'black'}\n icon=\"ArrowDefaultDown\"\n style={{ rotate: isExpanded ? '-180deg' : '0deg' }}\n tabIndex={-1}\n theme=\"outline\"\n variant=\"circle\"\n />\n </div>\n </CardBackground>\n </Clickable>\n <ElasticHeight isExpanded={isExpanded}>{children}</ElasticHeight>\n </Card>\n );\n};\n"],"names":["ExpandableCard","children","className","hLevel","image","onClick","subtitle","tags","title","component","attrs","hasTitle","isExpanded","setIsExpanded","useState","jsxs","Card","classnames","jsx","Clickable","CardBackground","tag","createElement","Tag","HeadingGroup","Button","ElasticHeight"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,IAAyD,CAAC;AAAA,EACrE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAW,EAAQH,GAEnB,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK;AAElD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAAP;AAAA,MACA,aAAU;AAAA,MACV,eAAY;AAAA,MACX,GAAGC;AAAA,MACJ,WAAWO,EAAW,EAAE,cAAcb,
|
|
1
|
+
{"version":3,"file":"ExpandableCard.js","sources":["../../../lib/molecules/Cards/ExpandableCard.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport { type ComponentProps, type FunctionComponent, useState } from 'react';\n\nimport { Clickable } from '../../atoms/Clickable/Clickable';\nimport { Heading } from '../../atoms/Heading/Heading';\nimport { Tag } from '../Tag';\nimport { CardBackground, type CardBackgroundProps } from '@/molecules/Cards/CardBackground';\nimport { ElasticHeight } from '@/molecules/ElasticHeight';\nimport { Card, type CardProps } from '@/molecules/Cards/v2/Card';\nimport { HeadingGroup } from '@/atoms/Heading/HeadingGroup';\nimport { Button } from '@/molecules/Buttons/v2/Button';\n\nexport interface ExpandableCardProps extends Omit<CardProps<'article'>, 'onClick'> {\n hLevel?: ComponentProps<typeof Heading>['level'];\n image?: CardBackgroundProps;\n onClick?: (isExpanded: boolean) => void;\n subtitle?: string | null;\n tags?: ComponentProps<typeof Tag>[] | null;\n title: string;\n}\n\nexport const ExpandableCard: FunctionComponent<ExpandableCardProps> = ({\n children,\n className,\n hLevel = 3,\n image,\n onClick,\n subtitle,\n tags,\n title,\n component = 'article',\n ...attrs\n}) => {\n const hasTitle = Boolean(title);\n\n const [isExpanded, setIsExpanded] = useState(false);\n\n return (\n <Card<'article'>\n component={component}\n data-name=\"ExpandableCard\"\n data-testid=\"expandable-card\"\n {...attrs}\n className={classnames({ 'border-t-0': image?.src }, className)}\n data-open={isExpanded}\n >\n <Clickable\n className=\"group relative -m-1 block aspect-horizontal overflow-hidden rounded-16 text-start\"\n data-testid=\"expandable-card-clickable\"\n onClick={() => {\n onClick?.(!isExpanded);\n setIsExpanded(!isExpanded);\n }}\n >\n <CardBackground {...(image || {})}>\n {Boolean(tags?.length) && (\n <div className=\"flex flex-wrap gap-4 self-start p-20\">\n {tags?.map((tag) => <Tag {...tag} key={tag.label} />)}\n </div>\n )}\n <div\n className={classnames('mt-auto flex justify-between gap-x-8 p-20', {\n 'text-white': image?.src,\n })}\n >\n {hasTitle && (\n <HeadingGroup subtitle={subtitle} level={hLevel}>\n {title}\n </HeadingGroup>\n )}\n <Button\n component=\"span\"\n className=\"!transition duration-500\"\n color={image?.src ? 'white' : 'black'}\n icon=\"ArrowDefaultDown\"\n style={{ rotate: isExpanded ? '-180deg' : '0deg' }}\n tabIndex={-1}\n theme=\"outline\"\n variant=\"circle\"\n />\n </div>\n </CardBackground>\n </Clickable>\n <ElasticHeight isExpanded={isExpanded}>{children}</ElasticHeight>\n </Card>\n );\n};\n"],"names":["ExpandableCard","children","className","hLevel","image","onClick","subtitle","tags","title","component","attrs","hasTitle","isExpanded","setIsExpanded","useState","jsxs","Card","classnames","jsx","Clickable","CardBackground","tag","createElement","Tag","HeadingGroup","Button","ElasticHeight"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,IAAyD,CAAC;AAAA,EACrE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAW,EAAQH,GAEnB,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK;AAElD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAAP;AAAA,MACA,aAAU;AAAA,MACV,eAAY;AAAA,MACX,GAAGC;AAAA,MACJ,WAAWO,EAAW,EAAE,cAAcb,GAAO,IAAA,GAAOF,CAAS;AAAA,MAC7D,aAAWU;AAAA,MAEX,UAAA;AAAA,QAAA,gBAAAM;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YACZ,SAAS,MAAM;AACb,cAAAd,IAAU,CAACO,CAAU,GACrBC,EAAc,CAACD,CAAU;AAAA,YAC3B;AAAA,YAEA,UAAA,gBAAAG,EAACK,GAAA,EAAgB,GAAIhB,KAAS,CAAA,GAC3B,UAAA;AAAA,cAAA,EAAQG,GAAM,4BACZ,OAAA,EAAI,WAAU,wCACZ,UAAAA,GAAM,IAAI,CAACc,MAAQ,gBAAAC,EAACC,KAAK,GAAGF,GAAK,KAAKA,EAAI,OAAO,CAAE,GACtD;AAAA,cAEF,gBAAAN;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWE,EAAW,6CAA6C;AAAA,oBACjE,cAAcb,GAAO;AAAA,kBAAA,CACtB;AAAA,kBAEA,UAAA;AAAA,oBAAAO,KACC,gBAAAO,EAACM,GAAA,EAAa,UAAAlB,GAAoB,OAAOH,GACtC,UAAAK,GACH;AAAA,oBAEF,gBAAAU;AAAA,sBAACO;AAAA,sBAAA;AAAA,wBACC,WAAU;AAAA,wBACV,WAAU;AAAA,wBACV,OAAOrB,GAAO,MAAM,UAAU;AAAA,wBAC9B,MAAK;AAAA,wBACL,OAAO,EAAE,QAAQQ,IAAa,YAAY,OAAA;AAAA,wBAC1C,UAAU;AAAA,wBACV,OAAM;AAAA,wBACN,SAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACV;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAM,EAACQ,GAAA,EAAc,YAAAd,GAAyB,UAAAX,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGvD;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementType } from 'react';
|
|
2
2
|
import { CARD_ASPECT_RATIOS } from '../CardAspectRatios';
|
|
3
3
|
type CARD_THEME = 'none' | 'bordered' | 'frame';
|
|
4
4
|
export type CardProps<T extends ElementType = 'div'> = {
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { c as m } from "../../../chunks/index.js";
|
|
3
|
-
import { CARD_ASPECT_RATIOS as
|
|
4
|
-
function
|
|
5
|
-
children:
|
|
6
|
-
className:
|
|
3
|
+
import { CARD_ASPECT_RATIOS as l } from "../CardAspectRatios.js";
|
|
4
|
+
function f({
|
|
5
|
+
children: o,
|
|
6
|
+
className: e,
|
|
7
7
|
component: d = "div",
|
|
8
8
|
format: i = "custom",
|
|
9
9
|
theme: t = "bordered",
|
|
10
10
|
...n
|
|
11
11
|
}) {
|
|
12
|
-
const
|
|
12
|
+
const s = d, r = [].concat(t).join(" ");
|
|
13
13
|
return /* @__PURE__ */ c(
|
|
14
|
-
|
|
14
|
+
s,
|
|
15
15
|
{
|
|
16
16
|
...n,
|
|
17
17
|
className: m(
|
|
18
|
-
|
|
18
|
+
l[i],
|
|
19
19
|
"relative isolate rounded-16",
|
|
20
20
|
{
|
|
21
|
-
"bg-white": !
|
|
22
|
-
"group overflow-hidden":
|
|
23
|
-
"border border-lightGrey":
|
|
21
|
+
"bg-white": !e?.includes("bg-"),
|
|
22
|
+
"group overflow-hidden": r.includes("frame"),
|
|
23
|
+
"border border-lightGrey": r.includes("bordered")
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
e
|
|
26
26
|
),
|
|
27
|
-
children:
|
|
27
|
+
children: o
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
f as Card
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../lib/molecules/Cards/v2/Card.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from 'react';\nimport cx from 'classnames';\nimport { CARD_ASPECT_RATIOS } from '../CardAspectRatios';\n\ntype CARD_THEME = 'none' | 'bordered' | 'frame';\n\nexport type CardProps<T extends ElementType = 'div'> = {\n component?: string;\n /**\n * By default the card has a border.\n * Set to false to remove it.\n */\n border?: boolean;\n format?: keyof typeof CARD_ASPECT_RATIOS;\n theme?: CARD_THEME | CARD_THEME[];\n} & ComponentPropsWithoutRef<T>;\n\nexport function Card<T extends ElementType = 'div'>({\n children,\n className,\n component = 'div',\n format = 'custom',\n theme = 'bordered',\n ...attrs\n}: CardProps<T>) {\n const Cmp = component as ElementType;\n const resolvedTheme = ([] as CARD_THEME[]).concat(theme).join(' ');\n\n return (\n <Cmp\n {...attrs}\n className={cx(\n CARD_ASPECT_RATIOS[format],\n 'relative isolate rounded-16',\n {\n 'bg-white': !className?.includes('bg-'),\n 'group overflow-hidden': resolvedTheme.includes('frame'),\n 'border border-lightGrey': resolvedTheme.includes('bordered'),\n },\n className,\n )}\n >\n {children}\n </Cmp>\n );\n}\n"],"names":["Card","children","className","component","format","theme","attrs","Cmp","resolvedTheme","jsx","cx","CARD_ASPECT_RATIOS"],"mappings":";;;AAiBO,SAASA,EAAoC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAS;AAAA,EACT,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACL,GAAiB;AACf,QAAMC,IAAMJ,GACNK,IAAiB,CAAA,EAAoB,OAAOH,CAAK,EAAE,KAAK,GAAG;AAEjE,SACE,gBAAAI;AAAA,IAACF;AAAA,IAAA;AAAA,MACE,GAAGD;AAAA,MACJ,WAAWI;AAAAA,QACTC,EAAmBP,CAAM;AAAA,QACzB;AAAA,QACA;AAAA,UACE,YAAY,
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../lib/molecules/Cards/v2/Card.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from 'react';\nimport cx from 'classnames';\nimport { CARD_ASPECT_RATIOS } from '../CardAspectRatios';\n\ntype CARD_THEME = 'none' | 'bordered' | 'frame';\n\nexport type CardProps<T extends ElementType = 'div'> = {\n component?: string;\n /**\n * By default the card has a border.\n * Set to false to remove it.\n */\n border?: boolean;\n format?: keyof typeof CARD_ASPECT_RATIOS;\n theme?: CARD_THEME | CARD_THEME[];\n} & ComponentPropsWithoutRef<T>;\n\nexport function Card<T extends ElementType = 'div'>({\n children,\n className,\n component = 'div',\n format = 'custom',\n theme = 'bordered',\n ...attrs\n}: CardProps<T>) {\n const Cmp = component as ElementType;\n const resolvedTheme = ([] as CARD_THEME[]).concat(theme).join(' ');\n\n return (\n <Cmp\n {...attrs}\n className={cx(\n CARD_ASPECT_RATIOS[format],\n 'relative isolate rounded-16',\n {\n 'bg-white': !className?.includes('bg-'),\n 'group overflow-hidden': resolvedTheme.includes('frame'),\n 'border border-lightGrey': resolvedTheme.includes('bordered'),\n },\n className,\n )}\n >\n {children}\n </Cmp>\n );\n}\n"],"names":["Card","children","className","component","format","theme","attrs","Cmp","resolvedTheme","jsx","cx","CARD_ASPECT_RATIOS"],"mappings":";;;AAiBO,SAASA,EAAoC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAS;AAAA,EACT,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACL,GAAiB;AACf,QAAMC,IAAMJ,GACNK,IAAiB,CAAA,EAAoB,OAAOH,CAAK,EAAE,KAAK,GAAG;AAEjE,SACE,gBAAAI;AAAA,IAACF;AAAA,IAAA;AAAA,MACE,GAAGD;AAAA,MACJ,WAAWI;AAAAA,QACTC,EAAmBP,CAAM;AAAA,QACzB;AAAA,QACA;AAAA,UACE,YAAY,CAACF,GAAW,SAAS,KAAK;AAAA,UACtC,yBAAyBM,EAAc,SAAS,OAAO;AAAA,UACvD,2BAA2BA,EAAc,SAAS,UAAU;AAAA,QAAA;AAAA,QAE9DN;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
package/molecules/Chip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { Theme } from './Chip.themes';
|
|
3
|
+
import { Colors } from '../types/Colors';
|
|
4
4
|
export interface ChipProps extends ComponentPropsWithoutRef<'span'> {
|
|
5
5
|
color?: Colors;
|
|
6
6
|
size?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
2
|
interface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
3
|
innerClassName?: string;
|
|
4
4
|
isExpanded?: boolean;
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
className:
|
|
8
|
-
children:
|
|
9
|
-
innerClassName:
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { c as u } from "../chunks/index.js";
|
|
4
|
+
import { useRef as l, useState as m, useLayoutEffect as d } from "react";
|
|
5
|
+
import h from "../hooks/useResizeObserver.js";
|
|
6
|
+
const H = ({
|
|
7
|
+
className: i,
|
|
8
|
+
children: o,
|
|
9
|
+
innerClassName: a,
|
|
10
10
|
isExpanded: t = !1,
|
|
11
|
-
min:
|
|
12
|
-
...
|
|
11
|
+
min: n = 0,
|
|
12
|
+
...f
|
|
13
13
|
}) => {
|
|
14
|
-
const e =
|
|
15
|
-
return
|
|
14
|
+
const e = l(null), [c, r] = m(0);
|
|
15
|
+
return h({
|
|
16
16
|
ref: e,
|
|
17
17
|
onResize: () => {
|
|
18
|
-
|
|
19
|
-
e.current && r((s = e.current) == null ? void 0 : s.offsetHeight);
|
|
18
|
+
e.current && r(e.current?.offsetHeight);
|
|
20
19
|
}
|
|
21
|
-
}),
|
|
20
|
+
}), d(() => {
|
|
22
21
|
e.current && r(e.current.offsetHeight);
|
|
23
|
-
}, [e]), /* @__PURE__ */
|
|
22
|
+
}, [e]), /* @__PURE__ */ s(
|
|
24
23
|
"div",
|
|
25
24
|
{
|
|
26
|
-
...
|
|
27
|
-
className:
|
|
25
|
+
...f,
|
|
26
|
+
className: u("overflow-hidden transition-all duration-500", i),
|
|
28
27
|
"data-expanded": t,
|
|
29
|
-
style: { height: t ?
|
|
30
|
-
children: /* @__PURE__ */
|
|
28
|
+
style: { height: t ? c : n },
|
|
29
|
+
children: /* @__PURE__ */ s("div", { className: a, ref: e, children: o })
|
|
31
30
|
}
|
|
32
31
|
);
|
|
33
32
|
};
|
|
34
33
|
export {
|
|
35
|
-
|
|
34
|
+
H as ElasticHeight
|
|
36
35
|
};
|
|
37
36
|
//# sourceMappingURL=ElasticHeight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type ComponentPropsWithoutRef,\n type FunctionComponent,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport useResizeObserver from '@/hooks/useResizeObserver';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n const [max, setMax] = useState(0);\n\n useResizeObserver<HTMLDivElement>({\n ref: ref,\n onResize: () => {\n if (ref.current) {\n setMax(ref.current?.offsetHeight);\n }\n },\n });\n\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n setMax(ref.current.offsetHeight);\n }, [ref]);\n\n return (\n <div\n {...attrs}\n className={classnames('overflow-hidden transition-all duration-500', className)}\n data-expanded={isExpanded}\n style={{ height: isExpanded ? max : min }}\n >\n <div className={innerClassName} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["ElasticHeight","className","children","innerClassName","isExpanded","min","attrs","ref","useRef","max","setMax","useState","useResizeObserver","
|
|
1
|
+
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type ComponentPropsWithoutRef,\n type FunctionComponent,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport useResizeObserver from '@/hooks/useResizeObserver';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n const [max, setMax] = useState(0);\n\n useResizeObserver<HTMLDivElement>({\n ref: ref,\n onResize: () => {\n if (ref.current) {\n setMax(ref.current?.offsetHeight);\n }\n },\n });\n\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n setMax(ref.current.offsetHeight);\n }, [ref]);\n\n return (\n <div\n {...attrs}\n className={classnames('overflow-hidden transition-all duration-500', className)}\n data-expanded={isExpanded}\n style={{ height: isExpanded ? max : min }}\n >\n <div className={innerClassName} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["ElasticHeight","className","children","innerClassName","isExpanded","min","attrs","ref","useRef","max","setMax","useState","useResizeObserver","useLayoutEffect","jsx","classnames"],"mappings":";;;;;AAkBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAW,GACxC,CAACC,GAAKC,CAAM,IAAIC,EAAS,CAAC;AAEhC,SAAAC,EAAkC;AAAA,IAChC,KAAAL;AAAA,IACA,UAAU,MAAM;AACd,MAAIA,EAAI,WACNG,EAAOH,EAAI,SAAS,YAAY;AAAA,IAEpC;AAAA,EAAA,CACD,GAEDM,EAAgB,MAAM;AACpB,IAAKN,EAAI,WAGTG,EAAOH,EAAI,QAAQ,YAAY;AAAA,EACjC,GAAG,CAACA,CAAG,CAAC,GAGN,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,WAAWS,EAAW,+CAA+Cd,CAAS;AAAA,MAC9E,iBAAeG;AAAA,MACf,OAAO,EAAE,QAAQA,IAAaK,IAAMJ,EAAA;AAAA,MAEpC,UAAA,gBAAAS,EAAC,OAAA,EAAI,WAAWX,GAAgB,KAAAI,GAC7B,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as n } from "../../../chunks/index.js";
|
|
3
3
|
import { useId as D } from "react";
|
|
4
4
|
import { useValue as S } from "../../../hooks/useValue.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { useInternalStatus as V } from "../../../hooks/useInternalStatus.js";
|
|
7
|
-
import { Icon as
|
|
8
|
-
function A(
|
|
9
|
-
const
|
|
10
|
-
id: s =
|
|
11
|
-
name:
|
|
12
|
-
className:
|
|
13
|
-
dataTestId:
|
|
7
|
+
import { Icon as h } from "@clubmed/trident-icons";
|
|
8
|
+
function A(p) {
|
|
9
|
+
const u = D(), {
|
|
10
|
+
id: s = u,
|
|
11
|
+
name: o = s,
|
|
12
|
+
className: x,
|
|
13
|
+
dataTestId: f,
|
|
14
14
|
disabled: r = !1,
|
|
15
|
-
checked:
|
|
15
|
+
checked: b = !1,
|
|
16
16
|
value: l,
|
|
17
17
|
size: i = 24,
|
|
18
|
-
tabIndex:
|
|
19
|
-
validationStatus:
|
|
20
|
-
errorMessage:
|
|
21
|
-
children:
|
|
22
|
-
onChange:
|
|
23
|
-
...
|
|
24
|
-
} =
|
|
25
|
-
name:
|
|
26
|
-
initialValue:
|
|
27
|
-
onChange(w,
|
|
28
|
-
|
|
18
|
+
tabIndex: k = 0,
|
|
19
|
+
validationStatus: g = "default",
|
|
20
|
+
errorMessage: c,
|
|
21
|
+
children: v,
|
|
22
|
+
onChange: C,
|
|
23
|
+
...N
|
|
24
|
+
} = p, { value: d, setValue: y } = S({
|
|
25
|
+
name: o,
|
|
26
|
+
initialValue: b,
|
|
27
|
+
onChange(w, m) {
|
|
28
|
+
C?.(w, m ? l !== void 0 ? l : m : null);
|
|
29
29
|
}
|
|
30
30
|
}), e = V({
|
|
31
31
|
isDisabled: r,
|
|
32
|
-
validationStatus:
|
|
33
|
-
}),
|
|
34
|
-
return /* @__PURE__ */
|
|
32
|
+
validationStatus: g
|
|
33
|
+
}), I = e === "error" && c;
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
|
-
className:
|
|
37
|
+
className: n("flex flex-col space-y-2", x),
|
|
38
38
|
"data-testid": `checkbox-container-${s}`,
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ a(
|
|
41
41
|
"label",
|
|
42
42
|
{
|
|
43
|
-
className:
|
|
43
|
+
className: n("cursor-pointer relative flex text-b3 items-center", {
|
|
44
44
|
"text-grey": e === "disabled",
|
|
45
45
|
"text-black": e !== "default"
|
|
46
46
|
}),
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ a("span", { className: "relative self-start me-8", children: [
|
|
49
|
+
/* @__PURE__ */ t(
|
|
50
50
|
"input",
|
|
51
51
|
{
|
|
52
|
-
...
|
|
53
|
-
name:
|
|
54
|
-
"data-testid":
|
|
52
|
+
...N,
|
|
53
|
+
name: o,
|
|
54
|
+
"data-testid": f,
|
|
55
55
|
type: "checkbox",
|
|
56
|
-
tabIndex:
|
|
56
|
+
tabIndex: k,
|
|
57
57
|
onChange: () => {
|
|
58
|
-
!r &&
|
|
58
|
+
!r && y(!d);
|
|
59
59
|
},
|
|
60
|
-
checked:
|
|
60
|
+
checked: d,
|
|
61
61
|
"data-name": "Checkbox",
|
|
62
62
|
disabled: r,
|
|
63
63
|
value: l
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ t(
|
|
67
67
|
"span",
|
|
68
68
|
{
|
|
69
69
|
style: { height: i, width: i },
|
|
70
|
-
className:
|
|
70
|
+
className: n({ "!border-red": e === "error" }),
|
|
71
71
|
"data-testid": `check-container-${s}`,
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
-
|
|
72
|
+
children: /* @__PURE__ */ t(
|
|
73
|
+
h,
|
|
74
74
|
{
|
|
75
75
|
name: "CheckDefault",
|
|
76
76
|
type: "svg",
|
|
@@ -82,13 +82,13 @@ function A(u) {
|
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
] }),
|
|
85
|
-
|
|
85
|
+
v
|
|
86
86
|
]
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
|
-
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
89
|
+
I && /* @__PURE__ */ a("span", { className: "text-red text-b4 flex items-start space-x-4 ps-20", role: "alert", children: [
|
|
90
|
+
/* @__PURE__ */ t(h, { name: "Error", width: "20px" }),
|
|
91
|
+
c
|
|
92
92
|
] })
|
|
93
93
|
]
|
|
94
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Checkbox\"\n disabled={disabled}\n value={value as any}\n />\n\n <span\n style={{ height: size, width: size }}\n className={classnames({ '!border-red': internalStatus === 'error' })}\n data-testid={`check-container-${id}`}\n >\n <Icon\n name=\"CheckDefault\"\n type=\"svg\"\n width={`${size}px`}\n color=\"black\"\n className=\"absolute\"\n />\n </span>\n </span>\n\n {children}\n </label>\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start space-x-4 ps-20\" role=\"alert\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Checkbox","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","size","tabIndex","validationStatus","errorMessage","children","onChange","rest","checked","setValue","useValue","internalStatus","useInternalStatus","shouldDisplayErrorMessage","jsxs","classnames","jsx","Icon"],"mappings":";;;;;;;AAaO,SAASA,EAAyBC,GAA6B;AACpE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDhB,GAEE,EAAE,OAAOiB,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAf;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMa,GAAS;AACtB,MAAAF,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Checkbox\"\n disabled={disabled}\n value={value as any}\n />\n\n <span\n style={{ height: size, width: size }}\n className={classnames({ '!border-red': internalStatus === 'error' })}\n data-testid={`check-container-${id}`}\n >\n <Icon\n name=\"CheckDefault\"\n type=\"svg\"\n width={`${size}px`}\n color=\"black\"\n className=\"absolute\"\n />\n </span>\n </span>\n\n {children}\n </label>\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start space-x-4 ps-20\" role=\"alert\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Checkbox","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","size","tabIndex","validationStatus","errorMessage","children","onChange","rest","checked","setValue","useValue","internalStatus","useInternalStatus","shouldDisplayErrorMessage","jsxs","classnames","jsx","Icon"],"mappings":";;;;;;;AAaO,SAASA,EAAyBC,GAA6B;AACpE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDhB,GAEE,EAAE,OAAOiB,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAf;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMa,GAAS;AACtB,MAAAF,IAAWX,GAAMa,IAAYR,MAAU,SAAYA,IAAQQ,IAAqB,IAAI;AAAA,IACtF;AAAA,EAAA,CACD,GACKG,IAAiBC,EAAkB;AAAA,IACvC,YAAYd;AAAA,IACZ,kBAAAK;AAAA,EAAA,CACD,GAEKU,IAA4BF,MAAmB,WAAWP;AAEhE,SACE,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,2BAA2BnB,CAAS;AAAA,MAC1D,eAAa,sBAAsBF,CAAE;AAAA,MAErC,UAAA;AAAA,QAAA,gBAAAoB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC,EAAW,qDAAqD;AAAA,cACzE,aAAaJ,MAAmB;AAAA,cAChC,cAAcA,MAAmB;AAAA,YAAA,CAClC;AAAA,YAED,UAAA;AAAA,cAAA,gBAAAG,EAAC,QAAA,EAAK,WAAU,4BACd,UAAA;AAAA,gBAAA,gBAAAE;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACE,GAAGT;AAAA,oBACJ,MAAAZ;AAAA,oBACA,eAAaE;AAAA,oBACb,MAAK;AAAA,oBACL,UAAAK;AAAA,oBACA,UAAU,MAAM;AACd,uBAACJ,KAAYW,EAAS,CAACD,CAAO;AAAA,oBAChC;AAAA,oBACA,SAAAA;AAAA,oBACA,aAAU;AAAA,oBACV,UAAAV;AAAA,oBACA,OAAAE;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGF,gBAAAgB;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,OAAO,EAAE,QAAQf,GAAM,OAAOA,EAAA;AAAA,oBAC9B,WAAWc,EAAW,EAAE,eAAeJ,MAAmB,SAAS;AAAA,oBACnE,eAAa,mBAAmBjB,CAAE;AAAA,oBAElC,UAAA,gBAAAsB;AAAA,sBAACC;AAAA,sBAAA;AAAA,wBACC,MAAK;AAAA,wBACL,MAAK;AAAA,wBACL,OAAO,GAAGhB,CAAI;AAAA,wBACd,OAAM;AAAA,wBACN,WAAU;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACZ;AAAA,gBAAA;AAAA,cACF,GACF;AAAA,cAECI;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGFQ,KACC,gBAAAC,EAAC,QAAA,EAAK,WAAU,qDAAoD,MAAK,SACvE,UAAA;AAAA,UAAA,gBAAAE,EAACC,GAAA,EAAK,MAAK,SAAQ,OAAM,QAAO;AAAA,UAC/Bb;AAAA,QAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { FormControlProps } from '../FormControl.js';
|
|
3
3
|
export interface CheckboxesProps<Value = string> extends Pick<FormControlProps<Value[]>, 'id' | 'name' | 'value' | 'onChange' | 'disabled' | 'readOnly' | 'tabIndex' | 'description' | 'validationStatus' | 'errorMessage'>, Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
4
4
|
}
|
|
5
5
|
export declare function Checkboxes<Value = string>(props: CheckboxesProps<Value>): import("react/jsx-runtime").JSX.Element;
|