@clubmed/trident-ui 1.5.0-rc.1 → 1.5.1-beta.1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/atoms/Prose/Prose.js +4 -4
  3. package/atoms/Prose/Prose.js.map +1 -1
  4. package/chunks/clsx.js +17 -0
  5. package/chunks/clsx.js.map +1 -0
  6. package/molecules/Arrows/Arrows.js +16 -16
  7. package/molecules/Arrows/Arrows.js.map +1 -1
  8. package/molecules/Avatar.js +7 -7
  9. package/molecules/Avatar.js.map +1 -1
  10. package/molecules/Backdrop.js +12 -12
  11. package/molecules/Backdrop.js.map +1 -1
  12. package/molecules/Breadcrumb.js +5 -5
  13. package/molecules/Breadcrumb.js.map +1 -1
  14. package/molecules/Buttons/v2/Button.js +5 -12
  15. package/molecules/Buttons/v2/Button.js.map +1 -1
  16. package/molecules/Buttons/v2/Button.type.js +5 -5
  17. package/molecules/Buttons/v2/Button.type.js.map +1 -1
  18. package/molecules/Cards/CardBackground.js +7 -7
  19. package/molecules/Cards/CardBackground.js.map +1 -1
  20. package/molecules/Cards/CardClickable.js +7 -7
  21. package/molecules/Cards/CardClickable.js.map +1 -1
  22. package/molecules/Cards/ExpandableCard.js +8 -8
  23. package/molecules/Cards/ExpandableCard.js.map +1 -1
  24. package/molecules/Cards/v2/Card.js +10 -10
  25. package/molecules/Cards/v2/Card.js.map +1 -1
  26. package/molecules/Chip.js +9 -9
  27. package/molecules/Chip.js.map +1 -1
  28. package/molecules/Chip.themes.js +6 -6
  29. package/molecules/Chip.themes.js.map +1 -1
  30. package/molecules/ElasticHeight.js +5 -5
  31. package/molecules/ElasticHeight.js.map +1 -1
  32. package/molecules/Forms/Checkboxes/Checkbox.js +10 -10
  33. package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
  34. package/molecules/Forms/Checkboxes/Checkboxes.js +11 -11
  35. package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
  36. package/molecules/Forms/DateField.js +8 -8
  37. package/molecules/Forms/DateField.js.map +1 -1
  38. package/molecules/Forms/Filter.js +8 -8
  39. package/molecules/Forms/Filter.js.map +1 -1
  40. package/molecules/Forms/FormControl.js +9 -9
  41. package/molecules/Forms/FormControl.js.map +1 -1
  42. package/molecules/Forms/FormLabel.js +14 -14
  43. package/molecules/Forms/FormLabel.js.map +1 -1
  44. package/molecules/Forms/NumberField.js +9 -9
  45. package/molecules/Forms/NumberField.js.map +1 -1
  46. package/molecules/Forms/Password/Password.js +1 -1
  47. package/molecules/Forms/Password/Password.js.map +1 -1
  48. package/molecules/Forms/Password/ValidationMessage.js +10 -10
  49. package/molecules/Forms/Password/ValidationMessage.js.map +1 -1
  50. package/molecules/Forms/Radios/Radio.js +19 -19
  51. package/molecules/Forms/Radios/Radio.js.map +1 -1
  52. package/molecules/Forms/Radios/RadioGroup.js +11 -11
  53. package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
  54. package/molecules/Forms/Range.js +1 -1
  55. package/molecules/Forms/Range.js.map +1 -1
  56. package/molecules/Forms/Select.js +5 -5
  57. package/molecules/Forms/Select.js.map +1 -1
  58. package/molecules/Forms/Switch.js +12 -12
  59. package/molecules/Forms/Switch.js.map +1 -1
  60. package/molecules/Forms/TextField.js +1 -1
  61. package/molecules/Forms/TextField.js.map +1 -1
  62. package/molecules/HamburgerIcon.js +1 -1
  63. package/molecules/HamburgerIcon.js.map +1 -1
  64. package/molecules/Link.js +8 -8
  65. package/molecules/Link.js.map +1 -1
  66. package/molecules/Loader.js +3 -3
  67. package/molecules/Loader.js.map +1 -1
  68. package/molecules/Pagination.js +1 -1
  69. package/molecules/Pagination.js.map +1 -1
  70. package/molecules/Popin.js +5 -5
  71. package/molecules/Popin.js.map +1 -1
  72. package/molecules/Tabs/Tab.js +21 -21
  73. package/molecules/Tabs/Tab.js.map +1 -1
  74. package/molecules/Tabs/TabList.js +1 -1
  75. package/molecules/Tabs/TabList.js.map +1 -1
  76. package/molecules/Tabs/TabPanel.js +8 -8
  77. package/molecules/Tabs/TabPanel.js.map +1 -1
  78. package/molecules/Tabs/Tabs.js +9 -9
  79. package/molecules/Tabs/Tabs.js.map +1 -1
  80. package/molecules/Tabs/TabsBody.js +3 -3
  81. package/molecules/Tabs/TabsBody.js.map +1 -1
  82. package/molecules/Tag.js +5 -5
  83. package/molecules/Tag.js.map +1 -1
  84. package/package.json +2 -2
  85. package/chunks/index.js +0 -46
  86. package/chunks/index.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
3
3
  import { useState as b, createElement as k } from "react";
4
- import { c as s } from "../../chunks/index.js";
4
+ import { c as d } from "../../chunks/clsx.js";
5
5
  import { Clickable as w } from "../../atoms/Clickable/Clickable.js";
6
6
  import { Tag as v } from "../Tag.js";
7
7
  import { CardBackground as C } from "./CardBackground.js";
@@ -10,9 +10,9 @@ import { Card as g } from "./v2/Card.js";
10
10
  import { HeadingGroup as N } from "../../atoms/Heading/HeadingGroup.js";
11
11
  import { Button as B } from "../Buttons/v2/Button.js";
