@clubmed/trident-ui 1.3.0-beta.1 → 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 +956 -862
- 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 +28 -28
- 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 +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.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 +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/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 -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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as m } from "../chunks/index.js";
|
|
3
|
+
import { getTheme as c } from "./Chip.themes.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
className: e,
|
|
6
|
+
color: s = "sienna",
|
|
7
|
+
size: r = "size-32",
|
|
8
|
+
theme: o = "solid",
|
|
9
|
+
children: t,
|
|
10
|
+
...n
|
|
11
|
+
}) => {
|
|
12
|
+
const { thRoot: i } = c(o, { color: s });
|
|
13
|
+
return /* @__PURE__ */ a(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
...n,
|
|
17
|
+
className: m(
|
|
18
|
+
"inline-flex aspect-square shrink-0 items-center justify-center overflow-hidden rounded-full border",
|
|
19
|
+
r,
|
|
20
|
+
i,
|
|
21
|
+
e
|
|
22
|
+
),
|
|
23
|
+
"data-name": "Chip",
|
|
24
|
+
children: t
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
f as Chip
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=Chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.js","sources":["../../lib/molecules/Chip.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport type { ComponentPropsWithoutRef } from 'react';\n\nimport { getTheme, type Theme } from './Chip.themes';\n\nimport type { Colors } from '@/types/Colors';\n\nexport interface ChipProps extends ComponentPropsWithoutRef<'span'> {\n color?: Colors;\n size?: string;\n theme?: Theme;\n}\n\nexport const Chip = ({\n className,\n color = 'sienna',\n size = 'size-32',\n theme = 'solid',\n children,\n ...attrs\n}: ChipProps) => {\n const { thRoot } = getTheme(theme, { color });\n\n return (\n <span\n {...attrs}\n className={classNames(\n 'inline-flex aspect-square shrink-0 items-center justify-center overflow-hidden rounded-full border',\n size,\n thRoot,\n className,\n )}\n data-name=\"Chip\"\n >\n {children}\n </span>\n );\n};\n"],"names":["Chip","className","color","size","theme","children","attrs","thRoot","getTheme","jsx","classNames"],"mappings":";;;AAaO,MAAMA,IAAO,CAAC;AAAA,EACnB,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,GAAGC;AACL,MAAiB;AACf,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAASJ,GAAO,EAAE,OAAAF,GAAO;AAE5C,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGH;AAAA,MACJ,WAAWI;AAAAA,QACT;AAAA,QACAP;AAAA,QACAI;AAAA,QACAN;AAAA,MAAA;AAAA,MAEF,aAAU;AAAA,MAET,UAAAI;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Colors } from '../types/Colors';
|
|
2
|
+
export type Theme = 'solid' | 'outline' | 'light' | 'dark';
|
|
3
|
+
type Options = {
|
|
4
|
+
color: Colors;
|
|
5
|
+
};
|
|
6
|
+
export declare const themes: (color: Colors) => Record<Theme, {
|
|
7
|
+
thRoot: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getTheme: (theme: Theme, { color }: Options) => {
|
|
10
|
+
thRoot: string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { c as e } from "../chunks/index.js";
|
|
2
|
+
import { getBorderColor as r, getTextColor as n, getBgColor as g, getComplementaryTextColor as i } from "../helpers/colors/colors.js";
|
|
3
|
+
const l = (t) => ({
|
|
4
|
+
solid: {
|
|
5
|
+
thRoot: e(g(t), r(t), i(t))
|
|
6
|
+
},
|
|
7
|
+
outline: {
|
|
8
|
+
thRoot: e("bg-transparent", r(t), n(t))
|
|
9
|
+
},
|
|
10
|
+
light: {
|
|
11
|
+
thRoot: e("bg-lightSand text-black border-lightSand")
|
|
12
|
+
},
|
|
13
|
+
dark: {
|
|
14
|
+
thRoot: e("bg-ultramarine text-white border-ultramarine")
|
|
15
|
+
}
|
|
16
|
+
}), h = (t, { color: a }) => {
|
|
17
|
+
const o = l(a);
|
|
18
|
+
return o[t] || o.solid;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
h as getTheme,
|
|
22
|
+
l as themes
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Chip.themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.themes.js","sources":["../../lib/molecules/Chip.themes.ts"],"sourcesContent":["import classnames from 'classnames';\nimport type { Colors } from '@/types/Colors';\nimport {\n getBgColor,\n getBorderColor,\n getComplementaryTextColor,\n getTextColor,\n} from '@/helpers/colors/colors';\n\nexport type Theme = 'solid' | 'outline' | 'light' | 'dark';\n\ntype Options = { color: Colors };\n\nexport const themes = (color: Colors): Record<Theme, { thRoot: string }> => ({\n solid: {\n thRoot: classnames(getBgColor(color), getBorderColor(color), getComplementaryTextColor(color)),\n },\n outline: {\n thRoot: classnames('bg-transparent', getBorderColor(color), getTextColor(color)),\n },\n light: {\n thRoot: classnames('bg-lightSand text-black border-lightSand'),\n },\n dark: {\n thRoot: classnames('bg-ultramarine text-white border-ultramarine'),\n },\n});\n\nexport const getTheme = (theme: Theme, { color }: Options) => {\n const THEMES = themes(color);\n\n return THEMES[theme] || THEMES.solid;\n};\n"],"names":["themes","color","classnames","getBgColor","getBorderColor","getComplementaryTextColor","getTextColor","getTheme","theme","THEMES"],"mappings":";;AAaO,MAAMA,IAAS,CAACC,OAAsD;AAAA,EAC3E,OAAO;AAAA,IACL,QAAQC,EAAWC,EAAWF,CAAK,GAAGG,EAAeH,CAAK,GAAGI,EAA0BJ,CAAK,CAAC;AAAA,EAAA;AAAA,EAE/F,SAAS;AAAA,IACP,QAAQC,EAAW,kBAAkBE,EAAeH,CAAK,GAAGK,EAAaL,CAAK,CAAC;AAAA,EAAA;AAAA,EAEjF,OAAO;AAAA,IACL,QAAQC,EAAW,0CAA0C;AAAA,EAAA;AAAA,EAE/D,MAAM;AAAA,IACJ,QAAQA,EAAW,8CAA8C;AAAA,EAAA;AAErE,IAEaK,IAAW,CAACC,GAAc,EAAE,OAAAP,QAAqB;AAC5D,QAAMQ,IAAST,EAAOC,CAAK;AAE3B,SAAOQ,EAAOD,CAAK,KAAKC,EAAO;AACjC;"}
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* ID is there for accessibility purposes.
|
|
7
|
-
*
|
|
8
|
-
* This is in no way affiliated with Amazon ElasticSearch.
|
|
9
|
-
*/
|
|
10
|
-
interface ElasticHeightProps {
|
|
11
|
-
/**
|
|
12
|
-
* Id of the element
|
|
13
|
-
*/
|
|
14
|
-
id?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Class of the element (please provide something that sets the height)
|
|
17
|
-
*/
|
|
18
|
-
className?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Class of the container (to avoid CLS, mainly)
|
|
21
|
-
*/
|
|
22
|
-
containerClassName?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Role of the element
|
|
25
|
-
*/
|
|
26
|
-
role?: string;
|
|
1
|
+
import { type ComponentPropsWithoutRef, type FunctionComponent } from 'react';
|
|
2
|
+
interface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
innerClassName?: string;
|
|
4
|
+
isExpanded?: boolean;
|
|
5
|
+
min?: number;
|
|
27
6
|
}
|
|
28
|
-
export declare const ElasticHeight: FunctionComponent<
|
|
7
|
+
export declare const ElasticHeight: FunctionComponent<ElasticHeightProps>;
|
|
29
8
|
export {};
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import { useRef as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { c as l } from "../chunks/index.js";
|
|
4
|
+
import { useRef as m, useState as d, useLayoutEffect as h } from "react";
|
|
5
|
+
import p from "../hooks/useResizeObserver.js";
|
|
6
|
+
const R = ({
|
|
7
|
+
className: o,
|
|
8
|
+
children: a,
|
|
9
|
+
innerClassName: n,
|
|
10
|
+
isExpanded: t = !1,
|
|
11
|
+
min: f = 0,
|
|
12
|
+
...c
|
|
11
13
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
config: {
|
|
24
|
-
tension: 170,
|
|
25
|
-
friction: 26
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}, [o, e]), /* @__PURE__ */ s(
|
|
29
|
-
p.div,
|
|
14
|
+
const e = m(null), [u, r] = d(0);
|
|
15
|
+
return p({
|
|
16
|
+
ref: e,
|
|
17
|
+
onResize: () => {
|
|
18
|
+
var s;
|
|
19
|
+
e.current && r((s = e.current) == null ? void 0 : s.offsetHeight);
|
|
20
|
+
}
|
|
21
|
+
}), h(() => {
|
|
22
|
+
e.current && r(e.current.offsetHeight);
|
|
23
|
+
}, [e]), /* @__PURE__ */ i(
|
|
24
|
+
"div",
|
|
30
25
|
{
|
|
31
|
-
|
|
32
|
-
className:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: /* @__PURE__ */
|
|
26
|
+
...c,
|
|
27
|
+
className: l("overflow-hidden transition-all duration-500", o),
|
|
28
|
+
"data-expanded": t,
|
|
29
|
+
style: { height: t ? u : f },
|
|
30
|
+
children: /* @__PURE__ */ i("div", { className: n, ref: e, children: a })
|
|
36
31
|
}
|
|
37
32
|
);
|
|
38
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type ComponentPropsWithoutRef,\n type FunctionComponent,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport useResizeObserver from '@/hooks/useResizeObserver';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n const [max, setMax] = useState(0);\n\n useResizeObserver<HTMLDivElement>({\n ref: ref,\n onResize: () => {\n if (ref.current) {\n setMax(ref.current?.offsetHeight);\n }\n },\n });\n\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n setMax(ref.current.offsetHeight);\n }, [ref]);\n\n return (\n <div\n {...attrs}\n className={classnames('overflow-hidden transition-all duration-500', className)}\n data-expanded={isExpanded}\n style={{ height: isExpanded ? max : min }}\n >\n <div className={innerClassName} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["ElasticHeight","className","children","innerClassName","isExpanded","min","attrs","ref","useRef","max","setMax","useState","useResizeObserver","_a","useLayoutEffect","jsx","classnames"],"mappings":";;;;;AAkBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAW,GACxC,CAACC,GAAKC,CAAM,IAAIC,EAAS,CAAC;AAEhC,SAAAC,EAAkC;AAAA,IAChC,KAAAL;AAAA,IACA,UAAU,MAAM;;AACd,MAAIA,EAAI,WACNG,GAAOG,IAAAN,EAAI,YAAJ,gBAAAM,EAAa,YAAY;AAAA,IAEpC;AAAA,EAAA,CACD,GAEDC,EAAgB,MAAM;AACpB,IAAKP,EAAI,WAGTG,EAAOH,EAAI,QAAQ,YAAY;AAAA,EACjC,GAAG,CAACA,CAAG,CAAC,GAGN,gBAAAQ;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGT;AAAA,MACJ,WAAWU,EAAW,+CAA+Cf,CAAS;AAAA,MAC9E,iBAAeG;AAAA,MACf,OAAO,EAAE,QAAQA,IAAaK,IAAMJ,EAAA;AAAA,MAEpC,UAAA,gBAAAU,EAAC,OAAA,EAAI,WAAWZ,GAAgB,KAAAI,GAC7B,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "../../../chunks/index.js";
|
|
2
|
+
import { c as o } from "../../../chunks/index.js";
|
|
3
3
|
import { useId as D } from "react";
|
|
4
|
-
import { Icon as h } from "../../../atoms/Icons/Icon.js";
|
|
5
|
-
import "@clubmed/trident-icons";
|
|
6
4
|
import { useValue as S } from "../../../hooks/useValue.js";
|
|
7
5
|
/* empty css */
|
|
8
6
|
import { useInternalStatus as V } from "../../../hooks/useInternalStatus.js";
|
|
9
|
-
|
|
7
|
+
import { Icon as p } from "@clubmed/trident-icons";
|
|
8
|
+
function A(u) {
|
|
10
9
|
const x = D(), {
|
|
11
10
|
id: s = x,
|
|
12
11
|
name: n = s,
|
|
@@ -20,13 +19,13 @@ function B(u) {
|
|
|
20
19
|
validationStatus: N = "default",
|
|
21
20
|
errorMessage: d,
|
|
22
21
|
children: g,
|
|
23
|
-
onChange:
|
|
22
|
+
onChange: c,
|
|
24
23
|
...y
|
|
25
24
|
} = u, { value: m, setValue: I } = S({
|
|
26
25
|
name: n,
|
|
27
26
|
initialValue: k,
|
|
28
|
-
onChange(w,
|
|
29
|
-
|
|
27
|
+
onChange(w, h) {
|
|
28
|
+
c == null || c(w, h ? l !== void 0 ? l : h : null);
|
|
30
29
|
}
|
|
31
30
|
}), e = V({
|
|
32
31
|
isDisabled: r,
|
|
@@ -35,13 +34,13 @@ function B(u) {
|
|
|
35
34
|
return /* @__PURE__ */ t(
|
|
36
35
|
"div",
|
|
37
36
|
{
|
|
38
|
-
className:
|
|
37
|
+
className: o("flex flex-col space-y-2", f),
|
|
39
38
|
"data-testid": `checkbox-container-${s}`,
|
|
40
39
|
children: [
|
|
41
40
|
/* @__PURE__ */ t(
|
|
42
41
|
"label",
|
|
43
42
|
{
|
|
44
|
-
className:
|
|
43
|
+
className: o("cursor-pointer relative flex text-b3 items-center", {
|
|
45
44
|
"text-grey": e === "disabled",
|
|
46
45
|
"text-black": e !== "default"
|
|
47
46
|
}),
|
|
@@ -68,10 +67,10 @@ function B(u) {
|
|
|
68
67
|
"span",
|
|
69
68
|
{
|
|
70
69
|
style: { height: i, width: i },
|
|
71
|
-
className:
|
|
70
|
+
className: o({ "!border-red": e === "error" }),
|
|
72
71
|
"data-testid": `check-container-${s}`,
|
|
73
72
|
children: /* @__PURE__ */ a(
|
|
74
|
-
|
|
73
|
+
p,
|
|
75
74
|
{
|
|
76
75
|
name: "CheckDefault",
|
|
77
76
|
type: "svg",
|
|
@@ -88,7 +87,7 @@ function B(u) {
|
|
|
88
87
|
}
|
|
89
88
|
),
|
|
90
89
|
C && /* @__PURE__ */ t("span", { className: "text-red text-b4 flex items-start space-x-4 ps-20", role: "alert", children: [
|
|
91
|
-
/* @__PURE__ */ a(
|
|
90
|
+
/* @__PURE__ */ a(p, { name: "Error", width: "20px" }),
|
|
92
91
|
d
|
|
93
92
|
] })
|
|
94
93
|
]
|
|
@@ -96,6 +95,6 @@ function B(u) {
|
|
|
96
95
|
);
|
|
97
96
|
}
|
|
98
97
|
export {
|
|
99
|
-
|
|
98
|
+
A as Checkbox
|
|
100
99
|
};
|
|
101
100
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -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 {
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Checkbox\"\n disabled={disabled}\n value={value as any}\n />\n\n <span\n style={{ height: size, width: size }}\n className={classnames({ '!border-red': internalStatus === 'error' })}\n data-testid={`check-container-${id}`}\n >\n <Icon\n name=\"CheckDefault\"\n type=\"svg\"\n width={`${size}px`}\n color=\"black\"\n className=\"absolute\"\n />\n </span>\n </span>\n\n {children}\n </label>\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start space-x-4 ps-20\" role=\"alert\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n}\n"],"names":["Checkbox","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","size","tabIndex","validationStatus","errorMessage","children","onChange","rest","checked","setValue","useValue","internalStatus","useInternalStatus","shouldDisplayErrorMessage","jsxs","classnames","jsx","Icon"],"mappings":";;;;;;;AAaO,SAASA,EAAyBC,GAA6B;AACpE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDhB,GAEE,EAAE,OAAOiB,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAf;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMa,GAAS;AACtB,MAAAF,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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IconicNames, type IconicTypes } from '
|
|
1
|
+
import { type IconicNames, type IconicTypes } from '@clubmed/trident-icons';
|
|
2
2
|
import { type FormControlProps } from './FormControl.js';
|
|
3
3
|
interface DateFieldProps extends Omit<FormControlProps<Date | null>, 'max' | 'min'> {
|
|
4
4
|
description?: string;
|