@clubmed/trident-ui 2.0.0-beta.2 → 2.0.0-beta.21

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 (87) hide show
  1. package/chunks/DateField.js +36 -35
  2. package/chunks/DateField.js.map +1 -1
  3. package/examples/button-demo.js +2 -2
  4. package/examples/button-demo.js.map +1 -1
  5. package/examples/checkbox-demo.js +16 -20
  6. package/examples/checkbox-demo.js.map +1 -1
  7. package/examples/checkboxes-demo.js +6 -6
  8. package/examples/checkboxes-demo.js.map +1 -1
  9. package/examples/choice-expander-demo.js +4 -67
  10. package/examples/choice-expander-demo.js.map +1 -1
  11. package/examples/dropdown-demo.js +9 -1
  12. package/examples/dropdown-demo.js.map +1 -1
  13. package/examples/elastic-height-demo.js +2 -1
  14. package/examples/elastic-height-demo.js.map +1 -1
  15. package/examples/frame-demo.d.ts +1 -0
  16. package/examples/frame-demo.js +18 -0
  17. package/examples/frame-demo.js.map +1 -0
  18. package/examples/frame-horizontal-demo.d.ts +1 -0
  19. package/examples/frame-horizontal-demo.js +18 -0
  20. package/examples/frame-horizontal-demo.js.map +1 -0
  21. package/examples/frame-vertical-demo.d.ts +1 -0
  22. package/examples/frame-vertical-demo.js +18 -0
  23. package/examples/frame-vertical-demo.js.map +1 -0
  24. package/examples/frame-with-tag-demo.d.ts +1 -0
  25. package/examples/frame-with-tag-demo.js +23 -0
  26. package/examples/frame-with-tag-demo.js.map +1 -0
  27. package/examples/sidebar-layout-demo.js +5 -5
  28. package/examples/sidebar-layout-demo.js.map +1 -1
  29. package/examples/sidebar-layout-minimal-demo.js +2 -2
  30. package/examples/sidebar-layout-minimal-demo.js.map +1 -1
  31. package/examples/sidebar-layout-with-header-demo.js +2 -2
  32. package/examples/sidebar-layout-with-header-demo.js.map +1 -1
  33. package/package.json +2 -1
  34. package/styles/animate.css +19 -19
  35. package/styles/theme.css +23 -18
  36. package/styles/ui/button.css +18 -24
  37. package/styles/ui/controls.css +1 -11
  38. package/styles/variants.css +0 -2
  39. package/ui/AdvancedToast.js +11 -11
  40. package/ui/AdvancedToast.js.map +1 -1
  41. package/ui/BasicToast.js +1 -1
  42. package/ui/BasicToast.js.map +1 -1
  43. package/ui/Breadcrumb.d.ts +2 -2
  44. package/ui/Breadcrumb.js +31 -35
  45. package/ui/Breadcrumb.js.map +1 -1
  46. package/ui/ChoiceExpander.js +1 -1
  47. package/ui/ChoiceExpander.js.map +1 -1
  48. package/ui/Dropdown.d.ts +20 -3
  49. package/ui/Dropdown.js +57 -23
  50. package/ui/Dropdown.js.map +1 -1
  51. package/ui/ElasticHeight.d.ts +0 -1
  52. package/ui/ElasticHeight.js +14 -23
  53. package/ui/ElasticHeight.js.map +1 -1
  54. package/ui/Frame.d.ts +15 -0
  55. package/ui/Frame.js +39 -0
  56. package/ui/Frame.js.map +1 -0
  57. package/ui/Loader.d.ts +5 -4
  58. package/ui/Loader.js +11 -10
  59. package/ui/Loader.js.map +1 -1
  60. package/ui/Popin.js +2 -2
  61. package/ui/Popin.js.map +1 -1
  62. package/ui/SidebarLayout.d.ts +11 -7
  63. package/ui/SidebarLayout.js +55 -34
  64. package/ui/SidebarLayout.js.map +1 -1
  65. package/ui/arrows/Arrows.d.ts +1 -0
  66. package/ui/arrows/Arrows.js +19 -17
  67. package/ui/arrows/Arrows.js.map +1 -1
  68. package/ui/buttons/Button.type.d.ts +1 -1
  69. package/ui/buttons/Button.type.js.map +1 -1
  70. package/ui/forms/Filter.d.ts +8 -4
  71. package/ui/forms/Filter.js +23 -45
  72. package/ui/forms/Filter.js.map +1 -1
  73. package/ui/forms/FormControl.js +6 -6
  74. package/ui/forms/NumberField.d.ts +10 -10
  75. package/ui/forms/checkboxes/Checkbox.d.ts +10 -12
  76. package/ui/forms/checkboxes/Checkbox.js +38 -55
  77. package/ui/forms/checkboxes/Checkbox.js.map +1 -1
  78. package/ui/forms/checkboxes/Checkboxes.js +2 -2
  79. package/ui/forms/checkboxes/Checkboxes.js.map +1 -1
  80. package/ui/helpers/colors/colors.d.ts +4 -0
  81. package/ui/helpers/colors/colors.js +6 -1
  82. package/ui/helpers/colors/colors.js.map +1 -1
  83. package/ui/hooks/useValue.js +1 -1
  84. package/ui/hooks/useValue.js.map +1 -1
  85. package/ui/Breadcrumb.themes.d.ts +0 -8
  86. package/ui/Breadcrumb.themes.js +0 -16
  87. package/ui/Breadcrumb.themes.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","names":[],"sources":["../../../lib/ui/forms/Filter.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId } from 'react';\nimport { Icon } from '@clubmed/trident-icons';\nimport { useValue } from '../hooks/useValue';\nimport type { FormControlProps } from './FormControl';\nimport { useInternalStatus } from '../hooks/useInternalStatus';\n\nexport interface FilterProps<Value = string> extends FormControlProps<Value> {\n /**\n * Is it attached to a dropdown?\n */\n hasDropdown?: boolean;\n\n onChange?: (name: string, value: Value | null) => void;\n}\n\nexport function Filter<Value = string>(props: FilterProps<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 tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n onChange,\n hasDropdown,\n children,\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\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div className={clsx(className, 'relative')}>\n <label data-testid={`filter-container-${id}`} className=\"relative\">\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=\"Filter\"\n disabled={disabled}\n value={value as any}\n />\n <span>\n <span className=\"font-semibold\">{children}</span>\n\n <Icon className=\"check\" width={null} name=\"CheckDefault\" color=\"black\" />\n\n {hasDropdown && (\n <Icon name=\"ArrowDefaultDown\" className=\"ml-8\" width=\"24px\" color=\"black\" />\n )}\n </span>\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"],"mappings":";;;;;;;AAgBA,SAAgB,EAAuB,GAA2B;CAChE,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,cACA,eACA,cAAW,IACX,SAAS,IAAiB,IAC1B,UACA,cAAW,GACX,sBAAmB,WACnB,iBACA,aACA,gBACA,aACA,GAAG,MACD,GAEE,EAAE,OAAO,GAAS,gBAAa,EAAkB;EACrD;EACA,cAAc;EACd,SAAS,GAAM,GAAS;AACtB,OAAW,GAAM,IAAY,MAAU,KAAA,IAAoB,IAAR,IAA6B,KAAK;;EAExF,CAAC,EAOI,IALiB,EAAkB;EACvC,YAAY;EACZ;EACD,CAAC,KAEmD,WAAW;AAEhE,QACE,kBAAC,OAAD;EAAK,WAAW,EAAK,GAAW,WAAW;YAA3C,CACE,kBAAC,SAAD;GAAO,eAAa,oBAAoB;GAAM,WAAU;aAAxD,CACE,kBAAC,SAAD;IACE,GAAI;IACE;IACN,eAAa;IACb,MAAK;IACK;IACV,gBAAgB;AACd,KAAK,KAAU,EAAS,CAAC,EAAQ;;IAE1B;IACT,aAAU;IACA;IACH;IACP,CAAA,EACF,kBAAC,QAAD,EAAA,UAAA;IACE,kBAAC,QAAD;KAAM,WAAU;KAAiB;KAAgB,CAAA;IAEjD,kBAAC,GAAD;KAAM,WAAU;KAAQ,OAAO;KAAM,MAAK;KAAe,OAAM;KAAU,CAAA;IAExE,KACC,kBAAC,GAAD;KAAM,MAAK;KAAmB,WAAU;KAAO,OAAM;KAAO,OAAM;KAAU,CAAA;IAEzE,EAAA,CAAA,CACD;MAEP,KACC,kBAAC,QAAD;GAAM,WAAU;GAAoD,MAAK;aAAzE,CACE,kBAAC,GAAD;IAAM,MAAK;IAAQ,OAAM;IAAS,CAAA,EACjC,EACI;KAEL"}
