@clubmed/trident-ui 1.3.0-beta.12 → 1.3.0-beta.13

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 (127) hide show
  1. package/.npm/_logs/2025-08-08T15_19_22_167Z-debug-0.log +19 -0
  2. package/.npm/_logs/2025-08-08T15_19_22_257Z-debug-0.log +14 -0
  3. package/CHANGELOG.md +7 -0
  4. package/README.md +8 -0
  5. package/assets/{style.css → trident-ui.css} +1 -1
  6. package/atoms/Clickable/Clickable.d.ts +2 -2
  7. package/atoms/Heading/Heading.d.ts +1 -1
  8. package/atoms/Heading/HeadingGroup.d.ts +2 -2
  9. package/atoms/Icons/Iconics.d.ts +1 -1
  10. package/atoms/Icons/IconsResolver.d.ts +1 -1
  11. package/atoms/Icons/contexts/IconsContext.d.ts +1 -1
  12. package/atoms/Icons/svg/SvgIcon.d.ts +1 -1
  13. package/atoms/Icons/svg-use/SvgUseIcon.d.ts +1 -1
  14. package/atoms/Image/Image.d.ts +1 -1
  15. package/atoms/Image/Image.js +12 -12
  16. package/atoms/Image/Image.js.map +1 -1
  17. package/atoms/Prose/Prose.d.ts +2 -2
  18. package/chunks/ResizeObserver.js +1 -1
  19. package/chunks/ResizeObserver.js.map +1 -1
  20. package/chunks/_commonjsHelpers.js +19 -14
  21. package/chunks/_commonjsHelpers.js.map +1 -1
  22. package/chunks/index.js +36 -33
  23. package/chunks/index.js.map +1 -1
  24. package/chunks/plugin.js +57 -46
  25. package/chunks/plugin.js.map +1 -1
  26. package/contexts/Devices/Device.d.ts +3 -3
  27. package/contexts/Devices/hooks/useQueries.d.ts +2 -2
  28. package/contexts/Devices/reducers/reducer.d.ts +2 -2
  29. package/contexts/TridentUIConfig.d.ts +1 -1
  30. package/contexts/TridentUIConfig.js +1265 -653
  31. package/contexts/TridentUIConfig.js.map +1 -1
  32. package/helpers/colors/colors.d.ts +1 -1
  33. package/hooks/useKeyboardControls.d.ts +1 -1
  34. package/hooks/useResizeObserver.d.ts +1 -1
  35. package/hooks/useSafeBoop.d.ts +2 -2
  36. package/molecules/Arrows/Arrows.d.ts +2 -2
  37. package/molecules/Avatar.d.ts +1 -1
  38. package/molecules/Avatar.js +24 -24
  39. package/molecules/Avatar.js.map +1 -1
  40. package/molecules/Backdrop.d.ts +1 -1
  41. package/molecules/Breadcrumb.d.ts +2 -3
  42. package/molecules/Breadcrumb.js +25 -36
  43. package/molecules/Breadcrumb.js.map +1 -1
  44. package/molecules/Breadcrumb.themes.d.ts +1 -1
  45. package/molecules/Buttons/ArrowButton.d.ts +1 -1
  46. package/molecules/Buttons/Button.d.ts +3 -3
  47. package/molecules/Buttons/ButtonAnchor.d.ts +2 -2
  48. package/molecules/Buttons/ButtonContent.d.ts +2 -2
  49. package/molecules/Buttons/FakeButton.d.ts +2 -3
  50. package/molecules/Buttons/InertButton.d.ts +2 -2
  51. package/molecules/Buttons/v2/Button.d.ts +2081 -2082
  52. package/molecules/Buttons/v2/Button.type.d.ts +2 -2
  53. package/molecules/Cards/Card.d.ts +4 -4
  54. package/molecules/Cards/CardBackground.d.ts +2 -2
  55. package/molecules/Cards/CardBackground.js +17 -17
  56. package/molecules/Cards/CardBackground.js.map +1 -1
  57. package/molecules/Cards/CardBackgroundContext.d.ts +1 -1
  58. package/molecules/Cards/CardClickable.d.ts +1 -1
  59. package/molecules/Cards/ExpandableCard.d.ts +3 -3
  60. package/molecules/Cards/ExpandableCard.js +41 -41
  61. package/molecules/Cards/ExpandableCard.js.map +1 -1
  62. package/molecules/Cards/v2/Card.d.ts +1 -1
  63. package/molecules/Cards/v2/Card.js +13 -13
  64. package/molecules/Cards/v2/Card.js.map +1 -1
  65. package/molecules/Chip.d.ts +3 -3
  66. package/molecules/Chip.themes.d.ts +1 -1
  67. package/molecules/ElasticHeight.d.ts +1 -1
  68. package/molecules/ElasticHeight.js +20 -21
  69. package/molecules/ElasticHeight.js.map +1 -1
  70. package/molecules/Forms/Checkboxes/Checkbox.d.ts +1 -1
  71. package/molecules/Forms/Checkboxes/Checkbox.js +43 -43
  72. package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
  73. package/molecules/Forms/Checkboxes/Checkboxes.d.ts +2 -2
  74. package/molecules/Forms/DateField.d.ts +2 -2
  75. package/molecules/Forms/DateField.js +60 -61
  76. package/molecules/Forms/DateField.js.map +1 -1
  77. package/molecules/Forms/Filter.d.ts +1 -2
  78. package/molecules/Forms/Filter.js +29 -29
  79. package/molecules/Forms/Filter.js.map +1 -1
  80. package/molecules/Forms/FormControl.d.ts +4 -4
  81. package/molecules/Forms/FormLabel.d.ts +1 -1
  82. package/molecules/Forms/NumberField.d.ts +278 -278
  83. package/molecules/Forms/Password/Password.d.ts +1 -1
  84. package/molecules/Forms/Password/ValidationMessage.d.ts +1 -1
  85. package/molecules/Forms/Radios/Radio.d.ts +1 -2
  86. package/molecules/Forms/Radios/Radio.js +30 -30
  87. package/molecules/Forms/Radios/Radio.js.map +1 -1
  88. package/molecules/Forms/Radios/RadioGroup.d.ts +2 -2
  89. package/molecules/Forms/Radios/RadioGroup.js +50 -52
  90. package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
  91. package/molecules/Forms/Range.d.ts +1 -2
  92. package/molecules/Forms/Range.js +118 -113
  93. package/molecules/Forms/Range.js.map +1 -1
  94. package/molecules/Forms/Select.d.ts +3 -3
  95. package/molecules/Forms/Switch.d.ts +1 -1
  96. package/molecules/Forms/TextField.d.ts +3 -3
  97. package/molecules/HamburgerIcon.d.ts +1 -1
  98. package/molecules/Link.d.ts +2 -2
  99. package/molecules/Loader.d.ts +1 -1
  100. package/molecules/Pagination.d.ts +2 -2
  101. package/molecules/Popin.d.ts +1 -1
  102. package/molecules/Spinner.d.ts +1 -1
  103. package/molecules/Tabs/Tab.d.ts +2 -3
  104. package/molecules/Tabs/Tab.js +41 -42
  105. package/molecules/Tabs/Tab.js.map +1 -1
  106. package/molecules/Tabs/TabList.d.ts +1 -1
  107. package/molecules/Tabs/TabList.js +21 -21
  108. package/molecules/Tabs/TabList.js.map +1 -1
  109. package/molecules/Tabs/TabPanel.d.ts +1 -1
  110. package/molecules/Tabs/TabPanel.js +13 -13
  111. package/molecules/Tabs/TabPanel.js.map +1 -1
  112. package/molecules/Tabs/Tabs.d.ts +1 -1
  113. package/molecules/Tabs/TabsBody.d.ts +1 -1
  114. package/molecules/Tabs/context/TabControl.d.ts +2 -2
  115. package/molecules/Tabs/hooks/tabControl.d.ts +5 -5
  116. package/molecules/Tag.d.ts +4 -4
  117. package/package.json +29 -32
  118. package/tailwind/plugins/animationDelay.d.ts +2 -2
  119. package/tailwind/plugins/hocus.d.ts +2 -2
  120. package/tailwind/plugins/lineClampFix.d.ts +2 -2
  121. package/tailwind/plugins/popover.d.ts +2 -2
  122. package/tailwind/plugins/startingStyle.d.ts +2 -2
  123. package/tailwind/plugins/transitionBehavior.d.ts +2 -2
  124. package/tailwind/tailwind.preset.d.ts +50 -50
  125. package/tests/helpers/device.d.ts +14 -0
  126. package/tests/helpers/device.js +13426 -0
  127. package/tests/helpers/device.js.map +1 -0
