@clubmed/trident-ui 1.3.0-beta.4 → 1.3.0-beta.6
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 +19 -0
- package/assets/style.css +1 -1
- 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/hooks/keyboard.constants.js.map +1 -1
- package/hooks/useInternalStatus.js.map +1 -1
- package/hooks/useKeyboardControls.js.map +1 -1
- 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.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 +13 -34
- package/molecules/Buttons/Button.js +50 -42
- package/molecules/Buttons/Button.js.map +1 -1
- package/molecules/Buttons/ButtonAnchor.d.ts +2 -3
- package/molecules/Buttons/ButtonAnchor.js +14 -36
- package/molecules/Buttons/ButtonAnchor.js.map +1 -1
- package/molecules/Buttons/ButtonContent.d.ts +11 -3
- package/molecules/Buttons/ButtonContent.js +13 -6
- package/molecules/Buttons/ButtonContent.js.map +1 -1
- package/molecules/Buttons/FakeButton.d.ts +7 -0
- package/molecules/Buttons/FakeButton.js +27 -0
- package/molecules/Buttons/FakeButton.js.map +1 -0
- package/molecules/Buttons/InertButton.d.ts +4 -0
- package/molecules/Buttons/InertButton.js +14 -31
- package/molecules/Buttons/InertButton.js.map +1 -1
- package/molecules/Buttons/v2/Button.d.ts +10 -0
- package/molecules/Buttons/v2/Button.js +32 -0
- package/molecules/Buttons/v2/Button.js.map +1 -0
- package/molecules/Buttons/v2/Button.type.d.ts +54 -0
- package/molecules/Buttons/v2/Button.type.js +42 -0
- package/molecules/Buttons/v2/Button.type.js.map +1 -0
- package/molecules/Buttons/v2/ButtonAnchor.d.ts +12 -0
- package/molecules/Buttons/v2/ButtonAnchor.js +32 -0
- package/molecules/Buttons/v2/ButtonAnchor.js.map +1 -0
- package/molecules/Card.js.map +1 -1
- package/molecules/ElasticHeight.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
- package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
- package/molecules/Forms/DateField.js +142 -115
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js.map +1 -1
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/FormLabel.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +15 -15
- package/molecules/Forms/NumberField.js +68 -68
- package/molecules/Forms/NumberField.js.map +1 -1
- package/molecules/Forms/Password/Password.js.map +1 -1
- 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.map +1 -1
- package/molecules/Forms/Select.js.map +1 -1
- package/molecules/Forms/Switch.js.map +1 -1
- package/molecules/Forms/TextField.js.map +1 -1
- package/molecules/HamburgerIcon.js.map +1 -1
- package/molecules/Link.js.map +1 -1
- package/molecules/Loader.js.map +1 -1
- package/molecules/Pagination.d.ts +2 -1
- package/molecules/Pagination.helper.js.map +1 -1
- package/molecules/Pagination.js +67 -45
- package/molecules/Pagination.js.map +1 -1
- package/molecules/Popin.js +16 -16
- package/molecules/Popin.js.map +1 -1
- package/molecules/Spinner.js.map +1 -1
- package/molecules/Tabs/Tab.js.map +1 -1
- package/molecules/Tabs/TabList.js.map +1 -1
- package/molecules/Tabs/TabPanel.js.map +1 -1
- package/molecules/Tabs/Tabs.js.map +1 -1
- package/molecules/Tabs/TabsBody.js.map +1 -1
- package/molecules/Tabs/context/TabControl.js.map +1 -1
- package/molecules/Tabs/hooks/tabControl.js.map +1 -1
- package/molecules/Tabs/theme.js.map +1 -1
- package/package.json +11 -11
- package/styles/globals.css +12 -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 +730 -510
- package/tailwind/tailwind.preset.js +705 -631
- 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/ScrollerLabels.d.js +2 -0
- package/types/ScrollerLabels.d.js.map +1 -0
- package/molecules/Buttons/Button.helpers.d.ts +0 -8
- package/molecules/Buttons/Button.helpers.js +0 -12
- 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
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
-
import './button.css';
|
|
3
2
|
import { type CommonButtonProps } from './Button';
|
|
4
|
-
|
|
3
|
+
type ButtonAnchorProps = CommonButtonProps & {
|
|
5
4
|
component?: FunctionComponent<PropsWithChildren<any>> | string;
|
|
6
|
-
}
|
|
5
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
7
6
|
export declare const ButtonAnchor: FunctionComponent<ButtonAnchorProps>;
|
|
8
7
|
export {};
|
|
@@ -1,40 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label: o,
|
|
15
|
-
children: a,
|
|
16
|
-
title: c,
|
|
17
|
-
icon: p,
|
|
18
|
-
dataTestId: i,
|
|
19
|
-
href: l,
|
|
20
|
-
groupName: f = "",
|
|
21
|
-
...h
|
|
22
|
-
}) => {
|
|
23
|
-
const u = t === "text", d = y[t], x = w(s, e, f);
|
|
24
|
-
return /* @__PURE__ */ m(
|
|
25
|
-
r,
|
|
26
|
-
{
|
|
27
|
-
"data-name": "ButtonAnchor",
|
|
28
|
-
"data-testid": i,
|
|
29
|
-
className: C(B, x, d, t, n),
|
|
30
|
-
title: c || o,
|
|
31
|
-
href: l,
|
|
32
|
-
...h,
|
|
33
|
-
children: /* @__PURE__ */ m(A, { showLabel: u, label: o, icon: p, children: a })
|
|
34
|
-
}
|
|
35
|
-
);
|
|
1
|
+
import { jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonAnchor as r } from "./v2/ButtonAnchor.js";
|
|
3
|
+
import { BUTTON_VARIANT_LEGACY as c, BUTTON_THEME_LEGACY as e } from "./Button.js";
|
|
4
|
+
const i = (t) => {
|
|
5
|
+
const o = {
|
|
6
|
+
...t,
|
|
7
|
+
...e[t.theme] || {},
|
|
8
|
+
...c[t.variant] || {}
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ n(r, { ...o, children: [
|
|
11
|
+
o.label,
|
|
12
|
+
t.children
|
|
13
|
+
] });
|
|
36
14
|
};
|
|
37
15
|
export {
|
|
38
|
-
|
|
16
|
+
i as ButtonAnchor
|
|
39
17
|
};
|
|
40
18
|
//# sourceMappingURL=ButtonAnchor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAnchor.js","sources":["../../../lib/molecules/Buttons/ButtonAnchor.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ButtonAnchor.js","sources":["../../../lib/molecules/Buttons/ButtonAnchor.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, FunctionComponent, PropsWithChildren } from 'react';\nimport { ButtonAnchor as ButtonAnchorV2 } from './v2/ButtonAnchor';\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\n\ntype ButtonAnchorProps = CommonButtonProps & {\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n} & AnchorHTMLAttributes<HTMLAnchorElement>;\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = (props) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <ButtonAnchorV2 {...opts}>\n {opts.label}\n {props.children}\n </ButtonAnchorV2>\n );\n};\n"],"names":["ButtonAnchor","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsxs","ButtonAnchorV2"],"mappings":";;;AAQO,MAAMA,IAAqD,CAACC,MAAU;AAC3E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIG,EAAsBH,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAI,EAACC,GAAA,EAAgB,GAAGJ,GACjB,UAAA;AAAA,IAAAA,EAAK;AAAA,IACLD,EAAM;AAAA,EAAA,GACT;AAEJ;"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { type IconicNames, type IconicTypes } from '../../atoms/Icons';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type ButtonContentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
showLabel?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
5
11
|
label?: string;
|
|
6
12
|
children?: ReactNode;
|
|
7
13
|
icon?: IconicNames;
|
|
8
14
|
iconType?: IconicTypes;
|
|
9
|
-
|
|
15
|
+
iconWidth?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const ButtonContent: FunctionComponent<ButtonContentProps>;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Icon as
|
|
1
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as c } from "../../atoms/Icons/Icon.js";
|
|
3
3
|
import "@clubmed/trident-icons";
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const f = ({
|
|
5
|
+
showLabel: r,
|
|
6
|
+
label: t,
|
|
7
|
+
children: s,
|
|
8
|
+
icon: e,
|
|
9
|
+
iconType: o,
|
|
10
|
+
iconWidth: m
|
|
11
|
+
}) => /* @__PURE__ */ p("span", { className: "flex items-center justify-center gap-x-8 w-full", children: [
|
|
12
|
+
r ? t : t && /* @__PURE__ */ n("span", { className: "sr-only", children: t }),
|
|
6
13
|
s,
|
|
7
|
-
e && /* @__PURE__ */ n(
|
|
14
|
+
e && /* @__PURE__ */ n(c, { name: e, width: m ?? "24px", type: o })
|
|
8
15
|
] });
|
|
9
16
|
export {
|
|
10
|
-
|
|
17
|
+
f as ButtonContent
|
|
11
18
|
};
|
|
12
19
|
//# sourceMappingURL=ButtonContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonContent.js","sources":["../../../lib/molecules/Buttons/ButtonContent.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\nexport
|
|
1
|
+
{"version":3,"file":"ButtonContent.js","sources":["../../../lib/molecules/Buttons/ButtonContent.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\nexport type ButtonContentProps = {\n /**\n * @deprecated\n */\n showLabel?: boolean;\n /**\n * @deprecated\n */\n label?: string;\n children?: ReactNode;\n icon?: IconicNames;\n iconType?: IconicTypes;\n iconWidth?: string;\n};\n\nexport const ButtonContent: FunctionComponent<ButtonContentProps> = ({\n showLabel,\n label,\n children,\n icon,\n iconType,\n iconWidth,\n}) => {\n return (\n <span className=\"flex items-center justify-center gap-x-8 w-full\">\n {showLabel ? label : label && <span className=\"sr-only\">{label}</span>}\n {children}\n {icon && <Icon name={icon} width={iconWidth ?? '24px'} type={iconType} />}\n </span>\n );\n};\n"],"names":["ButtonContent","showLabel","label","children","icon","iconType","iconWidth","jsxs","jsx","Icon"],"mappings":";;;AAmBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,MAEI,gBAAAC,EAAC,QAAA,EAAK,WAAU,mDACb,UAAA;AAAA,EAAAN,IAAYC,IAAQA,KAAS,gBAAAM,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAN,GAAM;AAAA,EAC9DC;AAAA,EACAC,uBAASK,GAAA,EAAK,MAAML,GAAM,OAAOE,KAAa,QAAQ,MAAMD,EAAA,CAAU;AAAA,GACzE;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
|
+
import { type ButtonProps } from './v2/Button.type';
|
|
3
|
+
import './v2/Button.css';
|
|
4
|
+
interface Props extends ButtonProps, Omit<ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FakeButton: FunctionComponent<Props>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "../../chunks/index.js";
|
|
3
|
+
import { getButtonClasses as f } from "./v2/Button.type.js";
|
|
4
|
+
import { ButtonContent as c } from "./ButtonContent.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const g = ({
|
|
7
|
+
className: t,
|
|
8
|
+
children: r,
|
|
9
|
+
color: s = "saffron",
|
|
10
|
+
icon: m,
|
|
11
|
+
iconWidth: n,
|
|
12
|
+
size: e = "medium",
|
|
13
|
+
theme: a = "solid",
|
|
14
|
+
variant: i = "pill",
|
|
15
|
+
...p
|
|
16
|
+
}) => /* @__PURE__ */ o(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
...p,
|
|
20
|
+
className: l(f({ color: s, size: e, theme: a, variant: i }), t),
|
|
21
|
+
children: /* @__PURE__ */ o(c, { icon: m, iconWidth: n, children: r })
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
export {
|
|
25
|
+
g as FakeButton
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=FakeButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeButton.js","sources":["../../../lib/molecules/Buttons/FakeButton.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './v2/Button.type';\n\nimport { ButtonContent } from './ButtonContent';\n\nimport './v2/Button.css';\n\ninterface Props extends ButtonProps, Omit<ComponentPropsWithoutRef<'span'>, 'color'> {}\n\nexport const FakeButton: FunctionComponent<Props> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n ...attrs\n}) => {\n return (\n <span\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </span>\n );\n};\n"],"names":["FakeButton","className","children","color","icon","iconWidth","size","theme","variant","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;AAWO,MAAMA,IAAuC,CAAC;AAAA,EACnD,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,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAT,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAElF,UAAA,gBAAAS,EAACG,GAAA,EAAc,MAAAT,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children: n,
|
|
15
|
-
title: a,
|
|
16
|
-
icon: i,
|
|
17
|
-
dataTestId: p,
|
|
18
|
-
groupName: c = ""
|
|
19
|
-
}) => {
|
|
20
|
-
const l = t === "text", f = x[t], u = y(e, r, c);
|
|
21
|
-
return /* @__PURE__ */ s(
|
|
22
|
-
"span",
|
|
23
|
-
{
|
|
24
|
-
"data-name": "InertButton",
|
|
25
|
-
"data-testid": p,
|
|
26
|
-
className: d(h, u, f, t, m),
|
|
27
|
-
title: a || o,
|
|
28
|
-
children: /* @__PURE__ */ s(B, { showLabel: l, label: o, icon: i, children: n })
|
|
29
|
-
}
|
|
30
|
-
);
|
|
1
|
+
import { jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { BUTTON_VARIANT_LEGACY as n, BUTTON_THEME_LEGACY as o } from "./Button.js";
|
|
3
|
+
import { FakeButton as m } from "./FakeButton.js";
|
|
4
|
+
const c = (t) => {
|
|
5
|
+
const r = {
|
|
6
|
+
...t,
|
|
7
|
+
...o[t.theme] || {},
|
|
8
|
+
...n[t.variant] || {}
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ e(m, { ...r, children: [
|
|
11
|
+
r.label,
|
|
12
|
+
t.children
|
|
13
|
+
] });
|
|
31
14
|
};
|
|
32
15
|
export {
|
|
33
|
-
|
|
16
|
+
c as InertButton
|
|
34
17
|
};
|
|
35
18
|
//# sourceMappingURL=InertButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InertButton.js","sources":["../../../lib/molecules/Buttons/InertButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"InertButton.js","sources":["../../../lib/molecules/Buttons/InertButton.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { BUTTON_THEME_LEGACY, BUTTON_VARIANT_LEGACY, type CommonButtonProps } from './Button';\nimport { FakeButton } from '@/molecules/Buttons/FakeButton';\n\n/**\n * @deprecated Use `FakeButton` instead.\n * @param props\n */\nexport const InertButton: FunctionComponent<CommonButtonProps> = (props) => {\n const opts = {\n ...props,\n ...(BUTTON_THEME_LEGACY[props.theme!] || {}),\n ...(BUTTON_VARIANT_LEGACY[props.variant!] || {}),\n };\n\n return (\n <FakeButton {...opts}>\n {opts.label}\n {props.children}\n </FakeButton>\n );\n};\n"],"names":["InertButton","props","opts","BUTTON_THEME_LEGACY","BUTTON_VARIANT_LEGACY","jsxs","FakeButton"],"mappings":";;;AASO,MAAMA,IAAoD,CAACC,MAAU;AAC1E,QAAMC,IAAO;AAAA,IACX,GAAGD;AAAA,IACH,GAAIE,EAAoBF,EAAM,KAAM,KAAK,CAAA;AAAA,IACzC,GAAIG,EAAsBH,EAAM,OAAQ,KAAK,CAAA;AAAA,EAAC;AAGhD,SACE,gBAAAI,EAACC,GAAA,EAAY,GAAGJ,GACb,UAAA;AAAA,IAAAA,EAAK;AAAA,IACLD,EAAM;AAAA,EAAA,GACT;AAEJ;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, FunctionComponent } from 'react';
|
|
2
|
+
import { type ButtonProps as Btn } from './Button.type';
|
|
3
|
+
import './Button.css';
|
|
4
|
+
export interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use `data-testid` instead
|
|
7
|
+
*/
|
|
8
|
+
dataTestId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const Button: FunctionComponent<ButtonProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { c as p } from "../../../chunks/index.js";
|
|
4
|
+
import { getButtonClasses as c } from "./Button.type.js";
|
|
5
|
+
import { ButtonContent as d } from "../ButtonContent.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const g = ({
|
|
8
|
+
className: o,
|
|
9
|
+
children: n,
|
|
10
|
+
color: s = "saffron",
|
|
11
|
+
icon: e,
|
|
12
|
+
iconWidth: m,
|
|
13
|
+
size: r = "medium",
|
|
14
|
+
theme: a = "solid",
|
|
15
|
+
variant: i = "pill",
|
|
16
|
+
dataTestId: u,
|
|
17
|
+
...l
|
|
18
|
+
}) => /* @__PURE__ */ t(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
"data-testid": u,
|
|
23
|
+
...l,
|
|
24
|
+
className: p(c({ color: s, size: r, theme: a, variant: i }), o),
|
|
25
|
+
"data-name": "Button",
|
|
26
|
+
children: /* @__PURE__ */ t(d, { icon: e, iconWidth: m, children: n })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
g as Button
|
|
31
|
+
};
|
|
32
|
+
//# 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 { ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport { getButtonClasses, type ButtonProps as Btn } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonProps extends Btn, Omit<ComponentPropsWithoutRef<'button'>, 'color'> {\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n dataTestId,\n ...attrs\n}) => {\n return (\n <button\n type=\"button\"\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"Button\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </button>\n );\n};\n"],"names":["Button","className","children","color","icon","iconWidth","size","theme","variant","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAgBO,MAAMA,IAAyC,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,YAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,eAAaF;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAV,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAU,EAACG,GAAA,EAAc,MAAAV,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Colors } from '../../../types/Colors';
|
|
2
|
+
import type { IconicNames, IconicTypes } from '../../../atoms/Icons';
|
|
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
|
+
};
|
|
40
|
+
export declare const BUTTON_THEMES: {
|
|
41
|
+
readonly outline: "button-outline";
|
|
42
|
+
readonly solid: "button-solid";
|
|
43
|
+
};
|
|
44
|
+
export declare const BUTTON_VARIANTS: {
|
|
45
|
+
readonly circle: "button-circle";
|
|
46
|
+
readonly pill: "button-pill";
|
|
47
|
+
};
|
|
48
|
+
export declare const BUTTON_SIZES: {
|
|
49
|
+
readonly small: "button-small";
|
|
50
|
+
readonly medium: "button-medium";
|
|
51
|
+
readonly large: "button-large";
|
|
52
|
+
};
|
|
53
|
+
export declare const getButtonClasses: ({ color, size, theme, variant }: Params) => string;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
}, a = (t) => u[t || "saffron"], l = {
|
|
18
|
+
outline: "button-outline",
|
|
19
|
+
solid: "button-solid"
|
|
20
|
+
}, s = (t) => l[t || "solid"], i = {
|
|
21
|
+
circle: "button-circle",
|
|
22
|
+
pill: "button-pill"
|
|
23
|
+
}, b = (t) => i[t || "pill"], d = {
|
|
24
|
+
small: "button-small",
|
|
25
|
+
medium: "button-medium",
|
|
26
|
+
large: "button-large"
|
|
27
|
+
}, c = (t) => d[t || "medium"], m = ({ color: t, size: n, theme: o, variant: e }) => r(
|
|
28
|
+
"flex",
|
|
29
|
+
"button",
|
|
30
|
+
s(o),
|
|
31
|
+
a(t),
|
|
32
|
+
b(e),
|
|
33
|
+
c(n)
|
|
34
|
+
);
|
|
35
|
+
export {
|
|
36
|
+
u as BUTTON_COLORS,
|
|
37
|
+
d as BUTTON_SIZES,
|
|
38
|
+
l as BUTTON_THEMES,
|
|
39
|
+
i as BUTTON_VARIANTS,
|
|
40
|
+
m as getButtonClasses
|
|
41
|
+
};
|
|
42
|
+
//# 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 { Colors } from '@/types/Colors';\nimport type { IconicNames, IconicTypes } from '@/atoms/Icons';\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} as const satisfies Record<string, `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;AACT,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;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import { type ButtonProps } from './Button.type';
|
|
3
|
+
import './Button.css';
|
|
4
|
+
export interface ButtonAnchorProps extends ButtonProps, Omit<ComponentPropsWithoutRef<'a'>, 'color'> {
|
|
5
|
+
href: string;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use `data-testid` instead
|
|
8
|
+
*/
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
component?: FunctionComponent<PropsWithChildren<any>> | string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ButtonAnchor: FunctionComponent<ButtonAnchorProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { c as u } from "../../../chunks/index.js";
|
|
4
|
+
import { getButtonClasses as d } from "./Button.type.js";
|
|
5
|
+
import { ButtonContent as f } from "../ButtonContent.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const j = ({
|
|
8
|
+
className: o,
|
|
9
|
+
children: m,
|
|
10
|
+
color: n = "saffron",
|
|
11
|
+
icon: r,
|
|
12
|
+
iconWidth: s,
|
|
13
|
+
size: a = "medium",
|
|
14
|
+
theme: e = "solid",
|
|
15
|
+
variant: i = "pill",
|
|
16
|
+
component: c = "a",
|
|
17
|
+
dataTestId: p,
|
|
18
|
+
...l
|
|
19
|
+
}) => /* @__PURE__ */ t(
|
|
20
|
+
c,
|
|
21
|
+
{
|
|
22
|
+
"data-testid": p,
|
|
23
|
+
...l,
|
|
24
|
+
className: u(d({ color: n, size: a, theme: e, variant: i }), o),
|
|
25
|
+
"data-name": "ButtonAnchor",
|
|
26
|
+
children: /* @__PURE__ */ t(f, { icon: r, iconWidth: s, children: m })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
j as ButtonAnchor
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=ButtonAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonAnchor.js","sources":["../../../../lib/molecules/Buttons/v2/ButtonAnchor.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport type { ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';\n\nimport { getButtonClasses, type ButtonProps } from './Button.type';\nimport { ButtonContent } from '../ButtonContent';\n\nimport './Button.css';\n\nexport interface ButtonAnchorProps\n extends ButtonProps,\n Omit<ComponentPropsWithoutRef<'a'>, 'color'> {\n href: string;\n /**\n * @deprecated use `data-testid` instead\n */\n dataTestId?: string;\n\n component?: FunctionComponent<PropsWithChildren<any>> | string;\n}\n\nexport const ButtonAnchor: FunctionComponent<ButtonAnchorProps> = ({\n className,\n children,\n color = 'saffron',\n icon,\n iconWidth,\n size = 'medium',\n theme = 'solid',\n variant = 'pill',\n component = 'a',\n dataTestId,\n ...attrs\n}) => {\n const Cmp = component as FunctionComponent<PropsWithChildren<ButtonAnchorProps>>;\n return (\n <Cmp\n data-testid={dataTestId}\n {...attrs}\n className={classnames(getButtonClasses({ color, size, theme, variant }), className)}\n data-name=\"ButtonAnchor\"\n >\n <ButtonContent icon={icon} iconWidth={iconWidth}>\n {children}\n </ButtonContent>\n </Cmp>\n );\n};\n"],"names":["ButtonAnchor","className","children","color","icon","iconWidth","size","theme","variant","component","dataTestId","attrs","jsx","classnames","getButtonClasses","ButtonContent"],"mappings":";;;;;;AAsBO,MAAMA,IAAqD,CAAC;AAAA,EACjE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,YAAAC;AAAA,EACA,GAAGC;AACL,MAGI,gBAAAC;AAAA,EAFUH;AAAA,EAET;AAAA,IACC,eAAaC;AAAA,IACZ,GAAGC;AAAA,IACJ,WAAWE,EAAWC,EAAiB,EAAE,OAAAX,GAAO,MAAAG,GAAM,OAAAC,GAAO,SAAAC,GAAS,GAAGP,CAAS;AAAA,IAClF,aAAU;AAAA,IAEV,UAAA,gBAAAW,EAACG,GAAA,EAAc,MAAAX,GAAY,WAAAC,GACxB,UAAAH,EAAA,CACH;AAAA,EAAA;AAAA;"}
|
package/molecules/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../lib/molecules/Card.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\ninterface CardProps {\n title: string;\n icon: IconicNames;\n iconType?: IconicTypes;\n theme?: 'light' | 'dark';\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 <div\n className=\"border-lightGrey rounded-16 flex shrink-0 flex-row gap-20 border bg-white p-20\"\n data-name={dataName}\n >\n <div\n className={classnames('flex h-48 w-48 shrink-0 items-center justify-center rounded-full', {\n 'bg-ultramarine text-white': theme === 'dark',\n 'bg-lightSand text-black': theme === 'light',\n })}\n >\n <Icon name={icon} type={iconType} width=\"24px\" />\n </div>\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 </div>\n );\n};\n"],"names":["Card","title","children","icon","iconType","theme","dataName","jsxs","jsx","classnames","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;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAWD;AAAA,IAEX,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC,EAAW,oEAAoE;AAAA,YACxF,6BAA6BJ,MAAU;AAAA,YACvC,2BAA2BA,MAAU;AAAA,UAAA,CACtC;AAAA,UAED,4BAACK,
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../lib/molecules/Card.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { FunctionComponent, PropsWithChildren } from 'react';\n\nimport { Icon, type IconicNames, type IconicTypes } from '@/atoms/Icons';\n\ninterface CardProps {\n title: string;\n icon: IconicNames;\n iconType?: IconicTypes;\n theme?: 'light' | 'dark';\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 <div\n className=\"border-lightGrey rounded-16 flex shrink-0 flex-row gap-20 border bg-white p-20\"\n data-name={dataName}\n >\n <div\n className={classnames('flex h-48 w-48 shrink-0 items-center justify-center rounded-full', {\n 'bg-ultramarine text-white': theme === 'dark',\n 'bg-lightSand text-black': theme === 'light',\n })}\n >\n <Icon name={icon} type={iconType} width=\"24px\" />\n </div>\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 </div>\n );\n};\n"],"names":["Card","title","children","icon","iconType","theme","dataName","jsxs","jsx","classnames","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;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,aAAWD;AAAA,IAEX,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWC,EAAW,oEAAoE;AAAA,YACxF,6BAA6BJ,MAAU;AAAA,YACvC,2BAA2BA,MAAU;AAAA,UAAA,CACtC;AAAA,UAED,4BAACK,GAAA,EAAK,MAAMP,GAAM,MAAMC,GAAU,OAAM,OAAA,CAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAEjD,gBAAAG,EAAC,OAAA,EAAI,WAAU,uBACb,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAP,GAAM;AAAA,QAC9C,gBAAAO,EAAC,OAAA,EAAI,WAAU,uBAAuB,UAAAN,EAAA,CAAS;AAAA,MAAA,EAAA,CACjD;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["import { useSpring, animated, useResize } from '@react-spring/web';\nimport classnames from 'classnames';\nimport {\n type FunctionComponent,\n type MutableRefObject,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from 'react';\n\n/**\n * This is not a Collapse component, it's a component that animates *to* the height of its children.\n * It does the *absolute* same but you Bring Your Own Height™ by applying a class to the children.\n * e.g.: <ElasticHeight className={isOpen ? \"\" : \"h-0\"}><div>...</div></ElasticHeight>\n * ID is there for accessibility purposes.\n *\n * This is in no way affiliated with Amazon ElasticSearch.\n */\n\ninterface ElasticHeightProps {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Class of the element (please provide something that sets the height)\n */\n className?: string;\n /**\n * Class of the container (to avoid CLS, mainly)\n */\n containerClassName?: string;\n /**\n * Role of the element\n */\n role?: string;\n}\n\nconst linearInterpolation = (x: number) => x;\n\nexport const ElasticHeight: FunctionComponent<PropsWithChildren<ElasticHeightProps>> = ({\n children,\n id,\n className,\n role,\n containerClassName,\n}) => {\n const ref = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { height } = useResize({ container: ref });\n\n const [styles, api] = useSpring(() => ({\n from: {\n height: height.to(linearInterpolation),\n },\n immediate: true,\n }));\n\n useEffect(() => {\n api.start({\n to: {\n height: height.to(linearInterpolation),\n },\n config: {\n tension: 170,\n friction: 26,\n },\n });\n }, [api, height]);\n\n return (\n <animated.div\n role={role}\n className={classnames('overflow-hidden', containerClassName)}\n style={{ ...styles }}\n id={id}\n >\n <div className={className} ref={ref}>\n {children}\n </div>\n </animated.div>\n );\n};\n"],"names":["linearInterpolation","x","ElasticHeight","children","id","className","role","containerClassName","ref","useRef","height","useResize","styles","api","useSpring","useEffect","jsx","animated","classnames"],"mappings":";;;;AAsCA,MAAMA,IAAsB,CAACC,MAAcA,GAE9BC,IAA0E,CAAC;AAAA,EACtF,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,oBAAAC;AACF,MAAM;
|
|
1
|
+
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["import { useSpring, animated, useResize } from '@react-spring/web';\nimport classnames from 'classnames';\nimport {\n type FunctionComponent,\n type MutableRefObject,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from 'react';\n\n/**\n * This is not a Collapse component, it's a component that animates *to* the height of its children.\n * It does the *absolute* same but you Bring Your Own Height™ by applying a class to the children.\n * e.g.: <ElasticHeight className={isOpen ? \"\" : \"h-0\"}><div>...</div></ElasticHeight>\n * ID is there for accessibility purposes.\n *\n * This is in no way affiliated with Amazon ElasticSearch.\n */\n\ninterface ElasticHeightProps {\n /**\n * Id of the element\n */\n id?: string;\n /**\n * Class of the element (please provide something that sets the height)\n */\n className?: string;\n /**\n * Class of the container (to avoid CLS, mainly)\n */\n containerClassName?: string;\n /**\n * Role of the element\n */\n role?: string;\n}\n\nconst linearInterpolation = (x: number) => x;\n\nexport const ElasticHeight: FunctionComponent<PropsWithChildren<ElasticHeightProps>> = ({\n children,\n id,\n className,\n role,\n containerClassName,\n}) => {\n const ref = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { height } = useResize({ container: ref });\n\n const [styles, api] = useSpring(() => ({\n from: {\n height: height.to(linearInterpolation),\n },\n immediate: true,\n }));\n\n useEffect(() => {\n api.start({\n to: {\n height: height.to(linearInterpolation),\n },\n config: {\n tension: 170,\n friction: 26,\n },\n });\n }, [api, height]);\n\n return (\n <animated.div\n role={role}\n className={classnames('overflow-hidden', containerClassName)}\n style={{ ...styles }}\n id={id}\n >\n <div className={className} ref={ref}>\n {children}\n </div>\n </animated.div>\n );\n};\n"],"names":["linearInterpolation","x","ElasticHeight","children","id","className","role","containerClassName","ref","useRef","height","useResize","styles","api","useSpring","useEffect","jsx","animated","classnames"],"mappings":";;;;AAsCA,MAAMA,IAAsB,CAACC,MAAcA,GAE9BC,IAA0E,CAAC;AAAA,EACtF,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,oBAAAC;AACF,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAI,GACjC,EAAE,QAAAC,EAAA,IAAWC,EAAU,EAAE,WAAWH,GAAK,GAEzC,CAACI,GAAQC,CAAG,IAAIC,EAAU,OAAO;AAAA,IACrC,MAAM;AAAA,MACJ,QAAQJ,EAAO,GAAGV,CAAmB;AAAA,IAAA;AAAA,IAEvC,WAAW;AAAA,EAAA,EACX;AAEF,SAAAe,EAAU,MAAM;AACd,IAAAF,EAAI,MAAM;AAAA,MACR,IAAI;AAAA,QACF,QAAQH,EAAO,GAAGV,CAAmB;AAAA,MAAA;AAAA,MAEvC,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,UAAU;AAAA,MAAA;AAAA,IACZ,CACD;AAAA,EACH,GAAG,CAACa,GAAKH,CAAM,CAAC,GAGd,gBAAAM;AAAA,IAACC,EAAS;AAAA,IAAT;AAAA,MACC,MAAAX;AAAA,MACA,WAAWY,EAAW,mBAAmBX,CAAkB;AAAA,MAC3D,OAAO,EAAE,GAAGK,EAAA;AAAA,MACZ,IAAAR;AAAA,MAEA,UAAA,gBAAAY,EAAC,OAAA,EAAI,WAAAX,GAAsB,KAAAG,GACxB,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -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 { Icon } from '@/atoms/Icons/index.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\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,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { Icon } from '@/atoms/Icons/index.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\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,KAAA,QAAAA,EAAWX,GAAMa,IAAYR,MAAU,SAAYA,IAAQQ,IAAqB;AAAA,IAClF;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkboxes.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport type { CheckboxProps } from './Checkbox.js';\nimport classnames from 'classnames';\n\nexport interface CheckboxesProps<Value = string>\n extends Pick<\n FormControlProps<Value[]>,\n | 'id'\n | 'name'\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'readOnly'\n | 'tabIndex'\n | 'description'\n | 'validationStatus'\n | 'errorMessage'\n >,\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {}\n\nexport function Checkboxes<Value = string>(props: CheckboxesProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n children,\n value: initialValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n tabIndex = 0,\n ...rest\n } = props;\n\n const { value, setValue } = useValue<Value[]>({\n name,\n initialValue,\n formatter(value) {\n return value !== undefined ? ([].concat(value as never) as Value[]) : value;\n },\n defaultValue: (defaultValue as Value[]) || ([] as Value[]),\n onChange,\n });\n\n return (\n <div {...rest} className={rest.className} role=\"listbox\">\n {Children.map(children, (child, index) => {\n if (isValidElement(child)) {\n const propValue: Value = (child.props as CheckboxProps<Value>).value as Value;\n\n return cloneElement(child, {\n ...child.props,\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: classnames(child.props.className || 'mt-8 first:mt-0'),\n checked: value.includes(propValue),\n onChange(_: string, item: Value | null) {\n if (item === null) {\n setValue(value.filter((v) => v !== propValue));\n } else {\n setValue(value.concat(propValue));\n }\n },\n } as CheckboxProps<Value>);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"names":["Checkboxes","props","internalId","useId","id","name","children","initialValue","defaultValue","onChange","disabled","readOnly","tabIndex","rest","value","setValue","useValue","jsx","Children","child","index","isValidElement","propValue","cloneElement","classnames","_","item","v"],"mappings":";;;;AAsBO,SAASA,EAA2BC,GAA+B;AACxE,QAAMC,IAAaC,
|
|
1
|
+
{"version":3,"file":"Checkboxes.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl.js';\nimport { useValue } from '@/hooks/useValue.js';\nimport type { CheckboxProps } from './Checkbox.js';\nimport classnames from 'classnames';\n\nexport interface CheckboxesProps<Value = string>\n extends Pick<\n FormControlProps<Value[]>,\n | 'id'\n | 'name'\n | 'value'\n | 'onChange'\n | 'disabled'\n | 'readOnly'\n | 'tabIndex'\n | 'description'\n | 'validationStatus'\n | 'errorMessage'\n >,\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {}\n\nexport function Checkboxes<Value = string>(props: CheckboxesProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n children,\n value: initialValue,\n defaultValue,\n onChange,\n disabled,\n readOnly,\n tabIndex = 0,\n ...rest\n } = props;\n\n const { value, setValue } = useValue<Value[]>({\n name,\n initialValue,\n formatter(value) {\n return value !== undefined ? ([].concat(value as never) as Value[]) : value;\n },\n defaultValue: (defaultValue as Value[]) || ([] as Value[]),\n onChange,\n });\n\n return (\n <div {...rest} className={rest.className} role=\"listbox\">\n {Children.map(children, (child, index) => {\n if (isValidElement(child)) {\n const propValue: Value = (child.props as CheckboxProps<Value>).value as Value;\n\n return cloneElement(child, {\n ...child.props,\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: classnames(child.props.className || 'mt-8 first:mt-0'),\n checked: value.includes(propValue),\n onChange(_: string, item: Value | null) {\n if (item === null) {\n setValue(value.filter((v) => v !== propValue));\n } else {\n setValue(value.concat(propValue));\n }\n },\n } as CheckboxProps<Value>);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"names":["Checkboxes","props","internalId","useId","id","name","children","initialValue","defaultValue","onChange","disabled","readOnly","tabIndex","rest","value","setValue","useValue","jsx","Children","child","index","isValidElement","propValue","cloneElement","classnames","_","item","v"],"mappings":";;;;AAsBO,SAASA,EAA2BC,GAA+B;AACxE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,UAAAE;AAAA,IACA,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,GAAGC;AAAA,EAAA,IACDZ,GAEE,EAAE,OAAAa,GAAO,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IAC5C,MAAAX;AAAA,IACA,cAAAE;AAAA,IACA,UAAUO,GAAO;AACf,aAAOA,MAAU,SAAa,CAAA,EAAG,OAAOA,CAAc,IAAgBA;AAAAA,IACxE;AAAA,IACA,cAAeN,KAA6B,CAAA;AAAA,IAC5C,UAAAC;AAAA,EAAA,CACD;AAED,SACE,gBAAAQ,EAAC,OAAA,EAAK,GAAGJ,GAAM,WAAWA,EAAK,WAAW,MAAK,WAC5C,UAAAK,EAAS,IAAIZ,GAAU,CAACa,GAAOC,MAAU;AACxC,QAAIC,EAAeF,CAAK,GAAG;AACzB,YAAMG,IAAoBH,EAAM,MAA+B;AAE/D,aAAOI,EAAaJ,GAAO;AAAA,QACzB,GAAGA,EAAM;AAAA,QACT,MAAAd;AAAA,QACA,IAAI,GAAGD,CAAE,IAAIgB,CAAK;AAAA,QAClB,UAAAV;AAAA,QACA,UAAAC;AAAA,QACA,UAAUC,IAAWQ,IAAQ;AAAA,QAC7B,WAAWI,EAAWL,EAAM,MAAM,aAAa,iBAAiB;AAAA,QAChE,SAASL,EAAM,SAASQ,CAAS;AAAA,QACjC,SAASG,GAAWC,GAAoB;AACtC,UACEX,EADEW,MAAS,OACFZ,EAAM,OAAO,CAACa,MAAMA,MAAML,CAAS,IAEnCR,EAAM,OAAOQ,CAAS,CAFc;AAAA,QAIjD;AAAA,MAAA,CACuB;AAAA,IAC3B;AAEA,WAAOH;AAAA,EACT,CAAC,EAAA,CACH;AAEJ;"}
|