1
+ {"version":3,"file":"Filter.js","names":[],"sources":["../../../lib/ui/forms/Filter.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId, type ComponentPropsWithoutRef } from 'react';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface FilterProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {\n /**\n * Is it attached to a dropdown?\n */\n hasDropdown?: boolean;\n /**\n * @deprecated use [\"data-testid\"] instead\n */\n dataTestId?: string;\n 'data-testid'?: string;\n}\n\nexport function Filter(props: FilterProps) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n dataTestId,\n disabled = false,\n 'data-testid': dataTestIdProp,\n tabIndex = 0,\n hasDropdown,\n children,\n ...rest\n } = props;\n\n return (\n <div className={clsx(className, 'relative')}>\n <label data-testid={`filter-container-${id}`} className=\"relative\">\n <input\n {...rest}\n id={id}\n name={name}\n data-testid={dataTestIdProp ?? dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n data-name=\"Filter\"\n disabled={disabled}\n />\n <span>\n <span className=\"font-semibold\">{children}</span>\n\n <Icon className=\"check\" width={null} name=\"CheckDefault\" color=\"black\" />\n\n {hasDropdown && (\n <Icon name=\"ArrowDefaultDown\" className=\"ml-8\" width=\"24px\" color=\"black\" />\n )}\n </span>\n </label>\n </div>\n );\n}\n"],"mappings":";;;;;AAgBA,SAAgB,EAAO,GAAoB;CACzC,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,cACA,eACA,cAAW,IACX,eAAe,GACf,cAAW,GACX,gBACA,aACA,GAAG,MACD;AAEJ,QACE,kBAAC,OAAD;EAAK,WAAW,EAAK,GAAW,WAAW;YACzC,kBAAC,SAAD;GAAO,eAAa,oBAAoB;GAAM,WAAU;aAAxD,CACE,kBAAC,SAAD;IACE,GAAI;IACA;IACE;IACN,eAAa,KAAkB;IAC/B,MAAK;IACK;IACV,aAAU;IACA;IACV,CAAA,EACF,kBAAC,QAAD,EAAA,UAAA;IACE,kBAAC,QAAD;KAAM,WAAU;KAAiB;KAAgB,CAAA;IAEjD,kBAAC,GAAD;KAAM,WAAU;KAAQ,OAAO;KAAM,MAAK;KAAe,OAAM;KAAU,CAAA;IAExE,KACC,kBAAC,GAAD;KAAM,MAAK;KAAmB,WAAU;KAAO,OAAM;KAAO,OAAM;KAAU,CAAA;IAEzE,EAAA,CAAA,CACD;;EACJ,CAAA"}
@@ -1,11 +1,11 @@
1
1
  import { t as e } from "../../chunks/clsx.js";
