@clubmed/trident-ui 1.0.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 +15 -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 +41 -39
- package/molecules/Forms/DateField.js.map +1 -1
- package/molecules/Forms/Filter.js +1 -1
- package/molecules/Forms/FormControl.d.ts +1 -1
- package/molecules/Forms/FormControl.js +23 -12
- package/molecules/Forms/FormControl.js.map +1 -1
- package/molecules/Forms/FormLabel.d.ts +2 -1
- package/molecules/Forms/FormLabel.js +20 -19
- package/molecules/Forms/FormLabel.js.map +1 -1
- package/molecules/Forms/NumberField.d.ts +8 -7
- package/molecules/Forms/NumberField.js +42 -40
- package/molecules/Forms/NumberField.js.map +1 -1
- package/molecules/Forms/Password/Password.js +23 -21
- package/molecules/Forms/Password/Password.js.map +1 -1
- 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/Select.js +18 -16
- package/molecules/Forms/Select.js.map +1 -1
- package/molecules/Forms/Switch.js +1 -1
- package/molecules/Forms/TextField.d.ts +2 -0
- package/molecules/Forms/TextField.js +33 -30
- 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(), {
|
@@ -16,25 +16,25 @@ 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
|
-
function
|
21
|
+
function A(t) {
|
22
22
|
F(1, arguments);
|
23
23
|
var e = Object.prototype.toString.call(t);
|
24
24
|
return t instanceof Date || T(t) === "object" && e === "[object Date]" ? new Date(t.getTime()) : typeof t == "number" || e === "[object Number]" ? new Date(t) : ((typeof t == "string" || e === "[object String]") && typeof console < "u" && (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"), console.warn(new Error().stack)), /* @__PURE__ */ new Date(NaN));
|
25
25
|
}
|
26
26
|
function l(t, e) {
|
27
|
-
for (var i = t < 0 ? "-" : "",
|
28
|
-
|
29
|
-
return i +
|
27
|
+
for (var i = t < 0 ? "-" : "", n = Math.abs(t).toString(); n.length < e; )
|
28
|
+
n = "0" + n;
|
29
|
+
return i + n;
|
30
30
|
}
|
31
|
-
function
|
32
|
-
var i,
|
31
|
+
function H(t, e) {
|
32
|
+
var i, n;
|
33
33
|
F(1, arguments);
|
34
|
-
var o =
|
34
|
+
var o = A(t);
|
35
35
|
if (isNaN(o.getTime()))
|
36
36
|
throw new RangeError("Invalid time value");
|
37
|
-
var d = String((i = e == null ? void 0 : e.format) !== null && i !== void 0 ? i : "extended"), c = String((
|
37
|
+
var d = String((i = e == null ? void 0 : e.format) !== null && i !== void 0 ? i : "extended"), c = String((n = e == null ? void 0 : e.representation) !== null && n !== void 0 ? n : "complete");
|
38
38
|
if (d !== "extended" && d !== "basic")
|
39
39
|
throw new RangeError("format must be 'extended' or 'basic'");
|
40
40
|
if (c !== "date" && c !== "time" && c !== "complete")
|
@@ -47,19 +47,19 @@ function A(t, e) {
|
|
47
47
|
if (c !== "date") {
|
48
48
|
var p = o.getTimezoneOffset();
|
49
49
|
if (p !== 0) {
|
50
|
-
var h = Math.abs(p), S = l(Math.floor(h / 60), 2),
|
51
|
-
f = "".concat(
|
50
|
+
var h = Math.abs(p), S = l(Math.floor(h / 60), 2), N = l(h % 60, 2), b = p < 0 ? "+" : "-";
|
51
|
+
f = "".concat(b).concat(S, ":").concat(N);
|
52
52
|
} else
|
53
53
|
f = "Z";
|
54
|
-
var
|
54
|
+
var k = l(o.getHours(), 2), y = l(o.getMinutes(), 2), a = l(o.getSeconds(), 2), j = s === "" ? "" : "T", C = [k, y, a].join(w);
|
55
55
|
s = "".concat(s).concat(j).concat(C).concat(f);
|
56
56
|
}
|
57
57
|
return s;
|
58
58
|
}
|
59
|
-
const M = (t) => t ?
|
59
|
+
const M = (t) => t ? H(new Date(t), { representation: "date" }) : "", X = (t) => {
|
60
60
|
const e = _(), {
|
61
61
|
id: i = e,
|
62
|
-
name:
|
62
|
+
name: n = i,
|
63
63
|
label: o,
|
64
64
|
description: d,
|
65
65
|
openDatepicker: c,
|
@@ -69,22 +69,23 @@ const M = (t) => t ? A(t, { representation: "date" }) : "", W = (t) => {
|
|
69
69
|
errorMessage: w,
|
70
70
|
disabled: r = !1,
|
71
71
|
required: v = !1,
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
hideRequiredStar: D,
|
73
|
+
dataTestId: p = "DateField",
|
74
|
+
value: h,
|
75
|
+
min: S,
|
76
|
+
max: N,
|
76
77
|
onChange: b,
|
77
|
-
...
|
78
|
-
} = t, y = z(null),
|
78
|
+
...k
|
79
|
+
} = t, y = z(null), a = Z({
|
79
80
|
isDisabled: r,
|
80
81
|
validationStatus: s
|
81
|
-
}), { setValue:
|
82
|
-
name:
|
82
|
+
}), { setValue: j, value: C } = G({
|
83
|
+
name: n,
|
83
84
|
formatter: M,
|
84
|
-
initialValue:
|
85
|
+
initialValue: h,
|
85
86
|
onChange: (u, V) => b == null ? void 0 : b(u, new Date(V))
|
86
|
-
}),
|
87
|
-
|
87
|
+
}), R = M(S), O = M(N), q = (u) => {
|
88
|
+
j(u.target.value);
|
88
89
|
}, P = () => {
|
89
90
|
var u;
|
90
91
|
(u = y.current) == null || u.showPicker();
|
@@ -96,36 +97,37 @@ const M = (t) => t ? A(t, { representation: "date" }) : "", W = (t) => {
|
|
96
97
|
label: o,
|
97
98
|
description: d,
|
98
99
|
dataName: "DateField",
|
99
|
-
dataTestId:
|
100
|
+
dataTestId: p,
|
100
101
|
disabled: r,
|
101
102
|
required: v,
|
103
|
+
hideRequiredStar: D,
|
102
104
|
validationStatus: s,
|
103
105
|
errorMessage: w,
|
104
106
|
children: /* @__PURE__ */ x("div", { className: "relative", children: [
|
105
107
|
/* @__PURE__ */ m(
|
106
108
|
"input",
|
107
109
|
{
|
108
|
-
...
|
110
|
+
...k,
|
109
111
|
type: "date",
|
110
112
|
className: E(
|
111
113
|
"text-b3 rounded-pill date-field min-h-[50px] w-full border px-20 py-12 ps-[52px] font-normal outline-none",
|
112
114
|
{
|
113
|
-
"border-lightGrey focus:border-black active:border-black":
|
114
|
-
"pe-[52px]":
|
115
|
+
"border-lightGrey focus:border-black active:border-black": a === "default",
|
116
|
+
"pe-[52px]": a === "error" || a === "success",
|
115
117
|
"bg-pearl text-grey": r,
|
116
118
|
"bg-white text-black": !r,
|
117
|
-
"border-red": !r &&
|
118
|
-
"border-green": !r &&
|
119
|
+
"border-red": !r && a === "error",
|
120
|
+
"border-green": !r && a === "success"
|
119
121
|
}
|
120
122
|
),
|
121
123
|
id: i,
|
122
124
|
disabled: r,
|
123
125
|
required: v,
|
124
126
|
ref: y,
|
125
|
-
value:
|
126
|
-
min:
|
127
|
+
value: C,
|
128
|
+
min: R,
|
127
129
|
max: O,
|
128
|
-
onChange:
|
130
|
+
onChange: q
|
129
131
|
}
|
130
132
|
),
|
131
133
|
/* @__PURE__ */ x(
|
@@ -135,8 +137,8 @@ const M = (t) => t ? A(t, { representation: "date" }) : "", W = (t) => {
|
|
135
137
|
"pointer-events-none absolute inset-0 flex items-center justify-between px-20 py-12",
|
136
138
|
{
|
137
139
|
"text-grey": r,
|
138
|
-
"text-red": !r &&
|
139
|
-
"text-green": !r &&
|
140
|
+
"text-red": !r && a === "error",
|
141
|
+
"text-green": !r && a === "success"
|
140
142
|
}
|
141
143
|
),
|
142
144
|
children: [
|
@@ -145,8 +147,8 @@ const M = (t) => t ? A(t, { representation: "date" }) : "", W = (t) => {
|
|
145
147
|
/* @__PURE__ */ m("span", { className: "sr-only", children: c })
|
146
148
|
] }),
|
147
149
|
/* @__PURE__ */ x("span", { className: "ms-auto flex gap-x-8", children: [
|
148
|
-
|
149
|
-
|
150
|
+
a === "error" && /* @__PURE__ */ m(I, { name: "CrossDefault", width: "24px" }),
|
151
|
+
a === "success" && /* @__PURE__ */ m(I, { name: "CheckDefault", width: "24px" })
|
150
152
|
] })
|
151
153
|
]
|
152
154
|
}
|
@@ -156,6 +158,6 @@ const M = (t) => t ? A(t, { representation: "date" }) : "", W = (t) => {
|
|
156
158
|
);
|
157
159
|
};
|
158
160
|
export {
|
159
|
-
|
161
|
+
X as DateField
|
160
162
|
};
|
161
163
|
//# sourceMappingURL=DateField.js.map
|
@@ -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 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 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","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;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,QAAS,CAAA,IACzB,OAAOA,KAAa,YAAYC,MAAW,oBAC7C,IAAI,KAAKD,CAAQ,MAEnB,OAAOA,KAAa,YAAYC,MAAW,sBAAsB,OAAO,UAAY,QAEvF,QAAQ,KAAK,oNAAoN,GAEjO,QAAQ,KA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AAA,YACA,UAAAS;AAAA,YACA,UAAAjD;AAAA,YACA,KAAAwD;AAAA,YACA,OAAArB;AAAA,YACA,KAAA2B;AAAA,YACA,KAAAC;AAAA,YACA,UAAUC;AAAA,UAAA;AAAA,QACZ;AAAA,QACA,gBAAAM;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,cACA;AAAA,gBACE,aAAatB;AAAA,gBACb,YAAY,CAACA,KAAYS,MAAmB;AAAA,gBAC5C,cAAc,CAACT,KAAYS,MAAmB;AAAA,cAChD;AAAA,YACF;AAAA,YAEA,UAAA;AAAA,cAAA,gBAAAY,EAAC,UAAO,EAAA,WAAU,oCAAmC,SAASJ,GAC5D,UAAA;AAAA,gBAAA,gBAAAE,EAACI,GAAK,EAAA,MAAM1B,GAAM,UAAAC,GAAoB,OAAM,QAAO;AAAA,gBAClD,gBAAAqB,EAAA,QAAA,EAAK,WAAU,WACb,UAEHxB,GAAA;AAAA,cAAA,GACF;AAAA,cACA,gBAAA0B,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;AAChB,UAAM,IAAI,UAAUA,IAAW,kCAAmEC,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,QAAS,CAAA,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,MAAO,EAAC,KAAK,IAEzB,oBAAI,KAAK,GAAG;AAEvB;ACnDe,SAASC,EAAgBC,GAAQC,GAAc;AAG5D,WAFIC,IAAOF,IAAS,IAAI,MAAM,IAC1BG,IAAS,KAAK,IAAIH,CAAM,EAAE,SAAQ,GAC/BG,EAAO,SAASF;AACrB,IAAAE,IAAS,MAAMA;AAEjB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C;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,cACA;AAAA,gBACE,aAAavB;AAAA,gBACb,YAAY,CAACA,KAAYU,MAAmB;AAAA,gBAC5C,cAAc,CAACV,KAAYU,MAAmB;AAAA,cAChD;AAAA,YACF;AAAA,YAEA,UAAA;AAAA,cAAA,gBAAAY,EAAC,UAAO,EAAA,WAAU,oCAAmC,SAASJ,GAC5D,UAAA;AAAA,gBAAA,gBAAAE,EAACI,GAAK,EAAA,MAAM3B,GAAM,UAAAC,GAAoB,OAAM,QAAO;AAAA,gBAClD,gBAAAsB,EAAA,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,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";
|
@@ -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, 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, InputHTMLAttributes<HTMLInputElement>>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
2
|
-
import { useInternalStatus as
|
3
|
-
import { FormLabel as
|
4
|
-
import { Icon as
|
2
|
+
import { useInternalStatus as h } from "../../hooks/useInternalStatus.js";
|
3
|
+
import { FormLabel as S } from "./FormLabel.js";
|
4
|
+
import { Icon as b } from "../../atoms/Icons/Icon.js";
|
5
5
|
import "../../atoms/Icons/contexts/IconsContext.js";
|
6
|
-
import { c as
|
7
|
-
const
|
6
|
+
import { c as g } from "../../index-Cu0xwYjD.js";
|
7
|
+
const w = ({
|
8
8
|
id: t,
|
9
9
|
label: r,
|
10
10
|
description: o,
|
@@ -16,23 +16,34 @@ const v = ({
|
|
16
16
|
errorMessage: a,
|
17
17
|
dataTestId: c,
|
18
18
|
dataName: d,
|
19
|
-
|
19
|
+
hideRequiredStar: x,
|
20
|
+
layout: f
|
20
21
|
}) => {
|
21
|
-
const
|
22
|
+
const u = h({
|
22
23
|
isDisabled: !!m,
|
23
24
|
validationStatus: l
|
24
25
|
}) === "error" && a;
|
25
26
|
return /* @__PURE__ */ s(
|
26
27
|
"div",
|
27
28
|
{
|
28
|
-
className:
|
29
|
+
className: g("flex flex-col gap-4", i),
|
29
30
|
"data-name": d,
|
30
31
|
"data-testid": c,
|
31
32
|
children: [
|
32
|
-
r && t && /* @__PURE__ */ e(
|
33
|
+
r && t && /* @__PURE__ */ e(
|
34
|
+
S,
|
35
|
+
{
|
36
|
+
description: o,
|
37
|
+
id: t,
|
38
|
+
layout: f,
|
39
|
+
required: n,
|
40
|
+
hideRequiredStar: x,
|
41
|
+
children: r
|
42
|
+
}
|
43
|
+
),
|
33
44
|
p,
|
34
|
-
|
35
|
-
/* @__PURE__ */ e(
|
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" }),
|
36
47
|
a
|
37
48
|
] })
|
38
49
|
]
|
@@ -40,6 +51,6 @@ const v = ({
|
|
40
51
|
);
|
41
52
|
};
|
42
53
|
export {
|
43
|
-
|
54
|
+
w as FormControl
|
44
55
|
};
|
45
56
|
//# sourceMappingURL=FormControl.js.map
|
@@ -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 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
|
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;"}
|
@@ -3,5 +3,6 @@ export interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
3
3
|
description?: string;
|
4
4
|
layout?: 'horizontal' | 'vertical';
|
5
5
|
required?: boolean;
|
6
|
+
hideRequiredStar?: boolean;
|
6
7
|
}
|
7
|
-
export declare const FormLabel: ({ id, description, layout, required, className, children, ...rest }: FormLabelProps) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
export declare const FormLabel: ({ id, description, layout, required, className, children, hideRequiredStar, ...rest }: FormLabelProps) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,35 +1,36 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c } from "../../index-Cu0xwYjD.js";
|
3
|
-
const
|
4
|
-
id:
|
5
|
-
description:
|
6
|
-
layout:
|
7
|
-
required:
|
8
|
-
className:
|
1
|
+
import { jsxs as c, jsx as l } from "react/jsx-runtime";
|
2
|
+
import { c as x } from "../../index-Cu0xwYjD.js";
|
3
|
+
const f = ({
|
4
|
+
id: s,
|
5
|
+
description: t,
|
6
|
+
layout: e = "horizontal",
|
7
|
+
required: a,
|
8
|
+
className: r,
|
9
9
|
children: m,
|
10
|
-
|
11
|
-
|
10
|
+
hideRequiredStar: n = !a,
|
11
|
+
...o
|
12
|
+
}) => /* @__PURE__ */ c(
|
12
13
|
"label",
|
13
14
|
{
|
14
|
-
...
|
15
|
-
htmlFor:
|
16
|
-
className:
|
15
|
+
...o,
|
16
|
+
htmlFor: s,
|
17
|
+
className: x(
|
17
18
|
"text-b3 font-semibold text-black flex",
|
18
19
|
{
|
19
|
-
"flex-wrap items-center ps-20":
|
20
|
-
"flex-col items-start":
|
20
|
+
"flex-wrap items-center ps-20": e === "horizontal",
|
21
|
+
"flex-col items-start": e === "vertical"
|
21
22
|
},
|
22
|
-
|
23
|
+
r
|
23
24
|
),
|
24
25
|
"data-name": "InputLabel",
|
25
26
|
children: [
|
26
27
|
m,
|
27
|
-
|
28
|
-
|
28
|
+
a && !n && /* @__PURE__ */ l("span", { children: "*" }),
|
29
|
+
t && /* @__PURE__ */ l("span", { className: "ms-12 text-b4 text-grey font-normal", children: t })
|
29
30
|
]
|
30
31
|
}
|
31
32
|
);
|
32
33
|
export {
|
33
|
-
|
34
|
+
f as FormLabel
|
34
35
|
};
|
35
36
|
//# sourceMappingURL=FormLabel.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormLabel.js","sources":["../../../lib/molecules/Forms/FormLabel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { LabelHTMLAttributes } from 'react';\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n description?: string;\n layout?: 'horizontal' | 'vertical';\n required?: boolean;\n}\n\nexport const FormLabel = ({\n id,\n description,\n layout = 'horizontal',\n required,\n className,\n children,\n ...rest\n}: FormLabelProps) => {\n return (\n <label\n {...rest}\n htmlFor={id}\n className={classnames(\n 'text-b3 font-semibold text-black flex',\n {\n 'flex-wrap items-center ps-20': layout === 'horizontal',\n 'flex-col items-start': layout === 'vertical',\n },\n className,\n )}\n data-name=\"InputLabel\"\n >\n {children}\n {required && <span>*</span>}\n {description && <span className=\"ms-12 text-b4 text-grey font-normal\">{description}</span>}\n </label>\n );\n};\n"],"names":["FormLabel","id","description","layout","required","className","children","rest","jsxs","classnames","jsx"],"mappings":";;
|
1
|
+
{"version":3,"file":"FormLabel.js","sources":["../../../lib/molecules/Forms/FormLabel.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { LabelHTMLAttributes } from 'react';\n\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n description?: string;\n layout?: 'horizontal' | 'vertical';\n required?: boolean;\n hideRequiredStar?: boolean;\n}\n\nexport const FormLabel = ({\n id,\n description,\n layout = 'horizontal',\n required,\n className,\n children,\n hideRequiredStar = !required,\n ...rest\n}: FormLabelProps) => {\n return (\n <label\n {...rest}\n htmlFor={id}\n className={classnames(\n 'text-b3 font-semibold text-black flex',\n {\n 'flex-wrap items-center ps-20': layout === 'horizontal',\n 'flex-col items-start': layout === 'vertical',\n },\n className,\n )}\n data-name=\"InputLabel\"\n >\n {children}\n {required && !hideRequiredStar && <span>*</span>}\n {description && <span className=\"ms-12 text-b4 text-grey font-normal\">{description}</span>}\n </label>\n );\n};\n"],"names":["FormLabel","id","description","layout","required","className","children","hideRequiredStar","rest","jsxs","classnames","jsx"],"mappings":";;AAUO,MAAMA,IAAY,CAAC;AAAA,EACxB,IAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC,IAAmB,CAACH;AAAA,EACpB,GAAGI;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,SAASP;AAAA,IACT,WAAWS;AAAA,MACT;AAAA,MACA;AAAA,QACE,gCAAgCP,MAAW;AAAA,QAC3C,wBAAwBA,MAAW;AAAA,MACrC;AAAA,MACAE;AAAA,IACF;AAAA,IACA,aAAU;AAAA,IAET,UAAA;AAAA,MAAAC;AAAA,MACAF,KAAY,CAACG,KAAoB,gBAAAI,EAAC,UAAK,UAAC,KAAA;AAAA,MACxCT,KAAe,gBAAAS,EAAC,QAAK,EAAA,WAAU,uCAAuC,UAAYT,GAAA;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
@@ -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;
|
@@ -313,6 +313,7 @@ export declare function useNumberField(props: NumberFieldProps): {
|
|
313
313
|
htmlFor?: string | undefined;
|
314
314
|
layout?: "horizontal" | "vertical" | undefined;
|
315
315
|
description?: string | undefined;
|
316
|
+
hideRequiredStar?: boolean | undefined;
|
316
317
|
};
|
317
318
|
export declare const NumberField: (props: NumberFieldProps) => import("react/jsx-runtime").JSX.Element;
|
318
319
|
export {};
|