@clubmed/trident-ui 1.1.0-beta.1 → 1.1.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/BeachView-D7jbrjhw.js +6 -0
- package/BeachView-D7jbrjhw.js.map +1 -0
- package/CHANGELOG.md +8 -0
- package/GardenView-C4ezQxpq.js +6 -0
- package/GardenView-C4ezQxpq.js.map +1 -0
- package/PoolView-P2ZBXZA9.js +6 -0
- package/PoolView-P2ZBXZA9.js.map +1 -0
- package/README.md +4 -22
- package/SnowSerenity-DQAGaSZc.js +6 -0
- package/SnowSerenity-DQAGaSZc.js.map +1 -0
- package/SunView-D_XYC3V5.js +6 -0
- package/SunView-D_XYC3V5.js.map +1 -0
- package/Twitter-B4o_qFxz.js +6 -0
- package/Twitter-B4o_qFxz.js.map +1 -0
- package/WithView-CM90ePcH.js +6 -0
- package/WithView-CM90ePcH.js.map +1 -0
- package/assets/icons/Services/SnowSerenity.svg +8 -0
- package/assets/icons/Socials/Twitter.svg +3 -4
- package/assets/icons/Utilities/BeachView.svg +3 -0
- package/assets/icons/Utilities/GardenView.svg +3 -0
- package/assets/icons/Utilities/PoolView.svg +3 -0
- package/assets/icons/Utilities/SunView.svg +3 -0
- package/assets/icons/Utilities/WithView.svg +3 -0
- package/assets/style.css +1 -1
- package/atoms/Icons/Iconics.d.ts +2 -2
- package/atoms/Icons/svg/Services.js +4 -0
- package/atoms/Icons/svg/Services.js.map +1 -1
- package/atoms/Icons/svg/Socials.js +1 -1
- package/atoms/Icons/svg/Utilities.js +20 -0
- package/atoms/Icons/svg/Utilities.js.map +1 -1
- package/atoms/Icons/svg-use/Services.js +33 -28
- package/atoms/Icons/svg-use/Services.js.map +1 -1
- package/atoms/Icons/svg-use/Utilities.js +100 -75
- package/atoms/Icons/svg-use/Utilities.js.map +1 -1
- package/hooks/useSafeBoop.js +1 -1
- package/hooks/useValue.d.ts +1 -1
- package/hooks/useValue.js +18 -20
- package/hooks/useValue.js.map +1 -1
- package/molecules/Backdrop.js +1 -1
- package/molecules/Buttons/Button.js +1 -1
- package/molecules/Buttons/ButtonAnchor.js +1 -1
- package/molecules/ElasticHeight.js +1 -1
- package/molecules/Forms/Checkboxes/Checkbox.js +1 -1
- package/molecules/Forms/DateField.js +9 -9
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js +1 -1
- package/molecules/Forms/FormControl.js +28 -28
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +7 -7
- package/molecules/Forms/Radios/Radio.js +1 -1
- package/molecules/Forms/Range.js +2 -4
- package/molecules/Forms/Range.js.map +1 -1
- package/molecules/Forms/Switch.js +1 -1
- package/molecules/Forms/TextField.d.ts +2 -0
- package/molecules/Forms/TextField.js +25 -24
- package/molecules/Forms/TextField.js.map +1 -1
- package/molecules/HamburgerIcon.js +1 -1
- package/molecules/Loader.js +1 -1
- package/molecules/Popin.js +1 -1
- package/molecules/Tabs/TabsHeader.js +1 -1
- package/molecules/Tabs/TabsHeading.js +1 -1
- package/molecules/Tabs/TabsPanel.js +1 -1
- package/package.json +16 -21
- package/{react-spring_web.modern-BPtZcx1z.js → react-spring_web.modern-DyRwH83_.js} +1275 -1781
- package/{react-spring_web.modern-BPtZcx1z.js.map → react-spring_web.modern-DyRwH83_.js.map} +1 -1
- package/Twitter-DtXFJEB1.js +0 -6
- package/Twitter-DtXFJEB1.js.map +0 -1
- package/atoms/Icons/fonts/Actions.d.ts +0 -2
- package/atoms/Icons/fonts/Actions.js +0 -113
- package/atoms/Icons/fonts/Actions.js.map +0 -1
- package/atoms/Icons/fonts/Activities.d.ts +0 -2
- package/atoms/Icons/fonts/Activities.js +0 -145
- package/atoms/Icons/fonts/Activities.js.map +0 -1
- package/atoms/Icons/fonts/Brand.d.ts +0 -2
- package/atoms/Icons/fonts/Brand.js +0 -92
- package/atoms/Icons/fonts/Brand.js.map +0 -1
- package/atoms/Icons/fonts/Covid.d.ts +0 -2
- package/atoms/Icons/fonts/Covid.js +0 -61
- package/atoms/Icons/fonts/Covid.js.map +0 -1
- package/atoms/Icons/fonts/FontIcon.d.ts +0 -5
- package/atoms/Icons/fonts/FontIcon.js +0 -24
- package/atoms/Icons/fonts/FontIcon.js.map +0 -1
- package/atoms/Icons/fonts/FontIconResolver.d.ts +0 -3
- package/atoms/Icons/fonts/FontIconResolver.js +0 -14
- package/atoms/Icons/fonts/FontIconResolver.js.map +0 -1
- package/atoms/Icons/fonts/Food.d.ts +0 -2
- package/atoms/Icons/fonts/Food.js +0 -106
- package/atoms/Icons/fonts/Food.js.map +0 -1
- package/atoms/Icons/fonts/HappyToCare.d.ts +0 -2
- package/atoms/Icons/fonts/HappyToCare.js +0 -58
- package/atoms/Icons/fonts/HappyToCare.js.map +0 -1
- package/atoms/Icons/fonts/Places.d.ts +0 -2
- package/atoms/Icons/fonts/Places.js +0 -61
- package/atoms/Icons/fonts/Places.js.map +0 -1
- package/atoms/Icons/fonts/Room.d.ts +0 -2
- package/atoms/Icons/fonts/Room.js +0 -115
- package/atoms/Icons/fonts/Room.js.map +0 -1
- package/atoms/Icons/fonts/Services.d.ts +0 -2
- package/atoms/Icons/fonts/Services.js +0 -73
- package/atoms/Icons/fonts/Services.js.map +0 -1
- package/atoms/Icons/fonts/Socials.d.ts +0 -2
- package/atoms/Icons/fonts/Socials.js +0 -73
- package/atoms/Icons/fonts/Socials.js.map +0 -1
- package/atoms/Icons/fonts/Transports.d.ts +0 -2
- package/atoms/Icons/fonts/Transports.js +0 -49
- package/atoms/Icons/fonts/Transports.js.map +0 -1
- package/atoms/Icons/fonts/Utilities.d.ts +0 -2
- package/atoms/Icons/fonts/Utilities.js +0 -154
- package/atoms/Icons/fonts/Utilities.js.map +0 -1
- package/atoms/Icons/fonts/index.d.ts +0 -2
- package/atoms/Icons/fonts/index.js +0 -7
- package/atoms/Icons/fonts/index.js.map +0 -1
- package/button-l0sNRNKZ.js +0 -2
- package/button-l0sNRNKZ.js.map +0 -1
- package/controls-l0sNRNKZ.js +0 -2
- package/controls-l0sNRNKZ.js.map +0 -1
- package/fonts/Actions/tui-actions.css +0 -52
- package/fonts/Actions/tui-actions.eot +0 -0
- package/fonts/Actions/tui-actions.less +0 -49
- package/fonts/Actions/tui-actions.module.less +0 -52
- package/fonts/Actions/tui-actions.scss +0 -84
- package/fonts/Actions/tui-actions.styl +0 -49
- package/fonts/Actions/tui-actions.svg +0 -111
- package/fonts/Actions/tui-actions.symbol.svg +0 -67
- package/fonts/Actions/tui-actions.ttf +0 -0
- package/fonts/Actions/tui-actions.woff +0 -0
- package/fonts/Actions/tui-actions.woff2 +0 -0
- package/fonts/Activities/tui-activities.css +0 -64
- package/fonts/Activities/tui-activities.eot +0 -0
- package/fonts/Activities/tui-activities.less +0 -61
- package/fonts/Activities/tui-activities.module.less +0 -64
- package/fonts/Activities/tui-activities.scss +0 -108
- package/fonts/Activities/tui-activities.styl +0 -61
- package/fonts/Activities/tui-activities.svg +0 -147
- package/fonts/Activities/tui-activities.symbol.svg +0 -91
- package/fonts/Activities/tui-activities.ttf +0 -0
- package/fonts/Activities/tui-activities.woff +0 -0
- package/fonts/Activities/tui-activities.woff2 +0 -0
- package/fonts/Brand/tui-brand.css +0 -36
- package/fonts/Brand/tui-brand.eot +0 -0
- package/fonts/Brand/tui-brand.less +0 -33
- package/fonts/Brand/tui-brand.module.less +0 -36
- package/fonts/Brand/tui-brand.scss +0 -52
- package/fonts/Brand/tui-brand.styl +0 -33
- package/fonts/Brand/tui-brand.svg +0 -63
- package/fonts/Brand/tui-brand.symbol.svg +0 -59
- package/fonts/Brand/tui-brand.ttf +0 -0
- package/fonts/Brand/tui-brand.woff +0 -0
- package/fonts/Brand/tui-brand.woff2 +0 -0
- package/fonts/Covid/tui-covid.css +0 -36
- package/fonts/Covid/tui-covid.eot +0 -0
- package/fonts/Covid/tui-covid.less +0 -33
- package/fonts/Covid/tui-covid.module.less +0 -36
- package/fonts/Covid/tui-covid.scss +0 -52
- package/fonts/Covid/tui-covid.styl +0 -33
- package/fonts/Covid/tui-covid.svg +0 -63
- package/fonts/Covid/tui-covid.symbol.svg +0 -36
- package/fonts/Covid/tui-covid.ttf +0 -0
- package/fonts/Covid/tui-covid.woff +0 -0
- package/fonts/Covid/tui-covid.woff2 +0 -0
- package/fonts/Food/tui-food.css +0 -51
- package/fonts/Food/tui-food.eot +0 -0
- package/fonts/Food/tui-food.less +0 -48
- package/fonts/Food/tui-food.module.less +0 -51
- package/fonts/Food/tui-food.scss +0 -82
- package/fonts/Food/tui-food.styl +0 -48
- package/fonts/Food/tui-food.svg +0 -108
- package/fonts/Food/tui-food.symbol.svg +0 -65
- package/fonts/Food/tui-food.ttf +0 -0
- package/fonts/Food/tui-food.woff +0 -0
- package/fonts/Food/tui-food.woff2 +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.css +0 -35
- package/fonts/HappyToCare/tui-happy-to-care.eot +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.less +0 -32
- package/fonts/HappyToCare/tui-happy-to-care.module.less +0 -35
- package/fonts/HappyToCare/tui-happy-to-care.scss +0 -50
- package/fonts/HappyToCare/tui-happy-to-care.styl +0 -32
- package/fonts/HappyToCare/tui-happy-to-care.svg +0 -60
- package/fonts/HappyToCare/tui-happy-to-care.symbol.svg +0 -34
- package/fonts/HappyToCare/tui-happy-to-care.ttf +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.woff +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.woff2 +0 -0
- package/fonts/Places/tui-places.css +0 -36
- package/fonts/Places/tui-places.eot +0 -0
- package/fonts/Places/tui-places.less +0 -33
- package/fonts/Places/tui-places.module.less +0 -36
- package/fonts/Places/tui-places.scss +0 -52
- package/fonts/Places/tui-places.styl +0 -33
- package/fonts/Places/tui-places.svg +0 -63
- package/fonts/Places/tui-places.symbol.svg +0 -35
- package/fonts/Places/tui-places.ttf +0 -0
- package/fonts/Places/tui-places.woff +0 -0
- package/fonts/Places/tui-places.woff2 +0 -0
- package/fonts/Room/tui-room.css +0 -54
- package/fonts/Room/tui-room.eot +0 -0
- package/fonts/Room/tui-room.less +0 -51
- package/fonts/Room/tui-room.module.less +0 -54
- package/fonts/Room/tui-room.scss +0 -88
- package/fonts/Room/tui-room.styl +0 -51
- package/fonts/Room/tui-room.svg +0 -117
- package/fonts/Room/tui-room.symbol.svg +0 -156
- package/fonts/Room/tui-room.ttf +0 -0
- package/fonts/Room/tui-room.woff +0 -0
- package/fonts/Room/tui-room.woff2 +0 -0
- package/fonts/Services/tui-services.css +0 -40
- package/fonts/Services/tui-services.eot +0 -0
- package/fonts/Services/tui-services.less +0 -37
- package/fonts/Services/tui-services.module.less +0 -40
- package/fonts/Services/tui-services.scss +0 -60
- package/fonts/Services/tui-services.styl +0 -37
- package/fonts/Services/tui-services.svg +0 -75
- package/fonts/Services/tui-services.symbol.svg +0 -106
- package/fonts/Services/tui-services.ttf +0 -0
- package/fonts/Services/tui-services.woff +0 -0
- package/fonts/Services/tui-services.woff2 +0 -0
- package/fonts/Socials/tui-socials.css +0 -36
- package/fonts/Socials/tui-socials.eot +0 -0
- package/fonts/Socials/tui-socials.less +0 -33
- package/fonts/Socials/tui-socials.module.less +0 -36
- package/fonts/Socials/tui-socials.scss +0 -52
- package/fonts/Socials/tui-socials.styl +0 -33
- package/fonts/Socials/tui-socials.svg +0 -63
- package/fonts/Socials/tui-socials.symbol.svg +0 -78
- package/fonts/Socials/tui-socials.ttf +0 -0
- package/fonts/Socials/tui-socials.woff +0 -0
- package/fonts/Socials/tui-socials.woff2 +0 -0
- package/fonts/Transports/tui-transports.css +0 -32
- package/fonts/Transports/tui-transports.eot +0 -0
- package/fonts/Transports/tui-transports.less +0 -29
- package/fonts/Transports/tui-transports.module.less +0 -32
- package/fonts/Transports/tui-transports.scss +0 -44
- package/fonts/Transports/tui-transports.styl +0 -29
- package/fonts/Transports/tui-transports.svg +0 -51
- package/fonts/Transports/tui-transports.symbol.svg +0 -53
- package/fonts/Transports/tui-transports.ttf +0 -0
- package/fonts/Transports/tui-transports.woff +0 -0
- package/fonts/Transports/tui-transports.woff2 +0 -0
- package/fonts/Utilities/tui-utilities.css +0 -67
- package/fonts/Utilities/tui-utilities.eot +0 -0
- package/fonts/Utilities/tui-utilities.less +0 -64
- package/fonts/Utilities/tui-utilities.module.less +0 -67
- package/fonts/Utilities/tui-utilities.scss +0 -114
- package/fonts/Utilities/tui-utilities.styl +0 -64
- package/fonts/Utilities/tui-utilities.svg +0 -156
- package/fonts/Utilities/tui-utilities.symbol.svg +0 -287
- package/fonts/Utilities/tui-utilities.ttf +0 -0
- package/fonts/Utilities/tui-utilities.woff +0 -0
- package/fonts/Utilities/tui-utilities.woff2 +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
2
2
|
import { c as C } from "../../index-Cu0xwYjD.js";
|
3
|
-
|
3
|
+
/* empty css */
|
4
4
|
import { variants as N, rootClassName as b } from "./Button.helpers.js";
|
5
5
|
import { themes as d } from "./Button.themes.js";
|
6
6
|
import { ButtonContent as j } from "./ButtonContent.js";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
2
2
|
import { c as C } from "../../index-Cu0xwYjD.js";
|
3
|
-
|
3
|
+
/* empty css */
|
4
4
|
import { variants as y, rootClassName as B } from "./Button.helpers.js";
|
5
5
|
import { themes as w } from "./Button.themes.js";
|
6
6
|
import { ButtonContent as A } from "./ButtonContent.js";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
2
|
-
import { u as l, a as h, b as p } from "../react-spring_web.modern-
|
2
|
+
import { u as l, a as h, b as p } from "../react-spring_web.modern-DyRwH83_.js";
|
3
3
|
import { c as u } from "../index-Cu0xwYjD.js";
|
4
4
|
import { useRef as d, useEffect as g } from "react";
|
5
5
|
const r = (t) => t, R = ({
|
@@ -4,7 +4,7 @@ import { useId as D } from "react";
|
|
4
4
|
import { Icon as h } from "../../../atoms/Icons/Icon.js";
|
5
5
|
import "../../../atoms/Icons/contexts/IconsContext.js";
|
6
6
|
import { useValue as S } from "../../../hooks/useValue.js";
|
7
|
-
|
7
|
+
/* empty css */
|
8
8
|
import { useInternalStatus as V } from "../../../hooks/useInternalStatus.js";
|
9
9
|
function B(u) {
|
10
10
|
const x = D(), {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as m, jsxs as x } from "react/jsx-runtime";
|
2
2
|
import { c as E } from "../../index-Cu0xwYjD.js";
|
3
|
-
import { useId as
|
3
|
+
import { useId as _, useRef as z } from "react";
|
4
4
|
import { Icon as I } from "../../atoms/Icons/Icon.js";
|
5
5
|
import "../../atoms/Icons/contexts/IconsContext.js";
|
6
6
|
import { useValue as G } from "../../hooks/useValue.js";
|
@@ -16,7 +16,7 @@ function T(t) {
|
|
16
16
|
}
|
17
17
|
function F(t, e) {
|
18
18
|
if (e.length < t)
|
19
|
-
throw new TypeError(t + " argument
|
19
|
+
throw new TypeError(t + " argument required, but only " + e.length + " present");
|
20
20
|
}
|
21
21
|
function A(t) {
|
22
22
|
F(1, arguments);
|
@@ -56,8 +56,8 @@ function H(t, e) {
|
|
56
56
|
}
|
57
57
|
return s;
|
58
58
|
}
|
59
|
-
const M = (t) => t ? H(t, { representation: "date" }) : "", X = (t) => {
|
60
|
-
const e =
|
59
|
+
const M = (t) => t ? H(new Date(t), { representation: "date" }) : "", X = (t) => {
|
60
|
+
const e = _(), {
|
61
61
|
id: i = e,
|
62
62
|
name: n = i,
|
63
63
|
label: o,
|
@@ -83,10 +83,10 @@ const M = (t) => t ? H(t, { representation: "date" }) : "", X = (t) => {
|
|
83
83
|
name: n,
|
84
84
|
formatter: M,
|
85
85
|
initialValue: h,
|
86
|
-
onChange: (u,
|
87
|
-
}), R = M(S), O = M(N),
|
86
|
+
onChange: (u, V) => b == null ? void 0 : b(u, new Date(V))
|
87
|
+
}), R = M(S), O = M(N), q = (u) => {
|
88
88
|
j(u.target.value);
|
89
|
-
},
|
89
|
+
}, P = () => {
|
90
90
|
var u;
|
91
91
|
(u = y.current) == null || u.showPicker();
|
92
92
|
};
|
@@ -127,7 +127,7 @@ const M = (t) => t ? H(t, { representation: "date" }) : "", X = (t) => {
|
|
127
127
|
value: C,
|
128
128
|
min: R,
|
129
129
|
max: O,
|
130
|
-
onChange:
|
130
|
+
onChange: q
|
131
131
|
}
|
132
132
|
),
|
133
133
|
/* @__PURE__ */ x(
|
@@ -142,7 +142,7 @@ const M = (t) => t ? H(t, { representation: "date" }) : "", X = (t) => {
|
|
142
142
|
}
|
143
143
|
),
|
144
144
|
children: [
|
145
|
-
/* @__PURE__ */ x("button", { className: "pointer-events-auto leading-none", onClick:
|
145
|
+
/* @__PURE__ */ x("button", { className: "pointer-events-auto leading-none", onClick: P, children: [
|
146
146
|
/* @__PURE__ */ m(I, { name: f, iconType: g, width: "24px" }),
|
147
147
|
/* @__PURE__ */ m("span", { className: "sr-only", children: c })
|
148
148
|
] }),
|
@@ -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/_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}","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 { formatISO } from 'date-fns';\nimport { ChangeEvent, useId, useRef } from 'react';\nimport { Icon, IconicNames, IconicTypes } from '@/atoms/Icons';\n\nimport { useValue } from '@/hooks/useValue.js';\nimport { useInternalStatus } from '@/hooks/useInternalStatus.js';\nimport { FormControl, 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(value, { representation: 'date' });\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 internalStatus = useInternalStatus({\n isDisabled: disabled,\n validationStatus,\n });\n\n const { setValue, value } = useValue<string, Date | number | undefined | null>({\n name,\n formatter: formatDate,\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 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 />\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","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","DateField","props","internalId","useId","id","name","label","description","openDatepicker","validationStatus","icon","iconType","errorMessage","disabled","hideRequiredStar","dataTestId","initialValue","initialMin","initialMax","onChange","rest","ref","useRef","internalStatus","useInternalStatus","setValue","useValue","min","max","handleChange","event","handleClickPicker","_a","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,EACf,IAAG,SAAUA,GAAG;AACf,WAAOA,KAAmB,OAAO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AA,QAAA,EAAK,WAAU,WACb,UAEHzB,GAAA;AAAA,cAAA,GACF;AAAA,cACA,gBAAA2B,EAAC,QAAK,EAAA,WAAU,wBACb,UAAA;AAAA,gBAAAZ,MAAmB,WAAY,gBAAAU,EAAAI,GAAA,EAAK,MAAK,gBAAe,OAAM,QAAO;AAAA,gBACrEd,MAAmB,aAAa,gBAAAU,EAACI,KAAK,MAAK,gBAAe,OAAM,QAAO;AAAA,cAAA,GAC1E;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA,GACF;AAAA,IAAA;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4]}
|
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/_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}","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 { formatISO } from 'date-fns';\nimport { ChangeEvent, useId, useRef } from 'react';\nimport { Icon, IconicNames, IconicTypes } from '@/atoms/Icons';\n\nimport { useValue } from '@/hooks/useValue.js';\nimport { useInternalStatus } from '@/hooks/useInternalStatus.js';\nimport { FormControl, 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\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 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 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 />\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","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","DateField","props","internalId","useId","id","name","label","description","openDatepicker","validationStatus","icon","iconType","errorMessage","disabled","hideRequiredStar","dataTestId","initialValue","initialMin","initialMax","onChange","rest","ref","useRef","internalStatus","useInternalStatus","setValue","useValue","min","max","handleChange","event","handleClickPicker","_a","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,EACf,IAAG,SAAUA,GAAG;AACf,WAAOA,KAAmB,OAAO,UAArB,cAA+BA,EAAE,gBAAgB,UAAUA,MAAM,OAAO,YAAY,WAAW,OAAOA;AAAA,EACtH,GAAKD,EAAQC,CAAC;AACd;ACRe,SAASC,EAAaC,GAAUC,GAAM;AACnD,MAAIA,EAAK,SAASD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e,OAAM,QAAO;AAAA,gBACrEd,MAAmB,aAAa,gBAAAU,EAACI,KAAK,MAAK,gBAAe,OAAM,QAAO;AAAA,cAAA,GAC1E;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA,GACF;AAAA,IAAA;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
2
2
|
import { c as r } from "../../index-Cu0xwYjD.js";
|
3
3
|
import { useId as D } from "react";
|
4
|
-
|
4
|
+
/* empty css */
|
5
5
|
import { Icon as c } from "../../atoms/Icons/Icon.js";
|
6
6
|
import "../../atoms/Icons/contexts/IconsContext.js";
|
7
7
|
import { useValue as N } from "../../hooks/useValue.js";
|
@@ -1,50 +1,50 @@
|
|
1
|
-
import { jsxs as
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
2
2
|
import { useInternalStatus as h } from "../../hooks/useInternalStatus.js";
|
3
|
-
import { FormLabel as
|
3
|
+
import { FormLabel as S } from "./FormLabel.js";
|
4
4
|
import { Icon as b } from "../../atoms/Icons/Icon.js";
|
5
5
|
import "../../atoms/Icons/contexts/IconsContext.js";
|
6
|
-
import { c as
|
6
|
+
import { c as g } from "../../index-Cu0xwYjD.js";
|
7
7
|
const w = ({
|
8
8
|
id: t,
|
9
|
-
label:
|
10
|
-
description:
|
9
|
+
label: r,
|
10
|
+
description: o,
|
11
11
|
disabled: m,
|
12
|
-
required:
|
12
|
+
required: n,
|
13
13
|
className: i,
|
14
|
-
validationStatus:
|
14
|
+
validationStatus: l = "default",
|
15
15
|
children: p,
|
16
|
-
errorMessage:
|
17
|
-
dataTestId:
|
18
|
-
dataName:
|
19
|
-
hideRequiredStar:
|
20
|
-
layout:
|
16
|
+
errorMessage: a,
|
17
|
+
dataTestId: c,
|
18
|
+
dataName: d,
|
19
|
+
hideRequiredStar: x,
|
20
|
+
layout: f
|
21
21
|
}) => {
|
22
22
|
const u = h({
|
23
23
|
isDisabled: !!m,
|
24
|
-
validationStatus:
|
25
|
-
}) === "error" &&
|
26
|
-
return
|
24
|
+
validationStatus: l
|
25
|
+
}) === "error" && a;
|
26
|
+
return /* @__PURE__ */ s(
|
27
27
|
"div",
|
28
28
|
{
|
29
|
-
className:
|
30
|
-
"data-name":
|
31
|
-
"data-testid":
|
29
|
+
className: g("flex flex-col gap-4", i),
|
30
|
+
"data-name": d,
|
31
|
+
"data-testid": c,
|
32
32
|
children: [
|
33
|
-
|
34
|
-
|
33
|
+
r && t && /* @__PURE__ */ e(
|
34
|
+
S,
|
35
35
|
{
|
36
|
-
description:
|
36
|
+
description: o,
|
37
37
|
id: t,
|
38
|
-
layout:
|
39
|
-
required:
|
40
|
-
hideRequiredStar:
|
41
|
-
children:
|
38
|
+
layout: f,
|
39
|
+
required: n,
|
40
|
+
hideRequiredStar: x,
|
41
|
+
children: r
|
42
42
|
}
|
43
43
|
),
|
44
44
|
p,
|
45
|
-
u && /* @__PURE__ */
|
46
|
-
/* @__PURE__ */
|
47
|
-
|
45
|
+
u && /* @__PURE__ */ s("span", { className: "text-red text-b4 flex items-start gap-x-4 px-20", children: [
|
46
|
+
/* @__PURE__ */ e(b, { name: "Error", width: "20px" }),
|
47
|
+
a
|
48
48
|
] })
|
49
49
|
]
|
50
50
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormControl.js","sources":["../../../lib/molecules/Forms/FormControl.tsx"],"sourcesContent":["import { HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';\nimport { useInternalStatus, ValidationStatus } from '@/hooks/useInternalStatus';\nimport { FormLabel, FormLabelProps } from './FormLabel';\nimport { Icon } from '@/atoms/Icons';\nimport classnames from 'classnames';\n\nexport type FormControlProps<\n Value = unknown,\n Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>,\n> = {\n value?: Value;\n label?: ReactNode;\n validationStatus?: ValidationStatus;\n onChange?: (name: string, value: Value) => void;\n dataTestId?: string;\n dataName?: string;\n errorMessage?: string;\n} & Omit<Attributes & Partial<FormLabelProps>, 'onChange' | 'value'>;\n\nexport const FormControl = <Value = string,>({\n id,\n label,\n description,\n disabled,\n required,\n className,\n validationStatus = 'default',\n children,\n errorMessage,\n dataTestId,\n dataName,\n hideRequiredStar,\n layout,\n}: FormControlProps<Value>) => {\n const internalStatus = useInternalStatus({\n isDisabled: !!disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n
|
1
|
+
{"version":3,"file":"FormControl.js","sources":["../../../lib/molecules/Forms/FormControl.tsx"],"sourcesContent":["import { HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';\nimport { useInternalStatus, ValidationStatus } from '@/hooks/useInternalStatus';\nimport { FormLabel, FormLabelProps } from './FormLabel';\nimport { Icon } from '@/atoms/Icons';\nimport classnames from 'classnames';\n\nexport type FormControlProps<\n Value = unknown,\n Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>,\n> = {\n value?: Value;\n label?: ReactNode;\n validationStatus?: ValidationStatus;\n onChange?: (name: string, value: Value) => void;\n dataTestId?: string;\n dataName?: string;\n errorMessage?: string;\n} & Omit<Attributes & Partial<FormLabelProps>, 'onChange' | 'value'>;\n\nexport const FormControl = <Value = string,>({\n id,\n label,\n description,\n disabled,\n required,\n className,\n validationStatus = 'default',\n children,\n errorMessage,\n dataTestId,\n dataName,\n hideRequiredStar,\n layout,\n}: FormControlProps<Value>) => {\n const internalStatus = useInternalStatus({\n isDisabled: !!disabled,\n validationStatus,\n });\n\n const shouldDisplayErrorMessage = internalStatus === 'error' && errorMessage;\n\n return (\n <div\n className={classnames('flex flex-col gap-4', className)}\n data-name={dataName}\n data-testid={dataTestId}\n >\n {label && id && (\n <FormLabel\n description={description}\n id={id}\n layout={layout}\n required={required}\n hideRequiredStar={hideRequiredStar}\n >\n {label}\n </FormLabel>\n )}\n\n {children}\n\n {shouldDisplayErrorMessage && (\n <span className=\"text-red text-b4 flex items-start gap-x-4 px-20\">\n <Icon name=\"Error\" width=\"20px\" />\n {errorMessage}\n </span>\n )}\n </div>\n );\n};\n"],"names":["FormControl","id","label","description","disabled","required","className","validationStatus","children","errorMessage","dataTestId","dataName","hideRequiredStar","layout","shouldDisplayErrorMessage","useInternalStatus","jsxs","classnames","jsx","FormLabel","Icon"],"mappings":";;;;;;AAmBO,MAAMA,IAAc,CAAkB;AAAA,EAC3C,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,QAAAC;AACF,MAA+B;AAMvB,QAAAC,IALiBC,EAAkB;AAAA,IACvC,YAAY,CAAC,CAACX;AAAA,IACd,kBAAAG;AAAA,EAAA,CACD,MAEoD,WAAWE;AAG9D,SAAA,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,uBAAuBX,CAAS;AAAA,MACtD,aAAWK;AAAA,MACX,eAAaD;AAAA,MAEZ,UAAA;AAAA,QAAAR,KAASD,KACR,gBAAAiB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,aAAAhB;AAAA,YACA,IAAAF;AAAA,YACA,QAAAY;AAAA,YACA,UAAAR;AAAA,YACA,kBAAAO;AAAA,YAEC,UAAAV;AAAA,UAAA;AAAA,QACH;AAAA,QAGDM;AAAA,QAEAM,KACC,gBAAAE,EAAC,QAAK,EAAA,WAAU,mDACd,UAAA;AAAA,UAAA,gBAAAE,EAACE,GAAK,EAAA,MAAK,SAAQ,OAAM,QAAO;AAAA,UAC/BX;AAAA,QAAA,GACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
@@ -25,20 +25,19 @@ export declare function useNumberField(props: NumberFieldProps): {
|
|
25
25
|
className?: string | undefined;
|
26
26
|
style?: import("react").CSSProperties | undefined;
|
27
27
|
children?: import("react").ReactNode;
|
28
|
-
prefix?: string | undefined;
|
29
28
|
form?: string | undefined;
|
30
|
-
list?: string | undefined;
|
31
|
-
role?: import("react").AriaRole | undefined;
|
32
29
|
slot?: string | undefined;
|
33
30
|
title?: string | undefined;
|
34
31
|
pattern?: string | undefined;
|
32
|
+
list?: string | undefined;
|
33
|
+
role?: import("react").AriaRole | undefined;
|
35
34
|
suppressHydrationWarning?: boolean | undefined;
|
36
35
|
height?: string | number | undefined;
|
37
36
|
lang?: string | undefined;
|
38
37
|
tabIndex?: number | undefined;
|
39
38
|
"aria-activedescendant"?: string | undefined;
|
40
39
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
41
|
-
"aria-autocomplete"?: "
|
40
|
+
"aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
|
42
41
|
"aria-braillelabel"?: string | undefined;
|
43
42
|
"aria-brailleroledescription"?: string | undefined;
|
44
43
|
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
@@ -58,7 +57,7 @@ export declare function useNumberField(props: NumberFieldProps): {
|
|
58
57
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
59
58
|
"aria-flowto"?: string | undefined;
|
60
59
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
61
|
-
"aria-haspopup"?: boolean | "dialog" | "
|
60
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined;
|
62
61
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
63
62
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
64
63
|
"aria-keyshortcuts"?: string | undefined;
|
@@ -276,6 +275,7 @@ export declare function useNumberField(props: NumberFieldProps): {
|
|
276
275
|
content?: string | undefined;
|
277
276
|
datatype?: string | undefined;
|
278
277
|
inlist?: any;
|
278
|
+
prefix?: string | undefined;
|
279
279
|
property?: string | undefined;
|
280
280
|
rel?: string | undefined;
|
281
281
|
resource?: string | undefined;
|
@@ -293,11 +293,11 @@ export declare function useNumberField(props: NumberFieldProps): {
|
|
293
293
|
results?: number | undefined;
|
294
294
|
security?: string | undefined;
|
295
295
|
unselectable?: "on" | "off" | undefined;
|
296
|
-
inputMode?: "search" | "
|
296
|
+
inputMode?: "search" | "text" | "none" | "url" | "tel" | "email" | "numeric" | "decimal" | undefined;
|
297
297
|
is?: string | undefined;
|
298
|
-
autoComplete?: import("react").HTMLInputAutoCompleteAttribute | undefined;
|
299
298
|
alt?: string | undefined;
|
300
299
|
src?: string | undefined;
|
300
|
+
autoComplete?: import("react").HTMLInputAutoCompleteAttribute | undefined;
|
301
301
|
accept?: string | undefined;
|
302
302
|
capture?: boolean | "user" | "environment" | undefined;
|
303
303
|
checked?: boolean | undefined;
|
@@ -2,7 +2,7 @@ import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { c as b } from "../../../index-Cu0xwYjD.js";
|
3
3
|
import { useId as k } from "react";
|
4
4
|
import { useValue as w } from "../../../hooks/useValue.js";
|
5
|
-
|
5
|
+
/* empty css */
|
6
6
|
function R(d) {
|
7
7
|
const n = k(), {
|
8
8
|
id: o = n,
|
package/molecules/Forms/Range.js
CHANGED
@@ -339,8 +339,7 @@ function Pe(e) {
|
|
339
339
|
N(() => (f.current = !0, () => void (f.current = !1)));
|
340
340
|
const [T, m, h] = de(() => {
|
341
341
|
const c = () => {
|
342
|
-
if (!o.current.element)
|
343
|
-
return;
|
342
|
+
if (!o.current.element) return;
|
344
343
|
const {
|
345
344
|
left: z,
|
346
345
|
top: B,
|
@@ -399,8 +398,7 @@ function Fe(e, t) {
|
|
399
398
|
}
|
400
399
|
function ve(e) {
|
401
400
|
const t = [];
|
402
|
-
if (!e || e === document.body)
|
403
|
-
return t;
|
401
|
+
if (!e || e === document.body) return t;
|
404
402
|
const {
|
405
403
|
overflow: r,
|
406
404
|
overflowX: n,
|