2
- import { useInternalStatus as t } from "../hooks/useInternalStatus.js";
3
- import { FormLabel as n } from "./FormLabel.js";
4
- import { FormControlError as r } from "./FormControlError.js";
2
+ import { FormControlError as t } from "./FormControlError.js";
3
+ import { useInternalStatus as n } from "../hooks/useInternalStatus.js";
4
+ import { FormLabel as r } from "./FormLabel.js";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  //#region lib/ui/forms/FormControl.tsx
7
7
  var o = ({ id: o, label: s, description: c, disabled: l, required: u, className: d, validationStatus: f = "default", children: p, errorMessage: m, dataTestId: h, "data-testid": g, dataName: _, labelClassName: v, hideRequiredStar: y, layout: b, inline: x }) => {
8
- let S = t({
8
+ let S = n({
9
9
  isDisabled: !!l,
10
10
  validationStatus: f
11
11
  }) === "error" && m;
@@ -14,7 +14,7 @@ var o = ({ id: o, label: s, description: c, disabled: l, required: u, className:
14
14
  "data-name": _,
15
15
  "data-testid": g ?? h,
16
16
  children: [
17
- s && o && /* @__PURE__ */ i(n, {
17
+ s && o && /* @__PURE__ */ i(r, {
18
18
  description: c,
19
19
  id: o,
20
20
  layout: b,
@@ -24,7 +24,7 @@ var o = ({ id: o, label: s, description: c, disabled: l, required: u, className:
24
24
  children: s
25
25
  }),
26
26
  p,
27
- S && /* @__PURE__ */ i(r, { children: m })
27
+ S && /* @__PURE__ */ i(t, { children: m })
28
28
  ]
29
29
  });
30
30
  };
@@ -34,14 +34,11 @@ export declare function useNumberField(props: NumberFieldProps): {
34
34
  errorMessage?: string;
35
35
  color?: string | undefined | undefined;
36
36
  size?: number | undefined | undefined;
37
- description?: string | undefined;
38
- layout?: "horizontal" | `horizontal-${string}` | "vertical" | undefined;
39
- required?: boolean | undefined | undefined;
40
- hideRequiredStar?: boolean | undefined;
41
- className?: string | undefined | undefined;
37
+ content?: string | undefined | undefined;
38
+ translate?: "yes" | "no" | undefined | undefined;
39
+ prefix?: string | undefined | undefined;
42
40
  children?: import('react').ReactNode;
43
- form?: string | undefined | undefined;
44
- htmlFor?: string | undefined | undefined;
41
+ className?: string | undefined | undefined;
45
42
  defaultChecked?: boolean | undefined | undefined;
46
43
  defaultValue?: string | number | readonly string[] | undefined;
47
44
  suppressContentEditableWarning?: boolean | undefined | undefined;
@@ -62,14 +59,11 @@ export declare function useNumberField(props: NumberFieldProps): {
62
59
  style?: import('react').CSSProperties | undefined;
63
60
  tabIndex?: number | undefined | undefined;
64
61
  title?: string | undefined | undefined;
65
- translate?: "yes" | "no" | undefined | undefined;
66
62
  radioGroup?: string | undefined | undefined;
67
63
  role?: import('react').AriaRole | undefined;
68
64
  about?: string | undefined | undefined;
69
- content?: string | undefined | undefined;
70
65
  datatype?: string | undefined | undefined;
71
66
  inlist?: any;
72
- prefix?: string | undefined | undefined;
73
67
  property?: string | undefined | undefined;
74
68
  rel?: string | undefined | undefined;
75
69
  resource?: string | undefined | undefined;
@@ -317,6 +311,7 @@ export declare function useNumberField(props: NumberFieldProps): {
317
311
  onTransitionRunCapture?: (import('react').TransitionEventHandler<HTMLInputElement> & import('react').TransitionEventHandler<HTMLLabelElement>) | undefined;
318
312
  onTransitionStart?: (import('react').TransitionEventHandler<HTMLInputElement> & import('react').TransitionEventHandler<HTMLLabelElement>) | undefined;
319
313
  onTransitionStartCapture?: (import('react').TransitionEventHandler<HTMLInputElement> & import('react').TransitionEventHandler<HTMLLabelElement>) | undefined;
314
+ form?: string | undefined | undefined;
320
315
  list?: string | undefined | undefined;
321
316
  pattern?: string | undefined | undefined;
322
317
  width?: number | string | undefined | undefined;
@@ -336,9 +331,14 @@ export declare function useNumberField(props: NumberFieldProps): {
336
331
  multiple?: boolean | undefined | undefined;
337
332
  placeholder?: string | undefined | undefined;
338
333
  readOnly?: boolean | undefined | undefined;
334
+ required?: boolean | undefined | undefined;
339
335
  src?: string | undefined | undefined;
340
336
  step?: number | string | undefined | undefined;
341
337
  type?: import('react').HTMLInputTypeAttribute | undefined;
338
+ description?: string | undefined;
339
+ layout?: "horizontal" | `horizontal-${string}` | "vertical" | undefined;
340
+ hideRequiredStar?: boolean | undefined;
341
+ htmlFor?: string | undefined | undefined;
342
342
  };
343
343
  export declare const NumberField: (props: NumberFieldProps) => import("react/jsx-runtime").JSX.Element;
344
344
  export {};
@@ -1,14 +1,12 @@
1
- import { InputHTMLAttributes } from 'react';
2
- import { FormControlProps } from '../FormControl';
3
- export interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
4
- /**
5
- * The data-testid to apply to the button.
6
- * This is used for testing purposes.
7
- * @deprecated use ["data-testid"] instead.
8
- */
9
- dataTestId?: string;
10
- size?: number;
11
- validationStatus?: FormControlProps['validationStatus'];
12
- errorMessage?: FormControlProps['errorMessage'];
1
+ import { ComponentPropsWithoutRef, Ref } from 'react';
2
+ import { Colors } from '../../types/Colors';
3
+ import { ValidationStatus } from '../../hooks/useInternalStatus';
4
+ export interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
5
+ color?: Colors;
6
+ size?: string;
7
+ validationStatus?: ValidationStatus;
8
+ errorMessage?: string;
9
+ ['data-testid']?: string;
10
+ ref?: Ref<HTMLInputElement>;
13
11
  }
14
12
  export declare function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,63 +1,46 @@
1
1
  import { t as e } from "../../../chunks/clsx.js";
2
- import { useInternalStatus as t } from "../../hooks/useInternalStatus.js";
3
- import { useId as n } from "react";
4
- import { Icon as r } from "@clubmed/trident-icons";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
2
+ import { getBorderColor as t, getTextColor as n } from "../../helpers/colors/colors.js";
3
+ import { FormControlError as r } from "../FormControlError.js";
4
+ import { useInternalStatus as i } from "../../hooks/useInternalStatus.js";
5
+ import { useId as a } from "react";
6
+ import { Icon as o } from "@clubmed/trident-icons";
7
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
8
  //#region lib/ui/forms/checkboxes/Checkbox.tsx
7
- function o(o) {
8
- let s = n(), { id: c = s, name: l = c, className: u, disabled: d = !1, size: f = 24, tabIndex: p = 0, validationStatus: m = "default", errorMessage: h, children: g, dataTestId: _, ...v } = o, y = t({
9
- isDisabled: d,
10
- validationStatus: m
11
- }), b = y === "error" && h;
12
- return /* @__PURE__ */ a("div", {
13
- className: e("flex flex-col space-y-2", u),
14
- "data-testid": `checkbox-container-${c}`,
15
- children: [/* @__PURE__ */ a("label", {
16
- className: e("cursor-pointer relative flex text-b3 items-center", {
17
- "text-grey": y === "disabled",
18
- "text-black": y !== "default"
19
- }),
20
- children: [/* @__PURE__ */ a("span", {
21
- className: "relative self-start me-8",
22
- children: [/* @__PURE__ */ i("input", {
23
- "data-testid": _,
24
- ...v,
25
- id: c,
26
- name: l,
27
- type: "checkbox",
28
- tabIndex: p,
29
- "data-name": "Checkbox",
30
- disabled: d
31
- }), /* @__PURE__ */ i("span", {
32
- style: {
33
- height: f,
34
- width: f
35
- },
36
- className: e({
37
- "!border-red": y === "error",
38
- "bg-pearl": y === "disabled"
39
- }),
40
- "data-testid": `check-container-${c}`,
41
- children: /* @__PURE__ */ i(r, {
42
- name: "CheckDefault",
43
- type: "svg",
44
- width: `${f}px`,
45
- color: "black",
46
- className: "absolute"
47
- })
48
- })]
49
- }), g]
50
- }), b && /* @__PURE__ */ a("span", {
51
- className: "text-red text-b4 flex items-start space-x-4 ps-20",
52
- role: "alert",
53
- children: [/* @__PURE__ */ i(r, {
54
- name: "Error",
55
- width: "20px"
56
- }), h]
9
+ function l(l) {
10
+ let u = a(), { id: d = u, name: f = d, className: p, color: m = "black", size: h = "size-24", disabled: g = !1, tabIndex: _ = 0, validationStatus: v = "default", errorMessage: y, children: b, ref: x, "data-testid": S, ...C } = l, w = i({
11
+ isDisabled: g,
12
+ validationStatus: v
13
+ }), T = w === "disabled", E = w === "error" && y, D = e({
14
+ "!border-red": w === "error",
15
+ "bg-pearl": T
16
+ }), O = /* @__PURE__ */ c("span", {
17
+ className: e("rounded-8 inline-flex shrink-0 items-center justify-center self-start border", t(m), n(m), h, D, p),
18
+ "data-name": "Checkbox",
19
+ children: [/* @__PURE__ */ s("input", {
20
+ ...C,
21
+ disabled: g,
22
+ id: d,
23
+ name: f,
24
+ className: "peer sr-only",
25
+ ref: x,
26
+ tabIndex: _,
27
+ type: "checkbox"
28
+ }), /* @__PURE__ */ s(o, {
29
+ className: "scale-1/2 transition-[transform,opacity] peer-checked:scale-auto opacity-0 peer-checked:opacity-100",
30
+ name: "CheckDefault",
31
+ width: "100%"
57
32
  })]
58
33
  });
34
+ return !b && !y ? O : /* @__PURE__ */ c("div", {
35
+ className: e("flex flex-col space-y-2", p),
36
+ "data-testid": S || `checkbox-container-${d}`,
37
+ children: [/* @__PURE__ */ c("label", {
38
+ className: e("relative flex items-center gap-8", { "text-grey": g }),
39
+ children: [O, b]
40
+ }), E && /* @__PURE__ */ s(r, { children: y })]
41
+ });
59
42
  }
60
43
  //#endregion
61
- export { o as Checkbox };
44
+ export { l as Checkbox };
62
45
 
63
46
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../../lib/ui/forms/checkboxes/Checkbox.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId } from 'react';\nimport type { InputHTMLAttributes } from 'react';\nimport type { FormControlProps } from '../FormControl';\nimport { useInternalStatus } from '@/ui/hooks/useInternalStatus';\nimport { Icon } from '@clubmed/trident-icons';\n\nexport interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {\n /**\n * The data-testid to apply to the button.\n * This is used for testing purposes.\n * @deprecated use [\"data-testid\"] instead.\n */\n dataTestId?: string;\n size?: number;\n validationStatus?: FormControlProps['validationStatus'];\n errorMessage?: FormControlProps['errorMessage'];\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n disabled = false,\n size = 24,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n dataTestId,\n ...rest\n } = props;\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 data-testid={dataTestId}\n {...rest}\n id={id}\n name={name}\n type=\"checkbox\"\n tabIndex={tabIndex}\n data-name=\"Checkbox\"\n disabled={disabled}\n />\n\n <span\n style={{ height: size, width: size }}\n className={clsx({\n '!border-red': internalStatus === 'error',\n 'bg-pearl': internalStatus === 'disabled',\n })}\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"],"mappings":";;;;;;AAmBA,SAAgB,EAAS,GAAsB;CAC7C,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,cACA,cAAW,IACX,UAAO,IACP,cAAW,GACX,sBAAmB,WACnB,iBACA,aACA,eACA,GAAG,MACD,GAEE,IAAiB,EAAkB;EACvC,YAAY;EACZ;EACD,CAAC,EAEI,IAA4B,MAAmB,WAAW;AAEhE,QACE,kBAAC,OAAD;EACE,WAAW,EAAK,2BAA2B,EAAU;EACrD,eAAa,sBAAsB;YAFrC,CAIE,kBAAC,SAAD;GACE,WAAW,EAAK,qDAAqD;IACnE,aAAa,MAAmB;IAChC,cAAc,MAAmB;IAClC,CAAC;aAJJ,CAME,kBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,kBAAC,SAAD;KACE,eAAa;KACb,GAAI;KACA;KACE;KACN,MAAK;KACK;KACV,aAAU;KACA;KACV,CAAA,EAEF,kBAAC,QAAD;KACE,OAAO;MAAE,QAAQ;MAAM,OAAO;MAAM;KACpC,WAAW,EAAK;MACd,eAAe,MAAmB;MAClC,YAAY,MAAmB;MAChC,CAAC;KACF,eAAa,mBAAmB;eAEhC,kBAAC,GAAD;MACE,MAAK;MACL,MAAK;MACL,OAAO,GAAG,EAAK;MACf,OAAM;MACN,WAAU;MACV,CAAA;KACG,CAAA,CACF;OAEN,EACK;MAEP,KACC,kBAAC,QAAD;GAAM,WAAU;GAAoD,MAAK;aAAzE,CACE,kBAAC,GAAD;IAAM,MAAK;IAAQ,OAAM;IAAS,CAAA,EACjC,EACI;KAEL"}
1
+ {"version":3,"file":"Checkbox.js","names":[],"sources":["../../../../lib/ui/forms/checkboxes/Checkbox.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId, type ComponentPropsWithoutRef, type Ref } from 'react';\nimport { Icon } from '@clubmed/trident-icons';\nimport type { Colors } from '../../types/Colors';\nimport { getBorderColor, getTextColor } from '../../helpers/colors/colors';\nimport { FormControlError } from '@/ui/forms/FormControlError';\nimport { useInternalStatus, type ValidationStatus } from '@/ui/hooks/useInternalStatus';\n\nexport interface CheckboxProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {\n color?: Colors;\n size?: string;\n validationStatus?: ValidationStatus;\n errorMessage?: string;\n ['data-testid']?: string;\n ref?: Ref<HTMLInputElement>;\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const internalId = useId();\n\n const {\n id = internalId,\n name = id,\n className,\n color = 'black',\n size = 'size-24',\n disabled = false,\n tabIndex = 0,\n validationStatus = 'default',\n errorMessage,\n children,\n ref,\n 'data-testid': dataTestId,\n ...rest\n } = props;\n\n const internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n const isDisabled = internalStatus === 'disabled';\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n // Apply validation styling to checkbox via className\n const checkboxClassName = clsx({\n '!border-red': internalStatus === 'error',\n 'bg-pearl': isDisabled,\n });\n\n const checkbox = (\n <span\n className={clsx(\n 'rounded-8 inline-flex shrink-0 items-center justify-center self-start border',\n getBorderColor(color),\n getTextColor(color),\n size,\n checkboxClassName,\n className,\n )}\n data-name=\"Checkbox\"\n >\n <input\n {...rest}\n disabled={disabled}\n id={id}\n name={name}\n className=\"peer sr-only\"\n ref={ref}\n tabIndex={tabIndex}\n type=\"checkbox\"\n />\n <Icon\n className=\"scale-1/2 transition-[transform,opacity] peer-checked:scale-auto opacity-0 peer-checked:opacity-100\"\n name=\"CheckDefault\"\n width=\"100%\"\n />\n </span>\n );\n\n if (!children && !errorMessage) {\n return checkbox;\n }\n\n return (\n <div\n className={clsx('flex flex-col space-y-2', className)}\n data-testid={dataTestId || `checkbox-container-${id}`}\n >\n <label\n className={clsx('relative flex items-center gap-8', {\n 'text-grey': disabled,\n })}\n >\n {checkbox}\n {children}\n </label>\n {shouldDisplayErrorMessage && <FormControlError>{errorMessage}</FormControlError>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,SAAgB,EAAS,GAAsB;CAC7C,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,cACA,WAAQ,SACR,UAAO,WACP,cAAW,IACX,cAAW,GACX,sBAAmB,WACnB,iBACA,aACA,QACA,eAAe,GACf,GAAG,MACD,GAEE,IAAiB,EAAkB;EACvC,YAAY;EACZ;EACD,CAAC,EACI,IAAa,MAAmB,YAEhC,IAA4B,MAAmB,WAAW,GAG1D,IAAoB,EAAK;EAC7B,eAAe,MAAmB;EAClC,YAAY;EACb,CAAC,EAEI,IACJ,kBAAC,QAAD;EACE,WAAW,EACT,gFACA,EAAe,EAAM,EACrB,EAAa,EAAM,EACnB,GACA,GACA,EACD;EACD,aAAU;YATZ,CAWE,kBAAC,SAAD;GACE,GAAI;GACM;GACN;GACE;GACN,WAAU;GACL;GACK;GACV,MAAK;GACL,CAAA,EACF,kBAAC,GAAD;GACE,WAAU;GACV,MAAK;GACL,OAAM;GACN,CAAA,CACG;;AAOT,QAJI,CAAC,KAAY,CAAC,IACT,IAIP,kBAAC,OAAD;EACE,WAAW,EAAK,2BAA2B,EAAU;EACrD,eAAa,KAAc,sBAAsB;YAFnD,CAIE,kBAAC,SAAD;GACE,WAAW,EAAK,oCAAoC,EAClD,aAAa,GACd,CAAC;aAHJ,CAKG,GACA,EACK;MACP,KAA6B,kBAAC,GAAD,EAAA,UAAmB,GAAgC,CAAA,CAC7E"}
@@ -29,8 +29,8 @@ function s(s) {
29
29
  tabIndex: _ + n + 1,
30
30
  className: e(t.props.className || "mt-8 first:mt-0"),
31
31
  checked: y.includes(i),
32
- onChange(e, t) {
33
- b(t === null ? y.filter((e) => e !== i) : y.concat(i));
32
+ onChange(e) {
33
+ e.target.checked ? b(y.concat(i)) : b(y.filter((e) => e !== i));
34
34
  }
35
35
  });
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Checkboxes.js","names":[],"sources":["../../../../lib/ui/forms/checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '../FormControl';\nimport { useValue } from '../../hooks/useValue';\nimport type { CheckboxProps } from './Checkbox';\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 = (child.props as CheckboxProps).value as Value;\n\n return cloneElement(child, {\n ...(child.props as any),\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: clsx((child.props as any).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);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"mappings":";;;;;AAsBA,SAAgB,EAA2B,GAA+B;CACxE,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,aACA,OAAO,GACP,iBACA,aACA,aACA,aACA,cAAW,GACX,GAAG,MACD,GAEE,EAAE,UAAO,gBAAa,EAAkB;EAC5C;EACA;EACA,UAAU,GAAO;AACf,UAAO,MAAU,KAAA,IAAqD,IAAxC,EAAE,CAAC,OAAO,EAAe;;EAEzD,cAAe,KAA6B,EAAE;EAC9C;EACD,CAAC;AAEF,QACE,kBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,EAAK;EAAW,MAAK;YAC5C,EAAS,IAAI,IAAW,GAAO,MAAU;AACxC,OAAI,EAAe,EAAM,EAAE;IACzB,IAAM,IAAa,EAAM,MAAwB;AAEjD,WAAO,EAAa,GAAO;KACzB,GAAI,EAAM;KACV;KACA,IAAI,GAAG,EAAG,GAAG;KACb;KACA;KACA,UAAU,IAAW,IAAQ;KAC7B,WAAW,EAAM,EAAM,MAAc,aAAa,kBAAkB;KACpE,SAAS,EAAM,SAAS,EAAU;KAClC,SAAS,GAAW,GAAoB;AACtC,MACE,EADE,MAAS,OACF,EAAM,QAAQ,MAAM,MAAM,EAAU,GAEpC,EAAM,OAAO,EAAU,CAAC;;KAGtC,CAAkB;;AAGrB,UAAO;IACP;EACE,CAAA"}
1
+ {"version":3,"file":"Checkboxes.js","names":[],"sources":["../../../../lib/ui/forms/checkboxes/Checkboxes.tsx"],"sourcesContent":["import { Children, cloneElement, type HTMLAttributes, isValidElement, useId } from 'react';\nimport type { FormControlProps } from '../FormControl';\nimport { useValue } from '../../hooks/useValue';\nimport type { CheckboxProps } from './Checkbox';\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 as Value;\n\n return cloneElement(child, {\n ...(child.props as any),\n name,\n id: `${id}-${index}`,\n disabled,\n readOnly,\n tabIndex: tabIndex + index + 1,\n className: clsx((child.props as any).className || 'mt-8 first:mt-0'),\n checked: value.includes(propValue),\n onChange(e: React.ChangeEvent<HTMLInputElement>) {\n if (e.target.checked) {\n setValue(value.concat(propValue));\n } else {\n setValue(value.filter((v) => v !== propValue));\n }\n },\n } as CheckboxProps);\n }\n\n return child;\n })}\n </div>\n );\n}\n"],"mappings":";;;;;AAsBA,SAAgB,EAA2B,GAA+B;CACxE,IAAM,IAAa,GAAO,EAEpB,EACJ,QAAK,GACL,UAAO,GACP,aACA,OAAO,GACP,iBACA,aACA,aACA,aACA,cAAW,GACX,GAAG,MACD,GAEE,EAAE,UAAO,gBAAa,EAAkB;EAC5C;EACA;EACA,UAAU,GAAO;AACf,UAAO,MAAU,KAAA,IAAqD,IAAxC,EAAE,CAAC,OAAO,EAAe;;EAEzD,cAAe,KAA6B,EAAE;EAC9C;EACD,CAAC;AAEF,QACE,kBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,EAAK;EAAW,MAAK;YAC5C,EAAS,IAAI,IAAW,GAAO,MAAU;AACxC,OAAI,EAAe,EAAM,EAAE;IACzB,IAAM,IAAoB,EAAM,MAAwB;AAExD,WAAO,EAAa,GAAO;KACzB,GAAI,EAAM;KACV;KACA,IAAI,GAAG,EAAG,GAAG;KACb;KACA;KACA,UAAU,IAAW,IAAQ;KAC7B,WAAW,EAAM,EAAM,MAAc,aAAa,kBAAkB;KACpE,SAAS,EAAM,SAAS,EAAU;KAClC,SAAS,GAAwC;AAC/C,MAAI,EAAE,OAAO,UACX,EAAS,EAAM,OAAO,EAAU,CAAC,GAEjC,EAAS,EAAM,QAAQ,MAAM,MAAM,EAAU,CAAC;;KAGnD,CAAkB;;AAGrB,UAAO;IACP;EACE,CAAA"}
@@ -8,6 +8,7 @@ export declare enum Colors {
8
8
  lightSand = "lightSand",
9
9
  marygold = "marygold",
10
10
  orange = "orange",
11
+ pearl = "pearl",
11
12
  red = "red",
12
13
  saffron = "saffron",
13
14
  sand = "sand",
@@ -47,6 +48,7 @@ declare const BG_COLORS: {
47
48
  readonly lightSand: "bg-lightSand";
48
49
  readonly marygold: "bg-marygold";
49
50
  readonly orange: "bg-orange";
51
+ readonly pearl: "bg-pearl";
50
52
  readonly red: "bg-red";
51
53
  readonly saffron: "bg-saffron";
52
54
  readonly sand: "bg-sand";
@@ -65,6 +67,7 @@ declare const TEXT_COLORS: {
65
67
  readonly lightSand: "text-lightSand";
66
68
  readonly marygold: "text-marygold";
67
69
  readonly orange: "text-orange";
70
+ readonly pearl: "text-pearl";
68
71
  readonly red: "text-red";
69
72
  readonly saffron: "text-saffron";
70
73
  readonly sand: "text-sand";
@@ -85,6 +88,7 @@ declare const TO_COLORS: {
85
88
  readonly lightSand: "to-lightSand";
86
89
  readonly marygold: "to-marygold";
87
90
  readonly orange: "to-orange";
91
+ readonly pearl: "to-pearl";
88
92
  readonly red: "to-red";
89
93
  readonly saffron: "to-saffron";
90
94
  readonly sand: "to-sand";
@@ -1,6 +1,6 @@
1
1
  //#region lib/ui/helpers/colors/colors.ts
2
2
  var e = /* @__PURE__ */ function(e) {
3
- return e.black = "black", e.darkGrey = "darkGrey", e.green = "green", e.lavender = "lavender", e.lightGrey = "lightGrey", e.lightSand = "lightSand", e.marygold = "marygold", e.orange = "orange", e.red = "red", e.saffron = "saffron", e.sand = "sand", e.sienna = "sienna", e.ultramarine = "ultramarine", e.verdigris = "verdigris", e.wave = "wave", e.white = "white", e.current = "current", e;
3
+ return e.black = "black", e.darkGrey = "darkGrey", e.green = "green", e.lavender = "lavender", e.lightGrey = "lightGrey", e.lightSand = "lightSand", e.marygold = "marygold", e.orange = "orange", e.pearl = "pearl", e.red = "red", e.saffron = "saffron", e.sand = "sand", e.sienna = "sienna", e.ultramarine = "ultramarine", e.verdigris = "verdigris", e.wave = "wave", e.white = "white", e.current = "current", e;
4
4
  }({}), t = {
5
5
  [e.black]: "border-black",
6
6
  [e.darkGrey]: "border-darkGrey",
@@ -28,6 +28,7 @@ var e = /* @__PURE__ */ function(e) {
28
28
  [e.lightSand]: "bg-lightSand",
29
29
  [e.marygold]: "bg-marygold",
30
30
  [e.orange]: "bg-orange",
31
+ [e.pearl]: "bg-pearl",
31
32
  [e.red]: "bg-red",
32
33
  [e.saffron]: "bg-saffron",
33
34
  [e.sand]: "bg-sand",
@@ -44,6 +45,7 @@ var e = /* @__PURE__ */ function(e) {
44
45
  [e.lightSand]: "text-lightSand",
45
46
  [e.marygold]: "text-marygold",
46
47
  [e.orange]: "text-orange",
48
+ [e.pearl]: "text-pearl",
47
49
  [e.red]: "text-red",
48
50
  [e.saffron]: "text-saffron",
49
51
  [e.sand]: "text-sand",
@@ -62,6 +64,7 @@ var e = /* @__PURE__ */ function(e) {
62
64
  [e.lightSand]: "to-lightSand",
63
65
  [e.marygold]: "to-marygold",
64
66
  [e.orange]: "to-orange",
67
+ [e.pearl]: "to-pearl",
65
68
  [e.red]: "to-red",
66
69
  [e.saffron]: "to-saffron",
67
70
  [e.sand]: "to-sand",
@@ -80,6 +83,7 @@ var e = /* @__PURE__ */ function(e) {
80
83
  [e.sand]: e.black,
81
84
  [e.verdigris]: e.black,
82
85
  [e.white]: e.black,
86
+ [e.pearl]: e.black,
83
87
  [e.black]: e.white,
84
88
  [e.green]: e.white,
85
89
  [e.lavender]: e.white,
@@ -111,6 +115,7 @@ var e = /* @__PURE__ */ function(e) {
111
115
  [e.green]: "text-white",
112
116
  [e.lavender]: "text-white",
113
117
  [e.orange]: "text-white",
118
+ [e.pearl]: "text-white",
114
119
  [e.red]: "text-white",
115
120
  [e.sienna]: "text-white",
116
121
  [e.ultramarine]: "text-white",
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":[],"sources":["../../../../lib/ui/helpers/colors/colors.ts"],"sourcesContent":["import type { Theme } from '../../types/Theme';\n\nexport enum Colors {\n black = 'black',\n darkGrey = 'darkGrey',\n green = 'green',\n lavender = 'lavender',\n lightGrey = 'lightGrey',\n lightSand = 'lightSand',\n marygold = 'marygold',\n orange = 'orange',\n red = 'red',\n saffron = 'saffron',\n sand = 'sand',\n sienna = 'sienna',\n ultramarine = 'ultramarine',\n verdigris = 'verdigris',\n wave = 'wave',\n white = 'white',\n current = 'current',\n}\n\nconst BORDER_COLORS = {\n [Colors.black]: 'border-black',\n [Colors.darkGrey]: 'border-darkGrey',\n [Colors.green]: 'border-green',\n [Colors.lavender]: 'border-lavender',\n [Colors.lightGrey]: 'border-lightGrey',\n [Colors.lightSand]: 'border-lightSand',\n [Colors.marygold]: 'border-marygold',\n [Colors.orange]: 'border-orange',\n [Colors.red]: 'border-red',\n [Colors.saffron]: 'border-saffron',\n [Colors.sand]: 'border-sand',\n [Colors.sienna]: 'border-sienna',\n [Colors.ultramarine]: 'border-ultramarine',\n [Colors.verdigris]: 'border-verdigris',\n [Colors.wave]: 'border-wave',\n [Colors.white]: 'border-white',\n [Colors.current]: 'border-current',\n} as const satisfies Record<string, `border-${string}`>;\n\nexport type BorderColor = keyof typeof BORDER_COLORS;\n\nconst BG_COLORS = {\n [Colors.black]: 'bg-black',\n [Colors.darkGrey]: 'bg-darkGrey',\n [Colors.green]: 'bg-green',\n [Colors.lavender]: 'bg-lavender',\n [Colors.lightGrey]: 'bg-lightGrey',\n [Colors.lightSand]: 'bg-lightSand',\n [Colors.marygold]: 'bg-marygold',\n [Colors.orange]: 'bg-orange',\n [Colors.red]: 'bg-red',\n [Colors.saffron]: 'bg-saffron',\n [Colors.sand]: 'bg-sand',\n [Colors.sienna]: 'bg-sienna',\n [Colors.ultramarine]: 'bg-ultramarine',\n [Colors.verdigris]: 'bg-verdigris',\n [Colors.wave]: 'bg-wave',\n [Colors.white]: 'bg-white',\n [Colors.current]: 'bg-current',\n} as const satisfies Record<Colors, `bg-${string}`>;\n\nexport type BgColor = keyof typeof BG_COLORS;\n\nconst TEXT_COLORS = {\n [Colors.black]: 'text-black',\n [Colors.green]: 'text-green',\n [Colors.lavender]: 'text-lavender',\n [Colors.lightSand]: 'text-lightSand',\n [Colors.marygold]: 'text-marygold',\n [Colors.orange]: 'text-orange',\n [Colors.red]: 'text-red',\n [Colors.saffron]: 'text-saffron',\n [Colors.sand]: 'text-sand',\n [Colors.sienna]: 'text-sienna',\n [Colors.ultramarine]: 'text-ultramarine',\n [Colors.verdigris]: 'text-verdigris',\n [Colors.wave]: 'text-wave',\n [Colors.white]: 'text-white',\n [Colors.darkGrey]: 'text-darkGrey',\n [Colors.lightGrey]: 'text-lightGrey',\n [Colors.current]: 'text-current',\n} as const satisfies Record<Colors, `text-${string}`>;\n\nexport type TextColor = keyof typeof TEXT_COLORS;\n\nconst TO_COLORS = {\n [Colors.black]: `to-black`,\n [Colors.green]: `to-green`,\n [Colors.lavender]: `to-lavender`,\n [Colors.lightSand]: `to-lightSand`,\n [Colors.marygold]: `to-marygold`,\n [Colors.orange]: `to-orange`,\n [Colors.red]: `to-red`,\n [Colors.saffron]: `to-saffron`,\n [Colors.sand]: `to-sand`,\n [Colors.sienna]: `to-sienna`,\n [Colors.ultramarine]: `to-ultramarine`,\n [Colors.verdigris]: `to-verdigris`,\n [Colors.wave]: `to-wave`,\n [Colors.white]: `to-white`,\n [Colors.darkGrey]: `to-darkGrey`,\n [Colors.lightGrey]: `to-lightGrey`,\n [Colors.current]: `to-current`,\n} as const satisfies Record<keyof typeof Colors, `to-${string}`>;\n\nexport type ToColor = keyof typeof TO_COLORS;\n\nconst COMPLEMENTARY_COLORS = {\n [Colors.lightSand]: Colors.black,\n [Colors.marygold]: Colors.black,\n [Colors.saffron]: Colors.black,\n [Colors.sand]: Colors.black,\n [Colors.verdigris]: Colors.black,\n [Colors.white]: Colors.black,\n [Colors.black]: Colors.white,\n [Colors.green]: Colors.white,\n [Colors.lavender]: Colors.white,\n [Colors.orange]: Colors.white,\n [Colors.red]: Colors.white,\n [Colors.sienna]: Colors.white,\n [Colors.ultramarine]: Colors.white,\n [Colors.wave]: Colors.white,\n [Colors.darkGrey]: Colors.white,\n [Colors.lightGrey]: Colors.black,\n [Colors.current]: Colors.white,\n} as const satisfies Record<keyof typeof Colors, Colors.white | Colors.black>;\n\nconst THEME_TO_COLOR: Record<string, Colors> = {\n dark: Colors.ultramarine,\n exclusiveCollection: Colors.ultramarine,\n coreRange: Colors.lightSand,\n light: Colors.lightSand,\n happyToCare: Colors.verdigris,\n joyview: Colors.wave,\n urbanOasis: Colors.marygold,\n yellow: Colors.saffron,\n};\n\nconst COMPLEMENTARY_TEXT_COLOR_CONFIG = {\n [Colors.lightSand]: 'text-black',\n [Colors.marygold]: 'text-black',\n [Colors.saffron]: 'text-black',\n [Colors.sand]: 'text-black',\n [Colors.verdigris]: 'text-black',\n [Colors.white]: 'text-black',\n [Colors.black]: 'text-white',\n [Colors.green]: 'text-white',\n [Colors.lavender]: 'text-white',\n [Colors.orange]: 'text-white',\n [Colors.red]: 'text-white',\n [Colors.sienna]: 'text-white',\n [Colors.ultramarine]: 'text-white',\n [Colors.wave]: 'text-white',\n [Colors.darkGrey]: 'text-white',\n [Colors.lightGrey]: 'text-black',\n [Colors.current]: 'text-current',\n} as const satisfies Record<keyof typeof Colors, `text-${string}`>;\n\nconst colorGuard = <T extends Record<string, string>, K extends keyof T>(\n color: string | K,\n obj: T,\n): color is K => {\n return color in obj;\n};\n\nexport const getBorderColor = (color: string): `border-${string}` => {\n if (colorGuard(color, BORDER_COLORS)) {\n return BORDER_COLORS[color];\n }\n\n return `border-${color}`;\n};\n\nexport const getBgColor = (color: string): `bg-${string}` => {\n if (colorGuard(color, BG_COLORS)) {\n return BG_COLORS[color];\n }\n\n return `bg-${color}`;\n};\n\nexport const getTextColor = (color: string): `text-${string}` => {\n if (colorGuard(color, TEXT_COLORS)) {\n return TEXT_COLORS[color];\n }\n\n return `text-${color}`;\n};\n\nexport const getGradientToColor = (color: string): `to-${string}` => {\n if (colorGuard(color, TO_COLORS)) {\n return TO_COLORS[color];\n }\n\n return `to-${color}`;\n};\n\nexport const getComplementaryTextColor = (color: string): `text-${string}` => {\n return COMPLEMENTARY_TEXT_COLOR_CONFIG[color as Colors] || 'text-white';\n};\n\nexport const getComplementaryColor = (color: string): Colors => {\n return COMPLEMENTARY_COLORS[color as Colors] || 'white';\n};\n\nexport const getThemeColor = (theme: Theme): Colors => {\n return THEME_TO_COLOR[theme] || theme;\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"colors.js","names":[],"sources":["../../../../lib/ui/helpers/colors/colors.ts"],"sourcesContent":["import type { Theme } from '../../types/Theme';\n\nexport enum Colors {\n black = 'black',\n darkGrey = 'darkGrey',\n green = 'green',\n lavender = 'lavender',\n lightGrey = 'lightGrey',\n lightSand = 'lightSand',\n marygold = 'marygold',\n orange = 'orange',\n pearl = 'pearl',\n red = 'red',\n saffron = 'saffron',\n sand = 'sand',\n sienna = 'sienna',\n ultramarine = 'ultramarine',\n verdigris = 'verdigris',\n wave = 'wave',\n white = 'white',\n current = 'current',\n}\n\nconst BORDER_COLORS = {\n [Colors.black]: 'border-black',\n [Colors.darkGrey]: 'border-darkGrey',\n [Colors.green]: 'border-green',\n [Colors.lavender]: 'border-lavender',\n [Colors.lightGrey]: 'border-lightGrey',\n [Colors.lightSand]: 'border-lightSand',\n [Colors.marygold]: 'border-marygold',\n [Colors.orange]: 'border-orange',\n [Colors.red]: 'border-red',\n [Colors.saffron]: 'border-saffron',\n [Colors.sand]: 'border-sand',\n [Colors.sienna]: 'border-sienna',\n [Colors.ultramarine]: 'border-ultramarine',\n [Colors.verdigris]: 'border-verdigris',\n [Colors.wave]: 'border-wave',\n [Colors.white]: 'border-white',\n [Colors.current]: 'border-current',\n} as const satisfies Record<string, `border-${string}`>;\n\nexport type BorderColor = keyof typeof BORDER_COLORS;\n\nconst BG_COLORS = {\n [Colors.black]: 'bg-black',\n [Colors.darkGrey]: 'bg-darkGrey',\n [Colors.green]: 'bg-green',\n [Colors.lavender]: 'bg-lavender',\n [Colors.lightGrey]: 'bg-lightGrey',\n [Colors.lightSand]: 'bg-lightSand',\n [Colors.marygold]: 'bg-marygold',\n [Colors.orange]: 'bg-orange',\n [Colors.pearl]: 'bg-pearl',\n [Colors.red]: 'bg-red',\n [Colors.saffron]: 'bg-saffron',\n [Colors.sand]: 'bg-sand',\n [Colors.sienna]: 'bg-sienna',\n [Colors.ultramarine]: 'bg-ultramarine',\n [Colors.verdigris]: 'bg-verdigris',\n [Colors.wave]: 'bg-wave',\n [Colors.white]: 'bg-white',\n [Colors.current]: 'bg-current',\n} as const satisfies Record<Colors, `bg-${string}`>;\n\nexport type BgColor = keyof typeof BG_COLORS;\n\nconst TEXT_COLORS = {\n [Colors.black]: 'text-black',\n [Colors.green]: 'text-green',\n [Colors.lavender]: 'text-lavender',\n [Colors.lightSand]: 'text-lightSand',\n [Colors.marygold]: 'text-marygold',\n [Colors.orange]: 'text-orange',\n [Colors.pearl]: 'text-pearl',\n [Colors.red]: 'text-red',\n [Colors.saffron]: 'text-saffron',\n [Colors.sand]: 'text-sand',\n [Colors.sienna]: 'text-sienna',\n [Colors.ultramarine]: 'text-ultramarine',\n [Colors.verdigris]: 'text-verdigris',\n [Colors.wave]: 'text-wave',\n [Colors.white]: 'text-white',\n [Colors.darkGrey]: 'text-darkGrey',\n [Colors.lightGrey]: 'text-lightGrey',\n [Colors.current]: 'text-current',\n} as const satisfies Record<Colors, `text-${string}`>;\n\nexport type TextColor = keyof typeof TEXT_COLORS;\n\nconst TO_COLORS = {\n [Colors.black]: `to-black`,\n [Colors.green]: `to-green`,\n [Colors.lavender]: `to-lavender`,\n [Colors.lightSand]: `to-lightSand`,\n [Colors.marygold]: `to-marygold`,\n [Colors.orange]: `to-orange`,\n [Colors.pearl]: `to-pearl`,\n [Colors.red]: `to-red`,\n [Colors.saffron]: `to-saffron`,\n [Colors.sand]: `to-sand`,\n [Colors.sienna]: `to-sienna`,\n [Colors.ultramarine]: `to-ultramarine`,\n [Colors.verdigris]: `to-verdigris`,\n [Colors.wave]: `to-wave`,\n [Colors.white]: `to-white`,\n [Colors.darkGrey]: `to-darkGrey`,\n [Colors.lightGrey]: `to-lightGrey`,\n [Colors.current]: `to-current`,\n} as const satisfies Record<keyof typeof Colors, `to-${string}`>;\n\nexport type ToColor = keyof typeof TO_COLORS;\n\nconst COMPLEMENTARY_COLORS = {\n [Colors.lightSand]: Colors.black,\n [Colors.marygold]: Colors.black,\n [Colors.saffron]: Colors.black,\n [Colors.sand]: Colors.black,\n [Colors.verdigris]: Colors.black,\n [Colors.white]: Colors.black,\n [Colors.pearl]: Colors.black,\n [Colors.black]: Colors.white,\n [Colors.green]: Colors.white,\n [Colors.lavender]: Colors.white,\n [Colors.orange]: Colors.white,\n [Colors.red]: Colors.white,\n [Colors.sienna]: Colors.white,\n [Colors.ultramarine]: Colors.white,\n [Colors.wave]: Colors.white,\n [Colors.darkGrey]: Colors.white,\n [Colors.lightGrey]: Colors.black,\n [Colors.current]: Colors.white,\n} as const satisfies Record<keyof typeof Colors, Colors.white | Colors.black>;\n\nconst THEME_TO_COLOR: Record<string, Colors> = {\n dark: Colors.ultramarine,\n exclusiveCollection: Colors.ultramarine,\n coreRange: Colors.lightSand,\n light: Colors.lightSand,\n happyToCare: Colors.verdigris,\n joyview: Colors.wave,\n urbanOasis: Colors.marygold,\n yellow: Colors.saffron,\n};\n\nconst COMPLEMENTARY_TEXT_COLOR_CONFIG = {\n [Colors.lightSand]: 'text-black',\n [Colors.marygold]: 'text-black',\n [Colors.saffron]: 'text-black',\n [Colors.sand]: 'text-black',\n [Colors.verdigris]: 'text-black',\n [Colors.white]: 'text-black',\n [Colors.black]: 'text-white',\n [Colors.green]: 'text-white',\n [Colors.lavender]: 'text-white',\n [Colors.orange]: 'text-white',\n [Colors.pearl]: 'text-white',\n [Colors.red]: 'text-white',\n [Colors.sienna]: 'text-white',\n [Colors.ultramarine]: 'text-white',\n [Colors.wave]: 'text-white',\n [Colors.darkGrey]: 'text-white',\n [Colors.lightGrey]: 'text-black',\n [Colors.current]: 'text-current',\n} as const satisfies Record<keyof typeof Colors, `text-${string}`>;\n\nconst colorGuard = <T extends Record<string, string>, K extends keyof T>(\n color: string | K,\n obj: T,\n): color is K => {\n return color in obj;\n};\n\nexport const getBorderColor = (color: string): `border-${string}` => {\n if (colorGuard(color, BORDER_COLORS)) {\n return BORDER_COLORS[color];\n }\n\n return `border-${color}`;\n};\n\nexport const getBgColor = (color: string): `bg-${string}` => {\n if (colorGuard(color, BG_COLORS)) {\n return BG_COLORS[color];\n }\n\n return `bg-${color}`;\n};\n\nexport const getTextColor = (color: string): `text-${string}` => {\n if (colorGuard(color, TEXT_COLORS)) {\n return TEXT_COLORS[color];\n }\n\n return `text-${color}`;\n};\n\nexport const getGradientToColor = (color: string): `to-${string}` => {\n if (colorGuard(color, TO_COLORS)) {\n return TO_COLORS[color];\n }\n\n return `to-${color}`;\n};\n\nexport const getComplementaryTextColor = (color: string): `text-${string}` => {\n return COMPLEMENTARY_TEXT_COLOR_CONFIG[color as Colors] || 'text-white';\n};\n\nexport const getComplementaryColor = (color: string): Colors => {\n return COMPLEMENTARY_COLORS[color as Colors] || 'white';\n};\n\nexport const getThemeColor = (theme: Theme): Colors => {\n return THEME_TO_COLOR[theme] || theme;\n};\n"],"mappings":"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"}
@@ -3,7 +3,7 @@ import { useEffect as e, useState as t } from "react";
3
3
  function n({ name: n, initialValue: r, onChange: i, defaultValue: a = "", formatter: o = (e) => e }) {
4
4
  let [s, c] = t(o(r || a));
5
5
  e(() => {
6
- r !== void 0 && c(o(r));
6
+ c(o(r ?? a));
7
7
  }, [r]);
8
8
  function l(e) {
9
9
  e = o(e), c(e), i && i(n, e);
@@ -1 +1 @@
1
- {"version":3,"file":"useValue.js","names":[],"sources":["../../../lib/ui/hooks/useValue.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface UseValueProps<Value = string, InitialValue = Value> {\n name: string;\n initialValue?: InitialValue;\n defaultValue?: Value | string;\n formatter?: (v: Value) => Value;\n onChange?: (name: string, value: Value) => void;\n}\n\nexport function useValue<Value = string, InitialValue = Value>({\n name,\n initialValue,\n onChange,\n defaultValue = '',\n formatter = (v: Value) => v as unknown as Value,\n}: UseValueProps<Value, InitialValue>) {\n const [value, setValue] = useState<Value>(formatter((initialValue || defaultValue) as Value));\n\n useEffect(() => {\n if (initialValue !== undefined) {\n setValue(formatter(initialValue as Value));\n }\n }, [initialValue]);\n\n function setNewValue(newValue: Value) {\n newValue = formatter(newValue);\n setValue(newValue);\n if (onChange) onChange(name, newValue);\n }\n\n function resetValue() {\n setValue(defaultValue as Value);\n }\n\n return {\n value,\n setValue: setNewValue,\n resetValue,\n };\n}\n"],"mappings":";;AAUA,SAAgB,EAA+C,EAC7D,SACA,iBACA,aACA,kBAAe,IACf,gBAAa,MAAa,KACW;CACrC,IAAM,CAAC,GAAO,KAAY,EAAgB,EAAW,KAAgB,EAAuB,CAAC;AAE7F,SAAgB;AACd,EAAI,MAAiB,KAAA,KACnB,EAAS,EAAU,EAAsB,CAAC;IAE3C,CAAC,EAAa,CAAC;CAElB,SAAS,EAAY,GAAiB;AAGpC,EAFA,IAAW,EAAU,EAAS,EAC9B,EAAS,EAAS,EACd,KAAU,EAAS,GAAM,EAAS;;CAGxC,SAAS,IAAa;AACpB,IAAS,EAAsB;;AAGjC,QAAO;EACL;EACA,UAAU;EACV;EACD"}
1
+ {"version":3,"file":"useValue.js","names":[],"sources":["../../../lib/ui/hooks/useValue.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport interface UseValueProps<Value = string, InitialValue = Value> {\n name: string;\n initialValue?: InitialValue;\n defaultValue?: Value | string;\n formatter?: (v: Value) => Value;\n onChange?: (name: string, value: Value) => void;\n}\n\nexport function useValue<Value = string, InitialValue = Value>({\n name,\n initialValue,\n onChange,\n defaultValue = '',\n formatter = (v: Value) => v as unknown as Value,\n}: UseValueProps<Value, InitialValue>) {\n const [value, setValue] = useState<Value>(formatter((initialValue || defaultValue) as Value));\n\n useEffect(() => {\n // Use ?? operator to fallback to defaultValue when initialValue is undefined/null\n // This ensures the component resets properly when controlled value becomes undefined\n setValue(formatter((initialValue ?? defaultValue) as Value));\n }, [initialValue]);\n\n function setNewValue(newValue: Value) {\n newValue = formatter(newValue);\n setValue(newValue);\n if (onChange) onChange(name, newValue);\n }\n\n function resetValue() {\n setValue(defaultValue as Value);\n }\n\n return {\n value,\n setValue: setNewValue,\n resetValue,\n };\n}\n"],"mappings":";;AAUA,SAAgB,EAA+C,EAC7D,SACA,iBACA,aACA,kBAAe,IACf,gBAAa,MAAa,KACW;CACrC,IAAM,CAAC,GAAO,KAAY,EAAgB,EAAW,KAAgB,EAAuB,CAAC;AAE7F,SAAgB;AAGd,IAAS,EAAW,KAAgB,EAAuB,CAAC;IAC3D,CAAC,EAAa,CAAC;CAElB,SAAS,EAAY,GAAiB;AAGpC,EAFA,IAAW,EAAU,EAAS,EAC9B,EAAS,EAAS,EACd,KAAU,EAAS,GAAM,EAAS;;CAGxC,SAAS,IAAa;AACpB,IAAS,EAAsB;;AAGjC,QAAO;EACL;EACA,UAAU;EACV;EACD"}
@@ -1,8 +0,0 @@
1
- import { Theme } from './types/Theme';
2
- export declare const getTheme: (theme: Theme) => {
3
- thStart: string;
4
- thEnd: string;
5
- } | {
6
- readonly thStart: "text-middleGrey";
7
- readonly thEnd: "text-black font-bold";
8
- };
@@ -1,16 +0,0 @@
1
- //#region lib/ui/Breadcrumb.themes.ts
2
- var e = {
3
- thStart: "bg-ultramarine",
4
- thEnd: "bg-ultramarine font-bold"
5
- }, t = {
6
- dark: e,
7
- wave: e,
8
- light: {
9
- thStart: "text-middleGrey",
10
- thEnd: "text-black font-bold"
11
- }
12
- }, n = (e) => t[e] || t.light;
13
- //#endregion
14
- export { n as getTheme };
15
-
16
- //# sourceMappingURL=Breadcrumb.themes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Breadcrumb.themes.js","names":[],"sources":["../../lib/ui/Breadcrumb.themes.ts"],"sourcesContent":["import type { Theme } from './types/Theme';\nconst dark = {\n thStart: 'bg-ultramarine',\n thEnd: 'bg-ultramarine font-bold',\n};\n\nconst THEME = {\n dark,\n wave: dark,\n light: {\n thStart: 'text-middleGrey',\n thEnd: 'text-black font-bold',\n },\n} as const satisfies Record<string, { thStart: string; thEnd: string }>;\n\nexport const getTheme = (theme: Theme) => {\n return THEME[theme as keyof typeof THEME] || THEME.light;\n};\n"],"mappings":";AACA,IAAM,IAAO;CACX,SAAS;CACT,OAAO;CACR,EAEK,IAAQ;CACZ;CACA,MAAM;CACN,OAAO;EACL,SAAS;EACT,OAAO;EACR;CACF,EAEY,KAAY,MAChB,EAAM,MAAgC,EAAM"}