@clubmed/trident-ui 1.2.0 → 1.3.0-beta.10
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 +961 -860
- package/README.md +11 -1
- package/assets/style.css +1 -1
- package/atoms/Clickable/Clickable.d.ts +5 -0
- package/atoms/Clickable/Clickable.js +25 -0
- package/atoms/Clickable/Clickable.js.map +1 -0
- package/atoms/Heading/Heading.d.ts +6 -0
- package/atoms/Heading/Heading.js +14 -0
- package/atoms/Heading/Heading.js.map +1 -0
- package/atoms/Heading/HeadingGroup.d.ts +7 -0
- package/atoms/Heading/HeadingGroup.js +15 -0
- package/atoms/Heading/HeadingGroup.js.map +1 -0
- package/atoms/Image/Image.d.ts +7 -0
- package/atoms/Image/Image.js +18 -0
- package/atoms/Image/Image.js.map +1 -0
- package/atoms/Prose/Prose.d.ts +5 -0
- package/atoms/Prose/Prose.js +18 -0
- package/atoms/Prose/Prose.js.map +1 -0
- package/chunks/ResizeObserver.js +287 -0
- package/chunks/ResizeObserver.js.map +1 -0
- package/chunks/_commonjsHelpers.js +24 -4
- package/chunks/_commonjsHelpers.js.map +1 -1
- package/chunks/index.js.map +1 -1
- package/chunks/plugin.js +53 -0
- package/chunks/plugin.js.map +1 -0
- package/contexts/Device.d.ts +2 -22
- package/contexts/Device.js +5 -59
- package/contexts/Device.js.map +1 -1
- package/contexts/Devices/Device.d.ts +11 -0
- package/contexts/Devices/Device.js +23 -0
- package/contexts/Devices/Device.js.map +1 -0
- package/contexts/Devices/hooks/useQueries.d.ts +6 -0
- package/contexts/Devices/hooks/useQueries.js +24 -0
- package/contexts/Devices/hooks/useQueries.js.map +1 -0
- package/contexts/Devices/reducers/reducer.d.ts +25 -0
- package/contexts/Devices/reducers/reducer.js +50 -0
- package/contexts/Devices/reducers/reducer.js.map +1 -0
- package/contexts/TridentUIConfig.js +228 -228
- package/contexts/TridentUIConfig.js.map +1 -1
- package/helpers/colors/colors.d.ts +108 -0
- package/helpers/colors/colors.js +132 -0
- package/helpers/colors/colors.js.map +1 -0
- package/hooks/keyboard.constants.js.map +1 -1
- package/hooks/useInternalStatus.js.map +1 -1
- package/hooks/useKeyboardControls.js.map +1 -1
- package/hooks/useResizeObserver.d.ts +2 -0
- package/hooks/useResizeObserver.js +84 -0
- package/hooks/useResizeObserver.js.map +1 -0
- package/hooks/useSafeBoop.js.map +1 -1
- package/hooks/useValue.js.map +1 -1
- package/molecules/Arrows/Arrows.d.ts +16 -0
- package/molecules/Arrows/Arrows.js +66 -0
- package/molecules/Arrows/Arrows.js.map +1 -0
- package/molecules/Arrows/ArrowsLabels.d.js +2 -0
- package/molecules/Arrows/ArrowsLabels.d.js.map +1 -0
- package/molecules/Arrows.d.ts +1 -50
- package/molecules/Arrows.js +2 -56
- package/molecules/Arrows.js.map +1 -1
- package/molecules/Avatar.js.map +1 -1
- package/molecules/Backdrop.js.map +1 -1
- package/molecules/Breadcrumb.js +8 -9
- package/molecules/Breadcrumb.js.map +1 -1
- package/molecules/Buttons/ArrowButton.d.ts +7 -0
- package/molecules/Buttons/ArrowButton.js +14 -0
- package/molecules/Buttons/ArrowButton.js.map +1 -0
- package/molecules/Buttons/Button.d.ts +15 -32
- package/molecules/Buttons/Button.js +52 -42
- package/molecules/Buttons/Button.js.map +1 -1
- package/molecules/Buttons/ButtonAnchor.d.ts +7 -3
- package/molecules/Buttons/ButtonAnchor.js +17 -36
- package/molecules/Buttons/ButtonAnchor.js.map +1 -1
- package/molecules/Buttons/ButtonContent.d.ts +12 -4
- package/molecules/Buttons/ButtonContent.js +14 -8
- package/molecules/Buttons/ButtonContent.js.map +1 -1
- package/molecules/Buttons/FakeButton.d.ts +8 -0
- package/molecules/Buttons/FakeButton.js +8 -0
- package/molecules/Buttons/FakeButton.js.map +1 -0
- package/molecules/Buttons/InertButton.d.ts +4 -0
- package/molecules/Buttons/InertButton.js +15 -31
- package/molecules/Buttons/InertButton.js.map +1 -1
- package/molecules/Buttons/v2/Button.d.ts +2289 -0
- package/molecules/Buttons/v2/Button.js +57 -0
- package/molecules/Buttons/v2/Button.js.map +1 -0
- package/molecules/Buttons/v2/Button.type.d.ts +57 -0
- package/molecules/Buttons/v2/Button.type.js +45 -0
- package/molecules/Buttons/v2/Button.type.js.map +1 -0
- package/molecules/Card.d.ts +1 -11
- package/molecules/Card.js +2 -35
- package/molecules/Card.js.map +1 -1
- package/molecules/Cards/Card.d.ts +13 -0
- package/molecules/Cards/Card.js +22 -0
- package/molecules/Cards/Card.js.map +1 -0
- package/molecules/Cards/CardAspectRatios.d.ts +6 -0
- package/molecules/Cards/CardAspectRatios.js +10 -0
- package/molecules/Cards/CardAspectRatios.js.map +1 -0
- package/molecules/Cards/CardBackground.d.ts +4 -0
- package/molecules/Cards/CardBackground.js +30 -0
- package/molecules/Cards/CardBackground.js.map +1 -0
- package/molecules/Cards/CardBackgroundContext.d.ts +6 -0
- package/molecules/Cards/CardBackgroundContext.js +10 -0
- package/molecules/Cards/CardBackgroundContext.js.map +1 -0
- package/molecules/Cards/CardClickable.d.ts +6 -0
- package/molecules/Cards/CardClickable.js +37 -0
- package/molecules/Cards/CardClickable.js.map +1 -0
- package/molecules/Cards/ExpandableCard.d.ts +14 -0
- package/molecules/Cards/ExpandableCard.js +80 -0
- package/molecules/Cards/ExpandableCard.js.map +1 -0
- package/molecules/Cards/v2/Card.d.ts +15 -0
- package/molecules/Cards/v2/Card.js +34 -0
- package/molecules/Cards/v2/Card.js.map +1 -0
- package/molecules/Chip.d.ts +9 -0
- package/molecules/Chip.js +31 -0
- package/molecules/Chip.js.map +1 -0
- package/molecules/Chip.themes.d.ts +12 -0
- package/molecules/Chip.themes.js +24 -0
- package/molecules/Chip.themes.js.map +1 -0
- package/molecules/ElasticHeight.d.ts +6 -27
- package/molecules/ElasticHeight.js +28 -33
- package/molecules/ElasticHeight.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js +12 -13
- package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
- package/molecules/Forms/DateField.d.ts +1 -1
- package/molecules/Forms/DateField.js +142 -116
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js +12 -13
- package/molecules/Forms/Filter.js.map +1 -1
- package/molecules/Forms/FormControl.js +15 -16
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/FormLabel.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +29 -29
- package/molecules/Forms/NumberField.js +68 -68
- package/molecules/Forms/NumberField.js.map +1 -1
- package/molecules/Forms/Password/Password.js +10 -11
- package/molecules/Forms/Password/Password.js.map +1 -1
- package/molecules/Forms/Password/ValidationMessage.js +8 -9
- package/molecules/Forms/Password/ValidationMessage.js.map +1 -1
- package/molecules/Forms/Radios/Radio.js.map +1 -1
- package/molecules/Forms/Radios/RadioGroup.js +2 -2
- package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
- package/molecules/Forms/Range.js +124 -406
- package/molecules/Forms/Range.js.map +1 -1
- package/molecules/Forms/Select.d.ts +1 -1
- package/molecules/Forms/Select.js +3 -4
- package/molecules/Forms/Select.js.map +1 -1
- package/molecules/Forms/Switch.js.map +1 -1
- package/molecules/Forms/TextField.d.ts +1 -1
- package/molecules/Forms/TextField.js +7 -8
- package/molecules/Forms/TextField.js.map +1 -1
- package/molecules/HamburgerIcon.js.map +1 -1
- package/molecules/Link.d.ts +1 -1
- package/molecules/Link.js +8 -9
- package/molecules/Link.js.map +1 -1
- package/molecules/Loader.js.map +1 -1
- package/molecules/Pagination.d.ts +38 -0
- package/molecules/Pagination.helper.d.ts +48 -0
- package/molecules/Pagination.helper.js +30 -0
- package/molecules/Pagination.helper.js.map +1 -0
- package/molecules/Pagination.js +154 -0
- package/molecules/Pagination.js.map +1 -0
- package/molecules/Popin.js +16 -16
- package/molecules/Popin.js.map +1 -1
- package/molecules/Spinner.js.map +1 -1
- package/molecules/Tabs/Tab.d.ts +1 -1
- package/molecules/Tabs/Tab.js +51 -49
- package/molecules/Tabs/Tab.js.map +1 -1
- package/molecules/Tabs/TabList.js.map +1 -1
- package/molecules/Tabs/TabPanel.js +31 -29
- package/molecules/Tabs/TabPanel.js.map +1 -1
- package/molecules/Tabs/Tabs.js +7 -9
- package/molecules/Tabs/Tabs.js.map +1 -1
- package/molecules/Tabs/TabsBody.js.map +1 -1
- package/molecules/Tabs/context/TabControl.d.ts +29 -27
- package/molecules/Tabs/context/TabControl.js +67 -66
- package/molecules/Tabs/context/TabControl.js.map +1 -1
- package/molecules/Tabs/hooks/tabControl.d.ts +25 -14
- package/molecules/Tabs/hooks/tabControl.js +26 -23
- package/molecules/Tabs/hooks/tabControl.js.map +1 -1
- package/molecules/Tabs/theme.js.map +1 -1
- package/molecules/Tag.d.ts +43 -0
- package/molecules/Tag.js +73 -0
- package/molecules/Tag.js.map +1 -0
- package/package.json +29 -5
- package/styles/globals.css +16 -15
- package/tailwind/colors.d.ts +38 -0
- package/tailwind/colors.js +44 -0
- package/tailwind/colors.js.map +1 -0
- package/tailwind/plugins/animationDelay.d.ts +4 -0
- package/tailwind/plugins/animationDelay.js +15 -0
- package/tailwind/plugins/animationDelay.js.map +1 -0
- package/tailwind/plugins/hocus.d.ts +4 -0
- package/tailwind/plugins/hocus.js +11 -0
- package/tailwind/plugins/hocus.js.map +1 -0
- package/tailwind/plugins/lineClampFix.d.ts +4 -0
- package/tailwind/plugins/lineClampFix.js +13 -0
- package/tailwind/plugins/lineClampFix.js.map +1 -0
- package/tailwind/plugins/popover.d.ts +4 -0
- package/tailwind/plugins/popover.js +8 -0
- package/tailwind/plugins/popover.js.map +1 -0
- package/tailwind/plugins/startingStyle.d.ts +4 -0
- package/tailwind/plugins/startingStyle.js +8 -0
- package/tailwind/plugins/startingStyle.js.map +1 -0
- package/tailwind/plugins/transitionBehavior.d.ts +4 -0
- package/tailwind/plugins/transitionBehavior.js +11 -0
- package/tailwind/plugins/transitionBehavior.js.map +1 -0
- package/tailwind/tailwind.preset.d.ts +733 -510
- package/tailwind/tailwind.preset.js +706 -629
- package/tailwind/tailwind.preset.js.map +1 -1
- package/types/Colors.d.js +2 -0
- package/types/Colors.d.js.map +1 -0
- package/types/Devices.d.ts +8 -0
- package/types/Devices.js +11 -0
- package/types/Devices.js.map +1 -0
- package/types/Direction.d.js +2 -0
- package/types/Direction.d.js.map +1 -0
- package/types/LiteralUnion.d.js +2 -0
- package/types/LiteralUnion.d.js.map +1 -0
- package/types/ScrollerLabels.d.js +2 -0
- package/types/ScrollerLabels.d.js.map +1 -0
- package/types/Theme.d.js +2 -0
- package/types/Theme.d.js.map +1 -0
- package/molecules/Buttons/Button.helpers.d.ts +0 -7
- package/molecules/Buttons/Button.helpers.js +0 -11
- package/molecules/Buttons/Button.helpers.js.map +0 -1
- package/molecules/Buttons/Button.themes.d.ts +0 -1
- package/molecules/Buttons/Button.themes.js +0 -25
- package/molecules/Buttons/Button.themes.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
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",
|
|
35
|
+
icon: e,
|
|
36
|
+
iconWidth: o,
|
|
37
|
+
size: s = "medium",
|
|
38
|
+
theme: u = "solid",
|
|
39
|
+
variant: i = "pill",
|
|
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";
|
|
53
|
+
export {
|
|
54
|
+
C as Button,
|
|
55
|
+
p as useButton
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { IconicNames, IconicTypes } from '@clubmed/trident-icons';
|
|
2
|
+
import type { Colors } from '../../../types/Colors';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
color?: Colors;
|
|
5
|
+
/**
|
|
6
|
+
* Optional icon name
|
|
7
|
+
*/
|
|
8
|
+
icon?: IconicNames;
|
|
9
|
+
/**
|
|
10
|
+
* Force the icon type to be svg, font or default
|
|
11
|
+
*/
|
|
12
|
+
iconType?: IconicTypes;
|
|
13
|
+
iconWidth?: string;
|
|
14
|
+
size?: 'small' | 'medium' | 'large';
|
|
15
|
+
theme?: 'outline' | 'solid';
|
|
16
|
+
variant?: 'circle' | 'pill';
|
|
17
|
+
}
|
|
18
|
+
type Params = {
|
|
19
|
+
color: ButtonProps['color'];
|
|
20
|
+
size: ButtonProps['size'];
|
|
21
|
+
theme: ButtonProps['theme'];
|
|
22
|
+
variant: ButtonProps['variant'];
|
|
23
|
+
};
|
|
24
|
+
export declare const BUTTON_COLORS: {
|
|
25
|
+
readonly black: "button-black";
|
|
26
|
+
readonly green: "button-green";
|
|
27
|
+
readonly lavender: "button-lavender";
|
|
28
|
+
readonly lightSand: "button-lightSand";
|
|
29
|
+
readonly marygold: "button-marygold";
|
|
30
|
+
readonly orange: "button-orange";
|
|
31
|
+
readonly red: "button-red";
|
|
32
|
+
readonly saffron: "button-saffron";
|
|
33
|
+
readonly sand: "button-sand";
|
|
34
|
+
readonly sienna: "button-sienna";
|
|
35
|
+
readonly ultramarine: "button-ultramarine";
|
|
36
|
+
readonly verdigris: "button-verdigris";
|
|
37
|
+
readonly wave: "button-wave";
|
|
38
|
+
readonly white: "button-white";
|
|
39
|
+
readonly darkGrey: "button-darkGrey";
|
|
40
|
+
readonly lightGrey: "button-lightGrey";
|
|
41
|
+
readonly current: "button-current";
|
|
42
|
+
};
|
|
43
|
+
export declare const BUTTON_THEMES: {
|
|
44
|
+
readonly outline: "button-outline";
|
|
45
|
+
readonly solid: "button-solid";
|
|
46
|
+
};
|
|
47
|
+
export declare const BUTTON_VARIANTS: {
|
|
48
|
+
readonly circle: "button-circle";
|
|
49
|
+
readonly pill: "button-pill";
|
|
50
|
+
};
|
|
51
|
+
export declare const BUTTON_SIZES: {
|
|
52
|
+
readonly small: "button-small";
|
|
53
|
+
readonly medium: "button-medium";
|
|
54
|
+
readonly large: "button-large";
|
|
55
|
+
};
|
|
56
|
+
export declare const getButtonClasses: ({ color, size, theme, variant }: Params) => string;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { c as r } from "../../../chunks/index.js";
|
|
2
|
+
const u = {
|
|
3
|
+
black: "button-black",
|
|
4
|
+
green: "button-green",
|
|
5
|
+
lavender: "button-lavender",
|
|
6
|
+
lightSand: "button-lightSand",
|
|
7
|
+
marygold: "button-marygold",
|
|
8
|
+
orange: "button-orange",
|
|
9
|
+
red: "button-red",
|
|
10
|
+
saffron: "button-saffron",
|
|
11
|
+
sand: "button-sand",
|
|
12
|
+
sienna: "button-sienna",
|
|
13
|
+
ultramarine: "button-ultramarine",
|
|
14
|
+
verdigris: "button-verdigris",
|
|
15
|
+
wave: "button-wave",
|
|
16
|
+
white: "button-white",
|
|
17
|
+
darkGrey: "button-darkGrey",
|
|
18
|
+
lightGrey: "button-lightGrey",
|
|
19
|
+
current: "button-current"
|
|
20
|
+
}, a = (t) => u[t || "saffron"], l = {
|
|
21
|
+
outline: "button-outline",
|
|
22
|
+
solid: "button-solid"
|
|
23
|
+
}, i = (t) => l[t || "solid"], s = {
|
|
24
|
+
circle: "button-circle",
|
|
25
|
+
pill: "button-pill"
|
|
26
|
+
}, b = (t) => s[t || "pill"], d = {
|
|
27
|
+
small: "button-small",
|
|
28
|
+
medium: "button-medium",
|
|
29
|
+
large: "button-large"
|
|
30
|
+
}, c = (t) => d[t || "medium"], m = ({ color: t, size: n, theme: o, variant: e }) => r(
|
|
31
|
+
"flex",
|
|
32
|
+
"button",
|
|
33
|
+
i(o),
|
|
34
|
+
a(t),
|
|
35
|
+
b(e),
|
|
36
|
+
c(n)
|
|
37
|
+
);
|
|
38
|
+
export {
|
|
39
|
+
u as BUTTON_COLORS,
|
|
40
|
+
d as BUTTON_SIZES,
|
|
41
|
+
l as BUTTON_THEMES,
|
|
42
|
+
s as BUTTON_VARIANTS,
|
|
43
|
+
m as getButtonClasses
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=Button.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.type.js","sources":["../../../../lib/molecules/Buttons/v2/Button.type.ts"],"sourcesContent":["import classnames from 'classnames';\n\nimport type { IconicNames, IconicTypes } from '@clubmed/trident-icons';\nimport type { Colors } from '@/types/Colors';\n\nexport interface ButtonProps {\n color?: Colors;\n /**\n * Optional icon name\n */\n icon?: IconicNames;\n /**\n * Force the icon type to be svg, font or default\n */\n iconType?: IconicTypes;\n iconWidth?: string;\n size?: 'small' | 'medium' | 'large';\n theme?: 'outline' | 'solid';\n variant?: 'circle' | 'pill';\n}\n\ntype Params = {\n color: ButtonProps['color'];\n size: ButtonProps['size'];\n theme: ButtonProps['theme'];\n variant: ButtonProps['variant'];\n};\n\nexport const BUTTON_COLORS = {\n black: 'button-black',\n green: 'button-green',\n lavender: 'button-lavender',\n lightSand: 'button-lightSand',\n marygold: 'button-marygold',\n orange: 'button-orange',\n red: 'button-red',\n saffron: 'button-saffron',\n sand: 'button-sand',\n sienna: 'button-sienna',\n ultramarine: 'button-ultramarine',\n verdigris: 'button-verdigris',\n wave: 'button-wave',\n white: 'button-white',\n darkGrey: 'button-darkGrey',\n lightGrey: 'button-lightGrey',\n current: 'button-current',\n} as const satisfies Record<Colors, `button-${string}`>;\n\nconst getButtonColor = (color: ButtonProps['color']) => {\n return BUTTON_COLORS[color || 'saffron'];\n};\n\nexport const BUTTON_THEMES = {\n outline: 'button-outline',\n solid: 'button-solid',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst getButtonTheme = (theme: ButtonProps['theme']) => {\n return BUTTON_THEMES[theme || 'solid'];\n};\n\nexport const BUTTON_VARIANTS = {\n circle: 'button-circle',\n pill: 'button-pill',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst getButtonVariant = (variant: ButtonProps['variant']) => {\n return BUTTON_VARIANTS[variant || 'pill'];\n};\n\nexport const BUTTON_SIZES = {\n small: 'button-small',\n medium: 'button-medium',\n large: 'button-large',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst getButtonSize = (size: ButtonProps['size']) => {\n return BUTTON_SIZES[size || 'medium'];\n};\n\nexport const getButtonClasses = ({ color, size, theme, variant }: Params) => {\n /* keep the \"flex\" class outside of \"button-*\" so that it can be overridden in responsive */\n return classnames(\n 'flex',\n 'button',\n getButtonTheme(theme),\n getButtonColor(color),\n getButtonVariant(variant),\n getButtonSize(size),\n );\n};\n"],"names":["BUTTON_COLORS","getButtonColor","color","BUTTON_THEMES","getButtonTheme","theme","BUTTON_VARIANTS","getButtonVariant","variant","BUTTON_SIZES","getButtonSize","size","getButtonClasses","classnames"],"mappings":";AA4BO,MAAMA,IAAgB;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS;AACX,GAEMC,IAAiB,CAACC,MACfF,EAAcE,KAAS,SAAS,GAG5BC,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,OAAO;AACT,GAEMC,IAAiB,CAACC,MACfF,EAAcE,KAAS,OAAO,GAG1BC,IAAkB;AAAA,EAC7B,QAAQ;AAAA,EACR,MAAM;AACR,GAEMC,IAAmB,CAACC,MACjBF,EAAgBE,KAAW,MAAM,GAG7BC,IAAe;AAAA,EAC1B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACT,GAEMC,IAAgB,CAACC,MACdF,EAAaE,KAAQ,QAAQ,GAGzBC,IAAmB,CAAC,EAAE,OAAAV,GAAO,MAAAS,GAAM,OAAAN,GAAO,SAAAG,QAE9CK;AAAA,EACL;AAAA,EACA;AAAA,EACAT,EAAeC,CAAK;AAAA,EACpBJ,EAAeC,CAAK;AAAA,EACpBK,EAAiBC,CAAO;AAAA,EACxBE,EAAcC,CAAI;AAAA;"}
|
package/molecules/Card.d.ts
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type IconicNames, type IconicTypes } from '../atoms/Icons';
|
|
3
|
-
interface CardProps {
|
|
4
|
-
title: string;
|
|
5
|
-
icon: IconicNames;
|
|
6
|
-
iconType?: IconicTypes;
|
|
7
|
-
theme?: 'light' | 'dark';
|
|
8
|
-
dataName?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const Card: FunctionComponent<PropsWithChildren<CardProps>>;
|
|
11
|
-
export {};
|
|
1
|
+
export * from './Cards/Card';
|
package/molecules/Card.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as d } from "../chunks/index.js";
|
|
3
|
-
import { Icon as o } from "../atoms/Icons/Icon.js";
|
|
4
|
-
import "@clubmed/trident-icons";
|
|
5
|
-
const x = ({
|
|
6
|
-
title: a,
|
|
7
|
-
children: i,
|
|
8
|
-
icon: s,
|
|
9
|
-
iconType: l,
|
|
10
|
-
theme: r = "light",
|
|
11
|
-
dataName: n = "Card"
|
|
12
|
-
}) => /* @__PURE__ */ t(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
className: "border-lightGrey rounded-16 flex shrink-0 flex-row gap-20 border bg-white p-20",
|
|
16
|
-
"data-name": n,
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ e(
|
|
19
|
-
"div",
|
|
20
|
-
{
|
|
21
|
-
className: d("flex h-48 w-48 shrink-0 items-center justify-center rounded-full", {
|
|
22
|
-
"bg-ultramarine text-white": r === "dark",
|
|
23
|
-
"bg-lightSand text-black": r === "light"
|
|
24
|
-
}),
|
|
25
|
-
children: /* @__PURE__ */ e(o, { name: s, type: l, width: "24px" })
|
|
26
|
-
}
|
|
27
|
-
),
|
|
28
|
-
/* @__PURE__ */ t("div", { className: "space-y-8 font-sans", children: [
|
|
29
|
-
/* @__PURE__ */ e("div", { className: "text-b3 font-semibold", children: a }),
|
|
30
|
-
/* @__PURE__ */ e("div", { className: "text-b4 font-normal", children: i })
|
|
31
|
-
] })
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
);
|
|
1
|
+
import { Card as a } from "./Cards/Card.js";
|
|
35
2
|
export {
|
|
36
|
-
|
|
3
|
+
a as Card
|
|
37
4
|
};
|
|
38
5
|
//# sourceMappingURL=Card.js.map
|
package/molecules/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":[
|
|
1
|
+
{"version":3,"file":"Card.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { type CardProps as CardPropsV2 } from './v2/Card';
|
|
3
|
+
import { type IconicNames, type IconicTypes } from '@clubmed/trident-icons';
|
|
4
|
+
import { type ChipProps } from '../Chip';
|
|
5
|
+
interface CardProps extends Omit<CardPropsV2, 'theme'> {
|
|
6
|
+
title: string;
|
|
7
|
+
icon: IconicNames;
|
|
8
|
+
iconType?: IconicTypes;
|
|
9
|
+
theme?: ChipProps['theme'];
|
|
10
|
+
dataName?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const Card: FunctionComponent<PropsWithChildren<CardProps>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Card as n } from "./v2/Card.js";
|
|
3
|
+
import { Icon as d } from "@clubmed/trident-icons";
|
|
4
|
+
import { Chip as l } from "../Chip.js";
|
|
5
|
+
const x = ({
|
|
6
|
+
title: e,
|
|
7
|
+
children: s,
|
|
8
|
+
icon: i,
|
|
9
|
+
iconType: t,
|
|
10
|
+
theme: o = "light",
|
|
11
|
+
dataName: m = "Card"
|
|
12
|
+
}) => /* @__PURE__ */ a(n, { "data-name": m, className: "p-20 flex shrink-0 flex-row gap-20", children: [
|
|
13
|
+
/* @__PURE__ */ r(l, { theme: o, size: "size-48", children: /* @__PURE__ */ r(d, { name: i, type: t, width: "24px" }) }),
|
|
14
|
+
/* @__PURE__ */ a("div", { className: "space-y-8 font-sans", children: [
|
|
15
|
+
/* @__PURE__ */ r("div", { className: "text-b3 font-semibold", children: e }),
|
|
16
|
+
/* @__PURE__ */ r("div", { className: "text-b4 font-normal", children: s })
|
|
17
|
+
] })
|
|
18
|
+
] });
|
|
19
|
+
export {
|
|
20
|
+
x as Card
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../lib/molecules/Cards/Card.tsx"],"sourcesContent":["import type { FunctionComponent, PropsWithChildren } from 'react';\nimport { Card as CardV2, type CardProps as CardPropsV2 } from '@/molecules/Cards/v2/Card';\nimport { Icon, type IconicNames, type IconicTypes } from '@clubmed/trident-icons';\nimport { Chip, type ChipProps } from '@/molecules/Chip';\n\ninterface CardProps extends Omit<CardPropsV2, 'theme'> {\n title: string;\n icon: IconicNames;\n iconType?: IconicTypes;\n theme?: ChipProps['theme'];\n dataName?: string;\n}\n\nexport const Card: FunctionComponent<PropsWithChildren<CardProps>> = ({\n title,\n children,\n icon,\n iconType,\n theme = 'light',\n dataName = 'Card',\n}) => {\n return (\n <CardV2 data-name={dataName} className=\"p-20 flex shrink-0 flex-row gap-20\">\n <Chip theme={theme} size={'size-48'}>\n <Icon name={icon} type={iconType} width=\"24px\" />\n </Chip>\n <div className=\"space-y-8 font-sans\">\n <div className=\"text-b3 font-semibold\">{title}</div>\n <div className=\"text-b4 font-normal\">{children}</div>\n </div>\n </CardV2>\n );\n};\n"],"names":["Card","title","children","icon","iconType","theme","dataName","jsxs","CardV2","jsx","Chip","Icon"],"mappings":";;;;AAaO,MAAMA,IAAwD,CAAC;AAAA,EACpE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AACb,MAEI,gBAAAC,EAACC,GAAA,EAAO,aAAWF,GAAU,WAAU,uCACrC,UAAA;AAAA,EAAA,gBAAAG,EAACC,GAAA,EAAK,OAAAL,GAAc,MAAM,WACxB,UAAA,gBAAAI,EAACE,GAAA,EAAK,MAAMR,GAAM,MAAMC,GAAU,OAAM,OAAA,CAAO,GACjD;AAAA,EACA,gBAAAG,EAAC,OAAA,EAAI,WAAU,uBACb,UAAA;AAAA,IAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAR,GAAM;AAAA,IAC9C,gBAAAQ,EAAC,OAAA,EAAI,WAAU,uBAAuB,UAAAP,EAAA,CAAS;AAAA,EAAA,EAAA,CACjD;AAAA,GACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardAspectRatios.js","sources":["../../../lib/molecules/Cards/CardAspectRatios.ts"],"sourcesContent":["export const CARD_ASPECT_RATIOS = {\n horizontal: 'aspect-horizontal',\n vertical: 'aspect-vertical',\n square: 'aspect-square',\n custom: '',\n} as const;\n"],"names":["CARD_ASPECT_RATIOS"],"mappings":"AAAO,MAAMA,IAAqB;AAAA,EAChC,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AACV;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type FunctionComponent } from 'react';
|
|
2
|
+
import { type ImageProps } from '../../atoms/Image/Image';
|
|
3
|
+
export type CardBackgroundProps = ComponentPropsWithoutRef<'div'> & Partial<ImageProps>;
|
|
4
|
+
export declare const CardBackground: FunctionComponent<CardBackgroundProps>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as r, Fragment as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "../../chunks/index.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Image as i } from "../../atoms/Image/Image.js";
|
|
5
|
+
import { CardBackgroundContext as d } from "./CardBackgroundContext.js";
|
|
6
|
+
const s = ({
|
|
7
|
+
children: n,
|
|
8
|
+
className: c,
|
|
9
|
+
...e
|
|
10
|
+
}) => /* @__PURE__ */ r(m, { children: [
|
|
11
|
+
(e == null ? void 0 : e.src) && /* @__PURE__ */ o(i, { ...e, src: e.src, className: "h-full w-full object-cover" }),
|
|
12
|
+
/* @__PURE__ */ o(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
...e,
|
|
16
|
+
className: l(
|
|
17
|
+
"pointer-events-none absolute inset-0 flex flex-col rounded-16",
|
|
18
|
+
{
|
|
19
|
+
"bg-gradient-to-b from-transparent via-transparent to-black/40": e == null ? void 0 : e.src
|
|
20
|
+
},
|
|
21
|
+
c
|
|
22
|
+
),
|
|
23
|
+
children: /* @__PURE__ */ o(d.Provider, { value: { hasImage: !!(e != null && e.src) }, children: n })
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
] });
|
|
27
|
+
export {
|
|
28
|
+
s as CardBackground
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=CardBackground.js.map
|
|
@@ -0,0 +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,GAAAF,KAAA,gBAAAA,EAAO,0BAAQG,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,KAAA,gBAAAA,EAAO;AAAA,QAAA;AAAA,QAE1ED;AAAA,MAAA;AAAA,MAGF,UAAA,gBAAAK,EAACE,EAAsB,UAAtB,EAA+B,OAAO,EAAE,UAAU,CAAC,EAACN,KAAA,QAAAA,EAAO,KAAA,GACzD,UAAAF,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AACF,GACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardBackgroundContext.js","sources":["../../../lib/molecules/Cards/CardBackgroundContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport const CardBackgroundContext = createContext<{ hasImage: boolean }>({ hasImage: true });\n\nexport function useCardBackground() {\n return useContext(CardBackgroundContext);\n}\n"],"names":["CardBackgroundContext","createContext","useCardBackground","useContext"],"mappings":";AAEO,MAAMA,IAAwBC,EAAqC,EAAE,UAAU,IAAM;AAErF,SAASC,IAAoB;AAClC,SAAOC,EAAWH,CAAqB;AACzC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FunctionComponent, type HTMLAttributes } from 'react';
|
|
2
|
+
export interface CartTitleProps extends HTMLAttributes<HTMLDivElement | HTMLAnchorElement> {
|
|
3
|
+
coverLink?: boolean;
|
|
4
|
+
href?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const CardClickable: FunctionComponent<CartTitleProps>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../../chunks/index.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { useCardBackground as u } from "./CardBackgroundContext.js";
|
|
5
|
+
const d = ({
|
|
6
|
+
children: t,
|
|
7
|
+
className: m,
|
|
8
|
+
coverLink: a = !1,
|
|
9
|
+
href: s,
|
|
10
|
+
onClick: r,
|
|
11
|
+
...n
|
|
12
|
+
}) => {
|
|
13
|
+
const e = !!s, { hasImage: o } = u(), p = e ? "a" : "div", c = e ? { href: s, onClick: r } : {};
|
|
14
|
+
return /* @__PURE__ */ l(
|
|
15
|
+
p,
|
|
16
|
+
{
|
|
17
|
+
className: i(
|
|
18
|
+
"pointer-events-auto flex w-full gap-x-8 px-12 pb-12 sm:px-24 sm:pb-24",
|
|
19
|
+
{
|
|
20
|
+
"justify-center text-center": !t,
|
|
21
|
+
"h-full items-end": a,
|
|
22
|
+
"mt-auto h-auto": !a,
|
|
23
|
+
"text-white": o,
|
|
24
|
+
"text-black": !o
|
|
25
|
+
},
|
|
26
|
+
m
|
|
27
|
+
),
|
|
28
|
+
...c,
|
|
29
|
+
...n,
|
|
30
|
+
children: t
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
d as CardClickable
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=CardClickable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardClickable.js","sources":["../../../lib/molecules/Cards/CardClickable.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type FunctionComponent, type HTMLAttributes } from 'react';\nimport { useCardBackground } from '@/molecules/Cards/CardBackgroundContext';\n\nexport interface CartTitleProps extends HTMLAttributes<HTMLDivElement | HTMLAnchorElement> {\n coverLink?: boolean;\n href?: string;\n}\n\nexport const CardClickable: FunctionComponent<CartTitleProps> = ({\n children,\n className,\n coverLink = false,\n href,\n onClick,\n ...attrs\n}) => {\n const hasLink = !!href;\n const { hasImage } = useCardBackground();\n const TagName = hasLink ? 'a' : 'div';\n const tagProps = hasLink ? { href, onClick } : {};\n\n return (\n <TagName\n className={classnames(\n 'pointer-events-auto flex w-full gap-x-8 px-12 pb-12 sm:px-24 sm:pb-24',\n {\n 'justify-center text-center': !children,\n 'h-full items-end': coverLink,\n 'mt-auto h-auto': !coverLink,\n 'text-white': hasImage,\n 'text-black': !hasImage,\n },\n className,\n )}\n {...tagProps}\n {...attrs}\n >\n {children}\n </TagName>\n );\n};\n"],"names":["CardClickable","children","className","coverLink","href","onClick","attrs","hasLink","hasImage","useCardBackground","TagName","tagProps","jsx","classnames"],"mappings":";;;;AASO,MAAMA,IAAmD,CAAC;AAAA,EAC/D,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAU,CAAC,CAACH,GACZ,EAAE,UAAAI,EAAA,IAAaC,EAAA,GACfC,IAAUH,IAAU,MAAM,OAC1BI,IAAWJ,IAAU,EAAE,MAAAH,GAAM,SAAAC,EAAA,IAAY,CAAA;AAE/C,SACE,gBAAAO;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAWG;AAAA,QACT;AAAA,QACA;AAAA,UACE,8BAA8B,CAACZ;AAAA,UAC/B,oBAAoBE;AAAA,UACpB,kBAAkB,CAACA;AAAA,UACnB,cAAcK;AAAA,UACd,cAAc,CAACA;AAAA,QAAA;AAAA,QAEjBN;AAAA,MAAA;AAAA,MAED,GAAGS;AAAA,MACH,GAAGL;AAAA,MAEH,UAAAL;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ComponentProps, type FunctionComponent } from 'react';
|
|
2
|
+
import { Heading } from '../../atoms/Heading/Heading';
|
|
3
|
+
import { Tag } from '../Tag';
|
|
4
|
+
import { type CardBackgroundProps } from './CardBackground';
|
|
5
|
+
import { type CardProps } from './v2/Card';
|
|
6
|
+
export interface ExpandableCardProps extends Omit<CardProps<'article'>, 'onClick'> {
|
|
7
|
+
hLevel?: ComponentProps<typeof Heading>['level'];
|
|
8
|
+
image?: CardBackgroundProps;
|
|
9
|
+
onClick?: (isExpanded: boolean) => void;
|
|
10
|
+
subtitle?: string | null;
|
|
11
|
+
tags?: ComponentProps<typeof Tag>[] | null;
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ExpandableCard: FunctionComponent<ExpandableCardProps>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as b, createElement as w } from "react";
|
|
4
|
+
import { c } from "../../chunks/index.js";
|
|
5
|
+
import { Clickable as v } from "../../atoms/Clickable/Clickable.js";
|
|
6
|
+
import { Tag as E } from "../Tag.js";
|
|
7
|
+
import { CardBackground as N } from "./CardBackground.js";
|
|
8
|
+
import { ElasticHeight as B } from "../ElasticHeight.js";
|
|
9
|
+
import { Card as j } from "./v2/Card.js";
|
|
10
|
+
import { HeadingGroup as k } from "../../atoms/Heading/HeadingGroup.js";
|
|
11
|
+
import { Button as y } from "../Buttons/v2/Button.js";
|
|
12
|
+
const F = ({
|
|
13
|
+
children: s,
|
|
14
|
+
className: p,
|
|
15
|
+
hLevel: i = 3,
|
|
16
|
+
image: e,
|
|
17
|
+
onClick: a,
|
|
18
|
+
subtitle: f,
|
|
19
|
+
tags: r,
|
|
20
|
+
title: d,
|
|
21
|
+
component: m = "article",
|
|
22
|
+
...x
|
|
23
|
+
}) => {
|
|
24
|
+
const h = !!d, [t, u] = b(!1);
|
|
25
|
+
return /* @__PURE__ */ l(
|
|
26
|
+
j,
|
|
27
|
+
{
|
|
28
|
+
component: m,
|
|
29
|
+
"data-name": "ExpandableCard",
|
|
30
|
+
"data-testid": "expandable-card",
|
|
31
|
+
...x,
|
|
32
|
+
className: c({ "border-t-0": e == null ? void 0 : e.src }, p),
|
|
33
|
+
"data-open": t,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ o(
|
|
36
|
+
v,
|
|
37
|
+
{
|
|
38
|
+
className: "group relative -m-1 block aspect-horizontal overflow-hidden rounded-16 text-start",
|
|
39
|
+
"data-testid": "expandable-card-clickable",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
a == null || a(!t), u(!t);
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ l(N, { ...e || {}, children: [
|
|
44
|
+
!!(r != null && r.length) && /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-4 self-start p-20", children: r == null ? void 0 : r.map((n) => /* @__PURE__ */ w(E, { ...n, key: n.label })) }),
|
|
45
|
+
/* @__PURE__ */ l(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: c("mt-auto flex justify-between gap-x-8 p-20", {
|
|
49
|
+
"text-white": e == null ? void 0 : e.src
|
|
50
|
+
}),
|
|
51
|
+
children: [
|
|
52
|
+
h && /* @__PURE__ */ o(k, { subtitle: f, level: i, children: d }),
|
|
53
|
+
/* @__PURE__ */ o(
|
|
54
|
+
y,
|
|
55
|
+
{
|
|
56
|
+
component: "span",
|
|
57
|
+
className: "!transition duration-500",
|
|
58
|
+
color: e != null && e.src ? "white" : "black",
|
|
59
|
+
icon: "ArrowDefaultDown",
|
|
60
|
+
style: { rotate: t ? "-180deg" : "0deg" },
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
theme: "outline",
|
|
63
|
+
variant: "circle"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ o(B, { isExpanded: t, children: s })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
F as ExpandableCard
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=ExpandableCard.js.map
|
|
@@ -0,0 +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,KAAA,gBAAAA,EAAO,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,KAAA,QAAAA,EAAU,CAACO,IACXC,EAAc,CAACD,CAAU;AAAA,YAC3B;AAAA,YAEA,UAAA,gBAAAG,EAACK,GAAA,EAAgB,GAAIhB,KAAS,CAAA,GAC3B,UAAA;AAAA,cAAA,GAAQG,KAAA,QAAAA,EAAM,6BACZ,OAAA,EAAI,WAAU,wCACZ,UAAAA,KAAA,gBAAAA,EAAM,IAAI,CAACc,MAAQ,gBAAAC,EAACC,KAAK,GAAGF,GAAK,KAAKA,EAAI,OAAO,IACpD;AAAA,cAEF,gBAAAN;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWE,EAAW,6CAA6C;AAAA,oBACjE,cAAcb,KAAA,gBAAAA,EAAO;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,KAAA,QAAAA,EAAO,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;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType } from 'react';
|
|
2
|
+
import { CARD_ASPECT_RATIOS } from '../CardAspectRatios';
|
|
3
|
+
type CARD_THEME = 'none' | 'bordered' | 'frame';
|
|
4
|
+
export type CardProps<T extends ElementType = 'div'> = {
|
|
5
|
+
component?: string;
|
|
6
|
+
/**
|
|
7
|
+
* By default the card has a border.
|
|
8
|
+
* Set to false to remove it.
|
|
9
|
+
*/
|
|
10
|
+
border?: boolean;
|
|
11
|
+
format?: keyof typeof CARD_ASPECT_RATIOS;
|
|
12
|
+
theme?: CARD_THEME | CARD_THEME[];
|
|
13
|
+
} & ComponentPropsWithoutRef<T>;
|
|
14
|
+
export declare function Card<T extends ElementType = 'div'>({ children, className, component, format, theme, ...attrs }: CardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as m } from "../../../chunks/index.js";
|
|
3
|
+
import { CARD_ASPECT_RATIOS as b } from "../CardAspectRatios.js";
|
|
4
|
+
function s({
|
|
5
|
+
children: e,
|
|
6
|
+
className: r,
|
|
7
|
+
component: d = "div",
|
|
8
|
+
format: i = "custom",
|
|
9
|
+
theme: t = "bordered",
|
|
10
|
+
...n
|
|
11
|
+
}) {
|
|
12
|
+
const u = d, o = [].concat(t).join(" ");
|
|
13
|
+
return /* @__PURE__ */ c(
|
|
14
|
+
u,
|
|
15
|
+
{
|
|
16
|
+
...n,
|
|
17
|
+
className: m(
|
|
18
|
+
b[i],
|
|
19
|
+
"relative isolate rounded-16",
|
|
20
|
+
{
|
|
21
|
+
"bg-white": !(r != null && r.includes("bg-")),
|
|
22
|
+
"group overflow-hidden": o.includes("frame"),
|
|
23
|
+
"border border-lightGrey": o.includes("bordered")
|
|
24
|
+
},
|
|
25
|
+
r
|
|
26
|
+
),
|
|
27
|
+
children: e
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
s as Card
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=Card.js.map
|
|
@@ -0,0 +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,EAACF,KAAA,QAAAA,EAAW,SAAS;AAAA,UACjC,yBAAyBM,EAAc,SAAS,OAAO;AAAA,UACvD,2BAA2BA,EAAc,SAAS,UAAU;AAAA,QAAA;AAAA,QAE9DN;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type Theme } from './Chip.themes';
|
|
3
|
+
import type { Colors } from '../types/Colors';
|
|
4
|
+
export interface ChipProps extends ComponentPropsWithoutRef<'span'> {
|
|
5
|
+
color?: Colors;
|
|
6
|
+
size?: string;
|
|
7
|
+
theme?: Theme;
|
|
8
|
+
}
|
|
9
|
+
export declare const Chip: ({ className, color, size, theme, children, ...attrs }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|