12
12
  const q = ({
13
- children: d,
14
- className: i,
15
- hLevel: c = 3,
13
+ children: i,
14
+ className: c,
15
+ hLevel: s = 3,
16
16
  image: t,
17
17
  onClick: m,
18
18
  subtitle: p,
@@ -29,7 +29,7 @@ const q = ({
29
29
  "data-name": "ExpandableCard",
30
30
  "data-testid": "expandable-card",
31
31
  ...x,
32
- className: s({ "border-t-0": t?.src }, i),
32
+ className: d({ "border-t-0": t?.src }, c),
33
33
  "data-open": e,
34
34
  children: [
35
35
  /* @__PURE__ */ a(
@@ -45,11 +45,11 @@ const q = ({
45
45
  /* @__PURE__ */ r(
46
46
  "div",
47
47
  {
48
- className: s("mt-auto flex justify-between gap-x-8 p-20", {
48
+ className: d("mt-auto flex justify-between gap-x-8 p-20", {
49
49
  "text-white": t?.src
50
50
  }),
51
51
  children: [
52
- h && /* @__PURE__ */ a(N, { subtitle: p, level: c, children: l }),
52
+ h && /* @__PURE__ */ a(N, { subtitle: p, level: s, children: l }),
53
53
  /* @__PURE__ */ a(
54
54
  B,
55
55
  {
@@ -69,7 +69,7 @@ const q = ({
69
69
  ] })
70
70
  }
71
71
  ),
72
- /* @__PURE__ */ a(E, { isExpanded: e, children: d })
72
+ /* @__PURE__ */ a(E, { isExpanded: e, children: i })
73
73
  ]
74
74
  }
75
75
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableCard.js","sources":["../../../lib/molecules/Cards/ExpandableCard.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport { type ComponentProps, type FunctionComponent, useState } from 'react';\n\nimport { Clickable } from '../../atoms/Clickable/Clickable';\nimport { Heading } from '../../atoms/Heading/Heading';\nimport { Tag } from '../Tag';\nimport { CardBackground, type CardBackgroundProps } from '@/molecules/Cards/CardBackground';\nimport { ElasticHeight } from '@/molecules/ElasticHeight';\nimport { Card, type CardProps } from '@/molecules/Cards/v2/Card';\nimport { HeadingGroup } from '@/atoms/Heading/HeadingGroup';\nimport { Button } from '@/molecules/Buttons/v2/Button';\n\nexport interface ExpandableCardProps extends Omit<CardProps<'article'>, 'onClick'> {\n hLevel?: ComponentProps<typeof Heading>['level'];\n image?: CardBackgroundProps;\n onClick?: (isExpanded: boolean) => void;\n subtitle?: string | null;\n tags?: ComponentProps<typeof Tag>[] | null;\n title: string;\n}\n\nexport const ExpandableCard: FunctionComponent<ExpandableCardProps> = ({\n children,\n className,\n hLevel = 3,\n image,\n onClick,\n subtitle,\n tags,\n title,\n component = 'article',\n ...attrs\n}) => {\n const hasTitle = Boolean(title);\n\n const [isExpanded, setIsExpanded] = useState(false);\n\n return (\n <Card<'article'>\n component={component}\n data-name=\"ExpandableCard\"\n data-testid=\"expandable-card\"\n {...attrs}\n className={classnames({ 'border-t-0': image?.src }, className)}\n data-open={isExpanded}\n >\n <Clickable\n className=\"group relative -m-1 block aspect-horizontal overflow-hidden rounded-16 text-start\"\n data-testid=\"expandable-card-clickable\"\n onClick={() => {\n onClick?.(!isExpanded);\n setIsExpanded(!isExpanded);\n }}\n >\n <CardBackground {...(image || {})}>\n {Boolean(tags?.length) && (\n <div className=\"flex flex-wrap gap-4 self-start p-20\">\n {tags?.map((tag) => <Tag {...tag} key={tag.label} />)}\n </div>\n )}\n <div\n className={classnames('mt-auto flex justify-between gap-x-8 p-20', {\n 'text-white': image?.src,\n })}\n >\n {hasTitle && (\n <HeadingGroup subtitle={subtitle} level={hLevel}>\n {title}\n </HeadingGroup>\n )}\n <Button\n component=\"span\"\n className=\"!transition duration-500\"\n color={image?.src ? 'white' : 'black'}\n icon=\"ArrowDefaultDown\"\n style={{ rotate: isExpanded ? '-180deg' : '0deg' }}\n tabIndex={-1}\n theme=\"outline\"\n variant=\"circle\"\n />\n </div>\n </CardBackground>\n </Clickable>\n <ElasticHeight isExpanded={isExpanded}>{children}</ElasticHeight>\n </Card>\n );\n};\n"],"names":["ExpandableCard","children","className","hLevel","image","onClick","subtitle","tags","title","component","attrs","hasTitle","isExpanded","setIsExpanded","useState","jsxs","Card","classnames","jsx","Clickable","CardBackground","tag","createElement","Tag","HeadingGroup","Button","ElasticHeight"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,IAAyD,CAAC;AAAA,EACrE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAW,EAAQH,GAEnB,CAACI,GAAYC,CAAa,IAAIC,EAAS,EAAK;AAElD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAAP;AAAA,MACA,aAAU;AAAA,MACV,eAAY;AAAA,MACX,GAAGC;AAAA,MACJ,WAAWO,EAAW,EAAE,cAAcb,GAAO,IAAA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tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\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={clsx({ '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={clsx('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","clsx","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,EAAK,EAAE,cAAcb,GAAO,IAAA,GAAOF,CAAS;AAAA,MACvD,aAAWU;AAAA,MAEX,UAAA;AAAA,QAAA,gBAAAM;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YACZ,SAAS,MAAM;AACb,cAAAd,IAAU,CAACO,CAAU,GACrBC,EAAc,CAACD,CAAU;AAAA,YAC3B;AAAA,YAEA,UAAA,gBAAAG,EAACK,GAAA,EAAgB,GAAIhB,KAAS,CAAA,GAC3B,UAAA;AAAA,cAAA,EAAQG,GAAM,4BACZ,OAAA,EAAI,WAAU,wCACZ,UAAAA,GAAM,IAAI,CAACc,MAAQ,gBAAAC,EAACC,KAAK,GAAGF,GAAK,KAAKA,EAAI,OAAO,CAAE,GACtD;AAAA,cAEF,gBAAAN;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAWE,EAAK,6CAA6C;AAAA,oBAC3D,cAAcb,GAAO;AAAA,kBAAA,CACtB;AAAA,kBAEA,UAAA;AAAA,oBAAAO,KACC,gBAAAO,EAACM,GAAA,EAAa,UAAAlB,GAAoB,OAAOH,GACtC,UAAAK,GACH;AAAA,oBAEF,gBAAAU;AAAA,sBAACO;AAAA,sBAAA;AAAA,wBACC,WAAU;AAAA,wBACV,WAAU;AAAA,wBACV,OAAOrB,GAAO,MAAM,UAAU;AAAA,wBAC9B,MAAK;AAAA,wBACL,OAAO,EAAE,QAAQQ,IAAa,YAAY,OAAA;AAAA,wBAC1C,UAAU;AAAA,wBACV,OAAM;AAAA,wBACN,SAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACV;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,EAAA,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAM,EAACQ,GAAA,EAAc,YAAAd,GAAyB,UAAAX,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGvD;"}
@@ -1,28 +1,28 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { c as m } from "../../../chunks/index.js";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { c as m } from "../../../chunks/clsx.js";
3
3
  import { CARD_ASPECT_RATIOS as l } from "../CardAspectRatios.js";
4
4
  function f({
5
5
  children: o,
6
- className: e,
6
+ className: r,
7
7
  component: d = "div",
8
8
  format: i = "custom",
9
9
  theme: t = "bordered",
10
10
  ...n
11
11
  }) {
12
- const s = d, r = [].concat(t).join(" ");
13
- return /* @__PURE__ */ c(
14
- s,
12
+ const c = d, e = [].concat(t).join(" ");
13
+ return /* @__PURE__ */ s(
14
+ c,
15
15
  {
16
16
  ...n,
17
17
  className: m(
18
18
  l[i],
19
19
  "relative isolate rounded-16",
20
20
  {
21
- "bg-white": !e?.includes("bg-"),
22
- "group overflow-hidden": r.includes("frame"),
23
- "border border-lightGrey": r.includes("bordered")
21
+ "bg-white": !r?.includes("bg-"),
22
+ "group overflow-hidden": e.includes("frame"),
23
+ "border border-lightGrey": e.includes("bordered")
24
24
  },
25
- e
25
+ r
26
26
  ),
27
27
  children: o
28
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../lib/molecules/Cards/v2/Card.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from 'react';\nimport cx from 'classnames';\nimport { CARD_ASPECT_RATIOS } from '../CardAspectRatios';\n\ntype CARD_THEME = 'none' | 'bordered' | 'frame';\n\nexport type CardProps<T extends ElementType = 'div'> = {\n component?: string;\n /**\n * By default the card has a border.\n * Set to false to remove it.\n */\n border?: boolean;\n format?: keyof typeof CARD_ASPECT_RATIOS;\n theme?: CARD_THEME | CARD_THEME[];\n} & ComponentPropsWithoutRef<T>;\n\nexport function Card<T extends ElementType = 'div'>({\n children,\n className,\n component = 'div',\n format = 'custom',\n theme = 'bordered',\n ...attrs\n}: CardProps<T>) {\n const Cmp = component as ElementType;\n const resolvedTheme = ([] as CARD_THEME[]).concat(theme).join(' ');\n\n return (\n <Cmp\n {...attrs}\n className={cx(\n CARD_ASPECT_RATIOS[format],\n 'relative isolate rounded-16',\n {\n 'bg-white': !className?.includes('bg-'),\n 'group overflow-hidden': resolvedTheme.includes('frame'),\n 'border border-lightGrey': resolvedTheme.includes('bordered'),\n },\n className,\n )}\n >\n {children}\n </Cmp>\n );\n}\n"],"names":["Card","children","className","component","format","theme","attrs","Cmp","resolvedTheme","jsx","cx","CARD_ASPECT_RATIOS"],"mappings":";;;AAiBO,SAASA,EAAoC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAS;AAAA,EACT,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACL,GAAiB;AACf,QAAMC,IAAMJ,GACNK,IAAiB,CAAA,EAAoB,OAAOH,CAAK,EAAE,KAAK,GAAG;AAEjE,SACE,gBAAAI;AAAA,IAACF;AAAA,IAAA;AAAA,MACE,GAAGD;AAAA,MACJ,WAAWI;AAAAA,QACTC,EAAmBP,CAAM;AAAA,QACzB;AAAA,QACA;AAAA,UACE,YAAY,CAACF,GAAW,SAAS,KAAK;AAAA,UACtC,yBAAyBM,EAAc,SAAS,OAAO;AAAA,UACvD,2BAA2BA,EAAc,SAAS,UAAU;AAAA,QAAA;AAAA,QAE9DN;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../lib/molecules/Cards/v2/Card.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from 'react';\nimport cx from 'clsx';\nimport { CARD_ASPECT_RATIOS } from '../CardAspectRatios';\n\ntype CARD_THEME = 'none' | 'bordered' | 'frame';\n\nexport type CardProps<T extends ElementType = 'div'> = {\n component?: string;\n /**\n * By default the card has a border.\n * Set to false to remove it.\n */\n border?: boolean;\n format?: keyof typeof CARD_ASPECT_RATIOS;\n theme?: CARD_THEME | CARD_THEME[];\n} & ComponentPropsWithoutRef<T>;\n\nexport function Card<T extends ElementType = 'div'>({\n children,\n className,\n component = 'div',\n format = 'custom',\n theme = 'bordered',\n ...attrs\n}: CardProps<T>) {\n const Cmp = component as ElementType;\n const resolvedTheme = ([] as CARD_THEME[]).concat(theme).join(' ');\n\n return (\n <Cmp\n {...attrs}\n className={cx(\n CARD_ASPECT_RATIOS[format],\n 'relative isolate rounded-16',\n {\n 'bg-white': !className?.includes('bg-'),\n 'group overflow-hidden': resolvedTheme.includes('frame'),\n 'border border-lightGrey': resolvedTheme.includes('bordered'),\n },\n className,\n )}\n >\n {children}\n </Cmp>\n );\n}\n"],"names":["Card","children","className","component","format","theme","attrs","Cmp","resolvedTheme","jsx","cx","CARD_ASPECT_RATIOS"],"mappings":";;;AAiBO,SAASA,EAAoC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC,IAAS;AAAA,EACT,OAAAC,IAAQ;AAAA,EACR,GAAGC;AACL,GAAiB;AACf,QAAMC,IAAMJ,GACNK,IAAiB,CAAA,EAAoB,OAAOH,CAAK,EAAE,KAAK,GAAG;AAEjE,SACE,gBAAAI;AAAA,IAACF;AAAA,IAAA;AAAA,MACE,GAAGD;AAAA,MACJ,WAAWI;AAAAA,QACTC,EAAmBP,CAAM;AAAA,QACzB;AAAA,QACA;AAAA,UACE,YAAY,CAACF,GAAW,SAAS,KAAK;AAAA,UACtC,yBAAyBM,EAAc,SAAS,OAAO;AAAA,UACvD,2BAA2BA,EAAc,SAAS,UAAU;AAAA,QAAA;AAAA,QAE9DN;AAAA,MAAA;AAAA,MAGD,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
package/molecules/Chip.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { c as m } from "../chunks/index.js";
2
+ import { c as m } from "../chunks/clsx.js";
3
3
  import { getTheme as c } from "./Chip.themes.js";
4
4
  const f = ({
5
5
  className: e,
6
- color: s = "sienna",
7
- size: r = "size-32",
8
- theme: o = "solid",
6
+ color: r = "sienna",
7
+ size: o = "size-32",
8
+ theme: s = "solid",
9
9
  children: t,
10
- ...n
10
+ ...i
11
11
  }) => {
12
- const { thRoot: i } = c(o, { color: s });
12
+ const { thRoot: n } = c(s, { color: r });
13
13
  return /* @__PURE__ */ a(
14
14
  "span",
15
15
  {
16
- ...n,
16
+ ...i,
17
17
  className: m(
18
18
  "inline-flex aspect-square shrink-0 items-center justify-center overflow-hidden rounded-full border",
19
- r,
20
- i,
19
+ o,
20
+ n,
21
21
  e
22
22
  ),
23
23
  "data-name": "Chip",
@@ -1 +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;"}
1
+ {"version":3,"file":"Chip.js","sources":["../../lib/molecules/Chip.tsx"],"sourcesContent":["import clsx from 'clsx';\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={clsx(\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","clsx"],"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;AAAA,QACT;AAAA,QACAP;AAAA,QACAI;AAAA,QACAN;AAAA,MAAA;AAAA,MAEF,aAAU;AAAA,MAET,UAAAI;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,11 +1,11 @@
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";
1
+ import { c as e } from "../chunks/clsx.js";
2
+ import { getBorderColor as r, getTextColor as g, getBgColor as n, getComplementaryTextColor as i } from "../helpers/colors/colors.js";
3
3
  const l = (t) => ({
4
4
  solid: {
5
- thRoot: e(g(t), r(t), i(t))
5
+ thRoot: e(n(t), r(t), i(t))
6
6
  },
7
7
  outline: {
8
- thRoot: e("bg-transparent", r(t), n(t))
8
+ thRoot: e("bg-transparent", r(t), g(t))
9
9
  },
10
10
  light: {
11
11
  thRoot: e("bg-lightSand text-black border-lightSand")
@@ -13,12 +13,12 @@ const l = (t) => ({
13
13
  dark: {
14
14
  thRoot: e("bg-ultramarine text-white border-ultramarine")
15
15
  }
16
- }), h = (t, { color: a }) => {
16
+ }), s = (t, { color: a }) => {
17
17
  const o = l(a);
18
18
  return o[t] || o.solid;
19
19
  };
20
20
  export {
21
- h as getTheme,
21
+ s as getTheme,
22
22
  l as themes
23
23
  };
24
24
  //# sourceMappingURL=Chip.themes.js.map
@@ -1 +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
+ {"version":3,"file":"Chip.themes.js","sources":["../../lib/molecules/Chip.themes.ts"],"sourcesContent":["import clsx from 'clsx';\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: clsx(getBgColor(color), getBorderColor(color), getComplementaryTextColor(color)),\n },\n outline: {\n thRoot: clsx('bg-transparent', getBorderColor(color), getTextColor(color)),\n },\n light: {\n thRoot: clsx('bg-lightSand text-black border-lightSand'),\n },\n dark: {\n thRoot: clsx('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","clsx","getBgColor","getBorderColor","getComplementaryTextColor","getTextColor","getTheme","theme","THEMES"],"mappings":";;AAaO,MAAMA,IAAS,CAACC,OAAsD;AAAA,EAC3E,OAAO;AAAA,IACL,QAAQC,EAAKC,EAAWF,CAAK,GAAGG,EAAeH,CAAK,GAAGI,EAA0BJ,CAAK,CAAC;AAAA,EAAA;AAAA,EAEzF,SAAS;AAAA,IACP,QAAQC,EAAK,kBAAkBE,EAAeH,CAAK,GAAGK,EAAaL,CAAK,CAAC;AAAA,EAAA;AAAA,EAE3E,OAAO;AAAA,IACL,QAAQC,EAAK,0CAA0C;AAAA,EAAA;AAAA,EAEzD,MAAM;AAAA,IACJ,QAAQA,EAAK,8CAA8C;AAAA,EAAA;AAE/D,IAEaK,IAAW,CAACC,GAAc,EAAE,OAAAP,QAAqB;AAC5D,QAAMQ,IAAST,EAAOC,CAAK;AAE3B,SAAOQ,EAAOD,CAAK,KAAKC,EAAO;AACjC;"}
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as s } from "react/jsx-runtime";
3
- import { c as u } from "../chunks/index.js";
3
+ import { c as u } from "../chunks/clsx.js";
4
4
  import { useRef as l, useState as m, useLayoutEffect as d } from "react";
5
5
  import h from "../hooks/useResizeObserver.js";
6
6
  const H = ({
7
7
  className: i,
8
8
  children: o,
9
- innerClassName: a,
9
+ innerClassName: n,
10
10
  isExpanded: t = !1,
11
- min: n = 0,
11
+ min: a = 0,
12
12
  ...f
13
13
  }) => {
14
14
  const e = l(null), [c, r] = m(0);
@@ -25,8 +25,8 @@ const H = ({
25
25
  ...f,
26
26
  className: u("overflow-hidden transition-all duration-500", i),
27
27
  "data-expanded": t,
28
- style: { height: t ? c : n },
29
- children: /* @__PURE__ */ s("div", { className: a, ref: e, children: o })
28
+ style: { height: t ? c : a },
29
+ children: /* @__PURE__ */ s("div", { className: n, ref: e, children: o })
30
30
  }
31
31
  );
32
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["'use client';\n\nimport classnames from 'classnames';\nimport {\n type ComponentPropsWithoutRef,\n type FunctionComponent,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport useResizeObserver from '@/hooks/useResizeObserver';\n\ninterface ElasticHeightProps extends ComponentPropsWithoutRef<'div'> {\n innerClassName?: string;\n isExpanded?: boolean;\n min?: number;\n}\n\nexport const ElasticHeight: FunctionComponent<ElasticHeightProps> = ({\n className,\n children,\n innerClassName,\n isExpanded = false,\n min = 0,\n ...attrs\n}) => {\n const ref = useRef<HTMLDivElement>(null as any);\n const [max, setMax] = useState(0);\n\n useResizeObserver<HTMLDivElement>({\n ref: ref,\n onResize: () => {\n if (ref.current) {\n setMax(ref.current?.offsetHeight);\n }\n },\n });\n\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n setMax(ref.current.offsetHeight);\n }, [ref]);\n\n return (\n <div\n {...attrs}\n className={classnames('overflow-hidden transition-all duration-500', className)}\n data-expanded={isExpanded}\n style={{ height: isExpanded ? max : min }}\n >\n <div className={innerClassName} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["ElasticHeight","className","children","innerClassName","isExpanded","min","attrs","ref","useRef","max","setMax","useState","useResizeObserver","useLayoutEffect","jsx","classnames"],"mappings":";;;;;AAkBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAW,GACxC,CAACC,GAAKC,CAAM,IAAIC,EAAS,CAAC;AAEhC,SAAAC,EAAkC;AAAA,IAChC,KAAAL;AAAA,IACA,UAAU,MAAM;AACd,MAAIA,EAAI,WACNG,EAAOH,EAAI,SAAS,YAAY;AAAA,IAEpC;AAAA,EAAA,CACD,GAEDM,EAAgB,MAAM;AACpB,IAAKN,EAAI,WAGTG,EAAOH,EAAI,QAAQ,YAAY;AAAA,EACjC,GAAG,CAACA,CAAG,CAAC,GAGN,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,WAAWS,EAAW,+CAA+Cd,CAAS;AAAA,MAC9E,iBAAeG;AAAA,MACf,OAAO,EAAE,QAAQA,IAAaK,IAAMJ,EAAA;AAAA,MAEpC,UAAA,gBAAAS,EAAC,OAAA,EAAI,WAAWX,GAAgB,KAAAI,GAC7B,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"ElasticHeight.js","sources":["../../lib/molecules/ElasticHeight.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\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={clsx('overflow-hidden transition-all duration-500', className)}\n data-expanded={isExpanded}\n style={{ height: isExpanded ? max : min }}\n >\n <div className={innerClassName} ref={ref}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["ElasticHeight","className","children","innerClassName","isExpanded","min","attrs","ref","useRef","max","setMax","useState","useResizeObserver","useLayoutEffect","jsx","clsx"],"mappings":";;;;;AAkBO,MAAMA,IAAuD,CAAC;AAAA,EACnE,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAMC,EAAuB,IAAW,GACxC,CAACC,GAAKC,CAAM,IAAIC,EAAS,CAAC;AAEhC,SAAAC,EAAkC;AAAA,IAChC,KAAAL;AAAA,IACA,UAAU,MAAM;AACd,MAAIA,EAAI,WACNG,EAAOH,EAAI,SAAS,YAAY;AAAA,IAEpC;AAAA,EAAA,CACD,GAEDM,EAAgB,MAAM;AACpB,IAAKN,EAAI,WAGTG,EAAOH,EAAI,QAAQ,YAAY;AAAA,EACjC,GAAG,CAACA,CAAG,CAAC,GAGN,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,WAAWS,EAAK,+CAA+Cd,CAAS;AAAA,MACxE,iBAAeG;AAAA,MACf,OAAO,EAAE,QAAQA,IAAaK,IAAMJ,EAAA;AAAA,MAEpC,UAAA,gBAAAS,EAAC,OAAA,EAAI,WAAWX,GAAgB,KAAAI,GAC7B,UAAAL,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,5 +1,5 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { c as n } from "../../../chunks/index.js";
1
+ import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
+ import { c as n } from "../../../chunks/clsx.js";
3
3
  import { useId as D } from "react";
4
4
  import { useValue as S } from "../../../hooks/useValue.js";
5
5
  /* empty css */
@@ -31,13 +31,13 @@ function A(p) {
31
31
  isDisabled: r,
32
32
  validationStatus: g
33
33
  }), I = e === "error" && c;
34
- return /* @__PURE__ */ a(
34
+ return /* @__PURE__ */ t(
35
35
  "div",
36
36
  {
37
37
  className: n("flex flex-col space-y-2", x),
38
38
  "data-testid": `checkbox-container-${s}`,
39
39
  children: [
40
- /* @__PURE__ */ a(
40
+ /* @__PURE__ */ t(
41
41
  "label",
42
42
  {
43
43
  className: n("cursor-pointer relative flex text-b3 items-center", {
@@ -45,8 +45,8 @@ function A(p) {
45
45
  "text-black": e !== "default"
46
46
  }),
47
47
  children: [
48
- /* @__PURE__ */ a("span", { className: "relative self-start me-8", children: [
49
- /* @__PURE__ */ t(
48
+ /* @__PURE__ */ t("span", { className: "relative self-start me-8", children: [
49
+ /* @__PURE__ */ a(
50
50
  "input",
51
51
  {
52
52
  ...N,
@@ -63,13 +63,13 @@ function A(p) {
63
63
  value: l
64
64
  }
65
65
  ),
66
- /* @__PURE__ */ t(
66
+ /* @__PURE__ */ a(
67
67
  "span",
68
68
  {
69
69
  style: { height: i, width: i },
70
70
  className: n({ "!border-red": e === "error" }),
71
71
  "data-testid": `check-container-${s}`,
72
- children: /* @__PURE__ */ t(
72
+ children: /* @__PURE__ */ a(
73
73
  h,
74
74
  {
75
75
  name: "CheckDefault",
@@ -86,8 +86,8 @@ function A(p) {
86
86
  ]
87
87
  }
88
88
  ),
89
- I && /* @__PURE__ */ a("span", { className: "text-red text-b4 flex items-start space-x-4 ps-20", role: "alert", children: [
90
- /* @__PURE__ */ t(h, { name: "Error", width: "20px" }),
89
+ I && /* @__PURE__ */ t("span", { className: "text-red text-b4 flex items-start space-x-4 ps-20", role: "alert", children: [
90
+ /* @__PURE__ */ a(h, { name: "Error", width: "20px" }),
91
91
  c
92
92
  ] })
93
93
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { useId } from 'react';\nimport { useValue } from '@/hooks/useValue.js';\nimport '../controls.css';\nimport type { FormControlProps } from '@/molecules/Forms/FormControl';\nimport { useInternalStatus } from '@/hooks/useInternalStatus';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface CheckboxProps<Value = string> extends FormControlProps<Value> {\n size?: number;\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Checkbox<Value = string>(props: CheckboxProps<Value>) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n checked: initialChecked = false,\n value,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n onChange,\n ...rest\n } = props;\n\n const { value: checked, setValue } = useValue<boolean>({\n name,\n initialValue: initialChecked,\n onChange(name, checked) {\n onChange?.(name, checked ? ((value !== undefined ? value : checked) as Value) : null);\n },\n });\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={classnames('cursor-pointer relative flex text-b3 items-center', {\n 'text-grey': internalStatus === 'disabled',\n 'text-black': internalStatus !== 'default',\n })}\n >\n <span className=\"relative self-start me-8\">\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n if (!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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ElC,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
+ {"version":3,"file":"Checkbox.js","sources":["../../../../lib/molecules/Forms/Checkboxes/Checkbox.tsx"],"sourcesContent":["import clsx from 'clsx';\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={clsx('flex flex-col space-y-2', className)}\n data-testid={`checkbox-container-${id}`}\n >\n <label\n className={clsx('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 if (!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={clsx({ '!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","clsx","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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AAA,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,10 +1,10 @@
1
1
  import { jsx as I } from "react/jsx-runtime";
2
2
  import { useId as N, Children as v, isValidElement as g, cloneElement as h } from "react";
3
3
  import { useValue as k } from "../../../hooks/useValue.js";
4
- import { c as E } from "../../../chunks/index.js";
5
- function q(m) {
6
- const i = N(), {
7
- id: r = i,
4
+ import { c as E } from "../../../chunks/clsx.js";
5
+ function q(i) {
6
+ const m = N(), {
7
+ id: r = m,
8
8
  name: n = r,
9
9
  children: u,
10
10
  value: c,
@@ -12,9 +12,9 @@ function q(m) {
12
12
  onChange: d,
13
13
  disabled: f,
14
14
  readOnly: V,
15
- tabIndex: b = 0,
15
+ tabIndex: x = 0,
16
16
  ...s
17
- } = m, { value: a, setValue: o } = k({
17
+ } = i, { value: t, setValue: o } = k({
18
18
  name: n,
19
19
  initialValue: c,
20
20
  formatter(e) {
@@ -25,18 +25,18 @@ function q(m) {
25
25
  });
26
26
  return /* @__PURE__ */ I("div", { ...s, className: s.className, role: "listbox", children: v.map(u, (e, l) => {
27
27
  if (g(e)) {
28
- const t = e.props.value;
28
+ const a = e.props.value;
29
29
  return h(e, {
30
30
  ...e.props,
31
31
  name: n,
32
32
  id: `${r}-${l}`,
33
33
  disabled: f,
34
34
  readOnly: V,
35
- tabIndex: b + l + 1,
35
+ tabIndex: x + l + 1,
36
36
  className: E(e.props.className || "mt-8 first:mt-0"),
37
- checked: a.includes(t),
38
- onChange($, x) {
39
- o(x === null ? a.filter((C) => C !== t) : a.concat(t));
37
+ checked: t.includes(a),
38
+ onChange($, b) {
39
+ o(b === null ? t.filter((C) => C !== a) : t.concat(a));
40
40
  }
41
41
  });
42
42
  }
@@ -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,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
+ {"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 clsx from 'clsx';\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: clsx(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","clsx","_","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,EAAKL,EAAM,MAAM,aAAa,iBAAiB;AAAA,QAC1D,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,5 +1,5 @@
1
1
  import { jsx as p, jsxs as C } from "react/jsx-runtime";
2
- import { c as q } from "../../chunks/index.js";
2
+ import { c as q } from "../../chunks/clsx.js";
3
3
  import { useId as A, useRef as B, useState as H, useCallback as L, useEffect as J } from "react";
4
4
  import { Icon as E } from "@clubmed/trident-icons";
5
5
  import { useValue as K } from "../../hooks/useValue.js";
@@ -49,11 +49,11 @@ function W(t, e) {
49
49
  if (i !== "date") {
50
50
  var b = a.getTimezoneOffset();
51
51
  if (b !== 0) {
52
- var w = Math.abs(b), l = f(Math.floor(w / 60), 2), u = f(w % 60, 2), j = b < 0 ? "+" : "-";
52
+ var x = Math.abs(b), l = f(Math.floor(x / 60), 2), u = f(x % 60, 2), j = b < 0 ? "+" : "-";
53
53
  g = "".concat(j).concat(l, ":").concat(u);
54
54
  } else
55
55
  g = "Z";
56
- var F = f(a.getHours(), 2), x = f(a.getMinutes(), 2), S = f(a.getSeconds(), 2), M = d === "" ? "" : "T", s = [F, x, S].join(I);
56
+ var F = f(a.getHours(), 2), w = f(a.getMinutes(), 2), S = f(a.getSeconds(), 2), M = d === "" ? "" : "T", s = [F, w, S].join(I);
57
57
  d = "".concat(d).concat(M).concat(s).concat(g);
58
58
  }
59
59
  return d;
@@ -78,23 +78,23 @@ const O = (t) => t ? W(new Date(t), { representation: "date" }) : "", X = (t, e,
78
78
  required: y = !1,
79
79
  hideRequiredStar: T,
80
80
  dataTestId: b = "DateField",
81
- value: w,
81
+ value: x,
82
82
  min: l,
83
83
  max: u,
84
84
  onChange: j,
85
85
  ...F
86
- } = t, x = B(null), [S, M] = H(!1), s = Q({
86
+ } = t, w = B(null), [S, M] = H(!1), s = Q({
87
87
  isDisabled: o,
88
88
  validationStatus: d
89
89
  }), { setValue: v, value: h } = K({
90
90
  name: r,
91
91
  formatter: O,
92
- initialValue: w,
92
+ initialValue: x,
93
93
  onChange: (m, R) => j?.(m, new Date(R))
94
94
  }), N = O(l), k = O(u), Y = (m) => {
95
95
  v(m.target.value);
96
96
  }, Z = () => {
97
- x.current?.showPicker();
97
+ w.current?.showPicker();
98
98
  }, _ = L(() => {
99
99
  const m = new Date(h);
100
100
  if (l && u) {
@@ -146,7 +146,7 @@ const O = (t) => t ? W(new Date(t), { representation: "date" }) : "", X = (t, e,
146
146
  id: n,
147
147
  disabled: o,
148
148
  required: y,
149
- ref: x,
149
+ ref: w,
150
150
  value: h,
151
151
  min: N,
152
152
  max: k,
@@ -1 +1 @@
1
- {"version":3,"file":"DateField.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../../node_modules/date-fns/esm/toDate/index.js","../../../node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../../node_modules/date-fns/esm/formatISO/index.js","../../../lib/molecules/Forms/DateField.tsx"],"sourcesContent":["export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}","export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}","import toDate from \"../toDate/index.js\";\nimport addLeadingZeros from \"../_lib/addLeadingZeros/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatISO\n * @category Common Helpers\n * @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).\n *\n * @description\n * Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {'extended'|'basic'} [options.format='extended'] - if 'basic', hide delimiters between date and time values.\n * @param {'complete'|'date'|'time'} [options.representation='complete'] - format date, time with local time zone, or both.\n * @returns {String} the formatted date string (in local time zone)\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.format` must be 'extended' or 'basic'\n * @throws {RangeError} `options.representation` must be 'date', 'time' or 'complete'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))\n * //=> '2019-09-18T19:00:52Z'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })\n * //=> '20190918T190052'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, date only:\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })\n * //=> '2019-09-18'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })\n * //=> '19:00:52Z'\n */\nexport default function formatISO(date, options) {\n var _options$format, _options$representati;\n requiredArgs(1, arguments);\n var originalDate = toDate(date);\n if (isNaN(originalDate.getTime())) {\n throw new RangeError('Invalid time value');\n }\n var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : 'extended');\n var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : 'complete');\n if (format !== 'extended' && format !== 'basic') {\n throw new RangeError(\"format must be 'extended' or 'basic'\");\n }\n if (representation !== 'date' && representation !== 'time' && representation !== 'complete') {\n throw new RangeError(\"representation must be 'date', 'time', or 'complete'\");\n }\n var result = '';\n var tzOffset = '';\n var dateDelimiter = format === 'extended' ? '-' : '';\n var timeDelimiter = format === 'extended' ? ':' : '';\n\n // Representation is either 'date' or 'complete'\n if (representation !== 'time') {\n var day = addLeadingZeros(originalDate.getDate(), 2);\n var month = addLeadingZeros(originalDate.getMonth() + 1, 2);\n var year = addLeadingZeros(originalDate.getFullYear(), 4);\n\n // yyyyMMdd or yyyy-MM-dd.\n result = \"\".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);\n }\n\n // Representation is either 'time' or 'complete'\n if (representation !== 'date') {\n // Add the timezone.\n var offset = originalDate.getTimezoneOffset();\n if (offset !== 0) {\n var absoluteOffset = Math.abs(offset);\n var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2);\n var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);\n // If less than 0, the sign is +, because it is ahead of time.\n var sign = offset < 0 ? '+' : '-';\n tzOffset = \"\".concat(sign).concat(hourOffset, \":\").concat(minuteOffset);\n } else {\n tzOffset = 'Z';\n }\n var hour = addLeadingZeros(originalDate.getHours(), 2);\n var minute = addLeadingZeros(originalDate.getMinutes(), 2);\n var second = addLeadingZeros(originalDate.getSeconds(), 2);\n\n // If there's also date, separate it with time with 'T'\n var separator = result === '' ? '' : 'T';\n\n // Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.\n var time = [hour, minute, second].join(timeDelimiter);\n\n // HHmmss or HH:mm:ss.\n result = \"\".concat(result).concat(separator).concat(time).concat(tzOffset);\n }\n return result;\n}","import classnames from 'classnames';\nimport { differenceInMilliseconds, formatISO } from 'date-fns';\nimport { type ChangeEvent, useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { Icon, type IconicNames, type IconicTypes } from '@clubmed/trident-icons';\n\nimport { useValue } from '@/hooks/useValue.js';\nimport { useInternalStatus } from '@/hooks/useInternalStatus.js';\nimport { FormControl, type FormControlProps } from './FormControl.js';\n\ninterface DateFieldProps extends Omit<FormControlProps<Date | null>, 'max' | 'min'> {\n description?: string;\n /**\n * Open datepicker text\n */\n openDatepicker?: string;\n id?: string;\n icon?: IconicNames;\n iconType?: IconicTypes;\n errorMessage?: string;\n dataTestId?: string;\n /**\n * Minimum Date allowed\n */\n min?: Date | undefined;\n /**\n * Maximum Date allowed\n */\n max?: Date | undefined;\n}\n\nconst formatDate = (value: Date | number | undefined | null): string => {\n if (!value) {\n return '';\n }\n\n return formatISO(new Date(value), { representation: 'date' });\n};\n\nconst validateDateRange = (date: string, min?: Date, max?: Date): boolean => {\n if (!date) {\n return true;\n }\n\n const normalizeDate = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const inputDate = new Date(date);\n const normalizedInputDate = normalizeDate(inputDate);\n\n if (min && normalizedInputDate < normalizeDate(min)) {\n return false;\n }\n if (max && normalizedInputDate > normalizeDate(max)) {\n return false;\n }\n\n return true;\n};\n\nexport const DateField = (props: DateFieldProps) => {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n label,\n description,\n openDatepicker,\n validationStatus = 'default',\n icon = 'CalendarDefault',\n iconType,\n errorMessage,\n disabled = false,\n required = false,\n hideRequiredStar,\n dataTestId = 'DateField',\n value: initialValue,\n min: initialMin,\n max: initialMax,\n onChange,\n ...rest\n } = props;\n\n // NO LOGIC IS IMPLEMENTED YET HERE\n // THIS IS A VISUAL COMPONENT ONLY\n const ref = useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = useState<boolean>(false);\n\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const { setValue, value } = useValue<string, Date | number | undefined | null>({\n name,\n formatter: formatDate as never,\n initialValue,\n onChange: (name, value) => onChange?.(name, new Date(value)),\n });\n\n const min = formatDate(initialMin);\n const max = formatDate(initialMax);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value);\n };\n\n const handleClickPicker = () => {\n ref.current?.showPicker();\n };\n\n const handleOutOfRangeDate = useCallback(() => {\n const currentDate = new Date(value);\n\n if (initialMin && initialMax) {\n const distanceToMin = Math.abs(differenceInMilliseconds(currentDate, initialMin));\n const distanceToMax = Math.abs(differenceInMilliseconds(currentDate, initialMax));\n setValue(distanceToMin <= distanceToMax ? min : max);\n return;\n }\n\n if (initialMin) {\n setValue(min);\n return;\n }\n\n if (initialMax) {\n setValue(max);\n return;\n }\n }, [initialMax, initialMin, max, min, setValue, value]);\n\n useEffect(() => {\n const isValid = validateDateRange(value, initialMin, initialMax);\n if (!isValid && !isFocused) {\n handleOutOfRangeDate();\n }\n }, [handleOutOfRangeDate, initialMax, initialMin, isFocused, value]);\n\n return (\n <FormControl\n id={id}\n label={label}\n description={description}\n dataName=\"DateField\"\n dataTestId={dataTestId}\n disabled={disabled}\n required={required}\n hideRequiredStar={hideRequiredStar}\n validationStatus={validationStatus}\n errorMessage={errorMessage}\n >\n <div className=\"relative\">\n <input\n {...rest}\n type=\"date\"\n className={classnames(\n 'text-b3 rounded-pill date-field min-h-[50px] w-full border px-20 py-12 ps-[52px] font-normal outline-none',\n {\n 'border-lightGrey focus:border-black active:border-black':\n internalStatus === 'default',\n 'pe-[52px]': internalStatus === 'error' || internalStatus === 'success',\n 'bg-pearl text-grey': disabled,\n 'bg-white text-black': !disabled,\n 'border-red': !disabled && internalStatus === 'error',\n 'border-green': !disabled && internalStatus === 'success',\n },\n )}\n id={id}\n disabled={disabled}\n required={required}\n ref={ref}\n value={value}\n min={min}\n max={max}\n onChange={handleChange}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n />\n <div\n className={classnames(\n 'pointer-events-none absolute inset-0 flex items-center justify-between px-20 py-12',\n {\n 'text-grey': disabled,\n 'text-red': !disabled && internalStatus === 'error',\n 'text-green': !disabled && internalStatus === 'success',\n },\n )}\n >\n <button className=\"pointer-events-auto leading-none\" onClick={handleClickPicker}>\n <Icon name={icon} iconType={iconType} width=\"24px\" />\n <span className=\"sr-only\">\n {openDatepicker}\n {/* REPLACE THAT WITH SOMETHING LIKE \"OPEN DATEPICKER\" SOONER RATHER THAN LATER PLZ */}\n </span>\n </button>\n <span className=\"ms-auto flex gap-x-8\">\n {internalStatus === 'error' && <Icon name=\"CrossDefault\" width=\"24px\" />}\n {internalStatus === 'success' && <Icon name=\"CheckDefault\" width=\"24px\" />}\n </span>\n </div>\n </div>\n </FormControl>\n );\n};\n"],"names":["_typeof","o","requiredArgs","required","args","toDate","argument","argStr","differenceInMilliseconds","dateLeft","dateRight","addLeadingZeros","number","targetLength","sign","output","formatISO","date","options","_options$format","_options$representati","originalDate","format","representation","result","tzOffset","dateDelimiter","timeDelimiter","day","month","year","offset","absoluteOffset","hourOffset","minuteOffset","hour","minute","second","separator","time","formatDate","value","validateDateRange","min","max","normalizeDate","d","inputDate","normalizedInputDate","DateField","props","internalId","useId","id","name","label","description","openDatepicker","validationStatus","icon","iconType","errorMessage","disabled","hideRequiredStar","dataTestId","initialValue","initialMin","initialMax","onChange","rest","ref","useRef","isFocused","setIsFocused","useState","internalStatus","useInternalStatus","setValue","useValue","handleChange","event","handleClickPicker","handleOutOfRangeDate","useCallback","currentDate","distanceToMin","distanceToMax","useEffect","jsx","FormControl","jsxs","classnames","Icon"],"mappings":";;;;;;;AAAe,SAASA,EAAQC,GAAG;AACjC;AAEA,SAAOD,IAAwB,OAAO,UAArB,cAA2C,OAAO,OAAO,YAA1B,WAAqC,SAAUC,GAAG;AAChG,WAAO,OAAOA;AAAA,EAChB,IAAI,SAAUA,GAAG;AACf,WAAOA,KAAmB,OAAO,UAArB,cAA+BA,EAAE,gBAAgB,UAAUA,MAAM,OAAO,YAAY,WAAW,OAAOA;AAAA,EACpH,GAAGD,EAAQC,CAAC;AACd;ACRe,SAASC,EAAaC,GAAUC,GAAM;AACnD,MAAIA,EAAK,SAASD;AAChB,UAAM,IAAI,UAAUA,IAAW,eAAeA,IAAW,IAAI,MAAM,MAAM,yBAAyBC,EAAK,SAAS,UAAU;AAE9H;AC4Be,SAASC,EAAOC,GAAU;AACvC,EAAAJ,EAAa,GAAG,SAAS;AACzB,MAAIK,IAAS,OAAO,UAAU,SAAS,KAAKD,CAAQ;AAGpD,SAAIA,aAAoB,QAAQN,EAAQM,CAAQ,MAAM,YAAYC,MAAW,kBAEpE,IAAI,KAAKD,EAAS,SAAS,IACzB,OAAOA,KAAa,YAAYC,MAAW,oBAC7C,IAAI,KAAKD,CAAQ,MAEnB,OAAOA,KAAa,YAAYC,MAAW,sBAAsB,OAAO,UAAY,QAEvF,QAAQ,KAAK,oNAAoN,GAEjO,QAAQ,KAAK,IAAI,MAAK,EAAG,KAAK,IAEzB,oBAAI,KAAK,GAAG;AAEvB;AC3Be,SAASC,EAAyBC,GAAUC,GAAW;AACpE,SAAAR,EAAa,GAAG,SAAS,GAClBG,EAAOI,CAAQ,EAAE,QAAO,IAAKJ,EAAOK,CAAS,EAAE,QAAO;AAC/D;AC3Be,SAASC,EAAgBC,GAAQC,GAAc;AAG5D,WAFIC,IAAOF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A,cACA;AAAA,gBACE,aAAa7B;AAAA,gBACb,YAAY,CAACA,KAAYa,MAAmB;AAAA,gBAC5C,cAAc,CAACb,KAAYa,MAAmB;AAAA,cAAA;AAAA,YAChD;AAAA,YAGF,UAAA;AAAA,cAAA,gBAAAe,EAAC,UAAA,EAAO,WAAU,oCAAmC,SAAST,GAC5D,UAAA;AAAA,gBAAA,gBAAAO,EAACI,GAAA,EAAK,MAAMjC,GAAM,UAAAC,GAAoB,OAAM,QAAO;AAAA,gBACnD,gBAAA4B,EAAC,QAAA,EAAK,WAAU,WACb,UAAA/B,EAAA,CAEH;AAAA,cAAA,GACF;AAAA,cACA,gBAAAiC,EAAC,QAAA,EAAK,WAAU,wBACb,UAAA;AAAA,gBAAAf,MAAmB,WAAW,gBAAAa,EAACI,GAAA,EAAK,MAAK,gBAAe,OAAM,QAAO;AAAA,gBACrEjB,MAAmB,aAAa,gBAAAa,EAACI,KAAK,MAAK,gBAAe,OAAM,OAAA,CAAO;AAAA,cAAA,EAAA,CAC1E;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"DateField.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../../node_modules/date-fns/esm/toDate/index.js","../../../node_modules/date-fns/esm/differenceInMilliseconds/index.js","../../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../../node_modules/date-fns/esm/formatISO/index.js","../../../lib/molecules/Forms/DateField.tsx"],"sourcesContent":["export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","export default function requiredArgs(required, args) {\n if (args.length < required) {\n throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n }\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n requiredArgs(1, arguments);\n var argStr = Object.prototype.toString.call(argument);\n\n // Clone the date\n if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument);\n } else {\n if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(\"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments\");\n // eslint-disable-next-line no-console\n console.warn(new Error().stack);\n }\n return new Date(NaN);\n }\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * const result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport default function differenceInMilliseconds(dateLeft, dateRight) {\n requiredArgs(2, arguments);\n return toDate(dateLeft).getTime() - toDate(dateRight).getTime();\n}","export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return sign + output;\n}","import toDate from \"../toDate/index.js\";\nimport addLeadingZeros from \"../_lib/addLeadingZeros/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name formatISO\n * @category Common Helpers\n * @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).\n *\n * @description\n * Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {'extended'|'basic'} [options.format='extended'] - if 'basic', hide delimiters between date and time values.\n * @param {'complete'|'date'|'time'} [options.representation='complete'] - format date, time with local time zone, or both.\n * @returns {String} the formatted date string (in local time zone)\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `date` must not be Invalid Date\n * @throws {RangeError} `options.format` must be 'extended' or 'basic'\n * @throws {RangeError} `options.representation` must be 'date', 'time' or 'complete'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))\n * //=> '2019-09-18T19:00:52Z'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })\n * //=> '20190918T190052'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, date only:\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })\n * //=> '2019-09-18'\n *\n * @example\n * // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):\n * const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })\n * //=> '19:00:52Z'\n */\nexport default function formatISO(date, options) {\n var _options$format, _options$representati;\n requiredArgs(1, arguments);\n var originalDate = toDate(date);\n if (isNaN(originalDate.getTime())) {\n throw new RangeError('Invalid time value');\n }\n var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : 'extended');\n var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : 'complete');\n if (format !== 'extended' && format !== 'basic') {\n throw new RangeError(\"format must be 'extended' or 'basic'\");\n }\n if (representation !== 'date' && representation !== 'time' && representation !== 'complete') {\n throw new RangeError(\"representation must be 'date', 'time', or 'complete'\");\n }\n var result = '';\n var tzOffset = '';\n var dateDelimiter = format === 'extended' ? '-' : '';\n var timeDelimiter = format === 'extended' ? ':' : '';\n\n // Representation is either 'date' or 'complete'\n if (representation !== 'time') {\n var day = addLeadingZeros(originalDate.getDate(), 2);\n var month = addLeadingZeros(originalDate.getMonth() + 1, 2);\n var year = addLeadingZeros(originalDate.getFullYear(), 4);\n\n // yyyyMMdd or yyyy-MM-dd.\n result = \"\".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);\n }\n\n // Representation is either 'time' or 'complete'\n if (representation !== 'date') {\n // Add the timezone.\n var offset = originalDate.getTimezoneOffset();\n if (offset !== 0) {\n var absoluteOffset = Math.abs(offset);\n var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2);\n var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);\n // If less than 0, the sign is +, because it is ahead of time.\n var sign = offset < 0 ? '+' : '-';\n tzOffset = \"\".concat(sign).concat(hourOffset, \":\").concat(minuteOffset);\n } else {\n tzOffset = 'Z';\n }\n var hour = addLeadingZeros(originalDate.getHours(), 2);\n var minute = addLeadingZeros(originalDate.getMinutes(), 2);\n var second = addLeadingZeros(originalDate.getSeconds(), 2);\n\n // If there's also date, separate it with time with 'T'\n var separator = result === '' ? '' : 'T';\n\n // Creates a time string consisting of hour, minute, and second, separated by delimiters, if defined.\n var time = [hour, minute, second].join(timeDelimiter);\n\n // HHmmss or HH:mm:ss.\n result = \"\".concat(result).concat(separator).concat(time).concat(tzOffset);\n }\n return result;\n}","import clsx from 'clsx';\nimport { differenceInMilliseconds, formatISO } from 'date-fns';\nimport { type ChangeEvent, useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { Icon, type IconicNames, type IconicTypes } from '@clubmed/trident-icons';\n\nimport { useValue } from '@/hooks/useValue.js';\nimport { useInternalStatus } from '@/hooks/useInternalStatus.js';\nimport { FormControl, type FormControlProps } from './FormControl.js';\n\ninterface DateFieldProps extends Omit<FormControlProps<Date | null>, 'max' | 'min'> {\n description?: string;\n /**\n * Open datepicker text\n */\n openDatepicker?: string;\n id?: string;\n icon?: IconicNames;\n iconType?: IconicTypes;\n errorMessage?: string;\n dataTestId?: string;\n /**\n * Minimum Date allowed\n */\n min?: Date | undefined;\n /**\n * Maximum Date allowed\n */\n max?: Date | undefined;\n}\n\nconst formatDate = (value: Date | number | undefined | null): string => {\n if (!value) {\n return '';\n }\n\n return formatISO(new Date(value), { representation: 'date' });\n};\n\nconst validateDateRange = (date: string, min?: Date, max?: Date): boolean => {\n if (!date) {\n return true;\n }\n\n const normalizeDate = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate());\n const inputDate = new Date(date);\n const normalizedInputDate = normalizeDate(inputDate);\n\n if (min && normalizedInputDate < normalizeDate(min)) {\n return false;\n }\n if (max && normalizedInputDate > normalizeDate(max)) {\n return false;\n }\n\n return true;\n};\n\nexport const DateField = (props: DateFieldProps) => {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n label,\n description,\n openDatepicker,\n validationStatus = 'default',\n icon = 'CalendarDefault',\n iconType,\n errorMessage,\n disabled = false,\n required = false,\n hideRequiredStar,\n dataTestId = 'DateField',\n value: initialValue,\n min: initialMin,\n max: initialMax,\n onChange,\n ...rest\n } = props;\n\n // NO LOGIC IS IMPLEMENTED YET HERE\n // THIS IS A VISUAL COMPONENT ONLY\n const ref = useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = useState<boolean>(false);\n\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const { setValue, value } = useValue<string, Date | number | undefined | null>({\n name,\n formatter: formatDate as never,\n initialValue,\n onChange: (name, value) => onChange?.(name, new Date(value)),\n });\n\n const min = formatDate(initialMin);\n const max = formatDate(initialMax);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value);\n };\n\n const handleClickPicker = () => {\n ref.current?.showPicker();\n };\n\n const handleOutOfRangeDate = useCallback(() => {\n const currentDate = new Date(value);\n\n if (initialMin && initialMax) {\n const distanceToMin = Math.abs(differenceInMilliseconds(currentDate, initialMin));\n const distanceToMax = Math.abs(differenceInMilliseconds(currentDate, initialMax));\n setValue(distanceToMin <= distanceToMax ? min : max);\n return;\n }\n\n if (initialMin) {\n setValue(min);\n return;\n }\n\n if (initialMax) {\n setValue(max);\n return;\n }\n }, [initialMax, initialMin, max, min, setValue, value]);\n\n useEffect(() => {\n const isValid = validateDateRange(value, initialMin, initialMax);\n if (!isValid && !isFocused) {\n handleOutOfRangeDate();\n }\n }, [handleOutOfRangeDate, initialMax, initialMin, isFocused, value]);\n\n return (\n <FormControl\n id={id}\n label={label}\n description={description}\n dataName=\"DateField\"\n dataTestId={dataTestId}\n disabled={disabled}\n required={required}\n hideRequiredStar={hideRequiredStar}\n validationStatus={validationStatus}\n errorMessage={errorMessage}\n >\n <div className=\"relative\">\n <input\n {...rest}\n type=\"date\"\n className={clsx(\n 'text-b3 rounded-pill date-field min-h-[50px] w-full border px-20 py-12 ps-[52px] font-normal outline-none',\n {\n 'border-lightGrey focus:border-black active:border-black':\n internalStatus === 'default',\n 'pe-[52px]': internalStatus === 'error' || internalStatus === 'success',\n 'bg-pearl text-grey': disabled,\n 'bg-white text-black': !disabled,\n 'border-red': !disabled && internalStatus === 'error',\n 'border-green': !disabled && internalStatus === 'success',\n },\n )}\n id={id}\n disabled={disabled}\n required={required}\n ref={ref}\n value={value}\n min={min}\n max={max}\n onChange={handleChange}\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n />\n <div\n className={clsx(\n 'pointer-events-none absolute inset-0 flex items-center justify-between px-20 py-12',\n {\n 'text-grey': disabled,\n 'text-red': !disabled && internalStatus === 'error',\n 'text-green': !disabled && internalStatus === 'success',\n },\n )}\n >\n <button className=\"pointer-events-auto leading-none\" onClick={handleClickPicker}>\n <Icon name={icon} iconType={iconType} width=\"24px\" />\n <span className=\"sr-only\">\n {openDatepicker}\n {/* REPLACE THAT WITH SOMETHING LIKE \"OPEN DATEPICKER\" SOONER RATHER THAN LATER PLZ */}\n </span>\n </button>\n <span className=\"ms-auto flex gap-x-8\">\n {internalStatus === 'error' && <Icon name=\"CrossDefault\" width=\"24px\" />}\n {internalStatus === 'success' && <Icon name=\"CheckDefault\" width=\"24px\" />}\n </span>\n </div>\n </div>\n </FormControl>\n );\n};\n"],"names":["_typeof","o","requiredArgs","required","args","toDate","argument","argStr","differenceInMilliseconds","dateLeft","dateRight","addLeadingZeros","number","targetLength","sign","output","formatISO","date","options","_options$format","_options$representati","originalDate","format","representation","result","tzOffset","dateDelimiter","timeDelimiter","day","month","year","offset","absoluteOffset","hourOffset","minuteOffset","hour","minute","second","separator","time","formatDate","value","validateDateRange","min","max","normalizeDate","d","inputDate","normalizedInputDate","DateField","props","internalId","useId","id","name","label","description","openDatepicker","validationStatus","icon","iconType","errorMessage","disabled","hideRequiredStar","dataTestId","initialValue","initialMin","initialMax","onChange","rest","ref","useRef","isFocused","setIsFocused","useState","internalStatus","useInternalStatus","setValue","useValue","handleChange","event","handleClickPicker","handleOutOfRangeDate","useCallback","currentDate","distanceToMin","distanceToMax","useEffect","jsx","FormControl","jsxs","clsx","Icon"],"mappings":";;;;;;;AAAe,SAASA,EAAQC,GAAG;AACjC;AAEA,SAAOD,IAAwB,OAAO,UAArB,cAA2C,OAAO,OAAO,YAA1B,WAAqC,SAAUC,GAAG;AAChG,WAAO,OAAOA;AAAA,EAChB,IAAI,SAAUA,GAAG;AACf,WAAOA,KAAmB,OAAO,UAArB,cAA+BA,EAAE,gBAAgB,UAAUA,MAAM,OAAO,YAAY,WAAW,OAAOA;AAAA,EACpH,GAAGD,EAAQC,CAAC;AACd;ACRe,SAASC,EAAaC,GAAUC,GAAM;AACnD,MAAIA,EAAK,SAASD;AAChB,UAAM,IAAI,UAAUA,IAAW,eAAeA,IAAW,IAAI,MAAM,MAAM,yBAAyBC,EAAK,SAAS,UAAU;AAE9H;AC4Be,SAASC,EAAOC,GAAU;AACvC,EAAAJ,EAAa,GAAG,SAAS;AACzB,MAAIK,IAAS,OAAO,UAAU,SAAS,KAAKD,CAAQ;AAGpD,SAAIA,aAAoB,QAAQN,EAAQM,CAAQ,MAAM,YAAYC,MAAW,kBAEpE,IAAI,KAAKD,EAAS,SAAS,IACzB,OAAOA,KAAa,YAAYC,MAAW,oBAC7C,IAAI,KAAKD,CAAQ,MAEnB,OAAOA,KAAa,YAAYC,MAAW,sBAAsB,OAAO,UAAY,QAEvF,QAAQ,KAAK,oNAAoN,GAEjO,QAAQ,KAAK,IAAI,MAAK,EAAG,KAAK,IAEzB,oBAAI,KAAK,GAAG;AAEvB;AC3Be,SAASC,EAAyBC,GAAUC,GAAW;AACpE,SAAAR,EAAa,GAAG,SAAS,GAClBG,EAAOI,CAAQ,EAAE,QAAO,IA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