@@ -1,5 +1,5 @@
1
- import { type IconicNames, type IconicTypes } from '@clubmed/trident-icons';
2
- import { type FormControlProps } from './FormControl.js';
1
+ import { IconicNames, IconicTypes } from '@clubmed/trident-icons';
2
+ import { FormControlProps } from './FormControl.js';
3
3
  interface DateFieldProps extends Omit<FormControlProps<Date | null>, 'max' | 'min'> {
4
4
  description?: string;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { jsx as p, jsxs as T } from "react/jsx-runtime";
1
+ import { jsx as p, jsxs as C } from "react/jsx-runtime";
2
2
  import { c as q } from "../../chunks/index.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";
@@ -25,7 +25,7 @@ function z(t) {
25
25
  function G(t, e) {
26
26
  return P(2, arguments), z(t).getTime() - z(e).getTime();
27
27
  }
28
- function m(t, e) {
28
+ function f(t, e) {
29
29
  for (var n = t < 0 ? "-" : "", r = Math.abs(t).toString(); r.length < e; )
30
30
  r = "0" + r;
31
31
  return n + r;
@@ -36,98 +36,97 @@ function W(t, e) {
36
36
  var a = z(t);
37
37
  if (isNaN(a.getTime()))
38
38
  throw new RangeError("Invalid time value");
39
- var l = String((n = e == null ? void 0 : e.format) !== null && n !== void 0 ? n : "extended"), i = String((r = e == null ? void 0 : e.representation) !== null && r !== void 0 ? r : "complete");
40
- if (l !== "extended" && l !== "basic")
39
+ var c = String((n = e?.format) !== null && n !== void 0 ? n : "extended"), i = String((r = e?.representation) !== null && r !== void 0 ? r : "complete");
40
+ if (c !== "extended" && c !== "basic")
41
41
  throw new RangeError("format must be 'extended' or 'basic'");
42
42
  if (i !== "date" && i !== "time" && i !== "complete")
43
43
  throw new RangeError("representation must be 'date', 'time', or 'complete'");
44
- var f = "", g = "", y = l === "extended" ? "-" : "", j = l === "extended" ? ":" : "";
44
+ var d = "", g = "", D = c === "extended" ? "-" : "", I = c === "extended" ? ":" : "";
45
45
  if (i !== "time") {
46
- var o = m(a.getDate(), 2), w = m(a.getMonth() + 1, 2), C = m(a.getFullYear(), 4);
47
- f = "".concat(C).concat(y).concat(w).concat(y).concat(o);
46
+ var o = f(a.getDate(), 2), y = f(a.getMonth() + 1, 2), T = f(a.getFullYear(), 4);
47
+ d = "".concat(T).concat(D).concat(y).concat(D).concat(o);
48
48
  }
49
49
  if (i !== "date") {
50
50
  var b = a.getTimezoneOffset();
51
51
  if (b !== 0) {
52
- var x = Math.abs(b), u = m(Math.floor(x / 60), 2), d = m(x % 60, 2), v = b < 0 ? "+" : "-";
53
- g = "".concat(v).concat(u, ":").concat(d);
52
+ var w = Math.abs(b), l = f(Math.floor(w / 60), 2), u = f(w % 60, 2), j = b < 0 ? "+" : "-";
53
+ g = "".concat(j).concat(l, ":").concat(u);
54
54
  } else
55
55
  g = "Z";
56
- var F = m(a.getHours(), 2), S = m(a.getMinutes(), 2), M = m(a.getSeconds(), 2), N = f === "" ? "" : "T", s = [F, S, M].join(j);
57
- f = "".concat(f).concat(N).concat(s).concat(g);
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);
57
+ d = "".concat(d).concat(M).concat(s).concat(g);
58
58
  }
59
- return f;
59
+ return d;
60
60
  }
61
61
  const O = (t) => t ? W(new Date(t), { representation: "date" }) : "", X = (t, e, n) => {
62
62
  if (!t)
63
63
  return !0;
64
- const r = (i) => new Date(i.getFullYear(), i.getMonth(), i.getDate()), a = new Date(t), l = r(a);
65
- return !(e && l < r(e) || n && l > r(n));
64
+ const r = (i) => new Date(i.getFullYear(), i.getMonth(), i.getDate()), a = new Date(t), c = r(a);
65
+ return !(e && c < r(e) || n && c > r(n));
66
66
  }, se = (t) => {
67
67
  const e = A(), {
68
68
  id: n = e,
69
69
  name: r = n,
70
70
  label: a,
71
- description: l,
71
+ description: c,
72
72
  openDatepicker: i,
73
- validationStatus: f = "default",
73
+ validationStatus: d = "default",
74
74
  icon: g = "CalendarDefault",
75
- iconType: y,
76
- errorMessage: j,
75
+ iconType: D,
76
+ errorMessage: I,
77
77
  disabled: o = !1,
78
- required: w = !1,
79
- hideRequiredStar: C,
78
+ required: y = !1,
79
+ hideRequiredStar: T,
80
80
  dataTestId: b = "DateField",
81
- value: x,
82
- min: u,
83
- max: d,
84
- onChange: v,
81
+ value: w,
82
+ min: l,
83
+ max: u,
84
+ onChange: j,
85
85
  ...F
86
- } = t, S = B(null), [M, N] = H(!1), s = Q({
86
+ } = t, x = B(null), [S, M] = H(!1), s = Q({
87
87
  isDisabled: o,
88
- validationStatus: f
89
- }), { setValue: h, value: D } = K({
88
+ validationStatus: d
89
+ }), { setValue: v, value: h } = K({
90
90
  name: r,
91
91
  formatter: O,
92
- initialValue: x,
93
- onChange: (c, R) => v == null ? void 0 : v(c, new Date(R))
94
- }), k = O(u), I = O(d), Y = (c) => {
95
- h(c.target.value);
92
+ initialValue: w,
93
+ onChange: (m, R) => j?.(m, new Date(R))
94
+ }), N = O(l), k = O(u), Y = (m) => {
95
+ v(m.target.value);
96
96
  }, Z = () => {
97
- var c;
98
- (c = S.current) == null || c.showPicker();
97
+ x.current?.showPicker();
99
98
  }, _ = L(() => {
100
- const c = new Date(D);
101
- if (u && d) {
102
- const R = Math.abs(G(c, u)), $ = Math.abs(G(c, d));
103
- h(R <= $ ? k : I);
99
+ const m = new Date(h);
100
+ if (l && u) {
101
+ const R = Math.abs(G(m, l)), $ = Math.abs(G(m, u));
102
+ v(R <= $ ? N : k);
104
103
  return;
105
104
  }
106
- if (u) {
107
- h(k);
105
+ if (l) {
106
+ v(N);
108
107
  return;
109
108
  }
110
- if (d) {
111
- h(I);
109
+ if (u) {
110
+ v(k);
112
111
  return;
113
112
  }
114
- }, [d, u, I, k, h, D]);
113
+ }, [u, l, k, N, v, h]);
115
114
  return J(() => {
116
- !X(D, u, d) && !M && _();
117
- }, [_, d, u, M, D]), /* @__PURE__ */ p(
115
+ !X(h, l, u) && !S && _();
116
+ }, [_, u, l, S, h]), /* @__PURE__ */ p(
118
117
  U,
119
118
  {
120
119
  id: n,
121
120
  label: a,
122
- description: l,
121
+ description: c,
123
122
  dataName: "DateField",
124
123
  dataTestId: b,
125
124
  disabled: o,
126
- required: w,
127
- hideRequiredStar: C,
128
- validationStatus: f,
129
- errorMessage: j,
130
- children: /* @__PURE__ */ T("div", { className: "relative", children: [
125
+ required: y,
126
+ hideRequiredStar: T,
127
+ validationStatus: d,
128
+ errorMessage: I,
129
+ children: /* @__PURE__ */ C("div", { className: "relative", children: [
131
130
  /* @__PURE__ */ p(
132
131
  "input",
133
132
  {
@@ -146,17 +145,17 @@ const O = (t) => t ? W(new Date(t), { representation: "date" }) : "", X = (t, e,
146
145
  ),
147
146
  id: n,
148
147
  disabled: o,
149
- required: w,
150
- ref: S,
151
- value: D,
152
- min: k,
153
- max: I,
148
+ required: y,
149
+ ref: x,
150
+ value: h,
151
+ min: N,
152
+ max: k,
154
153
  onChange: Y,
155
- onFocus: () => N(!0),
156
- onBlur: () => N(!1)
154
+ onFocus: () => M(!0),
155
+ onBlur: () => M(!1)
157
156
  }
158
157
  ),
159
- /* @__PURE__ */ T(
158
+ /* @__PURE__ */ C(
160
159
  "div",
161
160
  {
162
161
  className: q(
@@ -168,11 +167,11 @@ const O = (t) => t ? W(new Date(t), { representation: "date" }) : "", X = (t, e,
168
167
  }
169
168
  ),
170
169
  children: [
171
- /* @__PURE__ */ T("button", { className: "pointer-events-auto leading-none", onClick: Z, children: [
172
- /* @__PURE__ */ p(E, { name: g, iconType: y, width: "24px" }),
170
+ /* @__PURE__ */ C("button", { className: "pointer-events-auto leading-none", onClick: Z, children: [
171
+ /* @__PURE__ */ p(E, { name: g, iconType: D, width: "24px" }),
173
172
  /* @__PURE__ */ p("span", { className: "sr-only", children: i })
174
173
  ] }),
175
- /* @__PURE__ */ T("span", { className: "ms-auto flex gap-x-8", children: [
174
+ /* @__PURE__ */ C("span", { className: "ms-auto flex gap-x-8", children: [
176
175
  s === "error" && /* @__PURE__ */ p(E, { name: "CrossDefault", width: "24px" }),
177
176
  s === "success" && /* @__PURE__ */ p(E, { name: "CheckDefault", width: "24px" })
178
177
  ] })
@@ -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","_a","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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AUmC;AAAA,YACV,SAAS,MAAMN,EAAa,EAAI;AAAA,YAChC,QAAQ,MAAMA,EAAa,EAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAElC,gBAAAkB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,cACA;AAAA,gBACE,aAAa9B;AAAA,gBACb,YAAY,CAACA,KAAYa,MAAmB;AAAA,gBAC5C,cAAc,CAACb,KAAYa,MAAmB;AAAA,cAAA;AAAA,YAChD;AAAA,YAGF,UAAA;AAAA,cAAA,gBAAAgB,EAAC,UAAA,EAAO,WAAU,oCAAmC,SAASV,GAC5D,UAAA;AAAA,gBAAA,gBAAAQ,EAACI,GAAA,EAAK,MAAMlC,GAAM,UAAAC,GAAoB,OAAM,QAAO;AAAA,gBACnD,gBAAA6B,EAAC,QAAA,EAAK,WAAU,WACb,UAAAhC,EAAA,CAEH;AAAA,cAAA,GACF;AAAA,cACA,gBAAAkC,EAAC,QAAA,EAAK,WAAU,wBACb,UAAA;AAAA,gBAAAhB,MAAmB,WAAW,gBAAAc,EAACI,GAAA,EAAK,MAAK,gBAAe,OAAM,QAAO;AAAA,gBACrElB,MAAmB,aAAa,gBAAAc,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 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,oNA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UAAA3D;AAAA,YACA,KAAAmE;AAAA,YACA,OAAA7B;AAAA,YACA,KAAAE;AAAA,YACA,KAAAC;AAAA,YACA,UAAUmC;AAAA,YACV,SAAS,MAAMN,EAAa,EAAI;AAAA,YAChC,QAAQ,MAAMA,EAAa,EAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAElC,gBAAAiB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,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,5 +1,4 @@
1
- import { type InputHTMLAttributes } from 'react';
2
- import './controls.css';
1
+ import { InputHTMLAttributes } from 'react';
3
2
  export interface FilterProps<Value = string> extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
4
3
  /**
5
4
  * The data-testid to apply to the button.
@@ -1,52 +1,52 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { c as r } from "../../chunks/index.js";
3
- import { useId as D } from "react";
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { c as i } from "../../chunks/index.js";
3
+ import { useId as v } from "react";
4
4
  /* empty css */
5
- import { Icon as c } from "@clubmed/trident-icons";
6
- import { useValue as N } from "../../hooks/useValue.js";
7
- function A(m) {
8
- const d = D(), {
9
- id: u = d,
10
- name: l = u,
11
- className: p,
5
+ import { Icon as r } from "@clubmed/trident-icons";
6
+ import { useValue as D } from "../../hooks/useValue.js";
7
+ function A(c) {
8
+ const m = v(), {
9
+ id: d = m,
10
+ name: t = d,
11
+ className: u,
12
12
  dataTestId: h,
13
- disabled: n,
14
- checked: f = !1,
13
+ disabled: l,
14
+ checked: p = !1,
15
15
  value: a,
16
- tabIndex: b = 0,
17
- onChange: t,
16
+ tabIndex: f = 0,
17
+ onChange: b,
18
18
  hasDropdown: x,
19
19
  children: k,
20
20
  ...w
21
- } = m, { value: o, setValue: I } = N({
22
- name: l,
23
- initialValue: f,
24
- onChange(v, s) {
25
- t == null || t(v, s ? a !== void 0 ? a : s : null);
21
+ } = c, { value: n, setValue: C } = D({
22
+ name: t,
23
+ initialValue: p,
24
+ onChange(I, o) {
25
+ b?.(I, o ? a !== void 0 ? a : o : null);
26
26
  }
27
27
  });
28
- return /* @__PURE__ */ i("label", { className: r(p, "relative"), children: [
28
+ return /* @__PURE__ */ s("label", { className: i(u, "relative"), children: [
29
29
  /* @__PURE__ */ e(
30
30
  "input",
31
31
  {
32
32
  ...w,
33
- name: l,
33
+ name: t,
34
34
  "data-testid": h,
35
35
  type: "checkbox",
36
- tabIndex: b,
36
+ tabIndex: f,
37
37
  onChange: () => {
38
- !n && I(!o);
38
+ !l && C(!n);
39
39
  },
40
- checked: o,
40
+ checked: n,
41
41
  "data-name": "Filter",
42
- disabled: n,
42
+ disabled: l,
43
43
  value: a
44
44
  }
45
45
  ),
46
- /* @__PURE__ */ i("span", { children: [
47
- /* @__PURE__ */ e("span", { className: r("text-b3 font-semibold"), children: k }),
48
- /* @__PURE__ */ e(c, { width: null, name: "CheckDefault", color: "black" }),
49
- x && /* @__PURE__ */ e(c, { name: "ArrowDefaultDown", className: "ml-8", width: "24px", color: "black" })
46
+ /* @__PURE__ */ s("span", { children: [
47
+ /* @__PURE__ */ e("span", { className: i("text-b3 font-semibold"), children: k }),
48
+ /* @__PURE__ */ e(r, { width: null, name: "CheckDefault", color: "black" }),
49
+ x && /* @__PURE__ */ e(r, { name: "ArrowDefaultDown", className: "ml-8", width: "24px", color: "black" })
50
50
  ] })
51
51
  ] });
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sources":["../../../lib/molecules/Forms/Filter.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type InputHTMLAttributes, useId } from 'react';\nimport './controls.css';\nimport { Icon } from '@clubmed/trident-icons';\nimport { useValue } from '@/hooks/useValue.js';\n\nexport interface FilterProps<Value = string>\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n /**\n * The data-testid to apply to the button.\n * This is used for testing purposes.\n * */\n dataTestId?: string;\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,\n checked: initialChecked = false,\n value,\n tabIndex = 0,\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 return (\n <label className={classnames(className, 'relative')}>\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Filter\"\n disabled={disabled}\n value={value}\n />\n <span>\n <span className={classnames('text-b3 font-semibold')}>{children}</span>\n <Icon width={null} name=\"CheckDefault\" color=\"black\" />\n {hasDropdown && (\n <Icon name=\"ArrowDefaultDown\" className=\"ml-8\" width=\"24px\" color=\"black\" />\n )}\n </span>\n </label>\n );\n}\n"],"names":["Filter","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","tabIndex","onChange","hasDropdown","children","rest","checked","setValue","useValue","classnames","jsx","Icon"],"mappings":";;;;;;AAqBO,SAASA,EAAuBC,GAA2B;AAChE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDd,GAEE,EAAE,OAAOe,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAb;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMW,GAAS;AACtB,MAAAJ,KAAA,QAAAA,EAAWP,GAAMW,IAAYN,MAAU,SAAYA,IAAQM,IAAqB;AAAA,IAClF;AAAA,EAAA,CACD;AAED,2BACG,SAAA,EAAM,WAAWG,EAAWb,GAAW,UAAU,GAChD,UAAA;AAAA,IAAA,gBAAAc;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGL;AAAA,QACJ,MAAAV;AAAA,QACA,eAAaE;AAAA,QACb,MAAK;AAAA,QACL,UAAAI;AAAA,QACA,UAAU,MAAM;AACd,WAACH,KAAYS,EAAS,CAACD,CAAO;AAAA,QAChC;AAAA,QACA,SAAAA;AAAA,QACA,aAAU;AAAA,QACV,UAAAR;AAAA,QACA,OAAAE;AAAA,MAAA;AAAA,IAAA;AAAA,sBAED,QAAA,EACC,UAAA;AAAA,MAAA,gBAAAU,EAAC,QAAA,EAAK,WAAWD,EAAW,uBAAuB,GAAI,UAAAL,GAAS;AAAA,wBAC/DO,GAAA,EAAK,OAAO,MAAM,MAAK,gBAAe,OAAM,SAAQ;AAAA,MACpDR,KACC,gBAAAO,EAACC,GAAA,EAAK,MAAK,oBAAmB,WAAU,QAAO,OAAM,QAAO,OAAM,QAAA,CAAQ;AAAA,IAAA,EAAA,CAE9E;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Filter.js","sources":["../../../lib/molecules/Forms/Filter.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type InputHTMLAttributes, useId } from 'react';\nimport './controls.css';\nimport { Icon } from '@clubmed/trident-icons';\nimport { useValue } from '@/hooks/useValue.js';\n\nexport interface FilterProps<Value = string>\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {\n /**\n * The data-testid to apply to the button.\n * This is used for testing purposes.\n * */\n dataTestId?: string;\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,\n checked: initialChecked = false,\n value,\n tabIndex = 0,\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 return (\n <label className={classnames(className, 'relative')}>\n <input\n {...rest}\n name={name}\n data-testid={dataTestId}\n type=\"checkbox\"\n tabIndex={tabIndex}\n onChange={() => {\n !disabled && setValue(!checked);\n }}\n checked={checked}\n data-name=\"Filter\"\n disabled={disabled}\n value={value}\n />\n <span>\n <span className={classnames('text-b3 font-semibold')}>{children}</span>\n <Icon width={null} name=\"CheckDefault\" color=\"black\" />\n {hasDropdown && (\n <Icon name=\"ArrowDefaultDown\" className=\"ml-8\" width=\"24px\" color=\"black\" />\n )}\n </span>\n </label>\n );\n}\n"],"names":["Filter","props","internalId","useId","id","name","className","dataTestId","disabled","initialChecked","value","tabIndex","onChange","hasDropdown","children","rest","checked","setValue","useValue","classnames","jsx","Icon"],"mappings":";;;;;;AAqBO,SAASA,EAAuBC,GAA2B;AAChE,QAAMC,IAAaC,EAAA,GAEb;AAAA,IACJ,IAAAC,IAAKF;AAAA,IACL,MAAAG,IAAOD;AAAA,IACP,WAAAE;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAASC,IAAiB;AAAA,IAC1B,OAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDd,GAEE,EAAE,OAAOe,GAAS,UAAAC,EAAA,IAAaC,EAAkB;AAAA,IACrD,MAAAb;AAAA,IACA,cAAcI;AAAA,IACd,SAASJ,GAAMW,GAAS;AACtB,MAAAJ,IAAWP,GAAMW,IAAYN,MAAU,SAAYA,IAAQM,IAAqB,IAAI;AAAA,IACtF;AAAA,EAAA,CACD;AAED,2BACG,SAAA,EAAM,WAAWG,EAAWb,GAAW,UAAU,GAChD,UAAA;AAAA,IAAA,gBAAAc;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGL;AAAA,QACJ,MAAAV;AAAA,QACA,eAAaE;AAAA,QACb,MAAK;AAAA,QACL,UAAAI;AAAA,QACA,UAAU,MAAM;AACd,WAACH,KAAYS,EAAS,CAACD,CAAO;AAAA,QAChC;AAAA,QACA,SAAAA;AAAA,QACA,aAAU;AAAA,QACV,UAAAR;AAAA,QACA,OAAAE;AAAA,MAAA;AAAA,IAAA;AAAA,sBAED,QAAA,EACC,UAAA;AAAA,MAAA,gBAAAU,EAAC,QAAA,EAAK,WAAWD,EAAW,uBAAuB,GAAI,UAAAL,GAAS;AAAA,wBAC/DO,GAAA,EAAK,OAAO,MAAM,MAAK,gBAAe,OAAM,SAAQ;AAAA,MACpDR,KACC,gBAAAO,EAACC,GAAA,EAAK,MAAK,oBAAmB,WAAU,QAAO,OAAM,QAAO,OAAM,QAAA,CAAQ;AAAA,IAAA,EAAA,CAE9E;AAAA,EAAA,GACF;AAEJ;"}
@@ -1,6 +1,6 @@
1
- import type { HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
- import { type ValidationStatus } from '../../hooks/useInternalStatus';
3
- import { type FormLabelProps } from './FormLabel';
1
+ import { HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
+ import { ValidationStatus } from '../../hooks/useInternalStatus';
3
+ import { FormLabelProps } from './FormLabel';
4
4
  export type FormControlProps<Value = unknown, Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>> = {
5
5
  value?: Value;
6
6
  label?: ReactNode;
@@ -10,4 +10,4 @@ export type FormControlProps<Value = unknown, Attributes extends HTMLAttributes<
10
10
  dataName?: string;
11
11
  errorMessage?: string;
12
12
  } & Omit<Attributes & Partial<FormLabelProps>, 'onChange' | 'value'>;
13
- export declare const FormControl: <Value = string>({ id, label, description, disabled, required, className, validationStatus, children, errorMessage, dataTestId, dataName, hideRequiredStar, layout, }: FormControlProps<Value, InputHTMLAttributes<HTMLInputElement>>) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const FormControl: <Value = string>({ id, label, description, disabled, required, className, validationStatus, children, errorMessage, dataTestId, dataName, hideRequiredStar, layout, }: FormControlProps<Value>) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LabelHTMLAttributes } from 'react';
1
+ import { LabelHTMLAttributes } from 'react';
2
2
  export interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
3
3
  description?: string;
4
4
  layout?: 'horizontal' | 'vertical';